@sesamehr/react-design-system 2.0.0-beta.1 → 2.0.0-beta.11
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/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 +20 -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/ComboboxCancel.d.ts +14 -0
- package/dist/Forms/Inputs/Combobox/ComboboxChipsInput.d.ts +4 -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 +124 -0
- package/dist/Forms/Inputs/Combobox/context.d.ts +15 -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/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 +22 -0
- package/dist/Forms/Inputs/SearchBar/useSearchDelay.d.ts +24 -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/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/hooks/index.d.ts +12 -0
- package/dist/hooks/useAutoGrow.d.ts +22 -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 +17345 -10589
- package/dist/react-design-system.umd.cjs +164 -117
- package/package.json +4 -2
- package/src/assets/styles/theme-v2.css +6 -6
- package/src/assets/styles/theme-v3.css +7 -4
- 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
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { CalendarDayState } from './CalendarDay.tsx';
|
|
2
|
+
import { CalendarConstraints } from './constraints.ts';
|
|
3
|
+
import { CalendarNav } from './nav.ts';
|
|
4
|
+
/** One day. Falls back to `OxCalendarDay`. */
|
|
5
|
+
type DayRenderer = (props: {
|
|
6
|
+
date: Date;
|
|
7
|
+
state: CalendarDayState;
|
|
8
|
+
}) => React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* A month of days, and nothing around it. Mirrors `@sesame/orxata-core`
|
|
11
|
+
* Calendar.
|
|
12
|
+
*
|
|
13
|
+
* `Calendar` speaks `Date`. A `Date` at the boundary means the calendar day
|
|
14
|
+
* formed by its local year, month and day: the time is ignored on the way in,
|
|
15
|
+
* and is local midnight on the way out.
|
|
16
|
+
*
|
|
17
|
+
* There is no month title and no navigation — `header` is not called until you
|
|
18
|
+
* pass one, and is handed everything a header needs. The shared, opinionated
|
|
19
|
+
* one belongs a layer up, in `DatePicker`.
|
|
20
|
+
*
|
|
21
|
+
* Not `OxCalendarDate`, which also ships: that is a `<time>` chip showing a day
|
|
22
|
+
* and an abbreviated month, not a grid.
|
|
23
|
+
*/
|
|
24
|
+
export interface CalendarProps extends Pick<React.HTMLAttributes<HTMLDivElement>, 'className'> {
|
|
25
|
+
/** The selected day, or `undefined` for none. Controlled. */
|
|
26
|
+
value?: Date;
|
|
27
|
+
/** The initially selected day, for the uncontrolled case. */
|
|
28
|
+
defaultValue?: Date;
|
|
29
|
+
onValueChange?: (value: Date | undefined) => void;
|
|
30
|
+
/** How many month grids to render. */
|
|
31
|
+
months?: number;
|
|
32
|
+
/** What can be picked, and where navigation stops. */
|
|
33
|
+
constraints?: CalendarConstraints;
|
|
34
|
+
/**
|
|
35
|
+
* Empty by default. Receives the visible month and the navigation state,
|
|
36
|
+
* because without those nobody could build a header at all.
|
|
37
|
+
*/
|
|
38
|
+
header?: (nav: CalendarNav) => React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* One month's name, above its grid. Falls back to the month and year from
|
|
41
|
+
* `Intl`, and only renders when `months` is more than one — a lone month is
|
|
42
|
+
* named by `header`, and naming it twice is worse than not at all.
|
|
43
|
+
*/
|
|
44
|
+
month?: (props: {
|
|
45
|
+
month: Date;
|
|
46
|
+
}) => React.ReactNode;
|
|
47
|
+
/** One day. Falls back to `OxCalendarDay`. */
|
|
48
|
+
day?: DayRenderer;
|
|
49
|
+
dataTestid: string;
|
|
50
|
+
}
|
|
51
|
+
export declare const Calendar: {
|
|
52
|
+
({ className, value, defaultValue, onValueChange, months, month: renderMonth, constraints, header, day, dataTestid, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
displayName: string;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The five booleans are what `Calendar` hands to the `day` render prop, and
|
|
3
|
+
* they are the `data-*` vocabulary this emits. `range` is `CalendarRange`'s
|
|
4
|
+
* alone.
|
|
5
|
+
*/
|
|
6
|
+
export interface CalendarDayState {
|
|
7
|
+
selected: boolean;
|
|
8
|
+
today: boolean;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
outside: boolean;
|
|
11
|
+
focused: boolean;
|
|
12
|
+
range?: 'start' | 'middle' | 'end';
|
|
13
|
+
}
|
|
14
|
+
export interface CalendarDayProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
15
|
+
/**
|
|
16
|
+
* Partial so a single state can be shown on its own, which is what the guide
|
|
17
|
+
* does. Inside a calendar the render prop always supplies all of it.
|
|
18
|
+
*/
|
|
19
|
+
state?: Partial<CalendarDayState>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One day in a calendar grid: a button that shows its number and paints the
|
|
23
|
+
* state it is told about. Mirrors `@sesame/orxata-core` CalendarDay.
|
|
24
|
+
*
|
|
25
|
+
* Not `OxCalendarDate`, which also ships and which the name invites confusing
|
|
26
|
+
* this with. That one is a `<time>` chip showing a day and an abbreviated
|
|
27
|
+
* month — no button, no selection, no keyboard. This one is the cell.
|
|
28
|
+
*
|
|
29
|
+
* It is **told** its state and never reads it from context, so it renders on
|
|
30
|
+
* its own — the guide shows the states as a legend, outside any calendar — and
|
|
31
|
+
* so that it is assembled the same way as its Vue original.
|
|
32
|
+
*
|
|
33
|
+
* `disabled` is applied before the prop spread on purpose: `DayPicker` passes
|
|
34
|
+
* its own, leaving a focused-but-disabled day focusable with `aria-disabled`
|
|
35
|
+
* instead, and its answer has to win over the one derived from `state`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const CalendarDay: import('react').ForwardRefExoticComponent<CalendarDayProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CalendarDayState } from './CalendarDay.tsx';
|
|
2
|
+
import { CalendarConstraints } from './constraints.ts';
|
|
3
|
+
import { CalendarNav } from './nav.ts';
|
|
4
|
+
/** One day. Falls back to `OxCalendarDay`. */
|
|
5
|
+
type DayRenderer = (props: {
|
|
6
|
+
date: Date;
|
|
7
|
+
state: CalendarDayState;
|
|
8
|
+
}) => React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* `start` and `end`, not `from` and `to` — those two words are already the
|
|
11
|
+
* navigation bounds in `constraints`, and one word meaning two things inside
|
|
12
|
+
* the same component is the confusion this naming was chosen to avoid.
|
|
13
|
+
*/
|
|
14
|
+
export interface CalendarDateRange {
|
|
15
|
+
start?: Date;
|
|
16
|
+
end?: Date;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A month of days where two clicks pick a span. Mirrors `@sesame/orxata-core`
|
|
20
|
+
* CalendarRange. A sibling of `Calendar` with its own API, not a part of it.
|
|
21
|
+
*
|
|
22
|
+
* Same date contract: a `Date` at the boundary means the calendar day formed by
|
|
23
|
+
* its local year, month and day.
|
|
24
|
+
*/
|
|
25
|
+
export interface CalendarRangeProps extends Pick<React.HTMLAttributes<HTMLDivElement>, 'className'> {
|
|
26
|
+
/** The selected span. Either end may be absent while one is being picked. */
|
|
27
|
+
value?: CalendarDateRange;
|
|
28
|
+
/** The initially selected span, for the uncontrolled case. */
|
|
29
|
+
defaultValue?: CalendarDateRange;
|
|
30
|
+
onValueChange?: (value: CalendarDateRange) => void;
|
|
31
|
+
/** How many month grids to render. */
|
|
32
|
+
months?: number;
|
|
33
|
+
/** What can be picked, and where navigation stops. */
|
|
34
|
+
constraints?: CalendarConstraints;
|
|
35
|
+
/**
|
|
36
|
+
* Empty by default. Receives the visible month and the navigation state,
|
|
37
|
+
* because without those nobody could build a header at all.
|
|
38
|
+
*/
|
|
39
|
+
header?: (nav: CalendarNav) => React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* One month's name, above its grid. Falls back to the month and year from
|
|
42
|
+
* `Intl`, and only renders at all when there is more than one grid — a lone
|
|
43
|
+
* month is named by `header`, and naming it twice is worse than not at all.
|
|
44
|
+
*/
|
|
45
|
+
month?: (props: {
|
|
46
|
+
month: Date;
|
|
47
|
+
}) => React.ReactNode;
|
|
48
|
+
/** One day. Falls back to `OxCalendarDay`. */
|
|
49
|
+
day?: DayRenderer;
|
|
50
|
+
dataTestid: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const CalendarRange: {
|
|
53
|
+
({ className, value, defaultValue, onValueChange, months, month: renderMonth, constraints, header, day, dataTestid, }: CalendarRangeProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
displayName: string;
|
|
55
|
+
};
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What can be picked, and where navigation stops.
|
|
3
|
+
*
|
|
4
|
+
* Grouped on purpose: the three fields are one concept, and the range-length
|
|
5
|
+
* pair `CalendarRange` will eventually want has to fit here without a redesign.
|
|
6
|
+
*
|
|
7
|
+
* The bounds are `from` / `to`, not `min` / `max`. In `react-day-picker` those
|
|
8
|
+
* two words already mean the minimum and maximum *number of days* a range may
|
|
9
|
+
* span, which is the length limit this will grow. Keeping them free avoids the
|
|
10
|
+
* collision instead of explaining it forever.
|
|
11
|
+
*/
|
|
12
|
+
export interface CalendarConstraints {
|
|
13
|
+
/** The earliest month the calendar will navigate to. */
|
|
14
|
+
from?: Date;
|
|
15
|
+
/** The latest month the calendar will navigate to. */
|
|
16
|
+
to?: Date;
|
|
17
|
+
/** Called per day. Return `true` to make it unpickable. */
|
|
18
|
+
isDisabled?: (date: Date) => boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirrors `@sesame/orxata-core`'s `date.ts`. Internal — none of this is
|
|
3
|
+
* exported from the package.
|
|
4
|
+
*
|
|
5
|
+
* The Vue half also converts between the `Date` a caller speaks and the
|
|
6
|
+
* `CalendarDate` reka needs; `react-day-picker` speaks `Date` throughout, so
|
|
7
|
+
* only the part both sides need lives here.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Whether `day` only appears in `month`'s grid as padding, while the month it
|
|
11
|
+
* actually belongs to has a grid of its own on screen.
|
|
12
|
+
*
|
|
13
|
+
* Every grid pads its first and last weeks with days of the neighbouring
|
|
14
|
+
* months, so with `months: 2` the 4th of April is drawn twice: once in April's
|
|
15
|
+
* grid, which owns it, and once in the tail of March's. Both copies read the
|
|
16
|
+
* same selection, so a range ending on the 4th was painted as ending in two
|
|
17
|
+
* places at once.
|
|
18
|
+
*
|
|
19
|
+
* The rule is contextual, not per-grid — "a day another visible grid owns" —
|
|
20
|
+
* which is why the visible months have to be passed in rather than inferred
|
|
21
|
+
* from `month` alone. March's *leading* days from February stay drawn when
|
|
22
|
+
* February is not on screen, and disappear when it is.
|
|
23
|
+
*
|
|
24
|
+
* With a single grid nothing else is visible to own the day, so this is always
|
|
25
|
+
* `false` and every outside day is drawn exactly as before. That is the whole
|
|
26
|
+
* reason the behaviour needs no prop: it follows from how many months are up.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isDrawnByAnotherMonth(day: Date, month: Date, visible: readonly Date[]): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
export { Calendar, type CalendarProps } from './Calendar.tsx';
|
|
3
|
+
export { CalendarRange, type CalendarRangeProps, type CalendarDateRange, } from './CalendarRange.tsx';
|
|
4
|
+
export { CalendarDay, type CalendarDayProps, type CalendarDayState, } from './CalendarDay.tsx';
|
|
5
|
+
export type { CalendarConstraints } from './constraints.ts';
|
|
6
|
+
export type { CalendarNav } from './nav.ts';
|
|
7
|
+
/**
|
|
8
|
+
* Only the range position varies here. The other five states — selected,
|
|
9
|
+
* today, disabled, focused, outside — are `data-*` attributes rather than
|
|
10
|
+
* classes, because those five are the vocabulary a caller writes their own CSS
|
|
11
|
+
* against and a parallel set of class names would be a second spelling of the
|
|
12
|
+
* same thing.
|
|
13
|
+
*
|
|
14
|
+
* The range position is not in that vocabulary: it is `CalendarRange`'s alone,
|
|
15
|
+
* and `react-day-picker` and reka disagree about what to call it, so it stays
|
|
16
|
+
* ours and stays a class.
|
|
17
|
+
*/
|
|
18
|
+
export declare const calendarDayVariants: (props?: ({
|
|
19
|
+
range?: "end" | "start" | "middle" | null | undefined;
|
|
20
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
21
|
+
export type CalendarDayVariants = VariantProps<typeof calendarDayVariants>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a calendar hands to whoever draws its header.
|
|
3
|
+
*
|
|
4
|
+
* `Calendar` and `CalendarRange` render no header of their own, so this is the
|
|
5
|
+
* whole of what a header can be built from — a type rather than an inline
|
|
6
|
+
* literal because `DatePickerHeader` takes it as one prop, and a header that
|
|
7
|
+
* cannot name its own argument is one every caller has to retype.
|
|
8
|
+
*/
|
|
9
|
+
export interface CalendarNav {
|
|
10
|
+
/** The first month on screen. */
|
|
11
|
+
month: Date;
|
|
12
|
+
/**
|
|
13
|
+
* How many month grids are on screen, which is what a step moves by. A header
|
|
14
|
+
* that names only `month` names one of several and is wrong about the rest.
|
|
15
|
+
*/
|
|
16
|
+
months: number;
|
|
17
|
+
/** Page one screenful back, or forward. A screenful is `months` months. */
|
|
18
|
+
goToPrev: () => void;
|
|
19
|
+
goToNext: () => void;
|
|
20
|
+
canGoPrev: boolean;
|
|
21
|
+
canGoNext: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Jump to the month a `Date` falls in, however far away it is.
|
|
24
|
+
*
|
|
25
|
+
* Stepping cannot express "the same month next year" — twelve calls to
|
|
26
|
+
* `goToNext` only land there when `months` divides twelve, and in React they
|
|
27
|
+
* do not compound at all, since each one is computed from the month of the
|
|
28
|
+
* render that produced them. Anything that moves by more than a page needs
|
|
29
|
+
* this: `OxDatePickerMonthSelect` and `OxDatePickerYearSelect`, and any month
|
|
30
|
+
* or year list a caller builds instead. It outlived the header's year arrows,
|
|
31
|
+
* which were the first thing to need it.
|
|
32
|
+
*/
|
|
33
|
+
goTo: (month: Date) => void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test ids are derived from the root's, so `months: 12` still produces twelve
|
|
3
|
+
* distinct `day-12`s — the month precedes them.
|
|
4
|
+
*
|
|
5
|
+
* The month is numeric, not a name: a name derived from `Intl` becomes
|
|
6
|
+
* `month-marzo` the moment the locale changes, and takes every test with it.
|
|
7
|
+
*
|
|
8
|
+
* calendar-for-vacations ← root, supplied by the caller
|
|
9
|
+
* calendar-for-vacations-month-2026-03 ← each month grid
|
|
10
|
+
* calendar-for-vacations-month-2026-03-day-12 ← each cell
|
|
11
|
+
*/
|
|
12
|
+
/** Built from the local parts, for the same reason `date.ts` is. */
|
|
13
|
+
export declare const monthTestid: (root: string, month: Date) => string;
|
|
14
|
+
/**
|
|
15
|
+
* `undefined` for a day borrowed from the neighbouring month, which is why the
|
|
16
|
+
* `outside` argument is not optional — the caller has to have answered it.
|
|
17
|
+
*
|
|
18
|
+
* Such a day is drawn in a grid it does not belong to, purely as padding.
|
|
19
|
+
* Giving it an id would either collide with the id of the grid that owns it, or
|
|
20
|
+
* mean an id that does not say which grid it came from. Neither is worth it for
|
|
21
|
+
* a day that is decoration — a test that wants the 1st of April pins April.
|
|
22
|
+
*
|
|
23
|
+
* It is only drawn at all while the month that owns it has no grid on screen:
|
|
24
|
+
* see `isDrawnByAnotherMonth`. So the `outside` argument stays required, and
|
|
25
|
+
* stays the caller's to answer — the id is about which grid a day belongs to,
|
|
26
|
+
* which is a different question from whether the day is drawn.
|
|
27
|
+
*/
|
|
28
|
+
export declare const dayTestid: (monthId: string, day: Date, outside: boolean) => string | undefined;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Sunday through Saturday, the numbering both primitives take. */
|
|
2
|
+
export type WeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
|
+
/**
|
|
4
|
+
* Derived from the locale rather than taken as a prop. A prop would let an
|
|
5
|
+
* application put Monday first while every date it formats says otherwise, and
|
|
6
|
+
* the locale already carries the answer for every region ICU knows.
|
|
7
|
+
*/
|
|
8
|
+
export declare const weekStartsOnFor: (locale: string) => WeekStart;
|
|
9
|
+
/**
|
|
10
|
+
* How a weekday is abbreviated above its column.
|
|
11
|
+
*
|
|
12
|
+
* The design draws two letters — `Su Mo Tu` — and `Intl` has no two-letter
|
|
13
|
+
* weekday: `narrow` is one character, `short` is the locale's own abbreviation
|
|
14
|
+
* (`Sun`, `dom`, `Mo.`), `long` is the whole word. `short` is the nearest of
|
|
15
|
+
* the three and the only one that is still the locale's, so it is what both
|
|
16
|
+
* packages ask for. Trimming `short` to two characters would match the English
|
|
17
|
+
* mock and produce nonsense everywhere the abbreviation is not built that way,
|
|
18
|
+
* which is most places — and it would be this package inventing a format rather
|
|
19
|
+
* than reading one, which is the line the no-strings rule draws.
|
|
20
|
+
*
|
|
21
|
+
* Named here rather than written at each call site because reka takes it as a
|
|
22
|
+
* `weekdayFormat` prop and `react-day-picker` takes it as a formatter we write
|
|
23
|
+
* ourselves: two spellings of one decision, which is exactly the kind of thing
|
|
24
|
+
* that drifts.
|
|
25
|
+
*/
|
|
26
|
+
export declare const WEEKDAY_FORMAT = "short";
|
|
27
|
+
/**
|
|
28
|
+
* The locale the calendar formats in, and the week start that follows from it.
|
|
29
|
+
*
|
|
30
|
+
* `useLocale()` yields `undefined` when nothing provided one, which every other
|
|
31
|
+
* component hands straight to `Intl` to mean "follow the runtime".
|
|
32
|
+
* `react-day-picker` instead needs a `date-fns` locale *object*, and the one it
|
|
33
|
+
* falls back to is `en-US` — so the month names would disagree with the rest of
|
|
34
|
+
* the page. Resolving the runtime's own locale here, and formatting through
|
|
35
|
+
* `Intl`, keeps them in step without shipping a locale table.
|
|
36
|
+
*/
|
|
37
|
+
export declare const useCalendarLocale: () => {
|
|
38
|
+
locale: string;
|
|
39
|
+
weekStartsOn: WeekStart;
|
|
40
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ChatInputActionLabels, ChatInputState } from './index.ts';
|
|
3
|
+
export interface ChatInputProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue' | 'rows' | 'children' | 'onSubmit'> {
|
|
4
|
+
/**
|
|
5
|
+
* What a screen reader announces for the three default action buttons.
|
|
6
|
+
* Required, and required for the same reason `IconButton`'s `aria-label` is:
|
|
7
|
+
* a glyph is the whole control, so an unlabelled one announces as "button"
|
|
8
|
+
* and nothing else — and no default the design system could ship would be in
|
|
9
|
+
* the reader's language. One object rather than three props so that naming
|
|
10
|
+
* the buttons costs one line, not three.
|
|
11
|
+
*/
|
|
12
|
+
actionLabels: ChatInputActionLabels;
|
|
13
|
+
/**
|
|
14
|
+
* How tall the surface may grow before it starts to scroll, counted in
|
|
15
|
+
* lines of text.
|
|
16
|
+
*/
|
|
17
|
+
maxRows?: number;
|
|
18
|
+
/** Controlled message. Pair with `onValueChange`; omit for uncontrolled. */
|
|
19
|
+
value?: string;
|
|
20
|
+
/** Starting message when uncontrolled. */
|
|
21
|
+
defaultValue?: string;
|
|
22
|
+
/** Called on every keystroke with the next message. */
|
|
23
|
+
onValueChange?: (value: string) => void;
|
|
24
|
+
/** Enter, or the send button. Never called for an empty or whitespace value. */
|
|
25
|
+
onSubmit?: (value: string) => void;
|
|
26
|
+
/** The default add-attachment button was pressed. */
|
|
27
|
+
onAttach?: () => void;
|
|
28
|
+
/** The default microphone button was pressed. */
|
|
29
|
+
onRecord?: () => void;
|
|
30
|
+
/** The text surface. Falls back to an auto-growing textarea. */
|
|
31
|
+
children?: ReactNode | ((state: ChatInputState) => ReactNode);
|
|
32
|
+
/** A full-width band above the text surface. Renders nothing when omitted. */
|
|
33
|
+
toolbar?: ReactNode | ((state: ChatInputState) => ReactNode);
|
|
34
|
+
/** Bottom-left corner. Falls back to the add-attachment button. */
|
|
35
|
+
actionsStart?: ReactNode | ((state: ChatInputState) => ReactNode);
|
|
36
|
+
/** Bottom-right corner. Falls back to the microphone and send buttons. */
|
|
37
|
+
actionsEnd?: ReactNode | ((state: ChatInputState) => ReactNode);
|
|
38
|
+
dataTestid: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The frame around a chat composer: the box, the growth, the keyboard
|
|
42
|
+
* contract and the two action corners. Deliberately *not* an editor.
|
|
43
|
+
* Mirrors `@sesame/orxata-core` ChatInput.
|
|
44
|
+
*
|
|
45
|
+
* The text surface is `children`, and what it renders by default is a plain
|
|
46
|
+
* auto-growing `<textarea>` — so `value` is a string, and a consumer who
|
|
47
|
+
* later needs mentions or rich paste drops their own editor in without the
|
|
48
|
+
* design system taking a dependency on one. The alternative — building on a
|
|
49
|
+
* rich-text library — would put ProseMirror in front of every consumer of the
|
|
50
|
+
* package, turn `value` into HTML, and leave two different integrations to
|
|
51
|
+
* keep in step across React and Vue, for a design that has no formatting
|
|
52
|
+
* controls in it.
|
|
53
|
+
*
|
|
54
|
+
* `children`, `toolbar`, `actionsStart` and `actionsEnd` each take a node or a
|
|
55
|
+
* render prop called with `{ empty, submit }`, because the frame is the only
|
|
56
|
+
* part that knows whether the field is empty. A caller who replaces the send
|
|
57
|
+
* button keeps the empty-state refusal for free instead of re-deriving it,
|
|
58
|
+
* which is the way the two can never disagree.
|
|
59
|
+
*
|
|
60
|
+
* `className` lands on the root, which is the box; everything else a native
|
|
61
|
+
* `<textarea>` takes — `placeholder`, `name`, `disabled`, `aria-label` — falls
|
|
62
|
+
* through to the surface. That is also how every human-readable string
|
|
63
|
+
* arrives: the design system ships none of its own. Replace `children` and the
|
|
64
|
+
* fallthrough has nowhere to go — a caller supplying their own surface labels
|
|
65
|
+
* their own surface. The `ref` is the root, for the same reason `className`
|
|
66
|
+
* is.
|
|
67
|
+
*/
|
|
68
|
+
export declare const ChatInput: import('react').ForwardRefExoticComponent<ChatInputProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export { ChatInput } from './ChatInput.tsx';
|
|
3
|
+
export type { ChatInputProps } from './ChatInput.tsx';
|
|
4
|
+
/**
|
|
5
|
+
* The accessible names for the three default action buttons.
|
|
6
|
+
*
|
|
7
|
+
* A separate type rather than an inline literal so the Vue original can hold
|
|
8
|
+
* the identical shape, and so a caller can keep their copy in one place.
|
|
9
|
+
*
|
|
10
|
+
* There is no `cva` here on purpose. `ChatInput` has no variants — the design
|
|
11
|
+
* draws one box — and an empty variant map would be a thing to keep in step
|
|
12
|
+
* across two packages in exchange for nothing.
|
|
13
|
+
*/
|
|
14
|
+
export interface ChatInputActionLabels {
|
|
15
|
+
/** The `+` button that starts an attachment. */
|
|
16
|
+
attach: string;
|
|
17
|
+
/** The microphone button. */
|
|
18
|
+
record: string;
|
|
19
|
+
/** The send button. */
|
|
20
|
+
send: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* What every slot is handed. The frame is the only part that knows whether
|
|
24
|
+
* the field is empty, so it passes that down rather than making each caller
|
|
25
|
+
* re-derive it.
|
|
26
|
+
*/
|
|
27
|
+
export interface ChatInputState {
|
|
28
|
+
/** The value is blank or nothing but whitespace. */
|
|
29
|
+
empty: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The whole composer is disabled. Handed over so a replaced action button
|
|
32
|
+
* goes down with the rest of it instead of staying live beside a field
|
|
33
|
+
* nobody can type in.
|
|
34
|
+
*/
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Submits, unless `empty` or `disabled`. The same refusal the Enter key and
|
|
38
|
+
* the send button follow.
|
|
39
|
+
*/
|
|
40
|
+
submit: () => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A slot: a node, or a render prop — the React translation of Vue's scoped
|
|
44
|
+
* slot.
|
|
45
|
+
*/
|
|
46
|
+
export type ChatInputSlot = ReactNode | ((state: ChatInputState) => ReactNode);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ComboboxCancelProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
+
dataTestid: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* ComboboxCancel — clears the search term without closing the popup.
|
|
6
|
+
*
|
|
7
|
+
* Radix ships no combobox at all, so there is no `Cancel` part to wrap: this
|
|
8
|
+
* reproduces reka's, which renders a `<button type="button" tabindex="-1">` and
|
|
9
|
+
* empties the filter on click. `tabindex="-1"` is reka's and is kept — the
|
|
10
|
+
* field's own clear affordances are the keyboard path, and a tab stop between
|
|
11
|
+
* the input and the trigger would be one more thing to pass through on the way
|
|
12
|
+
* to the list.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ComboboxCancel: import('react').ForwardRefExoticComponent<ComboboxCancelProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -10,5 +10,9 @@ export interface ComboboxChipsInputProps extends Omit<React.InputHTMLAttributes<
|
|
|
10
10
|
* ComboboxChipsInput — the search field with the current selection as chips.
|
|
11
11
|
* Multi-select field: renders the selected values as removable chips (read from
|
|
12
12
|
* the shared `multiple` model) alongside the search field.
|
|
13
|
+
*
|
|
14
|
+
* The chips stay on one line. Those that do not fit are taken out of flow and
|
|
15
|
+
* stood in for by a `+N` counter; see `useChipOverflow` for how the line is
|
|
16
|
+
* measured.
|
|
13
17
|
*/
|
|
14
18
|
export declare const ComboboxChipsInput: import('react').ForwardRefExoticComponent<ComboboxChipsInputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -4,10 +4,4 @@ export interface ComboboxContentProps extends Omit<React.ComponentPropsWithoutRe
|
|
|
4
4
|
sideOffset?: number;
|
|
5
5
|
align?: 'start' | 'center' | 'end';
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* ComboboxContent — the popover surface and the scrollable list in one.
|
|
9
|
-
* `@radix-ui/react-popover` provides the portal + positioning; `cmdk`'s `Command`
|
|
10
|
-
* provides item filtering. A visually-hidden `CommandInput` receives the shared
|
|
11
|
-
* search string so typing in the anchored input filters the list.
|
|
12
|
-
*/
|
|
13
7
|
export declare const ComboboxContent: import('react').ForwardRefExoticComponent<ComboboxContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { CommandGroup } from 'cmdk';
|
|
2
2
|
export interface ComboboxGroupProps extends React.ComponentPropsWithoutRef<typeof CommandGroup> {
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The group heading. A node rather than a string: it is the caller's word
|
|
5
|
+
* for their own category, and taking it as text would decide for them that
|
|
6
|
+
* it can only ever be text.
|
|
7
|
+
*/
|
|
8
|
+
label?: React.ReactNode;
|
|
5
9
|
}
|
|
6
10
|
/** ComboboxGroup — a labelled set of items. */
|
|
7
11
|
export declare const ComboboxGroup: import('react').ForwardRefExoticComponent<ComboboxGroupProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -3,7 +3,12 @@ export interface ComboboxInputProps extends Omit<React.InputHTMLAttributes<HTMLI
|
|
|
3
3
|
placeholder?: string;
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
size?: InputSize;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Overrides the text shown for the current selection. The default resolves
|
|
8
|
+
* the option's own label, so pass this only when the label is not the text:
|
|
9
|
+
* a name that comes from a server, or an option whose content is an avatar
|
|
10
|
+
* and two lines where none of them is the useful one.
|
|
11
|
+
*/
|
|
7
12
|
displayValue?: (value: unknown) => string;
|
|
8
13
|
/** Custom trigger content (defaults to a chevron icon). */
|
|
9
14
|
trigger?: React.ReactNode;
|
|
@@ -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,124 @@
|
|
|
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
|
+
* **One thing here has no Vue counterpart.** cmdk re-sorts the option elements
|
|
117
|
+
* by moving the DOM nodes themselves whenever the search term changes, and a
|
|
118
|
+
* focused field inside a row that gets reparented loses focus. Typing in the
|
|
119
|
+
* combobox's own search box while a row edit is open is therefore not the same
|
|
120
|
+
* experience in the two packages. Editing is reached by clicking a control in
|
|
121
|
+
* the row, which leaves the search box unfocused, so it takes a deliberate
|
|
122
|
+
* detour to hit.
|
|
123
|
+
*/
|
|
124
|
+
export declare const ComboboxItemEdit: import('react').ForwardRefExoticComponent<ComboboxItemEditProps & import('react').RefAttributes<HTMLDivElement>>;
|