@vireocodedev/ui · 0.3.2

@vireocodedev/ui/country

21 public exports generated from the shipped declaration graph.

Showing all 21 exports

Country and territory identifiers with 3:2 flag assets shipped by country-flag-icons.

/** Country and territory identifiers with 3:2 flag assets shipped by country-flag-icons. */
export declare const COUNTRY_CODES: readonly [
    "AC",
    "AD",
    "AE",
    "AF",
    "AG",
    "AI",
    "AL",
    "AM",
    "AO",
    "AQ",
    "AR",
    "AS",
    "AT",
    "AU",
    "AW",
    "AX",
    "AZ",
    "BA",
    "BB",
    "BD",
    "BE",
    "BF",
    "BG",
    "BH",
    "BI",
    "BJ",
    "BL",
    "BM",
    "BN",
    "BO",
    "BQ-BO",
    "BQ-SA",
    "BQ-SE",
    "BQ",
    "BR",
    "BS",
    "BT",
    "BV",
    "BW",
    "BY",
    "BZ",
    "CA",
    "CC",
    "CD",
    "CF",
    "CG",
    "CH",
    "CI",
    "CK",
    "CL",
    "CM",
    "CN",
    "CO",
    "CR",
    "CU",
    "CV",
    "CW",
    "CX",
    "CY",
    "CZ",
    "DE",
    "DJ",
    "DK",
    "DM",
    "DO",
    "DZ",
    "EC",
    "EE",
    "EG",
    "EH",
    "ER",
    "ES-CT",
    "ES",
    "ET",
    "EU",
    "FI",
    "FJ",
    "FK",
    "FM",
    "FO",
    "FR",
    "GA",
    "GB-ENG",
    "GB-NIR",
    "GB-SCT",
    "GB-WLS",
    "GB",
    "GD",
    "GE",
    "GF",
    "GG",
    "GH",
    "GI",
    "GL",
    "GM",
    "GN",
    "GP",
    "GQ",
    "GR",
    "GS",
    "GT",
    "GU",
    "GW",
    "GY",
    "HK",
    "HM",
    "HN",
    "HR",
    "HT",
    "HU",
    "IC",
    "ID",
    "IE",
    "IL",
    "IM",
    "IN",
    "IO",
    "IQ",
    "IR",
    "IS",
    "IT",
    "JE",
    "JM",
    "JO",
    "JP",
    "KE",
    "KG",
    "KH",
    "KI",
    "KM",
    "KN",
    "KP",
    "KR",
    "KW",
    "KY",
    "KZ",
    "LA",
    "LB",
    "LC",
    "LI",
    "LK",
    "LR",
    "LS",
    "LT",
    "LU",
    "LV",
    "LY",
    "MA",
    "MC",
    "MD",
    "ME",
    "MF",
    "MG",
    "MH",
    "MK",
    "ML",
    "MM",
    "MN",
    "MO",
    "MP",
    "MQ",
    "MR",
    "MS",
    "MT",
    "MU",
    "MV",
    "MW",
    "MX",
    "MY",
    "MZ",
    "NA",
    "NC",
    "NE",
    "NF",
    "NG",
    "NI",
    "NL",
    "NO",
    "NP",
    "NR",
    "NU",
    "NZ",
    "OM",
    "PA",
    "PE",
    "PF",
    "PG",
    "PH",
    "PK",
    "PL",
    "PM",
    "PN",
    "PR",
    "PS",
    "PT",
    "PW",
    "PY",
    "QA",
    "RE",
    "RO",
    "RS",
    "RU",
    "RW",
    "SA",
    "SB",
    "SC",
    "SD",
    "SE",
    "SG",
    "SH",
    "SI",
    "SJ",
    "SK",
    "SL",
    "SM",
    "SN",
    "SO",
    "SR",
    "SS",
    "ST",
    "SV",
    "SX",
    "SY",
    "SZ",
    "TA",
    "TC",
    "TD",
    "TF",
    "TG",
    "TH",
    "TJ",
    "TK",
    "TL",
    "TM",
    "TN",
    "TO",
    "TR",
    "TT",
    "TV",
    "TW",
    "TZ",
    "UA",
    "UG",
    "UM",
    "US",
    "UY",
    "UZ",
    "VA",
    "VC",
    "VE",
    "VG",
    "VI",
    "VN",
    "VU",
    "WF",
    "WS",
    "XA",
    "XC",
    "XK",
    "XO",
    "YE",
    "YT",
    "ZA",
    "ZM",
    "ZW"
];

