frontile 0.18.0 → 0.18.2
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/declarations/-private/get-config.d.ts.map +1 -1
- package/declarations/-private/timer.d.ts +3 -3
- package/declarations/-private/timer.d.ts.map +1 -1
- package/declarations/components/buttons/chip.d.ts +1 -1
- package/declarations/components/buttons/chip.d.ts.map +1 -1
- package/declarations/components/buttons/close-button.d.ts +2 -2
- package/declarations/components/buttons/close-button.d.ts.map +1 -1
- package/declarations/components/collections/listbox/item.d.ts +2 -2
- package/declarations/components/collections/listbox/item.d.ts.map +1 -1
- package/declarations/components/collections/simple-table/column.d.ts +6 -0
- package/declarations/components/collections/simple-table/column.d.ts.map +1 -1
- package/declarations/components/collections/simple-table/footer.d.ts +2 -1
- package/declarations/components/collections/simple-table/footer.d.ts.map +1 -1
- package/declarations/components/collections/simple-table/header.d.ts +2 -1
- package/declarations/components/collections/simple-table/header.d.ts.map +1 -1
- package/declarations/components/collections/simple-table/index.d.ts +1 -1
- package/declarations/components/collections/simple-table/index.d.ts.map +1 -1
- package/declarations/components/collections/table/checkbox.d.ts +1 -1
- package/declarations/components/collections/table/checkbox.d.ts.map +1 -1
- package/declarations/components/collections/table/column-visibility.d.ts +2 -2
- package/declarations/components/collections/table/column-visibility.d.ts.map +1 -1
- package/declarations/components/collections/table/table.d.ts +9 -7
- package/declarations/components/collections/table/table.d.ts.map +1 -1
- package/declarations/components/forms/autocomplete.d.ts +12 -12
- package/declarations/components/forms/checkbox.d.ts +2 -2
- package/declarations/components/forms/checkbox.d.ts.map +1 -1
- package/declarations/components/forms/date-input/clipboard.d.ts +34 -0
- package/declarations/components/forms/date-input/clipboard.d.ts.map +1 -0
- package/declarations/components/forms/date-input/date-input.d.ts +93 -0
- package/declarations/components/forms/date-input/date-input.d.ts.map +1 -0
- package/declarations/components/forms/date-input/segment-group.d.ts +132 -0
- package/declarations/components/forms/date-input/segment-group.d.ts.map +1 -0
- package/declarations/components/forms/date-input/segments.d.ts +163 -0
- package/declarations/components/forms/date-input/segments.d.ts.map +1 -0
- package/declarations/components/forms/date-input/types.d.ts +175 -0
- package/declarations/components/forms/date-input/types.d.ts.map +1 -0
- package/declarations/components/forms/date-input.d.ts +6 -0
- package/declarations/components/forms/date-input.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/date-picker.d.ts +263 -15
- package/declarations/components/forms/date-picker/date-picker.d.ts.map +1 -1
- package/declarations/components/forms/date-picker/end-content.d.ts +33 -3
- package/declarations/components/forms/date-picker/end-content.d.ts.map +1 -1
- package/declarations/components/forms/date-picker/types.d.ts +45 -2
- package/declarations/components/forms/date-picker/types.d.ts.map +1 -1
- package/declarations/components/forms/date-picker/value.d.ts +21 -5
- package/declarations/components/forms/date-picker/value.d.ts.map +1 -1
- package/declarations/components/forms/field.d.ts +7 -5
- package/declarations/components/forms/field.d.ts.map +1 -1
- package/declarations/components/forms/form.d.ts +5 -5
- package/declarations/components/forms/form.d.ts.map +1 -1
- package/declarations/components/forms/index.d.ts +1 -0
- package/declarations/components/forms/index.d.ts.map +1 -1
- package/declarations/components/forms/input-otp.d.ts +5 -5
- package/declarations/components/forms/input-otp.d.ts.map +1 -1
- package/declarations/components/forms/input.d.ts +15 -15
- package/declarations/components/forms/input.d.ts.map +1 -1
- package/declarations/components/forms/native-select.d.ts +10 -10
- package/declarations/components/forms/native-select.d.ts.map +1 -1
- package/declarations/components/forms/radio.d.ts +2 -2
- package/declarations/components/forms/radio.d.ts.map +1 -1
- package/declarations/components/forms/select/select.d.ts +16 -16
- package/declarations/components/forms/textarea.d.ts +10 -10
- package/declarations/components/forms/textarea.d.ts.map +1 -1
- package/declarations/components/navigation/pagination/pagination.d.ts +32 -1
- package/declarations/components/navigation/pagination/pagination.d.ts.map +1 -1
- package/declarations/components/overlays/overlay.d.ts +4 -4
- package/declarations/components/overlays/overlay.d.ts.map +1 -1
- package/declarations/components/utilities/avatar.d.ts +35 -2
- package/declarations/components/utilities/avatar.d.ts.map +1 -1
- package/declarations/components/utilities/collapsible.d.ts +16 -0
- package/declarations/components/utilities/collapsible.d.ts.map +1 -1
- package/declarations/test-support.d.ts +30 -0
- package/declarations/test-support.d.ts.map +1 -1
- package/declarations/utils/forms-utils-index.d.ts +1 -1
- package/declarations/utils/forms-utils-index.d.ts.map +1 -1
- package/declarations/utils/nested-data.d.ts +17 -0
- package/declarations/utils/nested-data.d.ts.map +1 -1
- package/dist/components/buttons/chip.js.map +1 -1
- package/dist/components/buttons/close-button.js +5 -12
- package/dist/components/buttons/close-button.js.map +1 -1
- package/dist/components/collections/listbox/item.js +4 -11
- package/dist/components/collections/listbox/item.js.map +1 -1
- package/dist/components/collections/simple-table/column.js +2 -2
- package/dist/components/collections/simple-table/column.js.map +1 -1
- package/dist/components/collections/simple-table/footer.js +1 -1
- package/dist/components/collections/simple-table/footer.js.map +1 -1
- package/dist/components/collections/simple-table/header.js +1 -1
- package/dist/components/collections/simple-table/header.js.map +1 -1
- package/dist/components/collections/simple-table/index.js +1 -1
- package/dist/components/collections/simple-table/index.js.map +1 -1
- package/dist/components/collections/table/checkbox.js +2 -7
- package/dist/components/collections/table/checkbox.js.map +1 -1
- package/dist/components/collections/table/column-visibility.js +2 -7
- package/dist/components/collections/table/column-visibility.js.map +1 -1
- package/dist/components/forms/checkbox.js +4 -12
- package/dist/components/forms/checkbox.js.map +1 -1
- package/dist/components/forms/date-input/clipboard.js +231 -0
- package/dist/components/forms/date-input/clipboard.js.map +1 -0
- package/dist/components/forms/date-input/date-input.js +204 -0
- package/dist/components/forms/date-input/date-input.js.map +1 -0
- package/dist/components/forms/date-input/segment-group.js +292 -0
- package/dist/components/forms/date-input/segment-group.js.map +1 -0
- package/dist/components/forms/date-input/segments.js +562 -0
- package/dist/components/forms/date-input/segments.js.map +1 -0
- package/dist/components/forms/date-input/types.js +2 -0
- package/dist/components/forms/date-input/types.js.map +1 -0
- package/dist/components/forms/date-input.js +4 -0
- package/dist/components/forms/date-input.js.map +1 -0
- package/dist/components/forms/date-picker/date-picker.js +361 -20
- package/dist/components/forms/date-picker/date-picker.js.map +1 -1
- package/dist/components/forms/date-picker/end-content.js +17 -4
- package/dist/components/forms/date-picker/end-content.js.map +1 -1
- package/dist/components/forms/date-picker/value.js +44 -6
- package/dist/components/forms/date-picker/value.js.map +1 -1
- package/dist/components/forms/field.js +12 -20
- package/dist/components/forms/field.js.map +1 -1
- package/dist/components/forms/form.js +11 -27
- package/dist/components/forms/form.js.map +1 -1
- package/dist/components/forms/index.js +5 -2
- package/dist/components/forms/index.js.map +1 -1
- package/dist/components/forms/input-otp.js +10 -26
- package/dist/components/forms/input-otp.js.map +1 -1
- package/dist/components/forms/input.js +9 -22
- package/dist/components/forms/input.js.map +1 -1
- package/dist/components/forms/native-select.js +5 -12
- package/dist/components/forms/native-select.js.map +1 -1
- package/dist/components/forms/radio.js +4 -12
- package/dist/components/forms/radio.js.map +1 -1
- package/dist/components/forms/textarea.js +6 -17
- package/dist/components/forms/textarea.js.map +1 -1
- package/dist/components/navigation/pagination/pagination.js +18 -2
- package/dist/components/navigation/pagination/pagination.js.map +1 -1
- package/dist/components/notifications/index.js +1 -1
- package/dist/components/overlays/overlay.js +8 -21
- package/dist/components/overlays/overlay.js.map +1 -1
- package/dist/components/utilities/avatar.js +26 -5
- package/dist/components/utilities/avatar.js.map +1 -1
- package/dist/components/utilities/collapsible.js +47 -3
- package/dist/components/utilities/collapsible.js.map +1 -1
- package/dist/forms.js +5 -2
- package/dist/forms.js.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/{manager-jDaRVZ5o.js → manager-Dge4r8Vn.js} +9 -19
- package/dist/manager-Dge4r8Vn.js.map +1 -0
- package/dist/notifications.js +1 -1
- package/dist/services/notifications.js +1 -1
- package/dist/test-support.js +903 -389
- package/dist/test-support.js.map +1 -1
- package/dist/utils/forms-utils-index.js +1 -1
- package/dist/utils/forms-utils-index.js.map +1 -1
- package/dist/utils/nested-data.js +28 -1
- package/dist/utils/nested-data.js.map +1 -1
- package/package.json +10 -10
- package/dist/manager-jDaRVZ5o.js.map +0 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { Part, Segment, SegmentType, SegmentGroupClasses, SegmentGroupUserClasses } from './types';
|
|
3
|
+
interface SegmentGroupSignature {
|
|
4
|
+
Args: {
|
|
5
|
+
parts: Part[];
|
|
6
|
+
/** Hands the whole list back; the group holds no state of its own. */
|
|
7
|
+
onPartsChange: (parts: Part[]) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Offered text that reads as two dates rather than one. Only `DatePicker`
|
|
10
|
+
* in `@mode="range"` supplies it, and only to its *start* group: pasting
|
|
11
|
+
* a range into the end of a field and having it rewrite the start would
|
|
12
|
+
* be surprising. Without it, such text is simply declined.
|
|
13
|
+
*/
|
|
14
|
+
onRangePaste?: (start: Part[], end: Part[]) => void;
|
|
15
|
+
locale: string;
|
|
16
|
+
placeholderValue: Date;
|
|
17
|
+
isDisabled?: boolean;
|
|
18
|
+
isReadOnly?: boolean;
|
|
19
|
+
isInvalid?: boolean;
|
|
20
|
+
/** Rendered as the group's own id, so a `<label for>` can target it. */
|
|
21
|
+
id?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The field's name. A `role="group"` is not a labelable element, so a
|
|
24
|
+
* sibling `<label for>` does not name it on its own -- this does.
|
|
25
|
+
*/
|
|
26
|
+
label?: string;
|
|
27
|
+
labelledBy?: string;
|
|
28
|
+
describedBy?: string;
|
|
29
|
+
segmentLabels?: Partial<Record<SegmentType, string>>;
|
|
30
|
+
/**
|
|
31
|
+
* Only the three slots this group renders, so that `DateInput`'s
|
|
32
|
+
* `dateInput` recipe and `DatePicker`'s `datePicker` recipe both satisfy
|
|
33
|
+
* it. See {@link SegmentGroupClasses}.
|
|
34
|
+
*/
|
|
35
|
+
classes: SegmentGroupClasses;
|
|
36
|
+
userClasses?: SegmentGroupUserClasses;
|
|
37
|
+
};
|
|
38
|
+
Element: HTMLDivElement;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Everything one rendered part needs, resolved to primitives.
|
|
42
|
+
*
|
|
43
|
+
* The template cannot narrow the `Part` union -- `eq` is unavailable and Glint
|
|
44
|
+
* does not carry a type predicate through `{{#if}}` -- so the narrowing happens
|
|
45
|
+
* here, in TypeScript, and the template only ever reads optional primitives.
|
|
46
|
+
* That keeps `part.type` off a `LiteralPart` without a cast anywhere.
|
|
47
|
+
*/
|
|
48
|
+
interface Cell {
|
|
49
|
+
index: number;
|
|
50
|
+
isSegment: boolean;
|
|
51
|
+
/** The segment's display text, or the literal's text. */
|
|
52
|
+
text: string;
|
|
53
|
+
type?: SegmentType;
|
|
54
|
+
isEmpty: boolean;
|
|
55
|
+
label?: string;
|
|
56
|
+
/** `text` for AM/PM, typed by letter; `numeric` for everything else. */
|
|
57
|
+
inputMode: 'numeric' | 'text';
|
|
58
|
+
valueNow?: number;
|
|
59
|
+
valueMin?: number;
|
|
60
|
+
valueMax?: number;
|
|
61
|
+
valueText?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* One row of date segments. Private: `DateInput` and `DatePicker` both render
|
|
65
|
+
* it, and neither wants the other's `FormControl` wrapper.
|
|
66
|
+
*/
|
|
67
|
+
declare class SegmentGroup extends Component<SegmentGroupSignature> {
|
|
68
|
+
get isEditable(): boolean;
|
|
69
|
+
labelFor: (type: SegmentType) => string;
|
|
70
|
+
/**
|
|
71
|
+
* Built once per locale rather than inside {@link valueTextFor}: `cells`
|
|
72
|
+
* recomputes on every keystroke, and an `Intl` constructor is expensive
|
|
73
|
+
* enough that building one per keypress is the costliest thing this
|
|
74
|
+
* component would otherwise do.
|
|
75
|
+
*/
|
|
76
|
+
get monthNames(): Intl.DateTimeFormat;
|
|
77
|
+
/**
|
|
78
|
+
* What a screen reader reads instead of the raw number. A month is read by
|
|
79
|
+
* name -- "January", not "1" -- which is the whole point of `aria-valuetext`.
|
|
80
|
+
*/
|
|
81
|
+
valueTextFor: (segment: Segment) => string | undefined;
|
|
82
|
+
get cells(): Cell[];
|
|
83
|
+
/** The segment elements, in document order -- the focus order too. */
|
|
84
|
+
private segmentElements;
|
|
85
|
+
/**
|
|
86
|
+
* Left and right are *visual* directions, so in an RTL locale they run
|
|
87
|
+
* against document order: pressing the left arrow in `yyyy/mm/dd` laid out
|
|
88
|
+
* right-to-left should move to the segment drawn to the left, which is the
|
|
89
|
+
* later one in the DOM.
|
|
90
|
+
*/
|
|
91
|
+
private focusSibling;
|
|
92
|
+
private isRtl;
|
|
93
|
+
private focusEdge;
|
|
94
|
+
/** Replaces one segment by index and reports the new list. */
|
|
95
|
+
private replace;
|
|
96
|
+
handleKeyDown: (index: number, event: KeyboardEvent) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Leaving a segment finishes it: the digits in it stop being something the
|
|
99
|
+
* user is still typing and become their answer, which is what turns a typed
|
|
100
|
+
* `26` into 2026. Tab, arrow-key navigation and a click elsewhere all arrive
|
|
101
|
+
* here, because moving focus is the one thing they have in common.
|
|
102
|
+
*/
|
|
103
|
+
handleFocusOut: (index: number) => void;
|
|
104
|
+
/**
|
|
105
|
+
* `contenteditable`'s hazard: anything not handled above arrives here and
|
|
106
|
+
* would be written into the span's DOM, desynchronising the display from the
|
|
107
|
+
* model. Every input type is refused; the model is the only writer.
|
|
108
|
+
*/
|
|
109
|
+
handleBeforeInput: (event: Event) => void;
|
|
110
|
+
/**
|
|
111
|
+
* Always `preventDefault`: the browser would otherwise write the pasted text
|
|
112
|
+
* into the contenteditable span, and the model would no longer describe what
|
|
113
|
+
* is on screen. Unparseable text is dropped silently -- a date field that
|
|
114
|
+
* guessed would be worse than one that declined.
|
|
115
|
+
*/
|
|
116
|
+
handlePaste: (event: ClipboardEvent) => void;
|
|
117
|
+
/**
|
|
118
|
+
* A second reading of text a single date could not be made of.
|
|
119
|
+
*
|
|
120
|
+
* Both halves are parsed against *this* group's parts, which is sound
|
|
121
|
+
* because the two groups of a range are built from the same locale and
|
|
122
|
+
* format and so have identical shape, and because a half only counts when
|
|
123
|
+
* it parses in full -- nothing of this group's own state survives into the
|
|
124
|
+
* list handed to the other one.
|
|
125
|
+
*/
|
|
126
|
+
private tryRangePaste;
|
|
127
|
+
handleCopy: (event: ClipboardEvent) => void;
|
|
128
|
+
handleCut: (event: ClipboardEvent) => void;
|
|
129
|
+
}
|
|
130
|
+
export { SegmentGroup, type SegmentGroupSignature };
|
|
131
|
+
export default SegmentGroup;
|
|
132
|
+
//# sourceMappingURL=segment-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment-group.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-input/segment-group.gts"],"names":[],"mappings":"AA2bA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAe3C,OAAO,KAAK,EACV,IAAI,EACJ,OAAO,EACP,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAEjB,UAAU,qBAAqB;IAC7B,IAAI,EAAE;QACJ,KAAK,EAAE,IAAI,EAAE,CAAC;QACd,sEAAsE;QACtE,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;QACvC;;;;;WAKG;QACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;QACpD,MAAM,EAAE,MAAM,CAAC;QACf,gBAAgB,EAAE,IAAI,CAAC;QACvB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,wEAAwE;QACxE,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aA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F;;;;;OAKG;IACH,cAAc,GAAI,OAAO,MAAM,KAAG,IAAI,CASpC;IAEF;;;;OAIG;IACH,iBAAiB,GAAI,OAAO,KAAK,KAAG,IAAI,CAEtC;IAEF;;;;;OAKG;IACH,WAAW,GAAI,OAAO,cAAc,KAAG,IAAI,CAYzC;IAEF;;;;;;;;OAQG;IACH,OAAO,CAAC,aAAa;IAYrB,UAAU,GAAI,OAAO,cAAc,KAAG,IAAI,CAMxC;IAEF,SAAS,GAAI,OAAO,cAAc,KAAG,IAAI,CAOvC;CAoIH;AAED,OAAO,EAAE,YAAY,EAAE,KAAK,qBAAqB,EAAE,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { HourCycle, Part, Segment, SegmentType, TimeOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The format an editable field uses when the consumer supplies none.
|
|
4
|
+
* Deliberately not `{ dateStyle: 'medium' }` -- DatePicker's button default --
|
|
5
|
+
* which renders a month name and has no numeric segment to type into.
|
|
6
|
+
*/
|
|
7
|
+
declare const DEFAULT_FORMAT: Intl.DateTimeFormatOptions;
|
|
8
|
+
declare const BOUNDS: Record<SegmentType, {
|
|
9
|
+
min: number;
|
|
10
|
+
max: number;
|
|
11
|
+
width: number;
|
|
12
|
+
placeholder: string;
|
|
13
|
+
}>;
|
|
14
|
+
declare function isSegment(part: Part): part is Segment;
|
|
15
|
+
declare function emptySegment(type: SegmentType, overrides?: Partial<Segment>): Segment;
|
|
16
|
+
/**
|
|
17
|
+
* The format the segments are built from: the date format, plus the time
|
|
18
|
+
* fields a granularity asks for. Seconds are out of scope.
|
|
19
|
+
*/
|
|
20
|
+
declare function withTime(format: Intl.DateTimeFormatOptions, { granularity, hourCycle }: TimeOptions): Intl.DateTimeFormatOptions;
|
|
21
|
+
/**
|
|
22
|
+
* Derives the segments and their separators from the locale, so `mm/dd/yyyy`,
|
|
23
|
+
* `dd/mm/yyyy` and `yyyy年mm月dd日` all fall out of `Intl` rather than being
|
|
24
|
+
* hardcoded.
|
|
25
|
+
*
|
|
26
|
+
* A format producing a textual month ('Jan') has no editable numeric
|
|
27
|
+
* representation, so that part becomes a numeric month segment anyway. The
|
|
28
|
+
* component warns; this function stays pure.
|
|
29
|
+
*/
|
|
30
|
+
declare function buildParts(locale: string, formatOptions?: Intl.DateTimeFormatOptions, time?: TimeOptions): Part[];
|
|
31
|
+
/**
|
|
32
|
+
* A bare `yy` resolves into the hundred years running from 80 back to 19
|
|
33
|
+
* forward -- so a birth date reaches the past while a card expiry reaches the
|
|
34
|
+
* near future. Three or four digits are a year the user spelled out and are
|
|
35
|
+
* taken literally.
|
|
36
|
+
*/
|
|
37
|
+
declare function resolveTwoDigitYear(digits: string, now?: Date): number;
|
|
38
|
+
/**
|
|
39
|
+
* Appends one typed digit.
|
|
40
|
+
*
|
|
41
|
+
* `isFull` is the signal to advance focus. It is true when the segment cannot
|
|
42
|
+
* take another digit -- either it has reached its width, or any further digit
|
|
43
|
+
* would exceed `max`. That is what makes typing `5` into a month jump straight
|
|
44
|
+
* to the day, while typing `1` waits to see whether `12` is coming.
|
|
45
|
+
*/
|
|
46
|
+
declare function applyDigit(segment: Segment, digit: string): {
|
|
47
|
+
segment: Segment;
|
|
48
|
+
isFull: boolean;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Marks a segment as the user's finished answer, expanding a one- or
|
|
52
|
+
* two-digit year through the sliding window on the way: typing `26` and
|
|
53
|
+
* moving on means 2026, while `0026` typed in full means the year 26.
|
|
54
|
+
*
|
|
55
|
+
* An empty segment has nothing to commit and stays uncommitted, so leaving a
|
|
56
|
+
* blank field does not invent a value for it.
|
|
57
|
+
*/
|
|
58
|
+
declare function commitSegment(segment: Segment): Segment;
|
|
59
|
+
/**
|
|
60
|
+
* A segment holding `value` as a finished answer.
|
|
61
|
+
*
|
|
62
|
+
* The zero-padded buffer is the paired invariant of `displaySegment`, which
|
|
63
|
+
* reads the buffer back out -- so every path that sets a value goes through
|
|
64
|
+
* here rather than restating the padding and risking the two drifting.
|
|
65
|
+
*/
|
|
66
|
+
declare function withValue(segment: Segment, value: number): Segment;
|
|
67
|
+
/**
|
|
68
|
+
* Types into a textual segment: a letter picks the first label starting with
|
|
69
|
+
* it, so `a` and `p` set AM and PM in English. A letter that starts no label
|
|
70
|
+
* is ignored, and the segment is finished either way it is set.
|
|
71
|
+
*/
|
|
72
|
+
declare function applyLetter(segment: Segment, key: string): {
|
|
73
|
+
segment: Segment;
|
|
74
|
+
isFull: boolean;
|
|
75
|
+
};
|
|
76
|
+
/** Clears both the value and the digits behind it. */
|
|
77
|
+
declare function clearSegment(segment: Segment): Segment;
|
|
78
|
+
/** Drops the last digit typed, for Backspace. */
|
|
79
|
+
declare function deleteDigit(segment: Segment): Segment;
|
|
80
|
+
/** A 0-23 hour as the given cycle counts it. */
|
|
81
|
+
declare function hourOnCycle(hours: number, cycle: HourCycle): number;
|
|
82
|
+
/** The 0-23 hour an hour segment and an AM/PM (0 or 1) stand for. */
|
|
83
|
+
declare function hourOfDay(hour: number, cycle: HourCycle, dayPeriod: number): number;
|
|
84
|
+
/**
|
|
85
|
+
* Arrow and page keys. An empty segment does not step from zero -- it adopts
|
|
86
|
+
* `placeholderValue`, so ArrowUp on a blank year offers this year rather than
|
|
87
|
+
* the year 1.
|
|
88
|
+
*/
|
|
89
|
+
declare function step(segment: Segment, delta: number, placeholderValue: Date): Segment;
|
|
90
|
+
/**
|
|
91
|
+
* The segment's display text: the digits behind it, or its placeholder when
|
|
92
|
+
* empty. A year still being typed shows exactly what has been typed --
|
|
93
|
+
* `26` on the way to `2026` -- because padding it would claim digits the
|
|
94
|
+
* user has not entered. Every other segment, and a committed year, is padded
|
|
95
|
+
* to its full width.
|
|
96
|
+
*
|
|
97
|
+
* This is the single source of truth for "what does this segment read as
|
|
98
|
+
* right now" -- both the rendered cell text and `formatForClipboard` call
|
|
99
|
+
* it, so a mid-entry copy always matches what is on screen.
|
|
100
|
+
*/
|
|
101
|
+
declare function displaySegment(segment: Segment): string;
|
|
102
|
+
declare function findSegment(parts: Part[], type: SegmentType): Segment | undefined;
|
|
103
|
+
/** Days in a month, via the zeroth day of the next one. */
|
|
104
|
+
declare function daysInMonth(year: number, month: number): number;
|
|
105
|
+
/**
|
|
106
|
+
* The time the time segments hold, as a 0-23 hour and a minute; midnight when
|
|
107
|
+
* there are none, and `null` while any of them is empty or still being typed.
|
|
108
|
+
*/
|
|
109
|
+
declare function timeOf(parts: Part[]): {
|
|
110
|
+
hours: number;
|
|
111
|
+
minutes: number;
|
|
112
|
+
} | null;
|
|
113
|
+
/**
|
|
114
|
+
* The composed value, or `null` while any segment is still empty or still
|
|
115
|
+
* being typed. The day is clamped to the chosen month's real length: a 31 left
|
|
116
|
+
* over from January must resolve to the 28th in February, not roll forward
|
|
117
|
+
* into March the way the `Date` constructor would.
|
|
118
|
+
*/
|
|
119
|
+
declare function toDate(parts: Part[]): Date | null;
|
|
120
|
+
/**
|
|
121
|
+
* Carries the segments' state onto a freshly built list, matching by type.
|
|
122
|
+
*
|
|
123
|
+
* Used when the locale or the format changes under a field that is already
|
|
124
|
+
* holding something. Going via `toDate` instead would discard a half-typed
|
|
125
|
+
* entry, because a partial entry composes no date -- and losing the user's
|
|
126
|
+
* digits to a locale switch is exactly the failure this component exists to
|
|
127
|
+
* avoid. A segment the new format has no place for is simply dropped.
|
|
128
|
+
*/
|
|
129
|
+
declare function carryOver(next: Part[], previous: Part[]): Part[];
|
|
130
|
+
/**
|
|
131
|
+
* Whether a format would render a month no one can type into -- either a
|
|
132
|
+
* textual month outright, or a `dateStyle` preset, which picks its own and
|
|
133
|
+
* cannot be reasoned about field by field.
|
|
134
|
+
*/
|
|
135
|
+
declare function hasTextualMonth(options: Intl.DateTimeFormatOptions): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* The nearest typeable format to the one asked for.
|
|
138
|
+
*
|
|
139
|
+
* A textual month is swapped for a numeric one and *everything else is left
|
|
140
|
+
* alone*: a format asking for month and day keeps exactly those two segments
|
|
141
|
+
* rather than growing a year the consumer never requested. A `dateStyle`
|
|
142
|
+
* preset names no fields at all, so there is nothing to preserve and the
|
|
143
|
+
* default numeric format stands in for the whole thing.
|
|
144
|
+
*/
|
|
145
|
+
declare function toNumericFormat(options: Intl.DateTimeFormatOptions): Intl.DateTimeFormatOptions;
|
|
146
|
+
/**
|
|
147
|
+
* The format the segments should actually be built from, warning when that is
|
|
148
|
+
* not the one asked for.
|
|
149
|
+
*
|
|
150
|
+
* Both hosts need the identical policy and differ only in what they call
|
|
151
|
+
* themselves, so the message is passed in rather than the rule being written
|
|
152
|
+
* out twice and left to drift.
|
|
153
|
+
*/
|
|
154
|
+
declare function resolveSegmentFormat(given: Intl.DateTimeFormatOptions | undefined, warning: {
|
|
155
|
+
message: string;
|
|
156
|
+
id: string;
|
|
157
|
+
}): Intl.DateTimeFormatOptions | undefined;
|
|
158
|
+
/** Whether two composed values differ -- `null` (no date) included. */
|
|
159
|
+
declare function hasDateChanged(before: Date | null, after: Date | null): boolean;
|
|
160
|
+
/** Writes a value across the segments, leaving literals untouched. */
|
|
161
|
+
declare function fromDate(parts: Part[], date: Date | null): Part[];
|
|
162
|
+
export { buildParts, withTime, applyLetter, timeOf, hourOnCycle, hourOfDay, isSegment, emptySegment, DEFAULT_FORMAT, BOUNDS, applyDigit, commitSegment, clearSegment, deleteDigit, step, toDate, fromDate, findSegment, resolveTwoDigitYear, daysInMonth, displaySegment, withValue, carryOver, hasTextualMonth, toNumericFormat, resolveSegmentFormat, hasDateChanged };
|
|
163
|
+
//# sourceMappingURL=segments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-input/segments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,OAAO,EACP,WAAW,EACX,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,Q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AAI,EAAE,GAAG,IAAI,EAAE,CAczD;AAED;;;;GAIG;AACH,iBAAS,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAOrE;AAED;;;;;;;;GAQG;AACH,iBAAS,eAAe,CACtB,OAAO,EAAE,IAAI,CAAC,qBAAqB,GAClC,IAAI,CAAC,qBAAqB,CAG5B;AAED;;;;;;;GAOG;AACH,iBAAS,oBAAoB,CAC3B,KAAK,EAAE,IAAI,CAAC,qBAAqB,GAAG,SAAS,EAC7C,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACvC,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAMxC;AAED,uEAAuE;AACvE,iBAAS,cAAc,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,CAGxE;AAED,sEAAsE;AACtE,iBAAS,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,CAO1D;AAED,OAAO,EACL,UAAU,EACV,QAAQ,EACR,WAAW,EACX,MAAM,EACN,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,EACZ,cAAc,EACd,MAAM,EACN,UAAU,EACV,aAAa,EACb,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,SAAS,EACT,SAAS,EACT,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,cAAc,EACf,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import type { ClassValue, DateInputSlots, SlotsToClasses, useStyles } from '@frontile/theme';
|
|
2
|
+
import type { FormControlSharedArgs } from '../form-control';
|
|
3
|
+
/** The resolved Tailwind Variants slot functions for this component. */
|
|
4
|
+
type DateInputClasses = ReturnType<ReturnType<typeof useStyles>['dateInput']>;
|
|
5
|
+
/** One resolved Tailwind Variants slot function, called as `slot(class=...)`. */
|
|
6
|
+
type SegmentSlotFn = (props?: {
|
|
7
|
+
class?: ClassValue;
|
|
8
|
+
}) => string;
|
|
9
|
+
/**
|
|
10
|
+
* The slots `SegmentGroup` renders, named structurally rather than by recipe.
|
|
11
|
+
* `DateInput` hands it `useStyles().dateInput(...)` and `DatePicker` hands it
|
|
12
|
+
* `useStyles().datePicker(...)`: two separate `tv()` calls, because tv() loses
|
|
13
|
+
* slot types across a two-level `extend` and so neither recipe can extend the
|
|
14
|
+
* other. Naming either one here would make the other a type error, so the
|
|
15
|
+
* group asks only for the three slots it actually uses -- which both recipes
|
|
16
|
+
* have.
|
|
17
|
+
*/
|
|
18
|
+
interface SegmentGroupClasses {
|
|
19
|
+
group: SegmentSlotFn;
|
|
20
|
+
segment: SegmentSlotFn;
|
|
21
|
+
literal: SegmentSlotFn;
|
|
22
|
+
}
|
|
23
|
+
/** The consumer overrides for those same three slots. */
|
|
24
|
+
type SegmentGroupUserClasses = SlotsToClasses<'group' | 'segment' | 'literal'>;
|
|
25
|
+
/**
|
|
26
|
+
* The editable units. The time ones appear only under an `hour` or `minute`
|
|
27
|
+
* {@link Granularity}; `dayPeriod` (AM/PM) only on a 12-hour cycle.
|
|
28
|
+
*/
|
|
29
|
+
type SegmentType = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'dayPeriod';
|
|
30
|
+
/** The smallest unit a field edits. `day` has no time segments at all. */
|
|
31
|
+
type Granularity = 'day' | 'hour' | 'minute';
|
|
32
|
+
/**
|
|
33
|
+
* How the hour segment counts, as `Intl` resolves it: `h11` runs 0-11 and
|
|
34
|
+
* `h12` 1-12 (both with AM/PM), `h23` runs 0-23 and `h24` 1-24.
|
|
35
|
+
*/
|
|
36
|
+
type HourCycle = 'h11' | 'h12' | 'h23' | 'h24';
|
|
37
|
+
/** What {@link buildParts} adds to the date segments. */
|
|
38
|
+
interface TimeOptions {
|
|
39
|
+
/** @defaultValue 'day' */
|
|
40
|
+
granularity?: Granularity;
|
|
41
|
+
/** Forces a 12- or 24-hour clock. @defaultValue the locale's */
|
|
42
|
+
hourCycle?: 12 | 24;
|
|
43
|
+
}
|
|
44
|
+
interface Segment {
|
|
45
|
+
kind: 'segment';
|
|
46
|
+
type: SegmentType;
|
|
47
|
+
/** `null` until the user has entered something. */
|
|
48
|
+
value: number | null;
|
|
49
|
+
min: number;
|
|
50
|
+
max: number;
|
|
51
|
+
/**
|
|
52
|
+
* Digits typed into this segment so far. Distinct from `value` because
|
|
53
|
+
* typing `0` must show `00` and wait, which no number can represent.
|
|
54
|
+
*/
|
|
55
|
+
buffer: string;
|
|
56
|
+
/**
|
|
57
|
+
* Whether `value` is the user's finished answer for this segment rather than
|
|
58
|
+
* a number they are still typing through. A year typed digit by digit passes
|
|
59
|
+
* through 2, 20 and 202 on its way to 2026, and none of those are a year
|
|
60
|
+
* anybody meant -- so an uncommitted segment composes no date at all. A
|
|
61
|
+
* segment commits when it can take no further digit, or when focus leaves it
|
|
62
|
+
* (which is what turns a typed `26` into 2026).
|
|
63
|
+
*/
|
|
64
|
+
isCommitted: boolean;
|
|
65
|
+
/** How many digits the segment shows when filled: 2, or 4 for a year. */
|
|
66
|
+
width: number;
|
|
67
|
+
/** Rendered when `value` is null: 'mm', 'dd', 'yyyy'. */
|
|
68
|
+
placeholder: string;
|
|
69
|
+
/**
|
|
70
|
+
* A textual segment's names, indexed by `value`: the locale's AM and PM for
|
|
71
|
+
* `dayPeriod`. A segment with labels is typed by letter, not by digit, and
|
|
72
|
+
* shows its label rather than its number.
|
|
73
|
+
*/
|
|
74
|
+
labels?: string[];
|
|
75
|
+
/** The hour segment's cycle, which its bounds and its value depend on. */
|
|
76
|
+
hourCycle?: HourCycle;
|
|
77
|
+
}
|
|
78
|
+
interface LiteralPart {
|
|
79
|
+
kind: 'literal';
|
|
80
|
+
text: string;
|
|
81
|
+
}
|
|
82
|
+
type Part = Segment | LiteralPart;
|
|
83
|
+
interface DateInputArgs extends FormControlSharedArgs {
|
|
84
|
+
/** The unique identifier for the control. */
|
|
85
|
+
id?: string;
|
|
86
|
+
/**
|
|
87
|
+
* The value submits under this name as `yyyy-MM-dd`, or as the local
|
|
88
|
+
* `yyyy-MM-ddTHH:mm` under an `hour` or `minute` granularity.
|
|
89
|
+
*/
|
|
90
|
+
name?: string;
|
|
91
|
+
/**
|
|
92
|
+
* A `Date`, or the same `yyyy-MM-dd` string this component writes to its
|
|
93
|
+
* hidden input.
|
|
94
|
+
*
|
|
95
|
+
* The field keeps its own segments and syncs *from* this argument: setting
|
|
96
|
+
* it replaces what is displayed, while typing updates the field immediately
|
|
97
|
+
* rather than waiting for `@value` to come back. `undefined` is ignored,
|
|
98
|
+
* which is why a `<form.Field>`-bound input still honors `@defaultValue`
|
|
99
|
+
* before form data exists.
|
|
100
|
+
*/
|
|
101
|
+
value?: Date | string | null;
|
|
102
|
+
/**
|
|
103
|
+
* The smallest unit the field edits. `hour` and `minute` add time segments
|
|
104
|
+
* after the date ones, in the locale's order.
|
|
105
|
+
*
|
|
106
|
+
* @defaultValue 'day'
|
|
107
|
+
*/
|
|
108
|
+
granularity?: Granularity;
|
|
109
|
+
/**
|
|
110
|
+
* Forces a 12- or 24-hour clock. A 12-hour one adds an AM/PM segment.
|
|
111
|
+
*
|
|
112
|
+
* @defaultValue the locale's
|
|
113
|
+
*/
|
|
114
|
+
hourCycle?: 12 | 24;
|
|
115
|
+
/** Seeds the value before any `@value` is supplied. */
|
|
116
|
+
defaultValue?: Date | string | null;
|
|
117
|
+
/**
|
|
118
|
+
* Fires with the composed `Date`, or `null` once a complete value is no
|
|
119
|
+
* longer complete. A partially typed date composes nothing and reports
|
|
120
|
+
* nothing.
|
|
121
|
+
*/
|
|
122
|
+
onChange?: (value: Date | null) => void;
|
|
123
|
+
/** Fires when focus leaves the field, not when it moves between segments. */
|
|
124
|
+
onBlur?: () => void;
|
|
125
|
+
/** @defaultValue navigator.language */
|
|
126
|
+
locale?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Decides which segments appear, their order, and their literals.
|
|
129
|
+
*
|
|
130
|
+
* @defaultValue { year: 'numeric', month: '2-digit', day: '2-digit' }
|
|
131
|
+
*/
|
|
132
|
+
formatOptions?: Intl.DateTimeFormatOptions;
|
|
133
|
+
/** Where ArrowUp on an empty segment starts. @defaultValue today */
|
|
134
|
+
placeholderValue?: Date;
|
|
135
|
+
/** The earliest allowed date. A value before it marks the field invalid. */
|
|
136
|
+
minValue?: Date;
|
|
137
|
+
/** The latest allowed date. A value after it marks the field invalid. */
|
|
138
|
+
maxValue?: Date;
|
|
139
|
+
/**
|
|
140
|
+
* Marks individual dates disallowed. A value it returns `true` for marks
|
|
141
|
+
* the field invalid. Like `@minValue` and `@maxValue`, it never blocks a
|
|
142
|
+
* keystroke.
|
|
143
|
+
*/
|
|
144
|
+
isDateUnavailable?: (date: Date) => boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Whether the value can be read and copied but not edited. The segments
|
|
147
|
+
* stay focusable and navigable.
|
|
148
|
+
*
|
|
149
|
+
* @defaultValue false
|
|
150
|
+
*/
|
|
151
|
+
isReadOnly?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Whether a clear button appears at the end of the field once any segment
|
|
154
|
+
* holds a digit. Never rendered on a disabled or read-only field.
|
|
155
|
+
*
|
|
156
|
+
* @defaultValue false
|
|
157
|
+
*/
|
|
158
|
+
isClearable?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* The size of the field. Matches `Input`'s and `Select`'s `@inputSize`.
|
|
161
|
+
*
|
|
162
|
+
* @defaultValue 'md'
|
|
163
|
+
*/
|
|
164
|
+
inputSize?: 'sm' | 'md' | 'lg';
|
|
165
|
+
/**
|
|
166
|
+
* The accessible names of the segments, for localizing them.
|
|
167
|
+
*
|
|
168
|
+
* @defaultValue { year: 'year', month: 'month', day: 'day', hour: 'hour', minute: 'minute', dayPeriod: 'AM/PM' }
|
|
169
|
+
*/
|
|
170
|
+
segmentLabels?: Partial<Record<SegmentType, string>>;
|
|
171
|
+
/** Per-slot class overrides. */
|
|
172
|
+
classes?: SlotsToClasses<DateInputSlots>;
|
|
173
|
+
}
|
|
174
|
+
export type { SegmentType, Granularity, HourCycle, TimeOptions, SegmentSlotFn, SegmentGroupClasses, SegmentGroupUserClasses, Segment, LiteralPart, Part, DateInputArgs, DateInputClasses };
|
|
175
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-input/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,wEAAwE;AACxE,KAAK,gBAAgB,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAE9E,iFAAiF;AACjF,KAAK,aAAa,GAAG,CAAC,KAAK,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,UAAU,CAAA;CAAE,KAAK,MAAM,CAAC;AAEhE;;;;;;;;GAQG;AACH,UAAU,mBAAmB;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,aAAa,CAAC;IACvB,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,yDAAyD;AACzD,KAAK,uBAAuB,GAAG,cAAc,CAAC,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;AAE/E;;;GAGG;AACH,KAAK,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE9E,0EAA0E;AAC1E,KAAK,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE7C;;;GAGG;AACH,KAAK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AACvC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC"}
|