@kanso-labs/react-native-kanso-ui 0.9.0 → 0.11.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.
Files changed (217) hide show
  1. package/README.md +4 -3
  2. package/dist/autocomplete/index.js +15 -1
  3. package/dist/autocomplete/index.js.map +1 -1
  4. package/dist/button/group.d.ts +5 -0
  5. package/dist/button/group.js +115 -0
  6. package/dist/button/group.js.map +1 -0
  7. package/dist/button/index.d.ts +4 -1
  8. package/dist/button/index.js +44 -22
  9. package/dist/button/index.js.map +1 -1
  10. package/dist/button/slots.js +2 -1
  11. package/dist/button/slots.js.map +1 -1
  12. package/dist/calendar/index.js +351 -182
  13. package/dist/calendar/index.js.map +1 -1
  14. package/dist/calendar/styles.js +33 -2
  15. package/dist/calendar/styles.js.map +1 -1
  16. package/dist/carousel/arrangement.d.ts +5 -0
  17. package/dist/carousel/arrangement.js +123 -0
  18. package/dist/carousel/arrangement.js.map +1 -0
  19. package/dist/chequer/index.js +95 -0
  20. package/dist/chequer/index.js.map +1 -0
  21. package/dist/collection/index.d.ts +157 -0
  22. package/dist/collection/index.js +1358 -0
  23. package/dist/collection/index.js.map +1 -0
  24. package/dist/color-thumb/index.js +56 -0
  25. package/dist/color-thumb/index.js.map +1 -0
  26. package/dist/components/button/index.d.ts +4 -2
  27. package/dist/components/button/index.js +227 -188
  28. package/dist/components/button/index.js.map +1 -1
  29. package/dist/components/button-group/index.d.ts +87 -0
  30. package/dist/components/button-group/index.js +275 -0
  31. package/dist/components/button-group/index.js.map +1 -0
  32. package/dist/components/calendar/index.d.ts +11 -3
  33. package/dist/components/calendar/index.js +60 -45
  34. package/dist/components/calendar/index.js.map +1 -1
  35. package/dist/components/carousel/index.d.ts +72 -0
  36. package/dist/components/carousel/index.js +496 -0
  37. package/dist/components/carousel/index.js.map +1 -0
  38. package/dist/components/checkbox-group/index.d.ts +3 -4
  39. package/dist/components/checkbox-group/index.js +1 -1
  40. package/dist/components/checkbox-group/index.js.map +1 -1
  41. package/dist/components/chip/index.d.ts +4 -1
  42. package/dist/components/chip/index.js +229 -161
  43. package/dist/components/chip/index.js.map +1 -1
  44. package/dist/components/color-area/index.d.ts +85 -0
  45. package/dist/components/color-area/index.js +630 -0
  46. package/dist/components/color-area/index.js.map +1 -0
  47. package/dist/components/color-field/index.d.ts +144 -0
  48. package/dist/components/color-field/index.js +516 -0
  49. package/dist/components/color-field/index.js.map +1 -0
  50. package/dist/components/color-picker/index.d.ts +74 -0
  51. package/dist/components/color-picker/index.js +317 -0
  52. package/dist/components/color-picker/index.js.map +1 -0
  53. package/dist/components/color-slider/index.d.ts +82 -0
  54. package/dist/components/color-slider/index.js +456 -0
  55. package/dist/components/color-slider/index.js.map +1 -0
  56. package/dist/components/color-swatch/index.d.ts +46 -0
  57. package/dist/components/color-swatch/index.js +127 -0
  58. package/dist/components/color-swatch/index.js.map +1 -0
  59. package/dist/components/color-swatch-picker/index.d.ts +81 -0
  60. package/dist/components/color-swatch-picker/index.js +287 -0
  61. package/dist/components/color-swatch-picker/index.js.map +1 -0
  62. package/dist/components/color-wheel/index.d.ts +71 -0
  63. package/dist/components/color-wheel/index.js +407 -0
  64. package/dist/components/color-wheel/index.js.map +1 -0
  65. package/dist/components/combo-box/index.d.ts +193 -0
  66. package/dist/components/combo-box/index.js +616 -0
  67. package/dist/components/combo-box/index.js.map +1 -0
  68. package/dist/components/date-field/index.d.ts +120 -0
  69. package/dist/components/date-field/index.js +111 -0
  70. package/dist/components/date-field/index.js.map +1 -0
  71. package/dist/components/date-picker/index.d.ts +130 -0
  72. package/dist/components/date-picker/index.js +310 -0
  73. package/dist/components/date-picker/index.js.map +1 -0
  74. package/dist/components/date-range-picker/index.d.ts +139 -0
  75. package/dist/components/date-range-picker/index.js +421 -0
  76. package/dist/components/date-range-picker/index.js.map +1 -0
  77. package/dist/components/dialog/index.d.ts +5 -5
  78. package/dist/components/dialog/index.js +5 -5
  79. package/dist/components/dialog/index.js.map +1 -1
  80. package/dist/components/disclosure/index.d.ts +94 -0
  81. package/dist/components/disclosure/index.js +365 -0
  82. package/dist/components/disclosure/index.js.map +1 -0
  83. package/dist/components/disclosure-group/index.d.ts +61 -0
  84. package/dist/components/disclosure-group/index.js +100 -0
  85. package/dist/components/disclosure-group/index.js.map +1 -0
  86. package/dist/components/drop-zone/index.d.ts +113 -0
  87. package/dist/components/drop-zone/index.js +304 -0
  88. package/dist/components/drop-zone/index.js.map +1 -0
  89. package/dist/components/fab/index.d.ts +1 -1
  90. package/dist/components/fab/index.js +91 -76
  91. package/dist/components/fab/index.js.map +1 -1
  92. package/dist/components/form/index.d.ts +3 -2
  93. package/dist/components/form/index.js.map +1 -1
  94. package/dist/components/icon-button/index.d.ts +4 -2
  95. package/dist/components/icon-button/index.js +204 -171
  96. package/dist/components/icon-button/index.js.map +1 -1
  97. package/dist/components/list/index.d.ts +15 -158
  98. package/dist/components/list/index.js +21 -1047
  99. package/dist/components/list/index.js.map +1 -1
  100. package/dist/components/list-box/index.d.ts +73 -0
  101. package/dist/components/list-box/index.js +82 -0
  102. package/dist/components/list-box/index.js.map +1 -0
  103. package/dist/components/loading-indicator/index.d.ts +32 -0
  104. package/dist/components/loading-indicator/index.js +174 -0
  105. package/dist/components/loading-indicator/index.js.map +1 -0
  106. package/dist/components/menu/index.d.ts +3 -3
  107. package/dist/components/menu/index.js +3 -3
  108. package/dist/components/menu/index.js.map +1 -1
  109. package/dist/components/navigation-tree/index.d.ts +117 -0
  110. package/dist/components/navigation-tree/index.js +135 -0
  111. package/dist/components/navigation-tree/index.js.map +1 -0
  112. package/dist/components/number-field/index.js +132 -143
  113. package/dist/components/number-field/index.js.map +1 -1
  114. package/dist/components/popover/index.d.ts +2 -2
  115. package/dist/components/popover/index.js +2 -2
  116. package/dist/components/popover/index.js.map +1 -1
  117. package/dist/components/range-calendar/index.d.ts +69 -0
  118. package/dist/components/range-calendar/index.js +144 -0
  119. package/dist/components/range-calendar/index.js.map +1 -0
  120. package/dist/components/search-view/index.d.ts +79 -0
  121. package/dist/components/search-view/index.js +571 -0
  122. package/dist/components/search-view/index.js.map +1 -0
  123. package/dist/components/select/index.d.ts +152 -0
  124. package/dist/components/select/index.js +419 -0
  125. package/dist/components/select/index.js.map +1 -0
  126. package/dist/components/sheet/index.d.ts +16 -7
  127. package/dist/components/sheet/index.js +157 -152
  128. package/dist/components/sheet/index.js.map +1 -1
  129. package/dist/components/slider/index.d.ts +111 -0
  130. package/dist/components/slider/index.js +673 -0
  131. package/dist/components/slider/index.js.map +1 -0
  132. package/dist/components/split-button/index.d.ts +77 -0
  133. package/dist/components/split-button/index.js +354 -0
  134. package/dist/components/split-button/index.js.map +1 -0
  135. package/dist/components/table/index.d.ts +391 -0
  136. package/dist/components/table/index.js +1708 -0
  137. package/dist/components/table/index.js.map +1 -0
  138. package/dist/components/tabs/index.d.ts +196 -0
  139. package/dist/components/tabs/index.js +1137 -0
  140. package/dist/components/tabs/index.js.map +1 -0
  141. package/dist/components/time-field/index.d.ts +43 -0
  142. package/dist/components/time-field/index.js +107 -0
  143. package/dist/components/time-field/index.js.map +1 -0
  144. package/dist/components/time-picker/index.d.ts +65 -0
  145. package/dist/components/time-picker/index.js +1168 -0
  146. package/dist/components/time-picker/index.js.map +1 -0
  147. package/dist/components/token-field/index.d.ts +105 -0
  148. package/dist/components/token-field/index.js +574 -0
  149. package/dist/components/token-field/index.js.map +1 -0
  150. package/dist/components/tooltip/index.d.ts +102 -0
  151. package/dist/components/tooltip/index.js +223 -0
  152. package/dist/components/tooltip/index.js.map +1 -0
  153. package/dist/components/tree/index.d.ts +112 -0
  154. package/dist/components/tree/index.js +157 -0
  155. package/dist/components/tree/index.js.map +1 -0
  156. package/dist/disclosure/chevron.js +75 -0
  157. package/dist/disclosure/chevron.js.map +1 -0
  158. package/dist/disclosure/index.js +7 -0
  159. package/dist/disclosure/index.js.map +1 -0
  160. package/dist/drop/index.d.ts +54 -0
  161. package/dist/drop/index.js +161 -0
  162. package/dist/drop/index.js.map +1 -0
  163. package/dist/field/chevron.js +74 -0
  164. package/dist/field/chevron.js.map +1 -0
  165. package/dist/field/index.d.ts +2 -1
  166. package/dist/field/index.js +359 -154
  167. package/dist/field/index.js.map +1 -1
  168. package/dist/field/styles.js +18 -1
  169. package/dist/field/styles.js.map +1 -1
  170. package/dist/files/index.d.ts +18 -0
  171. package/dist/files/index.js +107 -0
  172. package/dist/files/index.js.map +1 -0
  173. package/dist/form/index.d.ts +5 -2
  174. package/dist/form/index.js +64 -85
  175. package/dist/form/index.js.map +1 -1
  176. package/dist/glyphs/index.js +128 -1
  177. package/dist/glyphs/index.js.map +1 -1
  178. package/dist/i18n/index.js +36 -1
  179. package/dist/i18n/index.js.map +1 -1
  180. package/dist/i18n/messages.js +1734 -34
  181. package/dist/i18n/messages.js.map +1 -1
  182. package/dist/index.d.ts +37 -3
  183. package/dist/index.js +36 -3
  184. package/dist/indicator/paths.js +23 -1
  185. package/dist/indicator/paths.js.map +1 -1
  186. package/dist/modal/index.js +92 -77
  187. package/dist/modal/index.js.map +1 -1
  188. package/dist/number/keyboard.js +16 -0
  189. package/dist/number/keyboard.js.map +1 -0
  190. package/dist/overlay/anchored.js +68 -38
  191. package/dist/overlay/anchored.js.map +1 -1
  192. package/dist/overlay/keyboard.js +57 -0
  193. package/dist/overlay/keyboard.js.map +1 -0
  194. package/dist/overlay/panel.js +173 -19
  195. package/dist/overlay/panel.js.map +1 -1
  196. package/dist/overlay/placement.js +13 -1
  197. package/dist/overlay/placement.js.map +1 -1
  198. package/dist/picker/index.js +322 -0
  199. package/dist/picker/index.js.map +1 -0
  200. package/dist/press/index.d.ts +2 -0
  201. package/dist/press/index.js +102 -100
  202. package/dist/press/index.js.map +1 -1
  203. package/dist/row/index.js +77 -69
  204. package/dist/row/index.js.map +1 -1
  205. package/dist/row/styles.js +13 -2
  206. package/dist/row/styles.js.map +1 -1
  207. package/dist/segments/field.js +277 -0
  208. package/dist/segments/field.js.map +1 -0
  209. package/dist/segments/index.js +574 -0
  210. package/dist/segments/index.js.map +1 -0
  211. package/dist/segments/styles.js +24 -0
  212. package/dist/segments/styles.js.map +1 -0
  213. package/dist/slider/index.js +145 -0
  214. package/dist/slider/index.js.map +1 -0
  215. package/dist/swatch/index.js +56 -0
  216. package/dist/swatch/index.js.map +1 -0
  217. package/package.json +11 -2