Identifier backed by a 3:2 flag asset in country-flag-icons.

/** Identifier backed by a 3:2 flag asset in country-flag-icons. */
export type CountryCode = z.infer<typeof CountryCodeSchema>;

Runtime schema for identifiers backed by country-flag-icons.

/** Runtime schema for identifiers backed by country-flag-icons. */
export declare const CountryCodeSchema: z.ZodEnum<{
    AC: "AC";
    AD: "AD";
    AE: "AE";
    AF: "AF";
    AG: "AG";
    AI: "AI";
    AL: "AL";
    AM: "AM";
    AO: "AO";
    AQ: "AQ";
    AR: "AR";
    AS: "AS";
    AT: "AT";
    AU: "AU";
    AW: "AW";
    AX: "AX";
    AZ: "AZ";
    BA: "BA";
    BB: "BB";
    BD: "BD";
    BE: "BE";
    BF: "BF";
    BG: "BG";
    BH: "BH";
    BI: "BI";
    BJ: "BJ";
    BL: "BL";
    BM: "BM";
    BN: "BN";
    BO: "BO";
    BQ: "BQ";
    "BQ-BO": "BQ-BO";
    "BQ-SA": "BQ-SA";
    "BQ-SE": "BQ-SE";
    BR: "BR";
    BS: "BS";
    BT: "BT";
    BV: "BV";
    BW: "BW";
    BY: "BY";
    BZ: "BZ";
    CA: "CA";
    CC: "CC";
    CD: "CD";
    CF: "CF";
    CG: "CG";
    CH: "CH";
    CI: "CI";
    CK: "CK";
    CL: "CL";
    CM: "CM";
    CN: "CN";
    CO: "CO";
    CR: "CR";
    CU: "CU";
    CV: "CV";
    CW: "CW";
    CX: "CX";
    CY: "CY";
    CZ: "CZ";
    DE: "DE";
    DJ: "DJ";
    DK: "DK";
    DM: "DM";
    DO: "DO";
    DZ: "DZ";
    EC: "EC";
    EE: "EE";
    EG: "EG";
    EH: "EH";
    ER: "ER";
    ES: "ES";
    "ES-CT": "ES-CT";
    ET: "ET";
    EU: "EU";
    FI: "FI";
    FJ: "FJ";
    FK: "FK";
    FM: "FM";
    FO: "FO";
    FR: "FR";
    GA: "GA";
    GB: "GB";
    "GB-ENG": "GB-ENG";
    "GB-NIR": "GB-NIR";
    "GB-SCT": "GB-SCT";
    "GB-WLS": "GB-WLS";
    GD: "GD";
    GE: "GE";
    GF: "GF";
    GG: "GG";
    GH: "GH";
    GI: "GI";
    GL: "GL";
    GM: "GM";
    GN: "GN";
    GP: "GP";
    GQ: "GQ";
    GR: "GR";
    GS: "GS";
    GT: "GT";
    GU: "GU";
    GW: "GW";
    GY: "GY";
    HK: "HK";
    HM: "HM";
    HN: "HN";
    HR: "HR";
    HT: "HT";
    HU: "HU";
    IC: "IC";
    ID: "ID";
    IE: "IE";
    IL: "IL";
    IM: "IM";
    IN: "IN";
    IO: "IO";
    IQ: "IQ";
    IR: "IR";
    IS: "IS";
    IT: "IT";
    JE: "JE";
    JM: "JM";
    JO: "JO";
    JP: "JP";
    KE: "KE";
    KG: "KG";
    KH: "KH";
    KI: "KI";
    KM: "KM";
    KN: "KN";
    KP: "KP";
    KR: "KR";
    KW: "KW";
    KY: "KY";
    KZ: "KZ";
    LA: "LA";
    LB: "LB";
    LC: "LC";
    LI: "LI";
    LK: "LK";
    LR: "LR";
    LS: "LS";
    LT: "LT";
    LU: "LU";
    LV: "LV";
    LY: "LY";
    MA: "MA";
    MC: "MC";
    MD: "MD";
    ME: "ME";
    MF: "MF";
    MG: "MG";
    MH: "MH";
    MK: "MK";
    ML: "ML";
    MM: "MM";
    MN: "MN";
    MO: "MO";
    MP: "MP";
    MQ: "MQ";
    MR: "MR";
    MS: "MS";
    MT: "MT";
    MU: "MU";
    MV: "MV";
    MW: "MW";
    MX: "MX";
    MY: "MY";
    MZ: "MZ";
    NA: "NA";
    NC: "NC";
    NE: "NE";
    NF: "NF";
    NG: "NG";
    NI: "NI";
    NL: "NL";
    NO: "NO";
    NP: "NP";
    NR: "NR";
    NU: "NU";
    NZ: "NZ";
    OM: "OM";
    PA: "PA";
    PE: "PE";
    PF: "PF";
    PG: "PG";
    PH: "PH";
    PK: "PK";
    PL: "PL";
    PM: "PM";
    PN: "PN";
    PR: "PR";
    PS: "PS";
    PT: "PT";
    PW: "PW";
    PY: "PY";
    QA: "QA";
    RE: "RE";
    RO: "RO";
    RS: "RS";
    RU: "RU";
    RW: "RW";
    SA: "SA";
    SB: "SB";
    SC: "SC";
    SD: "SD";
    SE: "SE";
    SG: "SG";
    SH: "SH";
    SI: "SI";
    SJ: "SJ";
    SK: "SK";
    SL: "SL";
    SM: "SM";
    SN: "SN";
    SO: "SO";
    SR: "SR";
    SS: "SS";
    ST: "ST";
    SV: "SV";
    SX: "SX";
    SY: "SY";
    SZ: "SZ";
    TA: "TA";
    TC: "TC";
    TD: "TD";
    TF: "TF";
    TG: "TG";
    TH: "TH";
    TJ: "TJ";
    TK: "TK";
    TL: "TL";
    TM: "TM";
    TN: "TN";
    TO: "TO";
    TR: "TR";
    TT: "TT";
    TV: "TV";
    TW: "TW";
    TZ: "TZ";
    UA: "UA";
    UG: "UG";
    UM: "UM";
    US: "US";
    UY: "UY";
    UZ: "UZ";
    VA: "VA";
    VC: "VC";
    VE: "VE";
    VG: "VG";
    VI: "VI";
    VN: "VN";
    VU: "VU";
    WF: "WF";
    WS: "WS";
    XA: "XA";
    XC: "XC";
    XK: "XK";
    XO: "XO";
    YE: "YE";
    YT: "YT";
    ZA: "ZA";
    ZM: "ZM";
    ZW: "ZW";
}>;

