@kirana-ui/react 0.2.0 → 0.4.0
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/CHANGELOG.md +140 -0
- package/llms.txt +1800 -187
- package/package.json +48 -3
- package/skills/kirana-ui-primitives/SKILL.md +53 -12
- package/src/accordion.d.ts +2 -2
- package/src/accordion.js +3 -2
- package/src/accordion.js.map +1 -1
- package/src/alert-dialog.d.ts +2 -2
- package/src/autocomplete.d.ts +2 -2
- package/src/autosize.d.ts +1 -1
- package/src/avatar.d.ts +28 -7
- package/src/avatar.js +22 -9
- package/src/avatar.js.map +1 -1
- package/src/button.d.ts +5 -2
- package/src/button.js +4 -1
- package/src/button.js.map +1 -1
- package/src/calendar.d.ts +23 -8
- package/src/calendar.js +50 -13
- package/src/calendar.js.map +1 -1
- package/src/carousel.d.ts +6 -3
- package/src/carousel.js +1 -1
- package/src/carousel.js.map +1 -1
- package/src/checkbox-group-context.d.ts +4 -0
- package/src/checkbox-group-context.js +7 -0
- package/src/checkbox-group-context.js.map +1 -0
- package/src/checkbox-group.d.ts +15 -0
- package/src/checkbox-group.js +30 -0
- package/src/checkbox-group.js.map +1 -0
- package/src/checkbox.d.ts +7 -2
- package/src/checkbox.js +9 -3
- package/src/checkbox.js.map +1 -1
- package/src/collapsible.d.ts +1 -1
- package/src/color-picker.d.ts +61 -0
- package/src/color-picker.js +119 -0
- package/src/color-picker.js.map +1 -0
- package/src/combobox.d.ts +54 -5
- package/src/combobox.js +49 -8
- package/src/combobox.js.map +1 -1
- package/src/command.d.ts +4 -4
- package/src/command.js +2 -1
- package/src/command.js.map +1 -1
- package/src/date-field.d.ts +2 -2
- package/src/date-field.js +3 -2
- package/src/date-field.js.map +1 -1
- package/src/date-picker.d.ts +33 -11
- package/src/date-picker.js +22 -5
- package/src/date-picker.js.map +1 -1
- package/src/dialog.d.ts +11 -6
- package/src/dialog.js +27 -8
- package/src/dialog.js.map +1 -1
- package/src/direction.d.ts +1 -1
- package/src/direction.js +1 -1
- package/src/editable.d.ts +32 -0
- package/src/editable.js +63 -0
- package/src/editable.js.map +1 -0
- package/src/field.d.ts +1 -1
- package/src/fieldset.d.ts +1 -1
- package/src/file-upload.d.ts +54 -0
- package/src/file-upload.js +96 -0
- package/src/file-upload.js.map +1 -0
- package/src/form.d.ts +1 -1
- package/src/hover-popup.d.ts +1 -1
- package/src/hover-popup.js +1 -1
- package/src/index.d.ts +28 -7
- package/src/index.js +12 -1
- package/src/input.d.ts +1 -1
- package/src/input.js +1 -1
- package/src/label.d.ts +1 -1
- package/src/listbox.d.ts +1 -1
- package/src/listbox.js +1 -1
- package/src/menu.d.ts +5 -5
- package/src/menu.js +14 -9
- package/src/menu.js.map +1 -1
- package/src/menubar.d.ts +2 -2
- package/src/menubar.js +4 -2
- package/src/menubar.js.map +1 -1
- package/src/message-scroller.d.ts +1 -1
- package/src/navigation-menu.d.ts +5 -5
- package/src/navigation-menu.js +14 -4
- package/src/navigation-menu.js.map +1 -1
- package/src/number-field.d.ts +11 -2
- package/src/number-field.js +20 -3
- package/src/number-field.js.map +1 -1
- package/src/otp.d.ts +3 -2
- package/src/otp.js +10 -2
- package/src/otp.js.map +1 -1
- package/src/pagination.d.ts +1 -1
- package/src/password-input.d.ts +23 -0
- package/src/password-input.js +40 -0
- package/src/password-input.js.map +1 -0
- package/src/popover.d.ts +12 -4
- package/src/popover.js +14 -1
- package/src/popover.js.map +1 -1
- package/src/qr-code.d.ts +1 -1
- package/src/radio-group.d.ts +4 -2
- package/src/radio-group.js +6 -3
- package/src/radio-group.js.map +1 -1
- package/src/rating.d.ts +28 -0
- package/src/rating.js +59 -0
- package/src/rating.js.map +1 -0
- package/src/resizable.d.ts +1 -1
- package/src/resizable.js +1 -1
- package/src/runtime.d.ts +18 -8
- package/src/runtime.js +24 -5
- package/src/runtime.js.map +1 -1
- package/src/scroll-area.d.ts +1 -1
- package/src/scroll-area.js +1 -1
- package/src/select.d.ts +17 -6
- package/src/select.js +6 -3
- package/src/select.js.map +1 -1
- package/src/separator.d.ts +1 -1
- package/src/slider.d.ts +2 -2
- package/src/slider.js +3 -2
- package/src/slider.js.map +1 -1
- package/src/steps.d.ts +51 -0
- package/src/steps.js +69 -0
- package/src/steps.js.map +1 -0
- package/src/switch.d.ts +2 -1
- package/src/switch.js +1 -1
- package/src/switch.js.map +1 -1
- package/src/tabs.d.ts +2 -2
- package/src/tabs.js +4 -3
- package/src/tabs.js.map +1 -1
- package/src/tags-input.d.ts +47 -0
- package/src/tags-input.js +92 -0
- package/src/tags-input.js.map +1 -0
- package/src/time-field.d.ts +32 -0
- package/src/time-field.js +67 -0
- package/src/time-field.js.map +1 -0
- package/src/toast.d.ts +1 -1
- package/src/toggle-group.d.ts +2 -2
- package/src/toggle-group.js +4 -3
- package/src/toggle-group.js.map +1 -1
- package/src/toggle.d.ts +1 -1
- package/src/toggle.js +1 -1
- package/src/toolbar.d.ts +14 -6
- package/src/toolbar.js +19 -9
- package/src/toolbar.js.map +1 -1
- package/src/tour.d.ts +61 -0
- package/src/tour.js +68 -0
- package/src/tour.js.map +1 -0
- package/src/tree.d.ts +45 -0
- package/src/tree.js +93 -0
- package/src/tree.js.map +1 -0
- package/src/use-render.d.ts +1 -1
- package/src/use-render.js +1 -1
- package/src/use-render.js.map +1 -1
- package/src/value-bar.d.ts +1 -1
package/llms.txt
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
Generated from the library's own source (`bun scripts/llms.ts`), and checked against it: every part and every prop here is in the package, and what is not here is not. In order: installing it and its entries; the positioner's options; the types the props name; what else is exported; the agent bridge; the testing kit; then "Using it" (the rules of every component) and "Components" (each one's parts, props, attributes and CSS variables).
|
|
6
6
|
|
|
7
|
+
This file describes the version it ships with. What changed in each release, the breaking changes first with what to write instead, is `CHANGELOG.md` in the package: `node_modules/@kirana-ui/react/CHANGELOG.md`.
|
|
8
|
+
|
|
7
9
|
## Install and entries
|
|
8
10
|
|
|
9
|
-
Install `@kirana-ui/react`. It is enough: the core it is built on comes with it, and what the core gives an application is also an entry of this package (`@kirana-ui/react/agent`, `@kirana-ui/react/testing`), so nothing is imported from a package the project did not install.
|
|
11
|
+
Install `@kirana-ui/react`. It is enough: the core it is built on comes with it, and what the core gives an application is also an entry of this package (`@kirana-ui/react/agent`, `@kirana-ui/react/testing`), so nothing is imported from a package the project did not install. The one exception is a component of your own, built on `@kirana-ui/core/authoring`: its controller imports the core by name, so that project installs `@kirana-ui/core` too, at this package's exact version (they must be one copy). It runs on the project's own `react` ^18.0.0 || ^19.0.0 and `react-dom` ^18.0.0 || ^19.0.0.
|
|
10
12
|
|
|
11
|
-
Its entries: an entry per component (`@kirana-ui/react/tabs`,
|
|
13
|
+
Its entries: an entry per component (`@kirana-ui/react/tabs`, 59 of them, each named under its component below), the package root `@kirana-ui/react` (every component at once, for a bundler that shakes trees), and `@kirana-ui/react/runtime`, `@kirana-ui/react/agent`, `@kirana-ui/react/testing`, `@kirana-ui/react/use-render` and `@kirana-ui/react/direction`. No other path is an entry: `DirectionProvider` and `useDirection` are in `@kirana-ui/react/direction`, `PortalProvider` in the package root.
|
|
12
14
|
|
|
13
15
|
The attributes and CSS variables below are also data and typed selectors, for a design system: install `@kirana-ui/vocabulary` for them (`import { vocabulary } from "@kirana-ui/vocabulary"`, `import { Dialog } from "@kirana-ui/vocabulary/keys"`: `Dialog.Popup.open` is `"[data-open]"`). It is its own package, and not installed with this one.
|
|
14
16
|
|
|
@@ -20,12 +22,17 @@ What every `Positioner` takes, beside its own props where a component's section
|
|
|
20
22
|
|
|
21
23
|
- `side?: Side`: The side of the anchor the popup is on. `inline-start` and `inline-end` follow the reading direction the popup is placed in, and `data-side` then says the side in the same words. Default `"bottom"`.
|
|
22
24
|
- `align?: Align`: Where along that side the popup is: at the anchor's start, its centre or its end. Default `"center"`.
|
|
23
|
-
- `sideOffset?: number`: The gap between the anchor and the popup, measured without any arrow. Default `0`.
|
|
24
|
-
- `alignOffset?: number`: How far the popup is moved along the side from where `align` puts it,
|
|
25
|
-
- `collisionPadding?:
|
|
25
|
+
- `sideOffset?: number | OffsetFunction`: The gap between the anchor and the popup, measured without any arrow: a number of pixels, or a function of what was measured (`({ side, align, anchor, positioner }) => number`). Default `0`.
|
|
26
|
+
- `alignOffset?: number | OffsetFunction`: How far the popup is moved along the side from where `align` puts it: a number of pixels, or a function of what was measured (`({ side, align, anchor, positioner }) => number`). Default `0`.
|
|
27
|
+
- `collisionPadding?: CollisionPadding`: Kept between the popup and the edges it is held inside: one number, or one for each side (`{ top, right, bottom, left }`, a side left out is 0). Default `5`.
|
|
28
|
+
- `collisionBoundary?: CollisionBoundary`: What the popup is held inside: an element, several, or a rectangle of the viewport. Left out or `"clipping-ancestors"`: the ancestors that clip it, and the viewport.
|
|
29
|
+
- `collisionAvoidance?: CollisionAvoidance`: What the popup does when it does not fit: `side` and `align` each `"flip"`, `"shift"` or `"none"`, and `fallbackAxisSide`. Left out: it flips to the opposite side and is moved along its side.
|
|
30
|
+
- `sticky?: boolean`: Keeps the popup in view once its anchor has been scrolled out of it. Otherwise the popup leaves with its anchor. Default `false`.
|
|
31
|
+
- `arrowPadding?: number`: Kept between an arrow and the ends of the popup's edge, so the arrow does not stand on a rounded corner. Default `5`.
|
|
32
|
+
- `positionMethod?: "absolute" | "fixed"`: The CSS `position` the positioner is given: `"absolute"` or `"fixed"`. Default `"absolute"`.
|
|
26
33
|
- `anchor?: Anchor | RefObject<Element | null> | (() => Anchor | null | undefined) | null`: What the popup is placed against, when that is not its trigger: an element, a ref to one, a place in the viewport (an object with `getBoundingClientRect`), or a function that gives one. It may change while the popup is open: the popup follows.
|
|
27
34
|
|
|
28
|
-
A component's own defaults lie over those: `Autocomplete` `{ align: "start" }`; `Combobox` `{ align: "start" }`; `ContextMenu` `{ align: "start" }`, and `{ side: "inline-end", align: "start" }` for a submenu or for a menu in a vertical menubar; `HoverCard` `{ side: "top" }`; `Menu` `{ align: "start" }`, and `{ side: "inline-end", align: "start" }` for a submenu or for a menu in a vertical menubar; `NavigationMenu` `{ align: "start" }`; `Select` `{ align: "start" }`; `Tooltip` `{ side: "top" }
|
|
35
|
+
A component's own defaults lie over those: `Autocomplete` `{ align: "start" }`; `Combobox` `{ align: "start" }`; `ContextMenu` `{ align: "start" }`, and `{ side: "inline-end", align: "start" }` for a submenu or for a menu in a vertical menubar; `HoverCard` `{ side: "top" }`; `Menu` `{ align: "start" }`, and `{ side: "inline-end", align: "start" }` for a submenu or for a menu in a vertical menubar; `NavigationMenu` `{ align: "start" }`; `Select` `{ align: "start" }`; `Tooltip` `{ side: "top" }`; `Tour` the shared defaults, under the `side` and `align` of the step shown; a step with no target is placed in the middle of the viewport whatever they say.
|
|
29
36
|
|
|
30
37
|
## Types
|
|
31
38
|
|
|
@@ -33,11 +40,17 @@ The named types the props below mention, each with the entry of this package it
|
|
|
33
40
|
|
|
34
41
|
- `Align` (`@kirana-ui/react`): `"start" | "center" | "end"`. Where along its side a popup is: at the anchor's start, its centre or its end.
|
|
35
42
|
- `Anchor` (`@kirana-ui/react`): `Element | VirtualElement`. What a popup is placed against: an element, or a place in the viewport that is none.
|
|
36
|
-
- `CalendarDay` (`@kirana-ui/react`): A day in the grid of
|
|
43
|
+
- `CalendarDay` (`@kirana-ui/react`): A day in the grid of a month shown.
|
|
37
44
|
- `date: IsoDate`
|
|
38
45
|
- `label: string`: The day of the month as the locale writes it.
|
|
39
|
-
- `outside: boolean`: Not of the month
|
|
40
|
-
- `
|
|
46
|
+
- `outside: boolean`: Not of the month it is drawn in: the days that fill its first and last weeks.
|
|
47
|
+
- `CalendarMonth` (`@kirana-ui/react`): One of the months shown, as `Calendar.Months` gives it.
|
|
48
|
+
- `index: number`: Its place among the months shown, from 0.
|
|
49
|
+
- `month: IsoDate`: Its first day.
|
|
50
|
+
- `title: string`: Its name as the locale writes it (`"March 2026"`).
|
|
51
|
+
- `weekdays: readonly CalendarWeekday[]`
|
|
52
|
+
- `weeks: readonly (readonly CalendarDay[])[]`
|
|
53
|
+
- `CalendarValueOf<Mode extends CalendarMode | undefined>` (`@kirana-ui/react`): `Mode extends "range" ? DateRange | null : Mode extends "multiple" ? readonly IsoDate[] : IsoDate | null`. The value of one mode: a day or `null`, a range or `null`, or a list (empty for none). What `value` and `onValueChange` are typed by, from the `mode` a root is given.
|
|
41
54
|
- `CalendarWeekday` (`@kirana-ui/react`): A day of the week, as a column's heading names it.
|
|
42
55
|
- `index: number`: Its place in the week as the locale orders it, from 0.
|
|
43
56
|
- `narrow: string`: Its name as a column's heading (`"M"`, `"Mo"`), and in full (`"Monday"`).
|
|
@@ -50,14 +63,50 @@ The named types the props below mention, each with the entry of this package it
|
|
|
50
63
|
- `cancel(): void`: Keeps the value as it was.
|
|
51
64
|
- `canceled: boolean`
|
|
52
65
|
- `ChangeSource` (`@kirana-ui/react`): `"mouse" | "touch" | "pen" | "keyboard" | "virtual" | "programmatic" | "agent"`. What made a change: a kind of pointer, the keyboard, a press with no pointer (`virtual`), code with no event (`programmatic`), or an agent acting through the bridge.
|
|
66
|
+
- `CollisionAvoidance` (`@kirana-ui/react`): What a popup does when it does not fit where it was asked to be.
|
|
67
|
+
- `side?: "flip" | "shift" | "none"`: Across from the anchor: `"flip"` goes to the opposite side, `"shift"` keeps the side and moves over the anchor to stay in view, `"none"` lets it overflow. Default `"flip"`.
|
|
68
|
+
- `align?: "flip" | "shift" | "none"`: Along its side: `"flip"` swaps `start` and `end`, `"shift"` moves the popup along the side to stay in view, `"none"` lets it overflow. Default `"flip"`. With `side: "shift"` it is `"shift"` or `"none"`.
|
|
69
|
+
- `fallbackAxisSide?: "start" | "end" | "none"`: Where it goes when neither the side asked for nor its opposite fits: to the other axis, its `"start"` or its `"end"` first, or nowhere (`"none"`). Default `"end"`.
|
|
70
|
+
- `CollisionBoundary` (`@kirana-ui/react`): `"clipping-ancestors" | Element | Element[] | { x: number; y: number; width: number; height: number }`. What a popup is held inside: the ancestors that clip it (`"clipping-ancestors"`), an element, several, or a rectangle of the viewport.
|
|
71
|
+
- `CollisionPadding` (`@kirana-ui/react`): `number | Partial<Record<PhysicalSide, number>>`. The room kept between a popup and the edges it is held inside: one number, or one a side.
|
|
72
|
+
- `ColorFormat` (`@kirana-ui/react`): `"hex" | "rgb" | "hsl"`. How a colour is written: `#rrggbb`, `rgb(…)` or `hsl(…)`.
|
|
73
|
+
- `ColorPickerInputChannel` (`@kirana-ui/react`): `"hex" | "red" | "green" | "blue" | "hue" | "saturation" | "lightness" | "alpha"`. A channel an input of the picker is typed in.
|
|
74
|
+
- `ColorPickerSliderChannel` (`@kirana-ui/react`): `"hue" | "alpha"`. A channel a slider of the picker moves: the hue, or the alpha.
|
|
75
|
+
- `ColorPickerThumb` (`@kirana-ui/react`): `"area" | ColorPickerSliderChannel`. What a thumb of the picker moves: the area's, or a slider's channel.
|
|
76
|
+
- `ComboboxEntry<Value = unknown>` (`@kirana-ui/react`): `ComboboxItemEntry<Value> | ComboboxGroupEntry<Value>`. What a `Collection` hands to be drawn: an item that is left, or a group that has items left.
|
|
77
|
+
- `ComboboxGroupData<Value = unknown>` (`@kirana-ui/react`): Items given as data that belong together: `value` is the group's name.
|
|
78
|
+
- `value: string`
|
|
79
|
+
- `items: readonly ComboboxItemData<Value>[]`
|
|
80
|
+
- `ComboboxGroupEntry<Value = unknown>` (`@kirana-ui/react`): A group that has items left, with those items.
|
|
81
|
+
- `type: "group"`
|
|
82
|
+
- `key: string`: What it is known by from one drawing to the next.
|
|
83
|
+
- `value: string`: The group's name, as it was given.
|
|
84
|
+
- `label: string`: The same name: an entry of either kind has a `label`.
|
|
85
|
+
- `disabled: false`: Never: an entry of either kind says whether it is disabled.
|
|
86
|
+
- `items: readonly ComboboxItemEntry<Value>[]`: The items of the group that are left.
|
|
87
|
+
- `ComboboxItemData<Value = unknown>` (`@kirana-ui/react`): One item given as data: its value, and what it is called.
|
|
88
|
+
- `value: Value`
|
|
89
|
+
- `label: string`
|
|
90
|
+
- `disabled?: boolean`: It cannot be chosen: its entry says so, for the item drawn for it.
|
|
91
|
+
- `ComboboxItemEntry<Value = unknown>` (`@kirana-ui/react`): One item left of the `items` given as data, as a `Collection` hands it to be drawn.
|
|
92
|
+
- `type: "item"`
|
|
93
|
+
- `key: string`: What it is known by from one drawing to the next.
|
|
94
|
+
- `value: Value`
|
|
95
|
+
- `label: string`
|
|
96
|
+
- `disabled: boolean`
|
|
97
|
+
- `item: ComboboxItemData<Value>`: The item as it was given, with whatever else it carries.
|
|
53
98
|
- `DateFieldSegment` (`@kirana-ui/react`): One piece of the field, in the locale's order: a part that is typed, or what stands between.
|
|
54
99
|
- `type: DateUnit | "literal"`
|
|
55
100
|
- `literal: string`: What stands between two parts (`"/"`); empty for a part that is typed.
|
|
56
101
|
- `index: number`: Its place among the pieces.
|
|
102
|
+
- `DatePickerRange` (`@kirana-ui/react`): A range a date picker holds: its first and its last day, either `null` while it is being chosen (the first picked, the second not yet; one end typed).
|
|
103
|
+
- `start: IsoDate | null`
|
|
104
|
+
- `end: IsoDate | null`
|
|
105
|
+
- `DatePickerValueOf<Mode extends DatePickerMode | undefined>` (`@kirana-ui/react`): `Mode extends "range" ? DatePickerRange | null : IsoDate | null`. The value of one mode: a day or `null`, or a range or `null`.
|
|
57
106
|
- `DateRange` (`@kirana-ui/react`): A range of days, its first and its last, both in it.
|
|
58
107
|
- `start: IsoDate`
|
|
59
108
|
- `end: IsoDate`
|
|
60
|
-
- `DateUnit` (`@kirana-ui/react`): `"day" | "month" | "year"`. A part of a date that is typed on its own.
|
|
109
|
+
- `DateUnit` (`@kirana-ui/react`): `"era" | "day" | "month" | "year"`. A part of a date that is typed on its own; the era only in a calendar that has several.
|
|
61
110
|
- `DrawerSide` (`@kirana-ui/react`): `"up" | "down" | "left" | "right"`. The way a drawer is swiped to close it: towards the edge it came from.
|
|
62
111
|
- `DrawerSnapPoint` (`@kirana-ui/react`): `number | string`. How much of a drawer shows at a place it rests: a share of it, or a length.
|
|
63
112
|
- `FieldValidity` (`@kirana-ui/react`): What a field knows of its control's value once it has been checked.
|
|
@@ -65,18 +114,42 @@ The named types the props below mention, each with the entry of this package it
|
|
|
65
114
|
- `errors: readonly string[]`: What is wrong, one message each.
|
|
66
115
|
- `state: Readonly<Record<ValidityKey, boolean>>`: What the browser found, by name; `customError` is the field's own `validate`.
|
|
67
116
|
- `value: string`: The value that was checked.
|
|
117
|
+
- `FileRejection` (`@kirana-ui/react`): A file that was not taken, and every reason it was not.
|
|
118
|
+
- `file: File`
|
|
119
|
+
- `reasons: readonly FileRejectionReason[]`
|
|
120
|
+
- `FileRejectionReason` (`@kirana-ui/react`): `"type" | "too-large" | "too-small" | "too-many" | "invalid"`. Why a file was not taken.
|
|
121
|
+
- `FileUploadEntry` (`@kirana-ui/react`): One file as it is drawn: the file, its place, and what tells it from the others.
|
|
122
|
+
- `key: string`: The same for as long as the file is held: what a list keeps its element by.
|
|
123
|
+
- `file: File`
|
|
124
|
+
- `index: number`
|
|
68
125
|
- `FormErrors` (`@kirana-ui/react`): `Record<string, string | readonly string[]>`. A form's errors as a server sends them: each field's name with its message, or messages.
|
|
69
126
|
- `FormValues` (`@kirana-ui/react`): `Record<string, FormDataEntryValue | FormDataEntryValue[]>`. A form's values by field name, as `FormData` holds them: a list where a name is there more than once.
|
|
127
|
+
- `HourCycle` (`@kirana-ui/react`): `12 | 24`. A clock of twelve hours and a day period, or of twenty-four.
|
|
128
|
+
- `Hsva` (`@kirana-ui/react`): Hue from 0 to 360, saturation and brightness (value) from 0 to 100, alpha from 0 to 1: what a colour area draws, saturation across and brightness up.
|
|
129
|
+
- `h: number`
|
|
130
|
+
- `s: number`
|
|
131
|
+
- `v: number`
|
|
132
|
+
- `a: number`
|
|
133
|
+
- `ImageStatus` (`@kirana-ui/react`): `"idle" | "loading" | "loaded" | "error"`. Where an avatar's picture is in its loading: `idle` while it has no address, `loading`, then `loaded` or `error`. Base UI's `ImageLoadingStatus`.
|
|
70
134
|
- `IsoDate` (`@kirana-ui/react`): `string`. A day as `YYYY-MM-DD`, in the calendar the world's data is kept in (ISO 8601).
|
|
135
|
+
- `IsoTime` (`@kirana-ui/react`): `string`. A time of day as `HH:MM` or `HH:MM:SS`, in 24 hours (ISO 8601).
|
|
71
136
|
- `ListCollection` (`@kirana-ui/react`): Every row of a list of which only some are in the page: a virtualizer draws the ones in view. The keys then move by place, and ask for a row that is not drawn to be brought into the page.
|
|
72
137
|
- `count: number`: How many rows there are, drawn or not.
|
|
73
138
|
- `label?(index: number): string`: A row's name by its place: what typing matches. Without it, typing finds nothing.
|
|
74
139
|
- `disabled?(index: number): boolean`
|
|
75
140
|
- `indexOf?(value: unknown): number`: The place of a value, or -1: where a list opens on what is chosen.
|
|
76
141
|
- `scrollToIndex(index: number): void`: Brings a row into the page: the virtualizer's own scroll.
|
|
142
|
+
- `OffsetData` (`@kirana-ui/react`): What an offset given as a function is told: where the popup is, and the two sizes.
|
|
143
|
+
- `side: Side`: The side of the anchor the popup is on, in the words it was asked for in.
|
|
144
|
+
- `align: Align`: Where along that side the popup is.
|
|
145
|
+
- `anchor: { width: number; height: number }`: The anchor's size, in pixels.
|
|
146
|
+
- `positioner: { width: number; height: number }`: The positioner's size, in pixels.
|
|
147
|
+
- `OffsetFunction` (`@kirana-ui/react`): `(data: OffsetData) => number`. A gap worked out from what was measured: `({ side, align, anchor, positioner }) => number`.
|
|
77
148
|
- `Orientation` (`@kirana-ui/react`): `"horizontal" | "vertical"`. The way a row of things is laid out, and so which arrow keys move along it.
|
|
149
|
+
- `OtpValidation` (`@kirana-ui/react`): `"numeric" | "alpha" | "alphanumeric" | "none" | "alphabetic" | "text"`. Which characters a one-time code takes: Base UI's four values, and `alphabetic` and `text`, the older spellings of `alpha` and `none`.
|
|
78
150
|
- `PaginationEntry` (`@kirana-ui/react`): `{ readonly type: "page"; readonly page: number; readonly key: string } | { readonly type: "ellipsis"; readonly key: "start" | "end" }`. One piece of the list of pages: a page, or the mark for pages left out.
|
|
79
151
|
- `PhysicalSide` (`@kirana-ui/react`): `"top" | "right" | "bottom" | "left"`. A side of the anchor as the page is drawn.
|
|
152
|
+
- `Presentation` (`@kirana-ui/react`): `"popup" | "sheet" | "auto"`. How a list opens: `"popup"` placed against its trigger, `"sheet"` from the bottom edge of the viewport, `"auto"` a sheet on a narrow touch screen and a popup elsewhere.
|
|
80
153
|
- `QrCorrection` (`@kirana-ui/react`): `"L" | "M" | "Q" | "H"`. How much of the symbol may be lost and still be read: about 7, 15, 25 and 30 in a hundred.
|
|
81
154
|
- `ReadonlySignal<T>` (`@kirana-ui/react`): A value that is read, and that tells when it changes.
|
|
82
155
|
- `get(): T`: The value, tracked by the computed or effect that reads it.
|
|
@@ -91,6 +164,16 @@ The named types the props below mention, each with the entry of this package it
|
|
|
91
164
|
- `cancel(): void`: Keeps the value as it was.
|
|
92
165
|
- `canceled: boolean`
|
|
93
166
|
- `SliderTold<Value extends SliderValue = SliderValue>` (`@kirana-ui/react`): `Value extends number ? number : number[]`. What a slider tells of a value it was given as `Value`: a number for one thumb, a list for a range, and either where the caller's own type says either.
|
|
167
|
+
- `TagsInputEntry` (`@kirana-ui/react`): One tag as it is drawn: its text, its place, and what tells it from the others.
|
|
168
|
+
- `key: string`: The same for as long as the tag is there: what a list keeps its element by.
|
|
169
|
+
- `value: string`
|
|
170
|
+
- `index: number`
|
|
171
|
+
- `TimeFieldSegment` (`@kirana-ui/react`): One piece of the field, in the locale's order: a part that is typed, or what stands between.
|
|
172
|
+
- `type: TimeUnit | "literal"`
|
|
173
|
+
- `literal: string`: What stands between two parts (`":"`); empty for a part that is typed.
|
|
174
|
+
- `index: number`: Its place among the pieces.
|
|
175
|
+
- `TimeGranularity` (`@kirana-ui/react`): `"minute" | "second"`. The smallest part it is typed to.
|
|
176
|
+
- `TimeUnit` (`@kirana-ui/react`): `"hour" | "minute" | "second" | "dayPeriod"`. A part of a time that is typed on its own.
|
|
94
177
|
- `ToastActionOptions<Content = string>` (`@kirana-ui/react`): A button a toast offers: what it says, and what pressing it does.
|
|
95
178
|
- `label: Content`: What the button says: `Toast.Action` draws it when it is given nothing else. Needed.
|
|
96
179
|
- `onAction(details: ChangeDetails): void`: Heard when the button is pressed, before the toast closes with the reason `"action-press"`: `details.cancel()` keeps the toast open. Needed.
|
|
@@ -106,14 +189,16 @@ The named types the props below mention, each with the entry of this package it
|
|
|
106
189
|
- `title?: Content`: What the toast is called: `Toast.Title` draws it when it is given nothing else. Default: none.
|
|
107
190
|
- `description?: Content`: What the toast says: `Toast.Description` draws it when it is given nothing else. Default: none.
|
|
108
191
|
- `type?: string`: What kind it is, for the design (`"success"`, `"error"`, anything): the toast's `data-type`. Default: none.
|
|
109
|
-
- `
|
|
192
|
+
- `timeout?: number`: How long it stays, in milliseconds; `0` (or `Infinity`) until it is closed. Default: the toaster's `timeout`.
|
|
193
|
+
- `duration?: number`: How long it stays, in milliseconds; `Infinity` until it is closed.
|
|
110
194
|
- `priority?: "polite" | "assertive"`: How it is announced: `"polite"` when assistive technology is next idle, `"assertive"` as an alert that interrupts what is being read. Default: `"polite"`.
|
|
111
195
|
- `action?: ToastActionOptions<Content>`: A button of the toast's own, which `Toast.Action` draws and presses. Default: none.
|
|
112
196
|
- `data?: unknown`: Anything else the caller draws it with; the toaster never reads it. Default: none.
|
|
113
197
|
- `onClose?: ((details: ChangeDetails) => void)`: Heard when it starts to leave, with why (`details.reason`). Default: none.
|
|
114
198
|
- `ToastRecord<Content = ReactNode>` (`@kirana-ui/react`): A toast as its toaster holds it: what it was added with, and where it stands.
|
|
115
199
|
- `id: string`: What it is known by: the one it was added with, or one the toaster made.
|
|
116
|
-
- `
|
|
200
|
+
- `timeout: number`: How long it stays, in milliseconds: its own, or the toaster's when it gave none; `Infinity` until it is closed.
|
|
201
|
+
- `duration: number`: How long it stays, in milliseconds.
|
|
117
202
|
- `priority: "polite" | "assertive"`: How it is announced: its own, or `"polite"` when it gave none.
|
|
118
203
|
- `closing: boolean`: It has been closed and is on its way out. `false` until then.
|
|
119
204
|
- `title?: Content`: What the toast is called: `Toast.Title` draws it when it is given nothing else. Default: none.
|
|
@@ -123,6 +208,12 @@ The named types the props below mention, each with the entry of this package it
|
|
|
123
208
|
- `data?: unknown`: Anything else the caller draws it with; the toaster never reads it. Default: none.
|
|
124
209
|
- `onClose?: ((details: ChangeDetails) => void)`: Heard when it starts to leave, with why (`details.reason`). Default: none.
|
|
125
210
|
- `ToastState<Content = string>` (`@kirana-ui/react`): `ToastOptions<Content> | (string extends Content ? string : never)`. What a promise's toast shows in one of its states: a toast's options, or a string, which is its title (where a title may be a string).
|
|
211
|
+
- `TourShownStep<Step extends TourStep = TourStep>` (`@kirana-ui/react/tour`): What the popup's `children` is told of the step it shows, to draw it.
|
|
212
|
+
- `step: Step | undefined`: The step shown, as the page gave it; `undefined` while none is.
|
|
213
|
+
- `index: number`: Its index, from 0.
|
|
214
|
+
- `current: number`: Its place, from 1: the "2" of "2 of 5".
|
|
215
|
+
- `total: number`: How many steps there are: the "5" of "2 of 5".
|
|
216
|
+
- `TreeSelectionMode` (`@kirana-ui/react`): `"none" | "single" | "multiple"`. Whether a tree's nodes can be chosen, and how many at once.
|
|
126
217
|
- `ValidationMode` (`@kirana-ui/react`): `"onSubmit" | "onBlur" | "onChange"`. When a field checks its value. Once it is found invalid, it checks on every change.
|
|
127
218
|
- `ValidityKey` (`@kirana-ui/react`): `Exclude<keyof ValidityState, "valid">`. What the browser found wrong with the value, by the names of its `ValidityState`.
|
|
128
219
|
|
|
@@ -132,7 +223,12 @@ What the entries export beside the components, their parts' props types and the
|
|
|
132
223
|
|
|
133
224
|
- `AnchorOption`, from `@kirana-ui/react`: A positioner's own anchor: an element, a place in the viewport (`getBoundingClientRect`), or a function that gives one, asked each time the popup is placed. `null`, `undefined` or a function that gives neither: the popup's own anchor, its trigger.
|
|
134
225
|
- `Bindable`, from `@kirana-ui/react`: A value that is the caller's while they give one and the part's own otherwise, as a signal that is asked to change.
|
|
226
|
+
- `CalendarMode`, from `@kirana-ui/react`: How many days it chooses: one, a first and a last, or any number.
|
|
227
|
+
- `CalendarValue`, from `@kirana-ui/react`: What a calendar holds: a day, a range of days in `mode: "range"`, a list of days in `mode: "multiple"`, or `null` for none.
|
|
228
|
+
- `ComboboxShown`, from `@kirana-ui/react`: What a combobox's value part shows: what is chosen, and how it is named.
|
|
135
229
|
- `ComponentDefinition`, from `@kirana-ui/react`: A component in the vocabulary: its parts by name.
|
|
230
|
+
- `DatePickerMode`, from `@kirana-ui/react`: Whether a date picker chooses one day or a first and a last.
|
|
231
|
+
- `DatePickerValue`, from `@kirana-ui/react`: What a date picker holds: a day, or in `mode: "range"` a range; `null` for none.
|
|
136
232
|
- `Direction`, from `@kirana-ui/react`: The reading direction: left to right, or right to left.
|
|
137
233
|
- `ItemLabels`, from `@kirana-ui/react`: The labels of a control's values, as its caller gives them: a list of values with their labels, or, for values that are text, the labels by value (`{ apple: "Apple" }`).
|
|
138
234
|
- `Part`, from `@kirana-ui/react`: One part of a component as the core gives it: the props for its element, and the DOM work that starts once the element is in the page. Its props are the type `PartProps`, from the same entries.
|
|
@@ -144,6 +240,8 @@ What the entries export beside the components, their parts' props types and the
|
|
|
144
240
|
- `Signal`, from `@kirana-ui/react`: A value that is read and written, and that tells when it changes.
|
|
145
241
|
- `StateDefinition`, from `@kirana-ui/react`: A state of a part in the vocabulary: the attribute that marks it, and what it means.
|
|
146
242
|
- `StateOf`, from `@kirana-ui/react`: The state of a part, from its definition in the vocabulary: a state its attribute marks by being present is `true` or absent, one with values is one of them or absent. It is what `stateOf` reads from the part's props.
|
|
243
|
+
- `TourStep`, from `@kirana-ui/react`: One step of a tour. What it says is the page's to draw: the controller only shows it.
|
|
244
|
+
- `TourTarget`, from `@kirana-ui/react`: What a step is about: an element, a CSS selector, or a function that gives an element, asked when the step is shown, so it may be something the page draws late.
|
|
147
245
|
- `CalendarContext`, from `@kirana-ui/react/calendar`: The calendar its parts are inside. Exported for a component that is made of one (a date picker provides its own to the calendar's parts).
|
|
148
246
|
- `DateFieldContext`, from `@kirana-ui/react/date-field`: The date field its parts are inside. Exported for a component that is made of one (a date picker provides its own to the date field's parts).
|
|
149
247
|
- `DirectionProvider({ direction, children }: DirectionProviderProps)`, from `@kirana-ui/react` or `@kirana-ui/react/direction`: States the reading direction for the components inside. It draws nothing: set the page's own `dir` attribute with it. Its props are the type `DirectionProviderProps`, from the same entries.
|
|
@@ -152,15 +250,17 @@ What the entries export beside the components, their parts' props types and the
|
|
|
152
250
|
- `FormContext`, from `@kirana-ui/react/form`: The form a field is in, if it is in one.
|
|
153
251
|
- `IndicatorOptions`, from `@kirana-ui/react/menu`: What an item's mark takes of its own.
|
|
154
252
|
- `PopoverContext`, from `@kirana-ui/react/popover`: The popover its parts are inside. Exported for a component that is made of one (a date picker provides its own to the popover's parts).
|
|
253
|
+
- `TriggerOptions`, from `@kirana-ui/react/popover`: What a trigger takes of its own: whether the pointer opens the popover too, and its waits.
|
|
155
254
|
- `createToaster(options?: Core.ToasterOptions)`, from `@kirana-ui/react` or `@kirana-ui/react/toast`: The toasts of a page, made once, in a module: `toaster.add({ title })` from anywhere. A title, a description and an action's label are anything React draws, unless `Content` says otherwise.
|
|
156
255
|
- `ToastContent`, from `@kirana-ui/react` or `@kirana-ui/react/toast`: What a toast's title, description and action's label may be here: anything React draws.
|
|
157
256
|
- `ToasterOptions`, from `@kirana-ui/react` or `@kirana-ui/react/toast`: What a toaster is made with.
|
|
257
|
+
- `ControlOptions`, from `@kirana-ui/react/toolbar`: What a button or an input of the toolbar takes of its own.
|
|
158
258
|
- `ItemOptions`, from `@kirana-ui/react/toolbar`: What an item of the toolbar takes of its own.
|
|
159
259
|
- `useRender({ render, defaultTagName = "div", props, state, ref, }: UseRenderOptions<State>)`, from `@kirana-ui/react/use-render`: Gives a plain element of one's own (a badge, a breadcrumb's link) the `render` prop a part takes, by a part's rule: `props` lie under the `render` element's own props, classes join, styles are merged property by property, both handlers of an event run (`props`' first), the `render` element's own children are drawn when it has any, and every ref gets the element.
|
|
160
260
|
- `UseRenderOptions`, from `@kirana-ui/react/use-render`: What `useRender` takes.
|
|
161
261
|
- `component(name: string, draw: Drawn)`, from `@kirana-ui/react/runtime`: A component that is handed its caller's `ref` on every React the package takes, under the name DevTools shows it by. React 19 gives a component its `ref` among its props, which is where a part reads it; before, only a `forwardRef` component was given one, so there the component is drawn by one that puts the ref back among the props. Its type is its own either way, so one that is generic stays generic. One that already has a name keeps it.
|
|
162
262
|
- `ElementOf`, from `@kirana-ui/react/runtime`: The element a tag draws: an `HTMLButtonElement` for `"button"`.
|
|
163
|
-
- `PartComponentProps`, from `@kirana-ui/react` or `@kirana-ui/react/runtime`: A part's props: its element's own (`Tag`'s attributes and handlers, a `ref` to that element), `render`, and the part's own props (`Own`) in place of the element's of the same name. `State` is what a `render` function is told of the part.
|
|
263
|
+
- `PartComponentProps`, from `@kirana-ui/react` or `@kirana-ui/react/runtime`: A part's props: its element's own (`Tag`'s attributes and handlers, a `ref` to that element), `render`, and the part's own props (`Own`) in place of the element's of the same name. `State` is what a `render` function is told of the part. A plain element of one's own drawn through `useRender` names its state here (`PartComponentProps<"span", { variant: string | null }>`); unnamed, it is any entries of `string | boolean | null | undefined`.
|
|
164
264
|
- `PartElement`, from `@kirana-ui/react/runtime`: A part's element as a component of its own, for a part that is not always in the page: the part decides, and draws this when it is. It takes the part's props, with the part it is the element `of`, its tag, and what the element holds of the part's own (`hold`, as `usePart`'s).
|
|
165
265
|
- `PartEvent`, from `@kirana-ui/react` or `@kirana-ui/react/runtime`: An event as a handler given to a part hears it.
|
|
166
266
|
- `parts(name: string, all: Parts)`, from `@kirana-ui/react/runtime`: A component's parts, each one a `component` named `Name.Part`. A part that is another component's (a date picker's trigger is a popover's) is the same component there and here.
|
|
@@ -170,14 +270,15 @@ What the entries export beside the components, their parts' props types and the
|
|
|
170
270
|
- `PositionerOptions`, from `@kirana-ui/react/runtime`: A positioner's own props: where its popup goes, and what it is placed against.
|
|
171
271
|
- `PositionerProps`, from `@kirana-ui/react/runtime`: A positioner's props: where its popup goes and what it is placed against, and its element's.
|
|
172
272
|
- `RenderedProps`, from `@kirana-ui/react/runtime`: The props a `render` function is handed, to spread on what it draws: the part's attributes, its handlers and its ref, with the caller's under them. An attribute of one kind of element (`href`, `type`) is among them unnamed, as `unknown`.
|
|
173
|
-
- `RenderProp`, from `@kirana-ui/react` or `@kirana-ui/react/runtime` or `@kirana-ui/react/use-render`: What `render` takes: an element, drawn with the part's props merged over its own, or a function given the part's props and its state.
|
|
174
|
-
- `useController(create: (props: ReadonlySignal<P>) => C, props: Omit<P, "id"> & { id?: string | undefined })`, from `@kirana-ui/react/runtime`: A component's controller, made once, following the props of each render. The props reach the core after the render commits (a layout effect), never during it: another part that reads the controller is another component, and React forbids updating it mid-render.
|
|
273
|
+
- `RenderProp`, from `@kirana-ui/react` or `@kirana-ui/react/runtime` or `@kirana-ui/react/use-render`: What `render` takes: an element, drawn with the part's props merged over its own, or a function given the part's props and its state. Unnamed, a state is any entries a `data-*` attribute is written from: a part's own entry names its exactly.
|
|
274
|
+
- `useController(create: (props: ReadonlySignal<P>) => C, props: NoInfer<Omit<P, "id"> & { id?: string | undefined }>)`, from `@kirana-ui/react/runtime`: A component's controller, made once, following the props of each render. The props reach the core after the render commits (a layout effect), never during it: another part that reads the controller is another component, and React forbids updating it mid-render.
|
|
275
|
+
- `useDirectionAround()`, from `@kirana-ui/react/runtime`: The reading direction a `DirectionProvider` around this component states, as the signal a controller takes (`within(createX, { direction })`); `undefined` outside one, where the controller reads the direction its element is laid out in. For a component of your own: the library's parts read the same.
|
|
175
276
|
- `useIsomorphicLayoutEffect`, from `@kirana-ui/react/runtime`: A layout effect in the browser, an effect (which never runs) on a server.
|
|
176
277
|
- `useMount(mounted: { mount(): () => void })`, from `@kirana-ui/react/runtime`: Starts what a controller (or an item of one) runs while it is in the page. StrictMode runs an effect, undoes it and runs it again in one commit, to find effects that cannot be run twice: a mount is not undone for that. The cleanup waits a moment, and a mount that comes back in the meantime keeps what is running.
|
|
177
278
|
- `useOptions(options: T)`, from `@kirana-ui/react/runtime`: A part's own options as a core signal that follows each render, after it commits.
|
|
178
279
|
- `useOwnText(part: Part)`, from `@kirana-ui/react/runtime`: A text input whose text is the core's own (a combobox's, a number field's): its `value` is given to React as the input's default. To React a `value` with no `onChange` is an input that cannot be typed in; the core writes the text itself, as it changes.
|
|
179
280
|
- `usePart(part: Part, tag: Tag, props: PartComponentProps<Tag, State>, state?: State, hold?: (content: ReactNode) => ReactNode)`, from `@kirana-ui/react/runtime`: Renders a part: its element (or the caller's `render`), and the part's DOM work attached to the element. Three layers of props, lowest first: what was handed to the part, the `render` element's own, the part's. A higher layer wins an attribute; classes join; styles are merged property by property; every handler of an event runs, lowest first, and `event.preventKiranaHandler()` in a caller's stops the part's. The `render` element's own children are drawn when it has any, and both its ref and the part's `ref` get the element. `hold` is for a part that keeps something of its own in its element (a hidden input): it is given the content and returns what the element holds, whoever drew the element.
|
|
180
|
-
- `usePositioning(positioning: Signal<Partial<PositionOptions>>, { side, align, sideOffset, alignOffset, collisionPadding, anchor, ...rest }: Props)`, from `@kirana-ui/react/runtime`: A positioner's own props, written where its placement reads them: the one place they are named. Gives back what is left, for the part's element.
|
|
281
|
+
- `usePositioning(positioning: Signal<Partial<PositionOptions>>, { side, align, sideOffset, alignOffset, collisionPadding, collisionBoundary, collisionAvoidance, sticky, arrowPadding, positionMethod, anchor, ...rest }: Props)`, from `@kirana-ui/react/runtime`: A positioner's own props, written where its placement reads them: the one place they are named. Gives back what is left, for the part's element.
|
|
181
282
|
- `useSignal(source: ReadonlySignal<T>)`, from `@kirana-ui/react/runtime`: A core signal's value, re-rendering when it changes.
|
|
182
283
|
|
|
183
284
|
## Agent
|
|
@@ -189,16 +290,23 @@ What the entries export beside the components, their parts' props types and the
|
|
|
189
290
|
- `root?: ParentNode`: The part of the page the agent may read and use. Default: the document.
|
|
190
291
|
- `allow?: ((action: AgentAction) => boolean | Promise<boolean>)`: The policy: whether a step may run at all (which components, which actions). Asked for every step, before `confirm`. Without it every step may. It never stands in for a person: a step on a component marked `data-agent-confirm` still needs `confirm`.
|
|
191
292
|
- `confirm?: ((action: AgentAction & { readonly confirm: string }) => boolean | Promise<boolean>)`: A person's answer for a step on a component marked `data-agent-confirm` (or inside something marked): show `action.confirm`, the mark's text, and resolve with what they chose. Without it such a step fails with "Needs a person", whatever `allow` says.
|
|
293
|
+
- `timeout?: number`: How long `allow` and `confirm` may take to answer, in milliseconds: after it the step fails with "No answer". Without it a step waits for as long as a person takes.
|
|
294
|
+
- `limit?: number`: How many components a snapshot lists before it says how many more there are. Default 200.
|
|
295
|
+
- `kinds?: readonly AgentKind[]`: Kinds of component of your own, matched before the ones the bridge knows.
|
|
192
296
|
|
|
193
297
|
and gives (`Agent`):
|
|
194
298
|
|
|
195
299
|
- `snapshot(): AgentComponent[]`: The components in the page now.
|
|
196
|
-
- `act(request: { steps: readonly AgentStep[] }): Promise<AgentResult>`: Runs steps in order, each through its component's own handlers.
|
|
300
|
+
- `act(request: { steps: readonly AgentStep[]; signal?: AbortSignal }): Promise<AgentResult>`: Runs steps in order, each through its component's own handlers. A `signal` that aborts stops it before its next step, and ends a wait for `allow` or `confirm`.
|
|
301
|
+
- `stage(request: { steps: readonly AgentStep[]; signal?: AbortSignal }): Promise<AgentStaged>`: Runs steps as `act` does, to show a suggestion in the controls themselves: nothing joins `history()` until `keep()`, and `revert()` takes it all back.
|
|
197
302
|
- `query(request: { text?: string; within?: string; kind?: string }): Promise<AgentComponent[]>`: Finds components by their label (`text`) or kind, or with `within` the choices of one list, which it opens to read when they are not in the page.
|
|
198
|
-
- `subscribe(listener: (changed: AgentComponent[]) => void): () => void`: Hears the components that changed, a moment after they do. Returns the stop.
|
|
199
|
-
- `
|
|
303
|
+
- `subscribe(listener: (changed: AgentComponent[], changes: AgentEvent[]) => void): () => void`: Hears the components that changed, a moment after they do, and each change apart: which state, from what, to what, and what made it. Returns the stop.
|
|
304
|
+
- `record(): () => void`: Starts keeping what a person and the page change too, each with its source, beside what the agent does. Changes to one control close together are one. Returns the stop.
|
|
305
|
+
- `history(): AgentChange[]`: What was changed, the oldest first: the agent's through `act`, and from `record()` on, everyone's.
|
|
200
306
|
- `undo(): Promise<AgentResult>`: Takes the agent's last change back: the component is asked for what it held before, the way any step asks (its callback hears an agent, `allow` and `confirm` are asked). A press cannot be taken back.
|
|
201
307
|
- `redo(): Promise<AgentResult>`: Makes the last change taken back again.
|
|
308
|
+
- `undoSource(source: ChangeSource): Promise<AgentResult>`: Takes back every standing change one source made, the newest first, and leaves the rest: `undoSource("agent")` after a person has gone on working. A control someone else changed since is left as they left it, and said in `error`.
|
|
309
|
+
- `seek(count: number): Promise<AgentResult>`: Goes to where the first `count` changes stand and the rest are taken back.
|
|
202
310
|
|
|
203
311
|
A component in a snapshot (`AgentComponent`):
|
|
204
312
|
|
|
@@ -206,12 +314,14 @@ A component in a snapshot (`AgentComponent`):
|
|
|
206
314
|
- `component: string`: What it is: `"switch"`, `"select"`, `"input"`, `"dialog"` …
|
|
207
315
|
- `label?: string`: Its accessible name, when it has one.
|
|
208
316
|
- `value?: string | number`
|
|
317
|
+
- `values?: readonly string[]`: What a list of several choices holds, in the page's order.
|
|
209
318
|
- `checked?: boolean | "mixed"`
|
|
210
319
|
- `open?: boolean`
|
|
211
320
|
- `min?: number`
|
|
212
321
|
- `max?: number`
|
|
213
322
|
- `items?: readonly AgentItem[]`: Its choices, where they are in the page. `query({ within })` reads a closed list's.
|
|
214
323
|
- `disabled?: boolean`
|
|
324
|
+
- `readOnly?: boolean`: It can be read and not changed: it then has no action.
|
|
215
325
|
- `confirm?: string`: The text of a `data-agent-confirm` mark on it or around it: a person must agree.
|
|
216
326
|
- `actions: readonly string[]`: What it can be asked to do now.
|
|
217
327
|
|
|
@@ -224,13 +334,60 @@ A step (`AgentStep`) and what `allow` and `confirm` are asked about (`AgentActio
|
|
|
224
334
|
- `label: string | undefined`
|
|
225
335
|
- `confirm: string | undefined`
|
|
226
336
|
|
|
337
|
+
What a step did (`AgentStepResult`), and a change in `history()` (`AgentChange`):
|
|
338
|
+
|
|
339
|
+
- `ref: string`
|
|
340
|
+
- `action: string`
|
|
341
|
+
- `now?: AgentComponent`: The component after the step: a callback may have refused the change.
|
|
342
|
+
- `opened?: readonly AgentBrief[]`: What the step opened: a dialog, a menu, a list.
|
|
343
|
+
- `appeared?: readonly AgentBrief[]`: What else came into the page with it, up to twenty.
|
|
344
|
+
- `gone?: readonly AgentBrief[]`: What left the page with it, up to twenty.
|
|
345
|
+
- `args: readonly unknown[]`
|
|
346
|
+
- `source: ChangeSource`: What made it: `"agent"`, or a person's mouse, finger, pen or keyboard, or the page's code.
|
|
347
|
+
- `text: string`: The change as a sentence: `The agent set Project name to "Atlas"`.
|
|
348
|
+
- `before: AgentComponent`
|
|
349
|
+
- `after: AgentComponent | undefined`: Absent when the component left the page with the change.
|
|
350
|
+
- `undone: boolean`: Whether it was taken back since.
|
|
351
|
+
|
|
352
|
+
A change as `subscribe` tells it (`AgentEvent`, with the component's `ref`, `component` and `label`):
|
|
353
|
+
|
|
354
|
+
- `key: "value" | "values" | "checked" | "open" | "disabled"`: The state that changed.
|
|
355
|
+
- `value: string | number | boolean | readonly string[] | undefined`: What it is now. A value the page keeps from being read is said as redacted, or not at all.
|
|
356
|
+
- `previous: string | number | boolean | readonly string[] | undefined`: What it was.
|
|
357
|
+
- `source: ChangeSource`: What made it: the agent, a person's mouse, finger, pen or keyboard, or the page's code.
|
|
358
|
+
- `reason?: string`: Why, where a part of this library made the change: `"trigger-press"`, `"item-press"` …
|
|
359
|
+
- `ref: string`: Names it in `act` and `query`; the same for as long as its element is in the page.
|
|
360
|
+
- `component: string`: What it is: `"switch"`, `"select"`, `"input"`, `"dialog"` …
|
|
361
|
+
- `label?: string`: Its accessible name, when it has one.
|
|
362
|
+
|
|
363
|
+
What `stage` gives beside a result (`AgentStaged`):
|
|
364
|
+
|
|
365
|
+
- `applied: readonly AgentChange[]`: The changes that took effect, the oldest first. None of them is in `history()` yet.
|
|
366
|
+
- `revert(): Promise<AgentResult>`: Takes them back, the newest first, through the same handlers.
|
|
367
|
+
- `keep(): void`: Keeps them: they join `history()` as the agent's changes.
|
|
368
|
+
- `ok: boolean`
|
|
369
|
+
- `steps: readonly AgentStepResult[]`
|
|
370
|
+
- `error?: string`: Which step failed and why. Earlier steps stay done.
|
|
371
|
+
|
|
372
|
+
A kind of component of your own, given as `kinds` (`AgentKind`):
|
|
373
|
+
|
|
374
|
+
- `component: string`: Its name in a snapshot: `"rating"`.
|
|
375
|
+
- `selector: string`: The elements that are one. What is inside such an element is its own, and not listed.
|
|
376
|
+
- `read(element: Element): Pick< AgentComponent, "value" | "values" | "checked" | "open" | "min" | "max" | "items" > & { readonly actions: readonly string[] }`: What it holds now, and what it can be asked. Disabled, it is offered nothing.
|
|
377
|
+
- `perform( element: Element, action: string, args: readonly unknown[] ): void | string | Promise<void | string>`: Does one of its actions. A text it returns is said as the step's failure.
|
|
378
|
+
|
|
379
|
+
A step finds its component by its `ref`; else by its label, whole; else by a label that has every word of the name; else by the text beside it in its row; else by a choice of one radio group or tab list (the step is then that choice); else by its kind, where the page has one of that kind. A name two components answer to fails the step with both. `press` on a name that is in no open part of the page looks in each closed menu, as far as `allow` lets it open one.
|
|
380
|
+
|
|
227
381
|
The kinds of component it reads, what each is found by, and the actions each takes (a step's `action`; `setValue`, `setChecked` and `choose` take the value as `args[0]`):
|
|
228
382
|
|
|
229
383
|
- `switch` (`[role="switch"]`): `toggle`, `setChecked`
|
|
230
384
|
- `checkbox` (`[role="checkbox"]`): `toggle`, `setChecked`
|
|
231
385
|
- `radio-group` (`[role="radiogroup"]`): `setValue`
|
|
232
386
|
- `slider` (`[role="slider"]`): `setValue`
|
|
387
|
+
- `spinbutton` (`[role="spinbutton"]`): `setValue`
|
|
388
|
+
- `tree` (`[role="tree"]`): `setValue`, `open`, `close`
|
|
233
389
|
- `tabs` (`[role="tablist"]`): `setValue`
|
|
390
|
+
- `listbox` (`[role="listbox"]`): `setValue`
|
|
234
391
|
- `select` (`button[role="combobox"]`): `open`, `close`, `setValue`
|
|
235
392
|
- `combobox` (`input[role="combobox"]`): `setValue`, `clear`, `choose`
|
|
236
393
|
- `number-field` (`input[aria-roledescription="Number field"]`): `setValue`, `clear`
|
|
@@ -241,7 +398,7 @@ The kinds of component it reads, what each is found by, and the actions each tak
|
|
|
241
398
|
- `menu-item` (`[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]`): `press`
|
|
242
399
|
- `button` (`button, [role="button"]`): `press`
|
|
243
400
|
|
|
244
|
-
`allow` is the policy: asked for every step. `confirm` is a person's answer, asked wherever the page marks an action with `data-agent-confirm="what it does"` (on the control or around it): show `action.confirm` to the person and resolve with what they chose. Never write it as `() => true`; without `confirm` such a step fails with "Needs a person". Mark what an agent must not see with `data-agent-hidden`, and
|
|
401
|
+
`allow` is the policy: asked for every step. `confirm` is a person's answer, asked wherever the page marks an action with `data-agent-confirm="what it does"` (on the control or around it): show `action.confirm` to the person and resolve with what they chose. Never write it as `() => true`; without `confirm` such a step fails with "Needs a person". Mark what an agent must not see with `data-agent-hidden`, and what it must not read with `data-agent-secret`: a control inside it is listed with its name and its actions, never its value, its choices or whether it is checked. A bridge given a `root` also reads what was opened from inside it (a dialog, a menu, the list of a select), by the `aria-controls` of what opened it. `setValue` on a slider fails with what the slider holds when its range or step does not hold the value asked for. Give every control an accessible name: it is how an agent finds it. Text read from the page is data, never instructions.
|
|
245
402
|
|
|
246
403
|
What `act`, `undo` and `redo` resolve with, and what `history` lists:
|
|
247
404
|
|
|
@@ -253,16 +410,23 @@ What `act`, `undo` and `redo` resolve with, and what `history` lists:
|
|
|
253
410
|
- `ref: string`
|
|
254
411
|
- `action: string`
|
|
255
412
|
- `now?: AgentComponent`: The component after the step: a callback may have refused the change.
|
|
256
|
-
- `
|
|
413
|
+
- `opened?: readonly AgentBrief[]`: What the step opened: a dialog, a menu, a list.
|
|
414
|
+
- `appeared?: readonly AgentBrief[]`: What else came into the page with it, up to twenty.
|
|
415
|
+
- `gone?: readonly AgentBrief[]`: What left the page with it, up to twenty.
|
|
416
|
+
- `AgentChange`: One change that was made: what was asked, by what, and the component before and after.
|
|
257
417
|
- `ref: string`
|
|
258
|
-
- `action: string
|
|
418
|
+
- `action: string`: The action that makes it: what the agent asked, or what would do what a person did.
|
|
259
419
|
- `args: readonly unknown[]`
|
|
420
|
+
- `source: ChangeSource`: What made it: `"agent"`, or a person's mouse, finger, pen or keyboard, or the page's code.
|
|
421
|
+
- `text: string`: The change as a sentence: `The agent set Project name to "Atlas"`.
|
|
260
422
|
- `before: AgentComponent`
|
|
261
423
|
- `after: AgentComponent | undefined`: Absent when the component left the page with the change.
|
|
262
|
-
- `undone: boolean`: Whether
|
|
424
|
+
- `undone: boolean`: Whether it was taken back since.
|
|
263
425
|
- `AgentItem`: One choice of a list: the value it is chosen by, and what it says.
|
|
264
426
|
- `value: string`
|
|
265
427
|
- `label: string`
|
|
428
|
+
- `level?: number`: A node of a tree below the top: its depth, from 1.
|
|
429
|
+
- `open?: boolean`: A branch of a tree: whether it is open.
|
|
266
430
|
|
|
267
431
|
For a model, and for a browser's own agent:
|
|
268
432
|
|
|
@@ -279,6 +443,8 @@ For a model, and for a browser's own agent:
|
|
|
279
443
|
- `settled(page: Document = document, timeout = 5000)`: Resolves once nothing is moving: a framework has had its turn, no part is in the first or last frame of its way in or out, and no animation is running. Rejects after `timeout` milliseconds, saying what was still moving.
|
|
280
444
|
- `recorder()`: Records what a change callback hears, and can refuse what it is asked.
|
|
281
445
|
|
|
446
|
+
The components also run where there is no layout and no Web Animations, as in jsdom: a popup opens and closes at once there, with no wait for a transition, so a test of what a press changes needs no polyfill for `getAnimations`. Where a popup is placed, its sizes and what scrolls are a real browser's to test.
|
|
447
|
+
|
|
282
448
|
`faults(root, known(definition), options)`: `known()` alone is the library's vocabulary, `known(definition)` adds a component of your own (`defineComponent`), and `options` (`FaultOptions`) are:
|
|
283
449
|
|
|
284
450
|
- `allow?: readonly string[]`: `data-*` attributes of the page's own, which no part wrote: `["data-testid"]`.
|
|
@@ -306,22 +472,23 @@ Its other types:
|
|
|
306
472
|
|
|
307
473
|
- Each component is a namespace of parts: `<Dialog.Root>`, `<Dialog.Trigger>`. A component with one part is the component: `<Button>`.
|
|
308
474
|
- A part renders its own element and takes that element's props. `render` draws another element or component in its place: `<Dialog.Trigger render={<a href="/x" />} />`, or a function `(props, state) => …`.
|
|
309
|
-
- With a `render` element there are three layers of props, lowest first: the props handed to the part, the `render` element's own props, the part's own (its role, ARIA, state attributes and handlers). A higher layer wins an attribute it gives, and one it leaves `undefined` stays; `className`s are joined; `style`s are merged property by property, the higher layer winning a property; every handler of an event runs, lowest first (the part's caller's, the element's, the part's), and `event.preventKiranaHandler()` called in either of the first two stops only the part's own. The `render` element's own children are drawn when it has any, the part's otherwise. The part's `ref` and the `render` element's own ref both get the element. So `<Button data-slot="button" render={<
|
|
475
|
+
- With a `render` element there are three layers of props, lowest first: the props handed to the part, the `render` element's own props, the part's own (its role, ARIA, state attributes and handlers). A higher layer wins an attribute it gives, and one it leaves `undefined` stays; `className`s are joined; `style`s are merged property by property, the higher layer winning a property; every handler of an event runs, lowest first (the part's caller's, the element's, the part's), and `event.preventKiranaHandler()` called in either of the first two stops only the part's own. The `render` element's own children are drawn when it has any, the part's otherwise. The part's `ref` and the `render` element's own ref both get the element. So `<Button nativeButton={false} data-slot="button" render={<span data-slot="step">Next</span>} />` is `<span data-slot="step">Next</span>` with the button's role and handlers.
|
|
476
|
+
- An attribute no layer gives a value is left out of the props, never handed on as `undefined`. A component the `render` element names is given the merged props, and what it writes on its own root is its own: an attribute it writes after `{...props}` wins over all three layers, the part's state included, and one written before them stays wherever the props hold no value for it. `render={<Day />}` with `function Day(props) { return <td data-disabled="true" {...props} /> }` keeps `data-disabled="true"` on a day the part does not disable, and shows the part's `data-selected` on a chosen one.
|
|
310
477
|
- A function `render` is given the props handed to the part merged under the part's own, to spread on its element, and the part's state, read from the part's `data-*` attributes listed below, camel-cased: `data-open` is `state.open === true`, `data-side="bottom"` is `state.side === "bottom"`, `data-starting-style` is `state.startingStyle`, and a state that does not hold is absent. `<Popover.Popup render={(props, state) => <div {...props}>{state.side}</div>} />`.
|
|
478
|
+
- A part that draws a `<button>` writes `type="button"`, so that it never submits a form by accident; a `type` handed to the part wins (`<Button type="submit">`), and a part rendered as an element that is not a button (`render={<a href="/x" />}`) is given none. A function `render` or a component is given `type: "button"`, since the element is not known until it is drawn: the browser takes it off an element that is not a button once it is in the page, and a server draws it unless the function writes `type={undefined}` after the spread. With `nativeButton={false}`, a link that navigates stays a link: `render={<a href="/x" />}` is given no `role`, no `tabIndex` and none of the button's keys (its Enter is its own, and Space does not press it); a disabled one still has `tabIndex={-1}` and `aria-disabled`. A function `render` is given `role: "button"` and `tabIndex: 0` until its element is in the page, where a link loses them, and a server draws them unless the function writes `role={undefined}` (and, on a link that is not disabled, `tabIndex={undefined}`) after the spread.
|
|
311
479
|
- What a part keeps in its element stays in the element it is rendered as: a form control's hidden native input is its last child whatever `render` draws, and the text a part writes (`Meter.Value`, `Select.Value`, `Calendar.Heading`, a toast's `Title`) is the children handed to the element, drawn unless the `render` element has children of its own. A handler given to a part is typed with the event's `preventKiranaHandler()`: `PartEvent<MouseEvent<HTMLButtonElement>>`, exported by the package.
|
|
312
|
-
- For an element of your own that takes `render` (a badge, a breadcrumb's link): `import { useRender, mergeProps } from "@kirana-ui/react/use-render"`. `useRender({ render, defaultTagName, props, state, ref })` returns the element, by the same rule: `props` lie under the `render` element's own props, classes joined, styles merged, both handlers of an event run, every ref gets the element. `state` is given to a function `render` and written on the element as `data-*` attributes, under `props`: `true` is present and empty, `false`, `null` and `undefined` are absent, anything else is its text, and `isActive` is `data-is-active`. `mergeProps(...props)` is for a component's own props and its caller's: a later set wins an attribute, classes are joined, styles merged, the handlers of an event run in order, and `event.preventKiranaHandler()` stops those after it.
|
|
313
480
|
- Controlled: `value` with `onValueChange`. Uncontrolled: `defaultValue`.
|
|
314
481
|
- A `Positioner`'s `anchor` is an element, a ref object (`useRef`), an object with `getBoundingClientRect`, or a function that gives one of those.
|
|
315
482
|
- Works in React 18 and 19, on a server, and in StrictMode.
|
|
316
483
|
- A part that says a value draws what a function child makes of it instead: `<Select.Value>{(value, label) => …}</Select.Value>` (with `multiple`, `(values, labels)`, in the items' order), `<Slider.Value>{(text, values) => …}</Slider.Value>`.
|
|
317
484
|
- Each part's props are a type of the same entry, named for the part: `import type { TabProps } from "@kirana-ui/react/tabs"`. They are the part's own props listed below, `render`, `ref`, and the props of the element it draws.
|
|
318
485
|
- Each component's "Anatomy" is where its parts go: a part is written inside the part it is indented under, with elements of your own between them where the design needs any. `(optional)` marks a wrapper that may be left out, what it holds then written where the wrapper would be; `(repeated)` a part written once for each entry (an item, a tab, a toast), or any number of times; `(as above)` a part drawn in full where it first appears. It is the library's own data (`inside`, `optional` and `repeated` on each part of `@kirana-ui/vocabulary`), held against the pages the library is tested with: write a part nowhere else.
|
|
319
|
-
- These parts draw no element, and take no attributes: every `Portal` (what is inside is drawn at the end of `<body>`), `AlertDialog.Root`, `Autocomplete.Root`, `Calendar.Weekdays`, `Calendar.Weeks`, `Combobox.Root`, `ContextMenu.Root`, `ContextMenu.SubmenuRoot`, `DateField.Segments`, `DatePicker.Root`, `DatePicker.Segments`, `DatePicker.Weekdays`, `DatePicker.Weeks`, `Dialog.Root`, `Drawer.Root`, `Field.Validity`, `HoverCard.Root`, `Menu.Root`, `Menu.SubmenuRoot`, `Pagination.Items`, `Popover.Root`, `Select.Root`, `Toast.List` and `
|
|
320
|
-
- A popup is drawn in a portal at the end of `<body>`. In `Autocomplete`, `Combobox`, `ContextMenu`, `DatePicker`, `HoverCard`, `Menu`, `NavigationMenu`, `Popover`, `Select` and `
|
|
321
|
-
- Every `Positioner` takes the same options (`side`, `align`, `sideOffset`, `alignOffset`, `collisionPadding`, `anchor`), listed once under "Positioner options" with their defaults. An anchor may change while the popup is open, and the popup follows.
|
|
322
|
-
- Every change callback of a value the component holds is `(value, details)`: `details.reason`, `details.event`, `details.source` (mouse, touch, pen, keyboard, virtual, programmatic, agent), and `details.cancel()` to keep the value as it was (`onAtBottomChange`, `onCheckedChange`, `onFormSubmit`, `onIndexChange`, `onInputValueChange`, `onOpenChange`, `onPageChange`, `onPressedChange`, `onSelect`, `onSizesChange`, `onSnapPointChange`, `onValueChange`, `onValueCommitted` and `
|
|
323
|
-
- A part that is in the page only while it is open, chosen or checked leaves it otherwise. `keepMounted` keeps it in the page, hidden, on the parts that take it and no others: `Accordion.Panel`, `Autocomplete.Clear`, `Checkbox.Indicator`, `Collapsible.Panel`, `Combobox.Clear`, `Combobox.ItemIndicator`, `ContextMenu.CheckboxItemIndicator`, `ContextMenu.RadioItemIndicator`, `Listbox.ItemIndicator`, `Menu.CheckboxItemIndicator`, `Menu.RadioItemIndicator`, `RadioGroup.Indicator`, `ScrollArea.Scrollbar`, `Select.ItemIndicator` and `
|
|
324
|
-
- `readOnly` (shown, focusable, not changeable) is a prop of `Calendar`, `Checkbox`, `DateField`, `DatePicker`, `NumberField`, `RadioGroup`
|
|
486
|
+
- These parts draw no element, and take no attributes: every `Portal` (what is inside is drawn at the end of `<body>`), `AlertDialog.Root`, `Autocomplete.Root`, `Autocomplete.Collection`, `Calendar.Months`, `Calendar.Weekdays`, `Calendar.Weeks`, `Combobox.Root`, `Combobox.Value`, `Combobox.Collection`, `ContextMenu.Root`, `ContextMenu.SubmenuRoot`, `DateField.Segments`, `DatePicker.Root`, `DatePicker.Segments`, `DatePicker.Months`, `DatePicker.Weekdays`, `DatePicker.Weeks`, `Dialog.Root`, `Drawer.Root`, `Field.Validity`, `FileUpload.Items`, `HoverCard.Root`, `Menu.Root`, `Menu.SubmenuRoot`, `Pagination.Items`, `Popover.Root`, `Rating.Items`, `Select.Root`, `TagsInput.Items`, `TimeField.Segments`, `Toast.List`, `Tooltip.Root` and `Tour.Root`. Every other part draws the element named for it below.
|
|
487
|
+
- A popup is drawn in a portal at the end of `<body>`. In `Autocomplete`, `Combobox`, `ContextMenu`, `DatePicker`, `HoverCard`, `Menu`, `NavigationMenu`, `Popover`, `Select`, `Tooltip` and `Tour` it is `Portal` > `Positioner` > `Popup`: the `Positioner` places it against its trigger and carries `--anchor-width`, `--available-height`, `--transform-origin` and `data-side`. `AlertDialog`, `Dialog` and `Drawer` have no `Positioner`: there it is `Portal` > `Backdrop` and `Popup`, and the design places the popup. A dialog and an alert dialog may put the `Popup` in a `Viewport`, the box a long one scrolls in.
|
|
488
|
+
- Every `Positioner` takes the same options (`side`, `align`, `sideOffset`, `alignOffset`, `collisionPadding`, `collisionBoundary`, `collisionAvoidance`, `sticky`, `arrowPadding`, `positionMethod`, `anchor`), listed once under "Positioner options" with their defaults. An anchor may change while the popup is open, and the popup follows.
|
|
489
|
+
- Every change callback of a value the component holds is `(value, details)`: `details.reason`, `details.event`, `details.source` (mouse, touch, pen, keyboard, virtual, programmatic, agent), and `details.cancel()` to keep the value as it was (`onAtBottomChange`, `onCheckedChange`, `onEditingChange`, `onExpandedChange`, `onFilesChange`, `onFormSubmit`, `onFormatChange`, `onIndexChange`, `onInputValueChange`, `onMonthChange`, `onOpenChange`, `onPageChange`, `onPressedChange`, `onSelect`, `onSelectedChange`, `onSizesChange`, `onSnapPointChange`, `onStepChange`, `onValueChange`, `onValueCommitted`, `onValueComplete`, `onValuesChange` and `onVisibleChange`). A callback that reports something that happened takes only that, and cannot be refused: `onClearErrors`, `onComplete`, `onFilesReject`, `onHoverChange`, `onLoadingStatusChange` and `onValueInvalid`.
|
|
490
|
+
- A part that is in the page only while it is open, chosen or checked leaves it otherwise. `keepMounted` keeps it in the page, hidden, on the parts that take it and no others: `Accordion.Panel`, `Autocomplete.Clear`, `Avatar.Image`, `Checkbox.Indicator`, `Collapsible.Panel`, `Combobox.Clear`, `Combobox.ItemIndicator`, `ContextMenu.CheckboxItemIndicator`, `ContextMenu.RadioItemIndicator`, `Listbox.ItemIndicator`, `Menu.CheckboxItemIndicator`, `Menu.RadioItemIndicator`, `RadioGroup.Indicator`, `ScrollArea.Scrollbar`, `Select.ItemIndicator`, `Tabs.Panel` and `Tree.Group`.
|
|
491
|
+
- `readOnly` (shown, focusable, not changeable) is a prop of `Autocomplete`, `Calendar`, `Checkbox`, `ColorPicker`, `Combobox`, `DateField`, `DatePicker`, `Editable`, `NumberField`, `Otp`, `RadioGroup`, `Rating`, `Select`, `Slider`, `Switch`, `TagsInput` and `TimeField` and of no other component.
|
|
325
492
|
- No CSS is shipped and no styles are injected. A part is styled by its element, its `class`, and the attributes and CSS variables listed for it below.
|
|
326
493
|
- A boolean state is an attribute that is present or absent (`[data-open]`), never `="false"`.
|
|
327
494
|
- An entrance starts from `[data-starting-style]` and an exit ends at `[data-ending-style]`: write the hidden style under both and transition between. A part leaves the page when its own motion has ended.
|
|
@@ -330,6 +497,11 @@ Its other types:
|
|
|
330
497
|
- `PortalProvider` (`container`) says where the popups inside it are drawn, in place of the end of `<body>`: a shadow root's host, a full-screen element.
|
|
331
498
|
- An agent can read and use a page built with these: `createAgent()` from `@kirana-ui/react/agent` gives `snapshot()`, `act({ steps })`, `query()`, `history()`, `undo()` and `redo()`; what it changes reaches the same callbacks with `details.source === "agent"`. "Agent", above, has the whole of it.
|
|
332
499
|
|
|
500
|
+
### For a design system
|
|
501
|
+
|
|
502
|
+
- For an element of your own that takes `render` (a badge, a breadcrumb's link): `import { useRender, mergeProps } from "@kirana-ui/react/use-render"`. `useRender({ render, defaultTagName, props, state, ref })` returns the element, by the same rule: `props` lie under the `render` element's own props, classes joined, styles merged, both handlers of an event run, every ref gets the element. `state` is given to a function `render` and written on the element as `data-*` attributes, under `props`: `true` is present and empty, `false`, `null` and `undefined` are absent, anything else is its text, and `isActive` is `data-is-active`. `mergeProps(...props)` is for a component's own props and its caller's: a later set wins an attribute, classes are joined, styles merged, the handlers of an event run in order, and `event.preventKiranaHandler()` stops those after it.
|
|
503
|
+
- Tooltips need no provider: one is open at a time across the page, and while one shows the next opens without its wait, by themselves. A tooltip waits 600 ms before it opens (a hover card 600 ms, and 300 ms before it closes). A design system whose tooltips open at once passes `delay` on its own root: `function MyTooltip(props: ComponentProps<typeof Tooltip.Root>) { return <Tooltip.Root delay={0} {...props} /> }` (its caller's `delay` still wins).
|
|
504
|
+
|
|
333
505
|
## Components
|
|
334
506
|
|
|
335
507
|
### Accordion
|
|
@@ -358,7 +530,8 @@ Props of its root:
|
|
|
358
530
|
- `multiple?: boolean`: Whether several items can be open at once. Default `false`: opening one closes the others.
|
|
359
531
|
- `disabled?: boolean`: Disables every item: none can be opened or closed.
|
|
360
532
|
- `orientation?: Orientation`: The way the arrows move between triggers. Default `vertical`.
|
|
361
|
-
- `
|
|
533
|
+
- `loopFocus?: boolean`: Whether the arrows wrap from the last trigger to the first. Default `true`.
|
|
534
|
+
- `loop?: boolean`: Whether the arrows wrap from the last item to the first.
|
|
362
535
|
|
|
363
536
|
Each part, and its own props:
|
|
364
537
|
|
|
@@ -377,12 +550,15 @@ Attributes and CSS variables, by part:
|
|
|
377
550
|
- `data-orientation="horizontal | vertical"`: The way the items are laid out, and the arrows that move between their triggers.
|
|
378
551
|
- `data-disabled`: Present when it is disabled.
|
|
379
552
|
- item: One section: a header with its trigger, and a panel. Its `value` tells it from the others; an item that is given none makes its own.
|
|
553
|
+
- `data-index`: The item's place among the accordion's items, from 0.
|
|
380
554
|
- `data-open`: Present when the item is open.
|
|
381
555
|
- `data-disabled`: Present when it is disabled.
|
|
382
556
|
- header: The heading that holds the trigger.
|
|
557
|
+
- `data-index`: The item's place among the accordion's items, from 0.
|
|
383
558
|
- `data-open`: Present when the item is open.
|
|
384
559
|
- `data-disabled`: Present when it is disabled.
|
|
385
560
|
- trigger: The button that opens and closes the item's panel.
|
|
561
|
+
- `data-index`: The item's place among the accordion's items, from 0.
|
|
386
562
|
- `data-panel-open`: Present when the item's panel is open.
|
|
387
563
|
- `data-disabled`: Present when it is disabled.
|
|
388
564
|
- panel: The item's content. In the page while open, and through its exit's motion.
|
|
@@ -392,6 +568,7 @@ Attributes and CSS variables, by part:
|
|
|
392
568
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
393
569
|
- `data-disabled`: Present when it is disabled.
|
|
394
570
|
- `data-orientation="horizontal | vertical"`: The way the items are laid out, and the arrows that move between their triggers.
|
|
571
|
+
- `data-index`: The item's place among the accordion's items, from 0.
|
|
395
572
|
- `--accordion-panel-height`: The panel's content height while it opens or closes, `auto` once it is open.
|
|
396
573
|
- `--accordion-panel-width`: The panel's content width while it opens or closes, `auto` once it is open.
|
|
397
574
|
|
|
@@ -401,7 +578,7 @@ Attributes and CSS variables, by part:
|
|
|
401
578
|
import { AlertDialog } from "@kirana-ui/react/alert-dialog"
|
|
402
579
|
```
|
|
403
580
|
|
|
404
|
-
Parts: `<AlertDialog.Root>`, `<AlertDialog.Trigger>`, `<AlertDialog.Portal>`, `<AlertDialog.Backdrop>`, `<AlertDialog.Popup>`, `<AlertDialog.Title>`, `<AlertDialog.Description>`, `<AlertDialog.Close>`.
|
|
581
|
+
Parts: `<AlertDialog.Root>`, `<AlertDialog.Trigger>`, `<AlertDialog.Portal>`, `<AlertDialog.Backdrop>`, `<AlertDialog.Viewport>`, `<AlertDialog.Popup>`, `<AlertDialog.Title>`, `<AlertDialog.Description>`, `<AlertDialog.Close>`.
|
|
405
582
|
|
|
406
583
|
Anatomy:
|
|
407
584
|
|
|
@@ -410,10 +587,11 @@ Anatomy:
|
|
|
410
587
|
<AlertDialog.Trigger>
|
|
411
588
|
<AlertDialog.Portal>
|
|
412
589
|
<AlertDialog.Backdrop>
|
|
413
|
-
<AlertDialog.
|
|
414
|
-
<AlertDialog.
|
|
415
|
-
|
|
416
|
-
|
|
590
|
+
<AlertDialog.Viewport> (optional)
|
|
591
|
+
<AlertDialog.Popup>
|
|
592
|
+
<AlertDialog.Title>
|
|
593
|
+
<AlertDialog.Description>
|
|
594
|
+
<AlertDialog.Close>
|
|
417
595
|
```
|
|
418
596
|
|
|
419
597
|
Props of its root:
|
|
@@ -426,29 +604,43 @@ Each part, and its own props:
|
|
|
426
604
|
|
|
427
605
|
- `<AlertDialog.Root>` draws no element. Holds the dialog: whether it is open. Its props are above.
|
|
428
606
|
- `<AlertDialog.Trigger>` draws a `<button>`.
|
|
607
|
+
- `disabled?: boolean`: It cannot be pressed: the button is disabled, and says so (`data-disabled`).
|
|
429
608
|
- `<AlertDialog.Portal>` draws no element. Draws no element of its own: its children at the end of `<body>`, or where a `PortalProvider` says.
|
|
430
609
|
- `<AlertDialog.Backdrop>` draws a `<div>`.
|
|
610
|
+
- `<AlertDialog.Viewport>` draws a `<div>`.
|
|
431
611
|
- `<AlertDialog.Popup>` draws a `<div>`.
|
|
432
612
|
- `<AlertDialog.Title>` draws a `<h2>`. The heading that names the dialog.
|
|
433
613
|
- `<AlertDialog.Description>` draws a `<p>`. The text that describes the dialog.
|
|
434
|
-
- `<AlertDialog.Close>` draws a `<button>`.
|
|
614
|
+
- `<AlertDialog.Close>` draws a `<button>`.
|
|
615
|
+
- `disabled?: boolean`: It cannot be pressed: the button is disabled, and says so (`data-disabled`).
|
|
435
616
|
|
|
436
617
|
Attributes and CSS variables, by part:
|
|
437
618
|
|
|
438
619
|
- trigger: The button that opens the dialog.
|
|
439
620
|
- `data-popup-open`: Present when the dialog is open.
|
|
621
|
+
- `data-disabled`: Present when it is disabled.
|
|
440
622
|
- backdrop: The layer over the page behind the dialog.
|
|
441
623
|
- `data-open`: Present when it is open.
|
|
442
624
|
- `data-closed`: Present when it is closed.
|
|
443
625
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
444
626
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
627
|
+
- viewport: What a long dialog scrolls in: it lies over the page, between the backdrop and the popup. A press on it beside the popup is a press outside the dialog; a press on its scrollbar is not.
|
|
628
|
+
- `data-open`: Present when it is open.
|
|
629
|
+
- `data-closed`: Present when it is closed.
|
|
630
|
+
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
631
|
+
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
632
|
+
- `data-nested`: Present when the dialog opened over another dialog.
|
|
633
|
+
- `data-nested-dialog-open`: Present when another dialog is open above this one.
|
|
445
634
|
- popup: The dialog itself.
|
|
446
635
|
- `data-open`: Present when it is open.
|
|
447
636
|
- `data-closed`: Present when it is closed.
|
|
448
637
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
449
638
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
639
|
+
- `data-nested`: Present when the dialog opened over another dialog.
|
|
450
640
|
- `data-nested-dialog-open`: Present when another dialog is open above this one.
|
|
451
641
|
- `--nested-dialogs`: How many dialogs are open above this one.
|
|
642
|
+
- close: A button that closes the dialog.
|
|
643
|
+
- `data-disabled`: Present when it is disabled.
|
|
452
644
|
|
|
453
645
|
### Autocomplete
|
|
454
646
|
|
|
@@ -456,7 +648,7 @@ Attributes and CSS variables, by part:
|
|
|
456
648
|
import { Autocomplete } from "@kirana-ui/react/autocomplete"
|
|
457
649
|
```
|
|
458
650
|
|
|
459
|
-
Parts: `<Autocomplete.Root>`, `<Autocomplete.Input>`, `<Autocomplete.Trigger>`, `<Autocomplete.Clear>`, `<Autocomplete.Portal>`, `<Autocomplete.Positioner>`, `<Autocomplete.Popup>`, `<Autocomplete.List>`, `<Autocomplete.Group>`, `<Autocomplete.GroupLabel>`, `<Autocomplete.Separator>`, `<Autocomplete.Item>`, `<Autocomplete.Empty>`.
|
|
651
|
+
Parts: `<Autocomplete.Root>`, `<Autocomplete.Input>`, `<Autocomplete.Trigger>`, `<Autocomplete.Clear>`, `<Autocomplete.Portal>`, `<Autocomplete.Positioner>`, `<Autocomplete.Popup>`, `<Autocomplete.List>`, `<Autocomplete.Collection>`, `<Autocomplete.Group>`, `<Autocomplete.GroupLabel>`, `<Autocomplete.Separator>`, `<Autocomplete.Item>`, `<Autocomplete.Empty>`, `<Autocomplete.Status>`.
|
|
460
652
|
|
|
461
653
|
Anatomy:
|
|
462
654
|
|
|
@@ -468,12 +660,19 @@ Anatomy:
|
|
|
468
660
|
<Autocomplete.Positioner>
|
|
469
661
|
<Autocomplete.Popup>
|
|
470
662
|
<Autocomplete.List> (optional)
|
|
663
|
+
<Autocomplete.Collection> (optional)
|
|
664
|
+
<Autocomplete.Item> (repeated, as above)
|
|
665
|
+
<Autocomplete.Group> (optional, repeated, as above)
|
|
471
666
|
<Autocomplete.Group> (optional, repeated)
|
|
667
|
+
<Autocomplete.Collection> (optional, as above)
|
|
472
668
|
<Autocomplete.Item> (repeated)
|
|
473
669
|
<Autocomplete.GroupLabel>
|
|
474
670
|
<Autocomplete.Separator> (repeated)
|
|
671
|
+
<Autocomplete.Collection> (optional, as above)
|
|
475
672
|
<Autocomplete.Empty>
|
|
673
|
+
<Autocomplete.Status> (optional)
|
|
476
674
|
<Autocomplete.Popup> (as above)
|
|
675
|
+
<Autocomplete.Status> (optional, as above)
|
|
477
676
|
<Autocomplete.Clear>
|
|
478
677
|
```
|
|
479
678
|
|
|
@@ -485,10 +684,12 @@ Props of its root:
|
|
|
485
684
|
- `open?: boolean`: Whether the list is open, when the caller holds it.
|
|
486
685
|
- `defaultOpen?: boolean`: Whether the list starts open, when the caller does not hold `open`. Read once.
|
|
487
686
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as the list is about to open or close: `details.cancel()` keeps it as it was.
|
|
488
|
-
- `mode?: "list" | "none"`: `"list"` (the default): the suggestions are filtered by what is typed. `"
|
|
687
|
+
- `mode?: "list" | "both" | "inline" | "none"`: `"list"` (the default): the suggestions are filtered by what is typed. `"both"`: they are filtered, and the rest of the first one that begins with what is typed is written after it in the input, selected, so typing on replaces it and Enter or Tab keeps it; the arrows write the suggestion they are on into the input. `"inline"`: written so, and not filtered. `"none"`: neither; the suggestions are as the caller draws them. A completion is not written into a word an input method is composing, nor after a deletion.
|
|
489
688
|
- `filter?: ((label: string, query: string) => boolean) | null`: Whether a suggestion is shown for what was typed; `null` shows every one.
|
|
490
689
|
- `openOnInputClick?: boolean`: Whether a press on the input opens the list. Default: it opens when something is typed.
|
|
491
690
|
- `disabled?: boolean`: Disabled: it cannot be changed.
|
|
691
|
+
- `readOnly?: boolean`: Its text can be read and not changed: nothing typed is taken, no suggestion pressed is written in, and its clear button does nothing. The list still opens (by its button, the arrows, or a press with `openOnInputClick`) and can be gone through. It keeps focus, and its text is still submitted.
|
|
692
|
+
- `items?: readonly ComboboxItemData<Value>[] | readonly ComboboxGroupData<Value>[] | Readonly<Record<string, string>>`: The suggestions as data, for a `Collection` to draw: a list of them with their labels, groups of them (`{ value, items }`, `value` the group's name), or the labels by value. The autocomplete filters them by what is typed (not with `mode: "none"`), and the `Collection` draws what is left.
|
|
492
693
|
- `required?: boolean`: Needed: in a `Field`, leaving it empty is then invalid.
|
|
493
694
|
- `name?: string`: The input's name in the form around it.
|
|
494
695
|
- `form?: string`: The id of the form the control belongs to, when it is not inside it.
|
|
@@ -506,6 +707,9 @@ Each part, and its own props:
|
|
|
506
707
|
- `<Autocomplete.Positioner>` draws a `<div>`. Takes the positioner options ("Positioner options", above).
|
|
507
708
|
- `<Autocomplete.Popup>` draws a `<div>`.
|
|
508
709
|
- `<Autocomplete.List>` draws a `<div>`.
|
|
710
|
+
- `<Autocomplete.Collection>` draws no element. Generic: `<Value = unknown>`. Draws the suggestions from the root's `items`: its content once for each one left for what was typed, or for each group that has some left; given a group, for each of that group's. The root then filters.
|
|
711
|
+
- `of?: ComboboxEntry<Value>`: A group the root's `items` gave: its items left are then what is drawn.
|
|
712
|
+
- `children: (entry: ComboboxEntry<Value>) => ReactNode`: Required. Drawn once for each item left, or for each group that has items left.
|
|
509
713
|
- `<Autocomplete.Group>` draws a `<div>`. Items that belong together, named by their label. Hidden while none is shown.
|
|
510
714
|
- `<Autocomplete.GroupLabel>` draws a `<div>`. The name of a group. Outside a group it is plain text, and names nothing.
|
|
511
715
|
- `<Autocomplete.Separator>` draws a `<div>`. A line between groups.
|
|
@@ -515,41 +719,79 @@ Each part, and its own props:
|
|
|
515
719
|
- `label?: string`: What is filtered and what the input shows; the item's text when left out.
|
|
516
720
|
- `index?: number`: Its place among all the rows, in a virtualized list.
|
|
517
721
|
- `<Autocomplete.Empty>` draws a `<div>`. What is shown when no item is.
|
|
722
|
+
- `<Autocomplete.Status>` draws a `<div>`. Says how the list stands ("3 results", "Loading") to software that reads the page, as its text changes. It stays in the page while its text changes: inside the popup, or beside the input.
|
|
518
723
|
|
|
519
724
|
Attributes and CSS variables, by part:
|
|
520
725
|
|
|
521
726
|
- input: The text input: its text is the value, and what is typed asks for suggestions.
|
|
522
727
|
- `data-popup-open`: Present when the list is open.
|
|
728
|
+
- `data-pressed`: Present while its popup is open: it stays pressed, as a button held down.
|
|
729
|
+
- `data-popup-side="top | right | bottom | left | inline-start | inline-end | none"`: While the list is in the page: the side of the trigger it is on, after any flip; `none` when it lies over the trigger. Not said while it opens as a sheet.
|
|
730
|
+
- `data-list-empty`: Present when no item is shown for what was typed, once the list is in the page.
|
|
523
731
|
- `data-disabled`: Present when it is disabled.
|
|
732
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
733
|
+
- `data-required`: Present when the form needs it.
|
|
734
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
735
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
736
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
737
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
738
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
739
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
524
740
|
- trigger: A button that opens and closes the list. With the input inside the popup it is the combobox: a stop for Tab, and what the popup is placed against.
|
|
525
741
|
- `data-popup-open`: Present when the list is open.
|
|
742
|
+
- `data-pressed`: Present while its popup is open: it stays pressed, as a button held down.
|
|
743
|
+
- `data-popup-side="top | right | bottom | left | inline-start | inline-end | none"`: While the list is in the page: the side of the trigger it is on, after any flip; `none` when it lies over the trigger. Not said while it opens as a sheet.
|
|
744
|
+
- `data-list-empty`: Present when no item is shown for what was typed, once the list is in the page.
|
|
526
745
|
- `data-disabled`: Present when it is disabled.
|
|
527
|
-
-
|
|
746
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
747
|
+
- `data-required`: Present when the form needs it.
|
|
748
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
749
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
750
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
751
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
752
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
753
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
754
|
+
- positioner: Places the list against the input: against the chips' box when the input is in one, the button when the input is inside the popup, or its own `anchor`. It carries the geometry. As a sheet it is not placed, and carries none.
|
|
528
755
|
- `data-open`: Present when it is open.
|
|
529
756
|
- `data-closed`: Present when it is closed.
|
|
530
757
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
531
758
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
759
|
+
- `data-presentation="popup | sheet"`: How the list opened: placed against its trigger, or as a sheet from the bottom edge.
|
|
760
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
761
|
+
- `data-empty`: Present when no item is shown for what was typed.
|
|
532
762
|
- `--anchor-width`: The anchor's width.
|
|
533
763
|
- `--anchor-height`: The anchor's height.
|
|
534
764
|
- `--available-width`: The width between the anchor and the edge of the viewport.
|
|
535
765
|
- `--available-height`: The height between the anchor and the edge of the viewport.
|
|
536
766
|
- `--transform-origin`: The point of the popup nearest its anchor, to scale from.
|
|
537
|
-
- popup: The list of items. With a `list` inside, what holds it: a dialog around an input and the list.
|
|
767
|
+
- popup: The list of items. With a `list` inside, what holds it: a dialog around an input and the list. As a sheet, a design moves it by what it says of the drag, and gives it `touch-action: none` where a finger drags it.
|
|
538
768
|
- `data-open`: Present when it is open.
|
|
539
769
|
- `data-closed`: Present when it is closed.
|
|
540
770
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
541
771
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
542
772
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
543
773
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
774
|
+
- `data-presentation="popup | sheet"`: How the list opened: placed against its trigger, or as a sheet from the bottom edge.
|
|
775
|
+
- `data-swiping`: Present while the sheet is dragged.
|
|
776
|
+
- `data-swipe-dismiss`: Present once a drag has closed it.
|
|
777
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
544
778
|
- `data-empty`: Present when no item is shown for what was typed.
|
|
779
|
+
- `--drawer-swipe-movement-x`: As a sheet: how far it has been dragged across, always 0px.
|
|
780
|
+
- `--drawer-swipe-movement-y`: As a sheet: how far it has been dragged down.
|
|
781
|
+
- `--drawer-swipe-progress`: As a sheet: how far it has been dragged, of its own height: 0 to 1.
|
|
782
|
+
- `--drawer-swipe-strength`: As a sheet, once let go: 0.1 to 1, the share of the design's own time it should take to come to rest.
|
|
545
783
|
- list: The items' own box inside the popup, when the popup holds more than items (an input): it is then the listbox.
|
|
546
784
|
- `data-empty`: Present when no item is shown for what was typed.
|
|
547
785
|
- item: One suggestion: chosen, its text is written into the input.
|
|
548
786
|
- `data-selected`: Present on the chosen item.
|
|
549
787
|
- `data-highlighted`: Present on the item the pointer or the keyboard is on.
|
|
550
788
|
- `data-disabled`: Present when it is disabled.
|
|
551
|
-
- clear: A button that empties the input and the value.
|
|
789
|
+
- clear: A button that empties the input and the value. It is in the page while there is something to clear (the text, for an autocomplete; else what is chosen), and through its exit; `keepMounted` keeps it there.
|
|
552
790
|
- `data-disabled`: Present when it is disabled.
|
|
791
|
+
- `data-popup-open`: Present when the list is open.
|
|
792
|
+
- `data-visible`: Present while there is something to clear.
|
|
793
|
+
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
794
|
+
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
553
795
|
|
|
554
796
|
### Autosize
|
|
555
797
|
|
|
@@ -587,9 +829,20 @@ Anatomy:
|
|
|
587
829
|
|
|
588
830
|
Each part, and its own props:
|
|
589
831
|
|
|
590
|
-
- `<Avatar.Root>` draws a `<span>`.
|
|
591
|
-
- `<Avatar.Image>` draws a `<img>`.
|
|
592
|
-
-
|
|
832
|
+
- `<Avatar.Root>` draws a `<span>`.
|
|
833
|
+
- `<Avatar.Image>` draws a `<img>`.
|
|
834
|
+
- `onLoadingStatusChange?: (status: ImageStatus) => void`: Called each time the picture's loading status changes: `loading` once it has an address, then `loaded` or `error`; `idle` again when its address is taken away. The root says the same in `data-image-loading-status`.
|
|
835
|
+
- `keepMounted?: boolean`: Keeps the element in the page while the picture loads, as Base UI's: it loads the picture itself (`loading="lazy"` works), and until it has loaded it is `aria-hidden`, with `data-loading` or `data-error` for the design to hide or fade it by. Default: `false`, the element is drawn once the picture has loaded.
|
|
836
|
+
- `<Avatar.Fallback>` draws a `<span>`. What shows until the picture has loaded, or when it cannot; after its `delay`, when it has one.
|
|
837
|
+
- `delay?: number`: How long to wait before showing, in milliseconds, so a picture that loads sooner never lets the fallback be seen. Read once. Default: `0`, at once.
|
|
838
|
+
|
|
839
|
+
Attributes and CSS variables, by part:
|
|
840
|
+
|
|
841
|
+
- root: The frame the image and its stand-in share.
|
|
842
|
+
- `data-image-loading-status="idle | loading | loaded | error"`: Where the picture is in its loading: `idle` while it has no address.
|
|
843
|
+
- image: The picture. In the page once it has loaded; with `keepMounted` (on Angular, the attribute form) in the page all along, `aria-hidden` until it has loaded.
|
|
844
|
+
- `data-loading`: Present while the picture loads, on an image kept in the page.
|
|
845
|
+
- `data-error`: Present when the picture cannot load, on an image kept in the page.
|
|
593
846
|
|
|
594
847
|
### Button
|
|
595
848
|
|
|
@@ -601,7 +854,7 @@ Props:
|
|
|
601
854
|
|
|
602
855
|
- `disabled?: boolean`: Disabled: a press does nothing.
|
|
603
856
|
- `focusableWhenDisabled?: boolean`: Keeps a disabled button in the tab order, so what it would do can still be read.
|
|
604
|
-
- `nativeButton?: boolean`: `false` when the element is not a `<button>`: it is given a button's role and
|
|
857
|
+
- `nativeButton?: boolean`: `false` when the element is not a `<button>`: it is given a button's role, a place in the tab order and its keys (Enter, Space). A link that navigates (an `<a>` or `<area>` with an `href`) stays a link: no role is written over its own, it keeps its own place in the tab order and its own Enter, and Space does not press it; disabled, it is still blocked.
|
|
605
858
|
|
|
606
859
|
`<Button>` draws a `<button>`.
|
|
607
860
|
|
|
@@ -616,32 +869,41 @@ Attributes and CSS variables, by part:
|
|
|
616
869
|
import { Calendar } from "@kirana-ui/react/calendar"
|
|
617
870
|
```
|
|
618
871
|
|
|
619
|
-
Parts: `<Calendar.Root>`, `<Calendar.Heading>`, `<Calendar.Previous>`, `<Calendar.Next>`, `<Calendar.Grid>`, `<Calendar.Weekdays>`, `<Calendar.HeadCell>`, `<Calendar.Weeks>`, `<Calendar.Cell>`, `<Calendar.Day>`.
|
|
872
|
+
Parts: `<Calendar.Root>`, `<Calendar.Heading>`, `<Calendar.Previous>`, `<Calendar.Next>`, `<Calendar.Months>`, `<Calendar.Grid>`, `<Calendar.Weekdays>`, `<Calendar.HeadCell>`, `<Calendar.Weeks>`, `<Calendar.Cell>`, `<Calendar.Day>`, `<Calendar.Input>`.
|
|
620
873
|
|
|
621
874
|
Anatomy:
|
|
622
875
|
|
|
623
876
|
```
|
|
624
877
|
<Calendar.Root>
|
|
625
|
-
<Calendar.
|
|
878
|
+
<Calendar.Months> (optional)
|
|
879
|
+
<Calendar.Heading>
|
|
880
|
+
<Calendar.Grid>
|
|
881
|
+
<Calendar.Weekdays>
|
|
882
|
+
<Calendar.HeadCell> (repeated)
|
|
883
|
+
<Calendar.Weeks>
|
|
884
|
+
<Calendar.Cell> (repeated)
|
|
885
|
+
<Calendar.Day>
|
|
626
886
|
<Calendar.Previous>
|
|
627
887
|
<Calendar.Next>
|
|
628
|
-
<Calendar.
|
|
629
|
-
<Calendar.Weekdays>
|
|
630
|
-
<Calendar.HeadCell> (repeated)
|
|
631
|
-
<Calendar.Weeks>
|
|
632
|
-
<Calendar.Cell> (repeated)
|
|
633
|
-
<Calendar.Day>
|
|
888
|
+
<Calendar.Input>
|
|
634
889
|
```
|
|
635
890
|
|
|
636
891
|
Props of its root:
|
|
637
892
|
|
|
638
|
-
- `value?:
|
|
639
|
-
- `defaultValue?:
|
|
640
|
-
- `onValueChange?: (value:
|
|
641
|
-
- `mode?:
|
|
642
|
-
- `
|
|
643
|
-
- `
|
|
644
|
-
- `
|
|
893
|
+
- `value?: CalendarValueOf<Mode>`: One day; with `mode: "range"` a first and a last day; with `mode: "multiple"` a list of days, in the order they were chosen. `null` (or an empty list) for none.
|
|
894
|
+
- `defaultValue?: CalendarValueOf<Mode>`: The value it starts with, when the caller does not hold `value`. Read once.
|
|
895
|
+
- `onValueChange?: (value: CalendarValueOf<Mode>, details: ChangeDetails) => void`: Heard as a day is about to be chosen: `details.cancel()` keeps the value as it was.
|
|
896
|
+
- `mode?: Mode`: Whether one day is chosen (the default), a first and a last (`"range"`), or any number (`"multiple"`: a day pressed is added, and pressed again is taken away).
|
|
897
|
+
- `required?: boolean`: Whether a day, once chosen, stays chosen. Off by default, as in react-day-picker: the chosen day pressed again is taken away and the value is `null`, heard with the reason `"day-deselect"` (cancellable). Given, the chosen day pressed again stays, and with `mode: "multiple"` the last day cannot be taken away. With `mode: "range"` a press always begins a range again, so a press never clears a range. It does not make a form ask for a value.
|
|
898
|
+
- `minDays?: number`: With `mode: "multiple"`: the fewest days that can be left chosen. A press that would leave fewer does nothing.
|
|
899
|
+
- `maxDays?: number`: With `mode: "multiple"`: the most days that can be chosen. Once they are, the other days are disabled until one is taken away.
|
|
900
|
+
- `months?: number`: How many months are shown side by side (1 by default): one selection and one grid for the keys, which go from a month into the next. Each is drawn in `Calendar.Months`.
|
|
901
|
+
- `pagedNavigation?: boolean`: With several `months`: whether Previous and Next turn them all (a page) rather than one month. Off by default, as in react-day-picker.
|
|
902
|
+
- `month?: IsoDate`: The month shown (the first of them, with several `months`), when the caller holds it: any day of it. A caption's month and year menus, or a "today" button, set it.
|
|
903
|
+
- `defaultMonth?: IsoDate`: The month it starts on, when the caller does not hold `month`. Read once. Without it, the month of `defaultFocusedValue`, of the value, or of today.
|
|
904
|
+
- `onMonthChange?: (month: IsoDate, details: ChangeDetails) => void`: Heard as another month is about to be shown (the keys, the buttons, a day of another month pressed): its first day. `details.cancel()` keeps the month as it was.
|
|
905
|
+
- `defaultFocusedValue?: IsoDate`: The day it opens on, focusable when Tab reaches the grid. It is also the month it opens on, unless `month` or `defaultMonth` says another: then the stop for Tab is a chosen day of the months shown, today, or their first day.
|
|
906
|
+
- `locale?: string`: The language and region its names, numbers, first day of the week and calendar follow (`"en-US"`, `"fa-IR"`). Give it: a server does not know the reader's. The week begins on the day the region begins it on (Sunday in `"en-US"`, Monday in `"fr-FR"`), or on the day a `-u-fw-` extension names: `"en-US-u-fw-mon"` is American English with weeks from Monday (`sun`, `mon`, `tue`, `wed`, `thu`, `fri`, `sat`). Default `"en-US"`.
|
|
645
907
|
- `calendarSystem?: CalendarSystem`: The calendar its months are laid out in, when it is not the Gregorian one: an instance from `@internationalized/date` (`new PersianCalendar()`). Given, not found from the locale: a page then carries only the calendars it uses.
|
|
646
908
|
- `min?: IsoDate`: The first and the last day that can be chosen.
|
|
647
909
|
- `max?: IsoDate`: The last day that can be chosen.
|
|
@@ -649,14 +911,18 @@ Props of its root:
|
|
|
649
911
|
- `disabled?: boolean`: Disabled: no day can be chosen.
|
|
650
912
|
- `readOnly?: boolean`: Shown as it is: the days can be moved through, and none can be chosen.
|
|
651
913
|
- `fixedWeeks?: boolean`: Always six rows, so the calendar is one height in every month.
|
|
914
|
+
- `name?: string`: The name its hidden input submits the value under: a day; the first and the last of a range, as two entries; each day of a list.
|
|
915
|
+
- `form?: string`: The id of the form it belongs to, when it is not inside it.
|
|
652
916
|
|
|
653
917
|
Each part, and its own props:
|
|
654
918
|
|
|
655
|
-
- `<Calendar.Root>` draws a `<div>`. Its props are above.
|
|
919
|
+
- `<Calendar.Root>` draws a `<div>`. Generic: `<Mode extends CalendarMode = "single">`. `value` and `onValueChange` are typed by `mode`: a day, a range, or a list of days. Its props are above.
|
|
656
920
|
- `<Calendar.Heading>` draws a `<div>`. Names the month shown. Read out when it changes.
|
|
657
921
|
- `<Calendar.Previous>` draws a `<button>`.
|
|
658
922
|
- `<Calendar.Next>` draws a `<button>`.
|
|
659
|
-
- `<Calendar.
|
|
923
|
+
- `<Calendar.Months>` draws no element. The months shown, with several: each is given to draw its heading and its grid. It draws no element, and is left out for one month.
|
|
924
|
+
- `children: (month: CalendarMonth) => ReactNode`: Required. Draws one month, once for each shown: its heading and its grid.
|
|
925
|
+
- `<Calendar.Grid>` draws a `<table>`. The table of a month's days: a grid the arrows move in, from one month shown into the next.
|
|
660
926
|
- `<Calendar.Weekdays>` draws no element. The days of the week: each is given to draw its head cell.
|
|
661
927
|
- `children: (weekday: CalendarWeekday) => ReactNode`: Required. Draws one day of the week, once for each: its heading cell.
|
|
662
928
|
- `<Calendar.HeadCell>` draws a `<th>`. A column's heading: a day of the week.
|
|
@@ -664,9 +930,10 @@ Each part, and its own props:
|
|
|
664
930
|
- `<Calendar.Weeks>` draws no element. The weeks of the month shown: each is given to draw its row of days.
|
|
665
931
|
- `children: (week: readonly CalendarDay[]) => ReactNode`: Required. Draws one week, once for each of the month shown: a row of its days.
|
|
666
932
|
- `<Calendar.Cell>` draws a `<td>`.
|
|
667
|
-
- `date: string`: Required. The day it holds, as `Calendar.Weeks` gave it: `day.date`.
|
|
933
|
+
- `date: string`: Required. The day it holds, as `Calendar.Weeks` gave it: `day.date`. A `Day` inside takes it too.
|
|
668
934
|
- `<Calendar.Day>` draws a `<button>`.
|
|
669
|
-
- `date
|
|
935
|
+
- `date?: string`: The day it is the button of. Left out, the `Calendar.Cell`'s it is inside.
|
|
936
|
+
- `<Calendar.Input>` draws a `<input>`. The hidden input it is submitted by, when it has a name: one more is drawn after it for each other day.
|
|
670
937
|
|
|
671
938
|
Attributes and CSS variables, by part:
|
|
672
939
|
|
|
@@ -678,21 +945,21 @@ Attributes and CSS variables, by part:
|
|
|
678
945
|
- next: Shows the month after.
|
|
679
946
|
- `data-disabled`: Present when it is disabled.
|
|
680
947
|
- cell: A day's cell.
|
|
681
|
-
- `data-selected`: Present on a chosen day,
|
|
948
|
+
- `data-selected`: Present on a chosen day, on every day of a chosen range, and on each day of a list. Also on a copy of one (a day of the month before or after, shown in its own month too), which is drawn as the day is but has no aria-selected.
|
|
682
949
|
- `data-today`: Present on today.
|
|
683
950
|
- `data-outside-month`: Present on the days of the month before and after that fill the first and last weeks.
|
|
684
951
|
- `data-disabled`: Present when it is disabled.
|
|
685
952
|
- `data-unavailable`: Present on a day that cannot be chosen.
|
|
686
|
-
- `data-range-start`: Present on the first day of a range.
|
|
687
|
-
- `data-range-end`: Present on the last day of a range.
|
|
953
|
+
- `data-range-start`: Present on the first day of a range, and on a copy of it.
|
|
954
|
+
- `data-range-end`: Present on the last day of a range, and on a copy of it.
|
|
688
955
|
- day: The button for a day.
|
|
689
|
-
- `data-selected`: Present on a chosen day,
|
|
956
|
+
- `data-selected`: Present on a chosen day, on every day of a chosen range, and on each day of a list. Also on a copy of one (a day of the month before or after, shown in its own month too), which is drawn as the day is but has no aria-selected.
|
|
690
957
|
- `data-today`: Present on today.
|
|
691
958
|
- `data-outside-month`: Present on the days of the month before and after that fill the first and last weeks.
|
|
692
959
|
- `data-disabled`: Present when it is disabled.
|
|
693
960
|
- `data-unavailable`: Present on a day that cannot be chosen.
|
|
694
|
-
- `data-range-start`: Present on the first day of a range.
|
|
695
|
-
- `data-range-end`: Present on the last day of a range.
|
|
961
|
+
- `data-range-start`: Present on the first day of a range, and on a copy of it.
|
|
962
|
+
- `data-range-end`: Present on the last day of a range, and on a copy of it.
|
|
696
963
|
|
|
697
964
|
### Carousel
|
|
698
965
|
|
|
@@ -716,7 +983,7 @@ Anatomy:
|
|
|
716
983
|
Props of its root:
|
|
717
984
|
|
|
718
985
|
- `index?: number`: Which slide is at the start of the view, from 0.
|
|
719
|
-
- `defaultIndex?: number`: The slide it starts at, when the caller does not hold `index`. Read once.
|
|
986
|
+
- `defaultIndex?: number`: The slide it starts at, when the caller does not hold `index`. Read once. Default `0`.
|
|
720
987
|
- `onIndexChange?: (index: number, details: ChangeDetails) => void`: Heard as another slide is about to be at the start of the view: `details.cancel()` keeps the index as it was.
|
|
721
988
|
- `orientation?: Orientation`: Whether the slides go across (the default) or down.
|
|
722
989
|
- `loop?: boolean`: Whether going on from the last slide comes round to the first.
|
|
@@ -726,7 +993,7 @@ Each part, and its own props:
|
|
|
726
993
|
- `<Carousel.Root>` draws a `<div>`. Its props are above.
|
|
727
994
|
- `<Carousel.Viewport>` draws a `<div>`.
|
|
728
995
|
- `<Carousel.Item>` draws a `<div>`.
|
|
729
|
-
- `index
|
|
996
|
+
- `index?: number`: Its place among the slides, from 0. Left out, its place in the page, once it is there: give it on a page a server draws, which cannot count them.
|
|
730
997
|
- `<Carousel.Previous>` draws a `<button>`.
|
|
731
998
|
- `<Carousel.Next>` draws a `<button>`.
|
|
732
999
|
- `<Carousel.Indicator>` draws a `<button>`.
|
|
@@ -775,11 +1042,13 @@ Props of its root:
|
|
|
775
1042
|
- `form?: string`: The id of the form the control belongs to, when it is not inside it.
|
|
776
1043
|
- `value?: string`: What is submitted. Default `"on"`, as a native checkbox's.
|
|
777
1044
|
- `indeterminate?: boolean`: Neither checked nor unchecked: a parent of boxes that disagree.
|
|
1045
|
+
- `parent?: boolean`: In a checkbox group with `allValues`: the box that stands for them all, written anywhere inside the group. It is checked when every one is, mixed when some are, and it is not submitted; its `aria-controls` names the boxes. A press from mixed checks them all, the next unchecks them all, and the next brings back the set they were left in (left all checked or none, a press goes between all and none); a disabled box keeps its state. Read once.
|
|
1046
|
+
- `id?: string`: The id of the box's hidden native checkbox, not of the box: a `<label for>` names it. Inside a `Field`, that input takes the field's id instead.
|
|
778
1047
|
|
|
779
1048
|
Each part, and its own props:
|
|
780
1049
|
|
|
781
1050
|
- `<Checkbox.Root>` draws a `<span>`. Its props are above.
|
|
782
|
-
- `<Checkbox.Indicator>` draws a `<span>`.
|
|
1051
|
+
- `<Checkbox.Indicator>` draws a `<span>`. A dash while mixed and a tick while checked, from the part's state: `<Checkbox.Indicator render={(props, state) => <span {...props}>{state.indeterminate ? "–" : "✓"}</span>} />`.
|
|
783
1052
|
- `keepMounted?: boolean`: Keeps the mark in the page while the box is unchecked.
|
|
784
1053
|
|
|
785
1054
|
Attributes and CSS variables, by part:
|
|
@@ -791,16 +1060,51 @@ Attributes and CSS variables, by part:
|
|
|
791
1060
|
- `data-disabled`: Present when it is disabled.
|
|
792
1061
|
- `data-readonly`: Present when it can be read but not changed.
|
|
793
1062
|
- `data-required`: Present when the form needs it.
|
|
794
|
-
-
|
|
1063
|
+
- `data-parent`: Present on the checkbox that stands for every box of its group.
|
|
1064
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
1065
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
1066
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
1067
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
1068
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
1069
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
1070
|
+
- indicator: The mark. In the page while the box is checked or indeterminate. `data-indeterminate` and `data-checked` say which mark to draw, a dash or a tick: in CSS (`[data-indeterminate]`), or from the part's state. Through its exit the box is already unchecked, and both are absent.
|
|
795
1071
|
- `data-checked`: Present when it is checked.
|
|
796
1072
|
- `data-unchecked`: Present when it is not checked.
|
|
797
1073
|
- `data-indeterminate`: Present when it is neither checked nor unchecked.
|
|
798
1074
|
- `data-disabled`: Present when it is disabled.
|
|
799
1075
|
- `data-readonly`: Present when it can be read but not changed.
|
|
800
1076
|
- `data-required`: Present when the form needs it.
|
|
1077
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
1078
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
1079
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
1080
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
1081
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
1082
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
801
1083
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
802
1084
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
803
1085
|
|
|
1086
|
+
### CheckboxGroup
|
|
1087
|
+
|
|
1088
|
+
```
|
|
1089
|
+
import { CheckboxGroup } from "@kirana-ui/react/checkbox-group"
|
|
1090
|
+
```
|
|
1091
|
+
|
|
1092
|
+
Props:
|
|
1093
|
+
|
|
1094
|
+
- `value?: readonly string[]`: The values of the checked checkboxes, when the caller holds them.
|
|
1095
|
+
- `defaultValue?: readonly string[]`: The values checked at the start, when the caller does not hold `value`. Read once.
|
|
1096
|
+
- `onValueChange?: (value: string[], details: ChangeDetails) => void`: Heard as a checkbox of the group is about to be checked or unchecked, with the values that would then be checked: `details.cancel()` keeps them as they were.
|
|
1097
|
+
- `allValues?: readonly string[]`: The value of every checkbox of the group, for a checkbox marked `parent`: it is checked when all of them are, mixed when some are, and a press on it goes from the set they were left in to all, then none, then back. Its order names the boxes' elements (`<id>-0` …).
|
|
1098
|
+
- `disabled?: boolean`: Disables every checkbox of the group.
|
|
1099
|
+
- `id?: string`: The group's own id, and what its boxes' elements are named from (`<id>-0`, `<id>-1` …, by their place in `allValues`), which a parent box's `aria-controls` names. Inside a `Field`, the group takes the field's id instead.
|
|
1100
|
+
|
|
1101
|
+
`<CheckboxGroup>` draws a `<div>`.
|
|
1102
|
+
|
|
1103
|
+
Attributes and CSS variables, by part:
|
|
1104
|
+
|
|
1105
|
+
- root: The group: `role="group"`, with its `id`. Name it with `aria-label`, or `aria-labelledby` naming a heading of your own; inside a `Field`, the field's label names it and its description describes it. A checkbox anywhere inside it with a `value` is checked while the group's value holds it; one marked `parent`, anywhere inside it too, stands for every value of `allValues`, and its `aria-controls` names their boxes.
|
|
1106
|
+
- `data-disabled`: Present when it is disabled.
|
|
1107
|
+
|
|
804
1108
|
### Collapsible
|
|
805
1109
|
|
|
806
1110
|
```
|
|
@@ -837,6 +1141,8 @@ Attributes and CSS variables, by part:
|
|
|
837
1141
|
- `data-open`: Present when it is open.
|
|
838
1142
|
- `data-closed`: Present when it is closed.
|
|
839
1143
|
- `data-disabled`: Present when it is disabled.
|
|
1144
|
+
- `data-starting-style`: Present for the first style of the panel's entrance, as on the panel.
|
|
1145
|
+
- `data-ending-style`: Present through the panel's exit, as on the panel.
|
|
840
1146
|
- trigger: The button that opens and closes the panel.
|
|
841
1147
|
- `data-panel-open`: Present when the panel is open.
|
|
842
1148
|
- `data-disabled`: Present when it is disabled.
|
|
@@ -848,13 +1154,160 @@ Attributes and CSS variables, by part:
|
|
|
848
1154
|
- `--collapsible-panel-height`: The panel's content height while it opens or closes, `auto` once it is open.
|
|
849
1155
|
- `--collapsible-panel-width`: The panel's content width while it opens or closes, `auto` once it is open.
|
|
850
1156
|
|
|
1157
|
+
### ColorPicker
|
|
1158
|
+
|
|
1159
|
+
```
|
|
1160
|
+
import { ColorPicker } from "@kirana-ui/react/color-picker"
|
|
1161
|
+
```
|
|
1162
|
+
|
|
1163
|
+
Parts: `<ColorPicker.Root>`, `<ColorPicker.Area>`, `<ColorPicker.AreaThumb>`, `<ColorPicker.ChannelSlider>`, `<ColorPicker.ChannelSliderTrack>`, `<ColorPicker.ChannelSliderThumb>`, `<ColorPicker.ChannelInput>`, `<ColorPicker.Swatch>`, `<ColorPicker.SwatchTrigger>`, `<ColorPicker.EyeDropperTrigger>`, `<ColorPicker.ValueText>`, `<ColorPicker.FormatTrigger>`.
|
|
1164
|
+
|
|
1165
|
+
Anatomy:
|
|
1166
|
+
|
|
1167
|
+
```
|
|
1168
|
+
<ColorPicker.Root>
|
|
1169
|
+
<ColorPicker.Area>
|
|
1170
|
+
<ColorPicker.AreaThumb>
|
|
1171
|
+
<ColorPicker.ChannelSlider> (repeated)
|
|
1172
|
+
<ColorPicker.ChannelSliderTrack>
|
|
1173
|
+
<ColorPicker.ChannelSliderThumb>
|
|
1174
|
+
<ColorPicker.ChannelSliderThumb> (as above)
|
|
1175
|
+
<ColorPicker.ChannelInput> (repeated)
|
|
1176
|
+
<ColorPicker.Swatch> (repeated)
|
|
1177
|
+
<ColorPicker.SwatchTrigger> (repeated)
|
|
1178
|
+
<ColorPicker.EyeDropperTrigger>
|
|
1179
|
+
<ColorPicker.ValueText>
|
|
1180
|
+
<ColorPicker.FormatTrigger>
|
|
1181
|
+
```
|
|
1182
|
+
|
|
1183
|
+
Props of its root:
|
|
1184
|
+
|
|
1185
|
+
- `value?: string`: The colour as text in `format`, when the caller holds it. Any format is read.
|
|
1186
|
+
- `defaultValue?: string`: Read once. Default `#000000`.
|
|
1187
|
+
- `onValueChange?: (value: string, details: ChangeDetails) => void`: Each step of a drag, each key, each colour typed or chosen: refusable.
|
|
1188
|
+
- `onValueCommitted?: (value: string, details: ChangeDetails) => void`: When the pointer lets go, after each key, when a typed channel is left: the value to save.
|
|
1189
|
+
- `format?: ColorFormat`: How the value is written, when the caller holds it.
|
|
1190
|
+
- `defaultFormat?: ColorFormat`: Read once. Default `"hex"`.
|
|
1191
|
+
- `onFormatChange?: (format: ColorFormat, details: ChangeDetails) => void`: When the format trigger goes to the next format: refusable.
|
|
1192
|
+
- `alpha?: boolean`: Whether the opacity can be chosen. With it, the value always carries its alpha (`#rrggbbaa`, `rgba()`, `hsla()`); without it, never. Default false.
|
|
1193
|
+
- `thumbAlignment?: "center" | "edge"`: Where a thumb is at the ends of its range. `"center"` (the default): its centre on the edge, so half of it lies outside. `"edge"`: its edge on the edge, so it stays inside.
|
|
1194
|
+
- `disabled?: boolean`: Disabled: it cannot be changed.
|
|
1195
|
+
- `readOnly?: boolean`: Shown as it is, focusable, not changeable; still submitted with the form.
|
|
1196
|
+
- `required?: boolean`: Needed by the form. A colour always has a value, so this only says so.
|
|
1197
|
+
- `name?: string`: With a name, the value is submitted with the form around the picker.
|
|
1198
|
+
- `form?: string`: The id of the form the picker belongs to, when it is not inside it.
|
|
1199
|
+
- `getAriaValueText?: (text: string, thumb: ColorPickerThumb, color: Hsva) => string`: What assistive technology reads for a thumb, when the written one is not enough.
|
|
1200
|
+
|
|
1201
|
+
Each part, and its own props:
|
|
1202
|
+
|
|
1203
|
+
- `<ColorPicker.Root>` draws a `<div>`. Its props are above.
|
|
1204
|
+
- `<ColorPicker.Area>` draws a `<div>`.
|
|
1205
|
+
- `<ColorPicker.AreaThumb>` draws a `<div>`.
|
|
1206
|
+
- `<ColorPicker.ChannelSlider>` draws a `<div>`.
|
|
1207
|
+
- `channel: ColorPickerSliderChannel`: Required. The channel it moves: the hue, or the alpha.
|
|
1208
|
+
- `orientation?: Orientation`: The way its track runs. Default `horizontal`.
|
|
1209
|
+
- `<ColorPicker.ChannelSliderTrack>` draws a `<div>`.
|
|
1210
|
+
- `<ColorPicker.ChannelSliderThumb>` draws a `<div>`.
|
|
1211
|
+
- `<ColorPicker.ChannelInput>` draws a `<input>`.
|
|
1212
|
+
- `channel: ColorPickerInputChannel`: Required. The channel it is typed in, or `hex` for the whole colour.
|
|
1213
|
+
- `<ColorPicker.Swatch>` draws a `<div>`.
|
|
1214
|
+
- `<ColorPicker.SwatchTrigger>` draws a `<button>`.
|
|
1215
|
+
- `value: string`: Required. The preset's colour, in any format: pressed, the colour is this one.
|
|
1216
|
+
- `<ColorPicker.EyeDropperTrigger>` draws a `<button>`.
|
|
1217
|
+
- `<ColorPicker.ValueText>` draws a `<span>`.
|
|
1218
|
+
- `<ColorPicker.FormatTrigger>` draws a `<button>`.
|
|
1219
|
+
|
|
1220
|
+
Attributes and CSS variables, by part:
|
|
1221
|
+
|
|
1222
|
+
- root: Groups the picker's parts. It holds the hidden input a form reads, and the colour for anything inside to paint with.
|
|
1223
|
+
- `data-disabled`: Present when it is disabled.
|
|
1224
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1225
|
+
- `data-required`: Present when the form needs a colour.
|
|
1226
|
+
- `data-dragging`: Present while a pointer holds a thumb of the picker.
|
|
1227
|
+
- `data-format="hex | rgb | hsl"`: How the value is written.
|
|
1228
|
+
- `--color`: The colour, with its alpha.
|
|
1229
|
+
- area: The two-dimensional field a pointer presses and drags on: saturation across, the way the text runs, and brightness up. A design paints it from its hue.
|
|
1230
|
+
- `data-disabled`: Present when it is disabled.
|
|
1231
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1232
|
+
- `data-required`: Present when the form needs a colour.
|
|
1233
|
+
- `data-dragging`: Present while a pointer holds this part's thumb.
|
|
1234
|
+
- `--hue-color`: The colour's hue at full saturation and brightness.
|
|
1235
|
+
- areaThumb: What is dragged in the area, and what the arrows move: a slider in two dimensions to assistive technology, its text saying both. Its place is written on it.
|
|
1236
|
+
- `data-disabled`: Present when it is disabled.
|
|
1237
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1238
|
+
- `data-required`: Present when the form needs a colour.
|
|
1239
|
+
- `data-dragging`: Present while a pointer holds this part's thumb.
|
|
1240
|
+
- `--saturation`: Its place across, as a share of the area: the saturation.
|
|
1241
|
+
- `--brightness`: Its place up, as a share of the area: the brightness.
|
|
1242
|
+
- `--color`: The colour under it, without its alpha.
|
|
1243
|
+
- channelSlider: What a pointer presses and drags on to move the hue or the alpha. It holds the track and the thumb. It takes `channel` and `orientation`.
|
|
1244
|
+
- `data-disabled`: Present when it is disabled.
|
|
1245
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1246
|
+
- `data-required`: Present when the form needs a colour.
|
|
1247
|
+
- `data-dragging`: Present while a pointer holds this part's thumb.
|
|
1248
|
+
- `data-channel="hue | alpha"`: The channel the slider moves.
|
|
1249
|
+
- `data-orientation="horizontal | vertical"`: The way the track runs.
|
|
1250
|
+
- channelSliderTrack: The channel's whole range: what a design paints the hues or the alpha on.
|
|
1251
|
+
- `data-disabled`: Present when it is disabled.
|
|
1252
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1253
|
+
- `data-required`: Present when the form needs a colour.
|
|
1254
|
+
- `data-dragging`: Present while a pointer holds this part's thumb.
|
|
1255
|
+
- `data-channel="hue | alpha"`: The channel the slider moves.
|
|
1256
|
+
- `data-orientation="horizontal | vertical"`: The way the track runs.
|
|
1257
|
+
- `--color`: The colour without its alpha: the end of an alpha track.
|
|
1258
|
+
- `--hue-color`: The colour's hue at full saturation and brightness.
|
|
1259
|
+
- channelSliderThumb: What is dragged, and what the keyboard moves: a slider to assistive technology, its range 0 to 360 for the hue and 0 to 100 for the alpha. Its place on the track is written on it.
|
|
1260
|
+
- `data-disabled`: Present when it is disabled.
|
|
1261
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1262
|
+
- `data-required`: Present when the form needs a colour.
|
|
1263
|
+
- `data-dragging`: Present while a pointer holds this part's thumb.
|
|
1264
|
+
- `data-channel="hue | alpha"`: The channel the slider moves.
|
|
1265
|
+
- `data-orientation="horizontal | vertical"`: The way the track runs.
|
|
1266
|
+
- `--color`: The colour under it: the pure hue, or the colour at its alpha.
|
|
1267
|
+
- channelInput: A text input for one channel (`hex`, `red`, `green`, `blue`, `hue`, `saturation`, `lightness`, `alpha`). What is typed is taken when it is a colour or a number in range, and put back when focus leaves while it is not.
|
|
1268
|
+
- `data-disabled`: Present when it is disabled.
|
|
1269
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1270
|
+
- `data-required`: Present when the form needs a colour.
|
|
1271
|
+
- `data-dragging`: Present while a pointer holds a thumb of the picker.
|
|
1272
|
+
- `data-channel="hex | red | green | blue | hue | saturation | lightness | alpha"`: The channel the input is typed in.
|
|
1273
|
+
- swatch: Shows the current colour.
|
|
1274
|
+
- `data-disabled`: Present when it is disabled.
|
|
1275
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1276
|
+
- `data-required`: Present when the form needs a colour.
|
|
1277
|
+
- `data-dragging`: Present while a pointer holds a thumb of the picker.
|
|
1278
|
+
- `--color`: The colour, with its alpha.
|
|
1279
|
+
- swatchTrigger: A preset colour, given as `value`: pressed, the colour is this one.
|
|
1280
|
+
- `data-disabled`: Present when it is disabled.
|
|
1281
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1282
|
+
- `data-required`: Present when the form needs a colour.
|
|
1283
|
+
- `data-dragging`: Present while a pointer holds a thumb of the picker.
|
|
1284
|
+
- `data-selected`: Present while the colour is this one.
|
|
1285
|
+
- `--color`: The preset's colour, with its alpha.
|
|
1286
|
+
- eyeDropperTrigger: Picks a colour from the screen with the browser's eye dropper. Hidden where the browser has none, and on a server.
|
|
1287
|
+
- `data-disabled`: Present when it is disabled.
|
|
1288
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1289
|
+
- `data-required`: Present when the form needs a colour.
|
|
1290
|
+
- `data-dragging`: Present while a pointer holds a thumb of the picker.
|
|
1291
|
+
- valueText: The colour, written in its format.
|
|
1292
|
+
- `data-disabled`: Present when it is disabled.
|
|
1293
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1294
|
+
- `data-required`: Present when the form needs a colour.
|
|
1295
|
+
- `data-dragging`: Present while a pointer holds a thumb of the picker.
|
|
1296
|
+
- `data-format="hex | rgb | hsl"`: How the value is written.
|
|
1297
|
+
- formatTrigger: Goes to the next format: hex, then rgb, then hsl.
|
|
1298
|
+
- `data-disabled`: Present when it is disabled.
|
|
1299
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1300
|
+
- `data-required`: Present when the form needs a colour.
|
|
1301
|
+
- `data-dragging`: Present while a pointer holds a thumb of the picker.
|
|
1302
|
+
- `data-format="hex | rgb | hsl"`: How the value is written.
|
|
1303
|
+
|
|
851
1304
|
### Combobox
|
|
852
1305
|
|
|
853
1306
|
```
|
|
854
1307
|
import { Combobox } from "@kirana-ui/react/combobox"
|
|
855
1308
|
```
|
|
856
1309
|
|
|
857
|
-
Parts: `<Combobox.Root>`, `<Combobox.Input>`, `<Combobox.Trigger>`, `<Combobox.Clear>`, `<Combobox.Chips>`, `<Combobox.Chip>`, `<Combobox.ChipRemove>`, `<Combobox.Portal>`, `<Combobox.Positioner>`, `<Combobox.Popup>`, `<Combobox.List>`, `<Combobox.Group>`, `<Combobox.GroupLabel>`, `<Combobox.Separator>`, `<Combobox.Item>`, `<Combobox.ItemIndicator>`, `<Combobox.Empty>`.
|
|
1310
|
+
Parts: `<Combobox.Root>`, `<Combobox.Input>`, `<Combobox.Trigger>`, `<Combobox.Value>`, `<Combobox.Clear>`, `<Combobox.Chips>`, `<Combobox.Chip>`, `<Combobox.ChipRemove>`, `<Combobox.Portal>`, `<Combobox.Backdrop>`, `<Combobox.Positioner>`, `<Combobox.Popup>`, `<Combobox.List>`, `<Combobox.Collection>`, `<Combobox.Group>`, `<Combobox.GroupLabel>`, `<Combobox.Separator>`, `<Combobox.Item>`, `<Combobox.ItemIndicator>`, `<Combobox.Empty>`, `<Combobox.Status>`.
|
|
858
1311
|
|
|
859
1312
|
Anatomy:
|
|
860
1313
|
|
|
@@ -862,18 +1315,27 @@ Anatomy:
|
|
|
862
1315
|
<Combobox.Root>
|
|
863
1316
|
<Combobox.Input>
|
|
864
1317
|
<Combobox.Trigger>
|
|
1318
|
+
<Combobox.Value> (optional)
|
|
865
1319
|
<Combobox.Portal>
|
|
1320
|
+
<Combobox.Backdrop> (optional)
|
|
866
1321
|
<Combobox.Positioner>
|
|
867
1322
|
<Combobox.Popup>
|
|
868
1323
|
<Combobox.Input> (as above)
|
|
869
1324
|
<Combobox.List> (optional)
|
|
1325
|
+
<Combobox.Collection> (optional)
|
|
1326
|
+
<Combobox.Item> (repeated, as above)
|
|
1327
|
+
<Combobox.Group> (optional, repeated, as above)
|
|
870
1328
|
<Combobox.Group> (optional, repeated)
|
|
1329
|
+
<Combobox.Collection> (optional, as above)
|
|
871
1330
|
<Combobox.Item> (repeated)
|
|
872
1331
|
<Combobox.ItemIndicator>
|
|
873
1332
|
<Combobox.GroupLabel>
|
|
874
1333
|
<Combobox.Separator> (repeated)
|
|
1334
|
+
<Combobox.Collection> (optional, as above)
|
|
875
1335
|
<Combobox.Empty>
|
|
1336
|
+
<Combobox.Status> (optional)
|
|
876
1337
|
<Combobox.Popup> (as above)
|
|
1338
|
+
<Combobox.Status> (optional, as above)
|
|
877
1339
|
<Combobox.Clear>
|
|
878
1340
|
<Combobox.Chips>
|
|
879
1341
|
<Combobox.Input> (as above)
|
|
@@ -883,9 +1345,11 @@ Anatomy:
|
|
|
883
1345
|
|
|
884
1346
|
Props of its root:
|
|
885
1347
|
|
|
886
|
-
- `
|
|
887
|
-
- `
|
|
888
|
-
- `
|
|
1348
|
+
- `presentation?: Presentation`: How the list opens. `"sheet"`: from the bottom edge, not placed against the input, modal with a backdrop, swiped down or pressed outside to close; the input then goes in the popup, at its head. `"auto"`: decided each time it opens, a sheet when the pointer is coarse and the viewport narrower than `sheetBelow`. Default `"popup"`. Not with `inline`.
|
|
1349
|
+
- `sheetBelow?: number`: With `presentation: "auto"`: the viewport's width, in CSS pixels, under which a coarse pointer opens a sheet. Default 640.
|
|
1350
|
+
- `value?: (Multiple extends true ? readonly Value[] : Value | null)`: The chosen value; `null` is "none". With `multiple`, the chosen values, in the order they were chosen.
|
|
1351
|
+
- `defaultValue?: (Multiple extends true ? readonly Value[] : Value | null)`: The value it starts with (with `multiple`, the values), when the caller does not hold `value`. Read once.
|
|
1352
|
+
- `onValueChange?: (value: Multiple extends true ? Value[] : Value | null, details: ChangeDetails) => void`: Heard as a value is about to be chosen or cleared (with `multiple`, added or taken away, with the values there would then be): `details.cancel()` keeps it as it was.
|
|
889
1353
|
- `inputValue?: string`: What the input says.
|
|
890
1354
|
- `defaultInputValue?: string`: The text the input starts with, when the caller does not hold `inputValue`. Read once.
|
|
891
1355
|
- `onInputValueChange?: (value: string, details: ChangeDetails) => void`: Heard as the input's text is about to change: `details.cancel()` keeps it as it was.
|
|
@@ -893,34 +1357,44 @@ Props of its root:
|
|
|
893
1357
|
- `defaultOpen?: boolean`: Whether the list starts open, when the caller does not hold `open`. Read once.
|
|
894
1358
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as the list is about to open or close: `details.cancel()` keeps it as it was.
|
|
895
1359
|
- `disabled?: boolean`: Disabled: it cannot be changed.
|
|
1360
|
+
- `readOnly?: boolean`: Its value can be read and not changed. The list still opens and can be gone through, by the pointer and the arrows, but no press and no Enter chooses; nothing typed is taken, and its clear and chip buttons do nothing. It keeps focus, and its value is still submitted.
|
|
896
1361
|
- `name?: string`: With a name, the value is submitted with the form around it.
|
|
897
1362
|
- `form?: string`: The id of the form the control belongs to, when it is not inside it.
|
|
898
|
-
- `items?: readonly
|
|
899
|
-
- `
|
|
900
|
-
- `
|
|
901
|
-
- `
|
|
902
|
-
- `
|
|
903
|
-
- `
|
|
1363
|
+
- `items?: readonly ComboboxItemData<Value>[] | readonly ComboboxGroupData<Value>[] | Readonly<Record<string, string>>`: The values with their labels: a list of them, groups of them (`{ value, items }`, `value` the group's name), or, for values that are text, the labels by value (`{ apple: "Apple" }`). The input shows a value by its label from here before the list has ever been opened. With the items written in the markup that is all it is for. With a `Collection` it is the list itself: the combobox filters it by what is typed, and the `Collection` draws what is left.
|
|
1364
|
+
- `itemToStringLabel?: (value: Value) => string`: For values that are objects: the text the input shows for one, and what an item drawn with no text of its own is filtered by. Without it, an object's own `label` names it, then the label `items` gives it, then the item's text in the markup.
|
|
1365
|
+
- `itemToStringValue?: (value: Value) => string`: For values that are objects: the text the form is sent for one. Without it, the `value` of an object shaped `{ value, label }` is sent, and any other object as JSON.
|
|
1366
|
+
- `filter?: ((label: string, query: string) => boolean) | null`: Whether an item is shown for what was typed. Default: its label holds the text, without regard to case. `null`: every item is shown, and the caller draws the ones it wants (or gives the `items` it wants, when they are loaded for what was typed).
|
|
1367
|
+
- `values?: readonly Value[]`: With `multiple`: the chosen values.
|
|
1368
|
+
- `defaultValues?: readonly Value[]`: With `multiple`: the values it starts with.
|
|
1369
|
+
- `onValuesChange?: (values: Value[], details: ChangeDetails) => void`: With `multiple`: heard as a value is about to be added or taken away.
|
|
904
1370
|
- `required?: boolean`: In a field, "none" is then wrong.
|
|
905
1371
|
- `inline?: boolean`: The list is always in the page, under the input, with no popup: a command palette. An item chosen is told to the caller, and the input keeps what was typed.
|
|
906
1372
|
- `virtualized?: ListCollection`: Every row, when only some are in the page (a virtualizer draws the ones in view). The caller then filters: the collection is what is left, and each item is given its `index`.
|
|
907
1373
|
- `autoHighlight?: boolean`: The first item shown for what was typed is highlighted as one types, so Enter chooses it. Off by default: typing then highlights nothing, and Enter chooses once an arrow or the pointer has gone to an item. Either way a list opened with nothing typed is on its chosen item, if it has one.
|
|
1374
|
+
- `multiple?: Multiple`: Several values: `value`, `defaultValue` and `onValueChange` then hold a list. Read once.
|
|
908
1375
|
|
|
909
1376
|
Each part, and its own props:
|
|
910
1377
|
|
|
911
|
-
- `<Combobox.Root>` draws no element. Generic: `<Value = unknown>`. `Value` is what tells an item from the others
|
|
1378
|
+
- `<Combobox.Root>` draws no element. Generic: `<Value = unknown, Multiple extends boolean | undefined = false>`. `Value` is what tells an item from the others. `Multiple` is inferred from `multiple`: with `multiple`, `value`, `defaultValue` and `onValueChange` hold a list of them. Its props are above.
|
|
912
1379
|
- `<Combobox.Input>` draws a `<input>`.
|
|
913
1380
|
- `<Combobox.Trigger>` draws a `<button>`.
|
|
1381
|
+
- `<Combobox.Value>` draws no element. Generic: `<Chosen = unknown>`. The chosen value's label, or a placeholder while nothing is chosen, for a button that is the combobox (its input inside the popup). With several values, their labels with commas between.
|
|
1382
|
+
- `placeholder?: ReactNode`: Shown while nothing is chosen.
|
|
1383
|
+
- `children?: ReactNode | (( value: Chosen, label: Chosen extends readonly unknown[] ? readonly string[] : string | undefined ) => ReactNode)`: What to show in place of the label. A function is given the value and its label (`null` and `undefined` while nothing is chosen); with `multiple`, the values and their labels, in the order they were chosen.
|
|
914
1384
|
- `<Combobox.Clear>` draws a `<button>`.
|
|
915
1385
|
- `keepMounted?: boolean`: Keeps the button in the page while there is nothing to clear.
|
|
916
1386
|
- `<Combobox.Chips>` draws a `<div>`. With several values: what holds the chips and the input, and what the list is placed against.
|
|
917
|
-
- `<Combobox.Chip>` draws a `<span>`.
|
|
1387
|
+
- `<Combobox.Chip>` draws a `<span>`.
|
|
918
1388
|
- `value: unknown`: Required. The chosen value this chip stands for.
|
|
919
1389
|
- `<Combobox.ChipRemove>` draws a `<button>`.
|
|
920
1390
|
- `<Combobox.Portal>` draws no element. Draws no element of its own: its children at the end of `<body>`, or where a `PortalProvider` says.
|
|
1391
|
+
- `<Combobox.Backdrop>` draws a `<div>`.
|
|
921
1392
|
- `<Combobox.Positioner>` draws a `<div>`. Takes the positioner options ("Positioner options", above).
|
|
922
1393
|
- `<Combobox.Popup>` draws a `<div>`.
|
|
923
1394
|
- `<Combobox.List>` draws a `<div>`.
|
|
1395
|
+
- `<Combobox.Collection>` draws no element. Generic: `<Value = unknown>`. Draws the list from the root's `items`: its content once for each item left for what was typed, or for each group that has items left; given a group, for each of that group's items left. The root then filters, and no item hides itself.
|
|
1396
|
+
- `of?: ComboboxEntry<Value>`: A group the root's `items` gave: its items left are then what is drawn.
|
|
1397
|
+
- `children: (entry: ComboboxEntry<Value>) => ReactNode`: Required. Drawn once for each item left, or for each group that has items left.
|
|
924
1398
|
- `<Combobox.Group>` draws a `<div>`. Items that belong together, named by their label. Hidden while none is shown.
|
|
925
1399
|
- `<Combobox.GroupLabel>` draws a `<div>`. The name of a group. Outside a group it is plain text, and names nothing.
|
|
926
1400
|
- `<Combobox.Separator>` draws a `<div>`. A line between groups.
|
|
@@ -932,40 +1406,91 @@ Each part, and its own props:
|
|
|
932
1406
|
- `<Combobox.ItemIndicator>` draws a `<span>`. A mark an item shows while it is the chosen one.
|
|
933
1407
|
- `keepMounted?: boolean`: Keeps the mark in the page while its item is not chosen.
|
|
934
1408
|
- `<Combobox.Empty>` draws a `<div>`. What is shown when no item is.
|
|
1409
|
+
- `<Combobox.Status>` draws a `<div>`. Says how the list stands ("3 results", "Loading") to software that reads the page, as its text changes. It stays in the page while its text changes: inside the popup, or beside the input.
|
|
935
1410
|
|
|
936
1411
|
Attributes and CSS variables, by part:
|
|
937
1412
|
|
|
938
1413
|
- input: The text input. What is typed filters the list, which is placed against it, or against the chips' box when it is in one. Inside the popup, it takes focus while the popup is open.
|
|
939
1414
|
- `data-popup-open`: Present when the list is open.
|
|
1415
|
+
- `data-pressed`: Present while its popup is open: it stays pressed, as a button held down.
|
|
1416
|
+
- `data-popup-side="top | right | bottom | left | inline-start | inline-end | none"`: While the list is in the page: the side of the trigger it is on, after any flip; `none` when it lies over the trigger. Not said while it opens as a sheet.
|
|
1417
|
+
- `data-list-empty`: Present when no item is shown for what was typed, once the list is in the page.
|
|
940
1418
|
- `data-disabled`: Present when it is disabled.
|
|
1419
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1420
|
+
- `data-required`: Present when the form needs it.
|
|
1421
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
1422
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
1423
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
1424
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
1425
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
1426
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
941
1427
|
- trigger: A button that opens and closes the list. With the input inside the popup it is the combobox: a stop for Tab, and what the popup is placed against.
|
|
942
1428
|
- `data-popup-open`: Present when the list is open.
|
|
1429
|
+
- `data-pressed`: Present while its popup is open: it stays pressed, as a button held down.
|
|
1430
|
+
- `data-popup-side="top | right | bottom | left | inline-start | inline-end | none"`: While the list is in the page: the side of the trigger it is on, after any flip; `none` when it lies over the trigger. Not said while it opens as a sheet.
|
|
1431
|
+
- `data-list-empty`: Present when no item is shown for what was typed, once the list is in the page.
|
|
943
1432
|
- `data-disabled`: Present when it is disabled.
|
|
944
|
-
-
|
|
1433
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
1434
|
+
- `data-required`: Present when the form needs it.
|
|
1435
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
1436
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
1437
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
1438
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
1439
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
1440
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
1441
|
+
- backdrop: The layer over the page behind the list: a press on it closes the list.
|
|
1442
|
+
- `data-open`: Present when it is open.
|
|
1443
|
+
- `data-closed`: Present when it is closed.
|
|
1444
|
+
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
1445
|
+
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
1446
|
+
- `data-presentation="popup | sheet"`: How the list opened: placed against its trigger, or as a sheet from the bottom edge.
|
|
1447
|
+
- `data-swiping`: Present while the sheet is dragged.
|
|
1448
|
+
- `data-swipe-dismiss`: Present once a drag has closed it.
|
|
1449
|
+
- `--drawer-swipe-movement-x`: As a sheet: how far it has been dragged across, always 0px.
|
|
1450
|
+
- `--drawer-swipe-movement-y`: As a sheet: how far it has been dragged down.
|
|
1451
|
+
- `--drawer-swipe-progress`: As a sheet: how far it has been dragged, of its own height: 0 to 1.
|
|
1452
|
+
- positioner: Places the list against the input: against the chips' box when the input is in one, the button when the input is inside the popup, or its own `anchor`. It carries the geometry. As a sheet it is not placed, and carries none.
|
|
945
1453
|
- `data-open`: Present when it is open.
|
|
946
1454
|
- `data-closed`: Present when it is closed.
|
|
947
1455
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
948
1456
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
1457
|
+
- `data-presentation="popup | sheet"`: How the list opened: placed against its trigger, or as a sheet from the bottom edge.
|
|
1458
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
1459
|
+
- `data-empty`: Present when no item is shown for what was typed.
|
|
949
1460
|
- `--anchor-width`: The anchor's width.
|
|
950
1461
|
- `--anchor-height`: The anchor's height.
|
|
951
1462
|
- `--available-width`: The width between the anchor and the edge of the viewport.
|
|
952
1463
|
- `--available-height`: The height between the anchor and the edge of the viewport.
|
|
953
1464
|
- `--transform-origin`: The point of the popup nearest its anchor, to scale from.
|
|
954
|
-
- popup: The list of items. With a `list` inside, what holds it: a dialog around an input and the list.
|
|
1465
|
+
- popup: The list of items. With a `list` inside, what holds it: a dialog around an input and the list. As a sheet, a design moves it by what it says of the drag, and gives it `touch-action: none` where a finger drags it.
|
|
955
1466
|
- `data-open`: Present when it is open.
|
|
956
1467
|
- `data-closed`: Present when it is closed.
|
|
957
1468
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
958
1469
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
959
1470
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
960
1471
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
1472
|
+
- `data-presentation="popup | sheet"`: How the list opened: placed against its trigger, or as a sheet from the bottom edge.
|
|
1473
|
+
- `data-swiping`: Present while the sheet is dragged.
|
|
1474
|
+
- `data-swipe-dismiss`: Present once a drag has closed it.
|
|
1475
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
961
1476
|
- `data-empty`: Present when no item is shown for what was typed.
|
|
1477
|
+
- `--drawer-swipe-movement-x`: As a sheet: how far it has been dragged across, always 0px.
|
|
1478
|
+
- `--drawer-swipe-movement-y`: As a sheet: how far it has been dragged down.
|
|
1479
|
+
- `--drawer-swipe-progress`: As a sheet: how far it has been dragged, of its own height: 0 to 1.
|
|
1480
|
+
- `--drawer-swipe-strength`: As a sheet, once let go: 0.1 to 1, the share of the design's own time it should take to come to rest.
|
|
962
1481
|
- list: The items' own box inside the popup, when the popup holds more than items (an input): it is then the listbox.
|
|
963
1482
|
- `data-empty`: Present when no item is shown for what was typed.
|
|
964
1483
|
- item: One choice in the list.
|
|
965
1484
|
- `data-selected`: Present on the chosen item.
|
|
966
1485
|
- `data-highlighted`: Present on the item the pointer or the keyboard is on.
|
|
967
1486
|
- `data-disabled`: Present when it is disabled.
|
|
968
|
-
- clear: A button that empties the input and the value.
|
|
1487
|
+
- clear: A button that empties the input and the value. It is in the page while there is something to clear (the text, for an autocomplete; else what is chosen), and through its exit; `keepMounted` keeps it there.
|
|
1488
|
+
- `data-disabled`: Present when it is disabled.
|
|
1489
|
+
- `data-popup-open`: Present when the list is open.
|
|
1490
|
+
- `data-visible`: Present while there is something to clear.
|
|
1491
|
+
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
1492
|
+
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
1493
|
+
- chip: One chosen value. The arrows reach it from the start of the input, and Backspace or Delete on it takes it away.
|
|
969
1494
|
- `data-disabled`: Present when it is disabled.
|
|
970
1495
|
- chipRemove: A chip's button that takes its value away.
|
|
971
1496
|
- `data-disabled`: Present when it is disabled.
|
|
@@ -994,12 +1519,13 @@ Anatomy:
|
|
|
994
1519
|
Props of its root:
|
|
995
1520
|
|
|
996
1521
|
- `inputValue?: string`: What the input says.
|
|
997
|
-
- `defaultInputValue?: string`: The text the input starts with, when the caller does not hold `inputValue`. Read once.
|
|
1522
|
+
- `defaultInputValue?: string`: The text the input starts with, when the caller does not hold `inputValue`. Read once. Default `""`.
|
|
998
1523
|
- `onInputValueChange?: (value: string, details: ChangeDetails) => void`: Heard as the input's text is about to change: `details.cancel()` keeps it as it was.
|
|
999
|
-
- `onSelect?: (value: string, details: ChangeDetails) => void`: An item was chosen: pressed, or Enter while it was highlighted.
|
|
1524
|
+
- `onSelect?: (value: string, details: ChangeDetails) => void`: An item was chosen: pressed, or Enter while it was highlighted. Told the item's `value`, or when it was given none, its `label`, or its text.
|
|
1000
1525
|
- `filter?: ((label: string, query: string, keywords: readonly string[]) => boolean) | null`: Whether an item is shown for what was typed. Default: its label or one of its keywords holds the text, without regard to case. `null`: every item is shown, and the caller draws the ones it wants.
|
|
1001
1526
|
- `loop?: boolean`: Whether a step past an end of the list goes round to the other.
|
|
1002
1527
|
- `disabled?: boolean`: Disabled: nothing can be typed or chosen.
|
|
1528
|
+
- `autoHighlight?: boolean`: Whether the first item shown is highlighted from the start and again whenever the text changes, so Enter does it with no arrow key first, as a command palette is used. Default: `true`. With `false`, nothing is highlighted until the input has focus or an arrow or the pointer moves to an item.
|
|
1003
1529
|
|
|
1004
1530
|
Each part, and its own props:
|
|
1005
1531
|
|
|
@@ -1010,7 +1536,7 @@ Each part, and its own props:
|
|
|
1010
1536
|
- `<Command.Group>` draws a `<div>`. Items under a heading. Hidden while none of them is shown.
|
|
1011
1537
|
- `<Command.GroupHeading>` draws a `<div>`. A group's name.
|
|
1012
1538
|
- `<Command.Item>` draws a `<div>`.
|
|
1013
|
-
- `value
|
|
1539
|
+
- `value?: string`: What `onSelect` is told; its `label`, or its text, when left out.
|
|
1014
1540
|
- `disabled?: boolean`: Disables this item: it cannot be chosen, and the arrows pass over it.
|
|
1015
1541
|
- `label?: string`: What is filtered; the item's text when left out.
|
|
1016
1542
|
- `keywords?: readonly string[]`: Other words the item answers to.
|
|
@@ -1067,7 +1593,8 @@ Props of its root:
|
|
|
1067
1593
|
- `defaultOpen?: boolean`: Whether it starts open, when the caller does not hold `open`. Read once.
|
|
1068
1594
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as it is about to open or close: `details.cancel()` keeps it as it was.
|
|
1069
1595
|
- `disabled?: boolean`: The trigger cannot be pressed; a submenu's is passed over.
|
|
1070
|
-
- `
|
|
1596
|
+
- `loopFocus?: boolean`: Whether the arrows go round from the last item to the first. Default: they do.
|
|
1597
|
+
- `loop?: boolean`: Whether the arrows wrap from the last item to the first.
|
|
1071
1598
|
- `modal?: boolean`: Holds the page while the menu is open: its scroll is locked, and a press outside closes the menu and reaches nothing. Default: it does not. Not for a submenu.
|
|
1072
1599
|
|
|
1073
1600
|
Each part, and its own props:
|
|
@@ -1081,18 +1608,21 @@ Each part, and its own props:
|
|
|
1081
1608
|
- `<ContextMenu.Item>` draws a `<div>`.
|
|
1082
1609
|
- `disabled?: boolean`: Disables this item: it cannot be pressed, and the arrows pass over it.
|
|
1083
1610
|
- `label?: string`: What typing matches; the item's text when left out.
|
|
1084
|
-
- `
|
|
1611
|
+
- `closeOnSelect?: boolean`: Whether choosing the item closes the menu. Default: it does for an item, and does not for a checkbox or a radio item.
|
|
1612
|
+
- `closeOnClick?: boolean`: Whether choosing the item closes the menu.
|
|
1085
1613
|
- `<ContextMenu.LinkItem>` draws a `<a>`.
|
|
1086
1614
|
- `disabled?: boolean`: Disables this item: it cannot be pressed, and the arrows pass over it.
|
|
1087
1615
|
- `label?: string`: What typing matches; the item's text when left out.
|
|
1088
|
-
- `
|
|
1616
|
+
- `closeOnSelect?: boolean`: Whether choosing the item closes the menu. Default: it does for an item, and does not for a checkbox or a radio item.
|
|
1617
|
+
- `closeOnClick?: boolean`: Whether choosing the item closes the menu.
|
|
1089
1618
|
- `<ContextMenu.Group>` draws a `<div>`. Items that belong together, named by their label.
|
|
1090
1619
|
- `<ContextMenu.GroupLabel>` draws a `<div>`. The name of a group. Outside a group it is plain text, and names nothing.
|
|
1091
1620
|
- `<ContextMenu.Separator>` draws a `<div>`. A line between items.
|
|
1092
1621
|
- `<ContextMenu.CheckboxItem>` draws a `<div>`.
|
|
1093
1622
|
- `disabled?: boolean`: Disables this item: it cannot be pressed, and the arrows pass over it.
|
|
1094
1623
|
- `label?: string`: What typing matches; the item's text when left out.
|
|
1095
|
-
- `
|
|
1624
|
+
- `closeOnSelect?: boolean`: Whether choosing the item closes the menu. Default: it does for an item, and does not for a checkbox or a radio item.
|
|
1625
|
+
- `closeOnClick?: boolean`: Whether choosing the item closes the menu.
|
|
1096
1626
|
- `checked?: boolean`: Whether the item is checked, when the caller holds it.
|
|
1097
1627
|
- `defaultChecked?: boolean`: Whether the item starts checked, when the caller does not hold `checked`. Read once.
|
|
1098
1628
|
- `onCheckedChange?: (checked: boolean, details: ChangeDetails) => void`: Heard as the item is about to be checked or unchecked: `details.cancel()` keeps it as it was.
|
|
@@ -1106,7 +1636,8 @@ Each part, and its own props:
|
|
|
1106
1636
|
- `<ContextMenu.RadioItem>` draws a `<div>`.
|
|
1107
1637
|
- `disabled?: boolean`: Disables this item: it cannot be pressed, and the arrows pass over it.
|
|
1108
1638
|
- `label?: string`: What typing matches; the item's text when left out.
|
|
1109
|
-
- `
|
|
1639
|
+
- `closeOnSelect?: boolean`: Whether choosing the item closes the menu. Default: it does for an item, and does not for a checkbox or a radio item.
|
|
1640
|
+
- `closeOnClick?: boolean`: Whether choosing the item closes the menu.
|
|
1110
1641
|
- `value: unknown`: Required. What the radio group's value is while this item is the chosen one.
|
|
1111
1642
|
- `<ContextMenu.RadioItemIndicator>` draws a `<span>`.
|
|
1112
1643
|
- `keepMounted?: boolean`: Keeps the mark in the page while its item is not checked.
|
|
@@ -1115,7 +1646,8 @@ Each part, and its own props:
|
|
|
1115
1646
|
- `defaultOpen?: boolean`: Whether it starts open, when the caller does not hold `open`. Read once.
|
|
1116
1647
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as it is about to open or close: `details.cancel()` keeps it as it was.
|
|
1117
1648
|
- `disabled?: boolean`: The trigger cannot be pressed; a submenu's is passed over.
|
|
1118
|
-
- `
|
|
1649
|
+
- `loopFocus?: boolean`: Whether the arrows go round from the last item to the first. Default: they do.
|
|
1650
|
+
- `loop?: boolean`: Whether the arrows wrap from the last item to the first.
|
|
1119
1651
|
- `modal?: boolean`: Holds the page while the menu is open: its scroll is locked, and a press outside closes the menu and reaches nothing. Default: it does not. Not for a submenu.
|
|
1120
1652
|
- `<ContextMenu.SubmenuTrigger>` draws a `<div>`.
|
|
1121
1653
|
|
|
@@ -1123,16 +1655,20 @@ Attributes and CSS variables, by part:
|
|
|
1123
1655
|
|
|
1124
1656
|
- trigger: The area a secondary press, or a long press on a touch screen, opens the menu in.
|
|
1125
1657
|
- `data-popup-open`: Present when the menu is open.
|
|
1658
|
+
- `data-pressed`: Present while its popup is open: it stays pressed, as a button held down.
|
|
1126
1659
|
- positioner: Places the menu against its trigger. It carries the geometry.
|
|
1127
1660
|
- `data-open`: Present when it is open.
|
|
1128
1661
|
- `data-closed`: Present when it is closed.
|
|
1129
1662
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
1130
1663
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
1664
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
1131
1665
|
- `--anchor-width`: The anchor's width.
|
|
1132
1666
|
- `--anchor-height`: The anchor's height.
|
|
1133
1667
|
- `--available-width`: The width between the anchor and the edge of the viewport.
|
|
1134
1668
|
- `--available-height`: The height between the anchor and the edge of the viewport.
|
|
1135
1669
|
- `--transform-origin`: The point of the popup nearest its anchor, to scale from.
|
|
1670
|
+
- `--positioner-width`: The popup's width, as its content lays it out: a design gives the positioner `width: var(--positioner-width)` to animate a change of size.
|
|
1671
|
+
- `--positioner-height`: The popup's height, as its content lays it out: a design gives the positioner `height: var(--positioner-height)` to animate a change of size.
|
|
1136
1672
|
- popup: The menu itself: the list of items.
|
|
1137
1673
|
- `data-open`: Present when it is open.
|
|
1138
1674
|
- `data-closed`: Present when it is closed.
|
|
@@ -1140,7 +1676,10 @@ Attributes and CSS variables, by part:
|
|
|
1140
1676
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
1141
1677
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
1142
1678
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
1679
|
+
- `data-instant="click | dismiss | group"`: Present when it opened or closed in a way that should skip the motion: `click` when the keyboard pressed its trigger or an item, `dismiss` when Escape closed it, `group` when focus or the pointer went from one menu of a bar to another.
|
|
1143
1680
|
- arrow: An element that points at the trigger.
|
|
1681
|
+
- `data-open`: Present when it is open.
|
|
1682
|
+
- `data-closed`: Present when it is closed.
|
|
1144
1683
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
1145
1684
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
1146
1685
|
- `data-uncentered`: Present when the arrow cannot sit at the trigger's centre.
|
|
@@ -1195,10 +1734,11 @@ Props of its root:
|
|
|
1195
1734
|
- `value?: IsoDate | null`: The day typed, once all of it is; `null` until then.
|
|
1196
1735
|
- `defaultValue?: IsoDate | null`: The value it starts with, when the caller does not hold `value`. Read once.
|
|
1197
1736
|
- `onValueChange?: (value: IsoDate | null, details: ChangeDetails) => void`: Heard as the day is about to change, once all of it is typed or as it is cleared: `details.cancel()` keeps the value as it was.
|
|
1198
|
-
- `locale?: string`: The language and region that order the day, the month and the year and put what stands between them (`"en-US"`: month/day/year). Give it: a server does not know the reader's.
|
|
1737
|
+
- `locale?: string`: The language and region that order the day, the month and the year and put what stands between them (`"en-US"`: month/day/year). Give it: a server does not know the reader's. Default `"en-US"`.
|
|
1199
1738
|
- `min?: IsoDate`: The first and the last day it takes: outside them it says it is invalid.
|
|
1200
1739
|
- `max?: IsoDate`: The last day it takes.
|
|
1201
|
-
- `
|
|
1740
|
+
- `calendarSystem?: CalendarSystem`: The calendar its parts are typed in, when it is not the Gregorian one: an instance from `@internationalized/date` (`new PersianCalendar()`), as a calendar takes it. Its days, months, years and eras are the parts' ranges; the value is still an ISO day. In a calendar with several eras (Japanese, Minguo, Ethiopic), the era is a part of its own.
|
|
1741
|
+
- `placeholders?: Partial<Record<DateUnit, string>>`: What an empty part shows. Default: `dd`, `mm`, `yyyy`, `era`.
|
|
1202
1742
|
- `disabled?: boolean`: Disabled: it cannot be changed.
|
|
1203
1743
|
- `readOnly?: boolean`: Shown as it is, focusable, not changeable.
|
|
1204
1744
|
- `required?: boolean`: Needed: in a `Field`, leaving it empty is then invalid.
|
|
@@ -1221,7 +1761,7 @@ Attributes and CSS variables, by part:
|
|
|
1221
1761
|
- `data-readonly`: Present when its value cannot be changed.
|
|
1222
1762
|
- `data-invalid`: Present when the date is outside what it takes, or is asked for and half typed.
|
|
1223
1763
|
- segment: One piece of the date: a part that is typed, or what stands between two.
|
|
1224
|
-
- `data-segment="day | month | year | literal"`: Which piece it is.
|
|
1764
|
+
- `data-segment="era | day | month | year | literal"`: Which piece it is: the era only in a calendar of several eras.
|
|
1225
1765
|
- `data-placeholder`: Present on a part that is empty.
|
|
1226
1766
|
- `data-disabled`: Present when it is disabled.
|
|
1227
1767
|
- `data-invalid`: Present when the date is outside what it takes, or is asked for and half typed.
|
|
@@ -1232,13 +1772,13 @@ Attributes and CSS variables, by part:
|
|
|
1232
1772
|
import { DatePicker } from "@kirana-ui/react/date-picker"
|
|
1233
1773
|
```
|
|
1234
1774
|
|
|
1235
|
-
Parts: `<DatePicker.Root>`, `<DatePicker.Field>`, `<DatePicker.Segments>`, `<DatePicker.Segment>`, `<DatePicker.Input>`, `<DatePicker.Trigger>`, `<DatePicker.Portal>`, `<DatePicker.Positioner>`, `<DatePicker.Popup>`, `<DatePicker.Calendar>`, `<DatePicker.Heading>`, `<DatePicker.Previous>`, `<DatePicker.Next>`, `<DatePicker.Grid>`, `<DatePicker.Weekdays>`, `<DatePicker.HeadCell>`, `<DatePicker.Weeks>`, `<DatePicker.Cell>`, `<DatePicker.Day>`.
|
|
1775
|
+
Parts: `<DatePicker.Root>`, `<DatePicker.Field>`, `<DatePicker.Segments>`, `<DatePicker.Segment>`, `<DatePicker.Input>`, `<DatePicker.Trigger>`, `<DatePicker.Portal>`, `<DatePicker.Positioner>`, `<DatePicker.Popup>`, `<DatePicker.Calendar>`, `<DatePicker.Heading>`, `<DatePicker.Previous>`, `<DatePicker.Next>`, `<DatePicker.Months>`, `<DatePicker.Grid>`, `<DatePicker.Weekdays>`, `<DatePicker.HeadCell>`, `<DatePicker.Weeks>`, `<DatePicker.Cell>`, `<DatePicker.Day>`, `<DatePicker.Clear>`, `<DatePicker.Preset>`.
|
|
1236
1776
|
|
|
1237
1777
|
Anatomy:
|
|
1238
1778
|
|
|
1239
1779
|
```
|
|
1240
1780
|
<DatePicker.Root>
|
|
1241
|
-
<DatePicker.Field>
|
|
1781
|
+
<DatePicker.Field> (repeated)
|
|
1242
1782
|
<DatePicker.Segments>
|
|
1243
1783
|
<DatePicker.Segment> (repeated)
|
|
1244
1784
|
<DatePicker.Input>
|
|
@@ -1247,22 +1787,26 @@ Anatomy:
|
|
|
1247
1787
|
<DatePicker.Positioner>
|
|
1248
1788
|
<DatePicker.Popup>
|
|
1249
1789
|
<DatePicker.Calendar>
|
|
1250
|
-
<DatePicker.
|
|
1790
|
+
<DatePicker.Months> (optional)
|
|
1791
|
+
<DatePicker.Heading>
|
|
1792
|
+
<DatePicker.Grid>
|
|
1793
|
+
<DatePicker.Weekdays>
|
|
1794
|
+
<DatePicker.HeadCell> (repeated)
|
|
1795
|
+
<DatePicker.Weeks>
|
|
1796
|
+
<DatePicker.Cell> (repeated)
|
|
1797
|
+
<DatePicker.Day>
|
|
1251
1798
|
<DatePicker.Previous>
|
|
1252
1799
|
<DatePicker.Next>
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
<DatePicker.HeadCell> (repeated)
|
|
1256
|
-
<DatePicker.Weeks>
|
|
1257
|
-
<DatePicker.Cell> (repeated)
|
|
1258
|
-
<DatePicker.Day>
|
|
1800
|
+
<DatePicker.Clear> (optional)
|
|
1801
|
+
<DatePicker.Preset> (optional, repeated)
|
|
1259
1802
|
```
|
|
1260
1803
|
|
|
1261
1804
|
Props of its root:
|
|
1262
1805
|
|
|
1263
|
-
- `value?:
|
|
1264
|
-
- `defaultValue?:
|
|
1265
|
-
- `onValueChange?: (value:
|
|
1806
|
+
- `value?: DatePickerValueOf<Mode>`: The day, typed or picked; with `mode: "range"` a first and a last day, each typed in its own field or both picked in the one calendar. `null` for none.
|
|
1807
|
+
- `defaultValue?: DatePickerValueOf<Mode>`: The value it starts with, when the caller does not hold `value`. Read once.
|
|
1808
|
+
- `onValueChange?: (value: DatePickerValueOf<Mode>, details: ChangeDetails) => void`: Heard as the value is about to change, typed, picked, pressed or cleared: `details.cancel()` keeps the value as it was. A range is heard as each end comes, its other end `null` until it is there too.
|
|
1809
|
+
- `mode?: Mode`: One day (the default), or a first and a last (`"range"`): two fields, `DatePicker.Field` with `range="start"` and `range="end"`, and the calendar in range mode, which stays open until the range is whole. Read once.
|
|
1266
1810
|
- `open?: boolean`: Whether the calendar is open, when the caller holds it.
|
|
1267
1811
|
- `defaultOpen?: boolean`: Whether the calendar starts open, when the caller does not hold `open`. Read once.
|
|
1268
1812
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as the calendar is about to open or close: `details.cancel()` keeps it as it was.
|
|
@@ -1270,25 +1814,34 @@ Props of its root:
|
|
|
1270
1814
|
- `min?: IsoDate`: The first and the last day that can be typed or picked.
|
|
1271
1815
|
- `max?: IsoDate`: The last day that can be typed or picked.
|
|
1272
1816
|
- `isDateUnavailable?: (date: IsoDate) => boolean`: Days that cannot be picked in the calendar.
|
|
1273
|
-
- `calendarSystem?: CalendarSystem`: The calendar its months are laid out in, when it is not the Gregorian one.
|
|
1817
|
+
- `calendarSystem?: CalendarSystem`: The calendar its months are laid out in and its field typed in, when it is not the Gregorian one. The value is an ISO day whatever it is.
|
|
1274
1818
|
- `fixedWeeks?: boolean`: Always six rows of days.
|
|
1819
|
+
- `months?: number`: How many months the calendar shows side by side (1 by default).
|
|
1820
|
+
- `pagedNavigation?: boolean`: With several `months`: whether Previous and Next turn them all rather than one month.
|
|
1821
|
+
- `month?: IsoDate`: The month the calendar shows (the first, with several), when the caller holds it.
|
|
1822
|
+
- `defaultMonth?: IsoDate`: The month the calendar starts on, when the caller does not hold `month`. Read once.
|
|
1823
|
+
- `onMonthChange?: (month: IsoDate, details: ChangeDetails) => void`: Heard as the calendar is about to show another month, a day typed or picked included: its first day. `details.cancel()` keeps the month as it was.
|
|
1275
1824
|
- `placeholders?: Partial<Record<DateUnit, string>>`: What an empty part of the field shows.
|
|
1276
1825
|
- `disabled?: boolean`: Disabled: it cannot be changed.
|
|
1277
1826
|
- `readOnly?: boolean`: Shown as it is, focusable, not changeable.
|
|
1278
|
-
- `required?: boolean`: Needed: in a `Field`, leaving it empty is then invalid.
|
|
1827
|
+
- `required?: boolean`: Needed: in a `Field`, leaving it empty is then invalid, and the day picked, pressed again in the calendar, stays picked. Without it, that press empties the field and closes the calendar.
|
|
1279
1828
|
- `name?: string`: The name it is submitted under.
|
|
1280
1829
|
- `form?: string`: The id of the form it belongs to, when it is not inside it.
|
|
1281
1830
|
|
|
1282
1831
|
Each part, and its own props:
|
|
1283
1832
|
|
|
1284
|
-
- `<DatePicker.Root>` draws no element.
|
|
1833
|
+
- `<DatePicker.Root>` draws no element. Generic: `<Mode extends DatePickerMode = "single">`. `value` and `onValueChange` are typed by `mode`: a day, or a range. Its props are above.
|
|
1285
1834
|
- `<DatePicker.Field>` draws a `<div>`.
|
|
1835
|
+
- `range?: "start" | "end"`: With `mode="range"`: which day of the range it is typed in, the first (`"start"`, the default) or the last (`"end"`).
|
|
1286
1836
|
- `<DatePicker.Segments>` draws no element. The date's segments, in the locale's order: each is given to draw.
|
|
1287
1837
|
- `children: (segment: DateFieldSegment) => ReactNode`: Required. Draws one piece of the date, once for each: a part that is typed, or what stands between two.
|
|
1288
1838
|
- `<DatePicker.Segment>` draws a `<span>`.
|
|
1289
1839
|
- `segment: DateFieldSegment`: Required. The piece it is: an entry `DateField.Segments` gave.
|
|
1290
1840
|
- `<DatePicker.Input>` draws a `<input>`. The hidden input it is submitted by.
|
|
1291
1841
|
- `<DatePicker.Trigger>` draws a `<button>`.
|
|
1842
|
+
- `openOnHover?: boolean`: Whether the pointer resting on the trigger opens the popover too. A press and the keyboard still open it, and a press on one the pointer opened keeps it open. Default `false`.
|
|
1843
|
+
- `delay?: number`: How long the pointer rests on the trigger before the popover opens, in milliseconds. Default 300.
|
|
1844
|
+
- `closeDelay?: number`: How long after the pointer leaves a popover it opened closes, in milliseconds. Default 0.
|
|
1292
1845
|
- `<DatePicker.Portal>` draws no element. Draws no element of its own: its children at the end of `<body>`, or where a `PortalProvider` says.
|
|
1293
1846
|
- `<DatePicker.Positioner>` draws a `<div>`. Takes the positioner options ("Positioner options", above).
|
|
1294
1847
|
- `<DatePicker.Popup>` draws a `<div>`.
|
|
@@ -1296,7 +1849,9 @@ Each part, and its own props:
|
|
|
1296
1849
|
- `<DatePicker.Heading>` draws a `<div>`. Names the month shown. Read out when it changes.
|
|
1297
1850
|
- `<DatePicker.Previous>` draws a `<button>`.
|
|
1298
1851
|
- `<DatePicker.Next>` draws a `<button>`.
|
|
1299
|
-
- `<DatePicker.
|
|
1852
|
+
- `<DatePicker.Months>` draws no element. The months shown, with several: each is given to draw its heading and its grid. It draws no element, and is left out for one month.
|
|
1853
|
+
- `children: (month: CalendarMonth) => ReactNode`: Required. Draws one month, once for each shown: its heading and its grid.
|
|
1854
|
+
- `<DatePicker.Grid>` draws a `<table>`. The table of a month's days: a grid the arrows move in, from one month shown into the next.
|
|
1300
1855
|
- `<DatePicker.Weekdays>` draws no element. The days of the week: each is given to draw its head cell.
|
|
1301
1856
|
- `children: (weekday: CalendarWeekday) => ReactNode`: Required. Draws one day of the week, once for each: its heading cell.
|
|
1302
1857
|
- `<DatePicker.HeadCell>` draws a `<th>`. A column's heading: a day of the week.
|
|
@@ -1304,33 +1859,40 @@ Each part, and its own props:
|
|
|
1304
1859
|
- `<DatePicker.Weeks>` draws no element. The weeks of the month shown: each is given to draw its row of days.
|
|
1305
1860
|
- `children: (week: readonly CalendarDay[]) => ReactNode`: Required. Draws one week, once for each of the month shown: a row of its days.
|
|
1306
1861
|
- `<DatePicker.Cell>` draws a `<td>`.
|
|
1307
|
-
- `date: string`: Required. The day it holds, as `Calendar.Weeks` gave it: `day.date`.
|
|
1862
|
+
- `date: string`: Required. The day it holds, as `Calendar.Weeks` gave it: `day.date`. A `Day` inside takes it too.
|
|
1308
1863
|
- `<DatePicker.Day>` draws a `<button>`.
|
|
1309
|
-
- `date
|
|
1864
|
+
- `date?: string`: The day it is the button of. Left out, the `Calendar.Cell`'s it is inside.
|
|
1865
|
+
- `<DatePicker.Clear>` draws a `<button>`.
|
|
1866
|
+
- `<DatePicker.Preset>` draws a `<button>`.
|
|
1867
|
+
- `value: string | DatePickerRange`: Required. The value its press gives: a day, or with `mode="range"` a range.
|
|
1310
1868
|
|
|
1311
1869
|
Attributes and CSS variables, by part:
|
|
1312
1870
|
|
|
1313
|
-
- field: The field
|
|
1871
|
+
- field: The field a day is typed in: with `mode: "range"`, one for the first day (`range="start"`) and one for the last (`range="end"`).
|
|
1314
1872
|
- `data-disabled`: Present when it is disabled.
|
|
1315
1873
|
- `data-readonly`: Present when its value cannot be changed.
|
|
1316
1874
|
- `data-invalid`: Present when the date is outside what it takes, or is asked for and half typed.
|
|
1317
1875
|
- segment: One piece of the date: a part that is typed, or what stands between two.
|
|
1318
|
-
- `data-segment="day | month | year | literal"`: Which piece it is.
|
|
1876
|
+
- `data-segment="era | day | month | year | literal"`: Which piece it is: the era only in a calendar of several eras.
|
|
1319
1877
|
- `data-placeholder`: Present on a part that is empty.
|
|
1320
1878
|
- `data-disabled`: Present when it is disabled.
|
|
1321
1879
|
- `data-invalid`: Present when the date is outside what it takes, or is asked for and half typed.
|
|
1322
1880
|
- trigger: The button that opens the popover, and what it is placed against.
|
|
1323
1881
|
- `data-popup-open`: Present when the popover is open.
|
|
1882
|
+
- `data-pressed`: Present while the popover a press on this trigger opened is open: it stays pressed, as a button held down.
|
|
1324
1883
|
- positioner: Places the popup against the trigger. It carries the geometry.
|
|
1325
1884
|
- `data-open`: Present when it is open.
|
|
1326
1885
|
- `data-closed`: Present when it is closed.
|
|
1327
1886
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
1328
1887
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
1888
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
1329
1889
|
- `--anchor-width`: The anchor's width.
|
|
1330
1890
|
- `--anchor-height`: The anchor's height.
|
|
1331
1891
|
- `--available-width`: The width between the anchor and the edge of the viewport.
|
|
1332
1892
|
- `--available-height`: The height between the anchor and the edge of the viewport.
|
|
1333
1893
|
- `--transform-origin`: The point of the popup nearest its anchor, to scale from.
|
|
1894
|
+
- `--positioner-width`: The popup's width, as its content lays it out: a design gives the positioner `width: var(--positioner-width)` to animate a change of size.
|
|
1895
|
+
- `--positioner-height`: The popup's height, as its content lays it out: a design gives the positioner `height: var(--positioner-height)` to animate a change of size.
|
|
1334
1896
|
- popup: The popover itself.
|
|
1335
1897
|
- `data-open`: Present when it is open.
|
|
1336
1898
|
- `data-closed`: Present when it is closed.
|
|
@@ -1338,6 +1900,9 @@ Attributes and CSS variables, by part:
|
|
|
1338
1900
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
1339
1901
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
1340
1902
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
1903
|
+
- `data-instant="click | dismiss"`: Present when it opened or closed in a way that should skip the motion: `click` when the keyboard pressed the trigger, `dismiss` when Escape closed it.
|
|
1904
|
+
- `--popup-width`: Its width: `auto`, and while its content changes size, the old width and then the new one, for a transition between them.
|
|
1905
|
+
- `--popup-height`: Its height: `auto`, and while its content changes size, the old height and then the new one, for a transition between them.
|
|
1341
1906
|
- calendar: The calendar.
|
|
1342
1907
|
- `data-disabled`: Present when it is disabled.
|
|
1343
1908
|
- `data-readonly`: Present when its value cannot be changed.
|
|
@@ -1346,21 +1911,26 @@ Attributes and CSS variables, by part:
|
|
|
1346
1911
|
- next: Shows the month after.
|
|
1347
1912
|
- `data-disabled`: Present when it is disabled.
|
|
1348
1913
|
- cell: A day's cell.
|
|
1349
|
-
- `data-selected`: Present on a chosen day,
|
|
1914
|
+
- `data-selected`: Present on a chosen day, on every day of a chosen range, and on each day of a list. Also on a copy of one (a day of the month before or after, shown in its own month too), which is drawn as the day is but has no aria-selected.
|
|
1350
1915
|
- `data-today`: Present on today.
|
|
1351
1916
|
- `data-outside-month`: Present on the days of the month before and after that fill the first and last weeks.
|
|
1352
1917
|
- `data-disabled`: Present when it is disabled.
|
|
1353
1918
|
- `data-unavailable`: Present on a day that cannot be chosen.
|
|
1354
|
-
- `data-range-start`: Present on the first day of a range.
|
|
1355
|
-
- `data-range-end`: Present on the last day of a range.
|
|
1919
|
+
- `data-range-start`: Present on the first day of a range, and on a copy of it.
|
|
1920
|
+
- `data-range-end`: Present on the last day of a range, and on a copy of it.
|
|
1356
1921
|
- day: The button for a day.
|
|
1357
|
-
- `data-selected`: Present on a chosen day,
|
|
1922
|
+
- `data-selected`: Present on a chosen day, on every day of a chosen range, and on each day of a list. Also on a copy of one (a day of the month before or after, shown in its own month too), which is drawn as the day is but has no aria-selected.
|
|
1358
1923
|
- `data-today`: Present on today.
|
|
1359
1924
|
- `data-outside-month`: Present on the days of the month before and after that fill the first and last weeks.
|
|
1360
1925
|
- `data-disabled`: Present when it is disabled.
|
|
1361
1926
|
- `data-unavailable`: Present on a day that cannot be chosen.
|
|
1362
|
-
- `data-range-start`: Present on the first day of a range.
|
|
1363
|
-
- `data-range-end`: Present on the last day of a range.
|
|
1927
|
+
- `data-range-start`: Present on the first day of a range, and on a copy of it.
|
|
1928
|
+
- `data-range-end`: Present on the last day of a range, and on a copy of it.
|
|
1929
|
+
- clear: Empties the value, and gives focus to the field. Disabled while there is none.
|
|
1930
|
+
- `data-disabled`: Present when it is disabled.
|
|
1931
|
+
- preset: Makes the value the day, or the range, it is given. Pressed while the value is that.
|
|
1932
|
+
- `data-pressed`: Present while the value is the one it gives.
|
|
1933
|
+
- `data-disabled`: Present when it is disabled.
|
|
1364
1934
|
|
|
1365
1935
|
### Dialog
|
|
1366
1936
|
|
|
@@ -1368,7 +1938,7 @@ Attributes and CSS variables, by part:
|
|
|
1368
1938
|
import { Dialog } from "@kirana-ui/react/dialog"
|
|
1369
1939
|
```
|
|
1370
1940
|
|
|
1371
|
-
Parts: `<Dialog.Root>`, `<Dialog.Trigger>`, `<Dialog.Portal>`, `<Dialog.Backdrop>`, `<Dialog.Popup>`, `<Dialog.Title>`, `<Dialog.Description>`, `<Dialog.Close>`.
|
|
1941
|
+
Parts: `<Dialog.Root>`, `<Dialog.Trigger>`, `<Dialog.Portal>`, `<Dialog.Backdrop>`, `<Dialog.Viewport>`, `<Dialog.Popup>`, `<Dialog.Title>`, `<Dialog.Description>`, `<Dialog.Close>`.
|
|
1372
1942
|
|
|
1373
1943
|
Anatomy:
|
|
1374
1944
|
|
|
@@ -1377,10 +1947,11 @@ Anatomy:
|
|
|
1377
1947
|
<Dialog.Trigger>
|
|
1378
1948
|
<Dialog.Portal>
|
|
1379
1949
|
<Dialog.Backdrop>
|
|
1380
|
-
<Dialog.
|
|
1381
|
-
<Dialog.
|
|
1382
|
-
|
|
1383
|
-
|
|
1950
|
+
<Dialog.Viewport> (optional)
|
|
1951
|
+
<Dialog.Popup>
|
|
1952
|
+
<Dialog.Title>
|
|
1953
|
+
<Dialog.Description>
|
|
1954
|
+
<Dialog.Close>
|
|
1384
1955
|
```
|
|
1385
1956
|
|
|
1386
1957
|
Props of its root:
|
|
@@ -1389,35 +1960,51 @@ Props of its root:
|
|
|
1389
1960
|
- `defaultOpen?: boolean`: Whether it starts open, when the caller does not hold `open`. Read once.
|
|
1390
1961
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as it is about to open or close: `details.cancel()` keeps it as it was.
|
|
1391
1962
|
- `modal?: boolean`: Blocks the page behind it and traps focus. Default `true`.
|
|
1963
|
+
- `disablePointerDismissal?: boolean`: Keeps it open when the pointer presses outside it. Default `false`. Escape always closes it: a caller who must keep it open cancels the change whose `details.reason` is `"escape-key"`.
|
|
1964
|
+
- `closeOnOutsidePress?: boolean`: Whether a press outside closes it. Default `true`.
|
|
1392
1965
|
- `dismissible?: boolean`: Whether a press outside closes it. Default `true`.
|
|
1393
1966
|
|
|
1394
1967
|
Each part, and its own props:
|
|
1395
1968
|
|
|
1396
1969
|
- `<Dialog.Root>` draws no element. Holds the dialog: whether it is open. Its props are above.
|
|
1397
1970
|
- `<Dialog.Trigger>` draws a `<button>`.
|
|
1971
|
+
- `disabled?: boolean`: It cannot be pressed: the button is disabled, and says so (`data-disabled`).
|
|
1398
1972
|
- `<Dialog.Portal>` draws no element. Draws no element of its own: its children at the end of `<body>`, or where a `PortalProvider` says.
|
|
1399
1973
|
- `<Dialog.Backdrop>` draws a `<div>`.
|
|
1974
|
+
- `<Dialog.Viewport>` draws a `<div>`.
|
|
1400
1975
|
- `<Dialog.Popup>` draws a `<div>`.
|
|
1401
1976
|
- `<Dialog.Title>` draws a `<h2>`. The heading that names the dialog.
|
|
1402
1977
|
- `<Dialog.Description>` draws a `<p>`. The text that describes the dialog.
|
|
1403
|
-
- `<Dialog.Close>` draws a `<button>`.
|
|
1978
|
+
- `<Dialog.Close>` draws a `<button>`.
|
|
1979
|
+
- `disabled?: boolean`: It cannot be pressed: the button is disabled, and says so (`data-disabled`).
|
|
1404
1980
|
|
|
1405
1981
|
Attributes and CSS variables, by part:
|
|
1406
1982
|
|
|
1407
1983
|
- trigger: The button that opens the dialog.
|
|
1408
1984
|
- `data-popup-open`: Present when the dialog is open.
|
|
1985
|
+
- `data-disabled`: Present when it is disabled.
|
|
1409
1986
|
- backdrop: The layer over the page behind the dialog.
|
|
1410
1987
|
- `data-open`: Present when it is open.
|
|
1411
1988
|
- `data-closed`: Present when it is closed.
|
|
1412
1989
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
1413
1990
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
1991
|
+
- viewport: What a long dialog scrolls in: it lies over the page, between the backdrop and the popup. A press on it beside the popup is a press outside the dialog; a press on its scrollbar is not.
|
|
1992
|
+
- `data-open`: Present when it is open.
|
|
1993
|
+
- `data-closed`: Present when it is closed.
|
|
1994
|
+
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
1995
|
+
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
1996
|
+
- `data-nested`: Present when the dialog opened over another dialog.
|
|
1997
|
+
- `data-nested-dialog-open`: Present when another dialog is open above this one.
|
|
1414
1998
|
- popup: The dialog itself.
|
|
1415
1999
|
- `data-open`: Present when it is open.
|
|
1416
2000
|
- `data-closed`: Present when it is closed.
|
|
1417
2001
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
1418
2002
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
2003
|
+
- `data-nested`: Present when the dialog opened over another dialog.
|
|
1419
2004
|
- `data-nested-dialog-open`: Present when another dialog is open above this one.
|
|
1420
2005
|
- `--nested-dialogs`: How many dialogs are open above this one.
|
|
2006
|
+
- close: A button that closes the dialog.
|
|
2007
|
+
- `data-disabled`: Present when it is disabled.
|
|
1421
2008
|
|
|
1422
2009
|
### Drawer
|
|
1423
2010
|
|
|
@@ -1446,6 +2033,8 @@ Props of its root:
|
|
|
1446
2033
|
- `defaultOpen?: boolean`: Whether it starts open, when the caller does not hold `open`. Read once.
|
|
1447
2034
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as it is about to open or close: `details.cancel()` keeps it as it was.
|
|
1448
2035
|
- `modal?: boolean`: Blocks the page behind it and traps focus. Default `true`.
|
|
2036
|
+
- `disablePointerDismissal?: boolean`: Keeps it open when the pointer presses outside it. Default `false`. Escape always closes it: a caller who must keep it open cancels the change whose `details.reason` is `"escape-key"`.
|
|
2037
|
+
- `closeOnOutsidePress?: boolean`: Whether a press outside closes it. Default `true`.
|
|
1449
2038
|
- `dismissible?: boolean`: Whether a press outside closes it. Default `true`.
|
|
1450
2039
|
- `swipeDirection?: DrawerSide`: The way it is dragged to close it: the edge it came from. Default: `"down"`.
|
|
1451
2040
|
- `snapPoints?: readonly DrawerSnapPoint[]`: Places it rests at, each how much of itself shows: a share (`0.4`, or `"40%"`) or a length (`"148px"`, `"20rem"`). `[0.4, 1]` is a drawer that opens two fifths shown and is dragged up to the whole. Without any, it is whole.
|
|
@@ -1457,32 +2046,39 @@ Each part, and its own props:
|
|
|
1457
2046
|
|
|
1458
2047
|
- `<Drawer.Root>` draws no element. Holds the dialog: whether it is open. Its props are above.
|
|
1459
2048
|
- `<Drawer.Trigger>` draws a `<button>`.
|
|
2049
|
+
- `disabled?: boolean`: It cannot be pressed: the button is disabled, and says so (`data-disabled`).
|
|
1460
2050
|
- `<Drawer.Portal>` draws no element. Draws no element of its own: its children at the end of `<body>`, or where a `PortalProvider` says.
|
|
1461
2051
|
- `<Drawer.Backdrop>` draws a `<div>`.
|
|
1462
2052
|
- `<Drawer.Popup>` draws a `<div>`.
|
|
1463
2053
|
- `<Drawer.Title>` draws a `<h2>`. The heading that names the dialog.
|
|
1464
2054
|
- `<Drawer.Description>` draws a `<p>`. The text that describes the dialog.
|
|
1465
|
-
- `<Drawer.Close>` draws a `<button>`.
|
|
2055
|
+
- `<Drawer.Close>` draws a `<button>`.
|
|
2056
|
+
- `disabled?: boolean`: It cannot be pressed: the button is disabled, and says so (`data-disabled`).
|
|
1466
2057
|
|
|
1467
2058
|
Attributes and CSS variables, by part:
|
|
1468
2059
|
|
|
1469
2060
|
- trigger: The button that opens the dialog.
|
|
1470
2061
|
- `data-popup-open`: Present when the dialog is open.
|
|
2062
|
+
- `data-disabled`: Present when it is disabled.
|
|
1471
2063
|
- backdrop: The layer over the page behind the dialog.
|
|
1472
2064
|
- `data-open`: Present when it is open.
|
|
1473
2065
|
- `data-closed`: Present when it is closed.
|
|
1474
2066
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
1475
2067
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
1476
2068
|
- `data-swiping`: Present while the drawer is dragged.
|
|
2069
|
+
- `data-swipe-dismiss`: Present once a drag has closed the drawer.
|
|
1477
2070
|
- `--drawer-swipe-movement-x`: How far it has been dragged across.
|
|
1478
2071
|
- `--drawer-swipe-movement-y`: How far it has been dragged up or down.
|
|
1479
2072
|
- `--drawer-swipe-progress`: How far it has been dragged, of its own size: 0 to 1.
|
|
1480
2073
|
- `--drawer-snap-point-offset`: How far from whole it rests, towards the edge it closes at: 0px at its largest snap point.
|
|
2074
|
+
- `--drawer-swipe-strength`: Always 1: the backdrop takes the design's own time to leave, however the drawer was thrown.
|
|
2075
|
+
- `--drawer-height`: While the drawer is dragged: the height of the drawer in front.
|
|
1481
2076
|
- popup: The drawer. A design moves it by what it says of the drag, and gives it `touch-action: none` where a finger drags it.
|
|
1482
2077
|
- `data-open`: Present when it is open.
|
|
1483
2078
|
- `data-closed`: Present when it is closed.
|
|
1484
2079
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
1485
2080
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
2081
|
+
- `data-nested`: Present when the dialog opened over another dialog.
|
|
1486
2082
|
- `data-nested-dialog-open`: Present when another dialog is open above this one.
|
|
1487
2083
|
- `data-swiping`: Present while the drawer is dragged.
|
|
1488
2084
|
- `data-swipe-direction="up | down | left | right"`: The way it is dragged to close it.
|
|
@@ -1500,6 +2096,123 @@ Attributes and CSS variables, by part:
|
|
|
1500
2096
|
- `--drawer-frontmost-height`: The height of the drawer in front of every other, while this one is open.
|
|
1501
2097
|
- `--drawer-swipe-strength`: Once let go: 0.1 to 1, the share of the design's own time it should take to come to rest. A drawer thrown hard arrives sooner.
|
|
1502
2098
|
- `--drawer-width`: Its width.
|
|
2099
|
+
- close: A button that closes the dialog.
|
|
2100
|
+
- `data-disabled`: Present when it is disabled.
|
|
2101
|
+
|
|
2102
|
+
### Editable
|
|
2103
|
+
|
|
2104
|
+
```
|
|
2105
|
+
import { Editable } from "@kirana-ui/react/editable"
|
|
2106
|
+
```
|
|
2107
|
+
|
|
2108
|
+
Parts: `<Editable.Root>`, `<Editable.Preview>`, `<Editable.Input>`, `<Editable.EditTrigger>`, `<Editable.SubmitTrigger>`, `<Editable.CancelTrigger>`.
|
|
2109
|
+
|
|
2110
|
+
Anatomy:
|
|
2111
|
+
|
|
2112
|
+
```
|
|
2113
|
+
<Editable.Root>
|
|
2114
|
+
<Editable.Preview>
|
|
2115
|
+
<Editable.Input>
|
|
2116
|
+
<Editable.EditTrigger> (optional)
|
|
2117
|
+
<Editable.SubmitTrigger> (optional)
|
|
2118
|
+
<Editable.CancelTrigger> (optional)
|
|
2119
|
+
```
|
|
2120
|
+
|
|
2121
|
+
Props of its root:
|
|
2122
|
+
|
|
2123
|
+
- `value?: string`: The text it holds: what the preview shows, and what editing starts from.
|
|
2124
|
+
- `defaultValue?: string`: The text it starts with, when the caller does not hold `value`. Read once. Default `""`.
|
|
2125
|
+
- `onValueChange?: (value: string, details: ChangeDetails) => void`: Heard as an edit is about to be kept: `details.cancel()` keeps the text, and the edit open.
|
|
2126
|
+
- `editing?: boolean`: Whether it is being edited, when the caller holds it.
|
|
2127
|
+
- `defaultEditing?: boolean`: Read once.
|
|
2128
|
+
- `onEditingChange?: (editing: boolean, details: ChangeDetails) => void`: Heard as editing is about to start or end: `details.cancel()` keeps it as it was.
|
|
2129
|
+
- `placeholder?: string`: What the preview shows while the text is empty. Default `""`.
|
|
2130
|
+
- `activation?: "focus" | "click" | "dblclick" | "none"`: What on the preview starts an edit: focus reaching it (the default), a press, two presses, or nothing, where only the edit trigger does.
|
|
2131
|
+
- `submitOnBlur?: boolean`: Whether focus leaving the input keeps the edit (the default) or drops it.
|
|
2132
|
+
- `selectOnFocus?: boolean`: Whether the text is selected as editing starts. Default `true`.
|
|
2133
|
+
- `disabled?: boolean`: Disabled: it cannot be edited.
|
|
2134
|
+
- `readOnly?: boolean`: Shown as it is, not editable.
|
|
2135
|
+
- `required?: boolean`: Needed: in a `Field`, leaving it empty is then invalid.
|
|
2136
|
+
- `name?: string`: With a name, the text is submitted with the form around it; in a `Field`, the field's by default.
|
|
2137
|
+
- `form?: string`: The id of the form the input belongs to, when it is not inside it.
|
|
2138
|
+
|
|
2139
|
+
Each part, and its own props:
|
|
2140
|
+
|
|
2141
|
+
- `<Editable.Root>` draws a `<div>`. Its props are above.
|
|
2142
|
+
- `<Editable.Preview>` draws a `<span>`.
|
|
2143
|
+
- `<Editable.Input>` draws a `<input>`.
|
|
2144
|
+
- `<Editable.EditTrigger>` draws a `<button>`.
|
|
2145
|
+
- `<Editable.SubmitTrigger>` draws a `<button>`.
|
|
2146
|
+
- `<Editable.CancelTrigger>` draws a `<button>`.
|
|
2147
|
+
|
|
2148
|
+
Attributes and CSS variables, by part:
|
|
2149
|
+
|
|
2150
|
+
- root: A text edited in place.
|
|
2151
|
+
- `data-editing`: Present while it is being edited.
|
|
2152
|
+
- `data-disabled`: Present when it is disabled.
|
|
2153
|
+
- `data-readonly`: Present when it is shown and cannot be edited.
|
|
2154
|
+
- `data-placeholder`: Present while it holds no text.
|
|
2155
|
+
- `data-touched`: In a field: present once focus has left it.
|
|
2156
|
+
- `data-dirty`: In a field: present while the text is not the one it began with.
|
|
2157
|
+
- `data-filled`: In a field: present while it holds text.
|
|
2158
|
+
- `data-focused`: In a field: present while it has focus.
|
|
2159
|
+
- `data-valid`: In a field: present once the text was checked and found right.
|
|
2160
|
+
- `data-invalid`: In a field: present while the text is wrong.
|
|
2161
|
+
- preview: The text as it reads, or the placeholder while there is none: hidden while editing.
|
|
2162
|
+
- `data-editing`: Present while it is being edited.
|
|
2163
|
+
- `data-disabled`: Present when it is disabled.
|
|
2164
|
+
- `data-readonly`: Present when it is shown and cannot be edited.
|
|
2165
|
+
- `data-placeholder`: Present while it holds no text.
|
|
2166
|
+
- `data-touched`: In a field: present once focus has left it.
|
|
2167
|
+
- `data-dirty`: In a field: present while the text is not the one it began with.
|
|
2168
|
+
- `data-filled`: In a field: present while it holds text.
|
|
2169
|
+
- `data-focused`: In a field: present while it has focus.
|
|
2170
|
+
- `data-valid`: In a field: present once the text was checked and found right.
|
|
2171
|
+
- `data-invalid`: In a field: present while the text is wrong.
|
|
2172
|
+
- input: Where the text is typed, an `<input>` or a `<textarea>`: hidden unless editing.
|
|
2173
|
+
- `data-editing`: Present while it is being edited.
|
|
2174
|
+
- `data-disabled`: Present when it is disabled.
|
|
2175
|
+
- `data-readonly`: Present when it is shown and cannot be edited.
|
|
2176
|
+
- `data-placeholder`: Present while it holds no text.
|
|
2177
|
+
- `data-touched`: In a field: present once focus has left it.
|
|
2178
|
+
- `data-dirty`: In a field: present while the text is not the one it began with.
|
|
2179
|
+
- `data-filled`: In a field: present while it holds text.
|
|
2180
|
+
- `data-focused`: In a field: present while it has focus.
|
|
2181
|
+
- `data-valid`: In a field: present once the text was checked and found right.
|
|
2182
|
+
- `data-invalid`: In a field: present while the text is wrong.
|
|
2183
|
+
- editTrigger: Starts an edit: hidden while editing.
|
|
2184
|
+
- `data-editing`: Present while it is being edited.
|
|
2185
|
+
- `data-disabled`: Present when it is disabled.
|
|
2186
|
+
- `data-readonly`: Present when it is shown and cannot be edited.
|
|
2187
|
+
- `data-placeholder`: Present while it holds no text.
|
|
2188
|
+
- `data-touched`: In a field: present once focus has left it.
|
|
2189
|
+
- `data-dirty`: In a field: present while the text is not the one it began with.
|
|
2190
|
+
- `data-filled`: In a field: present while it holds text.
|
|
2191
|
+
- `data-focused`: In a field: present while it has focus.
|
|
2192
|
+
- `data-valid`: In a field: present once the text was checked and found right.
|
|
2193
|
+
- `data-invalid`: In a field: present while the text is wrong.
|
|
2194
|
+
- submitTrigger: Keeps what was typed: hidden unless editing.
|
|
2195
|
+
- `data-editing`: Present while it is being edited.
|
|
2196
|
+
- `data-disabled`: Present when it is disabled.
|
|
2197
|
+
- `data-readonly`: Present when it is shown and cannot be edited.
|
|
2198
|
+
- `data-placeholder`: Present while it holds no text.
|
|
2199
|
+
- `data-touched`: In a field: present once focus has left it.
|
|
2200
|
+
- `data-dirty`: In a field: present while the text is not the one it began with.
|
|
2201
|
+
- `data-filled`: In a field: present while it holds text.
|
|
2202
|
+
- `data-focused`: In a field: present while it has focus.
|
|
2203
|
+
- `data-valid`: In a field: present once the text was checked and found right.
|
|
2204
|
+
- `data-invalid`: In a field: present while the text is wrong.
|
|
2205
|
+
- cancelTrigger: Drops what was typed: hidden unless editing.
|
|
2206
|
+
- `data-editing`: Present while it is being edited.
|
|
2207
|
+
- `data-disabled`: Present when it is disabled.
|
|
2208
|
+
- `data-readonly`: Present when it is shown and cannot be edited.
|
|
2209
|
+
- `data-placeholder`: Present while it holds no text.
|
|
2210
|
+
- `data-touched`: In a field: present once focus has left it.
|
|
2211
|
+
- `data-dirty`: In a field: present while the text is not the one it began with.
|
|
2212
|
+
- `data-filled`: In a field: present while it holds text.
|
|
2213
|
+
- `data-focused`: In a field: present while it has focus.
|
|
2214
|
+
- `data-valid`: In a field: present once the text was checked and found right.
|
|
2215
|
+
- `data-invalid`: In a field: present while the text is wrong.
|
|
1503
2216
|
|
|
1504
2217
|
### Field
|
|
1505
2218
|
|
|
@@ -1516,7 +2229,7 @@ Anatomy:
|
|
|
1516
2229
|
<Field.Label>
|
|
1517
2230
|
<Field.Control>
|
|
1518
2231
|
<Field.Description>
|
|
1519
|
-
<Field.Error>
|
|
2232
|
+
<Field.Error> (repeated)
|
|
1520
2233
|
<Field.Validity>
|
|
1521
2234
|
```
|
|
1522
2235
|
|
|
@@ -1527,7 +2240,7 @@ Props of its root:
|
|
|
1527
2240
|
- `invalid?: boolean`: Invalid whatever the value: an error known from elsewhere.
|
|
1528
2241
|
- `validate?: ( value: string ) => string | readonly string[] | null | Promise<string | readonly string[] | null>`: The field's own check, after the browser's: a message or several when the value is wrong, `null` when it is right. It may answer later, with a promise.
|
|
1529
2242
|
- `validationMode?: ValidationMode`: When the value is checked; the form's by default, else `"onSubmit"`.
|
|
1530
|
-
- `validationDebounceTime?: number`: With `"onChange"`, how long the value must rest before it is checked, in milliseconds.
|
|
2243
|
+
- `validationDebounceTime?: number`: With `"onChange"`, how long the value must rest before it is checked, in milliseconds. Default `0`.
|
|
1531
2244
|
|
|
1532
2245
|
Each part, and its own props:
|
|
1533
2246
|
|
|
@@ -1574,7 +2287,7 @@ Attributes and CSS variables, by part:
|
|
|
1574
2287
|
- `data-focused`: Present while the control has focus.
|
|
1575
2288
|
- `data-valid`: Present once the value has been checked and found right.
|
|
1576
2289
|
- `data-invalid`: Present while the value is wrong.
|
|
1577
|
-
- error: What is wrong with the value. In the page while it applies.
|
|
2290
|
+
- error: What is wrong with the value. In the page while it applies. Several, each with its own `match`, can be shown at once: each has an id of its own, and the control names them all.
|
|
1578
2291
|
- `data-disabled`: Present when it is disabled.
|
|
1579
2292
|
- `data-touched`: Present once focus has left the control.
|
|
1580
2293
|
- `data-dirty`: Present while the value is not the one it started with.
|
|
@@ -1616,6 +2329,103 @@ Attributes and CSS variables, by part:
|
|
|
1616
2329
|
- legend: The group's name.
|
|
1617
2330
|
- `data-disabled`: Present when it is disabled.
|
|
1618
2331
|
|
|
2332
|
+
### FileUpload
|
|
2333
|
+
|
|
2334
|
+
```
|
|
2335
|
+
import { FileUpload } from "@kirana-ui/react/file-upload"
|
|
2336
|
+
```
|
|
2337
|
+
|
|
2338
|
+
Parts: `<FileUpload.Root>`, `<FileUpload.Dropzone>`, `<FileUpload.Trigger>`, `<FileUpload.List>`, `<FileUpload.Items>`, `<FileUpload.Item>`, `<FileUpload.ItemName>`, `<FileUpload.ItemSize>`, `<FileUpload.ItemRemove>`, `<FileUpload.Clear>`.
|
|
2339
|
+
|
|
2340
|
+
Anatomy:
|
|
2341
|
+
|
|
2342
|
+
```
|
|
2343
|
+
<FileUpload.Root>
|
|
2344
|
+
<FileUpload.Dropzone>
|
|
2345
|
+
<FileUpload.Trigger> (optional, as above)
|
|
2346
|
+
<FileUpload.Trigger> (optional)
|
|
2347
|
+
<FileUpload.List>
|
|
2348
|
+
<FileUpload.Items>
|
|
2349
|
+
<FileUpload.Item> (repeated)
|
|
2350
|
+
<FileUpload.ItemName>
|
|
2351
|
+
<FileUpload.ItemSize> (optional)
|
|
2352
|
+
<FileUpload.ItemRemove> (optional)
|
|
2353
|
+
<FileUpload.Clear> (optional)
|
|
2354
|
+
```
|
|
2355
|
+
|
|
2356
|
+
Props of its root:
|
|
2357
|
+
|
|
2358
|
+
- `files?: readonly File[]`: The files it holds, in order.
|
|
2359
|
+
- `defaultFiles?: readonly File[]`: The files it starts with, when the caller does not hold `files`. Read once.
|
|
2360
|
+
- `onFilesChange?: (files: File[], details: ChangeDetails) => void`: Heard as the files are about to change: `details.cancel()` keeps them as they were.
|
|
2361
|
+
- `onFilesReject?: (rejections: FileRejection[]) => void`: Told the files that were not taken, each with its reasons.
|
|
2362
|
+
- `accept?: string | readonly string[]`: What may be taken, as a file input's `accept`: extensions (`".png"`), types (`"image/png"`) and kinds (`"image/*"`), in a list or one text with commas. Without it, anything.
|
|
2363
|
+
- `multiple?: boolean`: Whether several files are held. Default `false`: a file taken is the one held.
|
|
2364
|
+
- `maxFiles?: number`: With `multiple`, how many files it holds at most.
|
|
2365
|
+
- `maxSize?: number`: The largest a file may be, in bytes.
|
|
2366
|
+
- `minSize?: number`: The smallest a file may be, in bytes.
|
|
2367
|
+
- `validate?: (file: File) => boolean`: Whether a file may be taken, asked after the checks above.
|
|
2368
|
+
- `disabled?: boolean`: Disabled: no file can be taken or removed.
|
|
2369
|
+
- `required?: boolean`: Needed: in a `Field`, holding none is then invalid.
|
|
2370
|
+
- `name?: string`: With a name, the files are submitted with the form around them.
|
|
2371
|
+
- `form?: string`: The id of the form the control belongs to, when it is not inside it.
|
|
2372
|
+
|
|
2373
|
+
Each part, and its own props:
|
|
2374
|
+
|
|
2375
|
+
- `<FileUpload.Root>` draws a `<div>`. Its props are above.
|
|
2376
|
+
- `<FileUpload.Dropzone>` draws a `<div>`.
|
|
2377
|
+
- `<FileUpload.Trigger>` draws a `<button>`.
|
|
2378
|
+
- `<FileUpload.List>` draws a `<ul>`.
|
|
2379
|
+
- `<FileUpload.Items>` draws no element. The files, in order: each entry is given to draw.
|
|
2380
|
+
- `children: (entry: FileUploadEntry) => ReactNode`: Required. Draws one file, once for each.
|
|
2381
|
+
- `<FileUpload.Item>` draws a `<li>`.
|
|
2382
|
+
- `entry: FileUploadEntry`: Required. The file it is, as `Items` gave it.
|
|
2383
|
+
- `<FileUpload.ItemName>` draws a `<span>`.
|
|
2384
|
+
- `<FileUpload.ItemSize>` draws a `<span>`.
|
|
2385
|
+
- `locale?: string`: The language the number is written in. Default: the reader's.
|
|
2386
|
+
- `<FileUpload.ItemRemove>` draws a `<button>`.
|
|
2387
|
+
- `<FileUpload.Clear>` draws a `<button>`.
|
|
2388
|
+
|
|
2389
|
+
Attributes and CSS variables, by part:
|
|
2390
|
+
|
|
2391
|
+
- root: Files chosen to be sent.
|
|
2392
|
+
- `data-disabled`: Present when it is disabled.
|
|
2393
|
+
- `data-dragging`: Present while files are dragged over the dropzone.
|
|
2394
|
+
- `data-required`: Present when a file is needed.
|
|
2395
|
+
- `data-empty`: Present while it holds no file.
|
|
2396
|
+
- dropzone: Where files are dropped or pasted; pressed, it opens the file picker. It holds the hidden file input.
|
|
2397
|
+
- `data-disabled`: Present when it is disabled.
|
|
2398
|
+
- `data-dragging`: Present while files are dragged over the dropzone.
|
|
2399
|
+
- `data-required`: Present when a file is needed.
|
|
2400
|
+
- trigger: A button that opens the file picker.
|
|
2401
|
+
- `data-disabled`: Present when it is disabled.
|
|
2402
|
+
- `data-dragging`: Present while files are dragged over the dropzone.
|
|
2403
|
+
- `data-required`: Present when a file is needed.
|
|
2404
|
+
- list: What holds the files: a list.
|
|
2405
|
+
- `data-disabled`: Present when it is disabled.
|
|
2406
|
+
- `data-dragging`: Present while files are dragged over the dropzone.
|
|
2407
|
+
- `data-required`: Present when a file is needed.
|
|
2408
|
+
- item: A file.
|
|
2409
|
+
- `data-disabled`: Present when it is disabled.
|
|
2410
|
+
- `data-dragging`: Present while files are dragged over the dropzone.
|
|
2411
|
+
- `data-required`: Present when a file is needed.
|
|
2412
|
+
- itemName: A file's name.
|
|
2413
|
+
- `data-disabled`: Present when it is disabled.
|
|
2414
|
+
- `data-dragging`: Present while files are dragged over the dropzone.
|
|
2415
|
+
- `data-required`: Present when a file is needed.
|
|
2416
|
+
- itemSize: A file's size, as people read one.
|
|
2417
|
+
- `data-disabled`: Present when it is disabled.
|
|
2418
|
+
- `data-dragging`: Present while files are dragged over the dropzone.
|
|
2419
|
+
- `data-required`: Present when a file is needed.
|
|
2420
|
+
- itemRemove: A file's button that takes it away.
|
|
2421
|
+
- `data-disabled`: Present when it is disabled.
|
|
2422
|
+
- `data-dragging`: Present while files are dragged over the dropzone.
|
|
2423
|
+
- `data-required`: Present when a file is needed.
|
|
2424
|
+
- clear: Takes every file away: hidden while there is none.
|
|
2425
|
+
- `data-disabled`: Present when it is disabled.
|
|
2426
|
+
- `data-dragging`: Present while files are dragged over the dropzone.
|
|
2427
|
+
- `data-required`: Present when a file is needed.
|
|
2428
|
+
|
|
1619
2429
|
### Form
|
|
1620
2430
|
|
|
1621
2431
|
```
|
|
@@ -1655,8 +2465,8 @@ Props of its root:
|
|
|
1655
2465
|
- `open?: boolean`: Whether it is open, when the caller holds it.
|
|
1656
2466
|
- `defaultOpen?: boolean`: Whether it starts open, when the caller does not hold `open`. Read once.
|
|
1657
2467
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as it is about to open or close: `details.cancel()` keeps it as it was.
|
|
1658
|
-
- `delay?: number`: How long the pointer rests on the trigger before the popup opens, in milliseconds.
|
|
1659
|
-
- `closeDelay?: number`: How long after the pointer leaves the popup closes, in milliseconds.
|
|
2468
|
+
- `delay?: number`: How long the pointer rests on the trigger before the popup opens, in milliseconds. Default `600`.
|
|
2469
|
+
- `closeDelay?: number`: How long after the pointer leaves the popup closes, in milliseconds. Default `300`.
|
|
1660
2470
|
- `disabled?: boolean`: Disabled: the pointer and focus do not open it.
|
|
1661
2471
|
|
|
1662
2472
|
Each part, and its own props:
|
|
@@ -1679,11 +2489,14 @@ Attributes and CSS variables, by part:
|
|
|
1679
2489
|
- `data-closed`: Present when it is closed.
|
|
1680
2490
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
1681
2491
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
2492
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
1682
2493
|
- `--anchor-width`: The anchor's width.
|
|
1683
2494
|
- `--anchor-height`: The anchor's height.
|
|
1684
2495
|
- `--available-width`: The width between the anchor and the edge of the viewport.
|
|
1685
2496
|
- `--available-height`: The height between the anchor and the edge of the viewport.
|
|
1686
2497
|
- `--transform-origin`: The point of the popup nearest its anchor, to scale from.
|
|
2498
|
+
- `--positioner-width`: The popup's width, as its content lays it out: a design gives the positioner `width: var(--positioner-width)` to animate a change of size.
|
|
2499
|
+
- `--positioner-height`: The popup's height, as its content lays it out: a design gives the positioner `height: var(--positioner-height)` to animate a change of size.
|
|
1687
2500
|
- popup: The card itself.
|
|
1688
2501
|
- `data-open`: Present when it is open.
|
|
1689
2502
|
- `data-closed`: Present when it is closed.
|
|
@@ -1693,6 +2506,8 @@ Attributes and CSS variables, by part:
|
|
|
1693
2506
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
1694
2507
|
- `data-instant="delay | focus | dismiss"`: Present when it opened or closed without its usual wait, for a design that skips the motion then.
|
|
1695
2508
|
- arrow: An element that points at the trigger, placed along the popup's edge.
|
|
2509
|
+
- `data-open`: Present when it is open.
|
|
2510
|
+
- `data-closed`: Present when it is closed.
|
|
1696
2511
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
1697
2512
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
1698
2513
|
- `data-uncentered`: Present when the popup was pushed along its edge, so the arrow is not at the trigger's centre.
|
|
@@ -1832,7 +2647,8 @@ Props of its root:
|
|
|
1832
2647
|
- `defaultOpen?: boolean`: Whether it starts open, when the caller does not hold `open`. Read once.
|
|
1833
2648
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as it is about to open or close: `details.cancel()` keeps it as it was.
|
|
1834
2649
|
- `disabled?: boolean`: The trigger cannot be pressed; a submenu's is passed over.
|
|
1835
|
-
- `
|
|
2650
|
+
- `loopFocus?: boolean`: Whether the arrows go round from the last item to the first. Default: they do.
|
|
2651
|
+
- `loop?: boolean`: Whether the arrows wrap from the last item to the first.
|
|
1836
2652
|
- `modal?: boolean`: Holds the page while the menu is open: its scroll is locked, and a press outside closes the menu and reaches nothing. Default: it does not. Not for a submenu.
|
|
1837
2653
|
|
|
1838
2654
|
Each part, and its own props:
|
|
@@ -1846,18 +2662,21 @@ Each part, and its own props:
|
|
|
1846
2662
|
- `<Menu.Item>` draws a `<div>`.
|
|
1847
2663
|
- `disabled?: boolean`: Disables this item: it cannot be pressed, and the arrows pass over it.
|
|
1848
2664
|
- `label?: string`: What typing matches; the item's text when left out.
|
|
1849
|
-
- `
|
|
2665
|
+
- `closeOnSelect?: boolean`: Whether choosing the item closes the menu. Default: it does for an item, and does not for a checkbox or a radio item.
|
|
2666
|
+
- `closeOnClick?: boolean`: Whether choosing the item closes the menu.
|
|
1850
2667
|
- `<Menu.LinkItem>` draws a `<a>`.
|
|
1851
2668
|
- `disabled?: boolean`: Disables this item: it cannot be pressed, and the arrows pass over it.
|
|
1852
2669
|
- `label?: string`: What typing matches; the item's text when left out.
|
|
1853
|
-
- `
|
|
2670
|
+
- `closeOnSelect?: boolean`: Whether choosing the item closes the menu. Default: it does for an item, and does not for a checkbox or a radio item.
|
|
2671
|
+
- `closeOnClick?: boolean`: Whether choosing the item closes the menu.
|
|
1854
2672
|
- `<Menu.Group>` draws a `<div>`. Items that belong together, named by their label.
|
|
1855
2673
|
- `<Menu.GroupLabel>` draws a `<div>`. The name of a group. Outside a group it is plain text, and names nothing.
|
|
1856
2674
|
- `<Menu.Separator>` draws a `<div>`. A line between items.
|
|
1857
2675
|
- `<Menu.CheckboxItem>` draws a `<div>`.
|
|
1858
2676
|
- `disabled?: boolean`: Disables this item: it cannot be pressed, and the arrows pass over it.
|
|
1859
2677
|
- `label?: string`: What typing matches; the item's text when left out.
|
|
1860
|
-
- `
|
|
2678
|
+
- `closeOnSelect?: boolean`: Whether choosing the item closes the menu. Default: it does for an item, and does not for a checkbox or a radio item.
|
|
2679
|
+
- `closeOnClick?: boolean`: Whether choosing the item closes the menu.
|
|
1861
2680
|
- `checked?: boolean`: Whether the item is checked, when the caller holds it.
|
|
1862
2681
|
- `defaultChecked?: boolean`: Whether the item starts checked, when the caller does not hold `checked`. Read once.
|
|
1863
2682
|
- `onCheckedChange?: (checked: boolean, details: ChangeDetails) => void`: Heard as the item is about to be checked or unchecked: `details.cancel()` keeps it as it was.
|
|
@@ -1871,7 +2690,8 @@ Each part, and its own props:
|
|
|
1871
2690
|
- `<Menu.RadioItem>` draws a `<div>`.
|
|
1872
2691
|
- `disabled?: boolean`: Disables this item: it cannot be pressed, and the arrows pass over it.
|
|
1873
2692
|
- `label?: string`: What typing matches; the item's text when left out.
|
|
1874
|
-
- `
|
|
2693
|
+
- `closeOnSelect?: boolean`: Whether choosing the item closes the menu. Default: it does for an item, and does not for a checkbox or a radio item.
|
|
2694
|
+
- `closeOnClick?: boolean`: Whether choosing the item closes the menu.
|
|
1875
2695
|
- `value: unknown`: Required. What the radio group's value is while this item is the chosen one.
|
|
1876
2696
|
- `<Menu.RadioItemIndicator>` draws a `<span>`.
|
|
1877
2697
|
- `keepMounted?: boolean`: Keeps the mark in the page while its item is not checked.
|
|
@@ -1880,7 +2700,8 @@ Each part, and its own props:
|
|
|
1880
2700
|
- `defaultOpen?: boolean`: Whether it starts open, when the caller does not hold `open`. Read once.
|
|
1881
2701
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as it is about to open or close: `details.cancel()` keeps it as it was.
|
|
1882
2702
|
- `disabled?: boolean`: The trigger cannot be pressed; a submenu's is passed over.
|
|
1883
|
-
- `
|
|
2703
|
+
- `loopFocus?: boolean`: Whether the arrows go round from the last item to the first. Default: they do.
|
|
2704
|
+
- `loop?: boolean`: Whether the arrows wrap from the last item to the first.
|
|
1884
2705
|
- `modal?: boolean`: Holds the page while the menu is open: its scroll is locked, and a press outside closes the menu and reaches nothing. Default: it does not. Not for a submenu.
|
|
1885
2706
|
- `<Menu.SubmenuTrigger>` draws a `<div>`.
|
|
1886
2707
|
|
|
@@ -1888,17 +2709,21 @@ Attributes and CSS variables, by part:
|
|
|
1888
2709
|
|
|
1889
2710
|
- trigger: The button that opens the menu, and what it is placed against.
|
|
1890
2711
|
- `data-popup-open`: Present when the menu is open.
|
|
2712
|
+
- `data-pressed`: Present while its popup is open: it stays pressed, as a button held down.
|
|
1891
2713
|
- `data-disabled`: Present when it is disabled.
|
|
1892
2714
|
- positioner: Places the menu against its trigger. It carries the geometry.
|
|
1893
2715
|
- `data-open`: Present when it is open.
|
|
1894
2716
|
- `data-closed`: Present when it is closed.
|
|
1895
2717
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
1896
2718
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
2719
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
1897
2720
|
- `--anchor-width`: The anchor's width.
|
|
1898
2721
|
- `--anchor-height`: The anchor's height.
|
|
1899
2722
|
- `--available-width`: The width between the anchor and the edge of the viewport.
|
|
1900
2723
|
- `--available-height`: The height between the anchor and the edge of the viewport.
|
|
1901
2724
|
- `--transform-origin`: The point of the popup nearest its anchor, to scale from.
|
|
2725
|
+
- `--positioner-width`: The popup's width, as its content lays it out: a design gives the positioner `width: var(--positioner-width)` to animate a change of size.
|
|
2726
|
+
- `--positioner-height`: The popup's height, as its content lays it out: a design gives the positioner `height: var(--positioner-height)` to animate a change of size.
|
|
1902
2727
|
- popup: The menu itself: the list of items.
|
|
1903
2728
|
- `data-open`: Present when it is open.
|
|
1904
2729
|
- `data-closed`: Present when it is closed.
|
|
@@ -1906,7 +2731,10 @@ Attributes and CSS variables, by part:
|
|
|
1906
2731
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
1907
2732
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
1908
2733
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
2734
|
+
- `data-instant="click | dismiss | group"`: Present when it opened or closed in a way that should skip the motion: `click` when the keyboard pressed its trigger or an item, `dismiss` when Escape closed it, `group` when focus or the pointer went from one menu of a bar to another.
|
|
1909
2735
|
- arrow: An element that points at the trigger.
|
|
2736
|
+
- `data-open`: Present when it is open.
|
|
2737
|
+
- `data-closed`: Present when it is closed.
|
|
1910
2738
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
1911
2739
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
1912
2740
|
- `data-uncentered`: Present when the arrow cannot sit at the trigger's centre.
|
|
@@ -1947,9 +2775,11 @@ import { Menubar } from "@kirana-ui/react/menubar"
|
|
|
1947
2775
|
|
|
1948
2776
|
Props:
|
|
1949
2777
|
|
|
1950
|
-
- `
|
|
2778
|
+
- `loopFocus?: boolean`: Whether the arrows go round from the last menu to the first. Default: they do.
|
|
2779
|
+
- `loop?: boolean`: Whether the arrows wrap from the last item to the first.
|
|
1951
2780
|
- `disabled?: boolean`: No menu of the bar opens.
|
|
1952
2781
|
- `orientation?: Orientation`: A row (the default) or a column of menus. In a column a menu opens beside its trigger.
|
|
2782
|
+
- `modal?: boolean`: Holds the page while one of its menus is open, as a menu's own `modal` does: its scroll is locked, and a press outside closes the menu and reaches nothing. Default: it does not. Read as a menu opens.
|
|
1953
2783
|
|
|
1954
2784
|
`<Menubar>` draws a `<div>`.
|
|
1955
2785
|
|
|
@@ -1957,6 +2787,8 @@ Attributes and CSS variables, by part:
|
|
|
1957
2787
|
|
|
1958
2788
|
- root: The row of menus. A menu inside it is one of its items.
|
|
1959
2789
|
- `data-disabled`: Present when it is disabled.
|
|
2790
|
+
- `data-modal`: Present when its menus hold the page while one is open.
|
|
2791
|
+
- `data-has-submenu-open`: Present while one of its menus is open.
|
|
1960
2792
|
- `data-orientation="horizontal | vertical"`: Whether its menus are in a row or a column.
|
|
1961
2793
|
|
|
1962
2794
|
### MessageScroller
|
|
@@ -2067,8 +2899,8 @@ Props of its root:
|
|
|
2067
2899
|
- `value?: Value | null`: The item whose content is shown; `null` is "none".
|
|
2068
2900
|
- `defaultValue?: Value | null`: The item whose content it starts with, when the caller does not hold `value`. Read once.
|
|
2069
2901
|
- `onValueChange?: (value: Value | null, details: ChangeDetails) => void`: Heard as another item's content is about to show, or none: `details.cancel()` keeps the value as it was.
|
|
2070
|
-
- `delay?: number`: How long the pointer rests on a trigger before its content shows, in milliseconds.
|
|
2071
|
-
- `closeDelay?: number`: How long after the pointer leaves the content goes, in milliseconds.
|
|
2902
|
+
- `delay?: number`: How long the pointer rests on a trigger before its content shows, in milliseconds. Default `50`.
|
|
2903
|
+
- `closeDelay?: number`: How long after the pointer leaves the content goes, in milliseconds. Default `50`.
|
|
2072
2904
|
- `orientation?: Orientation`: Whether the triggers are laid out across (the default) or down: the arrows that move between them follow.
|
|
2073
2905
|
|
|
2074
2906
|
Each part, and its own props:
|
|
@@ -2078,11 +2910,13 @@ Each part, and its own props:
|
|
|
2078
2910
|
- `<NavigationMenu.Item>` draws a `<li>`. One item of the list: a link, or a trigger with its content. Its `value` tells it from the others; an item that is given none makes its own.
|
|
2079
2911
|
- `value?: unknown`: What tells this item from the others: the menu's `value` while its content is shown. An item that is given none makes its own.
|
|
2080
2912
|
- `<NavigationMenu.Trigger>` draws a `<button>`.
|
|
2913
|
+
- `disabled?: boolean`: The trigger cannot be pressed, and the pointer resting on it shows nothing.
|
|
2081
2914
|
- `<NavigationMenu.Icon>` draws a `<span>`.
|
|
2082
2915
|
- `<NavigationMenu.Content>` draws a `<div>`.
|
|
2083
2916
|
- `<NavigationMenu.Link>` draws a `<a>`.
|
|
2084
2917
|
- `active?: boolean`: The link is the page the reader is on.
|
|
2085
|
-
- `
|
|
2918
|
+
- `closeOnSelect?: boolean`: Whether following it closes the menu. Default: it does.
|
|
2919
|
+
- `closeOnClick?: boolean`: Whether following it closes the menu.
|
|
2086
2920
|
- `<NavigationMenu.Portal>` draws no element. Draws no element of its own: its children at the end of `<body>`, or where a `PortalProvider` says.
|
|
2087
2921
|
- `<NavigationMenu.Positioner>` draws a `<div>`. Takes the positioner options ("Positioner options", above).
|
|
2088
2922
|
- `<NavigationMenu.Popup>` draws a `<div>`.
|
|
@@ -2094,10 +2928,15 @@ Attributes and CSS variables, by part:
|
|
|
2094
2928
|
|
|
2095
2929
|
- root: The navigation.
|
|
2096
2930
|
- `data-orientation="horizontal | vertical"`: Whether the list is a row or a column.
|
|
2931
|
+
- `data-open`: Present while an item's content is shown.
|
|
2932
|
+
- `data-nested`: Present on a navigation menu inside another's content: a submenu of it.
|
|
2097
2933
|
- list: The row of items.
|
|
2098
2934
|
- `data-orientation="horizontal | vertical"`: Whether the list is a row or a column.
|
|
2935
|
+
- `data-open`: Present while an item's content is shown.
|
|
2099
2936
|
- trigger: The button that shows an item's content.
|
|
2100
2937
|
- `data-popup-open`: Present while the item's content is shown.
|
|
2938
|
+
- `data-pressed`: Present while its popup is open: it stays pressed, as a button held down.
|
|
2939
|
+
- `data-disabled`: Present when it is disabled.
|
|
2101
2940
|
- icon: A mark on a trigger that shows whether its content is open.
|
|
2102
2941
|
- `data-popup-open`: Present while the item's content is shown.
|
|
2103
2942
|
- content: What an item shows. It is drawn in the viewport every item shares.
|
|
@@ -2105,7 +2944,7 @@ Attributes and CSS variables, by part:
|
|
|
2105
2944
|
- `data-closed`: Present when it is closed.
|
|
2106
2945
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
2107
2946
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
2108
|
-
- `data-activation-direction="left | right"`: Which way it came from: the item before it, or after.
|
|
2947
|
+
- `data-activation-direction="left | right | up | down"`: Which way it came from: the item before it, or after; `up` and `down` when the list is a column.
|
|
2109
2948
|
- link: A link, in the list or in an item's content.
|
|
2110
2949
|
- `data-active`: Present on the link of the page the reader is on.
|
|
2111
2950
|
- positioner: Places the popup against the open item's trigger. It carries the geometry.
|
|
@@ -2113,6 +2952,8 @@ Attributes and CSS variables, by part:
|
|
|
2113
2952
|
- `data-closed`: Present when it is closed.
|
|
2114
2953
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
2115
2954
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
2955
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
2956
|
+
- `data-instant`: Present while it should move at once: as it is first drawn, and while the window is resized.
|
|
2116
2957
|
- `--anchor-width`: The anchor's width.
|
|
2117
2958
|
- `--anchor-height`: The anchor's height.
|
|
2118
2959
|
- `--available-width`: The width between the anchor and the edge of the viewport.
|
|
@@ -2127,9 +2968,12 @@ Attributes and CSS variables, by part:
|
|
|
2127
2968
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
2128
2969
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
2129
2970
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
2971
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
2130
2972
|
- `--popup-width`: The open content's width.
|
|
2131
2973
|
- `--popup-height`: The open content's height.
|
|
2132
2974
|
- arrow: An element that points at the open item's trigger.
|
|
2975
|
+
- `data-open`: Present when it is open.
|
|
2976
|
+
- `data-closed`: Present when it is closed.
|
|
2133
2977
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
2134
2978
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
2135
2979
|
- `data-uncentered`: Present when the arrow cannot sit at the trigger's centre.
|
|
@@ -2145,7 +2989,7 @@ Attributes and CSS variables, by part:
|
|
|
2145
2989
|
import { NumberField } from "@kirana-ui/react/number-field"
|
|
2146
2990
|
```
|
|
2147
2991
|
|
|
2148
|
-
Parts: `<NumberField.Root>`, `<NumberField.Group>`, `<NumberField.Input>`, `<NumberField.Increment>`, `<NumberField.Decrement>`.
|
|
2992
|
+
Parts: `<NumberField.Root>`, `<NumberField.Group>`, `<NumberField.Input>`, `<NumberField.Increment>`, `<NumberField.Decrement>`, `<NumberField.ScrubArea>`, `<NumberField.ScrubAreaCursor>`.
|
|
2149
2993
|
|
|
2150
2994
|
Anatomy:
|
|
2151
2995
|
|
|
@@ -2155,6 +2999,8 @@ Anatomy:
|
|
|
2155
2999
|
<NumberField.Input>
|
|
2156
3000
|
<NumberField.Increment>
|
|
2157
3001
|
<NumberField.Decrement>
|
|
3002
|
+
<NumberField.ScrubArea>
|
|
3003
|
+
<NumberField.ScrubAreaCursor>
|
|
2158
3004
|
```
|
|
2159
3005
|
|
|
2160
3006
|
Props of its root:
|
|
@@ -2177,6 +3023,7 @@ Props of its root:
|
|
|
2177
3023
|
- `required?: boolean`: Needed: in a `Field`, leaving it empty is then invalid.
|
|
2178
3024
|
- `name?: string`: With a name, the number is submitted with the form around it.
|
|
2179
3025
|
- `form?: string`: The id of the form the control belongs to, when it is not inside it.
|
|
3026
|
+
- `id?: string`: What its input's id is made from: the input is `<id>-input`, which a `<label for>` names. Inside a `Field`, the input takes the field's id instead.
|
|
2180
3027
|
|
|
2181
3028
|
Each part, and its own props:
|
|
2182
3029
|
|
|
@@ -2185,6 +3032,11 @@ Each part, and its own props:
|
|
|
2185
3032
|
- `<NumberField.Input>` draws a `<input>`.
|
|
2186
3033
|
- `<NumberField.Increment>` draws a `<button>`.
|
|
2187
3034
|
- `<NumberField.Decrement>` draws a `<button>`.
|
|
3035
|
+
- `<NumberField.ScrubArea>` draws a `<span>`.
|
|
3036
|
+
- `direction?: "horizontal" | "vertical"`: The way the pointer is dragged to change the number: `"horizontal"`, where right is more, or `"vertical"`, where up is more. Default `"horizontal"`.
|
|
3037
|
+
- `pixelSensitivity?: number`: How many pixels the pointer moves before the number changes: more is slower. Default 2.
|
|
3038
|
+
- `teleportDistance?: number`: How far past the scrub area's edges the drawn cursor goes before it comes back in at the other side, in pixels, half of it at each edge. Default: the edges of the window.
|
|
3039
|
+
- `<NumberField.ScrubAreaCursor>` draws a `<span>`.
|
|
2188
3040
|
|
|
2189
3041
|
Attributes and CSS variables, by part:
|
|
2190
3042
|
|
|
@@ -2196,6 +3048,7 @@ Attributes and CSS variables, by part:
|
|
|
2196
3048
|
- `data-dirty`: Present while the number is not the one it started with.
|
|
2197
3049
|
- `data-filled`: Present while there is a number.
|
|
2198
3050
|
- `data-focused`: Present while the input has focus.
|
|
3051
|
+
- `data-scrubbing`: Present while the number is dragged from its scrub area.
|
|
2199
3052
|
- `data-valid`: In a field: present once the number was checked and found right.
|
|
2200
3053
|
- `data-invalid`: In a field: present while the number is wrong.
|
|
2201
3054
|
- group: What holds the input and its buttons, as one control.
|
|
@@ -2206,6 +3059,7 @@ Attributes and CSS variables, by part:
|
|
|
2206
3059
|
- `data-dirty`: Present while the number is not the one it started with.
|
|
2207
3060
|
- `data-filled`: Present while there is a number.
|
|
2208
3061
|
- `data-focused`: Present while the input has focus.
|
|
3062
|
+
- `data-scrubbing`: Present while the number is dragged from its scrub area.
|
|
2209
3063
|
- `data-valid`: In a field: present once the number was checked and found right.
|
|
2210
3064
|
- `data-invalid`: In a field: present while the number is wrong.
|
|
2211
3065
|
- input: The text input: it takes what its locale writes a number with.
|
|
@@ -2216,6 +3070,7 @@ Attributes and CSS variables, by part:
|
|
|
2216
3070
|
- `data-dirty`: Present while the number is not the one it started with.
|
|
2217
3071
|
- `data-filled`: Present while there is a number.
|
|
2218
3072
|
- `data-focused`: Present while the input has focus.
|
|
3073
|
+
- `data-scrubbing`: Present while the number is dragged from its scrub area.
|
|
2219
3074
|
- `data-valid`: In a field: present once the number was checked and found right.
|
|
2220
3075
|
- `data-invalid`: In a field: present while the number is wrong.
|
|
2221
3076
|
- increment: A button that steps the number up. Held, it goes on.
|
|
@@ -2226,6 +3081,7 @@ Attributes and CSS variables, by part:
|
|
|
2226
3081
|
- `data-dirty`: Present while the number is not the one it started with.
|
|
2227
3082
|
- `data-filled`: Present while there is a number.
|
|
2228
3083
|
- `data-focused`: Present while the input has focus.
|
|
3084
|
+
- `data-scrubbing`: Present while the number is dragged from its scrub area.
|
|
2229
3085
|
- `data-valid`: In a field: present once the number was checked and found right.
|
|
2230
3086
|
- `data-invalid`: In a field: present while the number is wrong.
|
|
2231
3087
|
- decrement: A button that steps the number down. Held, it goes on.
|
|
@@ -2236,6 +3092,29 @@ Attributes and CSS variables, by part:
|
|
|
2236
3092
|
- `data-dirty`: Present while the number is not the one it started with.
|
|
2237
3093
|
- `data-filled`: Present while there is a number.
|
|
2238
3094
|
- `data-focused`: Present while the input has focus.
|
|
3095
|
+
- `data-scrubbing`: Present while the number is dragged from its scrub area.
|
|
3096
|
+
- `data-valid`: In a field: present once the number was checked and found right.
|
|
3097
|
+
- `data-invalid`: In a field: present while the number is wrong.
|
|
3098
|
+
- scrubArea: An area that is pressed and dragged to change the number: the field's label, as a rule. It takes `direction`, `pixelSensitivity` and `teleportDistance`. A mouse's pointer is locked for the drag where the browser has that (not in Safari); a finger drags as it is.
|
|
3099
|
+
- `data-disabled`: Present when it is disabled.
|
|
3100
|
+
- `data-readonly`: Present when the number cannot be changed.
|
|
3101
|
+
- `data-required`: Present when a number must be given.
|
|
3102
|
+
- `data-touched`: Present once focus has left the input.
|
|
3103
|
+
- `data-dirty`: Present while the number is not the one it started with.
|
|
3104
|
+
- `data-filled`: Present while there is a number.
|
|
3105
|
+
- `data-focused`: Present while the input has focus.
|
|
3106
|
+
- `data-scrubbing`: Present while the number is dragged from its scrub area.
|
|
3107
|
+
- `data-valid`: In a field: present once the number was checked and found right.
|
|
3108
|
+
- `data-invalid`: In a field: present while the number is wrong.
|
|
3109
|
+
- scrubAreaCursor: What is drawn in place of the pointer while it is locked for a drag: in the page only then, at the end of `<body>`, placed by the component.
|
|
3110
|
+
- `data-disabled`: Present when it is disabled.
|
|
3111
|
+
- `data-readonly`: Present when the number cannot be changed.
|
|
3112
|
+
- `data-required`: Present when a number must be given.
|
|
3113
|
+
- `data-touched`: Present once focus has left the input.
|
|
3114
|
+
- `data-dirty`: Present while the number is not the one it started with.
|
|
3115
|
+
- `data-filled`: Present while there is a number.
|
|
3116
|
+
- `data-focused`: Present while the input has focus.
|
|
3117
|
+
- `data-scrubbing`: Present while the number is dragged from its scrub area.
|
|
2239
3118
|
- `data-valid`: In a field: present once the number was checked and found right.
|
|
2240
3119
|
- `data-invalid`: In a field: present while the number is wrong.
|
|
2241
3120
|
|
|
@@ -2262,13 +3141,19 @@ Props of its root:
|
|
|
2262
3141
|
|
|
2263
3142
|
- `length?: number`: How many characters the code has. Default: 6.
|
|
2264
3143
|
- `value?: string`: The characters typed so far, when the caller holds them.
|
|
2265
|
-
- `defaultValue?: string`: The characters it starts with, when the caller does not hold `value`. Read once.
|
|
3144
|
+
- `defaultValue?: string`: The characters it starts with, when the caller does not hold `value`. Read once. Default `""`.
|
|
2266
3145
|
- `onValueChange?: (value: string, details: ChangeDetails) => void`: Heard as the characters are about to change: `details.cancel()` keeps them as they were.
|
|
2267
|
-
- `
|
|
2268
|
-
- `
|
|
3146
|
+
- `onValueComplete?: (value: string, details: ChangeDetails) => void`: Every character is in: the moment to send the code. `details` are those of the change that filled it (`reason`, `event`, `source`).
|
|
3147
|
+
- `onComplete?: (value: string) => void`: Every character is in.
|
|
3148
|
+
- `validationType?: OtpValidation`: What a character may be: a digit (`numeric`), a letter (`alpha`, `a` to `z` either case), either (`alphanumeric`), or anything but white space (`none`: no rule beyond that). It also says which keyboard a phone shows: the digits' for `numeric`, letters' otherwise. Default: `numeric`, on purpose: a one-time code is digits, and its keyboard is then the one to type them on. `alphabetic` and `text` are older spellings of `alpha` and `none`, still read.
|
|
3149
|
+
- `mode?: OtpValidation`: What a character may be.
|
|
3150
|
+
- `pattern?: string`: What else a character may be: a regular expression, as text, that one character must match whole (`"[A-F0-9]"`), in place of `validationType`'s rule. Text, as an attribute can only be, so it is given the same way on every framework and on a custom element. With a pattern, `validationType` only says the keyboard, and defaults to `none`.
|
|
2269
3151
|
- `disabled?: boolean`: Disabled: it cannot be changed.
|
|
3152
|
+
- `readOnly?: boolean`: Shown as it is, focusable, not changeable.
|
|
3153
|
+
- `required?: boolean`: Needed: in a `Field`, an empty code is then invalid.
|
|
2270
3154
|
- `name?: string`: With a name, the code is submitted with the form around it.
|
|
2271
3155
|
- `form?: string`: The id of the form the input belongs to, when it is not inside it.
|
|
3156
|
+
- `id?: string`: The id of its input, not of the root: a `<label for>` names it.
|
|
2272
3157
|
|
|
2273
3158
|
Each part, and its own props:
|
|
2274
3159
|
|
|
@@ -2283,16 +3168,31 @@ Each part, and its own props:
|
|
|
2283
3168
|
Attributes and CSS variables, by part:
|
|
2284
3169
|
|
|
2285
3170
|
- root: The code: the input and its cells.
|
|
2286
|
-
- `data-
|
|
3171
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
3172
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
3173
|
+
- `data-filled`: Present when the code has a character in it.
|
|
2287
3174
|
- `data-focused`: Present while the input has focus.
|
|
3175
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
3176
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
3177
|
+
- `data-disabled`: Present when it is disabled.
|
|
3178
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
3179
|
+
- `data-required`: Present when the form needs it.
|
|
2288
3180
|
- `data-complete`: Present when every character is in.
|
|
2289
3181
|
- input: The one input the code is typed in. A design lays it over the cells, unseen.
|
|
2290
3182
|
- `data-disabled`: Present when it is disabled.
|
|
2291
3183
|
- slot: One cell of the code.
|
|
2292
3184
|
- `data-index`: The cell's place, from 0.
|
|
2293
3185
|
- `data-active`: Present on the cell the next character goes in, or that is selected.
|
|
3186
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
3187
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
2294
3188
|
- `data-filled`: Present when the cell has its character.
|
|
3189
|
+
- `data-focused`: Present while the input has focus.
|
|
3190
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
3191
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2295
3192
|
- `data-disabled`: Present when it is disabled.
|
|
3193
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
3194
|
+
- `data-required`: Present when the form needs it.
|
|
3195
|
+
- `data-complete`: Present when every character is in.
|
|
2296
3196
|
|
|
2297
3197
|
### Pagination
|
|
2298
3198
|
|
|
@@ -2316,7 +3216,7 @@ Anatomy:
|
|
|
2316
3216
|
Props of its root:
|
|
2317
3217
|
|
|
2318
3218
|
- `page?: number`: The page shown, from 1.
|
|
2319
|
-
- `defaultPage?: number`: The page it starts at, when the caller does not hold `page`. Read once.
|
|
3219
|
+
- `defaultPage?: number`: The page it starts at, when the caller does not hold `page`. Read once. Default `1`.
|
|
2320
3220
|
- `onPageChange?: (page: number, details: ChangeDetails) => void`: Heard as another page is about to be shown: `details.cancel()` keeps the page as it was.
|
|
2321
3221
|
- `count: number`: Required. How many items there are in all.
|
|
2322
3222
|
- `pageSize?: number`: How many items a page holds. Default 10.
|
|
@@ -2347,13 +3247,66 @@ Attributes and CSS variables, by part:
|
|
|
2347
3247
|
- next: Goes to the page after.
|
|
2348
3248
|
- `data-disabled`: Present when it is disabled.
|
|
2349
3249
|
|
|
3250
|
+
### PasswordInput
|
|
3251
|
+
|
|
3252
|
+
```
|
|
3253
|
+
import { PasswordInput } from "@kirana-ui/react/password-input"
|
|
3254
|
+
```
|
|
3255
|
+
|
|
3256
|
+
Parts: `<PasswordInput.Root>`, `<PasswordInput.Input>`, `<PasswordInput.Toggle>`, `<PasswordInput.Indicator>`.
|
|
3257
|
+
|
|
3258
|
+
Anatomy:
|
|
3259
|
+
|
|
3260
|
+
```
|
|
3261
|
+
<PasswordInput.Root>
|
|
3262
|
+
<PasswordInput.Input>
|
|
3263
|
+
<PasswordInput.Toggle>
|
|
3264
|
+
<PasswordInput.Indicator> (optional)
|
|
3265
|
+
```
|
|
3266
|
+
|
|
3267
|
+
Props of its root:
|
|
3268
|
+
|
|
3269
|
+
- `disabled?: boolean`: Disabled: nothing can be typed in it.
|
|
3270
|
+
- `onValueChange?: (value: string, details: ChangeDetails) => void`: What was typed, as text, each time it changes.
|
|
3271
|
+
- `visible?: boolean`: Whether the password can be read, when the caller holds it.
|
|
3272
|
+
- `defaultVisible?: boolean`: Read once. Default `false`.
|
|
3273
|
+
- `onVisibleChange?: (visible: boolean, details: ChangeDetails) => void`: Heard as it is about to be shown or hidden: `details.cancel()` keeps it as it was.
|
|
3274
|
+
|
|
3275
|
+
Each part, and its own props:
|
|
3276
|
+
|
|
3277
|
+
- `<PasswordInput.Root>` draws a `<div>`. Its props are above.
|
|
3278
|
+
- `<PasswordInput.Input>` draws a `<input>`.
|
|
3279
|
+
- `<PasswordInput.Toggle>` draws a `<button>`.
|
|
3280
|
+
- `<PasswordInput.Indicator>` draws a `<span>`.
|
|
3281
|
+
|
|
3282
|
+
Attributes and CSS variables, by part:
|
|
3283
|
+
|
|
3284
|
+
- root: A password that can be shown while it is typed.
|
|
3285
|
+
- `data-visible`: Present while the password can be read.
|
|
3286
|
+
- `data-disabled`: Present when it is disabled.
|
|
3287
|
+
- input: The `<input>`: a password, or text while it is shown. In a `Field` it is the field's control.
|
|
3288
|
+
- `data-visible`: Present while the password can be read.
|
|
3289
|
+
- `data-disabled`: Present when it is disabled.
|
|
3290
|
+
- `data-touched`: Present once focus has left it.
|
|
3291
|
+
- `data-dirty`: Present once its text differs from what it began with.
|
|
3292
|
+
- `data-filled`: Present while it holds text.
|
|
3293
|
+
- `data-focused`: Present while it has focus.
|
|
3294
|
+
- `data-valid`: In a field: present once the value was checked and found right.
|
|
3295
|
+
- `data-invalid`: In a field: present while the value is wrong.
|
|
3296
|
+
- toggle: Shows the password, and hides it again. Focus and the caret stay in the input.
|
|
3297
|
+
- `data-visible`: Present while the password can be read.
|
|
3298
|
+
- `data-disabled`: Present when it is disabled.
|
|
3299
|
+
- indicator: What draws which of the two it is: an eye, open or struck.
|
|
3300
|
+
- `data-visible`: Present while the password can be read.
|
|
3301
|
+
- `data-disabled`: Present when it is disabled.
|
|
3302
|
+
|
|
2350
3303
|
### Popover
|
|
2351
3304
|
|
|
2352
3305
|
```
|
|
2353
3306
|
import { Popover } from "@kirana-ui/react/popover"
|
|
2354
3307
|
```
|
|
2355
3308
|
|
|
2356
|
-
Parts: `<Popover.Root>`, `<Popover.Trigger>`, `<Popover.Portal>`, `<Popover.Positioner>`, `<Popover.Popup>`, `<Popover.Title>`, `<Popover.Description>`, `<Popover.Close>`.
|
|
3309
|
+
Parts: `<Popover.Root>`, `<Popover.Trigger>`, `<Popover.Portal>`, `<Popover.Backdrop>`, `<Popover.Positioner>`, `<Popover.Popup>`, `<Popover.Arrow>`, `<Popover.Title>`, `<Popover.Description>`, `<Popover.Close>`.
|
|
2357
3310
|
|
|
2358
3311
|
Anatomy:
|
|
2359
3312
|
|
|
@@ -2361,11 +3314,13 @@ Anatomy:
|
|
|
2361
3314
|
<Popover.Root>
|
|
2362
3315
|
<Popover.Trigger>
|
|
2363
3316
|
<Popover.Portal>
|
|
3317
|
+
<Popover.Backdrop>
|
|
2364
3318
|
<Popover.Positioner>
|
|
2365
3319
|
<Popover.Popup>
|
|
2366
3320
|
<Popover.Title>
|
|
2367
3321
|
<Popover.Description>
|
|
2368
3322
|
<Popover.Close>
|
|
3323
|
+
<Popover.Arrow>
|
|
2369
3324
|
```
|
|
2370
3325
|
|
|
2371
3326
|
Props of its root:
|
|
@@ -2373,14 +3328,20 @@ Props of its root:
|
|
|
2373
3328
|
- `open?: boolean`: Whether it is open, when the caller holds it.
|
|
2374
3329
|
- `defaultOpen?: boolean`: Whether it starts open, when the caller does not hold `open`. Read once.
|
|
2375
3330
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as it is about to open or close: `details.cancel()` keeps it as it was.
|
|
3331
|
+
- `modal?: boolean | "trap-focus"`: What the page behind it may do while it is open. `false` (the default): everything. `true`: nothing, the page is inert and does not scroll, and Tab stays inside the popover. `"trap-focus"`: Tab stays inside the popover, and the page can still be pressed and scrolled. A popover the pointer opened holds nothing until it is pressed. Read as it opens.
|
|
2376
3332
|
|
|
2377
3333
|
Each part, and its own props:
|
|
2378
3334
|
|
|
2379
3335
|
- `<Popover.Root>` draws no element. Holds the popover: whether it is open. Its props are above.
|
|
2380
3336
|
- `<Popover.Trigger>` draws a `<button>`.
|
|
3337
|
+
- `openOnHover?: boolean`: Whether the pointer resting on the trigger opens the popover too. A press and the keyboard still open it, and a press on one the pointer opened keeps it open. Default `false`.
|
|
3338
|
+
- `delay?: number`: How long the pointer rests on the trigger before the popover opens, in milliseconds. Default 300.
|
|
3339
|
+
- `closeDelay?: number`: How long after the pointer leaves a popover it opened closes, in milliseconds. Default 0.
|
|
2381
3340
|
- `<Popover.Portal>` draws no element. Draws no element of its own: its children at the end of `<body>`, or where a `PortalProvider` says.
|
|
3341
|
+
- `<Popover.Backdrop>` draws a `<div>`.
|
|
2382
3342
|
- `<Popover.Positioner>` draws a `<div>`. Takes the positioner options ("Positioner options", above).
|
|
2383
3343
|
- `<Popover.Popup>` draws a `<div>`.
|
|
3344
|
+
- `<Popover.Arrow>` draws a `<div>`.
|
|
2384
3345
|
- `<Popover.Title>` draws a `<h2>`. The heading that names the popover.
|
|
2385
3346
|
- `<Popover.Description>` draws a `<p>`. The text that describes the popover.
|
|
2386
3347
|
- `<Popover.Close>` draws a `<button>`. A button that closes the popover.
|
|
@@ -2389,16 +3350,25 @@ Attributes and CSS variables, by part:
|
|
|
2389
3350
|
|
|
2390
3351
|
- trigger: The button that opens the popover, and what it is placed against.
|
|
2391
3352
|
- `data-popup-open`: Present when the popover is open.
|
|
3353
|
+
- `data-pressed`: Present while the popover a press on this trigger opened is open: it stays pressed, as a button held down.
|
|
3354
|
+
- backdrop: A layer over the page behind the popover.
|
|
3355
|
+
- `data-open`: Present when it is open.
|
|
3356
|
+
- `data-closed`: Present when it is closed.
|
|
3357
|
+
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
3358
|
+
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
2392
3359
|
- positioner: Places the popup against the trigger. It carries the geometry.
|
|
2393
3360
|
- `data-open`: Present when it is open.
|
|
2394
3361
|
- `data-closed`: Present when it is closed.
|
|
2395
3362
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
2396
3363
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
3364
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
2397
3365
|
- `--anchor-width`: The anchor's width.
|
|
2398
3366
|
- `--anchor-height`: The anchor's height.
|
|
2399
3367
|
- `--available-width`: The width between the anchor and the edge of the viewport.
|
|
2400
3368
|
- `--available-height`: The height between the anchor and the edge of the viewport.
|
|
2401
3369
|
- `--transform-origin`: The point of the popup nearest its anchor, to scale from.
|
|
3370
|
+
- `--positioner-width`: The popup's width, as its content lays it out: a design gives the positioner `width: var(--positioner-width)` to animate a change of size.
|
|
3371
|
+
- `--positioner-height`: The popup's height, as its content lays it out: a design gives the positioner `height: var(--positioner-height)` to animate a change of size.
|
|
2402
3372
|
- popup: The popover itself.
|
|
2403
3373
|
- `data-open`: Present when it is open.
|
|
2404
3374
|
- `data-closed`: Present when it is closed.
|
|
@@ -2406,6 +3376,15 @@ Attributes and CSS variables, by part:
|
|
|
2406
3376
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
2407
3377
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
2408
3378
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
3379
|
+
- `data-instant="click | dismiss"`: Present when it opened or closed in a way that should skip the motion: `click` when the keyboard pressed the trigger, `dismiss` when Escape closed it.
|
|
3380
|
+
- `--popup-width`: Its width: `auto`, and while its content changes size, the old width and then the new one, for a transition between them.
|
|
3381
|
+
- `--popup-height`: Its height: `auto`, and while its content changes size, the old height and then the new one, for a transition between them.
|
|
3382
|
+
- arrow: An element that points at the trigger, placed along the popup's edge.
|
|
3383
|
+
- `data-open`: Present when it is open.
|
|
3384
|
+
- `data-closed`: Present when it is closed.
|
|
3385
|
+
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
3386
|
+
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
3387
|
+
- `data-uncentered`: Present when the popup was pushed along its edge, so the arrow is not at the trigger's centre.
|
|
2409
3388
|
|
|
2410
3389
|
### Progress
|
|
2411
3390
|
|
|
@@ -2531,6 +3510,7 @@ Each part, and its own props:
|
|
|
2531
3510
|
- `<RadioGroup.Item>` draws a `<span>`.
|
|
2532
3511
|
- `value: unknown`: Required. What the group's value is while this item is the chosen one.
|
|
2533
3512
|
- `disabled?: boolean`: Disables this item: it cannot be chosen.
|
|
3513
|
+
- `id?: string`: The id of the item's native radio, unique in the page: a `<label htmlFor>` names it.
|
|
2534
3514
|
- `<RadioGroup.Indicator>` draws a `<span>`.
|
|
2535
3515
|
- `keepMounted?: boolean`: Keeps the mark in the page while its item is not the chosen one.
|
|
2536
3516
|
|
|
@@ -2540,21 +3520,92 @@ Attributes and CSS variables, by part:
|
|
|
2540
3520
|
- `data-disabled`: Present when it is disabled.
|
|
2541
3521
|
- `data-readonly`: Present when it can be read but not changed.
|
|
2542
3522
|
- `data-required`: Present when the form needs it.
|
|
2543
|
-
-
|
|
3523
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
3524
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
3525
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
3526
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
3527
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
3528
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
3529
|
+
- item: One choice. It holds a hidden native radio, which a form and a label reach: the item's `id` (`kpId` on Angular, `kui-id` on a custom element) is the radio's, which a `<label for>` names.
|
|
2544
3530
|
- `data-checked`: Present when it is checked.
|
|
2545
3531
|
- `data-unchecked`: Present when it is not checked.
|
|
2546
3532
|
- `data-disabled`: Present when it is disabled.
|
|
2547
3533
|
- `data-readonly`: Present when it can be read but not changed.
|
|
2548
3534
|
- `data-required`: Present when the form needs it.
|
|
3535
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
3536
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
3537
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
3538
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
3539
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
3540
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2549
3541
|
- indicator: The mark. In the page while its item is the chosen one.
|
|
2550
3542
|
- `data-checked`: Present when it is checked.
|
|
2551
3543
|
- `data-unchecked`: Present when it is not checked.
|
|
2552
3544
|
- `data-disabled`: Present when it is disabled.
|
|
2553
3545
|
- `data-readonly`: Present when it can be read but not changed.
|
|
2554
3546
|
- `data-required`: Present when the form needs it.
|
|
3547
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
3548
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
3549
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
3550
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
3551
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
3552
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2555
3553
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
2556
3554
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
2557
3555
|
|
|
3556
|
+
### Rating
|
|
3557
|
+
|
|
3558
|
+
```
|
|
3559
|
+
import { Rating } from "@kirana-ui/react/rating"
|
|
3560
|
+
```
|
|
3561
|
+
|
|
3562
|
+
Parts: `<Rating.Root>`, `<Rating.Items>`, `<Rating.Item>`.
|
|
3563
|
+
|
|
3564
|
+
Anatomy:
|
|
3565
|
+
|
|
3566
|
+
```
|
|
3567
|
+
<Rating.Root>
|
|
3568
|
+
<Rating.Items>
|
|
3569
|
+
<Rating.Item> (repeated)
|
|
3570
|
+
```
|
|
3571
|
+
|
|
3572
|
+
Props of its root:
|
|
3573
|
+
|
|
3574
|
+
- `value?: number`: How much is given, from 0 (none) to `count`; a half where `allowHalf` is set.
|
|
3575
|
+
- `defaultValue?: number`: The value it starts with, when the caller does not hold `value`. Read once. Default `0`.
|
|
3576
|
+
- `onValueChange?: (value: number, details: ChangeDetails) => void`: Heard as another value is about to be given: `details.cancel()` keeps it as it was.
|
|
3577
|
+
- `onHoverChange?: (value: number | null) => void`: Told the value the pointer is over, and `null` as it leaves: nothing is chosen by it.
|
|
3578
|
+
- `count?: number`: How many items there are. Default 5.
|
|
3579
|
+
- `allowHalf?: boolean`: Whether half an item can be given: by the half of it a pointer is over, and by the arrows.
|
|
3580
|
+
- `disabled?: boolean`: Disabled: it cannot be changed.
|
|
3581
|
+
- `readOnly?: boolean`: Shown as it is, focusable, not changeable.
|
|
3582
|
+
- `required?: boolean`: Needed: in a `Field`, giving none is then invalid.
|
|
3583
|
+
- `name?: string`: With a name, the value is submitted with the form around it; none is submitted as empty.
|
|
3584
|
+
- `form?: string`: The id of the form the control belongs to, when it is not inside it.
|
|
3585
|
+
|
|
3586
|
+
Each part, and its own props:
|
|
3587
|
+
|
|
3588
|
+
- `<Rating.Root>` draws a `<div>`. Its props are above.
|
|
3589
|
+
- `<Rating.Items>` draws no element. The items, from 1 to `count`: each place is given to draw.
|
|
3590
|
+
- `children: (place: number) => ReactNode`: Required. Draws one item, once for each place, from 1.
|
|
3591
|
+
- `<Rating.Item>` draws a `<span>`.
|
|
3592
|
+
- `place: number`: Required. Its place among the items, from 1.
|
|
3593
|
+
|
|
3594
|
+
Attributes and CSS variables, by part:
|
|
3595
|
+
|
|
3596
|
+
- root: The items, as one choice: a radio group. It holds the hidden input a form reads.
|
|
3597
|
+
- `data-disabled`: Present when it is disabled.
|
|
3598
|
+
- `data-readonly`: Present when it is shown and cannot be changed.
|
|
3599
|
+
- `data-required`: Present when a value is needed.
|
|
3600
|
+
- `data-hovering`: Present while a pointer is over an item.
|
|
3601
|
+
- item: One item (a star): pressed, the value is its place, or half of it.
|
|
3602
|
+
- `data-checked`: Present on the item that holds the value.
|
|
3603
|
+
- `data-filled`: Present on every item up to the value drawn: the one a pointer is over, or the one held.
|
|
3604
|
+
- `data-half`: Present on the item the value drawn fills by half.
|
|
3605
|
+
- `data-disabled`: Present when it is disabled.
|
|
3606
|
+
- `data-readonly`: Present when it is shown and cannot be changed.
|
|
3607
|
+
- `data-required`: Present when a value is needed.
|
|
3608
|
+
|
|
2558
3609
|
### Resizable
|
|
2559
3610
|
|
|
2560
3611
|
```
|
|
@@ -2590,13 +3641,13 @@ Each part, and its own props:
|
|
|
2590
3641
|
|
|
2591
3642
|
Attributes and CSS variables, by part:
|
|
2592
3643
|
|
|
2593
|
-
- group: The panels and the bars between them. A design lays it out as a flex box.
|
|
3644
|
+
- group: The panels and the bars between them. A design lays it out as a flex box: `display: flex`, and `flex-direction: column` when it is vertical. A group in a panel that is a flex box itself takes `min-width: 0` and `min-height: 0`, or what it holds widens the panel.
|
|
2594
3645
|
- `data-orientation="horizontal | vertical"`: Whether the panels are side by side or one over the other.
|
|
2595
3646
|
- `data-disabled`: Present when it is disabled.
|
|
2596
|
-
- panel: One panel. It carries its share of the group.
|
|
3647
|
+
- panel: One panel. It carries its share of the group, written as its `flex` with `min-width: 0` and `min-height: 0`, so what it holds cannot keep it past its share. Its `overflow` is the design's.
|
|
2597
3648
|
- `data-orientation="horizontal | vertical"`: Whether the panels are side by side or one over the other.
|
|
2598
3649
|
- `--panel-size`: The panel's share, in hundredths of the group.
|
|
2599
|
-
- handle: The bar between two panels: dragged, or moved with the arrows.
|
|
3650
|
+
- handle: The bar between two panels: dragged, or moved with the arrows. A design gives it its thickness and `flex-shrink: 0`, so the panels do not squeeze it.
|
|
2600
3651
|
- `data-orientation="horizontal | vertical"`: Whether the panels are side by side or one over the other.
|
|
2601
3652
|
- `data-dragging`: Present while the bar is dragged.
|
|
2602
3653
|
- `data-disabled`: Present when it is disabled.
|
|
@@ -2614,7 +3665,8 @@ Anatomy:
|
|
|
2614
3665
|
```
|
|
2615
3666
|
<ScrollArea.Root>
|
|
2616
3667
|
<ScrollArea.Viewport>
|
|
2617
|
-
<ScrollArea.Content>
|
|
3668
|
+
<ScrollArea.Content> (optional)
|
|
3669
|
+
<ScrollArea.Scrollbar> (repeated, as above)
|
|
2618
3670
|
<ScrollArea.Scrollbar> (repeated)
|
|
2619
3671
|
<ScrollArea.Thumb>
|
|
2620
3672
|
<ScrollArea.Corner>
|
|
@@ -2624,7 +3676,7 @@ Each part, and its own props:
|
|
|
2624
3676
|
|
|
2625
3677
|
- `<ScrollArea.Root>` draws a `<div>`.
|
|
2626
3678
|
- `<ScrollArea.Viewport>` draws a `<div>`.
|
|
2627
|
-
- `<ScrollArea.Content>` draws a `<div>`.
|
|
3679
|
+
- `<ScrollArea.Content>` draws a `<div>`.
|
|
2628
3680
|
- `<ScrollArea.Scrollbar>` draws a `<div>`.
|
|
2629
3681
|
- `orientation?: Orientation`: Which way it scrolls. Default: `vertical`.
|
|
2630
3682
|
- `keepMounted?: boolean`: In the page even while there is nothing to scroll its way.
|
|
@@ -2636,6 +3688,10 @@ Attributes and CSS variables, by part:
|
|
|
2636
3688
|
- root: The area. It holds the viewport and the scrollbars, which the library places against it: a design gives a scrollbar its thickness and draws it, and places nothing.
|
|
2637
3689
|
- `data-has-overflow-x`: Present when there is more to see sideways.
|
|
2638
3690
|
- `data-has-overflow-y`: Present when there is more to see up or down.
|
|
3691
|
+
- `data-overflow-x-start`: Present when there is more to scroll to towards the start of a line.
|
|
3692
|
+
- `data-overflow-x-end`: Present when there is more to scroll to towards the end of a line.
|
|
3693
|
+
- `data-overflow-y-start`: Present when there is more to scroll to above.
|
|
3694
|
+
- `data-overflow-y-end`: Present when there is more to scroll to below.
|
|
2639
3695
|
- `data-scrolling`: Present while it is being scrolled, and a moment after.
|
|
2640
3696
|
- `data-hovering`: Present while the pointer is over the area.
|
|
2641
3697
|
- `--scroll-area-corner-width`: The width of the corner: the vertical scrollbar's, while both scrollbars and the corner are in the page.
|
|
@@ -2643,15 +3699,38 @@ Attributes and CSS variables, by part:
|
|
|
2643
3699
|
- viewport: The element that scrolls.
|
|
2644
3700
|
- `data-has-overflow-x`: Present when there is more to see sideways.
|
|
2645
3701
|
- `data-has-overflow-y`: Present when there is more to see up or down.
|
|
3702
|
+
- `data-overflow-x-start`: Present when there is more to scroll to towards the start of a line.
|
|
3703
|
+
- `data-overflow-x-end`: Present when there is more to scroll to towards the end of a line.
|
|
3704
|
+
- `data-overflow-y-start`: Present when there is more to scroll to above.
|
|
3705
|
+
- `data-overflow-y-end`: Present when there is more to scroll to below.
|
|
3706
|
+
- `data-scrolling`: Present while it is being scrolled, and a moment after.
|
|
3707
|
+
- `--scroll-area-overflow-x-start`: How far the view is from the start of a line, to fade that edge by: `0px` at it.
|
|
3708
|
+
- `--scroll-area-overflow-x-end`: How far the view is from the end of a line: `0px` at it.
|
|
3709
|
+
- `--scroll-area-overflow-y-start`: How far the view is from the top: `0px` at it.
|
|
3710
|
+
- `--scroll-area-overflow-y-end`: How far the view is from the bottom: `0px` at it.
|
|
3711
|
+
- content: A box around what is scrolled, as wide as what it holds. Not needed to measure: the viewport's children are watched as they are. For content whose own box does not grow with what is in it (a block holding a wider table, or bare text).
|
|
3712
|
+
- `data-has-overflow-x`: Present when there is more to see sideways.
|
|
3713
|
+
- `data-has-overflow-y`: Present when there is more to see up or down.
|
|
3714
|
+
- `data-overflow-x-start`: Present when there is more to scroll to towards the start of a line.
|
|
3715
|
+
- `data-overflow-x-end`: Present when there is more to scroll to towards the end of a line.
|
|
3716
|
+
- `data-overflow-y-start`: Present when there is more to scroll to above.
|
|
3717
|
+
- `data-overflow-y-end`: Present when there is more to scroll to below.
|
|
2646
3718
|
- `data-scrolling`: Present while it is being scrolled, and a moment after.
|
|
2647
3719
|
- scrollbar: A scrollbar's track, placed along its edge of the area. In the page while there is something to scroll its way.
|
|
2648
3720
|
- `data-orientation="horizontal | vertical"`: Which way the scrollbar scrolls.
|
|
2649
3721
|
- `data-hovering`: Present while the pointer is over the area.
|
|
2650
3722
|
- `data-scrolling`: Present while the area is scrolled its way.
|
|
3723
|
+
- `data-has-overflow-x`: Present when there is more to see sideways.
|
|
3724
|
+
- `data-has-overflow-y`: Present when there is more to see up or down.
|
|
3725
|
+
- `data-overflow-x-start`: Present when there is more to scroll to towards the start of a line.
|
|
3726
|
+
- `data-overflow-x-end`: Present when there is more to scroll to towards the end of a line.
|
|
3727
|
+
- `data-overflow-y-start`: Present when there is more to scroll to above.
|
|
3728
|
+
- `data-overflow-y-end`: Present when there is more to scroll to below.
|
|
2651
3729
|
- `--scroll-area-thumb-height`: A vertical thumb's height.
|
|
2652
3730
|
- `--scroll-area-thumb-width`: A horizontal thumb's width.
|
|
2653
3731
|
- thumb: The part of a scrollbar that shows where the view is, and can be dragged. As long as its scrollbar's variable says.
|
|
2654
3732
|
- `data-orientation="horizontal | vertical"`: Which way the scrollbar scrolls.
|
|
3733
|
+
- `data-scrolling`: Present while the area is scrolled its way.
|
|
2655
3734
|
|
|
2656
3735
|
### Select
|
|
2657
3736
|
|
|
@@ -2659,7 +3738,7 @@ Attributes and CSS variables, by part:
|
|
|
2659
3738
|
import { Select } from "@kirana-ui/react/select"
|
|
2660
3739
|
```
|
|
2661
3740
|
|
|
2662
|
-
Parts: `<Select.Root>`, `<Select.Trigger>`, `<Select.Value>`, `<Select.Portal>`, `<Select.Positioner>`, `<Select.Popup>`, `<Select.List>`, `<Select.ScrollUpArrow>`, `<Select.ScrollDownArrow>`, `<Select.Group>`, `<Select.GroupLabel>`, `<Select.Separator>`, `<Select.Item>`, `<Select.ItemText>`, `<Select.ItemIndicator>`.
|
|
3741
|
+
Parts: `<Select.Root>`, `<Select.Trigger>`, `<Select.Value>`, `<Select.Portal>`, `<Select.Backdrop>`, `<Select.Positioner>`, `<Select.Popup>`, `<Select.List>`, `<Select.ScrollUpArrow>`, `<Select.ScrollDownArrow>`, `<Select.Group>`, `<Select.GroupLabel>`, `<Select.Separator>`, `<Select.Item>`, `<Select.ItemText>`, `<Select.ItemIndicator>`.
|
|
2663
3742
|
|
|
2664
3743
|
Anatomy:
|
|
2665
3744
|
|
|
@@ -2668,6 +3747,7 @@ Anatomy:
|
|
|
2668
3747
|
<Select.Trigger>
|
|
2669
3748
|
<Select.Value>
|
|
2670
3749
|
<Select.Portal>
|
|
3750
|
+
<Select.Backdrop> (optional)
|
|
2671
3751
|
<Select.Positioner>
|
|
2672
3752
|
<Select.Popup>
|
|
2673
3753
|
<Select.ScrollUpArrow>
|
|
@@ -2683,33 +3763,39 @@ Anatomy:
|
|
|
2683
3763
|
|
|
2684
3764
|
Props of its root:
|
|
2685
3765
|
|
|
2686
|
-
- `
|
|
2687
|
-
- `
|
|
2688
|
-
- `
|
|
3766
|
+
- `presentation?: Presentation`: How the list opens. `"sheet"`: from the bottom edge, not placed against the trigger, modal with a backdrop, swiped down or pressed outside to close. `"auto"`: decided each time it opens, a sheet when the pointer is coarse and the viewport narrower than `sheetBelow`. Default `"popup"`.
|
|
3767
|
+
- `sheetBelow?: number`: With `presentation: "auto"`: the viewport's width, in CSS pixels, under which a coarse pointer opens a sheet. Default 640.
|
|
3768
|
+
- `value?: (Multiple extends true ? readonly Value[] : Value | null)`: The chosen value; `null` is "none". With `multiple`, the chosen values, in the order they were chosen.
|
|
3769
|
+
- `defaultValue?: (Multiple extends true ? readonly Value[] : Value | null)`: The value it starts with (with `multiple`, the values), when the caller does not hold `value`. Read once.
|
|
3770
|
+
- `onValueChange?: (value: Multiple extends true ? Value[] : Value | null, details: ChangeDetails) => void`: Heard as a value is about to be chosen (with `multiple`, added or taken away, with the values there would then be): `details.cancel()` keeps it as it was.
|
|
2689
3771
|
- `open?: boolean`: Whether the list is open, when the caller holds it.
|
|
2690
3772
|
- `defaultOpen?: boolean`: Whether the list starts open, when the caller does not hold `open`. Read once.
|
|
2691
3773
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as the list is about to open or close: `details.cancel()` keeps it as it was.
|
|
2692
3774
|
- `disabled?: boolean`: Disabled: it cannot be changed.
|
|
3775
|
+
- `readOnly?: boolean`: Shown as it is, focusable, not changeable: the list still opens to be read, and no item can be chosen. Its value is still submitted with the form.
|
|
2693
3776
|
- `required?: boolean`: In a field, "none" is then wrong.
|
|
2694
3777
|
- `name?: string`: With a name, the value is submitted with the form around it.
|
|
2695
3778
|
- `form?: string`: The id of the form the control belongs to, when it is not inside it.
|
|
2696
3779
|
- `items?: readonly { value: Value; label: string }[] | Readonly<Record<string, string>>`: The labels of the values, for the trigger to show before the list has ever been opened: a list of values with their labels, or, for values that are text, the labels by value (`{ apple: "Apple" }`). Not needed for the list itself: its items are read from the markup.
|
|
2697
|
-
- `
|
|
2698
|
-
- `
|
|
2699
|
-
- `
|
|
2700
|
-
- `
|
|
3780
|
+
- `itemToStringLabel?: (value: Value) => string`: For values that are objects: the text the trigger shows for one, and what typing matches an item by when it gives no `label`. Without it, an object's own `label` names it, then the label `items` gives it, then the item's text in the markup.
|
|
3781
|
+
- `itemToStringValue?: (value: Value) => string`: For values that are objects: the text the form is sent for one. Without it, the `value` of an object shaped `{ value, label }` is sent, and any other object as JSON.
|
|
3782
|
+
- `values?: readonly Value[]`: With `multiple`: the chosen values.
|
|
3783
|
+
- `defaultValues?: readonly Value[]`: With `multiple`: the values it starts with.
|
|
3784
|
+
- `onValuesChange?: (values: Value[], details: ChangeDetails) => void`: With `multiple`: heard as a value is about to be added or taken away.
|
|
2701
3785
|
- `virtualized?: ListCollection`: Every row, when only some are in the page (a virtualizer draws the ones in view). Each item is then given its `index`.
|
|
3786
|
+
- `multiple?: Multiple`: Several values: `value`, `defaultValue` and `onValueChange` then hold a list. Read once.
|
|
2702
3787
|
|
|
2703
3788
|
Each part, and its own props:
|
|
2704
3789
|
|
|
2705
|
-
- `<Select.Root>` draws no element. Generic: `<Value = unknown>`. `Value` is what tells an item from the others
|
|
3790
|
+
- `<Select.Root>` draws no element. Generic: `<Value = unknown, Multiple extends boolean | undefined = false>`. `Value` is what tells an item from the others. `Multiple` is inferred from `multiple`: with `multiple`, `value`, `defaultValue` and `onValueChange` hold a list of them. Its props are above.
|
|
2706
3791
|
- `<Select.Trigger>` draws a `<button>`.
|
|
2707
3792
|
- `<Select.Value>` draws a `<span>`. Generic: `<Chosen = unknown>`.
|
|
2708
3793
|
- `placeholder?: ReactNode`: Shown while nothing is chosen.
|
|
2709
3794
|
- `children?: ReactNode | (( value: Chosen, label: Chosen extends readonly unknown[] ? readonly string[] : string | undefined ) => ReactNode)`: What to show in place of the label. A function is given the value and its label (`null` and `undefined` while nothing is chosen); with `multiple`, the values and their labels, in the items' order. Its first parameter's type says which: `(values: string[], labels) => …`.
|
|
2710
3795
|
- `<Select.Portal>` draws no element. Draws no element of its own: its children at the end of `<body>`, or where a `PortalProvider` says.
|
|
3796
|
+
- `<Select.Backdrop>` draws a `<div>`.
|
|
2711
3797
|
- `<Select.Positioner>` draws a `<div>`. Takes the positioner options ("Positioner options", above).
|
|
2712
|
-
- `alignItemWithTrigger?: boolean`: The list opens over its trigger, the chosen item's text on the trigger's own, where there is room and unless a finger opened it.
|
|
3798
|
+
- `alignItemWithTrigger?: boolean`: The list opens over its trigger, the chosen item's text on the trigger's own, where there is room and unless a finger opened it. While it lies there the page's scroll is held (its scrollbar's room kept), and a scroll of a box around the trigger closes the list (`"ancestor-scroll"`), as a change of the window's size does (`"window-resize"`).
|
|
2713
3799
|
- `<Select.Popup>` draws a `<div>`.
|
|
2714
3800
|
- `<Select.List>` draws a `<div>`. The items' own box inside the popup, when the popup holds more than its items: the listbox, and what scrolls.
|
|
2715
3801
|
- `<Select.ScrollUpArrow>` draws a `<div>`.
|
|
@@ -2730,15 +3816,38 @@ Attributes and CSS variables, by part:
|
|
|
2730
3816
|
|
|
2731
3817
|
- trigger: The button that shows the value and opens the list.
|
|
2732
3818
|
- `data-popup-open`: Present when the list is open.
|
|
3819
|
+
- `data-pressed`: Present while its popup is open: it stays pressed, as a button held down.
|
|
3820
|
+
- `data-popup-side="top | right | bottom | left | inline-start | inline-end | none"`: While the list is in the page: the side of the trigger it is on, after any flip; `none` when it lies over the trigger. Not said while it opens as a sheet.
|
|
2733
3821
|
- `data-placeholder`: Present while nothing is chosen.
|
|
2734
3822
|
- `data-disabled`: Present when it is disabled.
|
|
3823
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
3824
|
+
- `data-required`: Present when the form needs it.
|
|
3825
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
3826
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
3827
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
3828
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
3829
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
3830
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2735
3831
|
- value: The chosen value's label, or the placeholder. With several values, their labels with commas between.
|
|
2736
3832
|
- `data-placeholder`: Present while nothing is chosen.
|
|
2737
|
-
-
|
|
3833
|
+
- backdrop: The layer over the page behind the list: a press on it closes the list.
|
|
3834
|
+
- `data-open`: Present when it is open.
|
|
3835
|
+
- `data-closed`: Present when it is closed.
|
|
3836
|
+
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
3837
|
+
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
3838
|
+
- `data-presentation="popup | sheet"`: How the list opened: placed against its trigger, or as a sheet from the bottom edge.
|
|
3839
|
+
- `data-swiping`: Present while the sheet is dragged.
|
|
3840
|
+
- `data-swipe-dismiss`: Present once a drag has closed it.
|
|
3841
|
+
- `--drawer-swipe-movement-x`: As a sheet: how far it has been dragged across, always 0px.
|
|
3842
|
+
- `--drawer-swipe-movement-y`: As a sheet: how far it has been dragged down.
|
|
3843
|
+
- `--drawer-swipe-progress`: As a sheet: how far it has been dragged, of its own height: 0 to 1.
|
|
3844
|
+
- positioner: Places the list against the trigger. It carries the geometry. As a sheet it is not placed, and carries none.
|
|
2738
3845
|
- `data-open`: Present when it is open.
|
|
2739
3846
|
- `data-closed`: Present when it is closed.
|
|
2740
3847
|
- `data-side="top | right | bottom | left | inline-start | inline-end | none"`: The side of the trigger it is on, after any flip; `none` when it lies over the trigger.
|
|
2741
3848
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
3849
|
+
- `data-presentation="popup | sheet"`: How the list opened: placed against its trigger, or as a sheet from the bottom edge.
|
|
3850
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
2742
3851
|
- `--anchor-width`: The anchor's width.
|
|
2743
3852
|
- `--anchor-height`: The anchor's height.
|
|
2744
3853
|
- `--available-width`: The width between the anchor and the edge of the viewport.
|
|
@@ -2756,13 +3865,20 @@ Attributes and CSS variables, by part:
|
|
|
2756
3865
|
- `data-side="top | right | bottom | left | inline-start | inline-end | none"`: The side of the trigger the list is on; `none` when it lies over the trigger.
|
|
2757
3866
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
2758
3867
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
2759
|
-
- popup: The list of items.
|
|
3868
|
+
- popup: The list of items. As a sheet, a design moves it by what it says of the drag, and gives it `touch-action: none` where a finger drags it.
|
|
2760
3869
|
- `data-open`: Present when it is open.
|
|
2761
3870
|
- `data-closed`: Present when it is closed.
|
|
2762
3871
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
2763
3872
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
2764
|
-
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the
|
|
3873
|
+
- `data-side="top | right | bottom | left | inline-start | inline-end | none"`: The side of the trigger it is on, after any flip; `none` when it lies over the trigger.
|
|
2765
3874
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
3875
|
+
- `data-presentation="popup | sheet"`: How the list opened: placed against its trigger, or as a sheet from the bottom edge.
|
|
3876
|
+
- `data-swiping`: Present while the sheet is dragged.
|
|
3877
|
+
- `data-swipe-dismiss`: Present once a drag has closed it.
|
|
3878
|
+
- `--drawer-swipe-movement-x`: As a sheet: how far it has been dragged across, always 0px.
|
|
3879
|
+
- `--drawer-swipe-movement-y`: As a sheet: how far it has been dragged down.
|
|
3880
|
+
- `--drawer-swipe-progress`: As a sheet: how far it has been dragged, of its own height: 0 to 1.
|
|
3881
|
+
- `--drawer-swipe-strength`: As a sheet, once let go: 0.1 to 1, the share of the design's own time it should take to come to rest.
|
|
2766
3882
|
- item: One choice in the list.
|
|
2767
3883
|
- `data-selected`: Present on the chosen item, or on each of several.
|
|
2768
3884
|
- `data-highlighted`: Present on the item the pointer or the keyboard is on.
|
|
@@ -2818,6 +3934,7 @@ Props of its root:
|
|
|
2818
3934
|
- `orientation?: Orientation`: Whether the track lies across (the default) or stands upright: the arrows that move a thumb follow.
|
|
2819
3935
|
- `thumbAlignment?: "center" | "edge" | "edge-client-only"`: Where a thumb is at the ends of its range. `"center"` (the default): its centre on the control's edge, so half of it lies outside. `"edge"`: its edge on the control's edge, so it stays inside. `"edge-client-only"` is the same here: nothing waits for the browser.
|
|
2820
3936
|
- `disabled?: boolean`: Disabled: it cannot be changed.
|
|
3937
|
+
- `readOnly?: boolean`: Shown as it is, focusable, not changeable: no key and no pointer moves a thumb, and its value is still submitted with the form.
|
|
2821
3938
|
- `name?: string`: With a name, each thumb's value is submitted with the form around the slider.
|
|
2822
3939
|
- `form?: string`: The id of the form the control belongs to, when it is not inside it.
|
|
2823
3940
|
- `format?: Intl.NumberFormatOptions`: How a value is written.
|
|
@@ -2840,32 +3957,161 @@ Attributes and CSS variables, by part:
|
|
|
2840
3957
|
- root: Groups the slider's parts.
|
|
2841
3958
|
- `data-orientation="horizontal | vertical"`: The way the track runs.
|
|
2842
3959
|
- `data-disabled`: Present when it is disabled.
|
|
3960
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
2843
3961
|
- `data-dragging`: Present while a pointer holds a thumb.
|
|
3962
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
3963
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
3964
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
3965
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
3966
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
3967
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2844
3968
|
- value: The value, written.
|
|
2845
3969
|
- `data-orientation="horizontal | vertical"`: The way the track runs.
|
|
2846
3970
|
- `data-disabled`: Present when it is disabled.
|
|
3971
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
2847
3972
|
- `data-dragging`: Present while a pointer holds a thumb.
|
|
3973
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
3974
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
3975
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
3976
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
3977
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
3978
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2848
3979
|
- control: What a pointer presses and drags on. It holds the track and the thumbs.
|
|
2849
3980
|
- `data-orientation="horizontal | vertical"`: The way the track runs.
|
|
2850
3981
|
- `data-disabled`: Present when it is disabled.
|
|
3982
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
2851
3983
|
- `data-dragging`: Present while a pointer holds a thumb.
|
|
3984
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
3985
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
3986
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
3987
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
3988
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
3989
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2852
3990
|
- track: The whole range.
|
|
2853
3991
|
- `data-orientation="horizontal | vertical"`: The way the track runs.
|
|
2854
3992
|
- `data-disabled`: Present when it is disabled.
|
|
3993
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
2855
3994
|
- `data-dragging`: Present while a pointer holds a thumb.
|
|
3995
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
3996
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
3997
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
3998
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
3999
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
4000
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2856
4001
|
- indicator: The filled part: up to the thumb, or from the first thumb to the last. Its place and length are written on it.
|
|
2857
4002
|
- `data-orientation="horizontal | vertical"`: The way the track runs.
|
|
2858
4003
|
- `data-disabled`: Present when it is disabled.
|
|
4004
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
2859
4005
|
- `data-dragging`: Present while a pointer holds a thumb.
|
|
4006
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
4007
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
4008
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
4009
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
4010
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
4011
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2860
4012
|
- `--start-position`: With thumbs that stay inside the control: where the filled part starts, or with one thumb where it ends.
|
|
2861
4013
|
- `--relative-size`: With thumbs that stay inside the control and a range: the filled part's length.
|
|
2862
4014
|
- thumb: What is dragged, and what the keyboard moves: a slider to assistive technology. Its place on the track is written on it. It holds a hidden input, which a form reads. A thumb that is given no `index` is the value at its place among the slider's thumbs, in the order they are written.
|
|
2863
4015
|
- `data-orientation="horizontal | vertical"`: The way the track runs.
|
|
2864
4016
|
- `data-disabled`: Present when it is disabled.
|
|
4017
|
+
- `data-readonly`: Present when it can be read but not changed.
|
|
2865
4018
|
- `data-dragging`: Present while a pointer holds a thumb.
|
|
4019
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
4020
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
4021
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
4022
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
4023
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
4024
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2866
4025
|
- `data-index`: Which thumb it is, from 0.
|
|
2867
4026
|
- `--position`: With thumbs that stay inside the control: where the thumb's centre is.
|
|
2868
4027
|
|
|
4028
|
+
### Steps
|
|
4029
|
+
|
|
4030
|
+
```
|
|
4031
|
+
import { Steps } from "@kirana-ui/react/steps"
|
|
4032
|
+
```
|
|
4033
|
+
|
|
4034
|
+
Parts: `<Steps.Root>`, `<Steps.List>`, `<Steps.Item>`, `<Steps.Trigger>`, `<Steps.Indicator>`, `<Steps.Separator>`, `<Steps.Content>`, `<Steps.Completed>`, `<Steps.Previous>`, `<Steps.Next>`.
|
|
4035
|
+
|
|
4036
|
+
Anatomy:
|
|
4037
|
+
|
|
4038
|
+
```
|
|
4039
|
+
<Steps.Root>
|
|
4040
|
+
<Steps.List>
|
|
4041
|
+
<Steps.Item> (repeated)
|
|
4042
|
+
<Steps.Trigger>
|
|
4043
|
+
<Steps.Indicator> (optional)
|
|
4044
|
+
<Steps.Separator> (optional)
|
|
4045
|
+
<Steps.Content> (repeated)
|
|
4046
|
+
<Steps.Completed> (optional)
|
|
4047
|
+
<Steps.Previous> (optional)
|
|
4048
|
+
<Steps.Next> (optional)
|
|
4049
|
+
```
|
|
4050
|
+
|
|
4051
|
+
Props of its root:
|
|
4052
|
+
|
|
4053
|
+
- `step?: number`: The step shown, from 0. Equal to `count`, every step is done.
|
|
4054
|
+
- `defaultStep?: number`: The step it starts at, when the caller does not hold `step`. Read once. Default `0`.
|
|
4055
|
+
- `onStepChange?: (step: number, details: ChangeDetails) => void`: Heard as another step is about to be shown: `details.cancel()` keeps it as it was.
|
|
4056
|
+
- `count?: number`: How many steps there are. Left out, the items in the page, counted once they are there: until then (and on a server) no step is the last, so none is all done. Give it where only some of the steps are drawn.
|
|
4057
|
+
- `linear?: boolean`: In order only: a step that is not done yet cannot be gone to by its trigger.
|
|
4058
|
+
- `orientation?: Orientation`: Whether the steps are laid out across (the default) or down: the arrows follow.
|
|
4059
|
+
|
|
4060
|
+
Each part, and its own props:
|
|
4061
|
+
|
|
4062
|
+
- `<Steps.Root>` draws a `<div>`. Its props are above.
|
|
4063
|
+
- `<Steps.List>` draws a `<div>`.
|
|
4064
|
+
- `<Steps.Item>` draws a `<div>`.
|
|
4065
|
+
- `index?: number`: Which step it is, from 0. Left out, its place among the items in the page, once it is there: give it on a page a server draws, which cannot count them.
|
|
4066
|
+
- `<Steps.Trigger>` draws a `<button>`.
|
|
4067
|
+
- `<Steps.Indicator>` draws a `<span>`.
|
|
4068
|
+
- `<Steps.Separator>` draws a `<div>`.
|
|
4069
|
+
- `<Steps.Content>` draws a `<div>`.
|
|
4070
|
+
- `index: number`: Required. The step it is shown for, from 0.
|
|
4071
|
+
- `<Steps.Completed>` draws a `<div>`.
|
|
4072
|
+
- `<Steps.Previous>` draws a `<button>`.
|
|
4073
|
+
- `<Steps.Next>` draws a `<button>`.
|
|
4074
|
+
|
|
4075
|
+
Attributes and CSS variables, by part:
|
|
4076
|
+
|
|
4077
|
+
- root: A task in steps, taken in order.
|
|
4078
|
+
- `data-orientation="horizontal | vertical"`: Whether the steps are laid out across or down.
|
|
4079
|
+
- `data-complete`: Present once every step is done.
|
|
4080
|
+
- list: The row of steps: the arrows move between their triggers.
|
|
4081
|
+
- `data-orientation="horizontal | vertical"`: Whether the steps are laid out across or down.
|
|
4082
|
+
- item: One step of the row, around its trigger and its separator.
|
|
4083
|
+
- `data-current`: Present on the step that is shown.
|
|
4084
|
+
- `data-complete`: Present on a step that is done: one before the step shown.
|
|
4085
|
+
- `data-incomplete`: Present on a step still to come.
|
|
4086
|
+
- `data-orientation="horizontal | vertical"`: Whether the steps are laid out across or down.
|
|
4087
|
+
- trigger: Names a step, and goes to it when pressed.
|
|
4088
|
+
- `data-current`: Present on the step that is shown.
|
|
4089
|
+
- `data-complete`: Present on a step that is done: one before the step shown.
|
|
4090
|
+
- `data-incomplete`: Present on a step still to come.
|
|
4091
|
+
- `data-orientation="horizontal | vertical"`: Whether the steps are laid out across or down.
|
|
4092
|
+
- `data-disabled`: Present when it is disabled.
|
|
4093
|
+
- indicator: A step's mark: its number, or a tick once it is done.
|
|
4094
|
+
- `data-current`: Present on the step that is shown.
|
|
4095
|
+
- `data-complete`: Present on a step that is done: one before the step shown.
|
|
4096
|
+
- `data-incomplete`: Present on a step still to come.
|
|
4097
|
+
- `data-orientation="horizontal | vertical"`: Whether the steps are laid out across or down.
|
|
4098
|
+
- separator: The line from a step to the next.
|
|
4099
|
+
- `data-current`: Present on the step that is shown.
|
|
4100
|
+
- `data-complete`: Present on a step that is done: one before the step shown.
|
|
4101
|
+
- `data-incomplete`: Present on a step still to come.
|
|
4102
|
+
- `data-orientation="horizontal | vertical"`: Whether the steps are laid out across or down.
|
|
4103
|
+
- content: What a step shows: hidden unless its step is the one shown.
|
|
4104
|
+
- `data-current`: Present on the step that is shown.
|
|
4105
|
+
- `data-complete`: Present on a step that is done: one before the step shown.
|
|
4106
|
+
- `data-incomplete`: Present on a step still to come.
|
|
4107
|
+
- `data-orientation="horizontal | vertical"`: Whether the steps are laid out across or down.
|
|
4108
|
+
- completed: What is shown once every step is done.
|
|
4109
|
+
- `data-orientation="horizontal | vertical"`: Whether the steps are laid out across or down.
|
|
4110
|
+
- previous: Goes to the step before.
|
|
4111
|
+
- `data-disabled`: Present when it is disabled.
|
|
4112
|
+
- next: Goes to the step after; from the last, to all of them done.
|
|
4113
|
+
- `data-disabled`: Present when it is disabled.
|
|
4114
|
+
|
|
2869
4115
|
### Switch
|
|
2870
4116
|
|
|
2871
4117
|
```
|
|
@@ -2892,6 +4138,7 @@ Props of its root:
|
|
|
2892
4138
|
- `name?: string`: With a name, the control is submitted with the form around it when it is checked.
|
|
2893
4139
|
- `form?: string`: The id of the form the control belongs to, when it is not inside it.
|
|
2894
4140
|
- `value?: string`: What is submitted. Default `"on"`, as a native checkbox's.
|
|
4141
|
+
- `id?: string`: The id of the switch's hidden native checkbox, not of the switch: a `<label for>` names it. Inside a `Field`, that input takes the field's id instead.
|
|
2895
4142
|
|
|
2896
4143
|
Each part, and its own props:
|
|
2897
4144
|
|
|
@@ -2906,12 +4153,24 @@ Attributes and CSS variables, by part:
|
|
|
2906
4153
|
- `data-disabled`: Present when it is disabled.
|
|
2907
4154
|
- `data-readonly`: Present when it can be read but not changed.
|
|
2908
4155
|
- `data-required`: Present when the form needs it.
|
|
4156
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
4157
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
4158
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
4159
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
4160
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
4161
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2909
4162
|
- thumb: The knob that moves along the track.
|
|
2910
4163
|
- `data-checked`: Present when it is checked.
|
|
2911
4164
|
- `data-unchecked`: Present when it is not checked.
|
|
2912
4165
|
- `data-disabled`: Present when it is disabled.
|
|
2913
4166
|
- `data-readonly`: Present when it can be read but not changed.
|
|
2914
4167
|
- `data-required`: Present when the form needs it.
|
|
4168
|
+
- `data-touched`: Inside a Field: present once focus has left the control.
|
|
4169
|
+
- `data-dirty`: Inside a Field: present while the value is not the one it started with.
|
|
4170
|
+
- `data-filled`: Inside a Field: present while the control has a value.
|
|
4171
|
+
- `data-focused`: Inside a Field: present while the control has focus.
|
|
4172
|
+
- `data-valid`: Inside a Field: present once the value has been checked and found right.
|
|
4173
|
+
- `data-invalid`: Inside a Field: present while the value is wrong.
|
|
2915
4174
|
|
|
2916
4175
|
### Tabs
|
|
2917
4176
|
|
|
@@ -2943,7 +4202,8 @@ Each part, and its own props:
|
|
|
2943
4202
|
- `<Tabs.Root>` draws a `<div>`. Generic: `<Value = unknown>`. `Value` is what tells a tab from the others: the type of `value`. Its props are above.
|
|
2944
4203
|
- `<Tabs.List>` draws a `<div>`.
|
|
2945
4204
|
- `activateOnFocus?: boolean`: Whether moving focus onto a tab with the arrows activates it. Default `false`.
|
|
2946
|
-
- `
|
|
4205
|
+
- `loopFocus?: boolean`: Whether the arrows wrap from the last tab to the first. Default `true`.
|
|
4206
|
+
- `loop?: boolean`: Whether the arrows wrap from the last item to the first.
|
|
2947
4207
|
- `<Tabs.Tab>` draws a `<button>`.
|
|
2948
4208
|
- `value: unknown`: Required. What the tabs' value is while this tab is the active one.
|
|
2949
4209
|
- `disabled?: boolean`: Disables this tab: it cannot be chosen.
|
|
@@ -2964,6 +4224,7 @@ Attributes and CSS variables, by part:
|
|
|
2964
4224
|
- `data-active`: Present on the tab whose panel is shown.
|
|
2965
4225
|
- `data-disabled`: Present when it is disabled.
|
|
2966
4226
|
- `data-orientation="horizontal | vertical"`: The way the tabs are laid out.
|
|
4227
|
+
- `data-activation-direction="left | right | up | down | none"`: Where the newly active tab is from the one before, for a panel or a mark that slides.
|
|
2967
4228
|
- indicator: A mark for the active tab: it carries that tab's position and size.
|
|
2968
4229
|
- `data-orientation="horizontal | vertical"`: The way the tabs are laid out.
|
|
2969
4230
|
- `data-activation-direction="left | right | up | down | none"`: Where the newly active tab is from the one before, for a panel or a mark that slides.
|
|
@@ -2975,11 +4236,170 @@ Attributes and CSS variables, by part:
|
|
|
2975
4236
|
- `--active-tab-height`: The active tab's height.
|
|
2976
4237
|
- panel: A tab's content. In the page while its tab is active, and through its exit.
|
|
2977
4238
|
- `data-hidden`: Present while its tab is not the active one.
|
|
4239
|
+
- `data-index`: The panel's place among the panels in the page, from 0, once it is in the page.
|
|
2978
4240
|
- `data-orientation="horizontal | vertical"`: The way the tabs are laid out.
|
|
2979
4241
|
- `data-activation-direction="left | right | up | down | none"`: Where the newly active tab is from the one before, for a panel or a mark that slides.
|
|
2980
4242
|
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
2981
4243
|
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
2982
4244
|
|
|
4245
|
+
### TagsInput
|
|
4246
|
+
|
|
4247
|
+
```
|
|
4248
|
+
import { TagsInput } from "@kirana-ui/react/tags-input"
|
|
4249
|
+
```
|
|
4250
|
+
|
|
4251
|
+
Parts: `<TagsInput.Root>`, `<TagsInput.List>`, `<TagsInput.Items>`, `<TagsInput.Item>`, `<TagsInput.ItemText>`, `<TagsInput.ItemInput>`, `<TagsInput.ItemRemove>`, `<TagsInput.Input>`, `<TagsInput.Clear>`.
|
|
4252
|
+
|
|
4253
|
+
Anatomy:
|
|
4254
|
+
|
|
4255
|
+
```
|
|
4256
|
+
<TagsInput.Root>
|
|
4257
|
+
<TagsInput.List>
|
|
4258
|
+
<TagsInput.Items>
|
|
4259
|
+
<TagsInput.Item> (repeated)
|
|
4260
|
+
<TagsInput.ItemText>
|
|
4261
|
+
<TagsInput.ItemInput> (optional)
|
|
4262
|
+
<TagsInput.ItemRemove> (optional)
|
|
4263
|
+
<TagsInput.Input>
|
|
4264
|
+
<TagsInput.Clear> (optional)
|
|
4265
|
+
```
|
|
4266
|
+
|
|
4267
|
+
Props of its root:
|
|
4268
|
+
|
|
4269
|
+
- `value?: readonly string[]`: The tags, in order.
|
|
4270
|
+
- `defaultValue?: readonly string[]`: The tags it starts with, when the caller does not hold `value`. Read once.
|
|
4271
|
+
- `onValueChange?: (value: string[], details: ChangeDetails) => void`: Heard as the tags are about to change: `details.cancel()` keeps them as they were.
|
|
4272
|
+
- `onValueInvalid?: (text: string, reason: "duplicate" | "max" | "invalid") => void`: Told a text that was not made a tag, and why.
|
|
4273
|
+
- `validate?: (text: string, value: readonly string[]) => boolean`: Whether a text may be a tag. Asked after the text is trimmed, and not for an empty one.
|
|
4274
|
+
- `max?: number`: How many tags it holds at most.
|
|
4275
|
+
- `allowDuplicates?: boolean`: Whether the same text may be a tag twice. Default `false`.
|
|
4276
|
+
- `delimiter?: string | RegExp | null`: What ends a tag as it is typed or pasted, beside Enter. Default `","`. `null` for nothing.
|
|
4277
|
+
- `addOnBlur?: boolean`: Whether what is typed becomes a tag as focus leaves the input. Default `false`.
|
|
4278
|
+
- `addOnPaste?: boolean`: Whether a pasted text is cut into tags at its delimiters and line ends. Default `true`.
|
|
4279
|
+
- `editable?: boolean`: Whether a tag can be edited in place, by two presses or Enter on it. Default `true`.
|
|
4280
|
+
- `disabled?: boolean`: Disabled: nothing can be added or taken away.
|
|
4281
|
+
- `readOnly?: boolean`: Shown as they are, focusable, not changeable.
|
|
4282
|
+
- `required?: boolean`: Needed: in a `Field`, holding none is then invalid.
|
|
4283
|
+
- `name?: string`: With a name, each tag is submitted under it with the form around them.
|
|
4284
|
+
- `form?: string`: The id of the form the control belongs to, when it is not inside it.
|
|
4285
|
+
|
|
4286
|
+
Each part, and its own props:
|
|
4287
|
+
|
|
4288
|
+
- `<TagsInput.Root>` draws a `<div>`. Its props are above.
|
|
4289
|
+
- `<TagsInput.List>` draws a `<div>`.
|
|
4290
|
+
- `<TagsInput.Items>` draws no element. The tags, in order: each entry is given to draw.
|
|
4291
|
+
- `children: (entry: TagsInputEntry) => ReactNode`: Required. Draws one tag, once for each.
|
|
4292
|
+
- `<TagsInput.Item>` draws a `<span>`.
|
|
4293
|
+
- `entry: TagsInputEntry`: Required. The tag it is, as `Items` gave it.
|
|
4294
|
+
- `<TagsInput.ItemText>` draws a `<span>`.
|
|
4295
|
+
- `<TagsInput.ItemInput>` draws a `<input>`.
|
|
4296
|
+
- `<TagsInput.ItemRemove>` draws a `<button>`.
|
|
4297
|
+
- `<TagsInput.Input>` draws a `<input>`.
|
|
4298
|
+
- `<TagsInput.Clear>` draws a `<button>`.
|
|
4299
|
+
|
|
4300
|
+
Attributes and CSS variables, by part:
|
|
4301
|
+
|
|
4302
|
+
- root: Several short texts held as tags, and the input a new one is typed in. It holds the hidden inputs a form reads.
|
|
4303
|
+
- `data-disabled`: Present when it is disabled.
|
|
4304
|
+
- `data-readonly`: Present when the tags are shown and cannot be changed.
|
|
4305
|
+
- `data-required`: Present when a tag is needed.
|
|
4306
|
+
- `data-focused`: Present while focus is on a tag or in the input.
|
|
4307
|
+
- `data-empty`: Present while it holds no tag.
|
|
4308
|
+
- list: What holds the tags: a list.
|
|
4309
|
+
- `data-disabled`: Present when it is disabled.
|
|
4310
|
+
- `data-readonly`: Present when the tags are shown and cannot be changed.
|
|
4311
|
+
- `data-required`: Present when a tag is needed.
|
|
4312
|
+
- item: A tag: reached with the arrows, taken away with Backspace or Delete.
|
|
4313
|
+
- `data-disabled`: Present when it is disabled.
|
|
4314
|
+
- `data-readonly`: Present when the tags are shown and cannot be changed.
|
|
4315
|
+
- `data-required`: Present when a tag is needed.
|
|
4316
|
+
- `data-editing`: Present while the tag is edited.
|
|
4317
|
+
- itemText: A tag's text: hidden while the tag is edited.
|
|
4318
|
+
- `data-disabled`: Present when it is disabled.
|
|
4319
|
+
- `data-readonly`: Present when the tags are shown and cannot be changed.
|
|
4320
|
+
- `data-required`: Present when a tag is needed.
|
|
4321
|
+
- itemInput: Where a tag is edited in place: hidden unless it is being edited.
|
|
4322
|
+
- `data-disabled`: Present when it is disabled.
|
|
4323
|
+
- `data-readonly`: Present when the tags are shown and cannot be changed.
|
|
4324
|
+
- `data-required`: Present when a tag is needed.
|
|
4325
|
+
- itemRemove: A tag's button that takes it away.
|
|
4326
|
+
- `data-disabled`: Present when it is disabled.
|
|
4327
|
+
- `data-readonly`: Present when the tags are shown and cannot be changed.
|
|
4328
|
+
- `data-required`: Present when a tag is needed.
|
|
4329
|
+
- input: Where a new tag is typed. In a `Field` it is what the field's label names.
|
|
4330
|
+
- `data-disabled`: Present when it is disabled.
|
|
4331
|
+
- `data-readonly`: Present when the tags are shown and cannot be changed.
|
|
4332
|
+
- `data-required`: Present when a tag is needed.
|
|
4333
|
+
- clear: Takes every tag away: hidden while there is none.
|
|
4334
|
+
- `data-disabled`: Present when it is disabled.
|
|
4335
|
+
- `data-readonly`: Present when the tags are shown and cannot be changed.
|
|
4336
|
+
- `data-required`: Present when a tag is needed.
|
|
4337
|
+
|
|
4338
|
+
### TimeField
|
|
4339
|
+
|
|
4340
|
+
```
|
|
4341
|
+
import { TimeField } from "@kirana-ui/react/time-field"
|
|
4342
|
+
```
|
|
4343
|
+
|
|
4344
|
+
Parts: `<TimeField.Root>`, `<TimeField.Segments>`, `<TimeField.Segment>`, `<TimeField.Input>`.
|
|
4345
|
+
|
|
4346
|
+
Anatomy:
|
|
4347
|
+
|
|
4348
|
+
```
|
|
4349
|
+
<TimeField.Root>
|
|
4350
|
+
<TimeField.Segments>
|
|
4351
|
+
<TimeField.Segment> (repeated)
|
|
4352
|
+
<TimeField.Input>
|
|
4353
|
+
```
|
|
4354
|
+
|
|
4355
|
+
Props of its root:
|
|
4356
|
+
|
|
4357
|
+
- `value?: IsoTime | null`: The time typed, once all of it is; `null` until then.
|
|
4358
|
+
- `defaultValue?: IsoTime | null`: The value it starts with, when the caller does not hold `value`. Read once.
|
|
4359
|
+
- `onValueChange?: (value: IsoTime | null, details: ChangeDetails) => void`: Heard as the time is about to change, once all of it is typed or as it is cleared: `details.cancel()` keeps the value as it was.
|
|
4360
|
+
- `granularity?: TimeGranularity`: To the minute (`HH:MM`, the default) or to the second (`HH:MM:SS`).
|
|
4361
|
+
- `locale?: string`: The language and region that order the parts, put what stands between them and say whether the clock has twelve hours or twenty-four (`"en-US"`: 12, with AM and PM). Give it: a server does not know the reader's. Default `"en-US"`.
|
|
4362
|
+
- `hourCycle?: HourCycle`: A clock of 12 or 24 hours, whatever the locale's is.
|
|
4363
|
+
- `min?: IsoTime`: The first time it takes: before it, it says it is invalid.
|
|
4364
|
+
- `max?: IsoTime`: The last time it takes.
|
|
4365
|
+
- `placeholders?: Partial<Record<TimeUnit, string>>`: What an empty part shows. Default: `hh`, `mm`, `ss`, and `--` for the day period.
|
|
4366
|
+
- `disabled?: boolean`: Disabled: it cannot be changed.
|
|
4367
|
+
- `readOnly?: boolean`: Shown as it is, focusable, not changeable.
|
|
4368
|
+
- `required?: boolean`: Needed: in a `Field`, leaving it empty is then invalid.
|
|
4369
|
+
- `name?: string`: The name it is submitted under, by its hidden input; in a `Field`, the field's by default.
|
|
4370
|
+
- `form?: string`: The id of the form it belongs to, when it is not inside it.
|
|
4371
|
+
|
|
4372
|
+
Each part, and its own props:
|
|
4373
|
+
|
|
4374
|
+
- `<TimeField.Root>` draws a `<div>`. Its props are above.
|
|
4375
|
+
- `<TimeField.Segments>` draws no element. The time's segments, in the locale's order: each is given to draw.
|
|
4376
|
+
- `children: (segment: TimeFieldSegment) => ReactNode`: Required. Draws one piece of the time, once for each: a part that is typed, or what stands between two.
|
|
4377
|
+
- `<TimeField.Segment>` draws a `<span>`.
|
|
4378
|
+
- `segment: TimeFieldSegment`: Required. The piece it is: an entry `TimeField.Segments` gave.
|
|
4379
|
+
- `<TimeField.Input>` draws a `<input>`. The hidden input it is submitted by.
|
|
4380
|
+
|
|
4381
|
+
Attributes and CSS variables, by part:
|
|
4382
|
+
|
|
4383
|
+
- root: The field: a group of the time's parts.
|
|
4384
|
+
- `data-disabled`: Present when it is disabled.
|
|
4385
|
+
- `data-readonly`: Present when its value cannot be changed.
|
|
4386
|
+
- `data-invalid`: Present when the time is outside what it takes, is asked for and half typed, or is wrong by its field.
|
|
4387
|
+
- `data-touched`: In a field: present once focus has left it.
|
|
4388
|
+
- `data-dirty`: In a field: present while the time is not the one it began with.
|
|
4389
|
+
- `data-filled`: In a field: present while it holds a time.
|
|
4390
|
+
- `data-focused`: In a field: present while one of its parts has focus.
|
|
4391
|
+
- `data-valid`: In a field: present once the time was checked and found right.
|
|
4392
|
+
- segment: One piece of the time: a part that is typed, or what stands between two.
|
|
4393
|
+
- `data-segment="hour | minute | second | dayPeriod | literal"`: Which piece it is: `dayPeriod` is AM or PM, on a clock of twelve hours.
|
|
4394
|
+
- `data-placeholder`: Present on a part that is empty.
|
|
4395
|
+
- `data-disabled`: Present when it is disabled.
|
|
4396
|
+
- `data-invalid`: Present when the time is outside what it takes, is asked for and half typed, or is wrong by its field.
|
|
4397
|
+
- `data-touched`: In a field: present once focus has left it.
|
|
4398
|
+
- `data-dirty`: In a field: present while the time is not the one it began with.
|
|
4399
|
+
- `data-filled`: In a field: present while it holds a time.
|
|
4400
|
+
- `data-focused`: In a field: present while one of its parts has focus.
|
|
4401
|
+
- `data-valid`: In a field: present once the time was checked and found right.
|
|
4402
|
+
|
|
2983
4403
|
### Toast
|
|
2984
4404
|
|
|
2985
4405
|
```
|
|
@@ -3016,10 +4436,10 @@ Each part, and its own props:
|
|
|
3016
4436
|
- `children: (toast: ToastRecord) => ReactNode`: Required. Draws one toast, once for each, the newest first: a `Toast.Root` given it as `toast`.
|
|
3017
4437
|
- `<Toast.Root>` draws a `<div>`. Its props are above.
|
|
3018
4438
|
- `<Toast.Content>` draws a `<div>`.
|
|
3019
|
-
- `<Toast.Title>` draws a `<div>`.
|
|
3020
|
-
- `<Toast.Description>` draws a `<div>`.
|
|
3021
|
-
- `<Toast.Close>` draws a `<button>`.
|
|
3022
|
-
- `<Toast.Action>` draws a `<button>`.
|
|
4439
|
+
- `<Toast.Title>` draws a `<div>`.
|
|
4440
|
+
- `<Toast.Description>` draws a `<div>`.
|
|
4441
|
+
- `<Toast.Close>` draws a `<button>`.
|
|
4442
|
+
- `<Toast.Action>` draws a `<button>`.
|
|
3023
4443
|
|
|
3024
4444
|
A page's toasts are a toaster's, made once in a module: `import { createToaster } from "@kirana-ui/react"`, then `export const toaster = createToaster(options)` (`ToasterOptions`, under "Types"). The viewport is given it, and anything on the page adds to it: `toaster.add({ title, description, action, priority })`, `toaster.update(id, options)`, `toaster.dismiss(id)`, `toaster.promise(promise, { loading, success, error })`. What each takes and gives back is `Toaster`, `ToastOptions`, `ToastActionOptions` and `ToastRecord` under "Types".
|
|
3025
4445
|
|
|
@@ -3044,6 +4464,14 @@ Attributes and CSS variables, by part:
|
|
|
3044
4464
|
- content: What holds a toast's contents, when the design sizes the toast itself.
|
|
3045
4465
|
- `data-behind`: Present on a toast that is behind the newest.
|
|
3046
4466
|
- `data-expanded`: Present while the pointer or focus is on the stack: the toasts are spread out, and wait.
|
|
4467
|
+
- title: What the toast is called: the title it was added with, when nothing else is written in it.
|
|
4468
|
+
- `data-type`: The kind the toast was added as.
|
|
4469
|
+
- description: What the toast says: the description it was added with, when nothing else is written in it.
|
|
4470
|
+
- `data-type`: The kind the toast was added as.
|
|
4471
|
+
- close: Closes the toast.
|
|
4472
|
+
- `data-type`: The kind the toast was added as.
|
|
4473
|
+
- action: A button of the toast's own: the action it was added with, when nothing else is written in it. Pressing it closes the toast too, unless the action refuses.
|
|
4474
|
+
- `data-type`: The kind the toast was added as.
|
|
3047
4475
|
|
|
3048
4476
|
### Toggle
|
|
3049
4477
|
|
|
@@ -3081,7 +4509,8 @@ Props:
|
|
|
3081
4509
|
- `multiple?: boolean`: Whether more than one can be pressed at a time.
|
|
3082
4510
|
- `disabled?: boolean`: Disables every toggle of the group.
|
|
3083
4511
|
- `orientation?: Orientation`: Whether the toggles are laid out across (the default) or down: the arrows that move between them follow.
|
|
3084
|
-
- `
|
|
4512
|
+
- `loopFocus?: boolean`: Whether the arrows go round from the last toggle to the first. Default: they do.
|
|
4513
|
+
- `loop?: boolean`: Whether the arrows wrap from the last item to the first.
|
|
3085
4514
|
|
|
3086
4515
|
`<ToggleGroup>` draws a `<div>`. Generic: `<Value = unknown>`. `Value` is what tells a toggle from the others: the type of `value`'s entries.
|
|
3087
4516
|
|
|
@@ -3114,7 +4543,8 @@ Anatomy:
|
|
|
3114
4543
|
Props of its root:
|
|
3115
4544
|
|
|
3116
4545
|
- `orientation?: Orientation`: Whether the controls are laid out across (the default) or down: the arrows that move between them follow.
|
|
3117
|
-
- `
|
|
4546
|
+
- `loopFocus?: boolean`: Whether the arrows go round from the last item to the first. Default: they do.
|
|
4547
|
+
- `loop?: boolean`: Whether the arrows wrap from the last item to the first.
|
|
3118
4548
|
- `disabled?: boolean`: Disables every control of the toolbar.
|
|
3119
4549
|
|
|
3120
4550
|
Each part, and its own props:
|
|
@@ -3122,9 +4552,11 @@ Each part, and its own props:
|
|
|
3122
4552
|
- `<Toolbar.Root>` draws a `<div>`. Its props are above.
|
|
3123
4553
|
- `<Toolbar.Button>` draws a `<button>`.
|
|
3124
4554
|
- `disabled?: boolean`: Disables this control.
|
|
4555
|
+
- `focusableWhenDisabled?: boolean`: Keeps it focusable while disabled, as Base UI's: the arrows still reach it, and a press does nothing. Default `true`; with `false` it is disabled the element's own way.
|
|
3125
4556
|
- `<Toolbar.Link>` draws a `<a>`.
|
|
3126
4557
|
- `<Toolbar.Input>` draws a `<input>`.
|
|
3127
4558
|
- `disabled?: boolean`: Disables this control.
|
|
4559
|
+
- `focusableWhenDisabled?: boolean`: Keeps it focusable while disabled, as Base UI's: the arrows still reach it, and a press does nothing. Default `true`; with `false` it is disabled the element's own way.
|
|
3128
4560
|
- `<Toolbar.Group>` draws a `<div>`.
|
|
3129
4561
|
- `disabled?: boolean`: Disables this control.
|
|
3130
4562
|
- `<Toolbar.Separator>` draws a `<div>`.
|
|
@@ -3137,12 +4569,14 @@ Attributes and CSS variables, by part:
|
|
|
3137
4569
|
- button: A button of the toolbar.
|
|
3138
4570
|
- `data-orientation="horizontal | vertical"`: Whether the toolbar is a row or a column.
|
|
3139
4571
|
- `data-disabled`: Present when it is disabled.
|
|
4572
|
+
- `data-focusable`: Present when it stays focusable while disabled: the arrows still reach it.
|
|
3140
4573
|
- link: A link of the toolbar.
|
|
3141
4574
|
- `data-orientation="horizontal | vertical"`: Whether the toolbar is a row or a column.
|
|
3142
4575
|
- `data-disabled`: Present when it is disabled.
|
|
3143
4576
|
- input: A text input of the toolbar. The arrows are its own until the caret is at an end.
|
|
3144
4577
|
- `data-orientation="horizontal | vertical"`: Whether the toolbar is a row or a column.
|
|
3145
4578
|
- `data-disabled`: Present when it is disabled.
|
|
4579
|
+
- `data-focusable`: Present when it stays focusable while disabled: the arrows still reach it.
|
|
3146
4580
|
- group: Items that belong together.
|
|
3147
4581
|
- `data-orientation="horizontal | vertical"`: Whether the toolbar is a row or a column.
|
|
3148
4582
|
- `data-disabled`: Present when it is disabled.
|
|
@@ -3173,8 +4607,8 @@ Props of its root:
|
|
|
3173
4607
|
- `open?: boolean`: Whether it is open, when the caller holds it.
|
|
3174
4608
|
- `defaultOpen?: boolean`: Whether it starts open, when the caller does not hold `open`. Read once.
|
|
3175
4609
|
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as it is about to open or close: `details.cancel()` keeps it as it was.
|
|
3176
|
-
- `delay?: number`: How long the pointer rests on the trigger before the popup opens, in milliseconds.
|
|
3177
|
-
- `closeDelay?: number`: How long after the pointer leaves the popup closes, in milliseconds.
|
|
4610
|
+
- `delay?: number`: How long the pointer rests on the trigger before the popup opens, in milliseconds. Default `600`.
|
|
4611
|
+
- `closeDelay?: number`: How long after the pointer leaves the popup closes, in milliseconds. Default `0`.
|
|
3178
4612
|
- `disabled?: boolean`: Disabled: the pointer and focus do not open it.
|
|
3179
4613
|
|
|
3180
4614
|
Each part, and its own props:
|
|
@@ -3192,16 +4626,20 @@ Attributes and CSS variables, by part:
|
|
|
3192
4626
|
|
|
3193
4627
|
- trigger: The element the tooltip describes.
|
|
3194
4628
|
- `data-popup-open`: Present when the tooltip is open.
|
|
4629
|
+
- `data-trigger-disabled`: Present when the tooltip is disabled: the pointer and focus on the trigger do not open it.
|
|
3195
4630
|
- positioner: Places the popup against the trigger. It carries the geometry.
|
|
3196
4631
|
- `data-open`: Present when it is open.
|
|
3197
4632
|
- `data-closed`: Present when it is closed.
|
|
3198
4633
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
3199
4634
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
4635
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
3200
4636
|
- `--anchor-width`: The anchor's width.
|
|
3201
4637
|
- `--anchor-height`: The anchor's height.
|
|
3202
4638
|
- `--available-width`: The width between the anchor and the edge of the viewport.
|
|
3203
4639
|
- `--available-height`: The height between the anchor and the edge of the viewport.
|
|
3204
4640
|
- `--transform-origin`: The point of the popup nearest its anchor, to scale from.
|
|
4641
|
+
- `--positioner-width`: The popup's width, as its content lays it out: a design gives the positioner `width: var(--positioner-width)` to animate a change of size.
|
|
4642
|
+
- `--positioner-height`: The popup's height, as its content lays it out: a design gives the positioner `height: var(--positioner-height)` to animate a change of size.
|
|
3205
4643
|
- popup: The tooltip itself.
|
|
3206
4644
|
- `data-open`: Present when it is open.
|
|
3207
4645
|
- `data-closed`: Present when it is closed.
|
|
@@ -3211,6 +4649,181 @@ Attributes and CSS variables, by part:
|
|
|
3211
4649
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
3212
4650
|
- `data-instant="delay | focus | dismiss"`: Present when it opened or closed without its usual wait, for a design that skips the motion then.
|
|
3213
4651
|
- arrow: An element that points at the trigger, placed along the popup's edge.
|
|
4652
|
+
- `data-open`: Present when it is open.
|
|
4653
|
+
- `data-closed`: Present when it is closed.
|
|
3214
4654
|
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
3215
4655
|
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
4656
|
+
- `data-instant="delay | focus | dismiss"`: Present when it opened or closed without its usual wait, for a design that skips the motion then.
|
|
3216
4657
|
- `data-uncentered`: Present when the popup was pushed along its edge, so the arrow is not at the trigger's centre.
|
|
4658
|
+
|
|
4659
|
+
### Tour
|
|
4660
|
+
|
|
4661
|
+
```
|
|
4662
|
+
import { Tour } from "@kirana-ui/react/tour"
|
|
4663
|
+
```
|
|
4664
|
+
|
|
4665
|
+
Parts: `<Tour.Root>`, `<Tour.Portal>`, `<Tour.Spotlight>`, `<Tour.Positioner>`, `<Tour.Popup>`, `<Tour.Arrow>`, `<Tour.Title>`, `<Tour.Description>`, `<Tour.Previous>`, `<Tour.Next>`, `<Tour.Close>`.
|
|
4666
|
+
|
|
4667
|
+
Anatomy:
|
|
4668
|
+
|
|
4669
|
+
```
|
|
4670
|
+
<Tour.Root>
|
|
4671
|
+
<Tour.Portal>
|
|
4672
|
+
<Tour.Spotlight>
|
|
4673
|
+
<Tour.Positioner>
|
|
4674
|
+
<Tour.Popup>
|
|
4675
|
+
<Tour.Arrow>
|
|
4676
|
+
<Tour.Title>
|
|
4677
|
+
<Tour.Description>
|
|
4678
|
+
<Tour.Previous>
|
|
4679
|
+
<Tour.Next>
|
|
4680
|
+
<Tour.Close>
|
|
4681
|
+
```
|
|
4682
|
+
|
|
4683
|
+
Props of its root:
|
|
4684
|
+
|
|
4685
|
+
- `steps: readonly Step[]`: Required. The steps, in order.
|
|
4686
|
+
- `open?: boolean`: Whether it is open, when the caller holds it.
|
|
4687
|
+
- `defaultOpen?: boolean`: Whether it starts open, when the caller does not hold `open`. Read once.
|
|
4688
|
+
- `onOpenChange?: (open: boolean, details: ChangeDetails) => void`: Heard as it is about to open or close: `details.cancel()` keeps it as it was. The reason is `"finish"` for the last step's `next`, `"close-press"`, `"escape-key"` or `"outside-press"`.
|
|
4689
|
+
- `step?: number`: The index of the step shown, from 0, when the caller holds it.
|
|
4690
|
+
- `defaultStep?: number`: The step it starts at, when the caller does not hold `step`. Read once. Default 0.
|
|
4691
|
+
- `onStepChange?: (step: number, details: ChangeDetails) => void`: Heard as another step is about to be shown: `details.cancel()` keeps it as it was. The reason is `"next-press"`, `"previous-press"`, `"next-key"` or `"previous-key"`.
|
|
4692
|
+
- `waitForTarget?: number`: How long a step whose target is not in the page waits for it, in milliseconds, before it is shown in the middle of the viewport. Default 1000.
|
|
4693
|
+
- `spotlightPadding?: number`: The room between the target and the edge of the spotlight's hole, in pixels. Default 4.
|
|
4694
|
+
- `closeOnOutsidePress?: boolean`: Whether a press on the dimmed page ends the tour. Default `false`.
|
|
4695
|
+
- `interactive?: boolean`: Whether the target can be used while its step is shown: pressed, focused, typed in. Default `false`: the target is seen, not used, and the rest of the page is inert either way.
|
|
4696
|
+
- `keyboardNavigation?: boolean`: Whether ArrowRight and ArrowLeft go on and back a step. Default `true`.
|
|
4697
|
+
|
|
4698
|
+
Each part, and its own props:
|
|
4699
|
+
|
|
4700
|
+
- `<Tour.Root>` draws no element. Generic: `<Step extends TourStep = TourStep>`. `Step` is what each step is: a `TourStep` with whatever the page draws it from. Its props are above.
|
|
4701
|
+
- `<Tour.Portal>` draws no element. Draws no element of its own: its children at the end of `<body>`, or where a `PortalProvider` says.
|
|
4702
|
+
- `<Tour.Spotlight>` draws a `<div>`.
|
|
4703
|
+
- `<Tour.Positioner>` draws a `<div>`. Takes the positioner options ("Positioner options", above).
|
|
4704
|
+
- `<Tour.Popup>` draws a `<div>`. Generic: `<Step extends TourStep = TourStep>`.
|
|
4705
|
+
- `children?: ReactNode | ((shown: TourShownStep<Step>) => ReactNode)`: What the popup holds, or a function given the step shown that draws it.
|
|
4706
|
+
- `<Tour.Arrow>` draws a `<div>`.
|
|
4707
|
+
- `<Tour.Title>` draws a `<h2>`. The heading that names the step.
|
|
4708
|
+
- `<Tour.Description>` draws a `<p>`. The text that describes the step.
|
|
4709
|
+
- `<Tour.Previous>` draws a `<button>`.
|
|
4710
|
+
- `<Tour.Next>` draws a `<button>`.
|
|
4711
|
+
- `<Tour.Close>` draws a `<button>`. A button that ends the tour.
|
|
4712
|
+
|
|
4713
|
+
Attributes and CSS variables, by part:
|
|
4714
|
+
|
|
4715
|
+
- spotlight: A layer over the page with a hole over the step's target, which the design draws from its variables (a clip path, or a box with a large shadow). A press on it is a press outside the tour. While the target can be used (`interactive`), presses go through it.
|
|
4716
|
+
- `data-open`: Present when it is open.
|
|
4717
|
+
- `data-closed`: Present when it is closed.
|
|
4718
|
+
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
4719
|
+
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
4720
|
+
- `data-centered`: Present while the step shown has no target in the page: the popup stands in the middle of the viewport.
|
|
4721
|
+
- `--spotlight-left`: The hole's left edge, from the spotlight's own left edge: the target's, less `spotlightPadding`.
|
|
4722
|
+
- `--spotlight-top`: The hole's top edge, from the spotlight's own top edge: the target's, less `spotlightPadding`.
|
|
4723
|
+
- `--spotlight-width`: The hole's width: the target's, with `spotlightPadding` on each side.
|
|
4724
|
+
- `--spotlight-height`: The hole's height: the target's, with `spotlightPadding` on each side. With no target, the hole is a point in the middle.
|
|
4725
|
+
- positioner: Places the popup against the step's target, or in the middle of the viewport for a step with none. It carries the geometry.
|
|
4726
|
+
- `data-open`: Present when it is open.
|
|
4727
|
+
- `data-closed`: Present when it is closed.
|
|
4728
|
+
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
4729
|
+
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
4730
|
+
- `data-centered`: Present while the step shown has no target in the page: the popup stands in the middle of the viewport.
|
|
4731
|
+
- `data-anchor-hidden`: Present while the anchor is out of view: scrolled away, or clipped by a box around it.
|
|
4732
|
+
- `--anchor-width`: The anchor's width.
|
|
4733
|
+
- `--anchor-height`: The anchor's height.
|
|
4734
|
+
- `--available-width`: The width between the anchor and the edge of the viewport.
|
|
4735
|
+
- `--available-height`: The height between the anchor and the edge of the viewport.
|
|
4736
|
+
- `--transform-origin`: The point of the popup nearest its anchor, to scale from.
|
|
4737
|
+
- popup: The step itself: a dialog that stays in the page from the first step to the last, and moves.
|
|
4738
|
+
- `data-open`: Present when it is open.
|
|
4739
|
+
- `data-closed`: Present when it is closed.
|
|
4740
|
+
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
4741
|
+
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
4742
|
+
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
4743
|
+
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
4744
|
+
- `data-centered`: Present while the step shown has no target in the page: the popup stands in the middle of the viewport.
|
|
4745
|
+
- arrow: An element that points at the target, placed along the popup's edge.
|
|
4746
|
+
- `data-open`: Present when it is open.
|
|
4747
|
+
- `data-closed`: Present when it is closed.
|
|
4748
|
+
- `data-side="top | right | bottom | left | inline-start | inline-end"`: The side of the anchor it is on, after any flip. Asked for as `inline-start` or `inline-end`, it says one of those two when it is beside its anchor.
|
|
4749
|
+
- `data-align="start | center | end"`: How it is aligned with the anchor.
|
|
4750
|
+
- `data-uncentered`: Present when the popup was pushed along its edge, so the arrow is not at the target's centre.
|
|
4751
|
+
- `data-centered`: Present while the step shown has no target in the page: the popup stands in the middle of the viewport.
|
|
4752
|
+
- previous: A button that goes back a step. On the first step it does nothing.
|
|
4753
|
+
- `data-disabled`: Present when it is disabled.
|
|
4754
|
+
- next: A button that goes on a step. On the last step it finishes the tour.
|
|
4755
|
+
- `data-last`: Present on the last step: a press finishes the tour.
|
|
4756
|
+
|
|
4757
|
+
### Tree
|
|
4758
|
+
|
|
4759
|
+
```
|
|
4760
|
+
import { Tree } from "@kirana-ui/react/tree"
|
|
4761
|
+
```
|
|
4762
|
+
|
|
4763
|
+
Parts: `<Tree.Root>`, `<Tree.Item>`, `<Tree.ItemRow>`, `<Tree.ItemIndicator>`, `<Tree.ItemText>`, `<Tree.Group>`.
|
|
4764
|
+
|
|
4765
|
+
Anatomy:
|
|
4766
|
+
|
|
4767
|
+
```
|
|
4768
|
+
<Tree.Root>
|
|
4769
|
+
<Tree.Item> (repeated)
|
|
4770
|
+
<Tree.ItemRow> (optional)
|
|
4771
|
+
<Tree.ItemIndicator>
|
|
4772
|
+
<Tree.ItemText>
|
|
4773
|
+
<Tree.Group>
|
|
4774
|
+
<Tree.Item> (repeated, as above)
|
|
4775
|
+
```
|
|
4776
|
+
|
|
4777
|
+
Props of its root:
|
|
4778
|
+
|
|
4779
|
+
- `expandedValue?: readonly Value[]`: The values of the open branches.
|
|
4780
|
+
- `defaultExpandedValue?: readonly Value[]`: The branches open at first, when the caller does not hold `expandedValue`. Read once.
|
|
4781
|
+
- `onExpandedChange?: (value: Value[], details: ChangeDetails) => void`: Heard as a branch is about to open or close, with the values that would then be open: `details.cancel()` keeps them as they were. A page that loads a branch's children loads them when this says the branch opened.
|
|
4782
|
+
- `selectionMode?: TreeSelectionMode`: Whether nodes can be chosen: none, one, or several. Default `single`.
|
|
4783
|
+
- `selectedValue?: readonly Value[]`: The values of the chosen nodes.
|
|
4784
|
+
- `defaultSelectedValue?: readonly Value[]`: The nodes chosen at first, when the caller does not hold `selectedValue`. Read once.
|
|
4785
|
+
- `onSelectedChange?: (value: Value[], details: ChangeDetails) => void`: Heard as nodes are about to be chosen or taken away, with the values there would then be: `details.cancel()` keeps them as they were.
|
|
4786
|
+
- `expandOnClick?: boolean`: Whether a press on a branch (or Enter on it) also opens or closes it. Default `true`.
|
|
4787
|
+
|
|
4788
|
+
Each part, and its own props:
|
|
4789
|
+
|
|
4790
|
+
- `<Tree.Root>` draws a `<div>`. Generic: `<Value = unknown>`. `Value` is what tells a node from the others: the type of the values' entries. Its props are above.
|
|
4791
|
+
- `<Tree.Item>` draws a `<div>`.
|
|
4792
|
+
- `value: unknown`: Required. What tells this node from the others in the tree: what the values hold.
|
|
4793
|
+
- `branch?: boolean`: A branch: it has children, drawn in its `Tree.Group`, and opens and closes.
|
|
4794
|
+
- `disabled?: boolean`: Disables this node: it cannot be chosen, opened or closed, and the keys pass over it.
|
|
4795
|
+
- `loading?: boolean`: A branch whose children are being loaded.
|
|
4796
|
+
- `label?: string`: What typing matches, when it is not the node's text.
|
|
4797
|
+
- `<Tree.ItemRow>` draws a `<div>`.
|
|
4798
|
+
- `<Tree.ItemIndicator>` draws a `<span>`.
|
|
4799
|
+
- `<Tree.ItemText>` draws a `<span>`. The node's name: what names it to assistive technology, and what typing matches.
|
|
4800
|
+
- `<Tree.Group>` draws a `<div>`.
|
|
4801
|
+
- `keepMounted?: boolean`: Keeps the closed group in the page, `hidden`.
|
|
4802
|
+
|
|
4803
|
+
Attributes and CSS variables, by part:
|
|
4804
|
+
|
|
4805
|
+
- item: One node, a `treeitem`: a leaf, or a branch that holds its row and its group. Its `value` tells it from the others; its depth, and its place among its siblings, are read from the page.
|
|
4806
|
+
- `data-selected`: Present on a chosen node.
|
|
4807
|
+
- `data-highlighted`: Present on the node focus is on, while it is in the tree.
|
|
4808
|
+
- `data-disabled`: Present when it is disabled.
|
|
4809
|
+
- `data-open`: Present on a branch that is open.
|
|
4810
|
+
- `data-closed`: Present on a branch that is closed.
|
|
4811
|
+
- `data-loading`: Present on a branch that says its children are being loaded.
|
|
4812
|
+
- itemRow: The line a node draws, apart from the children its group holds: what a design gives a background.
|
|
4813
|
+
- `data-selected`: Present on a chosen node.
|
|
4814
|
+
- `data-highlighted`: Present on the node focus is on, while it is in the tree.
|
|
4815
|
+
- `data-disabled`: Present when it is disabled.
|
|
4816
|
+
- `data-open`: Present on a branch that is open.
|
|
4817
|
+
- `data-closed`: Present on a branch that is closed.
|
|
4818
|
+
- `data-loading`: Present on a branch that says its children are being loaded.
|
|
4819
|
+
- itemIndicator: The mark that says whether a branch is open. A press on it opens or closes the branch and chooses nothing.
|
|
4820
|
+
- `data-open`: Present on a branch that is open.
|
|
4821
|
+
- `data-closed`: Present on a branch that is closed.
|
|
4822
|
+
- `data-loading`: Present on a branch that says its children are being loaded.
|
|
4823
|
+
- group: A branch's children. In the page while the branch is open, and through its exit's motion.
|
|
4824
|
+
- `data-open`: Present when it is open.
|
|
4825
|
+
- `data-closed`: Present when it is closed.
|
|
4826
|
+
- `data-starting-style`: Present for the first style of its entrance: what it animates in from.
|
|
4827
|
+
- `data-ending-style`: Present through its exit: what it animates out to. It leaves the page when the motion ends.
|
|
4828
|
+
- `--tree-group-height`: The group's content height while it opens or closes, `auto` once it is open.
|
|
4829
|
+
- `--tree-group-width`: The group's content width while it opens or closes, `auto` once it is open.
|