@sprawlify/primitives 0.1.10 → 0.1.12
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/{collection-BBgC8xCb.cjs → collection-D0Abtxc0.cjs} +68 -0
- package/dist/{collection-DgzidRvr.mjs → collection-GSpaYJ2f.mjs} +45 -1
- package/dist/collection.cjs +5 -1
- package/dist/collection.d.cts +49 -3
- package/dist/collection.d.mts +49 -3
- package/dist/collection.mjs +2 -2
- package/dist/{focus-trap-BewqTQFt.cjs → focus-trap-BbU9QXMe.cjs} +1 -1
- package/dist/{focus-trap-Do8IUXYh.mjs → focus-trap-CzhQ01j4.mjs} +1 -1
- package/dist/focus-trap.cjs +1 -1
- package/dist/focus-trap.mjs +1 -1
- package/dist/{list-collection-B_8BN0XB.d.cts → list-collection-Cjgbx_9l.d.cts} +1 -1
- package/dist/{list-collection-DkRA5LOq.d.mts → list-collection-IF510iNl.d.mts} +1 -1
- package/dist/machines/accordion/index.d.cts +1 -1
- package/dist/machines/accordion/index.d.mts +1 -1
- package/dist/machines/angle-slider/index.d.cts +1 -1
- package/dist/machines/angle-slider/index.d.mts +1 -1
- package/dist/machines/cascade-select/index.cjs +1 -1
- package/dist/machines/cascade-select/index.d.cts +2 -2
- package/dist/machines/cascade-select/index.d.mts +2 -2
- package/dist/machines/cascade-select/index.mjs +1 -1
- package/dist/machines/clipboard/index.d.cts +1 -1
- package/dist/machines/clipboard/index.d.mts +1 -1
- package/dist/machines/collapsible/index.d.cts +1 -1
- package/dist/machines/collapsible/index.d.mts +1 -1
- package/dist/machines/color-picker/index.d.cts +1 -1
- package/dist/machines/color-picker/index.d.mts +1 -1
- package/dist/machines/combobox/index.cjs +279 -355
- package/dist/machines/combobox/index.d.cts +5 -4
- package/dist/machines/combobox/index.d.mts +5 -4
- package/dist/machines/combobox/index.mjs +279 -355
- package/dist/machines/date-input/index.cjs +1830 -0
- package/dist/machines/date-input/index.d.cts +223 -0
- package/dist/machines/date-input/index.d.mts +223 -0
- package/dist/machines/date-input/index.mjs +1813 -0
- package/dist/machines/date-picker/index.d.cts +1 -1
- package/dist/machines/date-picker/index.d.mts +1 -1
- package/dist/machines/dialog/index.cjs +1 -1
- package/dist/machines/dialog/index.d.cts +1 -1
- package/dist/machines/dialog/index.d.mts +1 -1
- package/dist/machines/dialog/index.mjs +1 -1
- package/dist/machines/drawer/index.cjs +1 -1
- package/dist/machines/drawer/index.d.cts +1 -1
- package/dist/machines/drawer/index.d.mts +1 -1
- package/dist/machines/drawer/index.mjs +1 -1
- package/dist/machines/dropdown-menu/index.d.cts +1 -1
- package/dist/machines/dropdown-menu/index.d.mts +1 -1
- package/dist/machines/editable/index.d.cts +1 -1
- package/dist/machines/editable/index.d.mts +1 -1
- package/dist/machines/file-upload/index.d.cts +1 -1
- package/dist/machines/file-upload/index.d.mts +1 -1
- package/dist/machines/floating-panel/index.d.cts +1 -1
- package/dist/machines/floating-panel/index.d.mts +1 -1
- package/dist/machines/hover-card/index.d.cts +1 -1
- package/dist/machines/hover-card/index.d.mts +1 -1
- package/dist/machines/listbox/index.cjs +41 -16
- package/dist/machines/listbox/index.d.cts +5 -4
- package/dist/machines/listbox/index.d.mts +5 -4
- package/dist/machines/listbox/index.mjs +42 -17
- package/dist/machines/marquee/index.d.cts +2 -2
- package/dist/machines/marquee/index.d.mts +2 -2
- package/dist/machines/navigation-menu/index.d.cts +1 -1
- package/dist/machines/navigation-menu/index.d.mts +1 -1
- package/dist/machines/number-input/index.d.cts +1 -1
- package/dist/machines/number-input/index.d.mts +1 -1
- package/dist/machines/password-input/index.d.cts +1 -1
- package/dist/machines/password-input/index.d.mts +1 -1
- package/dist/machines/pin-input/index.d.cts +1 -1
- package/dist/machines/pin-input/index.d.mts +1 -1
- package/dist/machines/popover/index.cjs +1 -1
- package/dist/machines/popover/index.d.cts +1 -1
- package/dist/machines/popover/index.d.mts +1 -1
- package/dist/machines/popover/index.mjs +1 -1
- package/dist/machines/progress/index.d.cts +1 -1
- package/dist/machines/progress/index.d.mts +1 -1
- package/dist/machines/select/index.cjs +47 -18
- package/dist/machines/select/index.d.cts +4 -3
- package/dist/machines/select/index.d.mts +4 -3
- package/dist/machines/select/index.mjs +48 -19
- package/dist/machines/signature-pad/index.d.cts +1 -1
- package/dist/machines/signature-pad/index.d.mts +1 -1
- package/dist/machines/slider/index.d.cts +1 -1
- package/dist/machines/slider/index.d.mts +1 -1
- package/dist/machines/steps/index.d.cts +1 -1
- package/dist/machines/steps/index.d.mts +1 -1
- package/dist/machines/switch/index.d.cts +1 -1
- package/dist/machines/switch/index.d.mts +1 -1
- package/dist/machines/tabs/index.d.cts +1 -1
- package/dist/machines/tabs/index.d.mts +1 -1
- package/dist/machines/tags-input/index.d.cts +1 -1
- package/dist/machines/tags-input/index.d.mts +1 -1
- package/dist/machines/timer/index.d.cts +1 -1
- package/dist/machines/timer/index.d.mts +1 -1
- package/dist/machines/toast/index.d.cts +1 -1
- package/dist/machines/toast/index.d.mts +1 -1
- package/dist/machines/tooltip/index.d.cts +1 -1
- package/dist/machines/tooltip/index.d.mts +1 -1
- package/dist/machines/tour/index.cjs +1 -1
- package/dist/machines/tour/index.d.cts +1 -1
- package/dist/machines/tour/index.d.mts +1 -1
- package/dist/machines/tour/index.mjs +1 -1
- package/dist/machines/tree-view/index.cjs +1 -1
- package/dist/machines/tree-view/index.d.cts +1 -1
- package/dist/machines/tree-view/index.d.mts +1 -1
- package/dist/machines/tree-view/index.mjs +1 -1
- package/dist/{selection-DdNvrKbj.d.mts → selection-6urf-c8j.d.mts} +1 -1
- package/dist/{selection-Bb_ZSVxe.d.cts → selection-BmS2RDMq.d.cts} +1 -1
- package/package.json +13 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { n as AnatomyInstance } from "../../create-anatomy-9eFQs7lO.cjs";
|
|
2
|
+
import { b as Service, p as Machine } from "../../types-u-LWCSDE.cjs";
|
|
3
|
+
import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
|
|
4
|
+
import { i as DateGranularity } from "../../types-MFO-RQR7.cjs";
|
|
5
|
+
import { t as LiveRegion } from "../../index-BO-Z3fhz.cjs";
|
|
6
|
+
import { AnyDateTime, Calendar, Calendar as Calendar$1, CalendarDate, CalendarDateTime, DateFormatter, DateFormatter as DateFormatter$1, DateValue, DateValue as DateValue$1, ZonedDateTime } from "@internationalized/date";
|
|
7
|
+
|
|
8
|
+
//#region src/machines/date-input/date-input.anatomy.d.ts
|
|
9
|
+
declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "hiddenInput" | "segment" | "segmentGroup">;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/machines/date-input/utils/incomplete-date.d.ts
|
|
12
|
+
type HourCycle$1 = "h12" | "h11" | "h23" | "h24";
|
|
13
|
+
declare class IncompleteDate {
|
|
14
|
+
calendar: Calendar$1;
|
|
15
|
+
era: string | null;
|
|
16
|
+
year: number | null;
|
|
17
|
+
month: number | null;
|
|
18
|
+
day: number | null;
|
|
19
|
+
hour: number | null;
|
|
20
|
+
hourCycle: HourCycle$1;
|
|
21
|
+
dayPeriod: number | null;
|
|
22
|
+
minute: number | null;
|
|
23
|
+
second: number | null;
|
|
24
|
+
millisecond: number | null;
|
|
25
|
+
offset: number | null;
|
|
26
|
+
constructor(calendar: Calendar$1, hourCycle: HourCycle$1, dateValue?: Partial<Omit<AnyDateTime, "copy">> | null);
|
|
27
|
+
copy(): IncompleteDate;
|
|
28
|
+
isComplete(segments: SegmentType[]): boolean;
|
|
29
|
+
isCleared(segments: SegmentType[]): boolean;
|
|
30
|
+
set(field: SegmentType, value: number | string, placeholder: DateValue$1): IncompleteDate;
|
|
31
|
+
clear(field: SegmentType): IncompleteDate;
|
|
32
|
+
cycle(field: SegmentType, amount: number, placeholder: DateValue$1, displaySegments: SegmentType[]): IncompleteDate;
|
|
33
|
+
toValue(value: DateValue$1): DateValue$1;
|
|
34
|
+
getSegmentLimits(type: string): {
|
|
35
|
+
value: number | null;
|
|
36
|
+
minValue: number;
|
|
37
|
+
maxValue: number;
|
|
38
|
+
} | undefined;
|
|
39
|
+
toString(): string;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/machines/date-input/utils/segments.d.ts
|
|
43
|
+
declare const EDITABLE_SEGMENTS: {
|
|
44
|
+
readonly year: true;
|
|
45
|
+
readonly month: true;
|
|
46
|
+
readonly day: true;
|
|
47
|
+
readonly hour: true;
|
|
48
|
+
readonly minute: true;
|
|
49
|
+
readonly second: true;
|
|
50
|
+
readonly dayPeriod: true;
|
|
51
|
+
readonly era: true;
|
|
52
|
+
readonly literal: false;
|
|
53
|
+
readonly timeZoneName: false;
|
|
54
|
+
readonly weekday: false;
|
|
55
|
+
readonly unknown: false;
|
|
56
|
+
readonly fractionalSecond: false;
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/machines/date-input/date-input.types.d.ts
|
|
60
|
+
interface ValueChangeDetails {
|
|
61
|
+
value: DateValue[];
|
|
62
|
+
valueAsString: string[];
|
|
63
|
+
}
|
|
64
|
+
interface PlaceholderChangeDetails extends ValueChangeDetails {
|
|
65
|
+
placeholderValue: DateValue;
|
|
66
|
+
}
|
|
67
|
+
interface FocusChangeDetails {
|
|
68
|
+
focused: boolean;
|
|
69
|
+
}
|
|
70
|
+
interface FormatDateDetails {
|
|
71
|
+
locale: string;
|
|
72
|
+
timeZone: string;
|
|
73
|
+
}
|
|
74
|
+
type SelectionMode = "single" | "range";
|
|
75
|
+
type HourCycle = 12 | 24;
|
|
76
|
+
interface IntlTranslations {
|
|
77
|
+
placeholder: (locale: string) => Record<EditableSegmentType, string>;
|
|
78
|
+
}
|
|
79
|
+
type ElementIds = Partial<{
|
|
80
|
+
root: string;
|
|
81
|
+
label: (index: number) => string;
|
|
82
|
+
control: string;
|
|
83
|
+
segmentGroup: (index: number) => string;
|
|
84
|
+
hiddenInput: (index: number) => string;
|
|
85
|
+
}>;
|
|
86
|
+
interface DateInputProps extends DirectionProperty, CommonProperties {
|
|
87
|
+
locale?: string | undefined;
|
|
88
|
+
translations?: IntlTranslations | undefined;
|
|
89
|
+
ids?: ElementIds | undefined;
|
|
90
|
+
name?: string | undefined;
|
|
91
|
+
form?: string | undefined;
|
|
92
|
+
timeZone?: string | undefined;
|
|
93
|
+
disabled?: boolean | undefined;
|
|
94
|
+
readOnly?: boolean | undefined;
|
|
95
|
+
required?: boolean | undefined;
|
|
96
|
+
invalid?: boolean | undefined;
|
|
97
|
+
min?: DateValue | undefined;
|
|
98
|
+
max?: DateValue | undefined;
|
|
99
|
+
value?: DateValue[] | undefined;
|
|
100
|
+
defaultValue?: DateValue[] | undefined;
|
|
101
|
+
placeholderValue?: DateValue | undefined;
|
|
102
|
+
defaultPlaceholderValue?: DateValue | undefined;
|
|
103
|
+
onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
|
|
104
|
+
onPlaceholderChange?: ((details: PlaceholderChangeDetails) => void) | undefined;
|
|
105
|
+
onFocusChange?: ((details: FocusChangeDetails) => void) | undefined;
|
|
106
|
+
selectionMode?: SelectionMode | undefined;
|
|
107
|
+
hourCycle?: HourCycle | undefined;
|
|
108
|
+
granularity?: DateGranularity | undefined;
|
|
109
|
+
shouldForceLeadingZeros?: boolean | undefined;
|
|
110
|
+
formatter?: DateFormatter | undefined;
|
|
111
|
+
allSegments?: Segments | undefined;
|
|
112
|
+
format?: ((date: DateValue, details: FormatDateDetails) => string) | undefined;
|
|
113
|
+
}
|
|
114
|
+
type PropsWithDefault = "selectionMode" | "locale" | "timeZone" | "granularity" | "translations" | "shouldForceLeadingZeros" | "formatter" | "allSegments" | "format";
|
|
115
|
+
interface PrivateContext {
|
|
116
|
+
activeIndex: number;
|
|
117
|
+
activeSegmentIndex: number;
|
|
118
|
+
value: DateValue[];
|
|
119
|
+
placeholderValue: DateValue;
|
|
120
|
+
displayValues: IncompleteDate[];
|
|
121
|
+
enteredKeys: string;
|
|
122
|
+
}
|
|
123
|
+
type ComputedContext = Readonly<{
|
|
124
|
+
isInteractive: boolean;
|
|
125
|
+
valueAsString: string[];
|
|
126
|
+
segments: DateSegment[][];
|
|
127
|
+
}>;
|
|
128
|
+
type Refs = {
|
|
129
|
+
announcer: LiveRegion | null;
|
|
130
|
+
segmentToAnnounceIndex: number | null;
|
|
131
|
+
};
|
|
132
|
+
interface DateInputSchema {
|
|
133
|
+
state: "idle" | "focused";
|
|
134
|
+
props: RequiredBy<DateInputProps, PropsWithDefault>;
|
|
135
|
+
context: PrivateContext;
|
|
136
|
+
computed: ComputedContext;
|
|
137
|
+
refs: Refs;
|
|
138
|
+
guard: string;
|
|
139
|
+
action: string;
|
|
140
|
+
effect: string;
|
|
141
|
+
}
|
|
142
|
+
type DateInputService = Service<DateInputSchema>;
|
|
143
|
+
type DateInputMachine = Machine<DateInputSchema>;
|
|
144
|
+
type SegmentType = "era" | "year" | "month" | "day" | "hour" | "minute" | "second" | "dayPeriod" | "literal" | "timeZoneName";
|
|
145
|
+
type Segments = Partial<{ -readonly [K in keyof typeof EDITABLE_SEGMENTS]: boolean }>;
|
|
146
|
+
type EditableSegmentType = { [K in keyof typeof EDITABLE_SEGMENTS]: (typeof EDITABLE_SEGMENTS)[K] extends true ? K : never }[keyof typeof EDITABLE_SEGMENTS];
|
|
147
|
+
interface DateSegment {
|
|
148
|
+
type: SegmentType;
|
|
149
|
+
text: string;
|
|
150
|
+
value?: number;
|
|
151
|
+
minValue?: number;
|
|
152
|
+
maxValue?: number;
|
|
153
|
+
isPlaceholder: boolean;
|
|
154
|
+
placeholder: string;
|
|
155
|
+
isEditable: boolean;
|
|
156
|
+
}
|
|
157
|
+
interface SegmentGroupProps {
|
|
158
|
+
index?: number | undefined;
|
|
159
|
+
}
|
|
160
|
+
interface SegmentsProps {
|
|
161
|
+
index?: number | undefined;
|
|
162
|
+
}
|
|
163
|
+
interface SegmentProps {
|
|
164
|
+
segment: DateSegment;
|
|
165
|
+
index?: number | undefined;
|
|
166
|
+
}
|
|
167
|
+
interface SegmentState {
|
|
168
|
+
editable: boolean;
|
|
169
|
+
}
|
|
170
|
+
interface LabelProps {
|
|
171
|
+
index?: number | undefined;
|
|
172
|
+
}
|
|
173
|
+
interface HiddenInputProps {
|
|
174
|
+
index?: number | undefined;
|
|
175
|
+
name?: string | undefined;
|
|
176
|
+
}
|
|
177
|
+
interface DateInputApi<T extends PropTypes = PropTypes> {
|
|
178
|
+
focused: boolean;
|
|
179
|
+
disabled: boolean;
|
|
180
|
+
invalid: boolean;
|
|
181
|
+
groupCount: number;
|
|
182
|
+
value: DateValue[];
|
|
183
|
+
valueAsDate: Date[];
|
|
184
|
+
valueAsString: string[];
|
|
185
|
+
placeholderValue: DateValue;
|
|
186
|
+
displayValues: IncompleteDate[];
|
|
187
|
+
setValue: (values: DateValue[]) => void;
|
|
188
|
+
clearValue: VoidFunction;
|
|
189
|
+
getSegments: (props?: SegmentsProps | undefined) => DateSegment[];
|
|
190
|
+
getSegmentState: (props: SegmentProps) => SegmentState;
|
|
191
|
+
getRootProps: () => T["element"];
|
|
192
|
+
getLabelProps: (props?: LabelProps) => T["label"];
|
|
193
|
+
getControlProps: () => T["element"];
|
|
194
|
+
getSegmentGroupProps: (props?: SegmentGroupProps | undefined) => T["element"];
|
|
195
|
+
getSegmentProps: (props: SegmentProps) => T["element"];
|
|
196
|
+
getHiddenInputProps: (props?: HiddenInputProps | undefined) => T["input"];
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/machines/date-input/date-input.connect.d.ts
|
|
200
|
+
declare function connect<T extends PropTypes>(service: DateInputService, normalize: NormalizeProps<T>): DateInputApi<T>;
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/machines/date-input/date-input.machine.d.ts
|
|
203
|
+
declare const machine: Machine<DateInputSchema>;
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/machines/date-input/date-input.parse.d.ts
|
|
206
|
+
declare function parse(value: string | Date): DateValue$1;
|
|
207
|
+
declare function parse(value: string[] | Date[]): DateValue$1[];
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/machines/date-input/date-input.props.d.ts
|
|
210
|
+
declare const props: (keyof DateInputProps)[];
|
|
211
|
+
declare const splitProps: <Props extends Partial<DateInputProps>>(props: Props) => [Partial<DateInputProps>, Omit<Props, keyof DateInputProps>];
|
|
212
|
+
declare const segmentProps: (keyof SegmentProps)[];
|
|
213
|
+
declare const splitSegmentProps: <Props extends SegmentProps>(props: Props) => [SegmentProps, Omit<Props, keyof SegmentProps>];
|
|
214
|
+
declare const segmentGroupProps: "index"[];
|
|
215
|
+
declare const splitSegmentGroupProps: <Props extends SegmentGroupProps>(props: Props) => [SegmentGroupProps, Omit<Props, "index">];
|
|
216
|
+
declare const segmentsProps: "index"[];
|
|
217
|
+
declare const splitSegmentsProps: <Props extends SegmentsProps>(props: Props) => [SegmentsProps, Omit<Props, "index">];
|
|
218
|
+
declare const labelProps: "index"[];
|
|
219
|
+
declare const splitLabelProps: <Props extends LabelProps>(props: Props) => [LabelProps, Omit<Props, "index">];
|
|
220
|
+
declare const hiddenInputProps: (keyof HiddenInputProps)[];
|
|
221
|
+
declare const splitHiddenInputProps: <Props extends HiddenInputProps>(props: Props) => [HiddenInputProps, Omit<Props, keyof HiddenInputProps>];
|
|
222
|
+
//#endregion
|
|
223
|
+
export { type DateInputApi as Api, type Calendar, type CalendarDate, type CalendarDateTime, type DateFormatter, type DateSegment, type DateValue, type EditableSegmentType, type ElementIds, type FocusChangeDetails, type FormatDateDetails, type HiddenInputProps, type HourCycle, type IntlTranslations, type LabelProps, type DateInputMachine as Machine, type PlaceholderChangeDetails, type DateInputProps as Props, type SegmentGroupProps, type SegmentProps, type SegmentState, type SegmentType, type Segments, type SegmentsProps, type SelectionMode, type DateInputService as Service, type ValueChangeDetails, type ZonedDateTime, anatomy, connect, hiddenInputProps, labelProps, machine, parse, props, segmentGroupProps, segmentProps, segmentsProps, splitHiddenInputProps, splitLabelProps, splitProps, splitSegmentGroupProps, splitSegmentProps, splitSegmentsProps };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { n as AnatomyInstance } from "../../create-anatomy-BedZVdg0.mjs";
|
|
2
|
+
import { b as Service, p as Machine } from "../../types-DvUmCWsb.mjs";
|
|
3
|
+
import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
|
|
4
|
+
import { Z as DateGranularity } from "../../index-BfUngXif.mjs";
|
|
5
|
+
import { t as LiveRegion } from "../../index-1L40UHp8.mjs";
|
|
6
|
+
import { AnyDateTime, Calendar, Calendar as Calendar$1, CalendarDate, CalendarDateTime, DateFormatter, DateFormatter as DateFormatter$1, DateValue, DateValue as DateValue$1, ZonedDateTime } from "@internationalized/date";
|
|
7
|
+
|
|
8
|
+
//#region src/machines/date-input/date-input.anatomy.d.ts
|
|
9
|
+
declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "hiddenInput" | "segment" | "segmentGroup">;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/machines/date-input/utils/incomplete-date.d.ts
|
|
12
|
+
type HourCycle$1 = "h12" | "h11" | "h23" | "h24";
|
|
13
|
+
declare class IncompleteDate {
|
|
14
|
+
calendar: Calendar$1;
|
|
15
|
+
era: string | null;
|
|
16
|
+
year: number | null;
|
|
17
|
+
month: number | null;
|
|
18
|
+
day: number | null;
|
|
19
|
+
hour: number | null;
|
|
20
|
+
hourCycle: HourCycle$1;
|
|
21
|
+
dayPeriod: number | null;
|
|
22
|
+
minute: number | null;
|
|
23
|
+
second: number | null;
|
|
24
|
+
millisecond: number | null;
|
|
25
|
+
offset: number | null;
|
|
26
|
+
constructor(calendar: Calendar$1, hourCycle: HourCycle$1, dateValue?: Partial<Omit<AnyDateTime, "copy">> | null);
|
|
27
|
+
copy(): IncompleteDate;
|
|
28
|
+
isComplete(segments: SegmentType[]): boolean;
|
|
29
|
+
isCleared(segments: SegmentType[]): boolean;
|
|
30
|
+
set(field: SegmentType, value: number | string, placeholder: DateValue$1): IncompleteDate;
|
|
31
|
+
clear(field: SegmentType): IncompleteDate;
|
|
32
|
+
cycle(field: SegmentType, amount: number, placeholder: DateValue$1, displaySegments: SegmentType[]): IncompleteDate;
|
|
33
|
+
toValue(value: DateValue$1): DateValue$1;
|
|
34
|
+
getSegmentLimits(type: string): {
|
|
35
|
+
value: number | null;
|
|
36
|
+
minValue: number;
|
|
37
|
+
maxValue: number;
|
|
38
|
+
} | undefined;
|
|
39
|
+
toString(): string;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/machines/date-input/utils/segments.d.ts
|
|
43
|
+
declare const EDITABLE_SEGMENTS: {
|
|
44
|
+
readonly year: true;
|
|
45
|
+
readonly month: true;
|
|
46
|
+
readonly day: true;
|
|
47
|
+
readonly hour: true;
|
|
48
|
+
readonly minute: true;
|
|
49
|
+
readonly second: true;
|
|
50
|
+
readonly dayPeriod: true;
|
|
51
|
+
readonly era: true;
|
|
52
|
+
readonly literal: false;
|
|
53
|
+
readonly timeZoneName: false;
|
|
54
|
+
readonly weekday: false;
|
|
55
|
+
readonly unknown: false;
|
|
56
|
+
readonly fractionalSecond: false;
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/machines/date-input/date-input.types.d.ts
|
|
60
|
+
interface ValueChangeDetails {
|
|
61
|
+
value: DateValue[];
|
|
62
|
+
valueAsString: string[];
|
|
63
|
+
}
|
|
64
|
+
interface PlaceholderChangeDetails extends ValueChangeDetails {
|
|
65
|
+
placeholderValue: DateValue;
|
|
66
|
+
}
|
|
67
|
+
interface FocusChangeDetails {
|
|
68
|
+
focused: boolean;
|
|
69
|
+
}
|
|
70
|
+
interface FormatDateDetails {
|
|
71
|
+
locale: string;
|
|
72
|
+
timeZone: string;
|
|
73
|
+
}
|
|
74
|
+
type SelectionMode = "single" | "range";
|
|
75
|
+
type HourCycle = 12 | 24;
|
|
76
|
+
interface IntlTranslations {
|
|
77
|
+
placeholder: (locale: string) => Record<EditableSegmentType, string>;
|
|
78
|
+
}
|
|
79
|
+
type ElementIds = Partial<{
|
|
80
|
+
root: string;
|
|
81
|
+
label: (index: number) => string;
|
|
82
|
+
control: string;
|
|
83
|
+
segmentGroup: (index: number) => string;
|
|
84
|
+
hiddenInput: (index: number) => string;
|
|
85
|
+
}>;
|
|
86
|
+
interface DateInputProps extends DirectionProperty, CommonProperties {
|
|
87
|
+
locale?: string | undefined;
|
|
88
|
+
translations?: IntlTranslations | undefined;
|
|
89
|
+
ids?: ElementIds | undefined;
|
|
90
|
+
name?: string | undefined;
|
|
91
|
+
form?: string | undefined;
|
|
92
|
+
timeZone?: string | undefined;
|
|
93
|
+
disabled?: boolean | undefined;
|
|
94
|
+
readOnly?: boolean | undefined;
|
|
95
|
+
required?: boolean | undefined;
|
|
96
|
+
invalid?: boolean | undefined;
|
|
97
|
+
min?: DateValue | undefined;
|
|
98
|
+
max?: DateValue | undefined;
|
|
99
|
+
value?: DateValue[] | undefined;
|
|
100
|
+
defaultValue?: DateValue[] | undefined;
|
|
101
|
+
placeholderValue?: DateValue | undefined;
|
|
102
|
+
defaultPlaceholderValue?: DateValue | undefined;
|
|
103
|
+
onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
|
|
104
|
+
onPlaceholderChange?: ((details: PlaceholderChangeDetails) => void) | undefined;
|
|
105
|
+
onFocusChange?: ((details: FocusChangeDetails) => void) | undefined;
|
|
106
|
+
selectionMode?: SelectionMode | undefined;
|
|
107
|
+
hourCycle?: HourCycle | undefined;
|
|
108
|
+
granularity?: DateGranularity | undefined;
|
|
109
|
+
shouldForceLeadingZeros?: boolean | undefined;
|
|
110
|
+
formatter?: DateFormatter | undefined;
|
|
111
|
+
allSegments?: Segments | undefined;
|
|
112
|
+
format?: ((date: DateValue, details: FormatDateDetails) => string) | undefined;
|
|
113
|
+
}
|
|
114
|
+
type PropsWithDefault = "selectionMode" | "locale" | "timeZone" | "granularity" | "translations" | "shouldForceLeadingZeros" | "formatter" | "allSegments" | "format";
|
|
115
|
+
interface PrivateContext {
|
|
116
|
+
activeIndex: number;
|
|
117
|
+
activeSegmentIndex: number;
|
|
118
|
+
value: DateValue[];
|
|
119
|
+
placeholderValue: DateValue;
|
|
120
|
+
displayValues: IncompleteDate[];
|
|
121
|
+
enteredKeys: string;
|
|
122
|
+
}
|
|
123
|
+
type ComputedContext = Readonly<{
|
|
124
|
+
isInteractive: boolean;
|
|
125
|
+
valueAsString: string[];
|
|
126
|
+
segments: DateSegment[][];
|
|
127
|
+
}>;
|
|
128
|
+
type Refs = {
|
|
129
|
+
announcer: LiveRegion | null;
|
|
130
|
+
segmentToAnnounceIndex: number | null;
|
|
131
|
+
};
|
|
132
|
+
interface DateInputSchema {
|
|
133
|
+
state: "idle" | "focused";
|
|
134
|
+
props: RequiredBy<DateInputProps, PropsWithDefault>;
|
|
135
|
+
context: PrivateContext;
|
|
136
|
+
computed: ComputedContext;
|
|
137
|
+
refs: Refs;
|
|
138
|
+
guard: string;
|
|
139
|
+
action: string;
|
|
140
|
+
effect: string;
|
|
141
|
+
}
|
|
142
|
+
type DateInputService = Service<DateInputSchema>;
|
|
143
|
+
type DateInputMachine = Machine<DateInputSchema>;
|
|
144
|
+
type SegmentType = "era" | "year" | "month" | "day" | "hour" | "minute" | "second" | "dayPeriod" | "literal" | "timeZoneName";
|
|
145
|
+
type Segments = Partial<{ -readonly [K in keyof typeof EDITABLE_SEGMENTS]: boolean }>;
|
|
146
|
+
type EditableSegmentType = { [K in keyof typeof EDITABLE_SEGMENTS]: (typeof EDITABLE_SEGMENTS)[K] extends true ? K : never }[keyof typeof EDITABLE_SEGMENTS];
|
|
147
|
+
interface DateSegment {
|
|
148
|
+
type: SegmentType;
|
|
149
|
+
text: string;
|
|
150
|
+
value?: number;
|
|
151
|
+
minValue?: number;
|
|
152
|
+
maxValue?: number;
|
|
153
|
+
isPlaceholder: boolean;
|
|
154
|
+
placeholder: string;
|
|
155
|
+
isEditable: boolean;
|
|
156
|
+
}
|
|
157
|
+
interface SegmentGroupProps {
|
|
158
|
+
index?: number | undefined;
|
|
159
|
+
}
|
|
160
|
+
interface SegmentsProps {
|
|
161
|
+
index?: number | undefined;
|
|
162
|
+
}
|
|
163
|
+
interface SegmentProps {
|
|
164
|
+
segment: DateSegment;
|
|
165
|
+
index?: number | undefined;
|
|
166
|
+
}
|
|
167
|
+
interface SegmentState {
|
|
168
|
+
editable: boolean;
|
|
169
|
+
}
|
|
170
|
+
interface LabelProps {
|
|
171
|
+
index?: number | undefined;
|
|
172
|
+
}
|
|
173
|
+
interface HiddenInputProps {
|
|
174
|
+
index?: number | undefined;
|
|
175
|
+
name?: string | undefined;
|
|
176
|
+
}
|
|
177
|
+
interface DateInputApi<T extends PropTypes = PropTypes> {
|
|
178
|
+
focused: boolean;
|
|
179
|
+
disabled: boolean;
|
|
180
|
+
invalid: boolean;
|
|
181
|
+
groupCount: number;
|
|
182
|
+
value: DateValue[];
|
|
183
|
+
valueAsDate: Date[];
|
|
184
|
+
valueAsString: string[];
|
|
185
|
+
placeholderValue: DateValue;
|
|
186
|
+
displayValues: IncompleteDate[];
|
|
187
|
+
setValue: (values: DateValue[]) => void;
|
|
188
|
+
clearValue: VoidFunction;
|
|
189
|
+
getSegments: (props?: SegmentsProps | undefined) => DateSegment[];
|
|
190
|
+
getSegmentState: (props: SegmentProps) => SegmentState;
|
|
191
|
+
getRootProps: () => T["element"];
|
|
192
|
+
getLabelProps: (props?: LabelProps) => T["label"];
|
|
193
|
+
getControlProps: () => T["element"];
|
|
194
|
+
getSegmentGroupProps: (props?: SegmentGroupProps | undefined) => T["element"];
|
|
195
|
+
getSegmentProps: (props: SegmentProps) => T["element"];
|
|
196
|
+
getHiddenInputProps: (props?: HiddenInputProps | undefined) => T["input"];
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/machines/date-input/date-input.connect.d.ts
|
|
200
|
+
declare function connect<T extends PropTypes>(service: DateInputService, normalize: NormalizeProps<T>): DateInputApi<T>;
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/machines/date-input/date-input.machine.d.ts
|
|
203
|
+
declare const machine: Machine<DateInputSchema>;
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/machines/date-input/date-input.parse.d.ts
|
|
206
|
+
declare function parse(value: string | Date): DateValue$1;
|
|
207
|
+
declare function parse(value: string[] | Date[]): DateValue$1[];
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/machines/date-input/date-input.props.d.ts
|
|
210
|
+
declare const props: (keyof DateInputProps)[];
|
|
211
|
+
declare const splitProps: <Props extends Partial<DateInputProps>>(props: Props) => [Partial<DateInputProps>, Omit<Props, keyof DateInputProps>];
|
|
212
|
+
declare const segmentProps: (keyof SegmentProps)[];
|
|
213
|
+
declare const splitSegmentProps: <Props extends SegmentProps>(props: Props) => [SegmentProps, Omit<Props, keyof SegmentProps>];
|
|
214
|
+
declare const segmentGroupProps: "index"[];
|
|
215
|
+
declare const splitSegmentGroupProps: <Props extends SegmentGroupProps>(props: Props) => [SegmentGroupProps, Omit<Props, "index">];
|
|
216
|
+
declare const segmentsProps: "index"[];
|
|
217
|
+
declare const splitSegmentsProps: <Props extends SegmentsProps>(props: Props) => [SegmentsProps, Omit<Props, "index">];
|
|
218
|
+
declare const labelProps: "index"[];
|
|
219
|
+
declare const splitLabelProps: <Props extends LabelProps>(props: Props) => [LabelProps, Omit<Props, "index">];
|
|
220
|
+
declare const hiddenInputProps: (keyof HiddenInputProps)[];
|
|
221
|
+
declare const splitHiddenInputProps: <Props extends HiddenInputProps>(props: Props) => [HiddenInputProps, Omit<Props, keyof HiddenInputProps>];
|
|
222
|
+
//#endregion
|
|
223
|
+
export { type DateInputApi as Api, type Calendar, type CalendarDate, type CalendarDateTime, type DateFormatter, type DateSegment, type DateValue, type EditableSegmentType, type ElementIds, type FocusChangeDetails, type FormatDateDetails, type HiddenInputProps, type HourCycle, type IntlTranslations, type LabelProps, type DateInputMachine as Machine, type PlaceholderChangeDetails, type DateInputProps as Props, type SegmentGroupProps, type SegmentProps, type SegmentState, type SegmentType, type Segments, type SegmentsProps, type SelectionMode, type DateInputService as Service, type ValueChangeDetails, type ZonedDateTime, anatomy, connect, hiddenInputProps, labelProps, machine, parse, props, segmentGroupProps, segmentProps, segmentsProps, splitHiddenInputProps, splitLabelProps, splitProps, splitSegmentGroupProps, splitSegmentProps, splitSegmentsProps };
|