@kanso-labs/react-native-kanso-ui 0.8.0 → 0.10.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/README.md +4 -3
- package/dist/autocomplete/index.js +15 -1
- package/dist/autocomplete/index.js.map +1 -1
- package/dist/badge/index.js +9 -70
- package/dist/badge/index.js.map +1 -1
- package/dist/button/group.d.ts +5 -0
- package/dist/button/group.js +115 -0
- package/dist/button/group.js.map +1 -0
- package/dist/button/index.d.ts +4 -1
- package/dist/button/index.js +45 -23
- package/dist/button/index.js.map +1 -1
- package/dist/button/palettes.d.ts +2 -0
- package/dist/button/slots.js +2 -1
- package/dist/button/slots.js.map +1 -1
- package/dist/calendar/index.js +351 -182
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +33 -2
- package/dist/calendar/styles.js.map +1 -1
- package/dist/carousel/arrangement.d.ts +5 -0
- package/dist/carousel/arrangement.js +123 -0
- package/dist/carousel/arrangement.js.map +1 -0
- package/dist/chequer/index.js +95 -0
- package/dist/chequer/index.js.map +1 -0
- package/dist/collection/index.d.ts +157 -0
- package/dist/collection/index.js +1331 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/color-thumb/index.js +56 -0
- package/dist/color-thumb/index.js.map +1 -0
- package/dist/components/badge/index.d.ts +48 -0
- package/dist/components/badge/index.js +122 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/{badge → components/badge}/styles.js +10 -6
- package/dist/components/badge/styles.js.map +1 -0
- package/dist/components/breadcrumbs/index.d.ts +66 -0
- package/dist/components/breadcrumbs/index.js +285 -0
- package/dist/components/breadcrumbs/index.js.map +1 -0
- package/dist/components/button/index.d.ts +4 -2
- package/dist/components/button/index.js +227 -188
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +87 -0
- package/dist/components/button-group/index.js +275 -0
- package/dist/components/button-group/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +11 -3
- package/dist/components/calendar/index.js +60 -45
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +72 -0
- package/dist/components/carousel/index.js +496 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +7 -1
- package/dist/components/checkbox/index.js +183 -138
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.d.ts +92 -0
- package/dist/components/checkbox-group/index.js +306 -0
- package/dist/components/checkbox-group/index.js.map +1 -0
- package/dist/components/code/index.d.ts +25 -0
- package/dist/components/code/index.js +87 -0
- package/dist/components/code/index.js.map +1 -0
- package/dist/components/color-area/index.d.ts +85 -0
- package/dist/components/color-area/index.js +630 -0
- package/dist/components/color-area/index.js.map +1 -0
- package/dist/components/color-field/index.d.ts +144 -0
- package/dist/components/color-field/index.js +516 -0
- package/dist/components/color-field/index.js.map +1 -0
- package/dist/components/color-picker/index.d.ts +74 -0
- package/dist/components/color-picker/index.js +317 -0
- package/dist/components/color-picker/index.js.map +1 -0
- package/dist/components/color-slider/index.d.ts +82 -0
- package/dist/components/color-slider/index.js +456 -0
- package/dist/components/color-slider/index.js.map +1 -0
- package/dist/components/color-swatch/index.d.ts +46 -0
- package/dist/components/color-swatch/index.js +127 -0
- package/dist/components/color-swatch/index.js.map +1 -0
- package/dist/components/color-swatch-picker/index.d.ts +81 -0
- package/dist/components/color-swatch-picker/index.js +287 -0
- package/dist/components/color-swatch-picker/index.js.map +1 -0
- package/dist/components/color-wheel/index.d.ts +71 -0
- package/dist/components/color-wheel/index.js +407 -0
- package/dist/components/color-wheel/index.js.map +1 -0
- package/dist/components/combo-box/index.d.ts +193 -0
- package/dist/components/combo-box/index.js +616 -0
- package/dist/components/combo-box/index.js.map +1 -0
- package/dist/components/container/index.d.ts +47 -0
- package/dist/components/container/index.js +85 -0
- package/dist/components/container/index.js.map +1 -0
- package/dist/components/date-field/index.d.ts +120 -0
- package/dist/components/date-field/index.js +111 -0
- package/dist/components/date-field/index.js.map +1 -0
- package/dist/components/date-picker/index.d.ts +130 -0
- package/dist/components/date-picker/index.js +310 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/date-range-picker/index.d.ts +139 -0
- package/dist/components/date-range-picker/index.js +421 -0
- package/dist/components/date-range-picker/index.js.map +1 -0
- package/dist/components/disclosure/index.d.ts +94 -0
- package/dist/components/disclosure/index.js +365 -0
- package/dist/components/disclosure/index.js.map +1 -0
- package/dist/components/disclosure-group/index.d.ts +61 -0
- package/dist/components/disclosure-group/index.js +100 -0
- package/dist/components/disclosure-group/index.js.map +1 -0
- package/dist/components/drop-zone/index.d.ts +113 -0
- package/dist/components/drop-zone/index.js +304 -0
- package/dist/components/drop-zone/index.js.map +1 -0
- package/dist/components/fab/index.d.ts +80 -0
- package/dist/components/fab/index.js +246 -0
- package/dist/components/fab/index.js.map +1 -0
- package/dist/components/fab-menu/index.d.ts +120 -0
- package/dist/components/fab-menu/index.js +640 -0
- package/dist/components/fab-menu/index.js.map +1 -0
- package/dist/components/feed/index.d.ts +57 -0
- package/dist/components/feed/index.js +167 -0
- package/dist/components/feed/index.js.map +1 -0
- package/dist/components/form/index.d.ts +3 -2
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +4 -2
- package/dist/components/icon-button/index.js +204 -171
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/keycap/index.d.ts +27 -0
- package/dist/components/keycap/index.js +136 -0
- package/dist/components/keycap/index.js.map +1 -0
- package/dist/components/list/index.d.ts +15 -158
- package/dist/components/list/index.js +21 -1047
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +73 -0
- package/dist/components/list-box/index.js +82 -0
- package/dist/components/list-box/index.js.map +1 -0
- package/dist/components/loading-indicator/index.d.ts +32 -0
- package/dist/components/loading-indicator/index.js +174 -0
- package/dist/components/loading-indicator/index.js.map +1 -0
- package/dist/components/menu/index.js +1 -1
- package/dist/components/navigation-tree/index.d.ts +117 -0
- package/dist/components/navigation-tree/index.js +135 -0
- package/dist/components/navigation-tree/index.js.map +1 -0
- package/dist/components/number-field/index.js +132 -143
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +69 -0
- package/dist/components/range-calendar/index.js +144 -0
- package/dist/components/range-calendar/index.js.map +1 -0
- package/dist/components/search-view/index.d.ts +78 -0
- package/dist/components/search-view/index.js +570 -0
- package/dist/components/search-view/index.js.map +1 -0
- package/dist/components/select/index.d.ts +152 -0
- package/dist/components/select/index.js +419 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/separator/index.d.ts +3 -2
- package/dist/components/separator/index.js +29 -26
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +111 -0
- package/dist/components/slider/index.js +673 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/split-button/index.d.ts +77 -0
- package/dist/components/split-button/index.js +354 -0
- package/dist/components/split-button/index.js.map +1 -0
- package/dist/components/supporting-pane/index.d.ts +44 -0
- package/dist/components/supporting-pane/index.js +109 -0
- package/dist/components/supporting-pane/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +196 -0
- package/dist/components/tabs/index.js +1137 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.js +49 -21
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +145 -0
- package/dist/components/text-area/index.js +231 -0
- package/dist/components/text-area/index.js.map +1 -0
- package/dist/components/time-field/index.d.ts +43 -0
- package/dist/components/time-field/index.js +107 -0
- package/dist/components/time-field/index.js.map +1 -0
- package/dist/components/time-picker/index.d.ts +65 -0
- package/dist/components/time-picker/index.js +1168 -0
- package/dist/components/time-picker/index.js.map +1 -0
- package/dist/components/toolbar/index.d.ts +53 -0
- package/dist/components/toolbar/index.js +185 -0
- package/dist/components/toolbar/index.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +101 -0
- package/dist/components/tooltip/index.js +223 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/components/tree/index.d.ts +112 -0
- package/dist/components/tree/index.js +157 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/control/group.js +23 -0
- package/dist/control/group.js.map +1 -0
- package/dist/disclosure/chevron.js +75 -0
- package/dist/disclosure/chevron.js.map +1 -0
- package/dist/disclosure/index.js +7 -0
- package/dist/disclosure/index.js.map +1 -0
- package/dist/drop/index.d.ts +54 -0
- package/dist/drop/index.js +161 -0
- package/dist/drop/index.js.map +1 -0
- package/dist/fab/index.d.ts +19 -0
- package/dist/fab/index.js +147 -0
- package/dist/fab/index.js.map +1 -0
- package/dist/field/chevron.js +74 -0
- package/dist/field/chevron.js.map +1 -0
- package/dist/field/index.d.ts +2 -1
- package/dist/field/index.js +350 -153
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +27 -0
- package/dist/field/styles.js.map +1 -1
- package/dist/files/index.d.ts +18 -0
- package/dist/files/index.js +107 -0
- package/dist/files/index.js.map +1 -0
- package/dist/form/index.d.ts +6 -4
- package/dist/form/index.js +64 -85
- package/dist/form/index.js.map +1 -1
- package/dist/glyphs/index.js +92 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +20 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +1394 -34
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +51 -6
- package/dist/index.js +47 -4
- package/dist/indicator/paths.js +23 -1
- package/dist/indicator/paths.js.map +1 -1
- package/dist/modal/index.js +96 -68
- package/dist/modal/index.js.map +1 -1
- package/dist/navigation/index.js +8 -5
- package/dist/navigation/index.js.map +1 -1
- package/dist/number/keyboard.js +16 -0
- package/dist/number/keyboard.js.map +1 -0
- package/dist/overlay/anchored.js +68 -38
- package/dist/overlay/anchored.js.map +1 -1
- package/dist/overlay/keyboard.js +57 -0
- package/dist/overlay/keyboard.js.map +1 -0
- package/dist/overlay/panel.js +173 -19
- package/dist/overlay/panel.js.map +1 -1
- package/dist/overlay/placement.js +16 -2
- package/dist/overlay/placement.js.map +1 -1
- package/dist/picker/index.js +322 -0
- package/dist/picker/index.js.map +1 -0
- package/dist/press/index.d.ts +2 -0
- package/dist/press/index.js +102 -100
- package/dist/press/index.js.map +1 -1
- package/dist/row/index.js +77 -69
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +13 -2
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/field.js +277 -0
- package/dist/segments/field.js.map +1 -0
- package/dist/segments/index.js +574 -0
- package/dist/segments/index.js.map +1 -0
- package/dist/segments/styles.js +24 -0
- package/dist/segments/styles.js.map +1 -0
- package/dist/separator/index.js +7 -0
- package/dist/separator/index.js.map +1 -0
- package/dist/slider/index.js +145 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/swatch/index.js +56 -0
- package/dist/swatch/index.js.map +1 -0
- package/dist/typography/size.js +14 -0
- package/dist/typography/size.js.map +1 -0
- package/package.json +11 -2
- package/dist/badge/styles.js.map +0 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { ValidationResult } from "../../form/index.js";
|
|
2
|
+
import { FieldVariant } from "../../field/index.js";
|
|
3
|
+
import { StyleProp, View, ViewStyle } from "react-native";
|
|
4
|
+
import { ComponentRef, ReactNode, Ref } from "react";
|
|
5
|
+
import { Key } from "react-stately";
|
|
6
|
+
import { ChangeValueType, SelectionMode as SelectionMode$1, ValueType } from "react-stately/useSelectState";
|
|
7
|
+
//#region src/components/select/index.d.ts
|
|
8
|
+
type SelectProps<M extends SelectionMode$1 = 'single'> = {
|
|
9
|
+
/**
|
|
10
|
+
* Lets the list open with no options in it, showing its empty state.
|
|
11
|
+
* Left off, a press on a select with no options does nothing.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
readonly allowsEmptyCollection?: boolean;
|
|
15
|
+
/** Whether the list is open at first, when the select keeps its own. */
|
|
16
|
+
readonly defaultOpen?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* What is chosen at first, when the select keeps its own value: an
|
|
19
|
+
* option's `id`, or a list of them with `selectionMode="multiple"`.
|
|
20
|
+
*/
|
|
21
|
+
readonly defaultValue?: ValueType<M>;
|
|
22
|
+
/**
|
|
23
|
+
* A hint shown under the field. Replaced by `error` when there is one, so
|
|
24
|
+
* the two never stack.
|
|
25
|
+
*/
|
|
26
|
+
readonly description?: string;
|
|
27
|
+
/** The `id`s of the options drawn disabled, which take no presses. */
|
|
28
|
+
readonly disabledKeys?: Iterable<Key>;
|
|
29
|
+
/**
|
|
30
|
+
* The problem with the current value, in words. Its presence is what puts
|
|
31
|
+
* the field in its error state: the message, the error colours, and the
|
|
32
|
+
* error a screen reader reads with the field all follow from it. The line
|
|
33
|
+
* under the field arrives with the message, so the field grows when this
|
|
34
|
+
* does, unless it is inside a `Form`, which keeps the line drawn. It wins
|
|
35
|
+
* over what `validate` and the form say, and holds a `native` form back.
|
|
36
|
+
*/
|
|
37
|
+
readonly error?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the label sits in the empty box and floats to the top once the
|
|
40
|
+
* list is open or something is chosen. `false` keeps it small at the top
|
|
41
|
+
* in every state.
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
readonly floatingLabel?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Draws the field disabled: it takes no presses and its list never opens.
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
readonly isDisabled?: boolean;
|
|
50
|
+
/** Whether the list is open, when the call site holds it. */
|
|
51
|
+
readonly isOpen?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Marks the label with an asterisk, as the text fields page marks a field
|
|
54
|
+
* that must be filled. Inside a `native` form, a field left empty holds
|
|
55
|
+
* the form back.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
readonly isRequired?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* What the field is for, and the name a screen reader reads for it before
|
|
61
|
+
* its value. Required, since a select with no label is a box nobody can
|
|
62
|
+
* name.
|
|
63
|
+
*/
|
|
64
|
+
readonly label: string;
|
|
65
|
+
/**
|
|
66
|
+
* An icon at the start of the box, before the label and the value: the
|
|
67
|
+
* page's 24dp leading icon, in the muted role. The slot hands it that
|
|
68
|
+
* colour and size through `useIconStyle()`.
|
|
69
|
+
*/
|
|
70
|
+
readonly leadingIcon?: ReactNode;
|
|
71
|
+
/**
|
|
72
|
+
* The name the value is submitted under by the `Form` around the field,
|
|
73
|
+
* and the key its `validationErrors` reach the field by. A select with
|
|
74
|
+
* nothing chosen submits an empty string, and one choosing several
|
|
75
|
+
* submits the list of their `id`s.
|
|
76
|
+
*/
|
|
77
|
+
readonly name?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Called with what is chosen whenever it changes: an option's `id`, or
|
|
80
|
+
* the list of them with `selectionMode="multiple"`.
|
|
81
|
+
*/
|
|
82
|
+
readonly onChange?: (value: ChangeValueType<M>) => void;
|
|
83
|
+
/** Called with whether the list is open whenever that changes. */
|
|
84
|
+
readonly onOpenChange?: (isOpen: boolean) => void;
|
|
85
|
+
/**
|
|
86
|
+
* The options, a `ListBox.Item` for each and `ListBox.Section` to group
|
|
87
|
+
* them. The list is a ListBox's, and draws every slot one does. Give
|
|
88
|
+
* every option an `id`, which is what the value holds.
|
|
89
|
+
*/
|
|
90
|
+
readonly options?: ReactNode;
|
|
91
|
+
/**
|
|
92
|
+
* What the box shows while nothing is chosen. Left out, it is "Select an
|
|
93
|
+
* item" in the `I18nProvider`'s language, or the device's outside one.
|
|
94
|
+
*/
|
|
95
|
+
readonly placeholder?: string;
|
|
96
|
+
readonly ref?: Ref<ComponentRef<typeof View>>;
|
|
97
|
+
/**
|
|
98
|
+
* Whether one option is chosen, or several. A select choosing several
|
|
99
|
+
* stays open as they are pressed.
|
|
100
|
+
* @default 'single'
|
|
101
|
+
*/
|
|
102
|
+
readonly selectionMode?: M;
|
|
103
|
+
/**
|
|
104
|
+
* Whether a press on an option closes the list.
|
|
105
|
+
* @default true with one option chosen, false with several
|
|
106
|
+
*/
|
|
107
|
+
readonly shouldCloseOnSelect?: boolean;
|
|
108
|
+
/** Positions and sizes the field as a whole. */
|
|
109
|
+
readonly style?: StyleProp<ViewStyle>;
|
|
110
|
+
/** The test id of the box, which is the control. */
|
|
111
|
+
readonly testID?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Checks the value, and returns its problem in words, or several, where
|
|
114
|
+
* there is one, and `true`, `null` or `undefined` where there is none.
|
|
115
|
+
* Under the default `aria` validation the error shows as the value
|
|
116
|
+
* changes; inside a `native` form it shows once a submission is tried, or
|
|
117
|
+
* once something is chosen, and holds the form back.
|
|
118
|
+
*/
|
|
119
|
+
readonly validate?: (value: ValueType<M>) => ValidationResult;
|
|
120
|
+
/** What is chosen, when the call site holds it. */
|
|
121
|
+
readonly value?: ValueType<M>;
|
|
122
|
+
/**
|
|
123
|
+
* The filled box, or the outlined one, as the text fields page draws them.
|
|
124
|
+
* @default 'filled'
|
|
125
|
+
*/
|
|
126
|
+
readonly variant?: FieldVariant;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* A labelled field that opens a list to choose from. Pass `value` with
|
|
130
|
+
* `onChange` to hold what is chosen, or `defaultValue` to let the select
|
|
131
|
+
* keep its own. The value is an option's `id`, so give every option one;
|
|
132
|
+
* with `selectionMode="multiple"` it is a list of them.
|
|
133
|
+
*
|
|
134
|
+
* ```tsx
|
|
135
|
+
* <Select
|
|
136
|
+
* label="Label"
|
|
137
|
+
* options={[
|
|
138
|
+
* <ListBox.Item id="first" key="first">First item</ListBox.Item>,
|
|
139
|
+
* <ListBox.Item id="second" key="second">Second item</ListBox.Item>,
|
|
140
|
+
* ]}
|
|
141
|
+
* />
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* The box, the label, the supporting line and the error are the field chrome
|
|
145
|
+
* every field here draws; the list is a ListBox's, on the surface every
|
|
146
|
+
* anchored panel here draws. `style` and `ref` are the field as a whole, and
|
|
147
|
+
* `testID` the box.
|
|
148
|
+
*/
|
|
149
|
+
declare function Select<M extends SelectionMode$1 = 'single'>({ allowsEmptyCollection, defaultOpen, defaultValue, description, disabledKeys, error, floatingLabel, isDisabled, isOpen, isRequired, label, leadingIcon, name, onChange, onOpenChange, options, placeholder, ref, selectionMode, shouldCloseOnSelect, style, testID, validate, value, variant }: SelectProps<M>): import("react").JSX.Element;
|
|
150
|
+
//#endregion
|
|
151
|
+
export { Select, type SelectProps };
|
|
152
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { useTheme } from "../../theme/scope.js";
|
|
2
|
+
import { composeStyles, themedStyles } from "../../theme/styles.js";
|
|
3
|
+
import { listFor } from "../../i18n/index.js";
|
|
4
|
+
import { useLocaleOf, useMessages } from "../../i18n/provider.js";
|
|
5
|
+
import { useFieldValidation } from "../../form/index.js";
|
|
6
|
+
import { DismissLayer, PANEL_ORIGINS, useBackToClose, useFocusOnPlaced, usePanelMotion, useReturnFocus } from "../../overlay/panel.js";
|
|
7
|
+
import { FieldChevron } from "../../field/chevron.js";
|
|
8
|
+
import { FieldBox, FieldMessage, FieldValue, describedBy } from "../../field/index.js";
|
|
9
|
+
import { Overlay } from "../../overlay/host.js";
|
|
10
|
+
import { useAnchoredPlacement } from "../../overlay/anchored.js";
|
|
11
|
+
import { CollectionView, focusKeyOf } from "../../collection/index.js";
|
|
12
|
+
import { c } from "react/compiler-runtime";
|
|
13
|
+
import { StyleSheet, View } from "react-native";
|
|
14
|
+
import Animated from "react-native-reanimated";
|
|
15
|
+
import { useId, useRef, useState } from "react";
|
|
16
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { useSelectState } from "react-stately/useSelectState";
|
|
18
|
+
//#region src/components/select/index.tsx
|
|
19
|
+
const SHRINKS = { flexGrow: 0 };
|
|
20
|
+
const stylesOf = themedStyles(({ colors, radii, shadows }) => StyleSheet.create({ list: {
|
|
21
|
+
backgroundColor: colors.surfaceContainerLow,
|
|
22
|
+
borderRadius: radii.xs,
|
|
23
|
+
boxShadow: shadows.elevation2,
|
|
24
|
+
overflow: "hidden"
|
|
25
|
+
} }));
|
|
26
|
+
function chevronFor(isOpen) {
|
|
27
|
+
return /* @__PURE__ */ jsx(FieldChevron, { isOpen });
|
|
28
|
+
}
|
|
29
|
+
function keysOf(value) {
|
|
30
|
+
if (value === null) return [];
|
|
31
|
+
return typeof value === "object" ? value : [value];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A labelled field that opens a list to choose from. Pass `value` with
|
|
35
|
+
* `onChange` to hold what is chosen, or `defaultValue` to let the select
|
|
36
|
+
* keep its own. The value is an option's `id`, so give every option one;
|
|
37
|
+
* with `selectionMode="multiple"` it is a list of them.
|
|
38
|
+
*
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <Select
|
|
41
|
+
* label="Label"
|
|
42
|
+
* options={[
|
|
43
|
+
* <ListBox.Item id="first" key="first">First item</ListBox.Item>,
|
|
44
|
+
* <ListBox.Item id="second" key="second">Second item</ListBox.Item>,
|
|
45
|
+
* ]}
|
|
46
|
+
* />
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* The box, the label, the supporting line and the error are the field chrome
|
|
50
|
+
* every field here draws; the list is a ListBox's, on the surface every
|
|
51
|
+
* anchored panel here draws. `style` and `ref` are the field as a whole, and
|
|
52
|
+
* `testID` the box.
|
|
53
|
+
*/
|
|
54
|
+
function Select(t0) {
|
|
55
|
+
const $ = c(65);
|
|
56
|
+
const { allowsEmptyCollection, defaultOpen, defaultValue, description, disabledKeys, error, floatingLabel: t1, isDisabled: t2, isOpen, isRequired: t3, label, leadingIcon, name, onChange, onOpenChange, options, placeholder, ref, selectionMode, shouldCloseOnSelect, style, testID, validate, value, variant: t4 } = t0;
|
|
57
|
+
const floatingLabel = t1 === void 0 ? true : t1;
|
|
58
|
+
const isDisabled = t2 === void 0 ? false : t2;
|
|
59
|
+
const isRequired = t3 === void 0 ? false : t3;
|
|
60
|
+
const variant = t4 === void 0 ? "filled" : t4;
|
|
61
|
+
const id = useId();
|
|
62
|
+
const box = useRef(null);
|
|
63
|
+
const [focused, setFocused] = useState(false);
|
|
64
|
+
const messages = useMessages();
|
|
65
|
+
const locale = useLocaleOf(void 0);
|
|
66
|
+
const state = useSelectState({
|
|
67
|
+
allowsEmptyCollection,
|
|
68
|
+
children: options,
|
|
69
|
+
defaultOpen,
|
|
70
|
+
defaultValue,
|
|
71
|
+
disabledKeys,
|
|
72
|
+
isDisabled,
|
|
73
|
+
isOpen,
|
|
74
|
+
onChange: (changed) => {
|
|
75
|
+
validation.onEdit();
|
|
76
|
+
validation.onBlur();
|
|
77
|
+
onChange?.(changed);
|
|
78
|
+
},
|
|
79
|
+
onOpenChange,
|
|
80
|
+
selectionMode,
|
|
81
|
+
shouldCloseOnSelect,
|
|
82
|
+
value
|
|
83
|
+
});
|
|
84
|
+
let t10;
|
|
85
|
+
let t11;
|
|
86
|
+
let t12;
|
|
87
|
+
let t13;
|
|
88
|
+
let t5;
|
|
89
|
+
let t6;
|
|
90
|
+
let t7;
|
|
91
|
+
let t8;
|
|
92
|
+
let t9;
|
|
93
|
+
if ($[0] !== error || $[1] !== isDisabled || $[2] !== isRequired || $[3] !== name || $[4] !== state.selectionManager.selectionMode || $[5] !== state.value) {
|
|
94
|
+
const chosen = keysOf(state.value);
|
|
95
|
+
const several = state.selectionManager.selectionMode === "multiple";
|
|
96
|
+
t13 = useFieldValidation;
|
|
97
|
+
t5 = box;
|
|
98
|
+
t6 = error;
|
|
99
|
+
t7 = isDisabled;
|
|
100
|
+
t8 = chosen.length === 0;
|
|
101
|
+
t9 = false;
|
|
102
|
+
t10 = isRequired;
|
|
103
|
+
t11 = name;
|
|
104
|
+
t12 = several ? chosen.map(String) : String(chosen[0] ?? "");
|
|
105
|
+
$[0] = error;
|
|
106
|
+
$[1] = isDisabled;
|
|
107
|
+
$[2] = isRequired;
|
|
108
|
+
$[3] = name;
|
|
109
|
+
$[4] = state.selectionManager.selectionMode;
|
|
110
|
+
$[5] = state.value;
|
|
111
|
+
$[6] = t10;
|
|
112
|
+
$[7] = t11;
|
|
113
|
+
$[8] = t12;
|
|
114
|
+
$[9] = t13;
|
|
115
|
+
$[10] = t5;
|
|
116
|
+
$[11] = t6;
|
|
117
|
+
$[12] = t7;
|
|
118
|
+
$[13] = t8;
|
|
119
|
+
$[14] = t9;
|
|
120
|
+
} else {
|
|
121
|
+
t10 = $[6];
|
|
122
|
+
t11 = $[7];
|
|
123
|
+
t12 = $[8];
|
|
124
|
+
t13 = $[9];
|
|
125
|
+
t5 = $[10];
|
|
126
|
+
t6 = $[11];
|
|
127
|
+
t7 = $[12];
|
|
128
|
+
t8 = $[13];
|
|
129
|
+
t9 = $[14];
|
|
130
|
+
}
|
|
131
|
+
let t14;
|
|
132
|
+
if ($[15] !== state.value || $[16] !== t10 || $[17] !== t11 || $[18] !== t12 || $[19] !== t5 || $[20] !== t6 || $[21] !== t7 || $[22] !== t8 || $[23] !== t9 || $[24] !== validate) {
|
|
133
|
+
t14 = {
|
|
134
|
+
control: t5,
|
|
135
|
+
error: t6,
|
|
136
|
+
isDisabled: t7,
|
|
137
|
+
isEmpty: t8,
|
|
138
|
+
isReadOnly: t9,
|
|
139
|
+
isRequired: t10,
|
|
140
|
+
name: t11,
|
|
141
|
+
submitted: t12,
|
|
142
|
+
validate,
|
|
143
|
+
value: state.value
|
|
144
|
+
};
|
|
145
|
+
$[15] = state.value;
|
|
146
|
+
$[16] = t10;
|
|
147
|
+
$[17] = t11;
|
|
148
|
+
$[18] = t12;
|
|
149
|
+
$[19] = t5;
|
|
150
|
+
$[20] = t6;
|
|
151
|
+
$[21] = t7;
|
|
152
|
+
$[22] = t8;
|
|
153
|
+
$[23] = t9;
|
|
154
|
+
$[24] = validate;
|
|
155
|
+
$[25] = t14;
|
|
156
|
+
} else t14 = $[25];
|
|
157
|
+
const validation = t13(t14);
|
|
158
|
+
const shownError = validation.error;
|
|
159
|
+
const isPlaceholder = state.selectedItems.length === 0;
|
|
160
|
+
let t15;
|
|
161
|
+
if ($[26] !== isPlaceholder || $[27] !== locale || $[28] !== messages || $[29] !== placeholder || $[30] !== state.selectedItems) {
|
|
162
|
+
t15 = isPlaceholder ? placeholder ?? messages.selectPlaceholder : listFor(state.selectedItems.map(_temp), locale);
|
|
163
|
+
$[26] = isPlaceholder;
|
|
164
|
+
$[27] = locale;
|
|
165
|
+
$[28] = messages;
|
|
166
|
+
$[29] = placeholder;
|
|
167
|
+
$[30] = state.selectedItems;
|
|
168
|
+
$[31] = t15;
|
|
169
|
+
} else t15 = $[31];
|
|
170
|
+
const shown = t15;
|
|
171
|
+
const T0 = View;
|
|
172
|
+
const T1 = FieldBox;
|
|
173
|
+
const t16 = state.isOpen || focused;
|
|
174
|
+
const t17 = shownError !== void 0;
|
|
175
|
+
const t18 = !isPlaceholder;
|
|
176
|
+
let t19;
|
|
177
|
+
if ($[32] !== state.isOpen) {
|
|
178
|
+
t19 = chevronFor(state.isOpen);
|
|
179
|
+
$[32] = state.isOpen;
|
|
180
|
+
$[33] = t19;
|
|
181
|
+
} else t19 = $[33];
|
|
182
|
+
const t20 = triggerFor(state, {
|
|
183
|
+
described: describedBy(id, {
|
|
184
|
+
description,
|
|
185
|
+
error: shownError
|
|
186
|
+
}),
|
|
187
|
+
name: `${label} ${shown}`,
|
|
188
|
+
setFocused,
|
|
189
|
+
testID
|
|
190
|
+
});
|
|
191
|
+
let t21;
|
|
192
|
+
if ($[34] !== isPlaceholder || $[35] !== shown) {
|
|
193
|
+
t21 = /* @__PURE__ */ jsx(FieldValue, {
|
|
194
|
+
isPlaceholder,
|
|
195
|
+
children: shown
|
|
196
|
+
});
|
|
197
|
+
$[34] = isPlaceholder;
|
|
198
|
+
$[35] = shown;
|
|
199
|
+
$[36] = t21;
|
|
200
|
+
} else t21 = $[36];
|
|
201
|
+
let t22;
|
|
202
|
+
if ($[37] !== T1 || $[38] !== floatingLabel || $[39] !== isDisabled || $[40] !== isRequired || $[41] !== label || $[42] !== leadingIcon || $[43] !== t16 || $[44] !== t17 || $[45] !== t18 || $[46] !== t19 || $[47] !== t20 || $[48] !== t21 || $[49] !== variant) {
|
|
203
|
+
t22 = /* @__PURE__ */ jsx(T1, {
|
|
204
|
+
floatingLabel,
|
|
205
|
+
isDisabled,
|
|
206
|
+
isFocused: t16,
|
|
207
|
+
isInvalid: t17,
|
|
208
|
+
isPopulated: t18,
|
|
209
|
+
isRequired,
|
|
210
|
+
label,
|
|
211
|
+
leading: leadingIcon,
|
|
212
|
+
ref: box,
|
|
213
|
+
trailing: t19,
|
|
214
|
+
trigger: t20,
|
|
215
|
+
variant,
|
|
216
|
+
children: t21
|
|
217
|
+
});
|
|
218
|
+
$[37] = T1;
|
|
219
|
+
$[38] = floatingLabel;
|
|
220
|
+
$[39] = isDisabled;
|
|
221
|
+
$[40] = isRequired;
|
|
222
|
+
$[41] = label;
|
|
223
|
+
$[42] = leadingIcon;
|
|
224
|
+
$[43] = t16;
|
|
225
|
+
$[44] = t17;
|
|
226
|
+
$[45] = t18;
|
|
227
|
+
$[46] = t19;
|
|
228
|
+
$[47] = t20;
|
|
229
|
+
$[48] = t21;
|
|
230
|
+
$[49] = variant;
|
|
231
|
+
$[50] = t22;
|
|
232
|
+
} else t22 = $[50];
|
|
233
|
+
let t23;
|
|
234
|
+
if ($[51] !== description || $[52] !== id || $[53] !== shownError) {
|
|
235
|
+
t23 = /* @__PURE__ */ jsx(FieldMessage, {
|
|
236
|
+
description,
|
|
237
|
+
error: shownError,
|
|
238
|
+
id
|
|
239
|
+
});
|
|
240
|
+
$[51] = description;
|
|
241
|
+
$[52] = id;
|
|
242
|
+
$[53] = shownError;
|
|
243
|
+
$[54] = t23;
|
|
244
|
+
} else t23 = $[54];
|
|
245
|
+
let t24;
|
|
246
|
+
if ($[55] !== label || $[56] !== state) {
|
|
247
|
+
t24 = /* @__PURE__ */ jsx(SelectPopup, {
|
|
248
|
+
anchor: box,
|
|
249
|
+
label,
|
|
250
|
+
state
|
|
251
|
+
});
|
|
252
|
+
$[55] = label;
|
|
253
|
+
$[56] = state;
|
|
254
|
+
$[57] = t24;
|
|
255
|
+
} else t24 = $[57];
|
|
256
|
+
let t25;
|
|
257
|
+
if ($[58] !== T0 || $[59] !== ref || $[60] !== style || $[61] !== t22 || $[62] !== t23 || $[63] !== t24) {
|
|
258
|
+
t25 = /* @__PURE__ */ jsxs(T0, {
|
|
259
|
+
ref,
|
|
260
|
+
style,
|
|
261
|
+
children: [
|
|
262
|
+
t22,
|
|
263
|
+
t23,
|
|
264
|
+
t24
|
|
265
|
+
]
|
|
266
|
+
});
|
|
267
|
+
$[58] = T0;
|
|
268
|
+
$[59] = ref;
|
|
269
|
+
$[60] = style;
|
|
270
|
+
$[61] = t22;
|
|
271
|
+
$[62] = t23;
|
|
272
|
+
$[63] = t24;
|
|
273
|
+
$[64] = t25;
|
|
274
|
+
} else t25 = $[64];
|
|
275
|
+
return t25;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* The list, drawn in the overlay host above the screen and placed under the
|
|
279
|
+
* box: as wide as the box, flipped above it at the edge of the window, and
|
|
280
|
+
* scrolled to the option a screen reader is sent to once it has been placed.
|
|
281
|
+
*/
|
|
282
|
+
function _temp(item) {
|
|
283
|
+
return item.textValue;
|
|
284
|
+
}
|
|
285
|
+
function SelectList(t0) {
|
|
286
|
+
const $ = c(23);
|
|
287
|
+
const { anchor, isOpen, label, setPresent, state } = t0;
|
|
288
|
+
const styles = stylesOf(useTheme());
|
|
289
|
+
let t1;
|
|
290
|
+
if ($[0] !== anchor) {
|
|
291
|
+
t1 = {
|
|
292
|
+
align: "start",
|
|
293
|
+
anchor
|
|
294
|
+
};
|
|
295
|
+
$[0] = anchor;
|
|
296
|
+
$[1] = t1;
|
|
297
|
+
} else t1 = $[1];
|
|
298
|
+
const placement = useAnchoredPlacement(t1);
|
|
299
|
+
const motion = usePanelMotion(isOpen, placement.placed, setPresent);
|
|
300
|
+
const [panel, setPanel] = useState(null);
|
|
301
|
+
const [option, setOption] = useState(null);
|
|
302
|
+
const close = state.close;
|
|
303
|
+
useBackToClose(close, isOpen);
|
|
304
|
+
useFocusOnPlaced(isOpen && placement.placed, option ?? panel);
|
|
305
|
+
let t2;
|
|
306
|
+
if ($[2] !== close || $[3] !== isOpen) {
|
|
307
|
+
t2 = isOpen ? /* @__PURE__ */ jsx(DismissLayer, { onPress: close }) : null;
|
|
308
|
+
$[2] = close;
|
|
309
|
+
$[3] = isOpen;
|
|
310
|
+
$[4] = t2;
|
|
311
|
+
} else t2 = $[4];
|
|
312
|
+
const t3 = Animated;
|
|
313
|
+
const t4 = placement.onLayout;
|
|
314
|
+
const t5 = composeStyles(styles.list, { width: placement.anchorWidth }, placement.style, { transformOrigin: PANEL_ORIGINS[placement.side] }, motion);
|
|
315
|
+
let t6;
|
|
316
|
+
if ($[5] !== state) {
|
|
317
|
+
t6 = focusKeyOf(state);
|
|
318
|
+
$[5] = state;
|
|
319
|
+
$[6] = t6;
|
|
320
|
+
} else t6 = $[6];
|
|
321
|
+
let t7;
|
|
322
|
+
if ($[7] !== label || $[8] !== placement.placed || $[9] !== setOption || $[10] !== state || $[11] !== t6) {
|
|
323
|
+
t7 = /* @__PURE__ */ jsx(CollectionView, {
|
|
324
|
+
"aria-label": label,
|
|
325
|
+
focusKey: t6,
|
|
326
|
+
kind: "listbox",
|
|
327
|
+
onFocusTarget: setOption,
|
|
328
|
+
revealFocus: placement.placed,
|
|
329
|
+
state,
|
|
330
|
+
style: SHRINKS
|
|
331
|
+
});
|
|
332
|
+
$[7] = label;
|
|
333
|
+
$[8] = placement.placed;
|
|
334
|
+
$[9] = setOption;
|
|
335
|
+
$[10] = state;
|
|
336
|
+
$[11] = t6;
|
|
337
|
+
$[12] = t7;
|
|
338
|
+
} else t7 = $[12];
|
|
339
|
+
let t8;
|
|
340
|
+
if ($[13] !== close || $[14] !== placement.onLayout || $[15] !== setPanel || $[16] !== t3.View || $[17] !== t5 || $[18] !== t7) {
|
|
341
|
+
t8 = /* @__PURE__ */ jsx(t3.View, {
|
|
342
|
+
onAccessibilityEscape: close,
|
|
343
|
+
onLayout: t4,
|
|
344
|
+
ref: setPanel,
|
|
345
|
+
style: t5,
|
|
346
|
+
children: t7
|
|
347
|
+
});
|
|
348
|
+
$[13] = close;
|
|
349
|
+
$[14] = placement.onLayout;
|
|
350
|
+
$[15] = setPanel;
|
|
351
|
+
$[16] = t3.View;
|
|
352
|
+
$[17] = t5;
|
|
353
|
+
$[18] = t7;
|
|
354
|
+
$[19] = t8;
|
|
355
|
+
} else t8 = $[19];
|
|
356
|
+
let t9;
|
|
357
|
+
if ($[20] !== t2 || $[21] !== t8) {
|
|
358
|
+
t9 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t2, t8] });
|
|
359
|
+
$[20] = t2;
|
|
360
|
+
$[21] = t8;
|
|
361
|
+
$[22] = t9;
|
|
362
|
+
} else t9 = $[22];
|
|
363
|
+
return t9;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* The list while it is open and while its exit runs: mounted the moment the
|
|
367
|
+
* select opens, and kept until the list has faded out. A screen reader goes
|
|
368
|
+
* back to the box once it has gone.
|
|
369
|
+
*/
|
|
370
|
+
function SelectPopup(t0) {
|
|
371
|
+
const $ = c(4);
|
|
372
|
+
const { anchor, label, state } = t0;
|
|
373
|
+
const [present, setPresent] = useState(state.isOpen);
|
|
374
|
+
if (state.isOpen && !present) setPresent(true);
|
|
375
|
+
useReturnFocus(present, false, anchor);
|
|
376
|
+
if (!present) return null;
|
|
377
|
+
let t1;
|
|
378
|
+
if ($[0] !== anchor || $[1] !== label || $[2] !== state) {
|
|
379
|
+
t1 = /* @__PURE__ */ jsx(Overlay, { children: /* @__PURE__ */ jsx(SelectList, {
|
|
380
|
+
anchor,
|
|
381
|
+
isOpen: state.isOpen,
|
|
382
|
+
label,
|
|
383
|
+
setPresent,
|
|
384
|
+
state
|
|
385
|
+
}) });
|
|
386
|
+
$[0] = anchor;
|
|
387
|
+
$[1] = label;
|
|
388
|
+
$[2] = state;
|
|
389
|
+
$[3] = t1;
|
|
390
|
+
} else t1 = $[3];
|
|
391
|
+
return t1;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* The box as the select's control: named by its label and what it shows,
|
|
395
|
+
* described by the line under it, saying whether its list is open, and
|
|
396
|
+
* opening or closing the list when pressed. It tracks its own focus, for a
|
|
397
|
+
* keyboard reaching it, which the box draws as it draws a focused field.
|
|
398
|
+
*/
|
|
399
|
+
function triggerFor(state, { described, name, setFocused, testID }) {
|
|
400
|
+
return {
|
|
401
|
+
"aria-expanded": state.isOpen,
|
|
402
|
+
"aria-label": name,
|
|
403
|
+
described,
|
|
404
|
+
onBlur: () => {
|
|
405
|
+
setFocused(false);
|
|
406
|
+
},
|
|
407
|
+
onFocus: () => {
|
|
408
|
+
setFocused(true);
|
|
409
|
+
},
|
|
410
|
+
onPress: () => {
|
|
411
|
+
state.toggle();
|
|
412
|
+
},
|
|
413
|
+
testID
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
//#endregion
|
|
417
|
+
export { Select };
|
|
418
|
+
|
|
419
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","RefObject","HostInstance","StyleProp","ViewStyle","AnimatedStyle","Key","ListProps","StatelyListProps","ChangeValueType","SelectionMode","SelectState","ValueType","useId","useRef","useState","StyleSheet","View","Animated","useSelectState","FieldTriggerProps","FieldVariant","ValidationResult","ResolvedTheme","CollectionView","focusKeyOf","describedBy","FieldBox","FieldChevron","FieldMessage","FieldValue","useFieldValidation","listFor","useLocaleOf","useMessages","Overlay","useAnchoredPlacement","DismissLayer","PANEL_ORIGINS","useBackToClose","useFocusOnPlaced","usePanelMotion","useReturnFocus","useTheme","composeStyles","themedStyles","SelectListProps","anchor","isOpen","label","setPresent","present","state","SelectProps","allowsEmptyCollection","defaultOpen","defaultValue","M","description","disabledKeys","Iterable","error","floatingLabel","isDisabled","isRequired","leadingIcon","name","onChange","value","onOpenChange","options","placeholder","ref","selectionMode","shouldCloseOnSelect","style","testID","validate","variant","SHRINKS","flexGrow","stylesOf","colors","radii","shadows","create","list","backgroundColor","surfaceContainerLow","borderRadius","xs","boxShadow","elevation2","overflow","chevronFor","keysOf","Select","t0","$","_c","t1","t2","t3","t4","undefined","id","box","focused","setFocused","messages","locale","children","changed","validation","onEdit","onBlur","t10","t11","t12","t13","t5","t6","t7","t8","t9","selectionManager","chosen","several","length","map","String","t14","control","isEmpty","isReadOnly","submitted","shownError","isPlaceholder","selectedItems","t15","selectPlaceholder","_temp","shown","T0","T1","t16","t17","t18","t19","t20","triggerFor","described","t21","t22","t23","t24","t25","item","textValue","SelectList","styles","align","placement","motion","placed","panel","setPanel","option","setOption","close","onLayout","width","anchorWidth","transformOrigin","side","SelectPopup","onFocus","onPress","toggle","_c"],"sources":["../../../src/components/select/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref, RefObject } from 'react'\nimport type { HostInstance, StyleProp, ViewStyle } from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\nimport type { Key } from 'react-stately'\nimport type { ListProps as StatelyListProps } from 'react-stately/useListState'\nimport type {\n ChangeValueType,\n SelectionMode,\n SelectState,\n ValueType,\n} from 'react-stately/useSelectState'\n\nimport { useId, useRef, useState } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport Animated from 'react-native-reanimated'\nimport { useSelectState } from 'react-stately/useSelectState'\n\nimport type { FieldTriggerProps, FieldVariant } from '../../field'\nimport type { ValidationResult } from '../../form'\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport { CollectionView, focusKeyOf } from '../../collection'\nimport {\n describedBy,\n FieldBox,\n FieldChevron,\n FieldMessage,\n FieldValue,\n} from '../../field'\nimport { useFieldValidation } from '../../form'\nimport { listFor } from '../../i18n'\nimport { useLocaleOf, useMessages } from '../../i18n/provider'\nimport { Overlay, useAnchoredPlacement } from '../../overlay'\nimport {\n DismissLayer,\n PANEL_ORIGINS,\n useBackToClose,\n useFocusOnPlaced,\n usePanelMotion,\n useReturnFocus,\n} from '../../overlay/panel'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// kanso-ui's Select, the menus page's exposed dropdown menu: a field that\n// opens a list rather than taking a keystroke. Everything above the list is\n// the field chrome in src/field, the box, the label, the supporting line and\n// the error every field here draws, and the list is ListBox's, through\n// src/collection, on the surface every anchored panel here draws, placed by\n// src/overlay. What is here is React Stately's select state around the two,\n// and the things that are this component's own, which are web's.\n//\n// **The whole box opens the list.** The box is the control, a button a\n// screen reader reads as the label and then the value, so its padding, its\n// label and its icons all open the list, as the page draws it and as web's\n// does. Web's names its button the other way round, the value first, but its\n// label sits outside the button; here the label is inside it, drawn before\n// the value, and a name that reads what the box draws in the order it draws\n// it is what WCAG's label in name asks for.\n//\n// **The chevron turns.** The page's trailing icon points down while the list\n// is closed and up while it is open, turned on the step the list arrives on,\n// as src/field's chevron turns for every field that opens a list.\n//\n// **The list is the field's width**, under the field, and above it where the\n// window has no room below. It grows from the edge facing the field, as\n// every anchored panel here does, on surface container low with the\n// extra-small corner and the second elevation. A press outside it closes it,\n// as do Android's back gesture and VoiceOver's escape gesture.\n//\n// **A screen reader is sent to the chosen option as the list opens**, or to\n// the first option that takes a press where nothing is chosen, and back to\n// the field as it closes. A list taller than its room opens scrolled to the\n// chosen option.\n//\n// The value shown is each chosen option's `textValue`, its headline where\n// that is a string, and the chosen options' values joined into a list in the\n// locale's words where several are chosen. Where nothing is, the box shows\n// `placeholder`, or \"Select an item\" in the locale's words, React Aria's.\n//\n// Two things web's has that this does not, each because React Native has no\n// counterpart. A keyboard on web moves through the options and picks one by\n// typing its first letters; on a phone the list is touched or read by a\n// screen reader, which moves through it itself. And web's box tells a screen\n// reader it opens a listbox; React Native has neither the popup property nor\n// the listbox role, so the box is a button that says whether its list is\n// expanded, and the options are buttons that say whether they are chosen.\n\ntype SelectListProps = {\n readonly anchor: RefObject<HostInstance | null>\n readonly isOpen: boolean\n readonly label: string\n readonly setPresent: (present: boolean) => void\n readonly state: SelectState<object, SelectionMode>\n}\n\ntype SelectProps<M extends SelectionMode = 'single'> = {\n /**\n * Lets the list open with no options in it, showing its empty state.\n * Left off, a press on a select with no options does nothing.\n * @default false\n */\n readonly allowsEmptyCollection?: boolean\n /** Whether the list is open at first, when the select keeps its own. */\n readonly defaultOpen?: boolean\n /**\n * What is chosen at first, when the select keeps its own value: an\n * option's `id`, or a list of them with `selectionMode=\"multiple\"`.\n */\n readonly defaultValue?: ValueType<M>\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n readonly description?: string\n /** The `id`s of the options drawn disabled, which take no presses. */\n readonly disabledKeys?: Iterable<Key>\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state: the message, the error colours, and the\n * error a screen reader reads with the field all follow from it. The line\n * under the field arrives with the message, so the field grows when this\n * does, unless it is inside a `Form`, which keeps the line drawn. It wins\n * over what `validate` and the form say, and holds a `native` form back.\n */\n readonly error?: string\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * list is open or something is chosen. `false` keeps it small at the top\n * in every state.\n * @default true\n */\n readonly floatingLabel?: boolean\n /**\n * Draws the field disabled: it takes no presses and its list never opens.\n * @default false\n */\n readonly isDisabled?: boolean\n /** Whether the list is open, when the call site holds it. */\n readonly isOpen?: boolean\n /**\n * Marks the label with an asterisk, as the text fields page marks a field\n * that must be filled. Inside a `native` form, a field left empty holds\n * the form back.\n * @default false\n */\n readonly isRequired?: boolean\n /**\n * What the field is for, and the name a screen reader reads for it before\n * its value. Required, since a select with no label is a box nobody can\n * name.\n */\n readonly label: string\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. The slot hands it that\n * colour and size through `useIconStyle()`.\n */\n readonly leadingIcon?: ReactNode\n /**\n * The name the value is submitted under by the `Form` around the field,\n * and the key its `validationErrors` reach the field by. A select with\n * nothing chosen submits an empty string, and one choosing several\n * submits the list of their `id`s.\n */\n readonly name?: string\n /**\n * Called with what is chosen whenever it changes: an option's `id`, or\n * the list of them with `selectionMode=\"multiple\"`.\n */\n readonly onChange?: (value: ChangeValueType<M>) => void\n /** Called with whether the list is open whenever that changes. */\n readonly onOpenChange?: (isOpen: boolean) => void\n /**\n * The options, a `ListBox.Item` for each and `ListBox.Section` to group\n * them. The list is a ListBox's, and draws every slot one does. Give\n * every option an `id`, which is what the value holds.\n */\n readonly options?: ReactNode\n /**\n * What the box shows while nothing is chosen. Left out, it is \"Select an\n * item\" in the `I18nProvider`'s language, or the device's outside one.\n */\n readonly placeholder?: string\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * Whether one option is chosen, or several. A select choosing several\n * stays open as they are pressed.\n * @default 'single'\n */\n readonly selectionMode?: M\n /**\n * Whether a press on an option closes the list.\n * @default true with one option chosen, false with several\n */\n readonly shouldCloseOnSelect?: boolean\n /** Positions and sizes the field as a whole. */\n readonly style?: StyleProp<ViewStyle>\n /** The test id of the box, which is the control. */\n readonly testID?: string\n /**\n * Checks the value, and returns its problem in words, or several, where\n * there is one, and `true`, `null` or `undefined` where there is none.\n * Under the default `aria` validation the error shows as the value\n * changes; inside a `native` form it shows once a submission is tried, or\n * once something is chosen, and holds the form back.\n */\n readonly validate?: (value: ValueType<M>) => ValidationResult\n /** What is chosen, when the call site holds it. */\n readonly value?: ValueType<M>\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n readonly variant?: FieldVariant\n}\n\n// The list never grows past its room, and the rows scroll inside it.\nconst SHRINKS: ViewStyle = { flexGrow: 0 }\n\nconst stylesOf = themedStyles(({ colors, radii, shadows }: ResolvedTheme) =>\n StyleSheet.create({\n // The menus page's list surface: surface container low, the\n // extra-small corner and the second elevation, clipping its rows to\n // the corner.\n list: {\n backgroundColor: colors.surfaceContainerLow,\n borderRadius: radii.xs,\n boxShadow: shadows.elevation2,\n overflow: 'hidden',\n },\n }),\n)\n\n// The chevron, turned or not. A call rather than JSX written at the prop,\n// which is what react-perf's jsx-no-jsx-as-prop is after; the React Compiler\n// memoises the result on `isOpen`.\nfunction chevronFor(isOpen: boolean) {\n return <FieldChevron isOpen={isOpen} />\n}\n\n// The keys a select's value holds, one or several, as a list.\nfunction keysOf(value: Key | null | readonly Key[]): readonly Key[] {\n if (value === null) {\n return []\n }\n\n return typeof value === 'object' ? value : [value]\n}\n\n/**\n * A labelled field that opens a list to choose from. Pass `value` with\n * `onChange` to hold what is chosen, or `defaultValue` to let the select\n * keep its own. The value is an option's `id`, so give every option one;\n * with `selectionMode=\"multiple\"` it is a list of them.\n *\n * ```tsx\n * <Select\n * label=\"Label\"\n * options={[\n * <ListBox.Item id=\"first\" key=\"first\">First item</ListBox.Item>,\n * <ListBox.Item id=\"second\" key=\"second\">Second item</ListBox.Item>,\n * ]}\n * />\n * ```\n *\n * The box, the label, the supporting line and the error are the field chrome\n * every field here draws; the list is a ListBox's, on the surface every\n * anchored panel here draws. `style` and `ref` are the field as a whole, and\n * `testID` the box.\n */\nfunction Select<M extends SelectionMode = 'single'>({\n allowsEmptyCollection,\n defaultOpen,\n defaultValue,\n description,\n disabledKeys,\n error,\n floatingLabel = true,\n isDisabled = false,\n isOpen,\n isRequired = false,\n label,\n leadingIcon,\n name,\n onChange,\n onOpenChange,\n options,\n placeholder,\n ref,\n selectionMode,\n shouldCloseOnSelect,\n style,\n testID,\n validate,\n value,\n variant = 'filled',\n}: SelectProps<M>) {\n const id = useId()\n const box = useRef<HostInstance>(null)\n const [focused, setFocused] = useState(false)\n const messages = useMessages()\n const locale = useLocaleOf(undefined)\n const state = useSelectState<object, M>({\n allowsEmptyCollection,\n // Each option builds its own entry in the collection, as a ListBox's\n // does. The collection skips what is not an element, as a ReactNode may\n // be, and asks any element for its entry.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- see above\n children: options as StatelyListProps<object>['children'],\n defaultOpen,\n defaultValue,\n disabledKeys,\n isDisabled,\n isOpen,\n onChange: (changed) => {\n // A choice is made once, rather than typed, so it is committed as it\n // lands, as a checkbox group commits a tick.\n validation.onEdit()\n validation.onBlur()\n onChange?.(changed)\n },\n onOpenChange,\n selectionMode,\n shouldCloseOnSelect,\n value,\n })\n const chosen = keysOf(state.value)\n const several = state.selectionManager.selectionMode === 'multiple'\n const validation = useFieldValidation({\n control: box,\n error,\n isDisabled,\n isEmpty: chosen.length === 0,\n isReadOnly: false,\n isRequired,\n name,\n submitted: several ? chosen.map(String) : String(chosen[0] ?? ''),\n validate,\n value: state.value,\n })\n const shownError = validation.error\n const isPlaceholder = state.selectedItems.length === 0\n const shown = isPlaceholder\n ? (placeholder ?? messages.selectPlaceholder)\n : listFor(\n state.selectedItems.map((item) => item.textValue),\n locale,\n )\n\n return (\n <View ref={ref} style={style}>\n <FieldBox\n floatingLabel={floatingLabel}\n isDisabled={isDisabled}\n // The list takes the reader away from the box while it is open, so\n // the box is told it is focused then, or its label would fall back\n // onto the placeholder.\n isFocused={state.isOpen || focused}\n isInvalid={shownError !== undefined}\n isPopulated={!isPlaceholder}\n isRequired={isRequired}\n label={label}\n leading={leadingIcon}\n ref={box}\n trailing={chevronFor(state.isOpen)}\n trigger={triggerFor(state, {\n described: describedBy(id, { description, error: shownError }),\n name: `${label} ${shown}`,\n setFocused,\n testID,\n })}\n variant={variant}\n >\n <FieldValue isPlaceholder={isPlaceholder}>{shown}</FieldValue>\n </FieldBox>\n <FieldMessage description={description} error={shownError} id={id} />\n <SelectPopup anchor={box} label={label} state={state} />\n </View>\n )\n}\n\n/**\n * The list, drawn in the overlay host above the screen and placed under the\n * box: as wide as the box, flipped above it at the edge of the window, and\n * scrolled to the option a screen reader is sent to once it has been placed.\n */\nfunction SelectList({\n anchor,\n isOpen,\n label,\n setPresent,\n state,\n}: SelectListProps) {\n const styles = stylesOf(useTheme())\n const placement = useAnchoredPlacement({ align: 'start', anchor })\n const motion = usePanelMotion(isOpen, placement.placed, setPresent)\n const [panel, setPanel] = useState<HostInstance | null>(null)\n const [option, setOption] = useState<HostInstance | null>(null)\n // oxlint-disable-next-line typescript/unbound-method -- React Stately's `close` is a callback, and reads no `this`\n const close = state.close\n\n useBackToClose(close, isOpen)\n // Only while open: a choice moves the focus key to the option just chosen\n // as the list leaves, and the reader belongs back at the box by then.\n useFocusOnPlaced(isOpen && placement.placed, option ?? panel)\n\n return (\n <>\n {isOpen ? <DismissLayer onPress={close} /> : null}\n <Animated.View\n onAccessibilityEscape={close}\n onLayout={placement.onLayout}\n ref={setPanel}\n style={composeStyles<AnimatedStyle<ViewStyle>>(\n styles.list,\n { width: placement.anchorWidth },\n placement.style,\n { transformOrigin: PANEL_ORIGINS[placement.side] },\n motion,\n )}\n >\n <CollectionView\n aria-label={label}\n focusKey={focusKeyOf(state)}\n kind=\"listbox\"\n onFocusTarget={setOption}\n revealFocus={placement.placed}\n state={state}\n style={SHRINKS}\n />\n </Animated.View>\n </>\n )\n}\n\n/**\n * The list while it is open and while its exit runs: mounted the moment the\n * select opens, and kept until the list has faded out. A screen reader goes\n * back to the box once it has gone.\n */\nfunction SelectPopup({\n anchor,\n label,\n state,\n}: Omit<SelectListProps, 'isOpen' | 'setPresent'>) {\n const [present, setPresent] = useState(state.isOpen)\n\n if (state.isOpen && !present) {\n setPresent(true)\n }\n\n useReturnFocus(present, false, anchor)\n\n if (!present) {\n return null\n }\n\n return (\n <Overlay>\n <SelectList\n anchor={anchor}\n isOpen={state.isOpen}\n label={label}\n setPresent={setPresent}\n state={state}\n />\n </Overlay>\n )\n}\n\n/**\n * The box as the select's control: named by its label and what it shows,\n * described by the line under it, saying whether its list is open, and\n * opening or closing the list when pressed. It tracks its own focus, for a\n * keyboard reaching it, which the box draws as it draws a focused field.\n */\nfunction triggerFor(\n state: SelectState<object, SelectionMode>,\n {\n described,\n name,\n setFocused,\n testID,\n }: {\n readonly described: FieldTriggerProps['described']\n readonly name: string\n readonly setFocused: (focused: boolean) => void\n readonly testID: string | undefined\n },\n): FieldTriggerProps {\n return {\n 'aria-expanded': state.isOpen,\n 'aria-label': name,\n described,\n onBlur: () => {\n setFocused(false)\n },\n onFocus: () => {\n setFocused(true)\n },\n onPress: () => {\n state.toggle()\n },\n testID,\n }\n}\n\nexport { Select }\nexport type { SelectProps }\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0NA,MAAMiF,UAAqB,EAAEC,UAAU,EAAE;AAEzC,MAAMC,WAAWpC,cAAc,EAAEqC,QAAQC,OAAOC,cAC9CpE,WAAWqE,OAAO,EAIhBC,MAAM;CACJC,iBAAiBL,OAAOM;CACxBC,cAAcN,MAAMO;CACpBC,WAAWP,QAAQQ;CACnBC,UAAU;AACZ,EACF,CAAC,CACH;AAKA,SAASC,WAAW9C,QAAiB;CACnC,OAAO,oBAAC,cAAD,EAAsBA,OAAO,CAAA;AACtC;AAGA,SAAS+C,OAAO3B,OAAoD;CAClE,IAAIA,UAAU,MACZ,OAAO,CAAA;CAGT,OAAO,OAAOA,UAAU,WAAWA,QAAQ,CAACA,KAAK;AACnD;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAA4B,OAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAoD,MAAA,EAAA7C,uBAAAC,aAAAC,cAAAE,aAAAC,cAAAE,OAAAC,eAAAsC,IAAArC,YAAAsC,IAAArD,QAAAgB,YAAAsC,IAAArD,OAAAgB,aAAAC,MAAAC,UAAAE,cAAAC,SAAAC,aAAAC,KAAAC,eAAAC,qBAAAC,OAAAC,QAAAC,UAAAT,OAAAU,SAAAyB,OAAAN;CAOlD,MAAAnC,gBAAAsC,OAAAI,KAAAA,IAAA,OAAAJ;CACA,MAAArC,aAAAsC,OAAAG,KAAAA,IAAA,QAAAH;CAEA,MAAArC,aAAAsC,OAAAE,KAAAA,IAAA,QAAAF;CAeA,MAAAxB,UAAAyB,OAAAC,KAAAA,IAAA,WAAAD;CAEA,MAAAE,KAAW5F,MAA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ACnB,OAAO;EACL,iBAAiBxB,MAAMJ;EACvB,cAAckB;EACdqF;EACApC,cAAc;GACZP,WAAW,KAAK;EAClB;EACAoE,eAAe;GACbpE,WAAW,IAAI;EACjB;EACAqE,eAAe;GACb7H,MAAM8H,OAAO;EACf;EACAtG;CACF;AACF"}
|
|
@@ -13,7 +13,8 @@ type SeparatorProps = ViewProps & {
|
|
|
13
13
|
readonly inset?: SeparatorInset;
|
|
14
14
|
/**
|
|
15
15
|
* Which way the rule runs. A rule takes its length from its parent: a
|
|
16
|
-
* horizontal one spans a column, and a vertical one a row.
|
|
16
|
+
* horizontal one spans a column, and a vertical one a row. Inside a
|
|
17
|
+
* `Toolbar` it runs across the bar unless this says otherwise.
|
|
17
18
|
* @default 'horizontal'
|
|
18
19
|
*/
|
|
19
20
|
readonly orientation?: 'horizontal' | 'vertical';
|
|
@@ -39,7 +40,7 @@ type SeparatorProps = ViewProps & {
|
|
|
39
40
|
* iOS nor Android has. `style`, `ref` and `testID` land on the `View`, and a
|
|
40
41
|
* `style` there applies over the rule's own.
|
|
41
42
|
*/
|
|
42
|
-
declare function Separator({ inset, orientation, style, ...props }: SeparatorProps): import("react").JSX.Element;
|
|
43
|
+
declare function Separator({ inset, orientation: own, style, ...props }: SeparatorProps): import("react").JSX.Element;
|
|
43
44
|
//#endregion
|
|
44
45
|
export { Separator, type SeparatorInset, type SeparatorProps };
|
|
45
46
|
//# sourceMappingURL=index.d.ts.map
|