@kanso-labs/react-native-kanso-ui 0.9.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 (196) 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 +1331 -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/color-area/index.d.ts +85 -0
  42. package/dist/components/color-area/index.js +630 -0
  43. package/dist/components/color-area/index.js.map +1 -0
  44. package/dist/components/color-field/index.d.ts +144 -0
  45. package/dist/components/color-field/index.js +516 -0
  46. package/dist/components/color-field/index.js.map +1 -0
  47. package/dist/components/color-picker/index.d.ts +74 -0
  48. package/dist/components/color-picker/index.js +317 -0
  49. package/dist/components/color-picker/index.js.map +1 -0
  50. package/dist/components/color-slider/index.d.ts +82 -0
  51. package/dist/components/color-slider/index.js +456 -0
  52. package/dist/components/color-slider/index.js.map +1 -0
  53. package/dist/components/color-swatch/index.d.ts +46 -0
  54. package/dist/components/color-swatch/index.js +127 -0
  55. package/dist/components/color-swatch/index.js.map +1 -0
  56. package/dist/components/color-swatch-picker/index.d.ts +81 -0
  57. package/dist/components/color-swatch-picker/index.js +287 -0
  58. package/dist/components/color-swatch-picker/index.js.map +1 -0
  59. package/dist/components/color-wheel/index.d.ts +71 -0
  60. package/dist/components/color-wheel/index.js +407 -0
  61. package/dist/components/color-wheel/index.js.map +1 -0
  62. package/dist/components/combo-box/index.d.ts +193 -0
  63. package/dist/components/combo-box/index.js +616 -0
  64. package/dist/components/combo-box/index.js.map +1 -0
  65. package/dist/components/date-field/index.d.ts +120 -0
  66. package/dist/components/date-field/index.js +111 -0
  67. package/dist/components/date-field/index.js.map +1 -0
  68. package/dist/components/date-picker/index.d.ts +130 -0
  69. package/dist/components/date-picker/index.js +310 -0
  70. package/dist/components/date-picker/index.js.map +1 -0
  71. package/dist/components/date-range-picker/index.d.ts +139 -0
  72. package/dist/components/date-range-picker/index.js +421 -0
  73. package/dist/components/date-range-picker/index.js.map +1 -0
  74. package/dist/components/disclosure/index.d.ts +94 -0
  75. package/dist/components/disclosure/index.js +365 -0
  76. package/dist/components/disclosure/index.js.map +1 -0
  77. package/dist/components/disclosure-group/index.d.ts +61 -0
  78. package/dist/components/disclosure-group/index.js +100 -0
  79. package/dist/components/disclosure-group/index.js.map +1 -0
  80. package/dist/components/drop-zone/index.d.ts +113 -0
  81. package/dist/components/drop-zone/index.js +304 -0
  82. package/dist/components/drop-zone/index.js.map +1 -0
  83. package/dist/components/fab/index.d.ts +1 -1
  84. package/dist/components/fab/index.js +91 -76
  85. package/dist/components/fab/index.js.map +1 -1
  86. package/dist/components/form/index.d.ts +3 -2
  87. package/dist/components/form/index.js.map +1 -1
  88. package/dist/components/icon-button/index.d.ts +4 -2
  89. package/dist/components/icon-button/index.js +204 -171
  90. package/dist/components/icon-button/index.js.map +1 -1
  91. package/dist/components/list/index.d.ts +15 -158
  92. package/dist/components/list/index.js +21 -1047
  93. package/dist/components/list/index.js.map +1 -1
  94. package/dist/components/list-box/index.d.ts +73 -0
  95. package/dist/components/list-box/index.js +82 -0
  96. package/dist/components/list-box/index.js.map +1 -0
  97. package/dist/components/loading-indicator/index.d.ts +32 -0
  98. package/dist/components/loading-indicator/index.js +174 -0
  99. package/dist/components/loading-indicator/index.js.map +1 -0
  100. package/dist/components/navigation-tree/index.d.ts +117 -0
  101. package/dist/components/navigation-tree/index.js +135 -0
  102. package/dist/components/navigation-tree/index.js.map +1 -0
  103. package/dist/components/number-field/index.js +132 -143
  104. package/dist/components/number-field/index.js.map +1 -1
  105. package/dist/components/range-calendar/index.d.ts +69 -0
  106. package/dist/components/range-calendar/index.js +144 -0
  107. package/dist/components/range-calendar/index.js.map +1 -0
  108. package/dist/components/search-view/index.d.ts +78 -0
  109. package/dist/components/search-view/index.js +570 -0
  110. package/dist/components/search-view/index.js.map +1 -0
  111. package/dist/components/select/index.d.ts +152 -0
  112. package/dist/components/select/index.js +419 -0
  113. package/dist/components/select/index.js.map +1 -0
  114. package/dist/components/slider/index.d.ts +111 -0
  115. package/dist/components/slider/index.js +673 -0
  116. package/dist/components/slider/index.js.map +1 -0
  117. package/dist/components/split-button/index.d.ts +77 -0
  118. package/dist/components/split-button/index.js +354 -0
  119. package/dist/components/split-button/index.js.map +1 -0
  120. package/dist/components/tabs/index.d.ts +196 -0
  121. package/dist/components/tabs/index.js +1137 -0
  122. package/dist/components/tabs/index.js.map +1 -0
  123. package/dist/components/time-field/index.d.ts +43 -0
  124. package/dist/components/time-field/index.js +107 -0
  125. package/dist/components/time-field/index.js.map +1 -0
  126. package/dist/components/time-picker/index.d.ts +65 -0
  127. package/dist/components/time-picker/index.js +1168 -0
  128. package/dist/components/time-picker/index.js.map +1 -0
  129. package/dist/components/tooltip/index.d.ts +101 -0
  130. package/dist/components/tooltip/index.js +223 -0
  131. package/dist/components/tooltip/index.js.map +1 -0
  132. package/dist/components/tree/index.d.ts +112 -0
  133. package/dist/components/tree/index.js +157 -0
  134. package/dist/components/tree/index.js.map +1 -0
  135. package/dist/disclosure/chevron.js +75 -0
  136. package/dist/disclosure/chevron.js.map +1 -0
  137. package/dist/disclosure/index.js +7 -0
  138. package/dist/disclosure/index.js.map +1 -0
  139. package/dist/drop/index.d.ts +54 -0
  140. package/dist/drop/index.js +161 -0
  141. package/dist/drop/index.js.map +1 -0
  142. package/dist/field/chevron.js +74 -0
  143. package/dist/field/chevron.js.map +1 -0
  144. package/dist/field/index.d.ts +2 -1
  145. package/dist/field/index.js +310 -154
  146. package/dist/field/index.js.map +1 -1
  147. package/dist/field/styles.js +9 -0
  148. package/dist/field/styles.js.map +1 -1
  149. package/dist/files/index.d.ts +18 -0
  150. package/dist/files/index.js +107 -0
  151. package/dist/files/index.js.map +1 -0
  152. package/dist/form/index.d.ts +5 -2
  153. package/dist/form/index.js +64 -85
  154. package/dist/form/index.js.map +1 -1
  155. package/dist/glyphs/index.js +92 -1
  156. package/dist/glyphs/index.js.map +1 -1
  157. package/dist/i18n/index.js +20 -1
  158. package/dist/i18n/index.js.map +1 -1
  159. package/dist/i18n/messages.js +1394 -34
  160. package/dist/i18n/messages.js.map +1 -1
  161. package/dist/index.d.ts +35 -3
  162. package/dist/index.js +34 -3
  163. package/dist/indicator/paths.js +23 -1
  164. package/dist/indicator/paths.js.map +1 -1
  165. package/dist/modal/index.js +92 -77
  166. package/dist/modal/index.js.map +1 -1
  167. package/dist/number/keyboard.js +16 -0
  168. package/dist/number/keyboard.js.map +1 -0
  169. package/dist/overlay/anchored.js +68 -38
  170. package/dist/overlay/anchored.js.map +1 -1
  171. package/dist/overlay/keyboard.js +57 -0
  172. package/dist/overlay/keyboard.js.map +1 -0
  173. package/dist/overlay/panel.js +173 -19
  174. package/dist/overlay/panel.js.map +1 -1
  175. package/dist/overlay/placement.js +13 -1
  176. package/dist/overlay/placement.js.map +1 -1
  177. package/dist/picker/index.js +322 -0
  178. package/dist/picker/index.js.map +1 -0
  179. package/dist/press/index.d.ts +2 -0
  180. package/dist/press/index.js +102 -100
  181. package/dist/press/index.js.map +1 -1
  182. package/dist/row/index.js +77 -69
  183. package/dist/row/index.js.map +1 -1
  184. package/dist/row/styles.js +13 -2
  185. package/dist/row/styles.js.map +1 -1
  186. package/dist/segments/field.js +277 -0
  187. package/dist/segments/field.js.map +1 -0
  188. package/dist/segments/index.js +574 -0
  189. package/dist/segments/index.js.map +1 -0
  190. package/dist/segments/styles.js +24 -0
  191. package/dist/segments/styles.js.map +1 -0
  192. package/dist/slider/index.js +145 -0
  193. package/dist/slider/index.js.map +1 -0
  194. package/dist/swatch/index.js +56 -0
  195. package/dist/swatch/index.js.map +1 -0
  196. package/package.json +11 -2
