@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.
Files changed (253) 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/badge/index.js +9 -70
  5. package/dist/badge/index.js.map +1 -1
  6. package/dist/button/group.d.ts +5 -0
  7. package/dist/button/group.js +115 -0
  8. package/dist/button/group.js.map +1 -0
  9. package/dist/button/index.d.ts +4 -1
  10. package/dist/button/index.js +45 -23
  11. package/dist/button/index.js.map +1 -1
  12. package/dist/button/palettes.d.ts +2 -0
  13. package/dist/button/slots.js +2 -1
  14. package/dist/button/slots.js.map +1 -1
  15. package/dist/calendar/index.js +351 -182
  16. package/dist/calendar/index.js.map +1 -1
  17. package/dist/calendar/styles.js +33 -2
  18. package/dist/calendar/styles.js.map +1 -1
  19. package/dist/carousel/arrangement.d.ts +5 -0
  20. package/dist/carousel/arrangement.js +123 -0
  21. package/dist/carousel/arrangement.js.map +1 -0
  22. package/dist/chequer/index.js +95 -0
  23. package/dist/chequer/index.js.map +1 -0
  24. package/dist/collection/index.d.ts +157 -0
  25. package/dist/collection/index.js +1331 -0
  26. package/dist/collection/index.js.map +1 -0
  27. package/dist/color-thumb/index.js +56 -0
  28. package/dist/color-thumb/index.js.map +1 -0
  29. package/dist/components/badge/index.d.ts +48 -0
  30. package/dist/components/badge/index.js +122 -0
  31. package/dist/components/badge/index.js.map +1 -0
  32. package/dist/{badge → components/badge}/styles.js +10 -6
  33. package/dist/components/badge/styles.js.map +1 -0
  34. package/dist/components/breadcrumbs/index.d.ts +66 -0
  35. package/dist/components/breadcrumbs/index.js +285 -0
  36. package/dist/components/breadcrumbs/index.js.map +1 -0
  37. package/dist/components/button/index.d.ts +4 -2
  38. package/dist/components/button/index.js +227 -188
  39. package/dist/components/button/index.js.map +1 -1
  40. package/dist/components/button-group/index.d.ts +87 -0
  41. package/dist/components/button-group/index.js +275 -0
  42. package/dist/components/button-group/index.js.map +1 -0
  43. package/dist/components/calendar/index.d.ts +11 -3
  44. package/dist/components/calendar/index.js +60 -45
  45. package/dist/components/calendar/index.js.map +1 -1
  46. package/dist/components/carousel/index.d.ts +72 -0
  47. package/dist/components/carousel/index.js +496 -0
  48. package/dist/components/carousel/index.js.map +1 -0
  49. package/dist/components/checkbox/index.d.ts +7 -1
  50. package/dist/components/checkbox/index.js +183 -138
  51. package/dist/components/checkbox/index.js.map +1 -1
  52. package/dist/components/checkbox-group/index.d.ts +92 -0
  53. package/dist/components/checkbox-group/index.js +306 -0
  54. package/dist/components/checkbox-group/index.js.map +1 -0
  55. package/dist/components/code/index.d.ts +25 -0
  56. package/dist/components/code/index.js +87 -0
  57. package/dist/components/code/index.js.map +1 -0
  58. package/dist/components/color-area/index.d.ts +85 -0
  59. package/dist/components/color-area/index.js +630 -0
  60. package/dist/components/color-area/index.js.map +1 -0
  61. package/dist/components/color-field/index.d.ts +144 -0
  62. package/dist/components/color-field/index.js +516 -0
  63. package/dist/components/color-field/index.js.map +1 -0
  64. package/dist/components/color-picker/index.d.ts +74 -0
  65. package/dist/components/color-picker/index.js +317 -0
  66. package/dist/components/color-picker/index.js.map +1 -0
  67. package/dist/components/color-slider/index.d.ts +82 -0
  68. package/dist/components/color-slider/index.js +456 -0
  69. package/dist/components/color-slider/index.js.map +1 -0
  70. package/dist/components/color-swatch/index.d.ts +46 -0
  71. package/dist/components/color-swatch/index.js +127 -0
  72. package/dist/components/color-swatch/index.js.map +1 -0
  73. package/dist/components/color-swatch-picker/index.d.ts +81 -0
  74. package/dist/components/color-swatch-picker/index.js +287 -0
  75. package/dist/components/color-swatch-picker/index.js.map +1 -0
  76. package/dist/components/color-wheel/index.d.ts +71 -0
  77. package/dist/components/color-wheel/index.js +407 -0
  78. package/dist/components/color-wheel/index.js.map +1 -0
  79. package/dist/components/combo-box/index.d.ts +193 -0
  80. package/dist/components/combo-box/index.js +616 -0
  81. package/dist/components/combo-box/index.js.map +1 -0
  82. package/dist/components/container/index.d.ts +47 -0
  83. package/dist/components/container/index.js +85 -0
  84. package/dist/components/container/index.js.map +1 -0
  85. package/dist/components/date-field/index.d.ts +120 -0
  86. package/dist/components/date-field/index.js +111 -0
  87. package/dist/components/date-field/index.js.map +1 -0
  88. package/dist/components/date-picker/index.d.ts +130 -0
  89. package/dist/components/date-picker/index.js +310 -0
  90. package/dist/components/date-picker/index.js.map +1 -0
  91. package/dist/components/date-range-picker/index.d.ts +139 -0
  92. package/dist/components/date-range-picker/index.js +421 -0
  93. package/dist/components/date-range-picker/index.js.map +1 -0
  94. package/dist/components/disclosure/index.d.ts +94 -0
  95. package/dist/components/disclosure/index.js +365 -0
  96. package/dist/components/disclosure/index.js.map +1 -0
  97. package/dist/components/disclosure-group/index.d.ts +61 -0
  98. package/dist/components/disclosure-group/index.js +100 -0
  99. package/dist/components/disclosure-group/index.js.map +1 -0
  100. package/dist/components/drop-zone/index.d.ts +113 -0
  101. package/dist/components/drop-zone/index.js +304 -0
  102. package/dist/components/drop-zone/index.js.map +1 -0
  103. package/dist/components/fab/index.d.ts +80 -0
  104. package/dist/components/fab/index.js +246 -0
  105. package/dist/components/fab/index.js.map +1 -0
  106. package/dist/components/fab-menu/index.d.ts +120 -0
  107. package/dist/components/fab-menu/index.js +640 -0
  108. package/dist/components/fab-menu/index.js.map +1 -0
  109. package/dist/components/feed/index.d.ts +57 -0
  110. package/dist/components/feed/index.js +167 -0
  111. package/dist/components/feed/index.js.map +1 -0
  112. package/dist/components/form/index.d.ts +3 -2
  113. package/dist/components/form/index.js.map +1 -1
  114. package/dist/components/icon-button/index.d.ts +4 -2
  115. package/dist/components/icon-button/index.js +204 -171
  116. package/dist/components/icon-button/index.js.map +1 -1
  117. package/dist/components/keycap/index.d.ts +27 -0
  118. package/dist/components/keycap/index.js +136 -0
  119. package/dist/components/keycap/index.js.map +1 -0
  120. package/dist/components/list/index.d.ts +15 -158
  121. package/dist/components/list/index.js +21 -1047
  122. package/dist/components/list/index.js.map +1 -1
  123. package/dist/components/list-box/index.d.ts +73 -0
  124. package/dist/components/list-box/index.js +82 -0
  125. package/dist/components/list-box/index.js.map +1 -0
  126. package/dist/components/loading-indicator/index.d.ts +32 -0
  127. package/dist/components/loading-indicator/index.js +174 -0
  128. package/dist/components/loading-indicator/index.js.map +1 -0
  129. package/dist/components/menu/index.js +1 -1
  130. package/dist/components/navigation-tree/index.d.ts +117 -0
  131. package/dist/components/navigation-tree/index.js +135 -0
  132. package/dist/components/navigation-tree/index.js.map +1 -0
  133. package/dist/components/number-field/index.js +132 -143
  134. package/dist/components/number-field/index.js.map +1 -1
  135. package/dist/components/range-calendar/index.d.ts +69 -0
  136. package/dist/components/range-calendar/index.js +144 -0
  137. package/dist/components/range-calendar/index.js.map +1 -0
  138. package/dist/components/search-view/index.d.ts +78 -0
  139. package/dist/components/search-view/index.js +570 -0
  140. package/dist/components/search-view/index.js.map +1 -0
  141. package/dist/components/select/index.d.ts +152 -0
  142. package/dist/components/select/index.js +419 -0
  143. package/dist/components/select/index.js.map +1 -0
  144. package/dist/components/separator/index.d.ts +3 -2
  145. package/dist/components/separator/index.js +29 -26
  146. package/dist/components/separator/index.js.map +1 -1
  147. package/dist/components/slider/index.d.ts +111 -0
  148. package/dist/components/slider/index.js +673 -0
  149. package/dist/components/slider/index.js.map +1 -0
  150. package/dist/components/split-button/index.d.ts +77 -0
  151. package/dist/components/split-button/index.js +354 -0
  152. package/dist/components/split-button/index.js.map +1 -0
  153. package/dist/components/supporting-pane/index.d.ts +44 -0
  154. package/dist/components/supporting-pane/index.js +109 -0
  155. package/dist/components/supporting-pane/index.js.map +1 -0
  156. package/dist/components/tabs/index.d.ts +196 -0
  157. package/dist/components/tabs/index.js +1137 -0
  158. package/dist/components/tabs/index.js.map +1 -0
  159. package/dist/components/text/index.d.ts +1 -1
  160. package/dist/components/text/index.js +49 -21
  161. package/dist/components/text/index.js.map +1 -1
  162. package/dist/components/text-area/index.d.ts +145 -0
  163. package/dist/components/text-area/index.js +231 -0
  164. package/dist/components/text-area/index.js.map +1 -0
  165. package/dist/components/time-field/index.d.ts +43 -0
  166. package/dist/components/time-field/index.js +107 -0
  167. package/dist/components/time-field/index.js.map +1 -0
  168. package/dist/components/time-picker/index.d.ts +65 -0
  169. package/dist/components/time-picker/index.js +1168 -0
  170. package/dist/components/time-picker/index.js.map +1 -0
  171. package/dist/components/toolbar/index.d.ts +53 -0
  172. package/dist/components/toolbar/index.js +185 -0
  173. package/dist/components/toolbar/index.js.map +1 -0
  174. package/dist/components/tooltip/index.d.ts +101 -0
  175. package/dist/components/tooltip/index.js +223 -0
  176. package/dist/components/tooltip/index.js.map +1 -0
  177. package/dist/components/tree/index.d.ts +112 -0
  178. package/dist/components/tree/index.js +157 -0
  179. package/dist/components/tree/index.js.map +1 -0
  180. package/dist/control/group.js +23 -0
  181. package/dist/control/group.js.map +1 -0
  182. package/dist/disclosure/chevron.js +75 -0
  183. package/dist/disclosure/chevron.js.map +1 -0
  184. package/dist/disclosure/index.js +7 -0
  185. package/dist/disclosure/index.js.map +1 -0
  186. package/dist/drop/index.d.ts +54 -0
  187. package/dist/drop/index.js +161 -0
  188. package/dist/drop/index.js.map +1 -0
  189. package/dist/fab/index.d.ts +19 -0
  190. package/dist/fab/index.js +147 -0
  191. package/dist/fab/index.js.map +1 -0
  192. package/dist/field/chevron.js +74 -0
  193. package/dist/field/chevron.js.map +1 -0
  194. package/dist/field/index.d.ts +2 -1
  195. package/dist/field/index.js +350 -153
  196. package/dist/field/index.js.map +1 -1
  197. package/dist/field/styles.js +27 -0
  198. package/dist/field/styles.js.map +1 -1
  199. package/dist/files/index.d.ts +18 -0
  200. package/dist/files/index.js +107 -0
  201. package/dist/files/index.js.map +1 -0
  202. package/dist/form/index.d.ts +6 -4
  203. package/dist/form/index.js +64 -85
  204. package/dist/form/index.js.map +1 -1
  205. package/dist/glyphs/index.js +92 -1
  206. package/dist/glyphs/index.js.map +1 -1
  207. package/dist/i18n/index.js +20 -1
  208. package/dist/i18n/index.js.map +1 -1
  209. package/dist/i18n/messages.js +1394 -34
  210. package/dist/i18n/messages.js.map +1 -1
  211. package/dist/index.d.ts +51 -6
  212. package/dist/index.js +47 -4
  213. package/dist/indicator/paths.js +23 -1
  214. package/dist/indicator/paths.js.map +1 -1
  215. package/dist/modal/index.js +96 -68
  216. package/dist/modal/index.js.map +1 -1
  217. package/dist/navigation/index.js +8 -5
  218. package/dist/navigation/index.js.map +1 -1
  219. package/dist/number/keyboard.js +16 -0
  220. package/dist/number/keyboard.js.map +1 -0
  221. package/dist/overlay/anchored.js +68 -38
  222. package/dist/overlay/anchored.js.map +1 -1
  223. package/dist/overlay/keyboard.js +57 -0
  224. package/dist/overlay/keyboard.js.map +1 -0
  225. package/dist/overlay/panel.js +173 -19
  226. package/dist/overlay/panel.js.map +1 -1
  227. package/dist/overlay/placement.js +16 -2
  228. package/dist/overlay/placement.js.map +1 -1
  229. package/dist/picker/index.js +322 -0
  230. package/dist/picker/index.js.map +1 -0
  231. package/dist/press/index.d.ts +2 -0
  232. package/dist/press/index.js +102 -100
  233. package/dist/press/index.js.map +1 -1
  234. package/dist/row/index.js +77 -69
  235. package/dist/row/index.js.map +1 -1
  236. package/dist/row/styles.js +13 -2
  237. package/dist/row/styles.js.map +1 -1
  238. package/dist/segments/field.js +277 -0
  239. package/dist/segments/field.js.map +1 -0
  240. package/dist/segments/index.js +574 -0
  241. package/dist/segments/index.js.map +1 -0
  242. package/dist/segments/styles.js +24 -0
  243. package/dist/segments/styles.js.map +1 -0
  244. package/dist/separator/index.js +7 -0
  245. package/dist/separator/index.js.map +1 -0
  246. package/dist/slider/index.js +145 -0
  247. package/dist/slider/index.js.map +1 -0
  248. package/dist/swatch/index.js +56 -0
  249. package/dist/swatch/index.js.map +1 -0
  250. package/dist/typography/size.js +14 -0
  251. package/dist/typography/size.js.map +1 -0
  252. package/package.json +11 -2
  253. package/dist/badge/styles.js.map +0 -1