@@ -0,0 +1,1358 @@
1
+ import { useTheme } from "../theme/scope.js";
2
+ import { composeStyles, themedStyles } from "../theme/styles.js";
3
+ import { hitSlop, usePressFeedback } from "../press/index.js";
4
+ import { useTypeRole } from "../typography/roles.js";
5
+ import { rowContentColor, rowStyles } from "../row/styles.js";
6
+ import { RowContent, hasContent, rowStyleOf } from "../row/index.js";
7
+ import { AutocompleteContext } from "../autocomplete/index.js";
8
+ import { resultsFor } from "../i18n/index.js";
9
+ import { useLocaleOf, useMessages } from "../i18n/provider.js";
10
+ import { useOpenLink } from "../router/index.js";
11
+ import { refsOf } from "../ref/index.js";
12
+ import { toggleState } from "../button/index.js";
13
+ import { ProgressIndicator } from "../components/progress-indicator/index.js";
14
+ import { CheckboxBox } from "../control/checkbox-box.js";
15
+ import { ExpandChevron } from "../disclosure/chevron.js";
16
+ import { c } from "react/compiler-runtime";
17
+ import { AccessibilityInfo, FlatList, Platform, Pressable, StyleSheet, Text, View } from "react-native";
18
+ import { Children, createContext, use, useEffect, useRef, useState } from "react";
19
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
20
+ import { useListState } from "react-stately/useListState";
21
+ //#region src/collection/index.tsx
22
+ const BOX_SLOT = 24;
23
+ const LOADING_DIAMETER = "24px";
24
+ const LOAD_OFFSET = 1;
25
+ const INITIAL_ROWS = 10;
26
+ const IDLE = {};
27
+ const CURRENT_PAGE = { "aria-current": "page" };
28
+ const styles = StyleSheet.create({
29
+ box: {
30
+ alignItems: "center",
31
+ height: BOX_SLOT,
32
+ justifyContent: "center",
33
+ width: BOX_SLOT
34
+ },
35
+ idle: { height: 0 },
36
+ status: {
37
+ height: 1,
38
+ overflow: "hidden",
39
+ pointerEvents: "none",
40
+ position: "absolute",
41
+ width: 1
42
+ }
43
+ });
44
+ const stylesOf = themedStyles(({ colors, radii, sizing, spacing }) => StyleSheet.create({
45
+ content: { paddingVertical: spacing.sm },
46
+ drawerHeader: {
47
+ color: colors.onSurfaceVariant,
48
+ paddingBottom: spacing.xxs,
49
+ paddingHorizontal: spacing.lg + spacing.md,
50
+ paddingTop: spacing.lg
51
+ },
52
+ empty: { color: colors.onSurfaceVariant },
53
+ header: {
54
+ color: colors.onSurfaceVariant,
55
+ paddingBottom: spacing.xxs,
56
+ paddingHorizontal: spacing.lg,
57
+ paddingTop: spacing.lg
58
+ },
59
+ lead: {
60
+ alignItems: "center",
61
+ flexDirection: "row",
62
+ gap: spacing.lg
63
+ },
64
+ list: { backgroundColor: colors.surface },
65
+ loading: {
66
+ alignItems: "center",
67
+ justifyContent: "center",
68
+ minHeight: sizing.rowSm
69
+ },
70
+ pill: { borderRadius: radii.pill },
71
+ status: { color: colors.onSurface }
72
+ }));
73
+ const CollectionContext = createContext(null);
74
+ function accessibilityActionOf(actions) {
75
+ return (event) => {
76
+ switch (event.nativeEvent.actionName) {
77
+ case "collapse":
78
+ actions.collapse?.();
79
+ break;
80
+ case "expand":
81
+ actions.expand?.();
82
+ break;
83
+ case "select": actions.select?.();
84
+ }
85
+ };
86
+ }
87
+ /**
88
+ * The parts nested in a part, a Section's rows or a Tree row's, walked as
89
+ * React Stately's own Section walks them, which leaves each child its own
90
+ * key rather than the one `Children.toArray` gives it. A condition left
91
+ * false is no part: React hands a boolean or an undefined child over as
92
+ * null.
93
+ */
94
+ function childElementsOf(children) {
95
+ const elements = [];
96
+ Children.forEach(children, (child) => {
97
+ if (child !== null) elements.push(child);
98
+ });
99
+ return elements;
100
+ }
101
+ /**
102
+ * The `FlatList` List and ListBox draw, from parts read off its children by
103
+ * React Stately's list state. Inside an `Autocomplete`, it shows the rows the
104
+ * search keeps and says how many there are to a screen reader, and a tap on
105
+ * a row reaches it while the keyboard is up.
106
+ */
107
+ function Collection(t0) {
108
+ const $ = c(25);
109
+ let children;
110
+ let defaultSelectedKeys;
111
+ let disabledKeys;
112
+ let disallowEmptySelection;
113
+ let items;
114
+ let onSelectionChange;
115
+ let props;
116
+ let selectedKeys;
117
+ let t1;
118
+ if ($[0] !== t0) {
119
+ ({children, defaultSelectedKeys, disabledKeys, disallowEmptySelection, items, onSelectionChange, selectedKeys, selectionMode: t1, ...props} = t0);
120
+ $[0] = t0;
121
+ $[1] = children;
122
+ $[2] = defaultSelectedKeys;
123
+ $[3] = disabledKeys;
124
+ $[4] = disallowEmptySelection;
125
+ $[5] = items;
126
+ $[6] = onSelectionChange;
127
+ $[7] = props;
128
+ $[8] = selectedKeys;
129
+ $[9] = t1;
130
+ } else {
131
+ children = $[1];
132
+ defaultSelectedKeys = $[2];
133
+ disabledKeys = $[3];
134
+ disallowEmptySelection = $[4];
135
+ items = $[5];
136
+ onSelectionChange = $[6];
137
+ props = $[7];
138
+ selectedKeys = $[8];
139
+ t1 = $[9];
140
+ }
141
+ const selectionMode = t1 === void 0 ? "none" : t1;
142
+ const matches = use(AutocompleteContext)?.matches;
143
+ let t2;
144
+ if ($[10] !== matches) {
145
+ t2 = matches === void 0 ? void 0 : filterOf(matches);
146
+ $[10] = matches;
147
+ $[11] = t2;
148
+ } else t2 = $[11];
149
+ const filter = t2;
150
+ const t3 = children;
151
+ let t4;
152
+ if ($[12] !== defaultSelectedKeys || $[13] !== disabledKeys || $[14] !== disallowEmptySelection || $[15] !== filter || $[16] !== items || $[17] !== onSelectionChange || $[18] !== selectedKeys || $[19] !== selectionMode || $[20] !== t3) {
153
+ t4 = {
154
+ children: t3,
155
+ defaultSelectedKeys,
156
+ disabledKeys,
157
+ disallowEmptySelection,
158
+ filter,
159
+ items,
160
+ onSelectionChange,
161
+ selectedKeys,
162
+ selectionMode
163
+ };
164
+ $[12] = defaultSelectedKeys;
165
+ $[13] = disabledKeys;
166
+ $[14] = disallowEmptySelection;
167
+ $[15] = filter;
168
+ $[16] = items;
169
+ $[17] = onSelectionChange;
170
+ $[18] = selectedKeys;
171
+ $[19] = selectionMode;
172
+ $[20] = t3;
173
+ $[21] = t4;
174
+ } else t4 = $[21];
175
+ const state = useListState(t4);
176
+ let t5;
177
+ if ($[22] !== props || $[23] !== state) {
178
+ t5 = /* @__PURE__ */ jsx(CollectionView, {
179
+ ...props,
180
+ state
181
+ });
182
+ $[22] = props;
183
+ $[23] = state;
184
+ $[24] = t5;
185
+ } else t5 = $[24];
186
+ return t5;
187
+ }
188
+ /**
189
+ * The `FlatList` itself, drawn from a list state built elsewhere: by
190
+ * `Collection` from its own props, or by a component whose state holds more
191
+ * than a list's, as a Select's holds whether it is open and a Tree's which
192
+ * rows are. `focusKey` names the
193
+ * row whose node is handed to `onFocusTarget`, for a panel that sends a
194
+ * screen reader to it as it opens.
195
+ */
196
+ function CollectionView(t0) {
197
+ const $ = c(69);
198
+ let contentContainerStyle;
199
+ let keyboardShouldPersistTaps;
200
+ let kind;
201
+ let onAction;
202
+ let onFocusTarget;
203
+ let onLayout;
204
+ let props;
205
+ let ref;
206
+ let selectLabel;
207
+ let selectedRoute;
208
+ let state;
209
+ let style;
210
+ let t1;
211
+ let t2;
212
+ let t3;
213
+ if ($[0] !== t0) {
214
+ ({contentContainerStyle, focusKey: t1, keyboardShouldPersistTaps, kind, onAction, onFocusTarget, onLayout, ref, renderEmptyState: t2, revealFocus: t3, selectedRoute, selectLabel, state, style, ...props} = t0);
215
+ $[0] = t0;
216
+ $[1] = contentContainerStyle;
217
+ $[2] = keyboardShouldPersistTaps;
218
+ $[3] = kind;
219
+ $[4] = onAction;
220
+ $[5] = onFocusTarget;
221
+ $[6] = onLayout;
222
+ $[7] = props;
223
+ $[8] = ref;
224
+ $[9] = selectLabel;
225
+ $[10] = selectedRoute;
226
+ $[11] = state;
227
+ $[12] = style;
228
+ $[13] = t1;
229
+ $[14] = t2;
230
+ $[15] = t3;
231
+ } else {
232
+ contentContainerStyle = $[1];
233
+ keyboardShouldPersistTaps = $[2];
234
+ kind = $[3];
235
+ onAction = $[4];
236
+ onFocusTarget = $[5];
237
+ onLayout = $[6];
238
+ props = $[7];
239
+ ref = $[8];
240
+ selectLabel = $[9];
241
+ selectedRoute = $[10];
242
+ state = $[11];
243
+ style = $[12];
244
+ t1 = $[13];
245
+ t2 = $[14];
246
+ t3 = $[15];
247
+ }
248
+ const focusKey = t1 === void 0 ? null : t1;
249
+ const renderEmptyState = t2 === void 0 ? emptyState : t2;
250
+ const revealFocus = t3 === void 0 ? false : t3;
251
+ const theme = useTheme();
252
+ const own = stylesOf(theme);
253
+ const autocomplete = use(AutocompleteContext);
254
+ let t4;
255
+ if ($[16] !== state) {
256
+ t4 = entriesOf(state);
257
+ $[16] = state;
258
+ $[17] = t4;
259
+ } else t4 = $[17];
260
+ const { entries, loader, rows, sticky } = t4;
261
+ let t5;
262
+ if ($[18] !== kind || $[19] !== selectedRoute || $[20] !== state.collection) {
263
+ t5 = kind === "drawer" ? routeMarkOf(state.collection, selectedRoute) : void 0;
264
+ $[18] = kind;
265
+ $[19] = selectedRoute;
266
+ $[20] = state.collection;
267
+ $[21] = t5;
268
+ } else t5 = $[21];
269
+ const route = t5;
270
+ const [list, setList] = useState(null);
271
+ const [revealed, setRevealed] = useState(false);
272
+ const focusIndex = focusKey === null ? -1 : entries.findIndex((entry) => entry.kind === "item" && entry.node.key === focusKey);
273
+ const isList = kind === "list";
274
+ const listStyle = composeStyles(isList ? own.list : void 0, style);
275
+ const loadMore = loader?.props;
276
+ const isLoading = loadMore?.isLoading ?? false;
277
+ const messages = useMessages();
278
+ let t6;
279
+ if ($[22] !== isList || $[23] !== style || $[24] !== theme) {
280
+ t6 = isList ? StyleSheet.flatten(style)?.backgroundColor ?? theme.colors.surface : void 0;
281
+ $[22] = isList;
282
+ $[23] = style;
283
+ $[24] = theme;
284
+ $[25] = t6;
285
+ } else t6 = $[25];
286
+ const ground = t6;
287
+ const t7 = selectLabel ?? messages.select;
288
+ let t8;
289
+ if ($[26] !== focusKey || $[27] !== ground || $[28] !== kind || $[29] !== loadMore || $[30] !== onAction || $[31] !== onFocusTarget || $[32] !== renderEmptyState || $[33] !== route || $[34] !== state || $[35] !== t7) {
290
+ t8 = {
291
+ focusKey,
292
+ ground,
293
+ kind,
294
+ loadMore,
295
+ onAction,
296
+ onFocusTarget,
297
+ renderEmptyState,
298
+ route,
299
+ selectLabel: t7,
300
+ state
301
+ };
302
+ $[26] = focusKey;
303
+ $[27] = ground;
304
+ $[28] = kind;
305
+ $[29] = loadMore;
306
+ $[30] = onAction;
307
+ $[31] = onFocusTarget;
308
+ $[32] = renderEmptyState;
309
+ $[33] = route;
310
+ $[34] = state;
311
+ $[35] = t7;
312
+ $[36] = t8;
313
+ } else t8 = $[36];
314
+ const value = t8;
315
+ const T0 = CollectionContext;
316
+ const T1 = FlatList;
317
+ const t9 = composeStyles(own.content, contentContainerStyle);
318
+ const t10 = Math.max(INITIAL_ROWS, focusIndex + 1);
319
+ const t11 = keyboardShouldPersistTaps ?? (autocomplete === null ? void 0 : "handled");
320
+ const t12 = keyOf;
321
+ const t13 = isLoading ? void 0 : EmptyState;
322
+ const t14 = loadMore === void 0 ? void 0 : LoaderRow;
323
+ let t15;
324
+ if ($[37] !== loadMore) {
325
+ t15 = loadMore === void 0 ? void 0 : loadMoreOf(loadMore);
326
+ $[37] = loadMore;
327
+ $[38] = t15;
328
+ } else t15 = $[38];
329
+ const t16 = loadMore?.scrollOffset ?? LOAD_OFFSET;
330
+ const t17 = revealOnLayout(onLayout, {
331
+ index: revealFocus && !revealed ? focusIndex : -1,
332
+ list,
333
+ setRevealed
334
+ });
335
+ let t18;
336
+ if ($[39] !== list) {
337
+ t18 = scrollNear(list);
338
+ $[39] = list;
339
+ $[40] = t18;
340
+ } else t18 = $[40];
341
+ let t19;
342
+ if ($[41] !== ref || $[42] !== setList) {
343
+ t19 = refsOf(setList, ref);
344
+ $[41] = ref;
345
+ $[42] = setList;
346
+ $[43] = t19;
347
+ } else t19 = $[43];
348
+ const t20 = isList ? sticky : void 0;
349
+ let t21;
350
+ if ($[44] !== T1 || $[45] !== entries || $[46] !== listStyle || $[47] !== props || $[48] !== t10 || $[49] !== t11 || $[50] !== t12 || $[51] !== t13 || $[52] !== t14 || $[53] !== t15 || $[54] !== t16 || $[55] !== t17 || $[56] !== t18 || $[57] !== t19 || $[58] !== t20 || $[59] !== t9) {
351
+ t21 = /* @__PURE__ */ jsx(T1, {
352
+ ...props,
353
+ contentContainerStyle: t9,
354
+ data: entries,
355
+ initialNumToRender: t10,
356
+ keyboardShouldPersistTaps: t11,
357
+ keyExtractor: t12,
358
+ ListEmptyComponent: t13,
359
+ ListFooterComponent: t14,
360
+ onEndReached: t15,
361
+ onEndReachedThreshold: t16,
362
+ onLayout: t17,
363
+ onScrollToIndexFailed: t18,
364
+ ref: t19,
365
+ renderItem: renderEntry,
366
+ stickyHeaderIndices: t20,
367
+ style: listStyle
368
+ });
369
+ $[44] = T1;
370
+ $[45] = entries;
371
+ $[46] = listStyle;
372
+ $[47] = props;
373
+ $[48] = t10;
374
+ $[49] = t11;
375
+ $[50] = t12;
376
+ $[51] = t13;
377
+ $[52] = t14;
378
+ $[53] = t15;
379
+ $[54] = t16;
380
+ $[55] = t17;
381
+ $[56] = t18;
382
+ $[57] = t19;
383
+ $[58] = t20;
384
+ $[59] = t9;
385
+ $[60] = t21;
386
+ } else t21 = $[60];
387
+ let t22;
388
+ if ($[61] !== autocomplete || $[62] !== rows) {
389
+ t22 = autocomplete === null ? null : /* @__PURE__ */ jsx(ResultsStatus, { count: rows });
390
+ $[61] = autocomplete;
391
+ $[62] = rows;
392
+ $[63] = t22;
393
+ } else t22 = $[63];
394
+ let t23;
395
+ if ($[64] !== T0 || $[65] !== t21 || $[66] !== t22 || $[67] !== value) {
396
+ t23 = /* @__PURE__ */ jsxs(T0, {
397
+ value,
398
+ children: [t21, t22]
399
+ });
400
+ $[64] = T0;
401
+ $[65] = t21;
402
+ $[66] = t22;
403
+ $[67] = value;
404
+ $[68] = t23;
405
+ } else t23 = $[68];
406
+ return t23;
407
+ }
408
+ function currentState(current) {
409
+ if (Platform.OS !== "web") return { "aria-selected": current };
410
+ return current ? CURRENT_PAGE : void 0;
411
+ }
412
+ /**
413
+ * The muted row a list shows when nothing is in it: a row's box and
414
+ * headline in on surface variant, with no press of its own.
415
+ */
416
+ function EmptyRow() {
417
+ const $ = c(10);
418
+ const theme = useTheme();
419
+ const own = stylesOf(theme);
420
+ const headline = useTypeRole("bodyLarge");
421
+ const messages = useMessages();
422
+ const T0 = View;
423
+ let t0;
424
+ if ($[0] !== theme) {
425
+ t0 = rowStyleOf(theme, {});
426
+ $[0] = theme;
427
+ $[1] = t0;
428
+ } else t0 = $[1];
429
+ const T1 = Text;
430
+ const t1 = composeStyles(headline, own.empty);
431
+ let t2;
432
+ if ($[2] !== T1 || $[3] !== messages.noResults || $[4] !== t1) {
433
+ t2 = /* @__PURE__ */ jsx(T1, {
434
+ style: t1,
435
+ children: messages.noResults
436
+ });
437
+ $[2] = T1;
438
+ $[3] = messages.noResults;
439
+ $[4] = t1;
440
+ $[5] = t2;
441
+ } else t2 = $[5];
442
+ let t3;
443
+ if ($[6] !== T0 || $[7] !== t0 || $[8] !== t2) {
444
+ t3 = /* @__PURE__ */ jsx(T0, {
445
+ style: t0,
446
+ children: t2
447
+ });
448
+ $[6] = T0;
449
+ $[7] = t0;
450
+ $[8] = t2;
451
+ $[9] = t3;
452
+ } else t3 = $[9];
453
+ return t3;
454
+ }
455
+ function emptyState() {
456
+ return /* @__PURE__ */ jsx(EmptyRow, {});
457
+ }
458
+ function EmptyState() {
459
+ const $ = c(4);
460
+ const t0 = useCollection();
461
+ let t1;
462
+ if ($[0] !== t0) {
463
+ t1 = t0.renderEmptyState();
464
+ $[0] = t0;
465
+ $[1] = t1;
466
+ } else t1 = $[1];
467
+ let t2;
468
+ if ($[2] !== t1) {
469
+ t2 = /* @__PURE__ */ jsx(Fragment$1, { children: t1 });
470
+ $[2] = t1;
471
+ $[3] = t2;
472
+ } else t2 = $[3];
473
+ return t2;
474
+ }
475
+ /**
476
+ * The cells the `FlatList` draws, in order, where the headers among them
477
+ * are, and how many rows there are: the rows outside any section, and each
478
+ * section's header followed by its rows, with the rows under each open row
479
+ * of a tree after it. The row that loads more is drawn after them all.
480
+ */
481
+ function entriesOf(state) {
482
+ const entries = [];
483
+ const sticky = [];
484
+ const open = expansionOf(state)?.expandedKeys;
485
+ let loader;
486
+ let rows = 0;
487
+ const addRow = (row) => {
488
+ entries.push({
489
+ kind: "item",
490
+ node: row
491
+ });
492
+ rows++;
493
+ if (open?.has(row.key) === true) {
494
+ for (const child of row.childNodes) if (child.type === "item") addRow(child);
495
+ }
496
+ };
497
+ for (const node of state.collection) if (node.type === "loader") loader = node;
498
+ else if (node.type === "section") {
499
+ if (hasContent(node.rendered)) {
500
+ sticky.push(entries.length);
501
+ entries.push({
502
+ kind: "header",
503
+ node
504
+ });
505
+ }
506
+ const children = state.collection.getChildren?.(node.key) ?? node.childNodes;
507
+ for (const row of children) addRow(row);
508
+ } else addRow(node);
509
+ return {
510
+ entries,
511
+ loader,
512
+ rows,
513
+ sticky
514
+ };
515
+ }
516
+ /**
517
+ * The tree state a collection is drawn from, which says which rows are open
518
+ * and opens and closes them, or null for a list's, as React Aria tells the
519
+ * two apart.
520
+ */
521
+ function expansionOf(state) {
522
+ return "expandedKeys" in state ? state : null;
523
+ }
524
+ /**
525
+ * What a list inside an Autocomplete builds its collection from: the rows
526
+ * the search keeps, each section with a row left in it, and the row that
527
+ * loads more. Each node is copied rather than handed on, as React Stately's
528
+ * ComboBox copies its own, since a collection numbers the nodes it holds.
529
+ */
530
+ function filterOf(matches) {
531
+ return (nodes) => keptOf(nodes, matches);
532
+ }
533
+ /**
534
+ * The row a screen reader is sent to as a panel holding the list opens: the
535
+ * first one chosen, or the first that takes a press where none is.
536
+ */
537
+ function focusKeyOf(state) {
538
+ const chosen = state.selectionManager.firstSelectedKey;
539
+ if (chosen !== null) return chosen;
540
+ for (const node of state.collection) {
541
+ if (node.type === "item" && !state.disabledKeys.has(node.key)) return node.key;
542
+ if (node.type === "section") {
543
+ for (const row of state.collection.getChildren?.(node.key) ?? []) if (!state.disabledKeys.has(row.key)) return row.key;
544
+ }
545
+ }
546
+ return null;
547
+ }
548
+ function hrefOf(node) {
549
+ const { href } = node.props;
550
+ return href;
551
+ }
552
+ function keptOf(nodes, matches) {
553
+ const kept = [];
554
+ for (const node of nodes) if (node.type === "section") {
555
+ const rows = keptOf(node.childNodes, matches);
556
+ if (rows.some((row) => row.type === "item")) kept.push({
557
+ ...node,
558
+ childNodes: rows
559
+ });
560
+ } else if (node.type !== "item" || matches(node.textValue, node)) kept.push({ ...node });
561
+ return kept;
562
+ }
563
+ function keyOf({ kind, node }) {
564
+ return `${kind}:${String(node.key)}`;
565
+ }
566
+ function* loaderNode(props) {
567
+ yield {
568
+ hasChildNodes: false,
569
+ props,
570
+ rendered: null,
571
+ type: "loader"
572
+ };
573
+ }
574
+ function LoaderRow() {
575
+ const $ = c(2);
576
+ const t0 = useCollection().loadMore ?? IDLE;
577
+ let t1;
578
+ if ($[0] !== t0) {
579
+ t1 = /* @__PURE__ */ jsx(LoadingRow, { ...t0 });
580
+ $[0] = t0;
581
+ $[1] = t1;
582
+ } else t1 = $[1];
583
+ return t1;
584
+ }
585
+ /**
586
+ * The row a `LoadMore` part draws: a live region, empty while idle and
587
+ * holding the ring while loading. Android and React Native Web say what
588
+ * arrives in it; iOS has no live regions, so the ring's name is said there
589
+ * as it appears. A List's and a ListBox's, and a Table's, which draws it
590
+ * after its rows at a row's own height.
591
+ */
592
+ function LoadingRow(t0) {
593
+ const $ = c(8);
594
+ const { isLoading: t1, label, style, testID } = t0;
595
+ const isLoading = t1 === void 0 ? false : t1;
596
+ const own = stylesOf(useTheme());
597
+ const messages = useMessages();
598
+ const name = label ?? messages.loadingMore;
599
+ useLoadingAnnouncement(isLoading, name);
600
+ const T0 = View;
601
+ const t2 = "polite";
602
+ const t3 = composeStyles(isLoading ? own.loading : styles.idle, style);
603
+ let t4;
604
+ if ($[0] !== isLoading || $[1] !== name) {
605
+ t4 = isLoading ? /* @__PURE__ */ jsx(ProgressIndicator, {
606
+ "aria-label": name,
607
+ diameter: LOADING_DIAMETER,
608
+ isIndeterminate: true,
609
+ variant: "circular"
610
+ }) : null;
611
+ $[0] = isLoading;
612
+ $[1] = name;
613
+ $[2] = t4;
614
+ } else t4 = $[2];
615
+ let t5;
616
+ if ($[3] !== T0 || $[4] !== t3 || $[5] !== t4 || $[6] !== testID) {
617
+ t5 = /* @__PURE__ */ jsx(T0, {
618
+ "aria-live": t2,
619
+ style: t3,
620
+ testID,
621
+ children: t4
622
+ });
623
+ $[3] = T0;
624
+ $[4] = t3;
625
+ $[5] = t4;
626
+ $[6] = testID;
627
+ $[7] = t5;
628
+ } else t5 = $[7];
629
+ return t5;
630
+ }
631
+ function loadMoreOf({ isLoading = false, onLoadMore }) {
632
+ return () => {
633
+ if (!isLoading) onLoadMore?.();
634
+ };
635
+ }
636
+ function* nestedRowNode(props, rendered, textValue) {
637
+ const children = childElementsOf(props.children);
638
+ yield {
639
+ "aria-label": props["aria-label"],
640
+ *childNodes() {
641
+ for (const element of children) yield { element };
642
+ },
643
+ hasChildNodes: children.length > 0,
644
+ key: props.id,
645
+ props,
646
+ rendered,
647
+ textValue,
648
+ type: "item"
649
+ };
650
+ }
651
+ function noop() {}
652
+ /**
653
+ * The press handler of a row: the call site's own handler, then the row's.
654
+ * Built by a call rather than written inline at the prop, which is what
655
+ * react-perf's no-new-function-as-prop is after.
656
+ */
657
+ function pressThen(onPress, then) {
658
+ return (event) => {
659
+ onPress?.(event);
660
+ then?.();
661
+ };
662
+ }
663
+ function renderEntry({ item }) {
664
+ return item.kind === "header" ? /* @__PURE__ */ jsx(SectionHeader, { node: item.node }) : /* @__PURE__ */ jsx(RowNode, { node: item.node });
665
+ }
666
+ /**
667
+ * How many rows a search leaves, said to a screen reader as it changes and
668
+ * never drawn, through `Status`. A `count` of `null` says nothing, for a
669
+ * list that is closed, so the count is said again as it opens.
670
+ */
671
+ function ResultsStatus(t0) {
672
+ const $ = c(5);
673
+ const { count } = t0;
674
+ const locale = useLocaleOf(void 0);
675
+ let t1;
676
+ if ($[0] !== count || $[1] !== locale) {
677
+ t1 = count === null ? "" : resultsFor(count, locale);
678
+ $[0] = count;
679
+ $[1] = locale;
680
+ $[2] = t1;
681
+ } else t1 = $[2];
682
+ let t2;
683
+ if ($[3] !== t1) {
684
+ t2 = /* @__PURE__ */ jsx(Status, { message: t1 });
685
+ $[3] = t1;
686
+ $[4] = t2;
687
+ } else t2 = $[4];
688
+ return t2;
689
+ }
690
+ /**
691
+ * The list's layout handler: the call site's own, then a scroll that brings
692
+ * the row at `index` into view, once, where there is one to reveal. The row
693
+ * goes to the bottom of the list where it was below the fold, and a row
694
+ * already in view stays where it is: scrolled to put a row at the bottom, a
695
+ * list never scrolls past its end, and one that would have to scroll back
696
+ * above its start stays at the top.
697
+ */
698
+ function revealOnLayout(onLayout, { index, list, setRevealed }) {
699
+ return (event) => {
700
+ onLayout?.(event);
701
+ if (index > 0 && list !== null) {
702
+ setRevealed(true);
703
+ list.scrollToIndex({
704
+ animated: false,
705
+ index,
706
+ viewPosition: 1
707
+ });
708
+ }
709
+ };
710
+ }
711
+ function routeMarkOf(nodes, selectedRoute) {
712
+ const trail = [];
713
+ const find = (level) => {
714
+ for (const node of level) {
715
+ if (node.type === "item" && hrefOf(node) === selectedRoute) return node.key;
716
+ if (node.type === "item") trail.push(node.key);
717
+ const found = find(node.childNodes);
718
+ if (found !== null) return found;
719
+ if (node.type === "item") trail.pop();
720
+ }
721
+ return null;
722
+ };
723
+ const current = selectedRoute === void 0 ? null : find(nodes);
724
+ return {
725
+ current,
726
+ trail: new Set(current === null ? [] : trail)
727
+ };
728
+ }
729
+ function rowCountOf(state) {
730
+ return entriesOf(state).rows;
731
+ }
732
+ function* rowNode(props) {
733
+ yield {
734
+ "aria-label": props["aria-label"],
735
+ hasChildNodes: false,
736
+ key: props.id,
737
+ props,
738
+ rendered: props.children,
739
+ textValue: props.textValue ?? (typeof props.children === "string" ? props.children : ""),
740
+ type: "item"
741
+ };
742
+ }
743
+ /**
744
+ * A row: the state layer, the ripple and the focus ring over the leading
745
+ * slot, the lines and the trailing slot, on primary container while
746
+ * selected, with a List's checkbox before them on a row that selects. A
747
+ * Tree's row is indented by its depth and starts with its chevron, or a
748
+ * chevron's space on a row with nothing under it. A row with nothing to do
749
+ * on a press, in a collection that neither selects nor acts, is a `View`
750
+ * that only presents.
751
+ */
752
+ function RowNode(t0) {
753
+ const $ = c(75);
754
+ const { node } = t0;
755
+ const theme = useTheme();
756
+ const own = stylesOf(theme);
757
+ const collection = useCollection();
758
+ const messages = useMessages();
759
+ let href;
760
+ let leading;
761
+ let onAction;
762
+ let onBlur;
763
+ let onFocus;
764
+ let onHoverIn;
765
+ let onHoverOut;
766
+ let onLongPress;
767
+ let onPress;
768
+ let onPressIn;
769
+ let onPressOut;
770
+ let overline;
771
+ let props;
772
+ let ref;
773
+ let style;
774
+ let supporting;
775
+ let trailing;
776
+ if ($[0] !== node.props) {
777
+ const { children: _children, headline: _headline, href: t1, id: _id, isDisabled: _isDisabled, label: _label, leading: t2, onAction: t3, onBlur: t4, onFocus: t5, onHoverIn: t6, onHoverOut: t7, onLongPress: t8, onPress: t9, onPressIn: t10, onPressOut: t11, overline: t12, ref: t13, style: t14, supporting: t15, textValue: _textValue, trailing: t16, ...t17 } = node.props;
778
+ href = t1;
779
+ leading = t2;
780
+ onAction = t3;
781
+ onBlur = t4;
782
+ onFocus = t5;
783
+ onHoverIn = t6;
784
+ onHoverOut = t7;
785
+ onLongPress = t8;
786
+ onPress = t9;
787
+ onPressIn = t10;
788
+ onPressOut = t11;
789
+ overline = t12;
790
+ ref = t13;
791
+ style = t14;
792
+ supporting = t15;
793
+ trailing = t16;
794
+ props = t17;
795
+ $[0] = node.props;
796
+ $[1] = href;
797
+ $[2] = leading;
798
+ $[3] = onAction;
799
+ $[4] = onBlur;
800
+ $[5] = onFocus;
801
+ $[6] = onHoverIn;
802
+ $[7] = onHoverOut;
803
+ $[8] = onLongPress;
804
+ $[9] = onPress;
805
+ $[10] = onPressIn;
806
+ $[11] = onPressOut;
807
+ $[12] = overline;
808
+ $[13] = props;
809
+ $[14] = ref;
810
+ $[15] = style;
811
+ $[16] = supporting;
812
+ $[17] = trailing;
813
+ } else {
814
+ href = $[1];
815
+ leading = $[2];
816
+ onAction = $[3];
817
+ onBlur = $[4];
818
+ onFocus = $[5];
819
+ onHoverIn = $[6];
820
+ onHoverOut = $[7];
821
+ onLongPress = $[8];
822
+ onPress = $[9];
823
+ onPressIn = $[10];
824
+ onPressOut = $[11];
825
+ overline = $[12];
826
+ props = $[13];
827
+ ref = $[14];
828
+ style = $[15];
829
+ supporting = $[16];
830
+ trailing = $[17];
831
+ }
832
+ const isList = collection.kind === "list";
833
+ const { route } = collection;
834
+ const openLink = useOpenLink();
835
+ const { selectionManager } = collection.state;
836
+ const tree = expansionOf(collection.state);
837
+ const { key } = node;
838
+ let t1;
839
+ if ($[18] !== collection.focusKey || $[19] !== collection.onFocusTarget || $[20] !== key || $[21] !== ref) {
840
+ t1 = key === collection.focusKey ? refsOf(collection.onFocusTarget, ref) : ref;
841
+ $[18] = collection.focusKey;
842
+ $[19] = collection.onFocusTarget;
843
+ $[20] = key;
844
+ $[21] = ref;
845
+ $[22] = t1;
846
+ } else t1 = $[22];
847
+ const rowRef = t1;
848
+ const disabled = selectionManager.isDisabled(key);
849
+ const checks = selectionManager.selectionMode !== "none";
850
+ let t2;
851
+ if ($[23] !== key || $[24] !== selectionManager) {
852
+ t2 = selectionManager.canSelectItem(key);
853
+ $[23] = key;
854
+ $[24] = selectionManager;
855
+ $[25] = t2;
856
+ } else t2 = $[25];
857
+ const selectable = t2;
858
+ const selected = checks && selectionManager.isSelected(key);
859
+ const current = route?.current === key;
860
+ let t3;
861
+ if ($[26] !== key || $[27] !== route?.trail) {
862
+ t3 = route?.trail.has(key);
863
+ $[26] = key;
864
+ $[27] = route?.trail;
865
+ $[28] = t3;
866
+ } else t3 = $[28];
867
+ const onTrail = t3 === true;
868
+ const marked = selected || current;
869
+ const variant = route === void 0 ? void 0 : "drawer";
870
+ const branch = tree !== null && node.hasChildNodes;
871
+ const expanded = branch && tree.expandedKeys.has(key);
872
+ const toggle = toggleOf(tree, key);
873
+ const listAction = collection.onAction;
874
+ const action = onAction ?? (href === void 0 ? listAction === void 0 ? branch && !checks ? toggle : void 0 : () => {
875
+ listAction(key);
876
+ } : () => {
877
+ openLink(href);
878
+ });
879
+ const acts = action !== void 0 && (!selectable || selectionManager.isEmpty);
880
+ const offersSelect = selectable && (isList || action !== void 0);
881
+ const opens = branch && !disabled;
882
+ let t4;
883
+ if ($[29] !== key || $[30] !== selectionManager) {
884
+ t4 = () => {
885
+ selectionManager.select(key);
886
+ };
887
+ $[29] = key;
888
+ $[30] = selectionManager;
889
+ $[31] = t4;
890
+ } else t4 = $[31];
891
+ const select = t4;
892
+ const content = rowContentColor(theme, {
893
+ isDisabled: disabled,
894
+ isSelected: marked,
895
+ variant
896
+ });
897
+ const feedback = usePressFeedback({
898
+ color: content,
899
+ corners: route === void 0 ? void 0 : own.pill,
900
+ disabled,
901
+ onBlur,
902
+ onFocus,
903
+ onHoverIn,
904
+ onHoverOut,
905
+ onPressIn,
906
+ onPressOut
907
+ });
908
+ const box = isList && checks ? /* @__PURE__ */ jsx(SelectBox, {
909
+ isDisabled: disabled,
910
+ isSelected: selected,
911
+ onPress: acts && selectable ? select : void 0
912
+ }) : null;
913
+ const lead = tree === null ? box === null ? leading : withBox(box, leading, own.lead) : treeLead({
914
+ box,
915
+ chevron: branch ? /* @__PURE__ */ jsx(TreeChevron, {
916
+ color: disabled || marked ? content : theme.colors.onSurfaceVariant,
917
+ isDisabled: disabled,
918
+ isExpanded: expanded,
919
+ onPress: toggle
920
+ }) : null,
921
+ indent: node.level * theme.spacing.xl,
922
+ leading,
923
+ style: own.lead
924
+ });
925
+ let t5;
926
+ if ($[32] !== disabled || $[33] !== lead || $[34] !== marked || $[35] !== node.rendered || $[36] !== onTrail || $[37] !== overline || $[38] !== supporting || $[39] !== trailing || $[40] !== variant) {
927
+ t5 = /* @__PURE__ */ jsx(RowContent, {
928
+ isDisabled: disabled,
929
+ isEmphasized: onTrail,
930
+ isSelected: marked,
931
+ leading: lead,
932
+ overline,
933
+ supporting,
934
+ trailing,
935
+ variant,
936
+ children: node.rendered
937
+ });
938
+ $[32] = disabled;
939
+ $[33] = lead;
940
+ $[34] = marked;
941
+ $[35] = node.rendered;
942
+ $[36] = onTrail;
943
+ $[37] = overline;
944
+ $[38] = supporting;
945
+ $[39] = trailing;
946
+ $[40] = variant;
947
+ $[41] = t5;
948
+ } else t5 = $[41];
949
+ const lines = t5;
950
+ const rowStyle = rowStyleOf(theme, {
951
+ isSelected: marked,
952
+ overline,
953
+ supporting,
954
+ variant
955
+ });
956
+ let t6;
957
+ if ($[42] !== collection.selectLabel || $[43] !== offersSelect) {
958
+ t6 = offersSelect ? [{
959
+ label: collection.selectLabel,
960
+ name: "select"
961
+ }] : [];
962
+ $[42] = collection.selectLabel;
963
+ $[43] = offersSelect;
964
+ $[44] = t6;
965
+ } else t6 = $[44];
966
+ const t7 = opens ? [expanded ? {
967
+ label: messages.collapse,
968
+ name: "collapse"
969
+ } : {
970
+ label: messages.expand,
971
+ name: "expand"
972
+ }] : [];
973
+ let t8;
974
+ if ($[45] !== t6 || $[46] !== t7) {
975
+ t8 = [...t6, ...t7];
976
+ $[45] = t6;
977
+ $[46] = t7;
978
+ $[47] = t8;
979
+ } else t8 = $[47];
980
+ const accessibilityActions = t8;
981
+ if (!checks && action === void 0 && onPress === void 0) return /* @__PURE__ */ jsx(View, {
982
+ "aria-disabled": disabled || void 0,
983
+ ref: rowRef,
984
+ style: composeStyles(rowStyle, style),
985
+ testID: props.testID,
986
+ children: lines
987
+ });
988
+ const T0 = Pressable;
989
+ const t9 = href === void 0 ? "button" : "link";
990
+ const t10 = checks ? toggleState(selected) : void 0;
991
+ let t11;
992
+ if ($[48] !== current || $[49] !== route) {
993
+ t11 = route === void 0 ? void 0 : currentState(current);
994
+ $[48] = current;
995
+ $[49] = route;
996
+ $[50] = t11;
997
+ } else t11 = $[50];
998
+ const t12 = branch ? { "aria-expanded": expanded } : void 0;
999
+ const t13 = accessibilityActions.length > 0 ? {
1000
+ accessibilityActions,
1001
+ onAccessibilityAction: accessibilityActionOf({
1002
+ collapse: opens && expanded ? toggle : void 0,
1003
+ expand: opens && !expanded ? toggle : void 0,
1004
+ select: offersSelect ? select : void 0
1005
+ })
1006
+ } : void 0;
1007
+ const t14 = feedback.handlers;
1008
+ let t15;
1009
+ if ($[51] !== action || $[52] !== onLongPress || $[53] !== select || $[54] !== selectable) {
1010
+ t15 = action !== void 0 && selectable ? pressThen(onLongPress, select) : onLongPress;
1011
+ $[51] = action;
1012
+ $[52] = onLongPress;
1013
+ $[53] = select;
1014
+ $[54] = selectable;
1015
+ $[55] = t15;
1016
+ } else t15 = $[55];
1017
+ const t16 = acts ? action : selectable ? select : noop;
1018
+ let t17;
1019
+ if ($[56] !== onPress || $[57] !== t16) {
1020
+ t17 = pressThen(onPress, t16);
1021
+ $[56] = onPress;
1022
+ $[57] = t16;
1023
+ $[58] = t17;
1024
+ } else t17 = $[58];
1025
+ const t18 = composeStyles(rowStyle, feedback.ring, feedback.ring === void 0 ? void 0 : rowStyles.ring, style);
1026
+ let t19;
1027
+ if ($[59] !== T0 || $[60] !== disabled || $[61] !== feedback.handlers || $[62] !== feedback.layer || $[63] !== lines || $[64] !== props || $[65] !== rowRef || $[66] !== t10 || $[67] !== t11 || $[68] !== t12 || $[69] !== t13 || $[70] !== t15 || $[71] !== t17 || $[72] !== t18 || $[73] !== t9) {
1028
+ t19 = /* @__PURE__ */ jsxs(T0, {
1029
+ role: t9,
1030
+ ...props,
1031
+ ...t10,
1032
+ ...t11,
1033
+ ...t12,
1034
+ ...t13,
1035
+ ...t14,
1036
+ disabled,
1037
+ onLongPress: t15,
1038
+ onPress: t17,
1039
+ ref: rowRef,
1040
+ style: t18,
1041
+ children: [feedback.layer, lines]
1042
+ });
1043
+ $[59] = T0;
1044
+ $[60] = disabled;
1045
+ $[61] = feedback.handlers;
1046
+ $[62] = feedback.layer;
1047
+ $[63] = lines;
1048
+ $[64] = props;
1049
+ $[65] = rowRef;
1050
+ $[66] = t10;
1051
+ $[67] = t11;
1052
+ $[68] = t12;
1053
+ $[69] = t13;
1054
+ $[70] = t15;
1055
+ $[71] = t17;
1056
+ $[72] = t18;
1057
+ $[73] = t9;
1058
+ $[74] = t19;
1059
+ } else t19 = $[74];
1060
+ return t19;
1061
+ }
1062
+ /**
1063
+ * Where a row the list has not measured yet is reached: as far down as rows
1064
+ * of the average height would put it, which a `FlatList` asks for in place
1065
+ * of scrolling to a row it cannot place.
1066
+ */
1067
+ function scrollNear(list) {
1068
+ return ({ averageItemLength, index }) => {
1069
+ list?.scrollToOffset({
1070
+ animated: false,
1071
+ offset: averageItemLength * index
1072
+ });
1073
+ };
1074
+ }
1075
+ /**
1076
+ * A section's heading: on a List's ground, so the rows pass under it as it
1077
+ * sticks, and on none in a ListBox, where it scrolls with them.
1078
+ */
1079
+ function SectionHeader(t0) {
1080
+ const $ = c(10);
1081
+ const { node } = t0;
1082
+ const own = stylesOf(useTheme());
1083
+ const { ground, kind } = useCollection();
1084
+ const drawer = kind === "drawer";
1085
+ const title = useTypeRole(drawer ? "labelLarge" : "titleSmall");
1086
+ const T0 = View;
1087
+ let t1;
1088
+ if ($[0] !== ground) {
1089
+ t1 = ground === void 0 ? void 0 : composeStyles({ backgroundColor: ground });
1090
+ $[0] = ground;
1091
+ $[1] = t1;
1092
+ } else t1 = $[1];
1093
+ const T1 = Text;
1094
+ const t2 = "heading";
1095
+ const t3 = composeStyles(title, drawer ? own.drawerHeader : own.header);
1096
+ let t4;
1097
+ if ($[2] !== T1 || $[3] !== node.rendered || $[4] !== t3) {
1098
+ t4 = /* @__PURE__ */ jsx(T1, {
1099
+ role: t2,
1100
+ style: t3,
1101
+ children: node.rendered
1102
+ });
1103
+ $[2] = T1;
1104
+ $[3] = node.rendered;
1105
+ $[4] = t3;
1106
+ $[5] = t4;
1107
+ } else t4 = $[5];
1108
+ let t5;
1109
+ if ($[6] !== T0 || $[7] !== t1 || $[8] !== t4) {
1110
+ t5 = /* @__PURE__ */ jsx(T0, {
1111
+ style: t1,
1112
+ children: t4
1113
+ });
1114
+ $[6] = T0;
1115
+ $[7] = t1;
1116
+ $[8] = t4;
1117
+ $[9] = t5;
1118
+ } else t5 = $[9];
1119
+ return t5;
1120
+ }
1121
+ function* sectionNode(props) {
1122
+ const children = childElementsOf(props.children);
1123
+ yield {
1124
+ *childNodes() {
1125
+ for (const element of children) yield { element };
1126
+ },
1127
+ hasChildNodes: true,
1128
+ key: props.id,
1129
+ props,
1130
+ rendered: props.header,
1131
+ type: "section"
1132
+ };
1133
+ }
1134
+ /**
1135
+ * The checkbox a List's selecting row draws, for the eye alone: the row is
1136
+ * what a screen reader hears and presses. On a row whose press runs an
1137
+ * action, a touch on the box selects instead, through a press of its own the
1138
+ * size of a 48dp target, hidden from the reader as the box is.
1139
+ */
1140
+ function SelectBox(t0) {
1141
+ const $ = c(10);
1142
+ const { isDisabled, isSelected, onPress } = t0;
1143
+ let t1;
1144
+ if ($[0] !== isDisabled || $[1] !== isSelected) {
1145
+ t1 = /* @__PURE__ */ jsx(CheckboxBox, {
1146
+ isDisabled,
1147
+ isSelected,
1148
+ within: BOX_SLOT
1149
+ });
1150
+ $[0] = isDisabled;
1151
+ $[1] = isSelected;
1152
+ $[2] = t1;
1153
+ } else t1 = $[2];
1154
+ const drawn = t1;
1155
+ if (onPress === void 0) {
1156
+ let t2;
1157
+ if ($[3] !== drawn) {
1158
+ t2 = /* @__PURE__ */ jsx(View, {
1159
+ style: styles.box,
1160
+ children: drawn
1161
+ });
1162
+ $[3] = drawn;
1163
+ $[4] = t2;
1164
+ } else t2 = $[4];
1165
+ return t2;
1166
+ }
1167
+ let t2;
1168
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1169
+ t2 = hitSlop(BOX_SLOT, BOX_SLOT);
1170
+ $[5] = t2;
1171
+ } else t2 = $[5];
1172
+ let t3;
1173
+ if ($[6] !== drawn || $[7] !== isDisabled || $[8] !== onPress) {
1174
+ t3 = /* @__PURE__ */ jsx(Pressable, {
1175
+ accessible: false,
1176
+ "aria-hidden": true,
1177
+ disabled: isDisabled,
1178
+ focusable: false,
1179
+ hitSlop: t2,
1180
+ onPress,
1181
+ style: styles.box,
1182
+ tabIndex: -1,
1183
+ children: drawn
1184
+ });
1185
+ $[6] = drawn;
1186
+ $[7] = isDisabled;
1187
+ $[8] = onPress;
1188
+ $[9] = t3;
1189
+ } else t3 = $[9];
1190
+ return t3;
1191
+ }
1192
+ /**
1193
+ * A message said to a screen reader as it changes and never drawn: in a
1194
+ * polite live region on Android and under React Native Web, and through
1195
+ * `AccessibilityInfo` on iOS, which has no live regions, so nothing is drawn
1196
+ * there at all. The message a status mounts with is not said, and an empty
1197
+ * one says nothing. A search's count of rows, and a table's sort.
1198
+ */
1199
+ function Status(t0) {
1200
+ const $ = c(5);
1201
+ const { message } = t0;
1202
+ const t1 = useTheme();
1203
+ let t2;
1204
+ if ($[0] !== t1) {
1205
+ t2 = stylesOf(t1);
1206
+ $[0] = t1;
1207
+ $[1] = t2;
1208
+ } else t2 = $[1];
1209
+ const own = t2;
1210
+ useAnnouncement(message);
1211
+ if (Platform.OS === "ios") return null;
1212
+ let t3;
1213
+ if ($[2] !== message || $[3] !== own.status) {
1214
+ t3 = /* @__PURE__ */ jsx(View, {
1215
+ "aria-live": "polite",
1216
+ style: styles.status,
1217
+ children: /* @__PURE__ */ jsx(Text, {
1218
+ style: own.status,
1219
+ children: message
1220
+ })
1221
+ });
1222
+ $[2] = message;
1223
+ $[3] = own.status;
1224
+ $[4] = t3;
1225
+ } else t3 = $[4];
1226
+ return t3;
1227
+ }
1228
+ /**
1229
+ * Opens a tree's row, or closes it when it is open. Built by a call rather
1230
+ * than written inline, which is what react-perf's
1231
+ * no-new-function-as-prop is after.
1232
+ */
1233
+ function toggleOf(tree, key) {
1234
+ return () => {
1235
+ tree?.toggleKey(key);
1236
+ };
1237
+ }
1238
+ /**
1239
+ * The chevron a Tree's row with rows under it draws, which opens and closes
1240
+ * it, for the eye and the finger alone: the row is what a screen reader
1241
+ * hears, and opens or closes through its actions. It takes a press of its
1242
+ * own the size of a 48dp target, and draws no state layer, since the row
1243
+ * around it already carries one.
1244
+ */
1245
+ function TreeChevron(t0) {
1246
+ const $ = c(8);
1247
+ const { color, isDisabled, isExpanded, onPress } = t0;
1248
+ let t1;
1249
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1250
+ t1 = hitSlop(BOX_SLOT, BOX_SLOT);
1251
+ $[0] = t1;
1252
+ } else t1 = $[0];
1253
+ let t2;
1254
+ if ($[1] !== color || $[2] !== isExpanded) {
1255
+ t2 = /* @__PURE__ */ jsx(ExpandChevron, {
1256
+ color,
1257
+ isExpanded
1258
+ });
1259
+ $[1] = color;
1260
+ $[2] = isExpanded;
1261
+ $[3] = t2;
1262
+ } else t2 = $[3];
1263
+ let t3;
1264
+ if ($[4] !== isDisabled || $[5] !== onPress || $[6] !== t2) {
1265
+ t3 = /* @__PURE__ */ jsx(Pressable, {
1266
+ accessible: false,
1267
+ "aria-hidden": true,
1268
+ disabled: isDisabled,
1269
+ focusable: false,
1270
+ hitSlop: t1,
1271
+ onPress,
1272
+ style: styles.box,
1273
+ tabIndex: -1,
1274
+ children: t2
1275
+ });
1276
+ $[4] = isDisabled;
1277
+ $[5] = onPress;
1278
+ $[6] = t2;
1279
+ $[7] = t3;
1280
+ } else t3 = $[7];
1281
+ return t3;
1282
+ }
1283
+ /**
1284
+ * The leading slot of a Tree's row: its chevron, or the chevron's space on a
1285
+ * row with nothing under it so its headline lines up with one that opens,
1286
+ * then the checkbox of a tree that selects, then whatever the row was given,
1287
+ * all set in by the row's depth, a chevron's width a level.
1288
+ */
1289
+ function treeLead({ box, chevron, indent, leading, style }) {
1290
+ return /* @__PURE__ */ jsxs(View, {
1291
+ style: composeStyles(style, { marginStart: indent }),
1292
+ children: [
1293
+ chevron ?? /* @__PURE__ */ jsx(View, { style: styles.box }),
1294
+ box,
1295
+ leading
1296
+ ]
1297
+ });
1298
+ }
1299
+ function useAnnouncement(message) {
1300
+ const $ = c(3);
1301
+ const was = useRef(message);
1302
+ let t0;
1303
+ let t1;
1304
+ if ($[0] !== message) {
1305
+ t0 = () => {
1306
+ if (message !== was.current && message !== "" && Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(message);
1307
+ was.current = message;
1308
+ };
1309
+ t1 = [message];
1310
+ $[0] = message;
1311
+ $[1] = t0;
1312
+ $[2] = t1;
1313
+ } else {
1314
+ t0 = $[1];
1315
+ t1 = $[2];
1316
+ }
1317
+ useEffect(t0, t1);
1318
+ }
1319
+ function useCollection() {
1320
+ const collection = use(CollectionContext);
1321
+ if (collection === null) throw new Error("A List or ListBox part is drawn by the one it is in.");
1322
+ return collection;
1323
+ }
1324
+ function useLoadingAnnouncement(isLoading, label) {
1325
+ const $ = c(4);
1326
+ const was = useRef(isLoading);
1327
+ let t0;
1328
+ let t1;
1329
+ if ($[0] !== isLoading || $[1] !== label) {
1330
+ t0 = () => {
1331
+ if (isLoading && !was.current && Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(label);
1332
+ was.current = isLoading;
1333
+ };
1334
+ t1 = [isLoading, label];
1335
+ $[0] = isLoading;
1336
+ $[1] = label;
1337
+ $[2] = t0;
1338
+ $[3] = t1;
1339
+ } else {
1340
+ t0 = $[2];
1341
+ t1 = $[3];
1342
+ }
1343
+ useEffect(t0, t1);
1344
+ }
1345
+ /**
1346
+ * The leading slot of a List's row that selects: the checkbox, then whatever
1347
+ * the row was given, in a row of their own so the two sit side by side.
1348
+ */
1349
+ function withBox(box, leading, style) {
1350
+ return hasContent(leading) ? /* @__PURE__ */ jsxs(View, {
1351
+ style,
1352
+ children: [box, leading]
1353
+ }) : box;
1354
+ }
1355
+ //#endregion
1356
+ export { Collection, CollectionView, LoadingRow, ResultsStatus, SelectBox, Status, accessibilityActionOf, childElementsOf, focusKeyOf, loadMoreOf, loaderNode, nestedRowNode, noop, pressThen, rowCountOf, rowNode, sectionNode };
1357
+
1358
+ //# sourceMappingURL=index.js.map