Options for resolving a localized country or territory display name.

/** Options for resolving a localized country or territory display name. */
export type CountryNameOptions = {
    /** Already-localized names that take precedence over Vireo and platform data. */
    overrides?: Partial<Record<CountryCode, string>>;
};

Renders a country-flag-icons registry identifier through a consistent, accessible 3:2 flag surface.

/**
 * Renders a country-flag-icons registry identifier through a consistent, accessible 3:2 flag surface.
 */
export declare const VireoCountryFlag: React.ForwardRefExoticComponent<Omit<VireoCountryFlagProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;

Valid keys for VireoCountryFlag utility classes and theme style overrides.

/** Valid keys for VireoCountryFlag utility classes and theme style overrides. */
export type VireoCountryFlagClassKey = keyof VireoCountryFlagClasses;

Utility classes available to VireoCountryFlag.

/** Utility classes available to VireoCountryFlag. */
export type VireoCountryFlagClasses = Record<VireoCountryFlagSlotName | "known" | "unknown" | "tooltipEnabled", string>;

Known country codes retain autocomplete while arbitrary strings remain renderable as unknown flags.

/** Known country codes retain autocomplete while arbitrary strings remain renderable as unknown flags. */
export type VireoCountryFlagCode = CountryCode | (string & {});

Props VireoCountryFlag inherits from its default root after excluding protected component-owned props.

