@happeouikit/form-elements 2.6.0 → 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DatePicker.types.d.ts +8 -0
- package/dist/MonthDayPicker.types.d.ts +8 -1
- package/dist/dateLocale.d.ts +28 -0
- package/dist/index.cjs.js +135 -134
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +4195 -4171
- package/dist/index.es.js.map +1 -1
- package/package.json +2 -2
|
@@ -11,6 +11,13 @@ export interface DisabledDays {
|
|
|
11
11
|
export interface DatePickerProps {
|
|
12
12
|
label?: React.ReactNode;
|
|
13
13
|
locale?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Language for the calendar's written month names, e.g. "fr". Unlike
|
|
16
|
+
* `locale`, this should be a language the surrounding app is actually
|
|
17
|
+
* displaying its own UI copy in (never a raw OS/browser locale) — falls
|
|
18
|
+
* back to English when omitted.
|
|
19
|
+
*/
|
|
20
|
+
calendarLanguage?: string;
|
|
14
21
|
width?: string;
|
|
15
22
|
date?: DateRange;
|
|
16
23
|
type?: "from" | "to";
|
|
@@ -31,6 +38,7 @@ export interface DatePickerProps {
|
|
|
31
38
|
export interface MonthPickerProps {
|
|
32
39
|
date: Date;
|
|
33
40
|
disabledDays: DisabledDays;
|
|
41
|
+
calendarLanguage?: string;
|
|
34
42
|
onChange: (val: {
|
|
35
43
|
month: number;
|
|
36
44
|
year: number;
|
|
@@ -7,8 +7,15 @@ export interface MonthDay {
|
|
|
7
7
|
}
|
|
8
8
|
export interface MonthDayPickerProps {
|
|
9
9
|
label?: React.ReactNode;
|
|
10
|
-
/** BCP 47 locale for the day/month order
|
|
10
|
+
/** BCP 47 locale for the day/month order, e.g. "en-gb" or "en-us" */
|
|
11
11
|
locale?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Language for the calendar's written month names, e.g. "fr". Unlike
|
|
14
|
+
* `locale`, this should be a language the surrounding app is actually
|
|
15
|
+
* displaying its own UI copy in (never a raw OS/browser locale) — falls
|
|
16
|
+
* back to English when omitted.
|
|
17
|
+
*/
|
|
18
|
+
calendarLanguage?: string;
|
|
12
19
|
width?: string;
|
|
13
20
|
value?: MonthDay | null;
|
|
14
21
|
inputProps?: React.InputHTMLAttributes<HTMLInputElement> & {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Numeric date format/parse, driven by Intl instead of moment's locale data.
|
|
3
|
+
* No month-name localization here — only the day/month/year order and separators
|
|
4
|
+
* that `date.toLocaleDateString(locale)` would use for a plain numeric date.
|
|
5
|
+
*/
|
|
6
|
+
/** Explicit locale if valid, else the browser/OS regional locale (same as `new Date().toLocaleDateString()`). */
|
|
7
|
+
export declare const resolveLocale: (locale?: string) => string;
|
|
8
|
+
/** Placeholder like "DD/MM/YYYY" matching the locale's part order and separators. */
|
|
9
|
+
export declare const getDateFormatPattern: (locale?: string) => string;
|
|
10
|
+
/** Same output as `date.toLocaleDateString(locale)` for a calendar date. */
|
|
11
|
+
export declare const formatDate: (value: Date | number | string | undefined, locale?: string) => string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Parse typed input in the locale's day/month/year order.
|
|
14
|
+
* Accepts 1-2 digit day/month and a 4-digit year. Returns null if it doesn't match.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseDate: (input: string, locale?: string) => Date | null;
|
|
17
|
+
/**
|
|
18
|
+
* Long/short written month names for calendar UI (e.g. "December" / "Dec").
|
|
19
|
+
* Unlike `resolveLocale`, this never falls back to the OS/browser locale:
|
|
20
|
+
* written text must only switch language when the caller can vouch that the
|
|
21
|
+
* rest of the app is displaying in that language too (a Happeo UI language,
|
|
22
|
+
* not a raw system locale) — an unrecognised or missing locale falls back to
|
|
23
|
+
* English instead.
|
|
24
|
+
*/
|
|
25
|
+
export declare const getMonthNames: (locale?: string) => {
|
|
26
|
+
long: string;
|
|
27
|
+
short: string;
|
|
28
|
+
}[];
|