@kanso-labs/react-native-kanso-ui 0.4.0 → 0.6.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 (109) hide show
  1. package/README.md +4 -1
  2. package/dist/autocomplete/index.js +39 -0
  3. package/dist/autocomplete/index.js.map +1 -0
  4. package/dist/badge/index.js +74 -0
  5. package/dist/badge/index.js.map +1 -0
  6. package/dist/badge/styles.js +51 -0
  7. package/dist/badge/styles.js.map +1 -0
  8. package/dist/button/index.d.ts +2 -1
  9. package/dist/button/index.js +35 -2
  10. package/dist/button/index.js.map +1 -1
  11. package/dist/button/slots.d.ts +2 -1
  12. package/dist/button/slots.js.map +1 -1
  13. package/dist/chip/index.js +2 -2
  14. package/dist/components/app-bar/index.d.ts +111 -0
  15. package/dist/components/app-bar/index.js +341 -0
  16. package/dist/components/app-bar/index.js.map +1 -0
  17. package/dist/components/autocomplete/index.d.ts +49 -0
  18. package/dist/components/autocomplete/index.js +87 -0
  19. package/dist/components/autocomplete/index.js.map +1 -0
  20. package/dist/components/button/index.d.ts +1 -1
  21. package/dist/components/button/index.js +197 -151
  22. package/dist/components/button/index.js.map +1 -1
  23. package/dist/components/card/index.js +2 -2
  24. package/dist/components/checkbox/index.js +106 -193
  25. package/dist/components/checkbox/index.js.map +1 -1
  26. package/dist/components/chip/index.js +1 -1
  27. package/dist/components/chip-group/index.js +3 -3
  28. package/dist/components/dialog/index.js +4 -3
  29. package/dist/components/dialog/index.js.map +1 -1
  30. package/dist/components/icon-button/index.d.ts +1 -1
  31. package/dist/components/icon-button/index.js +206 -160
  32. package/dist/components/icon-button/index.js.map +1 -1
  33. package/dist/components/link/index.js +2 -2
  34. package/dist/components/list/index.d.ts +216 -0
  35. package/dist/components/list/index.js +1118 -0
  36. package/dist/components/list/index.js.map +1 -0
  37. package/dist/components/list-detail/index.d.ts +56 -0
  38. package/dist/components/list-detail/index.js +169 -0
  39. package/dist/components/list-detail/index.js.map +1 -0
  40. package/dist/components/list-item/index.d.ts +63 -0
  41. package/dist/components/list-item/index.js +275 -0
  42. package/dist/components/list-item/index.js.map +1 -0
  43. package/dist/components/menu/index.d.ts +309 -0
  44. package/dist/components/menu/index.js +1283 -0
  45. package/dist/components/menu/index.js.map +1 -0
  46. package/dist/components/navigation-bar/index.d.ts +170 -0
  47. package/dist/components/navigation-bar/index.js +494 -0
  48. package/dist/components/navigation-bar/index.js.map +1 -0
  49. package/dist/components/number-field/index.js +3 -3
  50. package/dist/components/popover/index.d.ts +140 -0
  51. package/dist/components/popover/index.js +704 -0
  52. package/dist/components/popover/index.js.map +1 -0
  53. package/dist/components/progress-indicator/index.js +3 -3
  54. package/dist/components/radio-group/index.js +2 -2
  55. package/dist/components/search-field/index.d.ts +11 -3
  56. package/dist/components/search-field/index.js +66 -60
  57. package/dist/components/search-field/index.js.map +1 -1
  58. package/dist/components/segmented-button/index.js +4 -4
  59. package/dist/components/sheet/index.js +5 -4
  60. package/dist/components/sheet/index.js.map +1 -1
  61. package/dist/components/snackbar/index.js +4 -4
  62. package/dist/components/switch/index.js +3 -3
  63. package/dist/control/checkbox-box.js +137 -0
  64. package/dist/control/checkbox-box.js.map +1 -0
  65. package/dist/field/index.d.ts +1 -1
  66. package/dist/field/index.js +3 -3
  67. package/dist/form/index.d.ts +1 -1
  68. package/dist/glyphs/index.js +22 -3
  69. package/dist/glyphs/index.js.map +1 -1
  70. package/dist/hooks/useAppBarScroll.d.ts +56 -0
  71. package/dist/hooks/useAppBarScroll.js +87 -0
  72. package/dist/hooks/useAppBarScroll.js.map +1 -0
  73. package/dist/i18n/index.js +16 -1
  74. package/dist/i18n/index.js.map +1 -1
  75. package/dist/i18n/messages.js +272 -34
  76. package/dist/i18n/messages.js.map +1 -1
  77. package/dist/index.d.ts +12 -3
  78. package/dist/index.js +12 -3
  79. package/dist/indicator/index.d.ts +2 -2
  80. package/dist/indicator/index.js +1 -1
  81. package/dist/indicator/motion.js +1 -1
  82. package/dist/mark/index.js +1 -1
  83. package/dist/modal/index.d.ts +1 -1
  84. package/dist/modal/index.js +2 -9
  85. package/dist/modal/index.js.map +1 -1
  86. package/dist/navigation/index.d.ts +29 -0
  87. package/dist/navigation/index.js +405 -0
  88. package/dist/navigation/index.js.map +1 -0
  89. package/dist/navigation/styles.js +61 -0
  90. package/dist/navigation/styles.js.map +1 -0
  91. package/dist/overlay/anchored.d.ts +2 -0
  92. package/dist/overlay/anchored.js +182 -0
  93. package/dist/overlay/anchored.js.map +1 -0
  94. package/dist/overlay/host.d.ts +2 -0
  95. package/dist/overlay/index.d.ts +4 -0
  96. package/dist/overlay/panel.js +215 -0
  97. package/dist/overlay/panel.js.map +1 -0
  98. package/dist/overlay/placement.d.ts +8 -0
  99. package/dist/overlay/placement.js +87 -0
  100. package/dist/overlay/placement.js.map +1 -0
  101. package/dist/press/index.js +74 -68
  102. package/dist/press/index.js.map +1 -1
  103. package/dist/ref/index.js +15 -0
  104. package/dist/ref/index.js.map +1 -0
  105. package/dist/row/index.js +158 -0
  106. package/dist/row/index.js.map +1 -0
  107. package/dist/row/styles.js +51 -0
  108. package/dist/row/styles.js.map +1 -0
  109. package/package.json +3 -3
