frontile 0.18.0-beta.1 → 0.18.0-beta.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/deprecated-args.d.ts +18 -0
- package/declarations/-private/notification.d.ts +4 -4
- package/declarations/-private/types.d.ts +10 -8
- package/declarations/components/buttons/button-group.d.ts +3 -1
- package/declarations/components/buttons/button.d.ts +12 -3
- package/declarations/components/buttons/chip.d.ts +15 -8
- package/declarations/components/buttons/close-button.d.ts +5 -2
- package/declarations/components/buttons/segmented-control/segmented-control.d.ts +9 -9
- package/declarations/components/buttons/toggle-button.d.ts +9 -1
- package/declarations/components/collections/calendar/calendar.d.ts +49 -49
- package/declarations/components/collections/calendar/utils.d.ts +1 -0
- package/declarations/components/collections/dropdown/dropdown.d.ts +13 -2
- package/declarations/components/collections/dropdown/menu-context.d.ts +3 -3
- package/declarations/components/collections/listbox/group.d.ts +7 -2
- package/declarations/components/collections/listbox/item.d.ts +27 -6
- package/declarations/components/collections/listbox/listbox.d.ts +31 -4
- package/declarations/components/collections/simple-table/body.d.ts +68 -68
- package/declarations/components/collections/simple-table/cell.d.ts +68 -68
- package/declarations/components/collections/simple-table/column.d.ts +68 -68
- package/declarations/components/collections/simple-table/footer.d.ts +68 -68
- package/declarations/components/collections/simple-table/header.d.ts +68 -68
- package/declarations/components/collections/simple-table/index.d.ts +68 -68
- package/declarations/components/collections/simple-table/row.d.ts +68 -68
- package/declarations/components/collections/table/column-visibility.d.ts +68 -68
- package/declarations/components/collections/table/sort-button.d.ts +68 -68
- package/declarations/components/collections/table/table.d.ts +68 -68
- package/declarations/components/disclosure/accordion/accordion.d.ts +23 -23
- package/declarations/components/forms/autocomplete.d.ts +24 -12
- package/declarations/components/forms/date-picker/date-picker.d.ts +268 -0
- package/declarations/components/forms/date-picker/end-content.d.ts +29 -0
- package/declarations/components/forms/date-picker/trigger.d.ts +40 -0
- package/declarations/components/forms/date-picker/types.d.ts +149 -0
- package/declarations/components/forms/date-picker/value.d.ts +43 -0
- package/declarations/components/forms/date-picker.d.ts +3 -0
- package/declarations/components/forms/field.d.ts +5 -0
- package/declarations/components/forms/form-control.d.ts +1 -1
- package/declarations/components/forms/form-feedback.d.ts +17 -2
- package/declarations/components/forms/icons.d.ts +4 -1
- package/declarations/components/forms/index.d.ts +2 -0
- package/declarations/components/forms/input.d.ts +10 -10
- package/declarations/components/forms/native-select.d.ts +7 -7
- package/declarations/components/forms/select/select.d.ts +30 -17
- package/declarations/components/forms/select/types.d.ts +42 -12
- package/declarations/components/forms/switch.d.ts +22 -18
- package/declarations/components/forms/textarea.d.ts +6 -6
- package/declarations/components/navigation/pagination/pagination.d.ts +18 -18
- package/declarations/components/navigation/tab-nav/tab-nav.d.ts +12 -12
- package/declarations/components/navigation/tabs/tabs.d.ts +12 -12
- package/declarations/components/notifications/index.d.ts +2 -2
- package/declarations/components/notifications/notification-card.d.ts +5 -5
- package/declarations/components/notifications/notifications-container.d.ts +2 -2
- package/declarations/components/overlays/drawer.d.ts +32 -32
- package/declarations/components/overlays/popover.d.ts +1 -1
- package/declarations/components/overlays/tooltip.d.ts +2 -2
- package/declarations/components/status/alert.d.ts +10 -10
- package/declarations/components/status/progress-bar.d.ts +5 -1
- package/declarations/components/utilities/kbd.d.ts +4 -4
- package/declarations/components/utilities/spinner.d.ts +14 -7
- package/declarations/index.d.ts +1 -1
- package/declarations/template-registry.d.ts +2 -1
- package/dist/components/buttons/button-group.js +26 -1
- package/dist/components/buttons/button-group.js.map +1 -1
- package/dist/components/buttons/button.js +21 -2
- package/dist/components/buttons/button.js.map +1 -1
- package/dist/components/buttons/chip.js +19 -2
- package/dist/components/buttons/chip.js.map +1 -1
- package/dist/components/buttons/close-button.js +17 -1
- package/dist/components/buttons/close-button.js.map +1 -1
- package/dist/components/buttons/segmented-control/segmented-control.js +1 -1
- package/dist/components/buttons/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/buttons/toggle-button.js +36 -2
- package/dist/components/buttons/toggle-button.js.map +1 -1
- package/dist/components/collections/calendar/calendar.js +36 -3
- package/dist/components/collections/calendar/calendar.js.map +1 -1
- package/dist/components/collections/calendar/utils.js +1 -1
- package/dist/components/collections/calendar/utils.js.map +1 -1
- package/dist/components/collections/command/footer.js +1 -1
- package/dist/components/collections/command/footer.js.map +1 -1
- package/dist/components/collections/command/list.js +1 -1
- package/dist/components/collections/command/list.js.map +1 -1
- package/dist/components/collections/dropdown/dropdown.js +45 -7
- package/dist/components/collections/dropdown/dropdown.js.map +1 -1
- package/dist/components/collections/dropdown/menu-context.js.map +1 -1
- package/dist/components/collections/listbox/group.js +1 -1
- package/dist/components/collections/listbox/group.js.map +1 -1
- package/dist/components/collections/listbox/item.js +47 -8
- package/dist/components/collections/listbox/item.js.map +1 -1
- package/dist/components/collections/listbox/listbox.js +53 -2
- package/dist/components/collections/listbox/listbox.js.map +1 -1
- package/dist/components/collections/table/column-visibility.js +1 -1
- package/dist/components/collections/table/column-visibility.js.map +1 -1
- package/dist/components/disclosure/accordion/accordion.js.map +1 -1
- package/dist/components/forms/autocomplete.js +47 -2
- package/dist/components/forms/autocomplete.js.map +1 -1
- package/dist/components/forms/date-picker/date-picker.js +301 -0
- package/dist/components/forms/date-picker/date-picker.js.map +1 -0
- package/dist/components/forms/date-picker/end-content.js +21 -0
- package/dist/components/forms/date-picker/end-content.js.map +1 -0
- package/dist/components/forms/date-picker/trigger.js +14 -0
- package/dist/components/forms/date-picker/trigger.js.map +1 -0
- package/dist/components/forms/date-picker/types.js +2 -0
- package/dist/components/forms/date-picker/types.js.map +1 -0
- package/dist/components/forms/date-picker/value.js +97 -0
- package/dist/components/forms/date-picker/value.js.map +1 -0
- package/dist/components/forms/date-picker.js +2 -0
- package/dist/components/forms/date-picker.js.map +1 -0
- package/dist/components/forms/field.js +3 -1
- package/dist/components/forms/field.js.map +1 -1
- package/dist/components/forms/form-control.js +1 -1
- package/dist/components/forms/form-control.js.map +1 -1
- package/dist/components/forms/form-feedback.js +25 -2
- package/dist/components/forms/form-feedback.js.map +1 -1
- package/dist/components/forms/icons.js +4 -1
- package/dist/components/forms/icons.js.map +1 -1
- package/dist/components/forms/index.js +2 -0
- package/dist/components/forms/index.js.map +1 -1
- package/dist/components/forms/input.js +1 -1
- package/dist/components/forms/input.js.map +1 -1
- package/dist/components/forms/select/end-content.js +1 -1
- package/dist/components/forms/select/end-content.js.map +1 -1
- package/dist/components/forms/select/select.js +61 -7
- package/dist/components/forms/select/select.js.map +1 -1
- package/dist/components/forms/select/selected-items.js +1 -1
- package/dist/components/forms/select/selected-items.js.map +1 -1
- package/dist/components/forms/switch.js +9 -1
- package/dist/components/forms/switch.js.map +1 -1
- package/dist/components/navigation/pagination/pagination.js +1 -1
- package/dist/components/navigation/pagination/pagination.js.map +1 -1
- package/dist/components/navigation/tab-nav/tab-nav.js +1 -1
- package/dist/components/navigation/tab-nav/tab-nav.js.map +1 -1
- package/dist/components/navigation/tabs/tabs.js +1 -1
- package/dist/components/navigation/tabs/tabs.js.map +1 -1
- package/dist/components/notifications/index.js +2 -2
- package/dist/components/notifications/notification-card.js +1 -1
- package/dist/components/notifications/notifications-container.js +1 -1
- package/dist/components/notifications/notifications-container.js.map +1 -1
- package/dist/components/overlays/drawer.js +3 -3
- package/dist/components/overlays/drawer.js.map +1 -1
- package/dist/components/overlays/popover.js.map +1 -1
- package/dist/components/overlays/tooltip.js +1 -1
- package/dist/components/overlays/tooltip.js.map +1 -1
- package/dist/components/status/alert.js +19 -15
- package/dist/components/status/alert.js.map +1 -1
- package/dist/components/status/progress-bar.js +9 -1
- package/dist/components/status/progress-bar.js.map +1 -1
- package/dist/components/utilities/kbd.js +2 -2
- package/dist/components/utilities/kbd.js.map +1 -1
- package/dist/components/utilities/spinner.js +26 -7
- package/dist/components/utilities/spinner.js.map +1 -1
- package/dist/deprecated-args-BIUjLA8y.js +32 -0
- package/dist/deprecated-args-BIUjLA8y.js.map +1 -0
- package/dist/forms.js +2 -0
- package/dist/forms.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/{manager-CDIZzrQ9.js → manager-B-PnYqDs.js} +28 -22
- package/dist/manager-B-PnYqDs.js.map +1 -0
- package/dist/{notification-card-BHTra4Zh.js → notification-card-CYmWQ35W.js} +25 -22
- package/dist/notification-card-CYmWQ35W.js.map +1 -0
- package/dist/notifications.js +2 -2
- package/dist/services/notifications.js +1 -1
- package/package.json +3 -3
- package/dist/manager-CDIZzrQ9.js.map +0 -1
- package/dist/notification-card-BHTra4Zh.js.map +0 -1
|
@@ -7,7 +7,7 @@ import { ControlBlurTracker } from '../../-private/control-blur';
|
|
|
7
7
|
import { type PopoverSignature, type ContentSignature } from '../overlays/popover';
|
|
8
8
|
import { type FormControlSharedArgs } from './form-control';
|
|
9
9
|
import { type FilterFn } from '../../utils/filter';
|
|
10
|
-
interface AutocompleteArgs<T> extends Pick<PopoverSignature['Args'], 'placement' | 'flipOptions' | 'middleware' | 'shiftOptions' | 'offsetOptions' | 'strategy' | 'didClose'>, Pick<ListboxSignature<T>['Args'], 'appearance' | 'intent' | 'disabledKeys' | 'allowEmpty' | 'items' | 'onAction'>, Pick<ContentSignature['Args'], 'renderInPlace' | 'target' | 'transitionDuration' | 'backdrop' | 'disableTransitions' | 'focusTrapOptions' | 'closeOnOutsideClick' | 'closeOnEscapeKey' | 'backdropTransition' | 'transition'>, FormControlSharedArgs {
|
|
10
|
+
interface AutocompleteArgs<T> extends Pick<PopoverSignature['Args'], 'placement' | 'flipOptions' | 'middleware' | 'shiftOptions' | 'offsetOptions' | 'strategy' | 'didClose'>, Pick<ListboxSignature<T>['Args'], 'variant' | 'appearance' | 'color' | 'intent' | 'disabledKeys' | 'allowEmpty' | 'items' | 'onAction'>, Pick<ContentSignature['Args'], 'renderInPlace' | 'target' | 'transitionDuration' | 'backdrop' | 'disableTransitions' | 'focusTrapOptions' | 'closeOnOutsideClick' | 'closeOnEscapeKey' | 'backdropTransition' | 'transition'>, FormControlSharedArgs {
|
|
11
11
|
/**
|
|
12
12
|
* The currently selected key.
|
|
13
13
|
*
|
|
@@ -321,94 +321,106 @@ declare class Autocomplete<T = unknown> extends Component<AutocompleteSignature<
|
|
|
321
321
|
get classes(): {
|
|
322
322
|
base: (slotProps?: ({
|
|
323
323
|
size?: "sm" | "md" | "lg" | undefined;
|
|
324
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
325
324
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
326
325
|
hasStartContent?: boolean | undefined;
|
|
327
326
|
hasEndContent?: boolean | undefined;
|
|
328
327
|
hasChips?: boolean | undefined;
|
|
328
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
329
329
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
330
330
|
innerContainer: (slotProps?: ({
|
|
331
331
|
size?: "sm" | "md" | "lg" | undefined;
|
|
332
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
333
332
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
334
333
|
hasStartContent?: boolean | undefined;
|
|
335
334
|
hasEndContent?: boolean | undefined;
|
|
336
335
|
hasChips?: boolean | undefined;
|
|
336
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
337
337
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
338
338
|
startContent: (slotProps?: ({
|
|
339
339
|
size?: "sm" | "md" | "lg" | undefined;
|
|
340
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
341
340
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
342
341
|
hasStartContent?: boolean | undefined;
|
|
343
342
|
hasEndContent?: boolean | undefined;
|
|
344
343
|
hasChips?: boolean | undefined;
|
|
344
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
345
345
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
346
346
|
endContent: (slotProps?: ({
|
|
347
347
|
size?: "sm" | "md" | "lg" | undefined;
|
|
348
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
349
348
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
350
349
|
hasStartContent?: boolean | undefined;
|
|
351
350
|
hasEndContent?: boolean | undefined;
|
|
352
351
|
hasChips?: boolean | undefined;
|
|
352
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
353
353
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
354
354
|
input: (slotProps?: ({
|
|
355
355
|
size?: "sm" | "md" | "lg" | undefined;
|
|
356
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
357
356
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
358
357
|
hasStartContent?: boolean | undefined;
|
|
359
358
|
hasEndContent?: boolean | undefined;
|
|
360
359
|
hasChips?: boolean | undefined;
|
|
360
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
361
361
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
362
362
|
} & {
|
|
363
363
|
base: (slotProps?: ({
|
|
364
364
|
size?: "sm" | "md" | "lg" | undefined;
|
|
365
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
366
365
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
367
366
|
hasStartContent?: boolean | undefined;
|
|
368
367
|
hasEndContent?: boolean | undefined;
|
|
369
368
|
hasChips?: boolean | undefined;
|
|
369
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
370
370
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
371
371
|
listbox: (slotProps?: ({
|
|
372
372
|
size?: "sm" | "md" | "lg" | undefined;
|
|
373
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
374
373
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
375
374
|
hasStartContent?: boolean | undefined;
|
|
376
375
|
hasEndContent?: boolean | undefined;
|
|
377
376
|
hasChips?: boolean | undefined;
|
|
377
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
378
378
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
379
379
|
icon: (slotProps?: ({
|
|
380
380
|
size?: "sm" | "md" | "lg" | undefined;
|
|
381
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
382
381
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
383
382
|
hasStartContent?: boolean | undefined;
|
|
384
383
|
hasEndContent?: boolean | undefined;
|
|
385
384
|
hasChips?: boolean | undefined;
|
|
385
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
386
386
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
387
387
|
clearButton: (slotProps?: ({
|
|
388
388
|
size?: "sm" | "md" | "lg" | undefined;
|
|
389
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
390
389
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
391
390
|
hasStartContent?: boolean | undefined;
|
|
392
391
|
hasEndContent?: boolean | undefined;
|
|
393
392
|
hasChips?: boolean | undefined;
|
|
393
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
394
394
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
395
395
|
input: (slotProps?: ({
|
|
396
396
|
size?: "sm" | "md" | "lg" | undefined;
|
|
397
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
398
397
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
399
398
|
hasStartContent?: boolean | undefined;
|
|
400
399
|
hasEndContent?: boolean | undefined;
|
|
401
400
|
hasChips?: boolean | undefined;
|
|
401
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
402
402
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
403
403
|
emptyContent: (slotProps?: ({
|
|
404
404
|
size?: "sm" | "md" | "lg" | undefined;
|
|
405
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
406
405
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
407
406
|
hasStartContent?: boolean | undefined;
|
|
408
407
|
hasEndContent?: boolean | undefined;
|
|
409
408
|
hasChips?: boolean | undefined;
|
|
409
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
410
410
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
411
411
|
} & {};
|
|
412
|
+
/**
|
|
413
|
+
* Resolved once (`@cached`) and forwarded to the internal `Listbox` as
|
|
414
|
+
* `@variant` only -- never `@appearance` as well, which would make the
|
|
415
|
+
* inner `Listbox` raise its own deprecation for the same usage.
|
|
416
|
+
*/
|
|
417
|
+
get variant(): "solid" | "subtle" | "outline" | undefined;
|
|
418
|
+
/**
|
|
419
|
+
* Resolved once (`@cached`) and forwarded to the internal `Listbox` as
|
|
420
|
+
* `@color` only -- never `@intent` as well, which would make the inner
|
|
421
|
+
* `Listbox` raise its own deprecation for the same usage.
|
|
422
|
+
*/
|
|
423
|
+
get color(): "neutral" | "primary" | "secondary" | "tertiary" | "success" | "warning" | "danger" | undefined;
|
|
412
424
|
/**
|
|
413
425
|
* Whether the clear button takes the chevron's place: something to clear,
|
|
414
426
|
* and a control that can act on it.
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { ControlBlurTracker } from '../../../-private/control-blur';
|
|
3
|
+
import type { CalendarMode, CalendarValue } from '../../collections/calendar/types';
|
|
4
|
+
import type { DatePickerArgs, DatePickerValueBlockArg, DatePickerCalendarArgs, DatePickerFooterArg } from './types';
|
|
5
|
+
interface DatePickerSignature<M extends CalendarMode = 'single'> {
|
|
6
|
+
Args: DatePickerArgs<M>;
|
|
7
|
+
Blocks: {
|
|
8
|
+
value: [DatePickerValueBlockArg<M>];
|
|
9
|
+
calendar: [DatePickerCalendarArgs<M>];
|
|
10
|
+
footer: [DatePickerFooterArg<M>];
|
|
11
|
+
};
|
|
12
|
+
Element: HTMLDivElement;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A date field: a button trigger showing the formatted value, and a calendar
|
|
16
|
+
* in a popover. `@mode="range"` switches both the calendar and the value shape
|
|
17
|
+
* to a `{ start, end }` range.
|
|
18
|
+
*/
|
|
19
|
+
declare class DatePicker<M extends CalendarMode = 'single'> extends Component<DatePickerSignature<M>> {
|
|
20
|
+
triggerRef: {
|
|
21
|
+
current: HTMLButtonElement | undefined;
|
|
22
|
+
"__#6@#onChange"?: ((el: HTMLButtonElement | undefined) => void) | undefined;
|
|
23
|
+
setup: import("ember-modifier").FunctionBasedModifier<{
|
|
24
|
+
Args: {
|
|
25
|
+
Positional: unknown[];
|
|
26
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
27
|
+
};
|
|
28
|
+
Element: HTMLButtonElement;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
containerRef: {
|
|
32
|
+
current: HTMLElement | undefined;
|
|
33
|
+
"__#6@#onChange"?: ((el: HTMLElement | undefined) => void) | undefined;
|
|
34
|
+
setup: import("ember-modifier").FunctionBasedModifier<{
|
|
35
|
+
Args: {
|
|
36
|
+
Positional: unknown[];
|
|
37
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
38
|
+
};
|
|
39
|
+
Element: HTMLElement;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The selection. Seeded from `@defaultValue`, updated by the user, and
|
|
44
|
+
* synced from `@value` by {@link syncValue} whenever that argument changes.
|
|
45
|
+
*
|
|
46
|
+
* Everything renders from here rather than from `@value` directly -- see
|
|
47
|
+
* {@link value} for why a read-through cannot work inside a `Form`.
|
|
48
|
+
*/
|
|
49
|
+
internalValue: CalendarValue<M> | null;
|
|
50
|
+
isOpen: boolean;
|
|
51
|
+
constructor(owner: unknown, args: DatePickerArgs<M>);
|
|
52
|
+
get mode(): M;
|
|
53
|
+
get locale(): string;
|
|
54
|
+
/**
|
|
55
|
+
* The rendered value is always internal state, never a read-through to
|
|
56
|
+
* `@value`; {@link syncValue} pushes `@value` into it whenever the argument
|
|
57
|
+
* changes. This is the pattern `Select` uses, and reading through instead
|
|
58
|
+
* deadlocks the component inside a `Form`: `Field` binds `@value` to the
|
|
59
|
+
* form's data, the form's data comes from hidden inputs this component
|
|
60
|
+
* renders, and those inputs would then render the very value they source.
|
|
61
|
+
* Nothing could ever change it, so every pick after the first submit was
|
|
62
|
+
* silently discarded.
|
|
63
|
+
*/
|
|
64
|
+
get value(): CalendarValue<M> | null;
|
|
65
|
+
/** Normalizes whatever `@value` / `@defaultValue` was given to `Date`s. */
|
|
66
|
+
private parseIncoming;
|
|
67
|
+
/**
|
|
68
|
+
* Pushes `@value` into internal state when the argument changes. `undefined`
|
|
69
|
+
* is ignored so that an uncontrolled picker -- and one bound by `Field`
|
|
70
|
+
* before the form holds anything for it -- keeps whatever the user chose.
|
|
71
|
+
*/
|
|
72
|
+
syncValue: import("ember-modifier").FunctionBasedModifier<{
|
|
73
|
+
Args: {
|
|
74
|
+
Positional: [unknown];
|
|
75
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
76
|
+
};
|
|
77
|
+
Element: HTMLDivElement;
|
|
78
|
+
}>;
|
|
79
|
+
get formatted(): string;
|
|
80
|
+
get isEmpty(): boolean;
|
|
81
|
+
get valueBlockArg(): DatePickerValueBlockArg<M>;
|
|
82
|
+
/**
|
|
83
|
+
* Names the trigger when a `:value` block owns its content. Falls back to
|
|
84
|
+
* the formatted value alone rather than prefixing a hardcoded English
|
|
85
|
+
* string when there is no `@label`. `undefined` (not `''`) when neither is
|
|
86
|
+
* present, so the trigger omits `aria-label` entirely rather than setting
|
|
87
|
+
* it to an empty string -- some assistive tech treats a present-but-empty
|
|
88
|
+
* `aria-label` as overriding the visible text with nothing, leaving the
|
|
89
|
+
* button unnamed.
|
|
90
|
+
*/
|
|
91
|
+
get accessibleName(): string | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Reports focus leaving the *whole* control -- the field and its portaled
|
|
94
|
+
* popover -- rather than the trigger, which blurs on the way into the
|
|
95
|
+
* calendar and on every day click.
|
|
96
|
+
*/
|
|
97
|
+
blurTracker: ControlBlurTracker;
|
|
98
|
+
willDestroy(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Whether the clear button takes the calendar icon's place. A disabled or
|
|
101
|
+
* read-only field never shows it: the end-content cluster is not
|
|
102
|
+
* pointer-transparent to it and it carries no disabled/read-only state of
|
|
103
|
+
* its own, so it would otherwise be a live button that clears a field the
|
|
104
|
+
* user may not change -- the same contract `Calendar` enforces for day
|
|
105
|
+
* selection under `@isReadOnly`.
|
|
106
|
+
*/
|
|
107
|
+
get isClearable(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Clearing removes the clear button from the DOM (`isClearable` flips
|
|
110
|
+
* false the instant the value is gone), so -- like `close()` -- focus must
|
|
111
|
+
* be handed back to the trigger explicitly or it falls to `<body>`.
|
|
112
|
+
*
|
|
113
|
+
* Unlike `close()`, clearing deliberately leaves an open popover open: the
|
|
114
|
+
* clear button lives outside the popover entirely, so there is no
|
|
115
|
+
* dangling-focus reason to dismiss the calendar, and a user who just
|
|
116
|
+
* cleared the field is a user who likely wants to pick a new date right
|
|
117
|
+
* away -- closing would just make them reopen it.
|
|
118
|
+
*/
|
|
119
|
+
clear: () => void;
|
|
120
|
+
/**
|
|
121
|
+
* Whether the selection is finished, and the popover should therefore close.
|
|
122
|
+
* A range with only its anchor set is not: the user still owes a second
|
|
123
|
+
* click, and closing would throw away the half they just made.
|
|
124
|
+
*/
|
|
125
|
+
private isComplete;
|
|
126
|
+
handleChange: (value: CalendarValue<M>) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Tells an enclosing `Form` the value moved.
|
|
129
|
+
*
|
|
130
|
+
* The hidden inputs are written programmatically, and a programmatic value
|
|
131
|
+
* change fires no `input` event -- so without this the form never learns
|
|
132
|
+
* anything happened. That is worse than stale data: as soon as `Form` holds
|
|
133
|
+
* any data for this field, `Field` binds `@value` back to it -- so without
|
|
134
|
+
* this the form's copy of the value silently diverges from the field's, and
|
|
135
|
+
* a later `@data` change would sync the stale value back in. `Select`
|
|
136
|
+
* dispatches the same event for the same reason.
|
|
137
|
+
*/
|
|
138
|
+
private notifyForm;
|
|
139
|
+
/**
|
|
140
|
+
* Wired to the popover's `@onOpenChange`, which also fires for Escape and
|
|
141
|
+
* an outside click -- not only the explicit paths that already call
|
|
142
|
+
* `close()` below. Routing every close through `close()` matters because
|
|
143
|
+
* `Overlay`'s own focus-restore captures `document.activeElement` at the
|
|
144
|
+
* moment its content mounts, which by then is already the day `@autofocus`
|
|
145
|
+
* moved focus onto (that modifier runs before the overlay's own), not the
|
|
146
|
+
* trigger. Left to it, closing would try to restore focus onto a day
|
|
147
|
+
* button that has just been removed from the DOM -- a no-op -- and focus
|
|
148
|
+
* would fall to `<body>`.
|
|
149
|
+
*/
|
|
150
|
+
onOpenChange: (isOpen: boolean) => void;
|
|
151
|
+
/**
|
|
152
|
+
* Closing removes the focused day from the DOM, so focus must be handed back
|
|
153
|
+
* explicitly or it falls to `<body>` and the keyboard user loses their place.
|
|
154
|
+
*/
|
|
155
|
+
close: () => void;
|
|
156
|
+
get classes(): {
|
|
157
|
+
base: (slotProps?: ({
|
|
158
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
159
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
160
|
+
hasStartContent?: boolean | undefined;
|
|
161
|
+
hasEndContent?: boolean | undefined;
|
|
162
|
+
hasChips?: boolean | undefined;
|
|
163
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
164
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
165
|
+
innerContainer: (slotProps?: ({
|
|
166
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
167
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
168
|
+
hasStartContent?: boolean | undefined;
|
|
169
|
+
hasEndContent?: boolean | undefined;
|
|
170
|
+
hasChips?: boolean | undefined;
|
|
171
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
172
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
173
|
+
startContent: (slotProps?: ({
|
|
174
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
175
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
176
|
+
hasStartContent?: boolean | undefined;
|
|
177
|
+
hasEndContent?: boolean | undefined;
|
|
178
|
+
hasChips?: boolean | undefined;
|
|
179
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
180
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
181
|
+
endContent: (slotProps?: ({
|
|
182
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
183
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
184
|
+
hasStartContent?: boolean | undefined;
|
|
185
|
+
hasEndContent?: boolean | undefined;
|
|
186
|
+
hasChips?: boolean | undefined;
|
|
187
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
188
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
189
|
+
input: (slotProps?: ({
|
|
190
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
191
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
192
|
+
hasStartContent?: boolean | undefined;
|
|
193
|
+
hasEndContent?: boolean | undefined;
|
|
194
|
+
hasChips?: boolean | undefined;
|
|
195
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
196
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
197
|
+
} & {
|
|
198
|
+
base: (slotProps?: ({
|
|
199
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
200
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
201
|
+
hasStartContent?: boolean | undefined;
|
|
202
|
+
hasEndContent?: boolean | undefined;
|
|
203
|
+
hasChips?: boolean | undefined;
|
|
204
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
205
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
206
|
+
placeholder: (slotProps?: ({
|
|
207
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
208
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
209
|
+
hasStartContent?: boolean | undefined;
|
|
210
|
+
hasEndContent?: boolean | undefined;
|
|
211
|
+
hasChips?: boolean | undefined;
|
|
212
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
213
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
214
|
+
input: (slotProps?: ({
|
|
215
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
216
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
217
|
+
hasStartContent?: boolean | undefined;
|
|
218
|
+
hasEndContent?: boolean | undefined;
|
|
219
|
+
hasChips?: boolean | undefined;
|
|
220
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
221
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
222
|
+
calendar: (slotProps?: ({
|
|
223
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
224
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
225
|
+
hasStartContent?: boolean | undefined;
|
|
226
|
+
hasEndContent?: boolean | undefined;
|
|
227
|
+
hasChips?: boolean | undefined;
|
|
228
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
229
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
230
|
+
footer: (slotProps?: ({
|
|
231
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
232
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
233
|
+
hasStartContent?: boolean | undefined;
|
|
234
|
+
hasEndContent?: boolean | undefined;
|
|
235
|
+
hasChips?: boolean | undefined;
|
|
236
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
237
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
238
|
+
icon: (slotProps?: ({
|
|
239
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
240
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
241
|
+
hasStartContent?: boolean | undefined;
|
|
242
|
+
hasEndContent?: boolean | undefined;
|
|
243
|
+
hasChips?: boolean | undefined;
|
|
244
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
245
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
246
|
+
clearButton: (slotProps?: ({
|
|
247
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
248
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
249
|
+
hasStartContent?: boolean | undefined;
|
|
250
|
+
hasEndContent?: boolean | undefined;
|
|
251
|
+
hasChips?: boolean | undefined;
|
|
252
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
253
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
254
|
+
} & {};
|
|
255
|
+
get isRangeMode(): boolean;
|
|
256
|
+
/**
|
|
257
|
+
* The single-mode wire value, or `''` when there is nothing selected. Only
|
|
258
|
+
* read from the single-mode branch of the template, so it does not repeat
|
|
259
|
+
* that branch's mode check.
|
|
260
|
+
*/
|
|
261
|
+
get wireValue(): string;
|
|
262
|
+
get wireRangeStart(): string;
|
|
263
|
+
get wireRangeEnd(): string;
|
|
264
|
+
get calendarBlockArg(): DatePickerCalendarArgs<M>;
|
|
265
|
+
get footerBlockArg(): DatePickerFooterArg<M>;
|
|
266
|
+
}
|
|
267
|
+
export { DatePicker, type DatePickerSignature };
|
|
268
|
+
export default DatePicker;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { TOC } from '@ember/component/template-only';
|
|
2
|
+
import type { SlotsToClasses, DatePickerSlots } from '@frontile/theme';
|
|
3
|
+
import type { DatePickerClasses } from './types';
|
|
4
|
+
interface DatePickerEndContentSignature {
|
|
5
|
+
Args: {
|
|
6
|
+
classes: DatePickerClasses;
|
|
7
|
+
userClasses?: SlotsToClasses<DatePickerSlots>;
|
|
8
|
+
isClearable: boolean;
|
|
9
|
+
onClear: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Defaults to `none` so clicks fall through to the trigger; content that
|
|
12
|
+
* needs its own events opts back in per element.
|
|
13
|
+
*
|
|
14
|
+
* The theme declares no default for this variant, so leaving it unset
|
|
15
|
+
* yields neither class and the browser default (`auto`) wins -- which
|
|
16
|
+
* makes the cluster sit over the right edge of the field and swallow
|
|
17
|
+
* clicks on the calendar icon.
|
|
18
|
+
*/
|
|
19
|
+
endContentPointerEvents?: 'none' | 'auto';
|
|
20
|
+
};
|
|
21
|
+
Element: HTMLDivElement;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The cluster at the end of the field: exactly one of the clear button or the
|
|
25
|
+
* calendar icon. Pointer events are off so a click anywhere in the field still
|
|
26
|
+
* reaches the trigger; the clear button opts back in.
|
|
27
|
+
*/
|
|
28
|
+
declare const DatePickerEndContent: TOC<DatePickerEndContentSignature>;
|
|
29
|
+
export { DatePickerEndContent, type DatePickerEndContentSignature };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { TOC } from '@ember/component/template-only';
|
|
2
|
+
import type { ModifierLike } from '@glint/template';
|
|
3
|
+
import type { SlotsToClasses, DatePickerSlots } from '@frontile/theme';
|
|
4
|
+
import type { DatePickerClasses } from './types';
|
|
5
|
+
interface DatePickerTriggerSignature {
|
|
6
|
+
Args: {
|
|
7
|
+
/** Records the element, for focus restoration and blur tracking. */
|
|
8
|
+
triggerRef: ModifierLike<{
|
|
9
|
+
Element: HTMLButtonElement;
|
|
10
|
+
}>;
|
|
11
|
+
/** The popover's `trigger` modifier: what opens the calendar. */
|
|
12
|
+
trigger: ModifierLike<{
|
|
13
|
+
Element: HTMLElement;
|
|
14
|
+
}>;
|
|
15
|
+
id?: string;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
formatted: string;
|
|
18
|
+
isEmpty: boolean;
|
|
19
|
+
isDisabled?: boolean;
|
|
20
|
+
isInvalid?: boolean;
|
|
21
|
+
hasCustomContent: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Names the trigger when a `:value` block owns its content — that block
|
|
24
|
+
* may render nothing readable at all, which would leave an unnamed
|
|
25
|
+
* button. `undefined` when there is nothing to name it with, so
|
|
26
|
+
* `aria-label` is omitted entirely rather than set to `""`.
|
|
27
|
+
*/
|
|
28
|
+
accessibleName: string | undefined;
|
|
29
|
+
classes: DatePickerClasses;
|
|
30
|
+
userClasses?: SlotsToClasses<DatePickerSlots>;
|
|
31
|
+
onFocusOut: (event: FocusEvent) => void;
|
|
32
|
+
};
|
|
33
|
+
Blocks: {
|
|
34
|
+
value: [];
|
|
35
|
+
};
|
|
36
|
+
Element: HTMLButtonElement;
|
|
37
|
+
}
|
|
38
|
+
declare const DatePickerTrigger: TOC<DatePickerTriggerSignature>;
|
|
39
|
+
export { DatePickerTrigger, type DatePickerTriggerSignature };
|
|
40
|
+
export default DatePickerTrigger;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { DatePickerSlots, DatePickerVariants, SlotsToClasses, useStyles } from '@frontile/theme';
|
|
2
|
+
import type { PopoverSignature, ContentSignature } from '../../overlays/popover';
|
|
3
|
+
import type { CalendarArgs } from '../../collections/calendar/calendar';
|
|
4
|
+
import type { CalendarMode, CalendarValue, DateRange, WeekDay } from '../../collections/calendar/types';
|
|
5
|
+
import type { FormControlSharedArgs } from '../form-control';
|
|
6
|
+
import type { DatePickerInput, DatePickerRangeInput } from './value';
|
|
7
|
+
interface BaseDatePickerArgs extends Pick<CalendarArgs, 'color' | 'minValue' | 'maxValue' | 'isDateUnavailable' | 'locale' | 'weekStartsOn' | 'visibleMonths' | 'captionLayout' | 'fixedWeeks' | 'showOutsideDays' | 'isReadOnly'>, Pick<PopoverSignature['Args'], 'placement' | 'flipOptions' | 'shiftOptions' | 'offsetOptions' | 'strategy' | 'didClose'>, Pick<ContentSignature['Args'], 'renderInPlace' | 'target' | 'closeOnOutsideClick' | 'closeOnEscapeKey' | 'transitionDuration' | 'disableTransitions'>, FormControlSharedArgs {
|
|
8
|
+
/** The unique identifier for the control. */
|
|
9
|
+
id?: string;
|
|
10
|
+
/** The name the value submits under. See the hidden inputs in date-picker.gts. */
|
|
11
|
+
name?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Additional floating-ui middleware for the popover positioning the
|
|
14
|
+
* calendar, beyond what `placement`, `offsetOptions`, `flipOptions`, and
|
|
15
|
+
* `shiftOptions` cover. Forwarded to `Popover`'s own `@middleware`.
|
|
16
|
+
*/
|
|
17
|
+
middleware?: PopoverSignature['Args']['middleware'];
|
|
18
|
+
/** Text shown in the trigger when there is no value. */
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
/**
|
|
21
|
+
* How the value is rendered in the trigger. Localized with `@locale`.
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue { dateStyle: 'medium' }
|
|
24
|
+
*/
|
|
25
|
+
formatOptions?: Intl.DateTimeFormatOptions;
|
|
26
|
+
/** The size of the field. Matches Select's `@inputSize`. */
|
|
27
|
+
inputSize?: DatePickerVariants['size'];
|
|
28
|
+
/**
|
|
29
|
+
* Whether a clear button replaces the calendar icon when there is a value.
|
|
30
|
+
*
|
|
31
|
+
* @defaultValue false
|
|
32
|
+
*/
|
|
33
|
+
isClearable?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The width of the popover holding the calendar.
|
|
36
|
+
*
|
|
37
|
+
* Defaults to `'auto'` -- the calendar's own width is the meaningful one,
|
|
38
|
+
* and it changes with `@visibleMonths`, so a fixed width would clip the
|
|
39
|
+
* grid. `'trigger'` matches the field's width; the named sizes are fixed.
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue 'auto'
|
|
42
|
+
*/
|
|
43
|
+
popoverSize?: ContentSignature['Args']['size'];
|
|
44
|
+
/**
|
|
45
|
+
* Whether the cluster at the end of the field (the calendar icon, or the
|
|
46
|
+
* clear button) receives pointer events.
|
|
47
|
+
*
|
|
48
|
+
* Defaults to `'none'` so that a click anywhere in the field -- the icon
|
|
49
|
+
* included -- falls through to the trigger and opens the picker. The clear
|
|
50
|
+
* button opts back in on its own.
|
|
51
|
+
*
|
|
52
|
+
* @defaultValue 'none'
|
|
53
|
+
*/
|
|
54
|
+
endContentPointerEvents?: 'none' | 'auto';
|
|
55
|
+
/** Fires when focus leaves the trigger *and* the popover. */
|
|
56
|
+
onBlur?: () => void;
|
|
57
|
+
classes?: SlotsToClasses<DatePickerSlots>;
|
|
58
|
+
}
|
|
59
|
+
interface SingleDatePickerArgs extends BaseDatePickerArgs {
|
|
60
|
+
/**
|
|
61
|
+
* Selects a single day. Set `@mode="range"` for a start/end range instead.
|
|
62
|
+
*
|
|
63
|
+
* @defaultValue 'single'
|
|
64
|
+
*/
|
|
65
|
+
mode?: 'single' | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* A `Date`, or the same `yyyy-MM-dd` string this component writes to its
|
|
68
|
+
* hidden input.
|
|
69
|
+
*
|
|
70
|
+
* The field keeps its own selection and syncs *from* this argument: setting
|
|
71
|
+
* it replaces what is displayed, while picking a date updates the field
|
|
72
|
+
* immediately rather than waiting for `@value` to come back. `undefined` is
|
|
73
|
+
* ignored, which is why a `<form.Field>`-bound picker — which always passes
|
|
74
|
+
* a `value` key — still honors `@defaultValue` before form data exists.
|
|
75
|
+
*/
|
|
76
|
+
value?: DatePickerInput | null;
|
|
77
|
+
/** Seeds the value before any `@value` is supplied. */
|
|
78
|
+
defaultValue?: DatePickerInput | null;
|
|
79
|
+
/** Fires with the picked `Date`, or `null` after clearing. */
|
|
80
|
+
onChange?: (value: Date | null) => void;
|
|
81
|
+
}
|
|
82
|
+
interface RangeDatePickerArgs extends BaseDatePickerArgs {
|
|
83
|
+
/** Switches the picker, and the calendar it wraps, to range selection. */
|
|
84
|
+
mode: 'range';
|
|
85
|
+
/**
|
|
86
|
+
* A `{ start, end }` pair, each a `Date` or a `yyyy-MM-dd` string; `end` may
|
|
87
|
+
* be `null` while only the anchor is chosen. Synced the same way as single
|
|
88
|
+
* mode's `@value`: setting it replaces the displayed range, `undefined` is
|
|
89
|
+
* ignored, and the field updates on its own as the user picks.
|
|
90
|
+
*/
|
|
91
|
+
value?: DatePickerRangeInput | null;
|
|
92
|
+
/** Seeds the range before any `@value` is supplied. */
|
|
93
|
+
defaultValue?: DatePickerRangeInput | null;
|
|
94
|
+
/** Fires with the `{ start, end }` range, or `null` after clearing. */
|
|
95
|
+
onChange?: (value: DateRange | null) => void;
|
|
96
|
+
}
|
|
97
|
+
type DatePickerArgs<M extends CalendarMode = 'single'> = M extends 'range' ? RangeDatePickerArgs : SingleDatePickerArgs;
|
|
98
|
+
/**
|
|
99
|
+
* The resolved Tailwind Variants slot functions, as produced by
|
|
100
|
+
* `useStyles().datePicker(...)`. Passed down to the pieces of the field so
|
|
101
|
+
* every one of them styles itself from the same `tv()` call.
|
|
102
|
+
*/
|
|
103
|
+
type DatePickerClasses = ReturnType<ReturnType<typeof useStyles>['datePicker']>;
|
|
104
|
+
/** What the `:value` block receives. */
|
|
105
|
+
interface DatePickerValueBlockArg<M extends CalendarMode = 'single'> {
|
|
106
|
+
/** The current value as `Date`s, whatever form it was passed in. */
|
|
107
|
+
value: CalendarValue<M> | null;
|
|
108
|
+
/** The same value as the trigger would render it. */
|
|
109
|
+
formatted: string;
|
|
110
|
+
/** Whether the placeholder would show. An anchored range is not empty. */
|
|
111
|
+
isEmpty: boolean;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The args the picker would otherwise have handed `Calendar`, so a `:calendar`
|
|
115
|
+
* block can spread them onto its own calendar rather than re-deriving the
|
|
116
|
+
* selection and focus wiring.
|
|
117
|
+
*
|
|
118
|
+
* `labelledBy` is only set when the consumer passed `@id` to the picker
|
|
119
|
+
* themselves. The default `<Calendar>` rendered in the template instead uses
|
|
120
|
+
* the id `FormControl` yields internally (`c.id`), which is generated when
|
|
121
|
+
* `@id` is absent and is not reachable from this getter — so it is always
|
|
122
|
+
* labelled. A consumer rendering their own calendar from this block must pass
|
|
123
|
+
* `@id` to the picker if they want the grid labelled.
|
|
124
|
+
*/
|
|
125
|
+
interface DatePickerCalendarArgs<M extends CalendarMode = 'single'> {
|
|
126
|
+
mode: CalendarMode;
|
|
127
|
+
color?: CalendarArgs['color'];
|
|
128
|
+
value: CalendarValue<M> | null;
|
|
129
|
+
onChange: (value: CalendarValue<M>) => void;
|
|
130
|
+
locale: string;
|
|
131
|
+
weekStartsOn?: WeekDay;
|
|
132
|
+
minValue?: Date;
|
|
133
|
+
maxValue?: Date;
|
|
134
|
+
isDateUnavailable?: (date: Date) => boolean;
|
|
135
|
+
visibleMonths?: number;
|
|
136
|
+
captionLayout?: 'label' | 'dropdown';
|
|
137
|
+
labelledBy?: string;
|
|
138
|
+
autofocus: boolean;
|
|
139
|
+
}
|
|
140
|
+
/** What the `:footer` block receives. Presets are built from these. */
|
|
141
|
+
interface DatePickerFooterArg<M extends CalendarMode = 'single'> {
|
|
142
|
+
/** Sets the value as if the user had picked it, callbacks and all. */
|
|
143
|
+
setValue: (value: CalendarValue<M>) => void;
|
|
144
|
+
/** Closes the popover and returns focus to the trigger. */
|
|
145
|
+
close: () => void;
|
|
146
|
+
value: CalendarValue<M> | null;
|
|
147
|
+
isOpen: boolean;
|
|
148
|
+
}
|
|
149
|
+
export type { DatePickerArgs, SingleDatePickerArgs, RangeDatePickerArgs, DatePickerValueBlockArg, DatePickerCalendarArgs, DatePickerFooterArg, DatePickerClasses };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { CalendarMode, CalendarValue, DateRange } from '../../collections/calendar/types';
|
|
2
|
+
/**
|
|
3
|
+
* A date as accepted from a consumer: a `Date`, or the same `yyyy-MM-dd`
|
|
4
|
+
* string this component writes to its hidden inputs.
|
|
5
|
+
*
|
|
6
|
+
* Strings are accepted because `Field` feeds form data — which is always
|
|
7
|
+
* strings — straight back into `@value`. It also means a value hydrated from
|
|
8
|
+
* JSON or an API needs no adapter. Output is always a `Date`: strings are an
|
|
9
|
+
* accepted input, never an output mode.
|
|
10
|
+
*/
|
|
11
|
+
type DatePickerInput = Date | string;
|
|
12
|
+
interface DatePickerRangeInput {
|
|
13
|
+
start: DatePickerInput;
|
|
14
|
+
end: DatePickerInput | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Normalizes one end of a value to a `Date`, or `null` when there is nothing
|
|
18
|
+
* usable there.
|
|
19
|
+
*
|
|
20
|
+
* An `Invalid Date` is treated as absent rather than passed along: it would
|
|
21
|
+
* otherwise reach `Intl.DateTimeFormat` and render the literal text
|
|
22
|
+
* "Invalid Date" inside the trigger.
|
|
23
|
+
*/
|
|
24
|
+
declare function parseDate(value: DatePickerInput | null | undefined): Date | null;
|
|
25
|
+
/**
|
|
26
|
+
* Normalizes a range. A `null` end is preserved rather than collapsed — that
|
|
27
|
+
* is a range mid-selection, with its anchor set and the second click pending,
|
|
28
|
+
* and the trigger must still show the anchor.
|
|
29
|
+
*/
|
|
30
|
+
declare function parseRange(value: DatePickerRangeInput | null | undefined): DateRange | null;
|
|
31
|
+
/** The value as it is submitted: `yyyy-MM-dd`, from local calendar fields. */
|
|
32
|
+
declare function toWire(date: Date | null | undefined): string;
|
|
33
|
+
/**
|
|
34
|
+
* The trigger's text for a value in either mode. An en dash (not a hyphen)
|
|
35
|
+
* joins a range, matching how date ranges are set in running text.
|
|
36
|
+
*/
|
|
37
|
+
declare function formatValue<M extends CalendarMode>(value: CalendarValue<M> | null | undefined, locale: string, options?: Intl.DateTimeFormatOptions): string;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the trigger should show its placeholder. An anchored range is *not*
|
|
40
|
+
* empty — its start is already chosen and must be visible.
|
|
41
|
+
*/
|
|
42
|
+
declare function isEmptyValue(value: unknown): boolean;
|
|
43
|
+
export { parseDate, parseRange, toWire, formatValue, isEmptyValue, type DatePickerInput, type DatePickerRangeInput };
|