@sesamehr/react-design-system 2.0.0-beta.2 → 2.0.0-beta.21
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/README.md +34 -0
- package/dist/Button/ActionItem/ActionItem.d.ts +40 -0
- package/dist/Button/ActionItem/index.d.ts +1 -0
- package/dist/Button/IconButton/IconButton.d.ts +32 -0
- package/dist/Button/IconButton/index.d.ts +27 -0
- package/dist/Data/Table/Table.d.ts +1 -1
- package/dist/Data/Table/TableBody/TableBody.d.ts +3 -0
- package/dist/Data/Table/TableHead/TableHead.d.ts +25 -1
- package/dist/Data/Table/TableScrollbar/TableScrollbar.d.ts +21 -0
- package/dist/Data/Table/TableSelectCell/TableSelectCell.d.ts +8 -0
- package/dist/Data/Table/TableVirtualized/TableVirtualized.d.ts +45 -0
- package/dist/Data/Table/TableVirtualized/index.d.ts +2 -0
- package/dist/Data/Table/hooks/index.d.ts +3 -0
- package/dist/Data/Table/hooks/useDragToScroll/useDragToScroll.d.ts +12 -2
- package/dist/Data/Table/hooks/useTableVirtual/context.d.ts +16 -0
- package/dist/Data/Table/hooks/useTableVirtual/index.d.ts +3 -0
- package/dist/Data/Table/hooks/useTableVirtual/useTableVirtual.d.ts +36 -0
- package/dist/Data/Table/hooks/useTableVirtual/useTableVirtual.types.d.ts +74 -0
- package/dist/Data/Table/index.d.ts +2 -2
- package/dist/Display/Avatar/AvatarSkeleton/AvatarSkeleton.d.ts +30 -0
- package/dist/Display/Avatar/index.d.ts +2 -0
- package/dist/Display/AvatarDetails/AvatarDetails.d.ts +68 -0
- package/dist/Display/AvatarDetails/index.d.ts +1 -0
- package/dist/Display/AvatarGroup/AvatarGroup.d.ts +3 -0
- package/dist/Display/Badge/Badge.d.ts +3 -2
- package/dist/Display/Badge/index.d.ts +10 -1
- package/dist/Display/ChatBubble/ChatBubble.d.ts +28 -0
- package/dist/Display/ChatBubble/ChatBubbleStatus/ChatBubbleStatus.d.ts +8 -0
- package/dist/Display/ChatBubble/ChatBubbleStatus/index.d.ts +10 -0
- package/dist/Display/ChatBubble/index.d.ts +44 -0
- package/dist/Display/Chip/Chip.d.ts +21 -5
- package/dist/Display/Chip/index.d.ts +19 -10
- package/dist/Display/FileCard/FileCard.d.ts +66 -0
- package/dist/Display/FileCard/index.d.ts +1 -0
- package/dist/Display/FilePreviewCard/FilePreviewCard.d.ts +49 -0
- package/dist/Display/FilePreviewCard/index.d.ts +1 -0
- package/dist/Feedback/Alert/AlertIcon.d.ts +1 -1
- package/dist/Feedback/Dialog/DialogBody.d.ts +18 -0
- package/dist/Feedback/Dialog/index.d.ts +1 -0
- package/dist/Feedback/Loader/Loader.d.ts +16 -0
- package/dist/Feedback/Loader/index.d.ts +2 -0
- package/dist/Feedback/Popover/PopoverContent.d.ts +0 -1
- package/dist/Feedback/Progress/Progress.d.ts +3 -0
- package/dist/Feedback/Progress/index.d.ts +17 -0
- package/dist/Feedback/Skeleton/Skeleton.d.ts +21 -0
- package/dist/Feedback/Skeleton/index.d.ts +2 -0
- package/dist/Feedback/Tooltip/TooltipContent.d.ts +0 -1
- package/dist/Forms/Field/Counter/Counter.d.ts +9 -0
- package/dist/Forms/Field/Counter/index.d.ts +13 -0
- package/dist/Forms/Field/FieldGroup/FieldGroup.d.ts +16 -1
- package/dist/Forms/Field/FieldLabel/FieldLabel.d.ts +16 -0
- package/dist/Forms/Field/FieldMessage/FieldMessage.d.ts +22 -2
- package/dist/Forms/Field/index.d.ts +1 -0
- package/dist/Forms/Field/useFieldGroup.d.ts +108 -0
- package/dist/Forms/Inputs/Calendar/Calendar.d.ts +55 -0
- package/dist/Forms/Inputs/Calendar/CalendarDay.d.ts +37 -0
- package/dist/Forms/Inputs/Calendar/CalendarRange.d.ts +56 -0
- package/dist/Forms/Inputs/Calendar/constraints.d.ts +19 -0
- package/dist/Forms/Inputs/Calendar/date.d.ts +28 -0
- package/dist/Forms/Inputs/Calendar/index.d.ts +21 -0
- package/dist/Forms/Inputs/Calendar/nav.d.ts +34 -0
- package/dist/Forms/Inputs/Calendar/testids.d.ts +28 -0
- package/dist/Forms/Inputs/Calendar/useCalendarLocale.d.ts +40 -0
- package/dist/Forms/Inputs/ChatInput/ChatInput.d.ts +68 -0
- package/dist/Forms/Inputs/ChatInput/index.d.ts +46 -0
- package/dist/Forms/Inputs/Combobox/Combobox.d.ts +19 -0
- package/dist/Forms/Inputs/Combobox/ComboboxCancel.d.ts +14 -0
- package/dist/Forms/Inputs/Combobox/ComboboxChipsInput.d.ts +11 -0
- package/dist/Forms/Inputs/Combobox/ComboboxContent.d.ts +0 -6
- package/dist/Forms/Inputs/Combobox/ComboboxGroup.d.ts +6 -2
- package/dist/Forms/Inputs/Combobox/ComboboxInput.d.ts +6 -1
- package/dist/Forms/Inputs/Combobox/ComboboxItem.d.ts +4 -0
- package/dist/Forms/Inputs/Combobox/ComboboxItemEdit.d.ts +134 -0
- package/dist/Forms/Inputs/Combobox/context.d.ts +21 -1
- package/dist/Forms/Inputs/Combobox/index.d.ts +2 -0
- package/dist/Forms/Inputs/Combobox/useChipOverflow.d.ts +30 -0
- package/dist/Forms/Inputs/Combobox/useComboboxEditing.d.ts +40 -0
- package/dist/Forms/Inputs/Combobox/useComboboxLabels.d.ts +21 -0
- package/dist/Forms/Inputs/Combobox/useComboboxSearch.d.ts +20 -0
- package/dist/Forms/Inputs/DatePicker/DatePicker.d.ts +51 -0
- package/dist/Forms/Inputs/DatePicker/DatePickerHeader.d.ts +65 -0
- package/dist/Forms/Inputs/DatePicker/DatePickerMonthSelect.d.ts +27 -0
- package/dist/Forms/Inputs/DatePicker/DatePickerTrigger.d.ts +29 -0
- package/dist/Forms/Inputs/DatePicker/DatePickerYearSelect.d.ts +25 -0
- package/dist/Forms/Inputs/DatePicker/DateRangePicker.d.ts +61 -0
- package/dist/Forms/Inputs/DatePicker/format.d.ts +44 -0
- package/dist/Forms/Inputs/DatePicker/index.d.ts +6 -0
- package/dist/Forms/Inputs/DatePicker/month.d.ts +28 -0
- package/dist/Forms/Inputs/DatePicker/useDatePickerHeader.d.ts +23 -0
- package/dist/Forms/Inputs/InputOtp/InputOtp.d.ts +7 -0
- package/dist/Forms/Inputs/InputPassword/InputPassword.d.ts +9 -1
- package/dist/Forms/Inputs/InputText/InputText.d.ts +9 -0
- package/dist/Forms/Inputs/SearchBar/SearchBar.d.ts +35 -0
- package/dist/Forms/Inputs/SearchBar/index.d.ts +20 -0
- package/dist/Forms/Inputs/SearchPanel/SearchPanel.d.ts +71 -0
- package/dist/Forms/Inputs/SearchPanel/SearchPanelEmpty.d.ts +16 -0
- package/dist/Forms/Inputs/SearchPanel/SearchPanelGroup.d.ts +14 -0
- package/dist/Forms/Inputs/SearchPanel/SearchPanelInput.d.ts +31 -0
- package/dist/Forms/Inputs/SearchPanel/SearchPanelItem.d.ts +20 -0
- package/dist/Forms/Inputs/SearchPanel/SearchPanelList.d.ts +11 -0
- package/dist/Forms/Inputs/SearchPanel/context.d.ts +11 -0
- package/dist/Forms/Inputs/SearchPanel/index.d.ts +6 -0
- package/dist/Forms/Inputs/Select/SelectContent.d.ts +0 -4
- package/dist/Forms/Inputs/Select/SelectGroup.d.ts +6 -2
- package/dist/Forms/Inputs/Select/SelectItem.d.ts +6 -0
- package/dist/Forms/Inputs/Textarea/Textarea.d.ts +69 -0
- package/dist/Forms/Inputs/Textarea/index.d.ts +21 -0
- package/dist/Forms/Inputs/Toggle/RadioButton/RadioGroup.d.ts +5 -0
- package/dist/Forms/Inputs/Toggle/ToggleLabel/ToggleLabel.d.ts +10 -1
- package/dist/Forms/Inputs/index.d.ts +6 -0
- package/dist/Layout/Card/Card.d.ts +4 -1
- package/dist/Layout/Card/index.d.ts +10 -4
- package/dist/Layout/Scrollbar/Scrollbar.d.ts +46 -0
- package/dist/Layout/Scrollbar/index.d.ts +2 -0
- package/dist/Layout/Scrollbar/useScrollbar.d.ts +52 -0
- package/dist/Navigation/ToggleTabs/useToggleTabsPill.d.ts +27 -0
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/useAutoGrow/useAutoGrow.d.ts +22 -0
- package/dist/hooks/useSearchDebounce/useSearchDebounce.d.ts +24 -0
- package/dist/internal/Listbox/ListboxEmpty.d.ts +3 -0
- package/dist/internal/Listbox/ListboxItem.d.ts +23 -0
- package/dist/internal/Listbox/ListboxLabel.d.ts +9 -0
- package/dist/internal/Listbox/ListboxSeparator.d.ts +3 -0
- package/dist/internal/Listbox/ListboxViewport.d.ts +9 -0
- package/dist/internal/Surface/Surface.d.ts +35 -0
- package/dist/internal/index.d.ts +13 -0
- package/dist/lib/cssModules.d.ts +13 -0
- package/dist/main.d.ts +18 -7
- package/dist/preflight.css +391 -0
- package/dist/react-design-system.css +1 -1
- package/dist/react-design-system.js +17244 -10361
- package/dist/react-design-system.umd.cjs +164 -117
- package/package.json +4 -2
- package/dist/Data/Table/TableAvatar/TableAvatar.d.ts +0 -14
- package/dist/Display/Tag/Tag.d.ts +0 -19
- package/dist/Display/Tag/index.d.ts +0 -2
|
@@ -6,5 +6,9 @@ export interface ComboboxItemProps extends Omit<React.ComponentPropsWithoutRef<t
|
|
|
6
6
|
/**
|
|
7
7
|
* ComboboxItem — a selectable option, with its own check indicator.
|
|
8
8
|
* Selecting commits the value through the shared context (toggles for multiple).
|
|
9
|
+
*
|
|
10
|
+
* See `SelectItem` for why the row is shared and the primitive wrapping it is
|
|
11
|
+
* not. The indicator is always passed, even while unchecked, so the space it
|
|
12
|
+
* needs is reserved once rather than appearing the moment the row is picked.
|
|
9
13
|
*/
|
|
10
14
|
export declare const ComboboxItem: import('react').ForwardRefExoticComponent<ComboboxItemProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
export interface ComboboxItemEditPreview {
|
|
2
|
+
/**
|
|
3
|
+
* Enter the editing state. Pass it straight to the control that starts the
|
|
4
|
+
* edit — `onClick={edit}` — so it receives the event and can stop it.
|
|
5
|
+
*/
|
|
6
|
+
edit: (event?: {
|
|
7
|
+
stopPropagation: () => void;
|
|
8
|
+
}) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface ComboboxItemEditField {
|
|
11
|
+
/** The text as it currently stands. */
|
|
12
|
+
value: string | undefined;
|
|
13
|
+
/** Report a keystroke from the field. */
|
|
14
|
+
setValue: (value: string | undefined) => void;
|
|
15
|
+
/** Save, and leave the editing state. */
|
|
16
|
+
commit: () => void;
|
|
17
|
+
/** Put the text back as it was, and leave the editing state. */
|
|
18
|
+
cancel: () => void;
|
|
19
|
+
}
|
|
20
|
+
export interface ComboboxItemEditProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'onChange'> {
|
|
21
|
+
/**
|
|
22
|
+
* The text being edited. Pass it one way — `value={label}` — and let
|
|
23
|
+
* `onCommit` write the new one back: it seeds the draft and re-seeds it
|
|
24
|
+
* whenever it changes, so the caller never holds the draft and the field
|
|
25
|
+
* inside `field` never has a second copy of it to disagree with. Add
|
|
26
|
+
* `onValueChange` for a caller who wants every keystroke.
|
|
27
|
+
*/
|
|
28
|
+
value?: string;
|
|
29
|
+
/** The starting text when nothing is passed for `value`. */
|
|
30
|
+
defaultValue?: string;
|
|
31
|
+
/** Every keystroke, for a caller controlling the draft. */
|
|
32
|
+
onValueChange?: (value: string | undefined) => void;
|
|
33
|
+
/** The edit was saved. Carries the text as it now stands. */
|
|
34
|
+
onCommit?: (value: string | undefined) => void;
|
|
35
|
+
/** The edit was abandoned; the draft has already been put back. */
|
|
36
|
+
onCancel?: () => void;
|
|
37
|
+
/** The row while it is being edited. */
|
|
38
|
+
field?: (context: ComboboxItemEditField) => React.ReactNode;
|
|
39
|
+
/** The row the rest of the time. */
|
|
40
|
+
children?: (context: ComboboxItemEditPreview) => React.ReactNode;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* An option that can be renamed without leaving the list: the row shows its
|
|
44
|
+
* normal content until the caller's own control asks to edit it, then hands the
|
|
45
|
+
* row over to the caller's own field. Port of
|
|
46
|
+
* `core/src/Forms/Inputs/Combobox/ComboboxItemEdit`.
|
|
47
|
+
*
|
|
48
|
+
* It holds no strings and draws no buttons — the design system ships neither.
|
|
49
|
+
* What it owns is the part a caller cannot get right from outside: a list whose
|
|
50
|
+
* every reflex is to select the row and close, aimed at a field that needs the
|
|
51
|
+
* click, the keystroke and the `Escape` for itself.
|
|
52
|
+
*
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <OxComboboxItem value="other">
|
|
55
|
+
* <OxComboboxItemEdit
|
|
56
|
+
* value={label}
|
|
57
|
+
* onCommit={next => setLabel(next ?? '')}
|
|
58
|
+
* field={({ value, setValue, commit }) => (
|
|
59
|
+
* <>
|
|
60
|
+
* <OxInputText size="sm" field={value} onFieldChange={setValue} />
|
|
61
|
+
* <OxButton variant="ghost" onClick={commit}>…</OxButton>
|
|
62
|
+
* </>
|
|
63
|
+
* )}
|
|
64
|
+
* >
|
|
65
|
+
* {({ edit }) => (
|
|
66
|
+
* <>
|
|
67
|
+
* {label}
|
|
68
|
+
* <OxButton variant="ghost" onClick={edit}>…</OxButton>
|
|
69
|
+
* </>
|
|
70
|
+
* )}
|
|
71
|
+
* </OxComboboxItemEdit>
|
|
72
|
+
* </OxComboboxItem>
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* Both states live here rather than behind the caller's own conditional for one
|
|
76
|
+
* reason worth the extra render prop: the control that *starts* the edit is
|
|
77
|
+
* itself inside the row, so its click selects the option and shuts the popover
|
|
78
|
+
* unless it is stopped. `edit` stops it. A caller assembling the two states
|
|
79
|
+
* themselves has to know that, and the version that does not know it looks
|
|
80
|
+
* exactly right until it is clicked.
|
|
81
|
+
*
|
|
82
|
+
* ### What is taken away from the list while editing, and by whom
|
|
83
|
+
*
|
|
84
|
+
* The Vue half is fighting reka; this one is fighting cmdk, and the two land on
|
|
85
|
+
* very nearly the same list:
|
|
86
|
+
*
|
|
87
|
+
* - **The click.** cmdk's `CommandItem` calls `onSelect` on `click`, and a
|
|
88
|
+
* single-select combobox turns a selection into `setOpen(false)`. Clicking
|
|
89
|
+
* into the field is a click on the row, so the popover closed under the
|
|
90
|
+
* cursor that opened it.
|
|
91
|
+
* - **`Enter`.** cmdk's `Command` dispatches a select on the highlighted row,
|
|
92
|
+
* which is the same close by another route. Here it is what saves the edit.
|
|
93
|
+
* - **`ArrowUp` / `ArrowDown` / `Home` / `End`.** All four are
|
|
94
|
+
* `preventDefault()`ed by `Command`, so the caret could not be moved.
|
|
95
|
+
* - **`pointermove`.** `CommandItem` moves the highlight onto the row under the
|
|
96
|
+
* cursor.
|
|
97
|
+
* - **`Space`** is in the list for the Vue half's sake — reka's `ListboxItem`
|
|
98
|
+
* selects on it *with `prevent`*, so a name with two words in it could not be
|
|
99
|
+
* typed. cmdk leaves the space bar alone; stopping it here costs nothing and
|
|
100
|
+
* keeps one list of claimed keys instead of two that drift.
|
|
101
|
+
*
|
|
102
|
+
* `Escape` is deliberately absent and is answered in `ComboboxContent`. See
|
|
103
|
+
* `useComboboxEditing` for why it cannot be answered here.
|
|
104
|
+
*
|
|
105
|
+
* ### Focus
|
|
106
|
+
*
|
|
107
|
+
* Nothing in this half steals focus the way reka's listbox can, so there is no
|
|
108
|
+
* equivalent of the `focusable` flag the Vue port suspends and restores:
|
|
109
|
+
* Radix's popover is non-modal and `onOpenAutoFocus` is already prevented,
|
|
110
|
+
* cmdk's highlight is an `aria-activedescendant` rather than a real focus move,
|
|
111
|
+
* and its one refocusing path fires only when the active element is cmdk's own
|
|
112
|
+
* input or root — never a field inside a row. What is left is the same on both
|
|
113
|
+
* sides: take focus on entering the edit, hand it back to the combobox's own
|
|
114
|
+
* field on leaving.
|
|
115
|
+
*
|
|
116
|
+
* **A dialog around the combobox is free here and was not in Vue.** A dialog
|
|
117
|
+
* traps focus, the popover is portalled to `body` and is therefore outside what
|
|
118
|
+
* the trap considers the dialog, so the `.focus()` below reads as focus
|
|
119
|
+
* escaping — unless a nearer focus layer has suspended the trap.
|
|
120
|
+
* `Popover.Content` registers one in every Radix build, untrapped when the
|
|
121
|
+
* popover is non-modal, which ours is. reka gives `SelectContentImpl`,
|
|
122
|
+
* `PopoverContentImpl` and `MenuContentImpl` a `FocusScope` and
|
|
123
|
+
* `ComboboxContentImpl` none, so the Vue `ComboboxContent` has to add the layer
|
|
124
|
+
* by hand to reach the behaviour this side gets for nothing.
|
|
125
|
+
*
|
|
126
|
+
* **One thing here has no Vue counterpart.** cmdk re-sorts the option elements
|
|
127
|
+
* by moving the DOM nodes themselves whenever the search term changes, and a
|
|
128
|
+
* focused field inside a row that gets reparented loses focus. Typing in the
|
|
129
|
+
* combobox's own search box while a row edit is open is therefore not the same
|
|
130
|
+
* experience in the two packages. Editing is reached by clicking a control in
|
|
131
|
+
* the row, which leaves the search box unfocused, so it takes a deliberate
|
|
132
|
+
* detour to hit.
|
|
133
|
+
*/
|
|
134
|
+
export declare const ComboboxItemEdit: import('react').ForwardRefExoticComponent<ComboboxItemEditProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComboboxEditing } from './useComboboxEditing.ts';
|
|
1
2
|
/**
|
|
2
3
|
* Shared Combobox state.
|
|
3
4
|
*
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
* every part needs — the value, `multiple`, `disabled` and the search term — so
|
|
7
8
|
* a part can be used on its own without threading props through the tree.
|
|
8
9
|
*/
|
|
9
|
-
export interface ComboboxContextValue {
|
|
10
|
+
export interface ComboboxContextValue extends ComboboxEditing {
|
|
10
11
|
/** Current selection. `string` for single-select, `string[]` for multiple. */
|
|
11
12
|
value: string | string[] | undefined;
|
|
12
13
|
/** Commit a selection (toggles for `multiple`). */
|
|
@@ -21,6 +22,25 @@ export interface ComboboxContextValue {
|
|
|
21
22
|
/** Search string driving cmdk filtering. */
|
|
22
23
|
search: string;
|
|
23
24
|
setSearch: (search: string) => void;
|
|
25
|
+
/** Typing: restart the quiet period before the root's `onSearch`. */
|
|
26
|
+
scheduleSearch: (term: string) => void;
|
|
27
|
+
/** A gesture that settles the term — clearing it. Report now. */
|
|
28
|
+
searchImmediately: (term: string) => void;
|
|
29
|
+
/** Whether cmdk should leave the rendered options alone. */
|
|
30
|
+
skipFilter: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The text each option renders, keyed by the value it selects, so the field
|
|
33
|
+
* can show `Barcelona` rather than `barcelona`. See `useComboboxLabels` for
|
|
34
|
+
* why it never forgets an entry.
|
|
35
|
+
*/
|
|
36
|
+
registerLabel: (value: string, label: string) => void;
|
|
37
|
+
labelFor: (value: string) => string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The field itself, so a row that took focus for an in-place edit can hand it
|
|
40
|
+
* back when the edit ends. reka carries the same element on its own combobox
|
|
41
|
+
* context, which is where the Vue half gets it.
|
|
42
|
+
*/
|
|
43
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
24
44
|
}
|
|
25
45
|
export declare const ComboboxContext: import('react').Context<ComboboxContextValue | null>;
|
|
26
46
|
export declare function useComboboxContext(): ComboboxContextValue;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { Combobox, type ComboboxProps } from './Combobox.tsx';
|
|
2
|
+
export { ComboboxCancel, type ComboboxCancelProps } from './ComboboxCancel.tsx';
|
|
2
3
|
export { ComboboxInput, type ComboboxInputProps } from './ComboboxInput.tsx';
|
|
3
4
|
export { ComboboxChipsInput, type ComboboxChipsInputProps, } from './ComboboxChipsInput.tsx';
|
|
4
5
|
export { ComboboxContent, type ComboboxContentProps, } from './ComboboxContent.tsx';
|
|
5
6
|
export { ComboboxItem, type ComboboxItemProps } from './ComboboxItem.tsx';
|
|
7
|
+
export { ComboboxItemEdit, type ComboboxItemEditProps, } from './ComboboxItemEdit.tsx';
|
|
6
8
|
export { ComboboxEmpty, type ComboboxEmptyProps } from './ComboboxEmpty.tsx';
|
|
7
9
|
export { ComboboxGroup, type ComboboxGroupProps } from './ComboboxGroup.tsx';
|
|
8
10
|
export { ComboboxSeparator, type ComboboxSeparatorProps, } from './ComboboxSeparator.tsx';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export interface ChipOverflowTargets {
|
|
3
|
+
/**
|
|
4
|
+
* The single-line row holding the chips, the `+N` counter and the query
|
|
5
|
+
* field. Its width is the whole budget, which only holds because the row is
|
|
6
|
+
* laid out `flex: 1 1 0` with `min-width: 0` — its width is then whatever its
|
|
7
|
+
* siblings leave behind and owes nothing to its own content. Measuring an
|
|
8
|
+
* element whose size depends on how many chips we decided to show is exactly
|
|
9
|
+
* what turns this into an infinite loop.
|
|
10
|
+
*/
|
|
11
|
+
row: RefObject<HTMLElement | null>;
|
|
12
|
+
/** Offscreen stand-in for the `+N` counter, rendered at its widest. */
|
|
13
|
+
sizer: RefObject<HTMLElement | null>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Decides how many chips of a multi-select field fit on one line.
|
|
17
|
+
*
|
|
18
|
+
* The chips past the edge are not removed from the DOM — the component keeps
|
|
19
|
+
* them rendered and takes them out of flow — so every chip reports its natural
|
|
20
|
+
* width on every pass, whether or not it is currently shown. That is the whole
|
|
21
|
+
* trick: nothing measured here changes as a result of what is decided here, so
|
|
22
|
+
* a measurement can never provoke the measurement that follows it.
|
|
23
|
+
*
|
|
24
|
+
* With no layout at all — a test environment, the tick before styles land —
|
|
25
|
+
* every width reads zero, `0 <= 0` holds, and the answer is "all of them".
|
|
26
|
+
* Showing the full selection is the right way to be wrong: it is what the field
|
|
27
|
+
* did before, and it fails towards markup that shows too much rather than a
|
|
28
|
+
* field that hides its own contents.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useChipOverflow({ row, sizer }: ChipOverflowTargets, total: number): number;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface ComboboxEditing {
|
|
2
|
+
/** The row entering its editing state announces how to back out of it. */
|
|
3
|
+
openEdit: (cancel: () => void) => void;
|
|
4
|
+
/** The row leaving its editing state withdraws that offer. */
|
|
5
|
+
closeEdit: (cancel: () => void) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Back out of the open edit, if there is one. Returns whether there was —
|
|
8
|
+
* the caller uses that to decide whether the keystroke has been spent.
|
|
9
|
+
*/
|
|
10
|
+
cancelOpenEdit: () => boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Which row, if any, is currently being edited in place. Port of
|
|
14
|
+
* `core/src/Forms/Inputs/Combobox/useComboboxEditing`, where Vue's
|
|
15
|
+
* `provide`/`inject` does what this hook plus `ComboboxContext` do here.
|
|
16
|
+
*
|
|
17
|
+
* It exists for one keystroke. `Escape` inside the edit has to cancel the edit
|
|
18
|
+
* and leave the list open, and the only thing that can stop the list closing is
|
|
19
|
+
* the content's `onEscapeKeyDown`: Radix's dismissable layer listens on
|
|
20
|
+
* `document` with `capture: true`, so the editing field never sees the key
|
|
21
|
+
* first and cannot swallow it however hard it tries. The layer offers exactly
|
|
22
|
+
* one way out — `preventDefault()` on the event it hands up. So the content is
|
|
23
|
+
* where `Escape` has to be answered, the state is in the row, and this is the
|
|
24
|
+
* wire between them.
|
|
25
|
+
*
|
|
26
|
+
* The Vue half reaches the same arrangement from the opposite constraint: reka
|
|
27
|
+
* listens on `window` in the bubble phase, so there the field *would* see the
|
|
28
|
+
* key first, and handling it in both places would close the edit before the
|
|
29
|
+
* content was asked whether to prevent the dismissal — closing the list, which
|
|
30
|
+
* is the one thing this must not do. One mechanism, in the content, on both
|
|
31
|
+
* sides.
|
|
32
|
+
*
|
|
33
|
+
* A ref rather than state: nothing renders differently for knowing which row is
|
|
34
|
+
* open, and the only reader is an event handler, which wants the current value
|
|
35
|
+
* and not the one captured when it was last rendered.
|
|
36
|
+
*
|
|
37
|
+
* One edit at a time, and opening a second cancels the first: two rows in edit
|
|
38
|
+
* mode have two answers to `Escape` and no way to say which one the user meant.
|
|
39
|
+
*/
|
|
40
|
+
export declare function useComboboxEditing(): ComboboxEditing;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ComboboxLabels {
|
|
2
|
+
/** Record the text an option renders, keyed by the value it selects. */
|
|
3
|
+
register: (value: string, label: string) => void;
|
|
4
|
+
/** The recorded text for a value, or `undefined` if no option ever had it. */
|
|
5
|
+
labelFor: (value: string) => string | undefined;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* What lets the field show `Barcelona` where the caller wrote
|
|
9
|
+
* `<OxComboboxItem value="barcelona">Barcelona</OxComboboxItem>`. Port of
|
|
10
|
+
* `core/src/Forms/Inputs/Combobox/useComboboxLabels`, where Vue's
|
|
11
|
+
* `provide`/`inject` does what this hook plus `ComboboxContext` do here.
|
|
12
|
+
*
|
|
13
|
+
* **It never forgets.** That is the whole design decision, and it is not
|
|
14
|
+
* laziness: cmdk unmounts an option that does not match the search, so typing
|
|
15
|
+
* over a selection removes the very option the field is naming. A registry that
|
|
16
|
+
* dropped a label on unmount would blank the field mid-search, which is the
|
|
17
|
+
* common case, not the edge case. The cost is a label that outlives its option,
|
|
18
|
+
* which is the best answer available and strictly better than the raw value.
|
|
19
|
+
* Entries are per-root and die with it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useComboboxLabels(): ComboboxLabels;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ComboboxSearch {
|
|
2
|
+
/** Typing: restart the quiet period, emit when it elapses. */
|
|
3
|
+
schedule: (term: string) => void;
|
|
4
|
+
/** A gesture that settles the term — clearing it. Emit now. */
|
|
5
|
+
immediately: (term: string) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The wire between whichever field is typed into and the root's `onSearch`.
|
|
9
|
+
*
|
|
10
|
+
* The root is where `debounce` and `onSearch` belong — there are three fields
|
|
11
|
+
* (`ComboboxInput`, `ComboboxChipsInput`, and `ComboboxCancel` clearing one of
|
|
12
|
+
* them) and a prop on each would be the same number asked three times. The
|
|
13
|
+
* fields reach it through the shared context, beside `setSearch`.
|
|
14
|
+
*
|
|
15
|
+
* The fields report from their `onChange` rather than from the term itself,
|
|
16
|
+
* because the term is also written when a value is selected — the field is
|
|
17
|
+
* reset and the resolved label put in its place — and a search fired for the
|
|
18
|
+
* text of the option the user just picked is a request nobody asked for.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useComboboxSearch(debounce: number, onSearch: ((term: string) => void) | undefined): ComboboxSearch;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CalendarDayState } from '../Calendar/CalendarDay.tsx';
|
|
2
|
+
import { CalendarConstraints } from '../Calendar/constraints.ts';
|
|
3
|
+
/**
|
|
4
|
+
* A field that shows the chosen day and opens a calendar to change it. Mirrors
|
|
5
|
+
* `@sesame/orxata-core` DatePicker.
|
|
6
|
+
*
|
|
7
|
+
* This is `OxCalendar` plus the three things a calendar deliberately refuses to
|
|
8
|
+
* own: a control to hang off, a popover to live in, and the opinionated header
|
|
9
|
+
* — the month and an arrow at each end — that an embedded calendar would have to
|
|
10
|
+
* strip. Nothing here reimplements any of them; `OxPopover`, `OxCalendar` and
|
|
11
|
+
* `OxDatePickerTrigger` do the work.
|
|
12
|
+
*
|
|
13
|
+
* Same date contract as the calendar: a `Date` at the boundary means the
|
|
14
|
+
* calendar day formed by its local year, month and day. The time is ignored on
|
|
15
|
+
* the way in and is local midnight on the way out.
|
|
16
|
+
*
|
|
17
|
+
* It ships no strings. The trigger shows the day formatted by `Intl` in the
|
|
18
|
+
* locale `LocaleProvider` publishes, and shows nothing at all until one is
|
|
19
|
+
* picked — a placeholder is words, so it is `children`'s to supply.
|
|
20
|
+
*/
|
|
21
|
+
export interface DatePickerProps extends Pick<React.ButtonHTMLAttributes<HTMLButtonElement>, 'className'> {
|
|
22
|
+
/** The chosen day, or `undefined` for none. Controlled. */
|
|
23
|
+
value?: Date;
|
|
24
|
+
/** The initially chosen day, for the uncontrolled case. */
|
|
25
|
+
defaultValue?: Date;
|
|
26
|
+
onValueChange?: (value: Date | undefined) => void;
|
|
27
|
+
/** How many month grids the popover shows. */
|
|
28
|
+
months?: number;
|
|
29
|
+
/** What can be picked, and where navigation stops. Passed straight through. */
|
|
30
|
+
constraints?: CalendarConstraints;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* What the trigger shows. Falls back to the day from `Intl`, and to nothing
|
|
34
|
+
* while none is chosen — pass one to put a placeholder there.
|
|
35
|
+
*/
|
|
36
|
+
children?: (state: {
|
|
37
|
+
value: Date | undefined;
|
|
38
|
+
}) => React.ReactNode;
|
|
39
|
+
/** The trailing glyph. Falls back to a calendar. */
|
|
40
|
+
icon?: React.ReactNode;
|
|
41
|
+
/** One day in the grid. Handed to `OxCalendar` untouched. */
|
|
42
|
+
day?: (props: {
|
|
43
|
+
date: Date;
|
|
44
|
+
state: CalendarDayState;
|
|
45
|
+
}) => React.ReactNode;
|
|
46
|
+
dataTestid: string;
|
|
47
|
+
}
|
|
48
|
+
export declare const DatePicker: {
|
|
49
|
+
({ className, value, defaultValue, onValueChange, months, constraints, disabled, children, icon, day, dataTestid, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
displayName: string;
|
|
51
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { CalendarConstraints } from '../Calendar/constraints.ts';
|
|
2
|
+
import { CalendarNav } from '../Calendar/nav.ts';
|
|
3
|
+
export interface DatePickerHeaderProps {
|
|
4
|
+
/** Everything the calendar's `header` render prop hands over, passed in. */
|
|
5
|
+
nav: CalendarNav;
|
|
6
|
+
/**
|
|
7
|
+
* The same object the calendar was given. Published to `children` rather than
|
|
8
|
+
* read here: the year selector offers the years `from` and `to` allow, which
|
|
9
|
+
* `canGoPrev` and `canGoNext` cannot answer for.
|
|
10
|
+
*/
|
|
11
|
+
constraints?: CalendarConstraints;
|
|
12
|
+
/**
|
|
13
|
+
* What sits between the arrows. Falls back to the months on screen, named by
|
|
14
|
+
* `Intl`. Fill it with the two selectors to get the design's month-and-year
|
|
15
|
+
* variant, or with anything else that should be centred there.
|
|
16
|
+
*/
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
dataTestid: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The header `Calendar` deliberately does not draw: one arrow at each end, and
|
|
22
|
+
* whatever names the months between them. Mirrors `@sesame/orxata-core`
|
|
23
|
+
* DatePickerHeader.
|
|
24
|
+
*
|
|
25
|
+
* It exists as its own component because the two pickers share it and because
|
|
26
|
+
* an embedded `OxCalendar` can wear it too —
|
|
27
|
+
*
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <OxCalendar
|
|
30
|
+
* header={nav => <OxDatePickerHeader nav={nav} dataTestid="calendar-header" />}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* **Two arrows, not four.** There used to be a year jump at each end as well,
|
|
35
|
+
* because stepping a month at a time is no way to reach a birth year. The
|
|
36
|
+
* design answers that with a pair of dropdowns instead, which is both a shorter
|
|
37
|
+
* journey and one that says where it is going — so the outer arrows are gone
|
|
38
|
+
* and `OxDatePickerMonthSelect` / `OxDatePickerYearSelect` go in `children`:
|
|
39
|
+
*
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <OxDatePickerHeader nav={nav} constraints={constraints} dataTestid="head">
|
|
42
|
+
* <OxDatePickerMonthSelect dataTestid="head-month" />
|
|
43
|
+
* <OxDatePickerYearSelect dataTestid="head-year" />
|
|
44
|
+
* </OxDatePickerHeader>
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* `nav.goTo` survives the loss of the year arrows and is now what the selectors
|
|
48
|
+
* run on: stepping cannot express "the same month in 1974", and in React it
|
|
49
|
+
* cannot even accumulate — each `goToNext` is computed from the month of the
|
|
50
|
+
* render that produced it.
|
|
51
|
+
*
|
|
52
|
+
* **An arrow is absent, not disabled, when there is nothing that way.** The
|
|
53
|
+
* design has two independent show/hide axes for them and draws no disabled
|
|
54
|
+
* state, and `canGoPrev` / `canGoNext` already say exactly when a step is
|
|
55
|
+
* possible — so they drive presence rather than a second boolean the caller
|
|
56
|
+
* would have to keep in step with `constraints`.
|
|
57
|
+
*
|
|
58
|
+
* It ships no strings. The title is `Intl`'s, and each arrow announces the
|
|
59
|
+
* month it would move to, which is a date the locale formats rather than a
|
|
60
|
+
* phrase we would have to translate.
|
|
61
|
+
*/
|
|
62
|
+
export declare const DatePickerHeader: {
|
|
63
|
+
({ nav, constraints, children, dataTestid, }: DatePickerHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
displayName: string;
|
|
65
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface DatePickerMonthSelectProps {
|
|
2
|
+
dataTestid: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* The month half of the design's "Month and Year Selector" header. Goes in
|
|
6
|
+
* `OxDatePickerHeader`'s `children`, beside `OxDatePickerYearSelect`. Mirrors
|
|
7
|
+
* `@sesame/orxata-core` DatePickerMonthSelect.
|
|
8
|
+
*
|
|
9
|
+
* It reads the visible month and the bounds out of the header's context rather
|
|
10
|
+
* than taking them as props: they are the header's already, and a part that
|
|
11
|
+
* asked for them again would put `nav` on the public API of every piece of a
|
|
12
|
+
* header a caller assembles.
|
|
13
|
+
*
|
|
14
|
+
* Twelve options, named by `Intl` in the locale `LocaleProvider` publishes —
|
|
15
|
+
* this ships no month names of its own. A month the bounds put out of reach is
|
|
16
|
+
* offered and disabled rather than dropped, so the list is the same twelve rows
|
|
17
|
+
* in the same order whatever the constraints say.
|
|
18
|
+
*
|
|
19
|
+
* The trigger carries no `aria-label`, and that is the no-strings rule rather
|
|
20
|
+
* than an oversight: the only honest label would be the word "month" in the
|
|
21
|
+
* user's language, which this package does not have. What it announces is its
|
|
22
|
+
* role and its value, and its value is the month it is showing.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DatePickerMonthSelect: {
|
|
25
|
+
({ dataTestid, }: DatePickerMonthSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface DatePickerTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
+
/**
|
|
3
|
+
* Nothing chosen yet. Dims the content and marks the button
|
|
4
|
+
* `data-placeholder`, the flag `OxSelectTrigger` already uses for the same
|
|
5
|
+
* state — so the styling is a boolean and not a second slot.
|
|
6
|
+
*/
|
|
7
|
+
empty?: boolean;
|
|
8
|
+
/** The trailing glyph. Falls back to a calendar. */
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
dataTestid: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The closed control both pickers hang off: what is chosen on one side, a
|
|
14
|
+
* calendar glyph on the other. Mirrors `@sesame/orxata-core` DatePickerTrigger.
|
|
15
|
+
*
|
|
16
|
+
* It is one component and not two copies because the alternative is two
|
|
17
|
+
* stylesheets describing the same control. That is exactly how `OxSelect` and
|
|
18
|
+
* `OxCombobox` came to disagree about a radius, a border and a background, and
|
|
19
|
+
* the fix cost more than the component.
|
|
20
|
+
*
|
|
21
|
+
* It takes no size prop: height and radius come from the `--controller-*`
|
|
22
|
+
* variables every input in the package reads, so `inputSizeClass[size]` on any
|
|
23
|
+
* ancestor sizes it. Its declarations are `OxSelectTrigger`'s, so the two sit
|
|
24
|
+
* level in one form.
|
|
25
|
+
*
|
|
26
|
+
* It shows what it is given and formats nothing. A date is a date in a locale,
|
|
27
|
+
* and the picker above it is the one holding the locale.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DatePickerTrigger: import('react').ForwardRefExoticComponent<DatePickerTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface DatePickerYearSelectProps {
|
|
2
|
+
dataTestid: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* The year half of the design's "Month and Year Selector" header. Goes in
|
|
6
|
+
* `OxDatePickerHeader`'s `children`, beside `OxDatePickerMonthSelect`. Mirrors
|
|
7
|
+
* `@sesame/orxata-core` DatePickerYearSelect.
|
|
8
|
+
*
|
|
9
|
+
* This is what replaced the header's year arrows. Stepping a year at a time is
|
|
10
|
+
* no way to reach a birth year, and it was the arrows' only justification; a
|
|
11
|
+
* list says where it is going and gets there in one move.
|
|
12
|
+
*
|
|
13
|
+
* **Which years it offers.** Exactly the ones `constraints` allows, when there
|
|
14
|
+
* are constraints — that is the only statement about reachable dates this
|
|
15
|
+
* package will believe. With none, there is no bound to read and any window is
|
|
16
|
+
* a guess, so it takes the documented default in `month.ts`: deep enough behind
|
|
17
|
+
* the visible year to hold a date of birth, shallow enough ahead to stay a
|
|
18
|
+
* list. A caller who wants another window passes `constraints`.
|
|
19
|
+
*
|
|
20
|
+
* No `aria-label`, for the reason `OxDatePickerMonthSelect` gives.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DatePickerYearSelect: {
|
|
23
|
+
({ dataTestid, }: DatePickerYearSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { CalendarDayState } from '../Calendar/CalendarDay.tsx';
|
|
2
|
+
import { CalendarDateRange } from '../Calendar/CalendarRange.tsx';
|
|
3
|
+
import { CalendarConstraints } from '../Calendar/constraints.ts';
|
|
4
|
+
/**
|
|
5
|
+
* A field that shows the chosen span and opens a range calendar to change it.
|
|
6
|
+
* Mirrors `@sesame/orxata-core` DateRangePicker.
|
|
7
|
+
*
|
|
8
|
+
* A sibling of `OxDatePicker` with its own API, the same way `OxCalendarRange`
|
|
9
|
+
* is a sibling of `OxCalendar` — not a mode of it.
|
|
10
|
+
*
|
|
11
|
+
* Two months by default, because a span usually crosses one. The trigger shows
|
|
12
|
+
* the span collapsed the way the locale collapses one (`12–15 mar 2026`), from
|
|
13
|
+
* `Intl.DateTimeFormat.formatRange` where the runtime has it.
|
|
14
|
+
*
|
|
15
|
+
* There is an `aside` render prop beside the grids and nothing in it. Presets
|
|
16
|
+
* are the obvious thing to put there, and they are entirely the caller's: the
|
|
17
|
+
* design system ships no list, no exported constant of one, and no function
|
|
18
|
+
* that knows what "this week" means. It lays the column out and hands over
|
|
19
|
+
* `select`, which sets the span and closes the popover — whether the column
|
|
20
|
+
* holds shortcuts, a legend or a summary is not this component's business.
|
|
21
|
+
*/
|
|
22
|
+
export interface DateRangePickerProps extends Pick<React.ButtonHTMLAttributes<HTMLButtonElement>, 'className'> {
|
|
23
|
+
/** The chosen span. Either end may be absent while one is being picked. */
|
|
24
|
+
value?: CalendarDateRange;
|
|
25
|
+
/** The initially chosen span, for the uncontrolled case. */
|
|
26
|
+
defaultValue?: CalendarDateRange;
|
|
27
|
+
onValueChange?: (value: CalendarDateRange) => void;
|
|
28
|
+
/** How many month grids the popover shows. */
|
|
29
|
+
months?: number;
|
|
30
|
+
/** What can be picked, and where navigation stops. Passed straight through. */
|
|
31
|
+
constraints?: CalendarConstraints;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* What the trigger shows. Falls back to the span from `Intl`, and to nothing
|
|
35
|
+
* while neither end is chosen — pass one to put a placeholder there.
|
|
36
|
+
*/
|
|
37
|
+
children?: (state: {
|
|
38
|
+
value: CalendarDateRange | undefined;
|
|
39
|
+
}) => React.ReactNode;
|
|
40
|
+
/** The trailing glyph. Falls back to a calendar. */
|
|
41
|
+
icon?: React.ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* A column beside the grids. Receives `select`, which sets the span and
|
|
44
|
+
* closes the popover in one call — so whatever goes in here behaves like a
|
|
45
|
+
* second click. Not called until you pass one, and the column is not drawn at
|
|
46
|
+
* all until then.
|
|
47
|
+
*/
|
|
48
|
+
aside?: (state: {
|
|
49
|
+
select: (value: CalendarDateRange) => void;
|
|
50
|
+
}) => React.ReactNode;
|
|
51
|
+
/** One day in the grid. Handed to `OxCalendarRange` untouched. */
|
|
52
|
+
day?: (props: {
|
|
53
|
+
date: Date;
|
|
54
|
+
state: CalendarDayState;
|
|
55
|
+
}) => React.ReactNode;
|
|
56
|
+
dataTestid: string;
|
|
57
|
+
}
|
|
58
|
+
export declare const DateRangePicker: {
|
|
59
|
+
({ className, value, defaultValue, onValueChange, months, constraints, disabled, children, icon, aside, day, dataTestid, }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
displayName: string;
|
|
61
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a picker writes a date down.
|
|
3
|
+
*
|
|
4
|
+
* Everything here goes through `Intl` and the tag `LocaleProvider` publishes,
|
|
5
|
+
* so the design system ships no strings: the only characters it contributes are
|
|
6
|
+
* the separator a runtime too old for `formatRange` never gets from CLDR.
|
|
7
|
+
* Internal — none of it is exported from the package, because a caller who
|
|
8
|
+
* wants a different format fills the trigger slot with their own.
|
|
9
|
+
*/
|
|
10
|
+
/** One day, in the locale's medium form — `12 mar 2026`, `Mar 12, 2026`. */
|
|
11
|
+
export declare const formatDay: (locale: string, date: Date) => string;
|
|
12
|
+
/**
|
|
13
|
+
* A span, collapsed the way the locale collapses one: `12–15 mar 2026` rather
|
|
14
|
+
* than the two ends spelled out in full.
|
|
15
|
+
*
|
|
16
|
+
* A half-made span is the start alone. It is not an error state — it is the
|
|
17
|
+
* moment between the two clicks, and `CalendarDateRange` makes both ends
|
|
18
|
+
* optional precisely so it can be shown.
|
|
19
|
+
*/
|
|
20
|
+
export declare const formatDayRange: (locale: string, start: Date | undefined, end: Date | undefined) => string;
|
|
21
|
+
/**
|
|
22
|
+
* The month a header names, and what its navigation announces.
|
|
23
|
+
*
|
|
24
|
+
* Capitalisation is left to CSS: `Intl` lowercases the month in Spanish and
|
|
25
|
+
* capitalises it in English, and uppercasing it here would be the design system
|
|
26
|
+
* overruling the locale in the one place it has no business doing so.
|
|
27
|
+
*/
|
|
28
|
+
export declare const formatMonthYear: (locale: string, month: Date) => string;
|
|
29
|
+
/**
|
|
30
|
+
* The months on screen when there is more than one of them — `March – April
|
|
31
|
+
* 2026`, with the year said once where the locale says it once.
|
|
32
|
+
*/
|
|
33
|
+
export declare const formatMonthYearRange: (locale: string, first: Date, last: Date) => string;
|
|
34
|
+
/** The year alone, for the year selector's options and its current value. */
|
|
35
|
+
export declare const formatYear: (locale: string, month: Date) => string;
|
|
36
|
+
/**
|
|
37
|
+
* The month alone and abbreviated — `Jan`, `ene`, `1月` — which is what the
|
|
38
|
+
* month selector shows and what the design draws in it.
|
|
39
|
+
*
|
|
40
|
+
* `Intl` and not a table of our own, for the reason `Calendar` spells out: the
|
|
41
|
+
* names belong to the runtime's locale, not to a translation this package would
|
|
42
|
+
* have to carry.
|
|
43
|
+
*/
|
|
44
|
+
export declare const formatMonthShort: (locale: string, month: Date) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DatePicker, type DatePickerProps } from './DatePicker.tsx';
|
|
2
|
+
export { DateRangePicker, type DateRangePickerProps, } from './DateRangePicker.tsx';
|
|
3
|
+
export { DatePickerTrigger, type DatePickerTriggerProps, } from './DatePickerTrigger.tsx';
|
|
4
|
+
export { DatePickerHeader, type DatePickerHeaderProps, } from './DatePickerHeader.tsx';
|
|
5
|
+
export { DatePickerMonthSelect, type DatePickerMonthSelectProps, } from './DatePickerMonthSelect.tsx';
|
|
6
|
+
export { DatePickerYearSelect, type DatePickerYearSelectProps, } from './DatePickerYearSelect.tsx';
|