@@ -0,0 +1,494 @@
1
+ import { useTheme } from "../../theme/scope.js";
2
+ import { composeStyles, themedStyles } from "../../theme/styles.js";
3
+ import { useLinkPress } from "../../router/index.js";
4
+ import { useWindowSizeClass } from "../../hooks/useWindowSizeClass.js";
5
+ import { NavigationContext, NavigationDestination, iconColorOf, labelColorOf } from "../../navigation/index.js";
6
+ import { c } from "react/compiler-runtime";
7
+ import { StyleSheet, View } from "react-native";
8
+ import { SafeAreaView } from "react-native-safe-area-context";
9
+ import { use, useState } from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ //#region src/components/navigation-bar/index.tsx
12
+ const MEASURING_ROOM = 1e4;
13
+ const ICON_SIZE = 24;
14
+ const NO_OPTIONS = {};
15
+ const DIGITS = /^\d+$/u;
16
+ const EDGES = [
17
+ "bottom",
18
+ "left",
19
+ "right"
20
+ ];
21
+ const styles = StyleSheet.create({
22
+ measurer: {
23
+ height: 0,
24
+ overflow: "hidden",
25
+ pointerEvents: "none",
26
+ position: "absolute",
27
+ start: 0,
28
+ top: 0,
29
+ width: 0
30
+ },
31
+ room: {
32
+ alignItems: "flex-start",
33
+ width: MEASURING_ROOM
34
+ },
35
+ vertical: { alignItems: "stretch" }
36
+ });
37
+ const stylesOf = themedStyles(({ colors, spacing }) => StyleSheet.create({
38
+ bar: { backgroundColor: colors.surfaceContainer },
39
+ horizontal: {
40
+ alignItems: "center",
41
+ gap: spacing.sm
42
+ },
43
+ measured: {
44
+ flexDirection: "row",
45
+ gap: spacing.sm
46
+ },
47
+ row: {
48
+ flexDirection: "row",
49
+ justifyContent: "center",
50
+ minHeight: 64
51
+ }
52
+ }));
53
+ /**
54
+ * What the bar tells the navigator and how it moves, from whichever of the
55
+ * two navigators drew it.
56
+ */
57
+ function actionsOf(emitter, navigateToTab, navigation) {
58
+ if (navigation !== void 0) return {
59
+ emit: (event) => navigation.emit(event),
60
+ go: (route) => {
61
+ navigation.navigate(route.name, route.params);
62
+ }
63
+ };
64
+ return {
65
+ emit: (event) => emitter?.emit(event),
66
+ go: (route) => {
67
+ navigateToTab?.(route.key);
68
+ }
69
+ };
70
+ }
71
+ /**
72
+ * The badge a tab's `tabBarBadge` draws: the count of a number or a string of
73
+ * digits, and the small dot for any other string.
74
+ */
75
+ function badgeOf(badge) {
76
+ if (typeof badge === "number") return badge;
77
+ if (badge === void 0 || badge === "") return;
78
+ return DIGITS.test(badge) ? Number(badge) : true;
79
+ }
80
+ /**
81
+ * Reports a long press on a tab. Built by a call rather than written inline
82
+ * at the prop, for the reason `widthThen` gives.
83
+ */
84
+ function longPressThen(actions, route) {
85
+ return () => {
86
+ actions.emit({
87
+ target: route.key,
88
+ type: "tabLongPress"
89
+ });
90
+ };
91
+ }
92
+ /**
93
+ * The bar of three to five top-level destinations a compact window keeps at
94
+ * its bottom edge. Each destination goes to its `href` through the app's
95
+ * router, see `RouterProvider`.
96
+ *
97
+ * ```tsx
98
+ * <NavigationBar selectedRoute="/first">
99
+ * <NavigationBar.Item href="/first" icon={<FirstIcon />}>
100
+ * First item
101
+ * </NavigationBar.Item>
102
+ * <NavigationBar.Item href="/second" icon={<SecondIcon />}>
103
+ * Second item
104
+ * </NavigationBar.Item>
105
+ * <NavigationBar.Item href="/third" icon={<ThirdIcon />}>
106
+ * Third item
107
+ * </NavigationBar.Item>
108
+ * </NavigationBar>
109
+ * ```
110
+ *
111
+ * Draw it below the screen's content, at the bottom of the window: it paints
112
+ * its surface to the bottom edge and keeps its destinations clear of the home
113
+ * indicator itself. From the medium window size class each destination puts
114
+ * its label beside its icon, where the bar is wide enough for every label.
115
+ *
116
+ * `style`, `ref` and `testID` land on the bar's own view, which is announced
117
+ * as a tab list.
118
+ */
119
+ function NavigationBar(t0) {
120
+ const $ = c(35);
121
+ let children;
122
+ let props;
123
+ let selectedRoute;
124
+ let style;
125
+ if ($[0] !== t0) {
126
+ ({children, selectedRoute, style, ...props} = t0);
127
+ $[0] = t0;
128
+ $[1] = children;
129
+ $[2] = props;
130
+ $[3] = selectedRoute;
131
+ $[4] = style;
132
+ } else {
133
+ children = $[1];
134
+ props = $[2];
135
+ selectedRoute = $[3];
136
+ style = $[4];
137
+ }
138
+ const theme = useTheme();
139
+ const own = stylesOf(theme);
140
+ const sizeClass = useWindowSizeClass();
141
+ const [room, setRoom] = useState(void 0);
142
+ const [needed, setNeeded] = useState(void 0);
143
+ const wide = sizeClass !== "compact";
144
+ const horizontal = wide && (room === void 0 || needed === void 0 || needed <= room);
145
+ const t1 = horizontal ? "horizontal" : "vertical";
146
+ let t2;
147
+ if ($[5] !== selectedRoute || $[6] !== t1) {
148
+ t2 = {
149
+ form: t1,
150
+ measuring: false,
151
+ selectedRoute
152
+ };
153
+ $[5] = selectedRoute;
154
+ $[6] = t1;
155
+ $[7] = t2;
156
+ } else t2 = $[7];
157
+ const context = t2;
158
+ let t3;
159
+ if ($[8] !== selectedRoute) {
160
+ t3 = {
161
+ form: "horizontal",
162
+ measuring: true,
163
+ selectedRoute
164
+ };
165
+ $[8] = selectedRoute;
166
+ $[9] = t3;
167
+ } else t3 = $[9];
168
+ const measuring = t3;
169
+ const T0 = View;
170
+ const t4 = "tablist";
171
+ const t5 = composeStyles(own.bar, style);
172
+ const T1 = SafeAreaView;
173
+ const t6 = EDGES;
174
+ const T2 = View;
175
+ let t7;
176
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
177
+ t7 = widthThen(setRoom);
178
+ $[10] = t7;
179
+ } else t7 = $[10];
180
+ const t8 = composeStyles(own.row, horizontal ? own.horizontal : styles.vertical);
181
+ let t9;
182
+ if ($[11] !== children || $[12] !== context) {
183
+ t9 = /* @__PURE__ */ jsx(NavigationContext, {
184
+ value: context,
185
+ children
186
+ });
187
+ $[11] = children;
188
+ $[12] = context;
189
+ $[13] = t9;
190
+ } else t9 = $[13];
191
+ let t10;
192
+ if ($[14] !== T2 || $[15] !== t7 || $[16] !== t8 || $[17] !== t9) {
193
+ t10 = /* @__PURE__ */ jsx(T2, {
194
+ onLayout: t7,
195
+ style: t8,
196
+ children: t9
197
+ });
198
+ $[14] = T2;
199
+ $[15] = t7;
200
+ $[16] = t8;
201
+ $[17] = t9;
202
+ $[18] = t10;
203
+ } else t10 = $[18];
204
+ let t11;
205
+ if ($[19] !== T1 || $[20] !== t10 || $[21] !== t6) {
206
+ t11 = /* @__PURE__ */ jsx(T1, {
207
+ edges: t6,
208
+ children: t10
209
+ });
210
+ $[19] = T1;
211
+ $[20] = t10;
212
+ $[21] = t6;
213
+ $[22] = t11;
214
+ } else t11 = $[22];
215
+ let t12;
216
+ if ($[23] !== children || $[24] !== measuring || $[25] !== own || $[26] !== setNeeded || $[27] !== wide) {
217
+ t12 = wide ? /* @__PURE__ */ jsx(View, {
218
+ "aria-hidden": true,
219
+ style: styles.measurer,
220
+ children: /* @__PURE__ */ jsx(View, {
221
+ style: styles.room,
222
+ children: /* @__PURE__ */ jsx(View, {
223
+ onLayout: widthThen(setNeeded),
224
+ style: own.measured,
225
+ children: /* @__PURE__ */ jsx(NavigationContext, {
226
+ value: measuring,
227
+ children
228
+ })
229
+ })
230
+ })
231
+ }) : null;
232
+ $[23] = children;
233
+ $[24] = measuring;
234
+ $[25] = own;
235
+ $[26] = setNeeded;
236
+ $[27] = wide;
237
+ $[28] = t12;
238
+ } else t12 = $[28];
239
+ let t13;
240
+ if ($[29] !== T0 || $[30] !== props || $[31] !== t11 || $[32] !== t12 || $[33] !== t5) {
241
+ t13 = /* @__PURE__ */ jsxs(T0, {
242
+ role: t4,
243
+ ...props,
244
+ style: t5,
245
+ children: [t11, t12]
246
+ });
247
+ $[29] = T0;
248
+ $[30] = props;
249
+ $[31] = t11;
250
+ $[32] = t12;
251
+ $[33] = t5;
252
+ $[34] = t13;
253
+ } else t13 = $[34];
254
+ return t13;
255
+ }
256
+ /**
257
+ * One destination of a navigation bar: an icon, a label and, while it is the
258
+ * current one, the active indicator behind the icon. Pressing it calls
259
+ * `onPress`, then goes to its `href`. Renders nothing of its own outside a
260
+ * `NavigationBar`, whose `selectedRoute` says whether it is selected.
261
+ *
262
+ * `style`, `ref` and `testID` land on the destination's `Pressable`.
263
+ */
264
+ function NavigationBarItem(t0) {
265
+ const $ = c(8);
266
+ let href;
267
+ let onPress;
268
+ let props;
269
+ if ($[0] !== t0) {
270
+ ({href, onPress, ...props} = t0);
271
+ $[0] = t0;
272
+ $[1] = href;
273
+ $[2] = onPress;
274
+ $[3] = props;
275
+ } else {
276
+ href = $[1];
277
+ onPress = $[2];
278
+ props = $[3];
279
+ }
280
+ const { selectedRoute } = use(NavigationContext);
281
+ const press = useLinkPress(href, onPress);
282
+ const t1 = selectedRoute !== void 0 && href === selectedRoute;
283
+ let t2;
284
+ if ($[4] !== press || $[5] !== props || $[6] !== t1) {
285
+ t2 = /* @__PURE__ */ jsx(NavigationDestination, {
286
+ ...props,
287
+ onPress: press,
288
+ selected: t1
289
+ });
290
+ $[4] = press;
291
+ $[5] = props;
292
+ $[6] = t1;
293
+ $[7] = t2;
294
+ } else t2 = $[7];
295
+ return t2;
296
+ }
297
+ /**
298
+ * A navigation bar drawing a tab navigator's routes, for the `tabBar` prop of
299
+ * React Navigation's bottom tabs and of Expo Router's `Tabs` alike.
300
+ *
301
+ * ```tsx
302
+ * <Tabs tabBar={(props) => <NavigationTabBar {...props} />}>
303
+ * <Tabs.Screen name="index" options={{ tabBarIcon: () => <FirstIcon />, title: 'First item' }} />
304
+ * </Tabs>
305
+ * ```
306
+ *
307
+ * Each route is a destination, labelled by its `tabBarLabel` or its title,
308
+ * with the icon `tabBarIcon` draws and the badge `tabBarBadge` asks for, and
309
+ * the focused route is the selected one. Pressing a destination reports
310
+ * `tabPress` to the navigator and moves to its route unless a listener
311
+ * prevents it, and a long press reports `tabLongPress`, as the navigators'
312
+ * own tab bars do.
313
+ *
314
+ * `style`, `ref` and `testID` land on the bar's own view, as on a
315
+ * `NavigationBar`.
316
+ */
317
+ function NavigationTabBar(t0) {
318
+ const $ = c(21);
319
+ let descriptors;
320
+ let emitter;
321
+ let navigateToTab;
322
+ let navigation;
323
+ let props;
324
+ let state;
325
+ if ($[0] !== t0) {
326
+ const { descriptors: t1, emitter: t2, insets: _insets, navigateToTab: t3, navigation: t4, state: t5, ...t6 } = t0;
327
+ descriptors = t1;
328
+ emitter = t2;
329
+ navigateToTab = t3;
330
+ navigation = t4;
331
+ state = t5;
332
+ props = t6;
333
+ $[0] = t0;
334
+ $[1] = descriptors;
335
+ $[2] = emitter;
336
+ $[3] = navigateToTab;
337
+ $[4] = navigation;
338
+ $[5] = props;
339
+ $[6] = state;
340
+ } else {
341
+ descriptors = $[1];
342
+ emitter = $[2];
343
+ navigateToTab = $[3];
344
+ navigation = $[4];
345
+ props = $[5];
346
+ state = $[6];
347
+ }
348
+ let T0;
349
+ let t1;
350
+ let t2;
351
+ if ($[7] !== descriptors || $[8] !== emitter || $[9] !== navigateToTab || $[10] !== navigation || $[11] !== props || $[12] !== state.index || $[13] !== state.routes) {
352
+ const actions = actionsOf(emitter, navigateToTab, navigation);
353
+ const focused = state.routes[state.index]?.key;
354
+ T0 = NavigationBar;
355
+ t1 = props;
356
+ t2 = state.routes.map((route) => /* @__PURE__ */ jsx(TabDestination, {
357
+ focused: route.key === focused,
358
+ onLongPress: longPressThen(actions, route),
359
+ onPress: pressThen(actions, route, route.key === focused),
360
+ options: descriptors[route.key]?.options ?? NO_OPTIONS,
361
+ route
362
+ }, route.key));
363
+ $[7] = descriptors;
364
+ $[8] = emitter;
365
+ $[9] = navigateToTab;
366
+ $[10] = navigation;
367
+ $[11] = props;
368
+ $[12] = state.index;
369
+ $[13] = state.routes;
370
+ $[14] = T0;
371
+ $[15] = t1;
372
+ $[16] = t2;
373
+ } else {
374
+ T0 = $[14];
375
+ t1 = $[15];
376
+ t2 = $[16];
377
+ }
378
+ let t3;
379
+ if ($[17] !== T0 || $[18] !== t1 || $[19] !== t2) {
380
+ t3 = /* @__PURE__ */ jsx(T0, {
381
+ ...t1,
382
+ children: t2
383
+ });
384
+ $[17] = T0;
385
+ $[18] = t1;
386
+ $[19] = t2;
387
+ $[20] = t3;
388
+ } else t3 = $[20];
389
+ return t3;
390
+ }
391
+ /**
392
+ * Moves to a tab once the navigator has heard the press, unless a listener
393
+ * prevented it or the tab is already focused. Built by a call rather than
394
+ * written inline at the prop, for the reason `widthThen` gives.
395
+ */
396
+ function pressThen(actions, route, focused) {
397
+ return () => {
398
+ const event = actions.emit({
399
+ canPreventDefault: true,
400
+ target: route.key,
401
+ type: "tabPress"
402
+ });
403
+ if (!focused && !prevented(event)) actions.go(route);
404
+ };
405
+ }
406
+ function prevented(event) {
407
+ return typeof event === "object" && event !== null && "defaultPrevented" in event && event.defaultPrevented === true;
408
+ }
409
+ /**
410
+ * One route's destination. Its colours are the destination's own for the
411
+ * form the bar draws, which is why it reads them inside the bar rather than
412
+ * the bar computing them for it.
413
+ */
414
+ function TabDestination(t0) {
415
+ const $ = c(21);
416
+ const { focused, onLongPress, onPress, options, route } = t0;
417
+ const theme = useTheme();
418
+ const { form } = use(NavigationContext);
419
+ const { tabBarLabel } = options;
420
+ const title = typeof tabBarLabel === "string" ? tabBarLabel : options.title ?? route.name;
421
+ const t1 = options.tabBarAccessibilityLabel ?? title;
422
+ let t2;
423
+ if ($[0] !== options.tabBarBadge) {
424
+ t2 = badgeOf(options.tabBarBadge);
425
+ $[0] = options.tabBarBadge;
426
+ $[1] = t2;
427
+ } else t2 = $[1];
428
+ let t3;
429
+ if ($[2] !== focused || $[3] !== options || $[4] !== theme) {
430
+ t3 = options.tabBarIcon?.({
431
+ color: iconColorOf(theme, false, focused),
432
+ focused,
433
+ size: ICON_SIZE
434
+ });
435
+ $[2] = focused;
436
+ $[3] = options;
437
+ $[4] = theme;
438
+ $[5] = t3;
439
+ } else t3 = $[5];
440
+ let t4;
441
+ if ($[6] !== focused || $[7] !== form || $[8] !== tabBarLabel || $[9] !== theme || $[10] !== title) {
442
+ t4 = typeof tabBarLabel === "function" ? tabBarLabel({
443
+ children: title,
444
+ color: labelColorOf(theme, form, false, focused),
445
+ focused,
446
+ position: form === "horizontal" ? "beside-icon" : "below-icon"
447
+ }) : title;
448
+ $[6] = focused;
449
+ $[7] = form;
450
+ $[8] = tabBarLabel;
451
+ $[9] = theme;
452
+ $[10] = title;
453
+ $[11] = t4;
454
+ } else t4 = $[11];
455
+ let t5;
456
+ if ($[12] !== focused || $[13] !== onLongPress || $[14] !== onPress || $[15] !== options.tabBarButtonTestID || $[16] !== t1 || $[17] !== t2 || $[18] !== t3 || $[19] !== t4) {
457
+ t5 = /* @__PURE__ */ jsx(NavigationDestination, {
458
+ "aria-label": t1,
459
+ badge: t2,
460
+ icon: t3,
461
+ onLongPress,
462
+ onPress,
463
+ selected: focused,
464
+ testID: options.tabBarButtonTestID,
465
+ children: t4
466
+ });
467
+ $[12] = focused;
468
+ $[13] = onLongPress;
469
+ $[14] = onPress;
470
+ $[15] = options.tabBarButtonTestID;
471
+ $[16] = t1;
472
+ $[17] = t2;
473
+ $[18] = t3;
474
+ $[19] = t4;
475
+ $[20] = t5;
476
+ } else t5 = $[20];
477
+ return t5;
478
+ }
479
+ /**
480
+ * Records a view's width, as React Native lays it out. Built by a call
481
+ * rather than written inline at the prop, which is what react-perf's
482
+ * jsx-no-new-function-as-prop is after; the React Compiler memoises the
483
+ * result on its inputs.
484
+ */
485
+ function widthThen(setWidth) {
486
+ return (event) => {
487
+ setWidth(event.nativeEvent.layout.width);
488
+ };
489
+ }
490
+ NavigationBar.Item = NavigationBarItem;
491
+ //#endregion
492
+ export { NavigationBar, NavigationBarItem, NavigationTabBar };
493
+
494
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","LayoutChangeEvent","StyleProp","ViewProps","ViewStyle","Edge","use","useMemo","useState","StyleSheet","View","SafeAreaView","NavigationDestinationProps","useWindowSizeClass","iconColorOf","labelColorOf","NavigationContext","NavigationDestination","useLinkPress","useTheme","composeStyles","themedStyles","NavigationBarItemProps","href","NavigationBarProps","Omit","children","ref","selectedRoute","style","NavigationTabBarProps","TabNavigatorProps","descriptors","Readonly","Partial","Record","options","TabOptions","insets","state","index","routes","TabRoute","TabActions","emit","event","TabEvent","go","route","TabEmitter","canPreventDefault","target","type","emitter","navigateToTab","routeKey","navigation","navigate","name","params","tabBarAccessibilityLabel","tabBarBadge","tabBarButtonTestID","tabBarIcon","props","color","focused","size","tabBarLabel","position","title","key","MEASURING_ROOM","ICON_SIZE","NO_OPTIONS","DIGITS","EDGES","styles","create","measurer","height","overflow","pointerEvents","start","top","width","room","alignItems","vertical","stylesOf","colors","spacing","bar","backgroundColor","surfaceContainer","horizontal","gap","sm","measured","flexDirection","row","justifyContent","minHeight","actionsOf","undefined","badgeOf","badge","test","Number","longPressThen","actions","NavigationBar","t0","$","_c","theme","own","sizeClass","setRoom","needed","setNeeded","wide","t1","const","t2","form","measuring","context","t3","T0","t4","t5","T1","T2","t7","Symbol","for","widthThen","t8","t9","t10","t11","t6","t12","t13","NavigationBarItem","onPress","press","NavigationTabBar","_insets","map","pressThen","prevented","defaultPrevented","TabDestination","onLongPress","setWidth","nativeEvent","layout","Item","_c"],"sources":["../../../src/components/navigation-bar/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type {\n LayoutChangeEvent,\n StyleProp,\n ViewProps,\n ViewStyle,\n} from 'react-native'\nimport type { Edge } from 'react-native-safe-area-context'\n\nimport { use, useMemo, useState } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { SafeAreaView } from 'react-native-safe-area-context'\n\nimport type { NavigationDestinationProps } from '../../navigation'\n\nimport { useWindowSizeClass } from '../../hooks/useWindowSizeClass'\nimport {\n iconColorOf,\n labelColorOf,\n NavigationContext,\n NavigationDestination,\n} from '../../navigation'\nimport { useLinkPress } from '../../router'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// kanso-ui's NavigationBar, the navigation bar page's flexible bar: three to\n// five destinations across the bottom of a compact window, on the surface\n// container, 64dp tall. In a compact window each destination is vertical and\n// the destinations share the bar's width equally; from the medium window\n// size class each is the page's horizontal pill, as wide as what it holds,\n// and the group sits centred with the spare width at the bar's ends, 8dp\n// between two pills. The destinations are src/navigation's, which holds the\n// two forms' values.\n//\n// The 8dp between two horizontal pills is the library's own, as on web. The\n// page puts each pill in an item of a fixed width it does not give, and with\n// no space at all the pills met edge to edge.\n//\n// **A bar too narrow for its horizontal form keeps the vertical one.** A\n// horizontal destination is as wide as its icon, its label and 16dp either\n// side, so five of them need far more than the 600dp the medium class starts\n// at, and drawn anyway every label would be cut short the moment the window\n// crossed into it. So from that class the bar draws its destinations a\n// second time, off screen in the horizontal form at their own widths, and\n// draws that form only while the bar is at least as wide as they are. Web\n// measures the labels it cuts short instead, which native has no way to ask.\n// The horizontal form is drawn until the first measurement arrives, so a bar\n// that fits never draws the other form for a frame.\n//\n// The bar paints its surface to the screen's bottom edge, under the home\n// indicator, and keeps its destinations inside the safe area: a\n// `SafeAreaView` pads it by the home indicator and a landscape notch\n// wherever the bar meets them, and by nothing where it does not.\n//\n// The bar is a `tablist` and each destination a `tab`, which is how both\n// platforms' own tab bars are announced. Web's is a landmark of links with\n// the current one marked as the page, which native has no counterpart for.\n// A destination still goes to its `href` through the app's router, see\n// `RouterProvider`. `NavigationTabBar` draws the bar for React Navigation's\n// bottom tabs and Expo Router's tabs instead.\n\ntype NavigationBarItemProps = NavigationDestinationProps & {\n /**\n * Where the destination goes, through the app's router, and what the\n * bar's `selectedRoute` is matched against.\n */\n readonly href: string\n}\n\ntype NavigationBarProps = Omit<ViewProps, 'children' | 'style'> & {\n /** The destinations, each a `NavigationBar.Item`. */\n readonly children?: ReactNode\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * The route of the current destination, matched against each\n * destination's `href`. The match is the selected tab, and draws the\n * active indicator.\n */\n readonly selectedRoute?: string | undefined\n readonly style?: StyleProp<ViewStyle>\n}\n\n/** The routes a tab navigator hands its tab bar, as both navigators do. */\ntype NavigationTabBarProps = Omit<\n NavigationBarProps,\n 'children' | 'selectedRoute'\n> &\n TabNavigatorProps & {\n /** Each route's options, by the route's key. */\n readonly descriptors: Readonly<\n Partial<Record<string, { readonly options: TabOptions }>>\n >\n /**\n * The insets the navigator measured, which the bar measures for itself\n * instead.\n */\n readonly insets?: unknown\n /** The navigator's routes, and which of them is focused. */\n readonly state: {\n readonly index: number\n readonly routes: readonly TabRoute[]\n }\n }\n\n/** What a tab bar's press tells the navigator, and how it moves to a tab. */\ntype TabActions = {\n readonly emit: (event: TabEvent) => unknown\n readonly go: (route: TabRoute) => void\n}\n\n/**\n * What hears a tab bar's events: React Navigation's `navigation` and Expo\n * Router's `emitter` alike.\n */\ntype TabEmitter = {\n emit(event: TabEvent): unknown\n}\n\n/** The events a tab bar reports, as both navigators name them. */\ntype TabEvent =\n | {\n readonly canPreventDefault: true\n readonly target: string\n readonly type: 'tabPress'\n }\n | { readonly target: string; readonly type: 'tabLongPress' }\n\n/**\n * How a tab bar moves to a tab: through React Navigation's `navigation`, or\n * through Expo Router's `navigateToTab`.\n */\ntype TabNavigatorProps =\n | {\n readonly emitter: TabEmitter\n readonly navigateToTab: (routeKey: string) => void\n readonly navigation?: never\n }\n | {\n readonly emitter?: never\n readonly navigateToTab?: never\n readonly navigation: TabEmitter & {\n navigate(name: string, params?: object): void\n }\n }\n\n/**\n * A tab's options the bar reads, as React Navigation's bottom tabs and Expo\n * Router's tabs both hand them to a tab bar. Options they take that are not\n * listed here are left to them.\n */\ntype TabOptions = {\n /** The tab's name for a screen reader, where it differs from its label. */\n readonly tabBarAccessibilityLabel?: string | undefined\n /**\n * The badge on the tab's icon. A number, or a string of digits, is the\n * large badge's count; any other string is the small dot, since a badge\n * draws a count and nothing else.\n */\n readonly tabBarBadge?: number | string | undefined\n readonly tabBarButtonTestID?: string | undefined\n /** The tab's icon, drawn at the size and in the colour it is handed. */\n readonly tabBarIcon?:\n | ((props: {\n readonly color: string\n readonly focused: boolean\n readonly size: number\n }) => ReactNode)\n | undefined\n /** The tab's label, in place of its title. */\n readonly tabBarLabel?:\n | ((props: {\n readonly children: string\n readonly color: string\n readonly focused: boolean\n readonly position: 'below-icon' | 'beside-icon'\n }) => ReactNode)\n | string\n | undefined\n readonly title?: string | undefined\n}\n\ntype TabRoute = {\n readonly key: string\n readonly name: string\n readonly params?: object | undefined\n}\n\n// Where the destinations are drawn off screen to be measured. Wider than any\n// bar, so each one is measured at its own width rather than squeezed.\nconst MEASURING_ROOM = 10_000\n\n// The size a tab's icon is drawn at, the page's.\nconst ICON_SIZE = 24\n\n// A route its navigator handed no options for.\nconst NO_OPTIONS: TabOptions = {}\n\n// A string of digits, which a badge draws as a count.\nconst DIGITS = /^\\d+$/u\n\n// The bar's sides as well as its bottom, so a landscape notch is cleared too.\n// The top is the screen's.\nconst EDGES: readonly Edge[] = ['bottom', 'left', 'right']\n\nconst styles = StyleSheet.create({\n // Holds the destinations measured off screen. It has no size and clips what\n // it holds, so they are laid out and never drawn, and take no touches.\n measurer: {\n height: 0,\n overflow: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n start: 0,\n top: 0,\n width: 0,\n },\n // The room the destinations are measured in, with the row of them at its\n // start, at the row's own width.\n room: {\n alignItems: 'flex-start',\n width: MEASURING_ROOM,\n },\n // The vertical form: each destination its share of the bar's height.\n vertical: {\n alignItems: 'stretch',\n },\n})\n\nconst stylesOf = themedStyles(({ colors, spacing }) =>\n StyleSheet.create({\n bar: {\n backgroundColor: colors.surfaceContainer,\n },\n // The horizontal form: the pills centred, 8dp apart.\n horizontal: {\n alignItems: 'center',\n gap: spacing.sm,\n },\n // The destinations, measured in the horizontal form.\n measured: {\n flexDirection: 'row',\n gap: spacing.sm,\n },\n // The page's 64dp, a minimum rather than a height, so a larger text size\n // the device asks for grows the bar rather than cutting the labels off.\n row: {\n flexDirection: 'row',\n justifyContent: 'center',\n minHeight: 64,\n },\n }),\n)\n\n/**\n * What the bar tells the navigator and how it moves, from whichever of the\n * two navigators drew it.\n */\nfunction actionsOf(\n emitter: TabEmitter | undefined,\n navigateToTab: ((routeKey: string) => void) | undefined,\n navigation: TabNavigatorProps['navigation'],\n): TabActions {\n if (navigation !== undefined) {\n return {\n emit: (event) => navigation.emit(event),\n go: (route) => {\n navigation.navigate(route.name, route.params)\n },\n }\n }\n return {\n emit: (event) => emitter?.emit(event),\n go: (route) => {\n navigateToTab?.(route.key)\n },\n }\n}\n\n/**\n * The badge a tab's `tabBarBadge` draws: the count of a number or a string of\n * digits, and the small dot for any other string.\n */\nfunction badgeOf(\n badge: number | string | undefined,\n): boolean | number | undefined {\n if (typeof badge === 'number') {\n return badge\n }\n if (badge === undefined || badge === '') {\n return undefined\n }\n return DIGITS.test(badge) ? Number(badge) : true\n}\n\n/**\n * Reports a long press on a tab. Built by a call rather than written inline\n * at the prop, for the reason `widthThen` gives.\n */\nfunction longPressThen(actions: TabActions, route: TabRoute) {\n return () => {\n actions.emit({ target: route.key, type: 'tabLongPress' })\n }\n}\n\n/**\n * The bar of three to five top-level destinations a compact window keeps at\n * its bottom edge. Each destination goes to its `href` through the app's\n * router, see `RouterProvider`.\n *\n * ```tsx\n * <NavigationBar selectedRoute=\"/first\">\n * <NavigationBar.Item href=\"/first\" icon={<FirstIcon />}>\n * First item\n * </NavigationBar.Item>\n * <NavigationBar.Item href=\"/second\" icon={<SecondIcon />}>\n * Second item\n * </NavigationBar.Item>\n * <NavigationBar.Item href=\"/third\" icon={<ThirdIcon />}>\n * Third item\n * </NavigationBar.Item>\n * </NavigationBar>\n * ```\n *\n * Draw it below the screen's content, at the bottom of the window: it paints\n * its surface to the bottom edge and keeps its destinations clear of the home\n * indicator itself. From the medium window size class each destination puts\n * its label beside its icon, where the bar is wide enough for every label.\n *\n * `style`, `ref` and `testID` land on the bar's own view, which is announced\n * as a tab list.\n */\nfunction NavigationBar({\n children,\n selectedRoute,\n style,\n ...props\n}: NavigationBarProps) {\n const theme = useTheme()\n const own = stylesOf(theme)\n const sizeClass = useWindowSizeClass()\n // The width the destinations have, and the width the horizontal form\n // takes, while each is known.\n const [room, setRoom] = useState<number | undefined>(undefined)\n const [needed, setNeeded] = useState<number | undefined>(undefined)\n\n const wide = sizeClass !== 'compact'\n const horizontal =\n wide && (room === undefined || needed === undefined || needed <= room)\n const context = useMemo(\n () => ({\n form: horizontal ? ('horizontal' as const) : ('vertical' as const),\n measuring: false,\n selectedRoute,\n }),\n [horizontal, selectedRoute],\n )\n const measuring = useMemo(\n () => ({ form: 'horizontal' as const, measuring: true, selectedRoute }),\n [selectedRoute],\n )\n\n return (\n <View\n role=\"tablist\"\n {...props}\n style={composeStyles<ViewStyle>(own.bar, style)}\n >\n <SafeAreaView edges={EDGES}>\n <View\n onLayout={widthThen(setRoom)}\n style={composeStyles<ViewStyle>(\n own.row,\n horizontal ? own.horizontal : styles.vertical,\n )}\n >\n <NavigationContext value={context}>{children}</NavigationContext>\n </View>\n </SafeAreaView>\n {wide ? (\n <View aria-hidden style={styles.measurer}>\n <View style={styles.room}>\n <View onLayout={widthThen(setNeeded)} style={own.measured}>\n <NavigationContext value={measuring}>\n {children}\n </NavigationContext>\n </View>\n </View>\n </View>\n ) : null}\n </View>\n )\n}\n\n/**\n * One destination of a navigation bar: an icon, a label and, while it is the\n * current one, the active indicator behind the icon. Pressing it calls\n * `onPress`, then goes to its `href`. Renders nothing of its own outside a\n * `NavigationBar`, whose `selectedRoute` says whether it is selected.\n *\n * `style`, `ref` and `testID` land on the destination's `Pressable`.\n */\nfunction NavigationBarItem({\n href,\n onPress,\n ...props\n}: NavigationBarItemProps) {\n const { selectedRoute } = use(NavigationContext)\n const press = useLinkPress(href, onPress)\n\n return (\n <NavigationDestination\n {...props}\n onPress={press}\n selected={selectedRoute !== undefined && href === selectedRoute}\n />\n )\n}\n\n/**\n * A navigation bar drawing a tab navigator's routes, for the `tabBar` prop of\n * React Navigation's bottom tabs and of Expo Router's `Tabs` alike.\n *\n * ```tsx\n * <Tabs tabBar={(props) => <NavigationTabBar {...props} />}>\n * <Tabs.Screen name=\"index\" options={{ tabBarIcon: () => <FirstIcon />, title: 'First item' }} />\n * </Tabs>\n * ```\n *\n * Each route is a destination, labelled by its `tabBarLabel` or its title,\n * with the icon `tabBarIcon` draws and the badge `tabBarBadge` asks for, and\n * the focused route is the selected one. Pressing a destination reports\n * `tabPress` to the navigator and moves to its route unless a listener\n * prevents it, and a long press reports `tabLongPress`, as the navigators'\n * own tab bars do.\n *\n * `style`, `ref` and `testID` land on the bar's own view, as on a\n * `NavigationBar`.\n */\nfunction NavigationTabBar({\n descriptors,\n emitter,\n insets: _insets,\n navigateToTab,\n navigation,\n state,\n ...props\n}: NavigationTabBarProps) {\n const actions = actionsOf(emitter, navigateToTab, navigation)\n const focused = state.routes[state.index]?.key\n\n return (\n <NavigationBar {...props}>\n {state.routes.map((route) => (\n <TabDestination\n focused={route.key === focused}\n key={route.key}\n onLongPress={longPressThen(actions, route)}\n onPress={pressThen(actions, route, route.key === focused)}\n options={descriptors[route.key]?.options ?? NO_OPTIONS}\n route={route}\n />\n ))}\n </NavigationBar>\n )\n}\n\n/**\n * Moves to a tab once the navigator has heard the press, unless a listener\n * prevented it or the tab is already focused. Built by a call rather than\n * written inline at the prop, for the reason `widthThen` gives.\n */\nfunction pressThen(actions: TabActions, route: TabRoute, focused: boolean) {\n return () => {\n const event = actions.emit({\n canPreventDefault: true,\n target: route.key,\n type: 'tabPress',\n })\n\n if (!focused && !prevented(event)) {\n actions.go(route)\n }\n }\n}\n\n// Whether a listener prevented an event, as the navigator reports it.\nfunction prevented(event: unknown) {\n return (\n typeof event === 'object' &&\n event !== null &&\n 'defaultPrevented' in event &&\n event.defaultPrevented === true\n )\n}\n\n/**\n * One route's destination. Its colours are the destination's own for the\n * form the bar draws, which is why it reads them inside the bar rather than\n * the bar computing them for it.\n */\nfunction TabDestination({\n focused,\n onLongPress,\n onPress,\n options,\n route,\n}: {\n readonly focused: boolean\n readonly onLongPress: () => void\n readonly onPress: () => void\n readonly options: TabOptions\n readonly route: TabRoute\n}) {\n const theme = useTheme()\n const { form } = use(NavigationContext)\n const { tabBarLabel } = options\n const title =\n typeof tabBarLabel === 'string'\n ? tabBarLabel\n : (options.title ?? route.name)\n\n return (\n <NavigationDestination\n aria-label={options.tabBarAccessibilityLabel ?? title}\n badge={badgeOf(options.tabBarBadge)}\n icon={options.tabBarIcon?.({\n color: iconColorOf(theme, false, focused),\n focused,\n size: ICON_SIZE,\n })}\n onLongPress={onLongPress}\n onPress={onPress}\n selected={focused}\n testID={options.tabBarButtonTestID}\n >\n {typeof tabBarLabel === 'function'\n ? tabBarLabel({\n children: title,\n color: labelColorOf(theme, form, false, focused),\n focused,\n position: form === 'horizontal' ? 'beside-icon' : 'below-icon',\n })\n : title}\n </NavigationDestination>\n )\n}\n\n/**\n * Records a view's width, as React Native lays it out. Built by a call\n * rather than written inline at the prop, which is what react-perf's\n * jsx-no-new-function-as-prop is after; the React Compiler memoises the\n * result on its inputs.\n */\nfunction widthThen(setWidth: (width: number) => void) {\n return (event: LayoutChangeEvent) => {\n setWidth(event.nativeEvent.layout.width)\n }\n}\n\nNavigationBar.Item = NavigationBarItem\n\nexport type {\n NavigationBarItemProps,\n NavigationBarProps,\n NavigationTabBarProps,\n}\n\nexport { NavigationBar, NavigationBarItem, NavigationTabBar }\n"],"mappings":";;;;;;;;;;;AA8LA,MAAM0E,iBAAiB;AAGvB,MAAMC,YAAY;AAGlB,MAAMC,aAAyB,CAAC;AAGhC,MAAMC,SAAS;AAIf,MAAMC,QAAyB;CAAC;CAAU;CAAQ;AAAO;AAEzD,MAAMC,SAASpE,WAAWqE,OAAO;CAG/BC,UAAU;EACRC,QAAQ;EACRC,UAAU;EACVC,eAAe;EACfb,UAAU;EACVc,OAAO;EACPC,KAAK;EACLC,OAAO;CACT;CAGAC,MAAM;EACJC,YAAY;EACZF,OAAOb;CACT;CAEAgB,UAAU,EACRD,YAAY,UACd;AACF,CAAC;AAED,MAAME,WAAWpE,cAAc,EAAEqE,QAAQC,cACvClF,WAAWqE,OAAO;CAChBc,KAAK,EACHC,iBAAiBH,OAAOI,iBAC1B;CAEAC,YAAY;EACVR,YAAY;EACZS,KAAKL,QAAQM;CACf;CAEAC,UAAU;EACRC,eAAe;EACfH,KAAKL,QAAQM;CACf;CAGAG,KAAK;EACHD,eAAe;EACfE,gBAAgB;EAChBC,WAAW;CACb;AACF,CAAC,CACH;;;;;AAMA,SAASC,UACPlD,SACAC,eACAE,YACY;CACZ,IAAIA,eAAegD,KAAAA,GACjB,OAAO;EACL5D,OAAOC,UAAUW,WAAWZ,KAAKC,KAAK;EACtCE,KAAKC,UAAU;GACbQ,WAAWC,SAAST,MAAMU,MAAMV,MAAMW,MAAM;EAC9C;CACF;CAEF,OAAO;EACLf,OAAOC,UAAUQ,SAAST,KAAKC,KAAK;EACpCE,KAAKC,UAAU;GACbM,gBAAgBN,MAAMuB,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ACL,OAAAE;GACD,MAAAI;GAKO2B;GACJT;GACChF,UAAAA;GACF,QAAA9B,QAAO0B;GAEdoE,UAAAA;EAbmB,CAAA;EAqBEjB,EAAA,MAAA/C;EAAA+C,EAAA,MAAA0C;EAAA1C,EAAA,MAAAiC;EAAAjC,EAAA,MAAA7E,QAAA0B;EAAAmD,EAAA,MAAAS;EAAAT,EAAA,MAAAW;EAAAX,EAAA,MAAAe;EAAAf,EAAA,MAAAiB;EAAAjB,EAAA,MAAAkB;CAAA,OAAAA,KAAAlB,EAAA;CAAA,OArBxBkB;AAqBwB;;;;;;;AAU5B,SAASM,UAAUmB,UAAmC;CACpD,QAAQ/G,UAA6B;EACnC+G,SAAS/G,MAAMgH,YAAYC,OAAOzE,KAAK;CACzC;AACF;AAEA0B,cAAcgD,OAAOd"}
@@ -1,11 +1,11 @@
1
1
  import { IconStyleContext } from "../../glyphs/icon-style.js";
2
- import { MinusGlyph, PlusGlyph } from "../../glyphs/index.js";
3
2
  import { useTheme } from "../../theme/scope.js";
4
3
  import { composeStyles, themedStyles } from "../../theme/styles.js";
5
- import { useFieldValidation } from "../../form/index.js";
4
+ import { hitSlop, usePressFeedback } from "../../press/index.js";
6
5
  import { withOpacity } from "../../theme/color.js";
7
6
  import { localeOf } from "../../number/locale.js";
8
- import { hitSlop, usePressFeedback } from "../../press/index.js";
7
+ import { MinusGlyph, PlusGlyph } from "../../glyphs/index.js";
8
+ import { useFieldValidation } from "../../form/index.js";
9
9
  import { IconButton } from "../icon-button/index.js";
10
10
  import { FieldBox, FieldInput, FieldMessage, describedBy, useFieldFocus } from "../../field/index.js";
11
11
  import { useNumberFieldState } from "../../number/state.js";