@@ -1,70 +1,14 @@
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 { toggleState } from "../../button/index.js";
11
- import { ProgressIndicator } from "../progress-indicator/index.js";
12
- import { CheckboxBox } from "../../control/checkbox-box.js";
1
+ import { Collection, loaderNode, rowNode, sectionNode } from "../../collection/index.js";
13
2
  import { c } from "react/compiler-runtime";
14
- import { AccessibilityInfo, FlatList, Platform, Pressable, StyleSheet, Text, View } from "react-native";
15
- import { Children, createContext, use, useEffect, useRef } from "react";
16
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
17
- import { useListState } from "react-stately/useListState";
3
+ import { jsx } from "react/jsx-runtime";
18
4
  //#region src/components/list/index.tsx
19
- const BOX_SLOT = 24;
20
- const LOADING_DIAMETER = "24px";
21
- const LOAD_OFFSET = 1;
22
- const IDLE = {};
23
- const styles = StyleSheet.create({
24
- box: {
25
- alignItems: "center",
26
- height: BOX_SLOT,
27
- justifyContent: "center",
28
- width: BOX_SLOT
29
- },
30
- idle: { height: 0 },
31
- status: {
32
- height: 1,
33
- overflow: "hidden",
34
- pointerEvents: "none",
35
- position: "absolute",
36
- width: 1
37
- }
38
- });
39
- const stylesOf = themedStyles(({ colors, sizing, spacing }) => StyleSheet.create({
40
- content: { paddingVertical: spacing.sm },
41
- empty: { color: colors.onSurfaceVariant },
42
- header: {
43
- color: colors.onSurfaceVariant,
44
- paddingBottom: spacing.xxs,
45
- paddingHorizontal: spacing.lg,
46
- paddingTop: spacing.lg
47
- },
48
- lead: {
49
- alignItems: "center",
50
- flexDirection: "row",
51
- gap: spacing.lg
52
- },
53
- list: { backgroundColor: colors.surface },
54
- loading: {
55
- alignItems: "center",
56
- justifyContent: "center",
57
- minHeight: sizing.rowSm
58
- },
59
- status: { color: colors.onSurface }
60
- }));
61
- const ListContext = createContext(null);
62
5
  /**
63
6
  * A list of rows, one or more of which can be selected. Selection is React
64
7
  * Stately's, as web's is React Aria's: set `selectionMode` to `single` or
65
8
  * `multiple`, and pass `selectedKeys` with `onSelectionChange` to control
66
- * it or `defaultSelectedKeys` to let it keep its own. A list whose rows do
67
- * something takes `onAction`, or an `onAction` on each row.
9
+ * it or `defaultSelectedKeys` to let it keep its own. A list that selects
10
+ * draws a checkbox on every row. A list whose rows do something takes
11
+ * `onAction`, or an `onAction` on each row.
68
12
  *
69
13
  * ```tsx
70
14
  * <List aria-label="Label" selectionMode="multiple">
@@ -78,210 +22,26 @@ const ListContext = createContext(null);
78
22
  * list draws from their props, so none of them renders anything on its
79
23
  * own. Name the list with `aria-label`. It scrolls by itself, so it wants a
80
24
  * height to fill: a short list on a page that scrolls takes
81
- * `scrollEnabled={false}` and is laid out at its full length. `style` and
82
- * `ref` land on the `FlatList`.
25
+ * `scrollEnabled={false}` and is laid out at its full length. It is drawn
26
+ * on surface, and a section's header stays at the top while its rows scroll
27
+ * under it. `style` and `ref` land on the `FlatList`.
83
28
  *
84
29
  * Inside an `Autocomplete`, the list shows the rows the search keeps and
85
30
  * says how many there are to a screen reader, and a tap on a row reaches it
86
31
  * while the keyboard is up.
87
32
  */