@@ -0,0 +1,1331 @@
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
+ /**
575
+ * The row the `LoadMore` part draws: a live region, empty while idle and
576
+ * holding the ring while loading. Android and React Native Web say what
577
+ * arrives in it; iOS has no live regions, so the ring's name is said there
578
+ * as it appears.
579
+ */
580
+ function LoaderRow() {
581
+ const $ = c(8);
582
+ const own = stylesOf(useTheme());
583
+ const { isLoading: t0, label, style, testID } = useCollection().loadMore ?? IDLE;
584
+ const isLoading = t0 === void 0 ? false : t0;
585
+ const messages = useMessages();
586
+ const name = label ?? messages.loadingMore;
587
+ useLoadingAnnouncement(isLoading, name);
588
+ const T0 = View;
589
+ const t1 = "polite";
590
+ const t2 = composeStyles(isLoading ? own.loading : styles.idle, style);
591
+ let t3;
592
+ if ($[0] !== isLoading || $[1] !== name) {
593
+ t3 = isLoading ? /* @__PURE__ */ jsx(ProgressIndicator, {
594
+ "aria-label": name,
595
+ diameter: LOADING_DIAMETER,
596
+ isIndeterminate: true,
597
+ variant: "circular"
598
+ }) : null;
599
+ $[0] = isLoading;
600
+ $[1] = name;
601
+ $[2] = t3;
602
+ } else t3 = $[2];
603
+ let t4;
604
+ if ($[3] !== T0 || $[4] !== t2 || $[5] !== t3 || $[6] !== testID) {
605
+ t4 = /* @__PURE__ */ jsx(T0, {
606
+ "aria-live": t1,
607
+ style: t2,
608
+ testID,
609
+ children: t3
610
+ });
611
+ $[3] = T0;
612
+ $[4] = t2;
613
+ $[5] = t3;
614
+ $[6] = testID;
615
+ $[7] = t4;
616
+ } else t4 = $[7];
617
+ return t4;
618
+ }
619
+ function loadMoreOf({ isLoading = false, onLoadMore }) {
620
+ return () => {
621
+ if (!isLoading) onLoadMore?.();
622
+ };
623
+ }
624
+ function* nestedRowNode(props, rendered, textValue) {
625
+ const children = childElementsOf(props.children);
626
+ yield {
627
+ "aria-label": props["aria-label"],
628
+ *childNodes() {
629
+ for (const element of children) yield { element };
630
+ },
631
+ hasChildNodes: children.length > 0,
632
+ key: props.id,
633
+ props,
634
+ rendered,
635
+ textValue,
636
+ type: "item"
637
+ };
638
+ }
639
+ function noop() {}
640
+ /**
641
+ * The press handler of a row: the call site's own handler, then the row's.
642
+ * Built by a call rather than written inline at the prop, which is what
643
+ * react-perf's no-new-function-as-prop is after.
644
+ */
645
+ function pressThen(onPress, then) {
646
+ return (event) => {
647
+ onPress?.(event);
648
+ then?.();
649
+ };
650
+ }
651
+ function renderEntry({ item }) {
652
+ return item.kind === "header" ? /* @__PURE__ */ jsx(SectionHeader, { node: item.node }) : /* @__PURE__ */ jsx(RowNode, { node: item.node });
653
+ }
654
+ /**
655
+ * How many rows a search leaves, said to a screen reader as it changes and
656
+ * never drawn: in a polite live region on Android and under React Native
657
+ * Web, and through `AccessibilityInfo` on iOS, which has no live regions,
658
+ * so nothing is drawn there at all. A `count` of `null` says nothing, for a
659
+ * list that is closed, so the count is said again as it opens.
660
+ */
661
+ function ResultsStatus(t0) {
662
+ const $ = c(8);
663
+ const { count } = t0;
664
+ const t1 = useTheme();
665
+ let t2;
666
+ if ($[0] !== t1) {
667
+ t2 = stylesOf(t1);
668
+ $[0] = t1;
669
+ $[1] = t2;
670
+ } else t2 = $[1];
671
+ const own = t2;
672
+ const locale = useLocaleOf(void 0);
673
+ let t3;
674
+ if ($[2] !== count || $[3] !== locale) {
675
+ t3 = count === null ? "" : resultsFor(count, locale);
676
+ $[2] = count;
677
+ $[3] = locale;
678
+ $[4] = t3;
679
+ } else t3 = $[4];
680
+ const message = t3;
681
+ useResultsAnnouncement(message);
682
+ if (Platform.OS === "ios") return null;
683
+ let t4;
684
+ if ($[5] !== message || $[6] !== own.status) {
685
+ t4 = /* @__PURE__ */ jsx(View, {
686
+ "aria-live": "polite",
687
+ style: styles.status,
688
+ children: /* @__PURE__ */ jsx(Text, {
689
+ style: own.status,
690
+ children: message
691
+ })
692
+ });
693
+ $[5] = message;
694
+ $[6] = own.status;
695
+ $[7] = t4;
696
+ } else t4 = $[7];
697
+ return t4;
698
+ }
699
+ /**
700
+ * The list's layout handler: the call site's own, then a scroll that brings
701
+ * the row at `index` into view, once, where there is one to reveal. The row
702
+ * goes to the bottom of the list where it was below the fold, and a row
703
+ * already in view stays where it is: scrolled to put a row at the bottom, a
704
+ * list never scrolls past its end, and one that would have to scroll back
705
+ * above its start stays at the top.
706
+ */
707
+ function revealOnLayout(onLayout, { index, list, setRevealed }) {
708
+ return (event) => {
709
+ onLayout?.(event);
710
+ if (index > 0 && list !== null) {
711
+ setRevealed(true);
712
+ list.scrollToIndex({
713
+ animated: false,
714
+ index,
715
+ viewPosition: 1
716
+ });
717
+ }
718
+ };
719
+ }
720
+ function routeMarkOf(nodes, selectedRoute) {
721
+ const trail = [];
722
+ const find = (level) => {
723
+ for (const node of level) {
724
+ if (node.type === "item" && hrefOf(node) === selectedRoute) return node.key;
725
+ if (node.type === "item") trail.push(node.key);
726
+ const found = find(node.childNodes);
727
+ if (found !== null) return found;
728
+ if (node.type === "item") trail.pop();
729
+ }
730
+ return null;
731
+ };
732
+ const current = selectedRoute === void 0 ? null : find(nodes);
733
+ return {
734
+ current,
735
+ trail: new Set(current === null ? [] : trail)
736
+ };
737
+ }
738
+ function rowCountOf(state) {
739
+ return entriesOf(state).rows;
740
+ }
741
+ function* rowNode(props) {
742
+ yield {
743
+ "aria-label": props["aria-label"],
744
+ hasChildNodes: false,
745
+ key: props.id,
746
+ props,
747
+ rendered: props.children,
748
+ textValue: props.textValue ?? (typeof props.children === "string" ? props.children : ""),
749
+ type: "item"
750
+ };
751
+ }
752
+ /**
753
+ * A row: the state layer, the ripple and the focus ring over the leading
754
+ * slot, the lines and the trailing slot, on primary container while
755
+ * selected, with a List's checkbox before them on a row that selects. A
756
+ * Tree's row is indented by its depth and starts with its chevron, or a
757
+ * chevron's space on a row with nothing under it. A row with nothing to do
758
+ * on a press, in a collection that neither selects nor acts, is a `View`
759
+ * that only presents.
760
+ */
761
+ function RowNode(t0) {
762
+ const $ = c(75);
763
+ const { node } = t0;
764
+ const theme = useTheme();
765
+ const own = stylesOf(theme);
766
+ const collection = useCollection();
767
+ const messages = useMessages();
768
+ let href;
769
+ let leading;
770
+ let onAction;
771
+ let onBlur;
772
+ let onFocus;
773
+ let onHoverIn;
774
+ let onHoverOut;
775
+ let onLongPress;
776
+ let onPress;
777
+ let onPressIn;
778
+ let onPressOut;
779
+ let overline;
780
+ let props;
781
+ let ref;
782
+ let style;
783
+ let supporting;
784
+ let trailing;
785
+ if ($[0] !== node.props) {
786
+ 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;
787
+ href = t1;
788
+ leading = t2;
789
+ onAction = t3;
790
+ onBlur = t4;
791
+ onFocus = t5;
792
+ onHoverIn = t6;
793
+ onHoverOut = t7;
794
+ onLongPress = t8;
795
+ onPress = t9;
796
+ onPressIn = t10;
797
+ onPressOut = t11;
798
+ overline = t12;
799
+ ref = t13;
800
+ style = t14;
801
+ supporting = t15;
802
+ trailing = t16;
803
+ props = t17;
804
+ $[0] = node.props;
805
+ $[1] = href;
806
+ $[2] = leading;
807
+ $[3] = onAction;
808
+ $[4] = onBlur;
809
+ $[5] = onFocus;
810
+ $[6] = onHoverIn;
811
+ $[7] = onHoverOut;
812
+ $[8] = onLongPress;
813
+ $[9] = onPress;
814
+ $[10] = onPressIn;
815
+ $[11] = onPressOut;
816
+ $[12] = overline;
817
+ $[13] = props;
818
+ $[14] = ref;
819
+ $[15] = style;
820
+ $[16] = supporting;
821
+ $[17] = trailing;
822
+ } else {
823
+ href = $[1];
824
+ leading = $[2];
825
+ onAction = $[3];
826
+ onBlur = $[4];
827
+ onFocus = $[5];
828
+ onHoverIn = $[6];
829
+ onHoverOut = $[7];
830
+ onLongPress = $[8];
831
+ onPress = $[9];
832
+ onPressIn = $[10];
833
+ onPressOut = $[11];
834
+ overline = $[12];
835
+ props = $[13];
836
+ ref = $[14];
837
+ style = $[15];
838
+ supporting = $[16];
839
+ trailing = $[17];
840
+ }
841
+ const isList = collection.kind === "list";
842
+ const { route } = collection;
843
+ const openLink = useOpenLink();
844
+ const { selectionManager } = collection.state;
845
+ const tree = expansionOf(collection.state);
846
+ const { key } = node;
847
+ let t1;
848
+ if ($[18] !== collection.focusKey || $[19] !== collection.onFocusTarget || $[20] !== key || $[21] !== ref) {
849
+ t1 = key === collection.focusKey ? refsOf(collection.onFocusTarget, ref) : ref;
850
+ $[18] = collection.focusKey;
851
+ $[19] = collection.onFocusTarget;
852
+ $[20] = key;
853
+ $[21] = ref;
854
+ $[22] = t1;
855
+ } else t1 = $[22];
856
+ const rowRef = t1;
857
+ const disabled = selectionManager.isDisabled(key);
858
+ const checks = selectionManager.selectionMode !== "none";
859
+ let t2;
860
+ if ($[23] !== key || $[24] !== selectionManager) {
861
+ t2 = selectionManager.canSelectItem(key);
862
+ $[23] = key;
863
+ $[24] = selectionManager;
864
+ $[25] = t2;
865
+ } else t2 = $[25];
866
+ const selectable = t2;
867
+ const selected = checks && selectionManager.isSelected(key);
868
+ const current = route?.current === key;
869
+ let t3;
870
+ if ($[26] !== key || $[27] !== route?.trail) {
871
+ t3 = route?.trail.has(key);
872
+ $[26] = key;
873
+ $[27] = route?.trail;
874
+ $[28] = t3;
875
+ } else t3 = $[28];
876
+ const onTrail = t3 === true;
877
+ const marked = selected || current;
878
+ const variant = route === void 0 ? void 0 : "drawer";
879
+ const branch = tree !== null && node.hasChildNodes;
880
+ const expanded = branch && tree.expandedKeys.has(key);
881
+ const toggle = toggleOf(tree, key);
882
+ const listAction = collection.onAction;
883
+ const action = onAction ?? (href === void 0 ? listAction === void 0 ? branch && !checks ? toggle : void 0 : () => {
884
+ listAction(key);
885
+ } : () => {
886
+ openLink(href);
887
+ });
888
+ const acts = action !== void 0 && (!selectable || selectionManager.isEmpty);
889
+ const offersSelect = selectable && (isList || action !== void 0);
890
+ const opens = branch && !disabled;
891
+ let t4;
892
+ if ($[29] !== key || $[30] !== selectionManager) {
893
+ t4 = () => {
894
+ selectionManager.select(key);
895
+ };
896
+ $[29] = key;
897
+ $[30] = selectionManager;
898
+ $[31] = t4;
899
+ } else t4 = $[31];
900
+ const select = t4;
901
+ const content = rowContentColor(theme, {
902
+ isDisabled: disabled,
903
+ isSelected: marked,
904
+ variant
905
+ });
906
+ const feedback = usePressFeedback({
907
+ color: content,
908
+ corners: route === void 0 ? void 0 : own.pill,
909
+ disabled,
910
+ onBlur,
911
+ onFocus,
912
+ onHoverIn,
913
+ onHoverOut,
914
+ onPressIn,
915
+ onPressOut
916
+ });
917
+ const box = isList && checks ? /* @__PURE__ */ jsx(SelectBox, {
918
+ isDisabled: disabled,
919
+ isSelected: selected,
920
+ onPress: acts && selectable ? select : void 0
921
+ }) : null;
922
+ const lead = tree === null ? box === null ? leading : withBox(box, leading, own.lead) : treeLead({
923
+ box,
924
+ chevron: branch ? /* @__PURE__ */ jsx(TreeChevron, {
925
+ color: disabled || marked ? content : theme.colors.onSurfaceVariant,
926
+ isDisabled: disabled,
927
+ isExpanded: expanded,
928
+ onPress: toggle
929
+ }) : null,
930
+ indent: node.level * theme.spacing.xl,
931
+ leading,
932
+ style: own.lead
933
+ });
934
+ let t5;
935
+ if ($[32] !== disabled || $[33] !== lead || $[34] !== marked || $[35] !== node.rendered || $[36] !== onTrail || $[37] !== overline || $[38] !== supporting || $[39] !== trailing || $[40] !== variant) {
936
+ t5 = /* @__PURE__ */ jsx(RowContent, {
937
+ isDisabled: disabled,
938
+ isEmphasized: onTrail,
939
+ isSelected: marked,
940
+ leading: lead,
941
+ overline,
942
+ supporting,
943
+ trailing,
944
+ variant,
945
+ children: node.rendered
946
+ });
947
+ $[32] = disabled;
948
+ $[33] = lead;
949
+ $[34] = marked;
950
+ $[35] = node.rendered;
951
+ $[36] = onTrail;
952
+ $[37] = overline;
953
+ $[38] = supporting;
954
+ $[39] = trailing;
955
+ $[40] = variant;
956
+ $[41] = t5;
957
+ } else t5 = $[41];
958
+ const lines = t5;
959
+ const rowStyle = rowStyleOf(theme, {
960
+ isSelected: marked,
961
+ overline,
962
+ supporting,
963
+ variant
964
+ });
965
+ let t6;
966
+ if ($[42] !== collection.selectLabel || $[43] !== offersSelect) {
967
+ t6 = offersSelect ? [{
968
+ label: collection.selectLabel,
969
+ name: "select"
970
+ }] : [];
971
+ $[42] = collection.selectLabel;
972
+ $[43] = offersSelect;
973
+ $[44] = t6;
974
+ } else t6 = $[44];
975
+ const t7 = opens ? [expanded ? {
976
+ label: messages.collapse,
977
+ name: "collapse"
978
+ } : {
979
+ label: messages.expand,
980
+ name: "expand"
981
+ }] : [];
982
+ let t8;
983
+ if ($[45] !== t6 || $[46] !== t7) {
984
+ t8 = [...t6, ...t7];
985
+ $[45] = t6;
986
+ $[46] = t7;
987
+ $[47] = t8;
988
+ } else t8 = $[47];
989
+ const accessibilityActions = t8;
990
+ if (!checks && action === void 0 && onPress === void 0) return /* @__PURE__ */ jsx(View, {
991
+ "aria-disabled": disabled || void 0,
992
+ ref: rowRef,
993
+ style: composeStyles(rowStyle, style),
994
+ testID: props.testID,
995
+ children: lines
996
+ });
997
+ const T0 = Pressable;
998
+ const t9 = href === void 0 ? "button" : "link";
999
+ const t10 = checks ? toggleState(selected) : void 0;
1000
+ let t11;
1001
+ if ($[48] !== current || $[49] !== route) {
1002
+ t11 = route === void 0 ? void 0 : currentState(current);
1003
+ $[48] = current;
1004
+ $[49] = route;
1005
+ $[50] = t11;
1006
+ } else t11 = $[50];
1007
+ const t12 = branch ? { "aria-expanded": expanded } : void 0;
1008
+ const t13 = accessibilityActions.length > 0 ? {
1009
+ accessibilityActions,
1010
+ onAccessibilityAction: accessibilityActionOf({
1011
+ collapse: opens && expanded ? toggle : void 0,
1012
+ expand: opens && !expanded ? toggle : void 0,
1013
+ select: offersSelect ? select : void 0
1014
+ })
1015
+ } : void 0;
1016
+ const t14 = feedback.handlers;
1017
+ let t15;
1018
+ if ($[51] !== action || $[52] !== onLongPress || $[53] !== select || $[54] !== selectable) {
1019
+ t15 = action !== void 0 && selectable ? pressThen(onLongPress, select) : onLongPress;
1020
+ $[51] = action;
1021
+ $[52] = onLongPress;
1022
+ $[53] = select;
1023
+ $[54] = selectable;
1024
+ $[55] = t15;
1025
+ } else t15 = $[55];
1026
+ const t16 = acts ? action : selectable ? select : noop;
1027
+ let t17;
1028
+ if ($[56] !== onPress || $[57] !== t16) {
1029
+ t17 = pressThen(onPress, t16);
1030
+ $[56] = onPress;
1031
+ $[57] = t16;
1032
+ $[58] = t17;
1033
+ } else t17 = $[58];
1034
+ const t18 = composeStyles(rowStyle, feedback.ring, feedback.ring === void 0 ? void 0 : rowStyles.ring, style);
1035
+ let t19;
1036
+ 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) {
1037
+ t19 = /* @__PURE__ */ jsxs(T0, {
1038
+ role: t9,
1039
+ ...props,
1040
+ ...t10,
1041
+ ...t11,
1042
+ ...t12,
1043
+ ...t13,
1044
+ ...t14,
1045
+ disabled,
1046
+ onLongPress: t15,
1047
+ onPress: t17,
1048
+ ref: rowRef,
1049
+ style: t18,
1050
+ children: [feedback.layer, lines]
1051
+ });
1052
+ $[59] = T0;
1053
+ $[60] = disabled;
1054
+ $[61] = feedback.handlers;
1055
+ $[62] = feedback.layer;
1056
+ $[63] = lines;
1057
+ $[64] = props;
1058
+ $[65] = rowRef;
1059
+ $[66] = t10;
1060
+ $[67] = t11;
1061
+ $[68] = t12;
1062
+ $[69] = t13;
1063
+ $[70] = t15;
1064
+ $[71] = t17;
1065
+ $[72] = t18;
1066
+ $[73] = t9;
1067
+ $[74] = t19;
1068
+ } else t19 = $[74];
1069
+ return t19;
1070
+ }
1071
+ /**
1072
+ * Where a row the list has not measured yet is reached: as far down as rows
1073
+ * of the average height would put it, which a `FlatList` asks for in place
1074
+ * of scrolling to a row it cannot place.
1075
+ */
1076
+ function scrollNear(list) {
1077
+ return ({ averageItemLength, index }) => {
1078
+ list?.scrollToOffset({
1079
+ animated: false,
1080
+ offset: averageItemLength * index
1081
+ });
1082
+ };
1083
+ }
1084
+ /**
1085
+ * A section's heading: on a List's ground, so the rows pass under it as it
1086
+ * sticks, and on none in a ListBox, where it scrolls with them.
1087
+ */
1088
+ function SectionHeader(t0) {
1089
+ const $ = c(10);
1090
+ const { node } = t0;
1091
+ const own = stylesOf(useTheme());
1092
+ const { ground, kind } = useCollection();
1093
+ const drawer = kind === "drawer";
1094
+ const title = useTypeRole(drawer ? "labelLarge" : "titleSmall");
1095
+ const T0 = View;
1096
+ let t1;
1097
+ if ($[0] !== ground) {
1098
+ t1 = ground === void 0 ? void 0 : composeStyles({ backgroundColor: ground });
1099
+ $[0] = ground;
1100
+ $[1] = t1;
1101
+ } else t1 = $[1];
1102
+ const T1 = Text;
1103
+ const t2 = "heading";
1104
+ const t3 = composeStyles(title, drawer ? own.drawerHeader : own.header);
1105
+ let t4;
1106
+ if ($[2] !== T1 || $[3] !== node.rendered || $[4] !== t3) {
1107
+ t4 = /* @__PURE__ */ jsx(T1, {
1108
+ role: t2,
1109
+ style: t3,
1110
+ children: node.rendered
1111
+ });
1112
+ $[2] = T1;
1113
+ $[3] = node.rendered;
1114
+ $[4] = t3;
1115
+ $[5] = t4;
1116
+ } else t4 = $[5];
1117
+ let t5;
1118
+ if ($[6] !== T0 || $[7] !== t1 || $[8] !== t4) {
1119
+ t5 = /* @__PURE__ */ jsx(T0, {
1120
+ style: t1,
1121
+ children: t4
1122
+ });
1123
+ $[6] = T0;
1124
+ $[7] = t1;
1125
+ $[8] = t4;
1126
+ $[9] = t5;
1127
+ } else t5 = $[9];
1128
+ return t5;
1129
+ }
1130
+ function* sectionNode(props) {
1131
+ const children = childElementsOf(props.children);
1132
+ yield {
1133
+ *childNodes() {
1134
+ for (const element of children) yield { element };
1135
+ },
1136
+ hasChildNodes: true,
1137
+ key: props.id,
1138
+ props,
1139
+ rendered: props.header,
1140
+ type: "section"
1141
+ };
1142
+ }
1143
+ /**
1144
+ * The checkbox a List's selecting row draws, for the eye alone: the row is
1145
+ * what a screen reader hears and presses. On a row whose press runs an
1146
+ * action, a touch on the box selects instead, through a press of its own the
1147
+ * size of a 48dp target, hidden from the reader as the box is.
1148
+ */
1149
+ function SelectBox(t0) {
1150
+ const $ = c(10);
1151
+ const { isDisabled, isSelected, onPress } = t0;
1152
+ let t1;
1153
+ if ($[0] !== isDisabled || $[1] !== isSelected) {
1154
+ t1 = /* @__PURE__ */ jsx(CheckboxBox, {
1155
+ isDisabled,
1156
+ isSelected,
1157
+ within: BOX_SLOT
1158
+ });
1159
+ $[0] = isDisabled;
1160
+ $[1] = isSelected;
1161
+ $[2] = t1;
1162
+ } else t1 = $[2];
1163
+ const drawn = t1;
1164
+ if (onPress === void 0) {
1165
+ let t2;
1166
+ if ($[3] !== drawn) {
1167
+ t2 = /* @__PURE__ */ jsx(View, {
1168
+ style: styles.box,
1169
+ children: drawn
1170
+ });
1171
+ $[3] = drawn;
1172
+ $[4] = t2;
1173
+ } else t2 = $[4];
1174
+ return t2;
1175
+ }
1176
+ let t2;
1177
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1178
+ t2 = hitSlop(BOX_SLOT, BOX_SLOT);
1179
+ $[5] = t2;
1180
+ } else t2 = $[5];
1181
+ let t3;
1182
+ if ($[6] !== drawn || $[7] !== isDisabled || $[8] !== onPress) {
1183
+ t3 = /* @__PURE__ */ jsx(Pressable, {
1184
+ accessible: false,
1185
+ "aria-hidden": true,
1186
+ disabled: isDisabled,
1187
+ focusable: false,
1188
+ hitSlop: t2,
1189
+ onPress,
1190
+ style: styles.box,
1191
+ tabIndex: -1,
1192
+ children: drawn
1193
+ });
1194
+ $[6] = drawn;
1195
+ $[7] = isDisabled;
1196
+ $[8] = onPress;
1197
+ $[9] = t3;
1198
+ } else t3 = $[9];
1199
+ return t3;
1200
+ }
1201
+ /**
1202
+ * Opens a tree's row, or closes it when it is open. Built by a call rather
1203
+ * than written inline, which is what react-perf's
1204
+ * no-new-function-as-prop is after.
1205
+ */
1206
+ function toggleOf(tree, key) {
1207
+ return () => {
1208
+ tree?.toggleKey(key);
1209
+ };
1210
+ }
1211
+ /**
1212
+ * The chevron a Tree's row with rows under it draws, which opens and closes
1213
+ * it, for the eye and the finger alone: the row is what a screen reader
1214
+ * hears, and opens or closes through its actions. It takes a press of its
1215
+ * own the size of a 48dp target, and draws no state layer, since the row
1216
+ * around it already carries one.
1217
+ */
1218
+ function TreeChevron(t0) {
1219
+ const $ = c(8);
1220
+ const { color, isDisabled, isExpanded, onPress } = t0;
1221
+ let t1;
1222
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1223
+ t1 = hitSlop(BOX_SLOT, BOX_SLOT);
1224
+ $[0] = t1;
1225
+ } else t1 = $[0];
1226
+ let t2;
1227
+ if ($[1] !== color || $[2] !== isExpanded) {
1228
+ t2 = /* @__PURE__ */ jsx(ExpandChevron, {
1229
+ color,
1230
+ isExpanded
1231
+ });
1232
+ $[1] = color;
1233
+ $[2] = isExpanded;
1234
+ $[3] = t2;
1235
+ } else t2 = $[3];
1236
+ let t3;
1237
+ if ($[4] !== isDisabled || $[5] !== onPress || $[6] !== t2) {
1238
+ t3 = /* @__PURE__ */ jsx(Pressable, {
1239
+ accessible: false,
1240
+ "aria-hidden": true,
1241
+ disabled: isDisabled,
1242
+ focusable: false,
1243
+ hitSlop: t1,
1244
+ onPress,
1245
+ style: styles.box,
1246
+ tabIndex: -1,
1247
+ children: t2
1248
+ });
1249
+ $[4] = isDisabled;
1250
+ $[5] = onPress;
1251
+ $[6] = t2;
1252
+ $[7] = t3;
1253
+ } else t3 = $[7];
1254
+ return t3;
1255
+ }
1256
+ /**
1257
+ * The leading slot of a Tree's row: its chevron, or the chevron's space on a
1258
+ * row with nothing under it so its headline lines up with one that opens,
1259
+ * then the checkbox of a tree that selects, then whatever the row was given,
1260
+ * all set in by the row's depth, a chevron's width a level.
1261
+ */
1262
+ function treeLead({ box, chevron, indent, leading, style }) {
1263
+ return /* @__PURE__ */ jsxs(View, {
1264
+ style: composeStyles(style, { marginStart: indent }),
1265
+ children: [
1266
+ chevron ?? /* @__PURE__ */ jsx(View, { style: styles.box }),
1267
+ box,
1268
+ leading
1269
+ ]
1270
+ });
1271
+ }
1272
+ function useCollection() {
1273
+ const collection = use(CollectionContext);
1274
+ if (collection === null) throw new Error("A List or ListBox part is drawn by the one it is in.");
1275
+ return collection;
1276
+ }
1277
+ function useLoadingAnnouncement(isLoading, label) {
1278
+ const $ = c(4);
1279
+ const was = useRef(isLoading);
1280
+ let t0;
1281
+ let t1;
1282
+ if ($[0] !== isLoading || $[1] !== label) {
1283
+ t0 = () => {
1284
+ if (isLoading && !was.current && Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(label);
1285
+ was.current = isLoading;
1286
+ };
1287
+ t1 = [isLoading, label];
1288
+ $[0] = isLoading;
1289
+ $[1] = label;
1290
+ $[2] = t0;
1291
+ $[3] = t1;
1292
+ } else {
1293
+ t0 = $[2];
1294
+ t1 = $[3];
1295
+ }
1296
+ useEffect(t0, t1);
1297
+ }
1298
+ function useResultsAnnouncement(message) {
1299
+ const $ = c(3);
1300
+ const was = useRef(message);
1301
+ let t0;
1302
+ let t1;
1303
+ if ($[0] !== message) {
1304
+ t0 = () => {
1305
+ if (message !== was.current && message !== "" && Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(message);
1306
+ was.current = message;
1307
+ };
1308
+ t1 = [message];
1309
+ $[0] = message;
1310
+ $[1] = t0;
1311
+ $[2] = t1;
1312
+ } else {
1313
+ t0 = $[1];
1314
+ t1 = $[2];
1315
+ }
1316
+ useEffect(t0, t1);
1317
+ }
1318
+ /**
1319
+ * The leading slot of a List's row that selects: the checkbox, then whatever
1320
+ * the row was given, in a row of their own so the two sit side by side.
1321
+ */
1322
+ function withBox(box, leading, style) {
1323
+ return hasContent(leading) ? /* @__PURE__ */ jsxs(View, {
1324
+ style,
1325
+ children: [box, leading]
1326
+ }) : box;
1327
+ }
1328
+ //#endregion
1329
+ export { Collection, CollectionView, ResultsStatus, focusKeyOf, loaderNode, nestedRowNode, rowCountOf, rowNode, sectionNode };
1330
+
1331
+ //# sourceMappingURL=index.js.map