UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

151 lines (150 loc) 4.23 kB
export declare const defaultLocale = "en"; export declare const locales: string[]; /** * To reference the CLDR meridiems for each supported locale navigate to: * https://github.com/unicode-org/cldr-json/tree/main/cldr-json/cldr-dates-full/main, * click {locale}/ca-generic.json and drill down to main.{locale}.dates.calendars.generic.dayPeriods.format.abbreviated. */ export declare const localizedTwentyFourHourMeridiems: Map<string, { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; } | { am: string; pm: string; }>; export declare const numberingSystems: readonly ["arab", "arabext", "latn"]; export declare const supportedLocales: readonly string[]; export type NumberingSystem = (typeof numberingSystems)[number]; export type SupportedLocale = (typeof supportedLocales)[number]; export declare const defaultNumberingSystem: "arab" | "arabext" | "latn"; export declare const getSupportedNumberingSystem: (numberingSystem: string) => NumberingSystem; /** * Gets the locale that best matches the context. * * @param locale – the BCP 47 locale code */ export declare function getSupportedLocale(locale: string): SupportedLocale; /** * Gets the locale that best matches the context for date formatting. * * Intl date formatting has some quirks with certain locales. This handles those quirks by mapping a locale to another for date formatting. * * @see https://github.com/Esri/calcite-design-system/issues/9387 * * @param locale – the BCP 47 locale code * @returns {string} a BCP 47 locale code */ export declare function getDateFormatSupportedLocale(locale: string): string; export interface NumberStringFormatOptions extends Intl.NumberFormatOptions { numberingSystem: NumberingSystem; locale: string; } /** This util formats and parses numbers for localization */ export declare class NumberStringFormat { /** * The actual group separator for the specified locale. * White-space group separators are changed to the non-breaking space (nbsp) unicode character. * so we replace them with a normal <SPACE>. */ private _actualGroup; /** the corrected group separator */ private _group; get group(): string; private _decimal; get decimal(): string; private _minusSign; get minusSign(): string; private _digits; get digits(): Array<string>; private _getDigitIndex; private _numberFormatter; get numberFormatter(): Intl.NumberFormat; private _numberFormatOptions; get numberFormatOptions(): NumberStringFormatOptions; /** numberFormatOptions needs to be set before localize/delocalize is called to ensure the options are up to date */ set numberFormatOptions(options: NumberStringFormatOptions); delocalize: (numberString: string) => string; localize: (numberString: string) => string; } export declare const numberStringFormatter: NumberStringFormat; export type LocaleDateTimeOptionKey = string; /** * Exported for testing purposes only. * * @private */ export declare let dateTimeFormatCache: Map<LocaleDateTimeOptionKey, Intl.DateTimeFormat>; /** * Returns an instance of Intl.DateTimeFormat and reuses it if requested with the same locale and options. * * **Note**: the cache will be cleared if a different locale is provided * * @private */ export declare function getDateTimeFormat(locale: string, options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;