/** Props VireoCountryFlag inherits from its default root after excluding protected component-owned props. */
export type VireoCountryFlagInheritedProps = Omit<BoxProps<"span">, "aria-hidden" | "aria-label" | "children" | "component" | "dangerouslySetInnerHTML" | "role" | "title">;

Props owned by {@link VireoCountryFlag }.

/** Props owned by {@link VireoCountryFlag}. */
export type VireoCountryFlagOwnProps = VireoCountryFlagSlotsAndSlotProps & {
    /** Country or subdivision identifier. Unknown strings render the fallback flag. */
    countryCode: VireoCountryFlagCode;
    /** Accessible flag label and, when enabled, tooltip content. */
    label?: string;
    /** Shows a country-name tooltip. @default false */
    enableTooltip?: boolean;
    /** Rendered width. Height follows the flag's 3:2 aspect ratio. @default 24 */
    width?: number | string;
    /** Override or extend the utility classes applied to each slot and state. */
    classes?: Partial<VireoCountryFlagClasses>;
};
export type VireoCountryFlagOwnerState = {
    countryCode: string;
    enableTooltip: boolean;
    known: boolean;
    width: number | string;
};

Props accepted by {@link VireoCountryFlag }.

/** Props accepted by {@link VireoCountryFlag}. */
export type VireoCountryFlagProps = VireoCountryFlagOwnProps & VireoCountryFlagInheritedProps;

Replaceable semantic regions exposed by {@link VireoCountryFlag }.

/** Replaceable semantic regions exposed by {@link VireoCountryFlag}. */
export type VireoCountryFlagSlots = {
    /** @default 'span' */
    root: React.ElementType;
    /** @default country-flag-icons SVG or the Vireo unknown-flag SVG */
    flag: React.ElementType;
    /** @default Tooltip */
    tooltip: React.ElementType;
};

Slot props exposed by {@link VireoCountryFlag }.

/** Slot props exposed by {@link VireoCountryFlag}. */
export type VireoCountryFlagSlotsAndSlotProps = CreateSlotsAndSlotProps<VireoCountryFlagSlots, {
    root: SlotProps<"span", VireoCountryFlagRootSlotPropsOverrides, VireoCountryFlagOwnerState>;
    flag: SlotProps<"svg", VireoCountryFlagFlagSlotPropsOverrides, VireoCountryFlagOwnerState>;
    tooltip: SlotProps<typeof Tooltip, VireoCountryFlagTooltipSlotPropsOverrides, VireoCountryFlagOwnerState>;
}>;

Resolves a localized display name for a supported country-flag-icons identifier.

/** Resolves a localized display name for a supported country-flag-icons identifier. */
export declare function getCountryName(countryCode: CountryCode, locale: string, options?: CountryNameOptions): string;

Returns the generated utility class name for a VireoCountryFlag slot or state.

/** Returns the generated utility class name for a VireoCountryFlag slot or state. */
export declare function getVireoCountryFlagUtilityClass(slot: string): string;

Returns whether a value is a country-flag-icons registry identifier.

/** Returns whether a value is a country-flag-icons registry identifier. */
export declare function isCountryCode(value: unknown): value is CountryCode;

Generated utility class names keyed by each public VireoCountryFlag class key.

/** Generated utility class names keyed by each public VireoCountryFlag class key. */
export declare const vireoCountryFlagClasses: VireoCountryFlagClasses;