88
- function List(t0) {
89
- const $ = c(64);
90
- let children;
91
- let contentContainerStyle;
92
- let defaultSelectedKeys;
93
- let disabledKeys;
94
- let disallowEmptySelection;
95
- let items;
96
- let keyboardShouldPersistTaps;
97
- let onAction;
98
- let onSelectionChange;
99
- let props;
100
- let ref;
101
- let selectLabel;
102
- let selectedKeys;
103
- let style;
104
- let t1;
105
- let t2;
106
- if ($[0] !== t0) {
107
- ({children, contentContainerStyle, defaultSelectedKeys, disabledKeys, disallowEmptySelection, items, keyboardShouldPersistTaps, onAction, onSelectionChange, ref, renderEmptyState: t1, selectedKeys, selectionMode: t2, selectLabel, style, ...props} = t0);
108
- $[0] = t0;
109
- $[1] = children;
110
- $[2] = contentContainerStyle;
111
- $[3] = defaultSelectedKeys;
112
- $[4] = disabledKeys;
113
- $[5] = disallowEmptySelection;
114
- $[6] = items;
115
- $[7] = keyboardShouldPersistTaps;
116
- $[8] = onAction;
117
- $[9] = onSelectionChange;
118
- $[10] = props;
119
- $[11] = ref;
120
- $[12] = selectLabel;
121
- $[13] = selectedKeys;
122
- $[14] = style;
123
- $[15] = t1;
124
- $[16] = t2;
125
- } else {
126
- children = $[1];
127
- contentContainerStyle = $[2];
128
- defaultSelectedKeys = $[3];
129
- disabledKeys = $[4];
130
- disallowEmptySelection = $[5];
131
- items = $[6];
132
- keyboardShouldPersistTaps = $[7];
133
- onAction = $[8];
134
- onSelectionChange = $[9];
135
- props = $[10];
136
- ref = $[11];
137
- selectLabel = $[12];
138
- selectedKeys = $[13];
139
- style = $[14];
140
- t1 = $[15];
141
- t2 = $[16];
142
- }
143
- const renderEmptyState = t1 === void 0 ? emptyState : t1;
144
- const selectionMode = t2 === void 0 ? "none" : t2;
145
- const theme = useTheme();
146
- const own = stylesOf(theme);
147
- const autocomplete = use(AutocompleteContext);
148
- const matches = autocomplete?.matches;
149
- let t3;
150
- if ($[17] !== matches) {
151
- t3 = matches === void 0 ? void 0 : filterOf(matches);
152
- $[17] = matches;
153
- $[18] = t3;
154
- } else t3 = $[18];
155
- const filter = t3;
156
- const t4 = children;
157
- let t5;
158
- if ($[19] !== defaultSelectedKeys || $[20] !== disabledKeys || $[21] !== disallowEmptySelection || $[22] !== filter || $[23] !== items || $[24] !== onSelectionChange || $[25] !== selectedKeys || $[26] !== selectionMode || $[27] !== t4) {
159
- t5 = {
160
- children: t4,
161
- defaultSelectedKeys,
162
- disabledKeys,
163
- disallowEmptySelection,
164
- filter,
165
- items,
166
- onSelectionChange,
167
- selectedKeys,
168
- selectionMode
169
- };
170
- $[19] = defaultSelectedKeys;
171
- $[20] = disabledKeys;
172
- $[21] = disallowEmptySelection;
173
- $[22] = filter;
174
- $[23] = items;
175
- $[24] = onSelectionChange;
176
- $[25] = selectedKeys;
177
- $[26] = selectionMode;
178
- $[27] = t4;
179
- $[28] = t5;
180
- } else t5 = $[28];
181
- const state = useListState(t5);
182
- let t6;
183
- if ($[29] !== state) {
184
- t6 = entriesOf(state);
185
- $[29] = state;
186
- $[30] = t6;
187
- } else t6 = $[30];
188
- const { entries, loader, rows, sticky } = t6;
189
- const listStyle = composeStyles(own.list, style);
190
- const loadMore = loader?.props;
191
- const isLoading = loadMore?.isLoading ?? false;
192
- const messages = useMessages();
193
- let t7;
194
- if ($[31] !== style || $[32] !== theme) {
195
- t7 = StyleSheet.flatten(style)?.backgroundColor ?? theme.colors.surface;
196
- $[31] = style;
197
- $[32] = theme;
198
- $[33] = t7;
199
- } else t7 = $[33];
200
- const ground = t7;
201
- const t8 = selectLabel ?? messages.select;
202
- let t9;
203
- if ($[34] !== ground || $[35] !== loadMore || $[36] !== onAction || $[37] !== renderEmptyState || $[38] !== state || $[39] !== t8) {
204
- t9 = {
205
- ground,
206
- loadMore,
207
- onAction,
208
- renderEmptyState,
209
- selectLabel: t8,
210
- state
211
- };
212
- $[34] = ground;
213
- $[35] = loadMore;
214
- $[36] = onAction;
215
- $[37] = renderEmptyState;
216
- $[38] = state;
217
- $[39] = t8;
218
- $[40] = t9;
219
- } else t9 = $[40];
220
- const value = t9;
221
- const T0 = ListContext;
222
- const T1 = FlatList;
223
- const t10 = composeStyles(own.content, contentContainerStyle);
224
- const t11 = keyboardShouldPersistTaps ?? (autocomplete === null ? void 0 : "handled");
225
- const t12 = isLoading ? void 0 : EmptyState;
226
- const t13 = loadMore === void 0 ? void 0 : LoaderRow;
227
- let t14;
228
- if ($[41] !== loadMore) {
229
- t14 = loadMore === void 0 ? void 0 : loadMoreOf(loadMore);
230
- $[41] = loadMore;
231
- $[42] = t14;
232
- } else t14 = $[42];
233
- const t15 = loadMore?.scrollOffset ?? LOAD_OFFSET;
234
- let t16;
235
- if ($[43] !== T1 || $[44] !== entries || $[45] !== listStyle || $[46] !== props || $[47] !== ref || $[48] !== sticky || $[49] !== t10 || $[50] !== t11 || $[51] !== t12 || $[52] !== t13 || $[53] !== t14 || $[54] !== t15) {
236
- t16 = /* @__PURE__ */ jsx(T1, {
33
+ function List(props) {
34
+ const $ = c(2);
35
+ let t0;
36
+ if ($[0] !== props) {
37
+ t0 = /* @__PURE__ */ jsx(Collection, {
237
38
  ...props,
238
- contentContainerStyle: t10,
239
- data: entries,
240
- keyboardShouldPersistTaps: t11,
241
- keyExtractor: keyOf,
242
- ListEmptyComponent: t12,
243
- ListFooterComponent: t13,
244
- onEndReached: t14,
245
- onEndReachedThreshold: t15,
246
- ref,
247
- renderItem: renderEntry,
248
- stickyHeaderIndices: sticky,
249
- style: listStyle
250
- });
251
- $[43] = T1;
252
- $[44] = entries;
253
- $[45] = listStyle;
254
- $[46] = props;
255
- $[47] = ref;
256
- $[48] = sticky;
257
- $[49] = t10;
258
- $[50] = t11;
259
- $[51] = t12;
260
- $[52] = t13;
261
- $[53] = t14;
262
- $[54] = t15;
263
- $[55] = t16;
264
- } else t16 = $[55];
265
- let t17;
266
- if ($[56] !== autocomplete || $[57] !== rows) {
267
- t17 = autocomplete === null ? null : /* @__PURE__ */ jsx(ResultsStatus, { count: rows });
268
- $[56] = autocomplete;
269
- $[57] = rows;
270
- $[58] = t17;
271
- } else t17 = $[58];
272
- let t18;
273
- if ($[59] !== T0 || $[60] !== t16 || $[61] !== t17 || $[62] !== value) {
274
- t18 = /* @__PURE__ */ jsxs(T0, {
275
- value,
276
- children: [t16, t17]
39
+ kind: "list"
277
40
  });
278
- $[59] = T0;
279
- $[60] = t16;
280
- $[61] = t17;
281
- $[62] = value;
282
- $[63] = t18;
283
- } else t18 = $[63];
284
- return t18;
41
+ $[0] = props;
42
+ $[1] = t0;
43
+ } else t0 = $[1];
44
+ return t0;
285
45
  }
286
46
  /**
287
47
  * The row shown while more items are being fetched. `onLoadMore` is called
@@ -292,14 +52,7 @@ function List(t0) {
292
52
  function ListLoadMore(_props) {
293
53
  return null;
294
54
  }
295
- ListLoadMore.getCollectionNode = function* getCollectionNode(props) {
296
- yield {
297
- hasChildNodes: false,
298
- props,
299
- rendered: null,
300
- type: "loader"
301
- };
302
- };
55
+ ListLoadMore.getCollectionNode = loaderNode;
303
56
  /**
304
57
  * One row. Its slots are ListItem's: `leading`, the headline as children,
305
58
  * `overline` above it, `supporting` under it, and `trailing`. Give every
@@ -312,17 +65,7 @@ ListLoadMore.getCollectionNode = function* getCollectionNode(props) {
312
65
  function ListRow(_props) {
313
66
  return null;
314
67
  }
315
- ListRow.getCollectionNode = function* getCollectionNode(props) {
316
- yield {
317
- "aria-label": props["aria-label"],
318
- hasChildNodes: false,
319
- key: props.id,
320
- props,
321
- rendered: props.children,
322
- textValue: props.textValue ?? (typeof props.children === "string" ? props.children : ""),
323
- type: "item"
324
- };
325
- };
68
+ ListRow.getCollectionNode = rowNode;
326
69
  /**
327
70
  * A group of rows under a heading, which stays at the top of the list while
328
71
  * the group's rows scroll under it.
@@ -330,776 +73,7 @@ ListRow.getCollectionNode = function* getCollectionNode(props) {
330
73
  function ListSection(_props) {
331
74
  return null;
332
75
  }
333
- ListSection.getCollectionNode = function* getCollectionNode(props) {
334
- const children = [];
335
- Children.forEach(props.children, (child) => {
336
- if (child !== null && child !== void 0 && child !== false) children.push(child);
337
- });
338
- yield {
339
- *childNodes() {
340
- for (const element of children) yield { element };
341
- },
342
- hasChildNodes: true,
343
- key: props.id,
344
- props,
345
- rendered: props.header,
346
- type: "section"
347
- };
348
- };
349
- /**
350
- * The muted row a list shows when nothing is in it: a row's box and
351
- * headline in on surface variant, with no press of its own.
352
- */
353
- function EmptyRow() {
354
- const $ = c(10);
355
- const theme = useTheme();
356
- const own = stylesOf(theme);
357
- const headline = useTypeRole("bodyLarge");
358
- const messages = useMessages();
359
- const T0 = View;
360
- let t0;
361
- if ($[0] !== theme) {
362
- t0 = rowStyleOf(theme, {});
363
- $[0] = theme;
364
- $[1] = t0;
365
- } else t0 = $[1];
366
- const T1 = Text;
367
- const t1 = composeStyles(headline, own.empty);
368
- let t2;
369
- if ($[2] !== T1 || $[3] !== messages.noResults || $[4] !== t1) {
370
- t2 = /* @__PURE__ */ jsx(T1, {
371
- style: t1,
372
- children: messages.noResults
373
- });
374
- $[2] = T1;
375
- $[3] = messages.noResults;
376
- $[4] = t1;
377
- $[5] = t2;
378
- } else t2 = $[5];
379
- let t3;
380
- if ($[6] !== T0 || $[7] !== t0 || $[8] !== t2) {
381
- t3 = /* @__PURE__ */ jsx(T0, {
382
- style: t0,
383
- children: t2
384
- });
385
- $[6] = T0;
386
- $[7] = t0;
387
- $[8] = t2;
388
- $[9] = t3;
389
- } else t3 = $[9];
390
- return t3;
391
- }
392
- function emptyState() {
393
- return /* @__PURE__ */ jsx(EmptyRow, {});
394
- }
395
- function EmptyState() {
396
- const $ = c(4);
397
- const t0 = useList();
398
- let t1;
399
- if ($[0] !== t0) {
400
- t1 = t0.renderEmptyState();
401
- $[0] = t0;
402
- $[1] = t1;
403
- } else t1 = $[1];
404
- let t2;
405
- if ($[2] !== t1) {
406
- t2 = /* @__PURE__ */ jsx(Fragment$1, { children: t1 });
407
- $[2] = t1;
408
- $[3] = t2;
409
- } else t2 = $[3];
410
- return t2;
411
- }
412
- /**
413
- * The cells the `FlatList` draws, in order, where the headers among them
414
- * are, and how many rows there are: the rows outside any section, and each
415
- * section's header followed by its rows. The row that loads more is drawn
416
- * after them all.
417
- */
418
- function entriesOf(state) {
419
- const entries = [];
420
- const sticky = [];
421
- let loader;
422
- let rows = 0;
423
- for (const node of state.collection) if (node.type === "loader") loader = node;
424
- else if (node.type === "section") {
425
- if (hasContent(node.rendered)) {
426
- sticky.push(entries.length);
427
- entries.push({
428
- kind: "header",
429
- node
430
- });
431
- }
432
- const children = state.collection.getChildren?.(node.key) ?? node.childNodes;
433
- for (const row of children) {
434
- entries.push({
435
- kind: "item",
436
- node: row
437
- });
438
- rows++;
439
- }
440
- } else {
441
- entries.push({
442
- kind: "item",
443
- node
444
- });
445
- rows++;
446
- }
447
- return {
448
- entries,
449
- loader,
450
- rows,
451
- sticky
452
- };
453
- }
454
- /**
455
- * What a list inside an Autocomplete builds its collection from: the rows
456
- * the search keeps, each section with a row left in it, and the row that
457
- * loads more. Each node is copied rather than handed on, as React Stately's
458
- * ComboBox copies its own, since a collection numbers the nodes it holds.
459
- */
460
- function filterOf(matches) {
461
- return (nodes) => keptOf(nodes, matches);
462
- }
463
- function keptOf(nodes, matches) {
464
- const kept = [];
465
- for (const node of nodes) if (node.type === "section") {
466
- const rows = keptOf(node.childNodes, matches);
467
- if (rows.some((row) => row.type === "item")) kept.push({
468
- ...node,
469
- childNodes: rows
470
- });
471
- } else if (node.type !== "item" || matches(node.textValue, node)) kept.push({ ...node });
472
- return kept;
473
- }
474
- function keyOf({ kind, node }) {
475
- return `${kind}:${String(node.key)}`;
476
- }
477
- /**
478
- * A row: the state layer, the ripple and the focus ring over the checkbox,
479
- * the leading slot, the lines and the trailing slot, on primary container
480
- * while selected. A row with nothing to do on a press, in a list that
481
- * neither selects nor acts, is a `View` that only presents.
482
- */
483
- function ListRowNode(t0) {
484
- const $ = c(117);
485
- const { node } = t0;
486
- const theme = useTheme();
487
- const own = stylesOf(theme);
488
- const list = useList();
489
- let children;
490
- let leading;
491
- let onAction;
492
- let onBlur;
493
- let onFocus;
494
- let onHoverIn;
495
- let onHoverOut;
496
- let onLongPress;
497
- let onPress;
498
- let onPressIn;
499
- let onPressOut;
500
- let overline;
501
- let props;
502
- let ref;
503
- let style;
504
- let supporting;
505
- let trailing;
506
- if ($[0] !== node.props) {
507
- const { children: t1, id: _id, isDisabled: _isDisabled, 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;
508
- children = t1;
509
- leading = t2;
510
- onAction = t3;
511
- onBlur = t4;
512
- onFocus = t5;
513
- onHoverIn = t6;
514
- onHoverOut = t7;
515
- onLongPress = t8;
516
- onPress = t9;
517
- onPressIn = t10;
518
- onPressOut = t11;
519
- overline = t12;
520
- ref = t13;
521
- style = t14;
522
- supporting = t15;
523
- trailing = t16;
524
- props = t17;
525
- $[0] = node.props;
526
- $[1] = children;
527
- $[2] = leading;
528
- $[3] = onAction;
529
- $[4] = onBlur;
530
- $[5] = onFocus;
531
- $[6] = onHoverIn;
532
- $[7] = onHoverOut;
533
- $[8] = onLongPress;
534
- $[9] = onPress;
535
- $[10] = onPressIn;
536
- $[11] = onPressOut;
537
- $[12] = overline;
538
- $[13] = props;
539
- $[14] = ref;
540
- $[15] = style;
541
- $[16] = supporting;
542
- $[17] = trailing;
543
- } else {
544
- children = $[1];
545
- leading = $[2];
546
- onAction = $[3];
547
- onBlur = $[4];
548
- onFocus = $[5];
549
- onHoverIn = $[6];
550
- onHoverOut = $[7];
551
- onLongPress = $[8];
552
- onPress = $[9];
553
- onPressIn = $[10];
554
- onPressOut = $[11];
555
- overline = $[12];
556
- props = $[13];
557
- ref = $[14];
558
- style = $[15];
559
- supporting = $[16];
560
- trailing = $[17];
561
- }
562
- const { selectionManager } = list.state;
563
- const { key } = node;
564
- let action;
565
- let acts;
566
- let checks;
567
- let disabled;
568
- let select;
569
- let selectable;
570
- let selected;
571
- let t1;
572
- if ($[18] !== key || $[19] !== list.onAction || $[20] !== onAction || $[21] !== selectionManager || $[22] !== theme) {
573
- disabled = selectionManager.isDisabled(key);
574
- checks = selectionManager.selectionMode !== "none";
575
- let t2;
576
- if ($[31] !== key || $[32] !== selectionManager) {
577
- t2 = selectionManager.canSelectItem(key);
578
- $[31] = key;
579
- $[32] = selectionManager;
580
- $[33] = t2;
581
- } else t2 = $[33];
582
- selectable = t2;
583
- selected = checks && selectionManager.isSelected(key);
584
- const listAction = list.onAction;
585
- let t3;
586
- if ($[34] !== key || $[35] !== listAction || $[36] !== onAction) {
587
- t3 = onAction ?? (listAction === void 0 ? void 0 : () => {
588
- listAction(key);
589
- });
590
- $[34] = key;
591
- $[35] = listAction;
592
- $[36] = onAction;
593
- $[37] = t3;
594
- } else t3 = $[37];
595
- action = t3;
596
- acts = action !== void 0 && (!selectable || selectionManager.isEmpty);
597
- let t4;
598
- if ($[38] !== key || $[39] !== selectionManager) {
599
- t4 = () => {
600
- selectionManager.select(key);
601
- };
602
- $[38] = key;
603
- $[39] = selectionManager;
604
- $[40] = t4;
605
- } else t4 = $[40];
606
- select = t4;
607
- t1 = rowContentColor(theme, {
608
- isDisabled: disabled,
609
- isSelected: selected
610
- });
611
- $[18] = key;
612
- $[19] = list.onAction;
613
- $[20] = onAction;
614
- $[21] = selectionManager;
615
- $[22] = theme;
616
- $[23] = action;
617
- $[24] = acts;
618
- $[25] = checks;
619
- $[26] = disabled;
620
- $[27] = select;
621
- $[28] = selectable;
622
- $[29] = selected;
623
- $[30] = t1;
624
- } else {
625
- action = $[23];
626
- acts = $[24];
627
- checks = $[25];
628
- disabled = $[26];
629
- select = $[27];
630
- selectable = $[28];
631
- selected = $[29];
632
- t1 = $[30];
633
- }
634
- const content = t1;
635
- let t2;
636
- if ($[41] !== content || $[42] !== disabled || $[43] !== onBlur || $[44] !== onFocus || $[45] !== onHoverIn || $[46] !== onHoverOut || $[47] !== onPressIn || $[48] !== onPressOut) {
637
- t2 = {
638
- color: content,
639
- disabled,
640
- onBlur,
641
- onFocus,
642
- onHoverIn,
643
- onHoverOut,
644
- onPressIn,
645
- onPressOut
646
- };
647
- $[41] = content;
648
- $[42] = disabled;
649
- $[43] = onBlur;
650
- $[44] = onFocus;
651
- $[45] = onHoverIn;
652
- $[46] = onHoverOut;
653
- $[47] = onPressIn;
654
- $[48] = onPressOut;
655
- $[49] = t2;
656
- } else t2 = $[49];
657
- const feedback = usePressFeedback(t2);
658
- const lead = checks ? withBox(/* @__PURE__ */ jsx(SelectBox, {
659
- isDisabled: disabled,
660
- isSelected: selected,
661
- onPress: acts && selectable ? select : void 0
662
- }), leading, own.lead) : leading;
663
- let t3;
664
- if ($[50] !== children || $[51] !== disabled || $[52] !== lead || $[53] !== overline || $[54] !== selected || $[55] !== supporting || $[56] !== trailing) {
665
- t3 = /* @__PURE__ */ jsx(RowContent, {
666
- isDisabled: disabled,
667
- isSelected: selected,
668
- leading: lead,
669
- overline,
670
- supporting,
671
- trailing,
672
- children
673
- });
674
- $[50] = children;
675
- $[51] = disabled;
676
- $[52] = lead;
677
- $[53] = overline;
678
- $[54] = selected;
679
- $[55] = supporting;
680
- $[56] = trailing;
681
- $[57] = t3;
682
- } else t3 = $[57];
683
- const lines = t3;
684
- let T0;
685
- let t10;
686
- let t11;
687
- let t12;
688
- let t13;
689
- let t14;
690
- let t4;
691
- let t5;
692
- let t6;
693
- let t7;
694
- let t8;
695
- let t9;
696
- if ($[58] !== action || $[59] !== acts || $[60] !== checks || $[61] !== disabled || $[62] !== feedback || $[63] !== lines || $[64] !== list.selectLabel || $[65] !== onLongPress || $[66] !== onPress || $[67] !== overline || $[68] !== props || $[69] !== ref || $[70] !== select || $[71] !== selectable || $[72] !== selected || $[73] !== style || $[74] !== supporting || $[75] !== theme) {
697
- t14 = Symbol.for("react.early_return_sentinel");
698
- bb0: {
699
- const rowStyle = rowStyleOf(theme, {
700
- isSelected: selected,
701
- overline,
702
- supporting
703
- });
704
- if (!checks && action === void 0 && onPress === void 0) {
705
- t14 = /* @__PURE__ */ jsx(View, {
706
- "aria-disabled": disabled || void 0,
707
- ref,
708
- style: composeStyles(rowStyle, style),
709
- testID: props.testID,
710
- children: lines
711
- });
712
- break bb0;
713
- }
714
- T0 = Pressable;
715
- t4 = "button";
716
- t5 = props;
717
- if ($[88] !== checks || $[89] !== selected) {
718
- t6 = checks ? toggleState(selected) : void 0;
719
- $[88] = checks;
720
- $[89] = selected;
721
- $[90] = t6;
722
- } else t6 = $[90];
723
- if ($[91] !== list.selectLabel || $[92] !== select || $[93] !== selectable) {
724
- t7 = selectable ? {
725
- accessibilityActions: [{
726
- label: list.selectLabel,
727
- name: "select"
728
- }],
729
- onAccessibilityAction: selectionActionOf(select)
730
- } : void 0;
731
- $[91] = list.selectLabel;
732
- $[92] = select;
733
- $[93] = selectable;
734
- $[94] = t7;
735
- } else t7 = $[94];
736
- t8 = feedback.handlers;
737
- t9 = disabled;
738
- if ($[95] !== action || $[96] !== onLongPress || $[97] !== select || $[98] !== selectable) {
739
- t10 = action !== void 0 && selectable ? pressThen(onLongPress, select) : onLongPress;
740
- $[95] = action;
741
- $[96] = onLongPress;
742
- $[97] = select;
743
- $[98] = selectable;
744
- $[99] = t10;
745
- } else t10 = $[99];
746
- const t15 = acts ? action : selectable ? select : noop;
747
- if ($[100] !== onPress || $[101] !== t15) {
748
- t11 = pressThen(onPress, t15);
749
- $[100] = onPress;
750
- $[101] = t15;
751
- $[102] = t11;
752
- } else t11 = $[102];
753
- t12 = ref;
754
- t13 = composeStyles(rowStyle, feedback.ring, feedback.ring === void 0 ? void 0 : rowStyles.ring, style);
755
- }
756
- $[58] = action;
757
- $[59] = acts;
758
- $[60] = checks;
759
- $[61] = disabled;
760
- $[62] = feedback;
761
- $[63] = lines;
762
- $[64] = list.selectLabel;
763
- $[65] = onLongPress;
764
- $[66] = onPress;
765
- $[67] = overline;
766
- $[68] = props;
767
- $[69] = ref;
768
- $[70] = select;
769
- $[71] = selectable;
770
- $[72] = selected;
771
- $[73] = style;
772
- $[74] = supporting;
773
- $[75] = theme;
774
- $[76] = T0;
775
- $[77] = t10;
776
- $[78] = t11;
777
- $[79] = t12;
778
- $[80] = t13;
779
- $[81] = t14;
780
- $[82] = t4;
781
- $[83] = t5;
782
- $[84] = t6;
783
- $[85] = t7;
784
- $[86] = t8;
785
- $[87] = t9;
786
- } else {
787
- T0 = $[76];
788
- t10 = $[77];
789
- t11 = $[78];
790
- t12 = $[79];
791
- t13 = $[80];
792
- t14 = $[81];
793
- t4 = $[82];
794
- t5 = $[83];
795
- t6 = $[84];
796
- t7 = $[85];
797
- t8 = $[86];
798
- t9 = $[87];
799
- }
800
- if (t14 !== Symbol.for("react.early_return_sentinel")) return t14;
801
- let t15;
802
- if ($[103] !== T0 || $[104] !== feedback.layer || $[105] !== lines || $[106] !== t10 || $[107] !== t11 || $[108] !== t12 || $[109] !== t13 || $[110] !== t4 || $[111] !== t5 || $[112] !== t6 || $[113] !== t7 || $[114] !== t8 || $[115] !== t9) {
803
- t15 = /* @__PURE__ */ jsxs(T0, {
804
- role: t4,
805
- ...t5,
806
- ...t6,
807
- ...t7,
808
- ...t8,
809
- disabled: t9,
810
- onLongPress: t10,
811
- onPress: t11,
812
- ref: t12,
813
- style: t13,
814
- children: [feedback.layer, lines]
815
- });
816
- $[103] = T0;
817
- $[104] = feedback.layer;
818
- $[105] = lines;
819
- $[106] = t10;
820
- $[107] = t11;
821
- $[108] = t12;
822
- $[109] = t13;
823
- $[110] = t4;
824
- $[111] = t5;
825
- $[112] = t6;
826
- $[113] = t7;
827
- $[114] = t8;
828
- $[115] = t9;
829
- $[116] = t15;
830
- } else t15 = $[116];
831
- return t15;
832
- }
833
- /**
834
- * The row `List.LoadMore` draws: a live region, empty while idle and
835
- * holding the ring while loading. Android and React Native Web say what
836
- * arrives in it; iOS has no live regions, so the ring's name is said there
837
- * as it appears.
838
- */
839
- function LoaderRow() {
840
- const $ = c(8);
841
- const own = stylesOf(useTheme());
842
- const { isLoading: t0, label, style, testID } = useList().loadMore ?? IDLE;
843
- const isLoading = t0 === void 0 ? false : t0;
844
- const messages = useMessages();
845
- const name = label ?? messages.loadingMore;
846
- useLoadingAnnouncement(isLoading, name);
847
- const T0 = View;
848
- const t1 = "polite";
849
- const t2 = composeStyles(isLoading ? own.loading : styles.idle, style);
850
- let t3;
851
- if ($[0] !== isLoading || $[1] !== name) {
852
- t3 = isLoading ? /* @__PURE__ */ jsx(ProgressIndicator, {
853
- "aria-label": name,
854
- diameter: LOADING_DIAMETER,
855
- isIndeterminate: true,
856
- variant: "circular"
857
- }) : null;
858
- $[0] = isLoading;
859
- $[1] = name;
860
- $[2] = t3;
861
- } else t3 = $[2];
862
- let t4;
863
- if ($[3] !== T0 || $[4] !== t2 || $[5] !== t3 || $[6] !== testID) {
864
- t4 = /* @__PURE__ */ jsx(T0, {
865
- "aria-live": t1,
866
- style: t2,
867
- testID,
868
- children: t3
869
- });
870
- $[3] = T0;
871
- $[4] = t2;
872
- $[5] = t3;
873
- $[6] = testID;
874
- $[7] = t4;
875
- } else t4 = $[7];
876
- return t4;
877
- }
878
- function loadMoreOf({ isLoading = false, onLoadMore }) {
879
- return () => {
880
- if (!isLoading) onLoadMore?.();
881
- };
882
- }
883
- function noop() {}
884
- /**
885
- * The press handler of a row: the call site's own handler, then the row's.
886
- * Built by a call rather than written inline at the prop, which is what
887
- * react-perf's no-new-function-as-prop is after.
888
- */
889
- function pressThen(onPress, then) {
890
- return (event) => {
891
- onPress?.(event);
892
- then?.();
893
- };
894
- }
895
- function renderEntry({ item }) {
896
- return item.kind === "header" ? /* @__PURE__ */ jsx(SectionHeader, { node: item.node }) : /* @__PURE__ */ jsx(ListRowNode, { node: item.node });
897
- }
898
- /**
899
- * How many rows a search leaves, said to a screen reader as it changes and
900
- * never drawn: in a polite live region on Android and under React Native
901
- * Web, and through `AccessibilityInfo` on iOS, which has no live regions,
902
- * so nothing is drawn there at all.
903
- */
904
- function ResultsStatus(t0) {
905
- const $ = c(8);
906
- const { count } = t0;
907
- const t1 = useTheme();
908
- let t2;
909
- if ($[0] !== t1) {
910
- t2 = stylesOf(t1);
911
- $[0] = t1;
912
- $[1] = t2;
913
- } else t2 = $[1];
914
- const own = t2;
915
- const locale = useLocaleOf(void 0);
916
- let t3;
917
- if ($[2] !== count || $[3] !== locale) {
918
- t3 = resultsFor(count, locale);
919
- $[2] = count;
920
- $[3] = locale;
921
- $[4] = t3;
922
- } else t3 = $[4];
923
- const message = t3;
924
- useResultsAnnouncement(message);
925
- if (Platform.OS === "ios") return null;
926
- let t4;
927
- if ($[5] !== message || $[6] !== own.status) {
928
- t4 = /* @__PURE__ */ jsx(View, {
929
- "aria-live": "polite",
930
- style: styles.status,
931
- children: /* @__PURE__ */ jsx(Text, {
932
- style: own.status,
933
- children: message
934
- })
935
- });
936
- $[5] = message;
937
- $[6] = own.status;
938
- $[7] = t4;
939
- } else t4 = $[7];
940
- return t4;
941
- }
942
- /** A section's heading, on the list's ground so the rows pass under it. */
943
- function SectionHeader(t0) {
944
- const $ = c(10);
945
- const { node } = t0;
946
- const own = stylesOf(useTheme());
947
- const title = useTypeRole("titleSmall");
948
- const { ground } = useList();
949
- const T0 = View;
950
- let t1;
951
- if ($[0] !== ground) {
952
- t1 = composeStyles({ backgroundColor: ground });
953
- $[0] = ground;
954
- $[1] = t1;
955
- } else t1 = $[1];
956
- const T1 = Text;
957
- const t2 = "heading";
958
- const t3 = composeStyles(title, own.header);
959
- let t4;
960
- if ($[2] !== T1 || $[3] !== node.rendered || $[4] !== t3) {
961
- t4 = /* @__PURE__ */ jsx(T1, {
962
- role: t2,
963
- style: t3,
964
- children: node.rendered
965
- });
966
- $[2] = T1;
967
- $[3] = node.rendered;
968
- $[4] = t3;
969
- $[5] = t4;
970
- } else t4 = $[5];
971
- let t5;
972
- if ($[6] !== T0 || $[7] !== t1 || $[8] !== t4) {
973
- t5 = /* @__PURE__ */ jsx(T0, {
974
- style: t1,
975
- children: t4
976
- });
977
- $[6] = T0;
978
- $[7] = t1;
979
- $[8] = t4;
980
- $[9] = t5;
981
- } else t5 = $[9];
982
- return t5;
983
- }
984
- /**
985
- * The checkbox a selecting row draws, for the eye alone: the row is what a
986
- * screen reader hears and presses. On a row whose press runs an action, a
987
- * touch on the box selects instead, through a press of its own the size of
988
- * a 48dp target, hidden from the reader as the box is.
989
- */
990
- function SelectBox(t0) {
991
- const $ = c(10);
992
- const { isDisabled, isSelected, onPress } = t0;
993
- let t1;
994
- if ($[0] !== isDisabled || $[1] !== isSelected) {
995
- t1 = /* @__PURE__ */ jsx(CheckboxBox, {
996
- isDisabled,
997
- isSelected,
998
- within: BOX_SLOT
999
- });
1000
- $[0] = isDisabled;
1001
- $[1] = isSelected;
1002
- $[2] = t1;
1003
- } else t1 = $[2];
1004
- const drawn = t1;
1005
- if (onPress === void 0) {
1006
- let t2;
1007
- if ($[3] !== drawn) {
1008
- t2 = /* @__PURE__ */ jsx(View, {
1009
- style: styles.box,
1010
- children: drawn
1011
- });
1012
- $[3] = drawn;
1013
- $[4] = t2;
1014
- } else t2 = $[4];
1015
- return t2;
1016
- }
1017
- let t2;
1018
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1019
- t2 = hitSlop(BOX_SLOT, BOX_SLOT);
1020
- $[5] = t2;
1021
- } else t2 = $[5];
1022
- let t3;
1023
- if ($[6] !== drawn || $[7] !== isDisabled || $[8] !== onPress) {
1024
- t3 = /* @__PURE__ */ jsx(Pressable, {
1025
- accessible: false,
1026
- "aria-hidden": true,
1027
- disabled: isDisabled,
1028
- focusable: false,
1029
- hitSlop: t2,
1030
- onPress,
1031
- style: styles.box,
1032
- tabIndex: -1,
1033
- children: drawn
1034
- });
1035
- $[6] = drawn;
1036
- $[7] = isDisabled;
1037
- $[8] = onPress;
1038
- $[9] = t3;
1039
- } else t3 = $[9];
1040
- return t3;
1041
- }
1042
- function selectionActionOf(select) {
1043
- return (event) => {
1044
- if (event.nativeEvent.actionName === "select") select();
1045
- };
1046
- }
1047
- function useList() {
1048
- const list = use(ListContext);
1049
- if (list === null) throw new Error("A List part is drawn by the List it is in.");
1050
- return list;
1051
- }
1052
- function useLoadingAnnouncement(isLoading, label) {
1053
- const $ = c(4);
1054
- const was = useRef(isLoading);
1055
- let t0;
1056
- let t1;
1057
- if ($[0] !== isLoading || $[1] !== label) {
1058
- t0 = () => {
1059
- if (isLoading && !was.current && Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(label);
1060
- was.current = isLoading;
1061
- };
1062
- t1 = [isLoading, label];
1063
- $[0] = isLoading;
1064
- $[1] = label;
1065
- $[2] = t0;
1066
- $[3] = t1;
1067
- } else {
1068
- t0 = $[2];
1069
- t1 = $[3];
1070
- }
1071
- useEffect(t0, t1);
1072
- }
1073
- function useResultsAnnouncement(message) {
1074
- const $ = c(3);
1075
- const was = useRef(message);
1076
- let t0;
1077
- let t1;
1078
- if ($[0] !== message) {
1079
- t0 = () => {
1080
- if (message !== was.current && Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(message);
1081
- was.current = message;
1082
- };
1083
- t1 = [message];
1084
- $[0] = message;
1085
- $[1] = t0;
1086
- $[2] = t1;
1087
- } else {
1088
- t0 = $[1];
1089
- t1 = $[2];
1090
- }
1091
- useEffect(t0, t1);
1092
- }
1093
- /**
1094
- * The leading slot of a row that selects: the checkbox, then whatever the
1095
- * row was given, in a row of their own so the two sit side by side.
1096
- */
1097
- function withBox(box, leading, style) {
1098
- return hasContent(leading) ? /* @__PURE__ */ jsxs(View, {
1099
- style,
1100
- children: [box, leading]
1101
- }) : box;
1102
- }
76
+ ListSection.getCollectionNode = sectionNode;
1103
77
  List.Item = ListRow;
1104
78
  List.LoadMore = ListLoadMore;
1105
79
  List.Section = ListSection;