@xaui/native 0.0.21 → 0.0.24

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 (113) hide show
  1. package/README.md +195 -2
  2. package/dist/alert/index.js +1 -2
  3. package/dist/app-bar/index.cjs +217 -0
  4. package/dist/app-bar/index.d.cts +52 -0
  5. package/dist/app-bar/index.d.ts +52 -0
  6. package/dist/app-bar/index.js +142 -0
  7. package/dist/autocomplete/index.js +48 -36
  8. package/dist/avatar/index.js +1 -2
  9. package/dist/badge/index.js +1 -2
  10. package/dist/bottom-sheet/index.js +1 -2
  11. package/dist/bottom-tab-bar/index.cjs +571 -0
  12. package/dist/bottom-tab-bar/index.d.cts +211 -0
  13. package/dist/bottom-tab-bar/index.d.ts +211 -0
  14. package/dist/bottom-tab-bar/index.js +497 -0
  15. package/dist/button/index.d.cts +102 -5
  16. package/dist/button/index.d.ts +102 -5
  17. package/dist/button/index.js +2 -3
  18. package/dist/button.type-j1ZdkkSl.d.cts +4 -0
  19. package/dist/button.type-j1ZdkkSl.d.ts +4 -0
  20. package/dist/card/index.cjs +2 -0
  21. package/dist/card/index.d.cts +6 -1
  22. package/dist/card/index.d.ts +6 -1
  23. package/dist/card/index.js +4 -2
  24. package/dist/carousel/index.js +1 -1
  25. package/dist/chart/index.cjs +1067 -0
  26. package/dist/chart/index.d.cts +218 -0
  27. package/dist/chart/index.d.ts +218 -0
  28. package/dist/chart/index.js +1026 -0
  29. package/dist/checkbox/index.js +1 -2
  30. package/dist/chip/index.js +1 -2
  31. package/dist/chunk-3XSXTM3G.js +661 -0
  32. package/dist/chunk-4KSZLONZ.js +79 -0
  33. package/dist/{chunk-DXXNBF5P.js → chunk-CZFDZPAS.js} +0 -5
  34. package/dist/{chunk-LTKYHG5V.js → chunk-GHCVNQET.js} +12 -5
  35. package/dist/chunk-I4V5Y5GD.js +76 -0
  36. package/dist/{chunk-F7WH4DMG.js → chunk-UI5L26KD.js} +1 -1
  37. package/dist/{chunk-LUBWRVI2.js → chunk-ULJSCNPE.js} +1 -1
  38. package/dist/chunk-URBEEDFX.js +79 -0
  39. package/dist/core/index.js +3 -5
  40. package/dist/datepicker/index.js +1 -2
  41. package/dist/divider/index.js +2 -3
  42. package/dist/drawer/index.cjs +310 -0
  43. package/dist/drawer/index.d.cts +58 -0
  44. package/dist/drawer/index.d.ts +58 -0
  45. package/dist/drawer/index.js +236 -0
  46. package/dist/{accordion → expansion-panel}/index.cjs +45 -45
  47. package/dist/{accordion → expansion-panel}/index.d.cts +30 -30
  48. package/dist/{accordion → expansion-panel}/index.d.ts +30 -30
  49. package/dist/{accordion → expansion-panel}/index.js +40 -41
  50. package/dist/fab/index.d.cts +3 -3
  51. package/dist/fab/index.d.ts +3 -3
  52. package/dist/fab/index.js +3 -4
  53. package/dist/fab-menu/index.d.cts +2 -2
  54. package/dist/fab-menu/index.d.ts +2 -2
  55. package/dist/fab-menu/index.js +3 -4
  56. package/dist/{fab.type-Ba0QMprb.d.ts → fab.type-CgIYqQlT.d.ts} +1 -1
  57. package/dist/{fab.type-U09H8B7D.d.cts → fab.type-l2vjG8-p.d.cts} +1 -1
  58. package/dist/feature-discovery/index.cjs +531 -0
  59. package/dist/feature-discovery/index.d.cts +82 -0
  60. package/dist/feature-discovery/index.d.ts +82 -0
  61. package/dist/feature-discovery/index.js +464 -0
  62. package/dist/indicator/index.js +2 -3
  63. package/dist/input/index.cjs +258 -164
  64. package/dist/input/index.d.cts +15 -1
  65. package/dist/input/index.d.ts +15 -1
  66. package/dist/input/index.js +219 -126
  67. package/dist/list/index.js +1 -2
  68. package/dist/menu/index.js +2 -2
  69. package/dist/menubox/index.cjs +369 -0
  70. package/dist/menubox/index.d.cts +98 -0
  71. package/dist/menubox/index.d.ts +98 -0
  72. package/dist/menubox/index.js +296 -0
  73. package/dist/pager/index.cjs +243 -0
  74. package/dist/pager/index.d.cts +93 -0
  75. package/dist/pager/index.d.ts +93 -0
  76. package/dist/pager/index.js +205 -0
  77. package/dist/progress/index.js +1 -2
  78. package/dist/radio/index.cjs +537 -0
  79. package/dist/radio/index.d.cts +145 -0
  80. package/dist/radio/index.d.ts +145 -0
  81. package/dist/radio/index.js +464 -0
  82. package/dist/segment-button/index.js +2 -2
  83. package/dist/select/index.js +22 -10
  84. package/dist/skeleton/index.js +2 -2
  85. package/dist/slider/index.cjs +655 -0
  86. package/dist/slider/index.d.cts +171 -0
  87. package/dist/slider/index.d.ts +171 -0
  88. package/dist/slider/index.js +575 -0
  89. package/dist/stepper/index.cjs +624 -0
  90. package/dist/stepper/index.d.cts +137 -0
  91. package/dist/stepper/index.d.ts +137 -0
  92. package/dist/stepper/index.js +549 -0
  93. package/dist/switch/index.js +1 -2
  94. package/dist/tabs/index.cjs +523 -0
  95. package/dist/tabs/index.d.cts +176 -0
  96. package/dist/tabs/index.d.ts +176 -0
  97. package/dist/tabs/index.js +438 -0
  98. package/dist/timepicker/index.cjs +1280 -0
  99. package/dist/timepicker/index.d.cts +215 -0
  100. package/dist/timepicker/index.d.ts +215 -0
  101. package/dist/timepicker/index.js +1181 -0
  102. package/dist/toolbar/index.cjs +395 -0
  103. package/dist/toolbar/index.d.cts +100 -0
  104. package/dist/toolbar/index.d.ts +100 -0
  105. package/dist/toolbar/index.js +325 -0
  106. package/dist/typography/index.js +1 -2
  107. package/dist/view/index.cjs +16 -2
  108. package/dist/view/index.js +16 -2
  109. package/package.json +73 -8
  110. package/dist/button.type-D8tzEBo7.d.ts +0 -104
  111. package/dist/button.type-ikaWzhIg.d.cts +0 -104
  112. package/dist/chunk-GBHQCAKW.js +0 -19
  113. package/dist/chunk-JEGEPGVU.js +0 -287
@@ -0,0 +1,571 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components/bottom-tab-bar/index.ts
31
+ var bottom_tab_bar_exports = {};
32
+ __export(bottom_tab_bar_exports, {
33
+ BottomTabBar: () => BottomTabBar,
34
+ BottomTabBarItem: () => BottomTabBarItem
35
+ });
36
+ module.exports = __toCommonJS(bottom_tab_bar_exports);
37
+
38
+ // src/components/bottom-tab-bar/bottom-tab-bar.tsx
39
+ var import_react9 = __toESM(require("react"), 1);
40
+ var import_react_native6 = require("react-native");
41
+
42
+ // src/components/bottom-tab-bar/bottom-tab-bar.hook.ts
43
+ var import_react6 = require("react");
44
+ var import_core = require("@xaui/core");
45
+
46
+ // src/core/theme-context.tsx
47
+ var import_react4 = __toESM(require("react"), 1);
48
+ var import_react_native2 = require("react-native");
49
+ var import_theme = require("@xaui/core/theme");
50
+ var import_palette = require("@xaui/core/palette");
51
+
52
+ // src/core/portal/portal.tsx
53
+ var import_react2 = require("react");
54
+
55
+ // src/core/portal/portal-context.ts
56
+ var import_react = require("react");
57
+ var PortalContext = (0, import_react.createContext)(null);
58
+
59
+ // src/core/portal/portal-host.tsx
60
+ var import_react3 = __toESM(require("react"), 1);
61
+ var import_react_native = require("react-native");
62
+ var hostStyles = import_react_native.StyleSheet.create({
63
+ container: {
64
+ flex: 1
65
+ }
66
+ });
67
+
68
+ // src/core/theme-context.tsx
69
+ var XUIThemeContext = (0, import_react4.createContext)(null);
70
+
71
+ // src/core/theme-hooks.ts
72
+ var import_react5 = require("react");
73
+ var import_react_native3 = require("react-native");
74
+ function useXUITheme() {
75
+ const theme = (0, import_react5.useContext)(XUIThemeContext);
76
+ if (!theme) {
77
+ throw new Error("useXUITheme must be used within XUIProvider");
78
+ }
79
+ return theme;
80
+ }
81
+
82
+ // src/core/index.ts
83
+ var import_theme2 = require("@xaui/core/theme");
84
+
85
+ // src/components/bottom-tab-bar/bottom-tab-bar.hook.ts
86
+ var sizeMap = {
87
+ sm: {
88
+ minHeight: 68,
89
+ iconSize: 20,
90
+ indicatorWidth: 58,
91
+ indicatorHeight: 30,
92
+ indicatorRadius: 15,
93
+ itemPaddingTop: 8,
94
+ itemPaddingBottom: 6,
95
+ labelSize: 11,
96
+ labelSpacing: 4
97
+ },
98
+ md: {
99
+ minHeight: 78,
100
+ iconSize: 24,
101
+ indicatorWidth: 64,
102
+ indicatorHeight: 32,
103
+ indicatorRadius: 16,
104
+ itemPaddingTop: 10,
105
+ itemPaddingBottom: 8,
106
+ labelSize: 12,
107
+ labelSpacing: 4
108
+ },
109
+ lg: {
110
+ minHeight: 86,
111
+ iconSize: 26,
112
+ indicatorWidth: 70,
113
+ indicatorHeight: 36,
114
+ indicatorRadius: 18,
115
+ itemPaddingTop: 11,
116
+ itemPaddingBottom: 10,
117
+ labelSize: 13,
118
+ labelSpacing: 5
119
+ }
120
+ };
121
+ var useBottomTabBarSizeStyles = (size) => {
122
+ return (0, import_react6.useMemo)(() => sizeMap[size], [size]);
123
+ };
124
+ var useBottomTabBarColors = (themeColor, activeColor, inactiveColor, indicatorColor) => {
125
+ const theme = useXUITheme();
126
+ const colorScheme = theme.colors[(0, import_core.getSafeThemeColor)(themeColor)];
127
+ return (0, import_react6.useMemo)(() => {
128
+ return {
129
+ activeColor: activeColor ?? colorScheme.main,
130
+ inactiveColor: inactiveColor ?? (0, import_core.withOpacity)(theme.colors.foreground, 0.66),
131
+ indicatorColor: indicatorColor ?? (0, import_core.withOpacity)(colorScheme.main, theme.mode === "dark" ? 0.28 : 0.16),
132
+ containerColor: theme.colors.background,
133
+ borderColor: (0, import_core.withOpacity)(theme.colors.foreground, 0.08)
134
+ };
135
+ }, [activeColor, colorScheme.main, indicatorColor, inactiveColor, theme]);
136
+ };
137
+
138
+ // src/components/bottom-tab-bar/bottom-tab-bar-context.ts
139
+ var import_react7 = require("react");
140
+ var BottomTabBarContext = (0, import_react7.createContext)(
141
+ null
142
+ );
143
+ var useBottomTabBarContext = () => {
144
+ return (0, import_react7.useContext)(BottomTabBarContext);
145
+ };
146
+
147
+ // src/components/bottom-tab-bar/bottom-tab-bar-item.tsx
148
+ var import_react8 = __toESM(require("react"), 1);
149
+ var import_react_native5 = require("react-native");
150
+
151
+ // src/components/bottom-tab-bar/bottom-tab-bar.style.ts
152
+ var import_react_native4 = require("react-native");
153
+ var styles = import_react_native4.StyleSheet.create({
154
+ container: {
155
+ flexDirection: "row",
156
+ alignItems: "stretch",
157
+ width: "100%",
158
+ borderTopWidth: 1
159
+ },
160
+ itemPressable: {
161
+ flex: 1
162
+ },
163
+ itemContainer: {
164
+ flex: 1,
165
+ alignItems: "center",
166
+ justifyContent: "center"
167
+ },
168
+ itemContainerInline: {
169
+ flexDirection: "row"
170
+ },
171
+ indicator: {
172
+ alignItems: "center",
173
+ justifyContent: "center",
174
+ position: "relative"
175
+ },
176
+ indicatorContent: {
177
+ flexDirection: "row",
178
+ alignItems: "center",
179
+ justifyContent: "center"
180
+ },
181
+ indicatorBackground: {
182
+ position: "absolute"
183
+ },
184
+ label: {
185
+ fontWeight: "600",
186
+ letterSpacing: 0.1
187
+ },
188
+ inlineLabel: {
189
+ marginLeft: 6
190
+ },
191
+ badgeContainer: {
192
+ position: "absolute",
193
+ top: -4,
194
+ right: -10
195
+ },
196
+ disabled: {
197
+ opacity: 0.5
198
+ }
199
+ });
200
+
201
+ // src/components/bottom-tab-bar/bottom-tab-bar-item.tsx
202
+ var resolveIconNode = (icon, params) => {
203
+ if (typeof icon === "function") {
204
+ return icon(params);
205
+ }
206
+ return icon;
207
+ };
208
+ var BottomTabBarItem = ({
209
+ itemKey,
210
+ label,
211
+ icon,
212
+ activeIcon,
213
+ badge,
214
+ isDisabled = false,
215
+ isSelected,
216
+ showLabel,
217
+ activeColor,
218
+ inactiveColor,
219
+ indicatorColor,
220
+ style,
221
+ customAppearance,
222
+ onPress,
223
+ onLongPress,
224
+ accessibilityLabel,
225
+ testID
226
+ }) => {
227
+ const INLINE_INDICATOR_HORIZONTAL_PADDING = 10;
228
+ const INLINE_INDICATOR_VERTICAL_PADDING = 14;
229
+ const ICON_ONLY_INDICATOR_HORIZONTAL_PADDING = 10;
230
+ const ICON_ONLY_INDICATOR_VERTICAL_PADDING = 10;
231
+ const context = useBottomTabBarContext();
232
+ const selected = isSelected ?? context?.selectedKey === itemKey;
233
+ const disabled = isDisabled || !!context?.isDisabled;
234
+ const resolvedVariant = context?.variant ?? "stacked";
235
+ const isIconOnly = resolvedVariant === "icon-only";
236
+ const resolvedShowLabel = isIconOnly ? false : showLabel ?? context?.showLabel ?? true;
237
+ const isInline = resolvedVariant === "inline";
238
+ const resolvedSize = context?.size ?? "md";
239
+ const resolvedThemeColor = context?.themeColor ?? "primary";
240
+ const [contentSize, setContentSize] = (0, import_react8.useState)({ width: 0, height: 0 });
241
+ const sizeStyles = useBottomTabBarSizeStyles(resolvedSize);
242
+ const resolvedIndicatorWidth = isInline ? Math.max(
243
+ sizeStyles.indicatorHeight,
244
+ contentSize.width + INLINE_INDICATOR_HORIZONTAL_PADDING * 2
245
+ ) : isIconOnly ? Math.max(
246
+ sizeStyles.indicatorWidth,
247
+ contentSize.width + ICON_ONLY_INDICATOR_HORIZONTAL_PADDING * 2
248
+ ) : sizeStyles.indicatorWidth;
249
+ const resolvedIndicatorHeight = isInline ? Math.max(
250
+ sizeStyles.indicatorHeight,
251
+ contentSize.height + INLINE_INDICATOR_VERTICAL_PADDING * 1.35
252
+ ) : isIconOnly ? Math.max(
253
+ sizeStyles.indicatorHeight,
254
+ contentSize.height + ICON_ONLY_INDICATOR_VERTICAL_PADDING * 2
255
+ ) : sizeStyles.indicatorHeight;
256
+ const colors2 = useBottomTabBarColors(
257
+ resolvedThemeColor,
258
+ activeColor ?? context?.activeColor,
259
+ inactiveColor ?? context?.inactiveColor,
260
+ indicatorColor ?? context?.indicatorColor
261
+ );
262
+ const indicatorScale = (0, import_react8.useRef)(new import_react_native5.Animated.Value(selected ? 1 : 0.75)).current;
263
+ const indicatorOpacity = (0, import_react8.useRef)(new import_react_native5.Animated.Value(selected ? 1 : 0)).current;
264
+ (0, import_react8.useEffect)(() => {
265
+ import_react_native5.Animated.parallel([
266
+ import_react_native5.Animated.spring(indicatorScale, {
267
+ toValue: selected ? 1 : 0.75,
268
+ friction: 9,
269
+ tension: 95,
270
+ useNativeDriver: true
271
+ }),
272
+ import_react_native5.Animated.timing(indicatorOpacity, {
273
+ toValue: selected ? 1 : 0,
274
+ duration: selected ? 180 : 140,
275
+ useNativeDriver: true
276
+ })
277
+ ]).start();
278
+ }, [indicatorOpacity, indicatorScale, selected]);
279
+ const iconColor = selected ? colors2.activeColor : colors2.inactiveColor;
280
+ const iconNode = (0, import_react8.useMemo)(() => {
281
+ const params = {
282
+ focused: !!selected,
283
+ color: iconColor,
284
+ size: sizeStyles.iconSize
285
+ };
286
+ if (selected && activeIcon) {
287
+ return resolveIconNode(activeIcon, params);
288
+ }
289
+ return resolveIconNode(icon, params);
290
+ }, [activeIcon, icon, iconColor, selected, sizeStyles.iconSize]);
291
+ const labelNode = resolvedShowLabel ? /* @__PURE__ */ import_react8.default.createElement(
292
+ import_react_native5.Text,
293
+ {
294
+ numberOfLines: 1,
295
+ style: [
296
+ styles.label,
297
+ isInline && styles.inlineLabel,
298
+ {
299
+ color: iconColor,
300
+ fontSize: sizeStyles.labelSize
301
+ },
302
+ customAppearance?.label
303
+ ]
304
+ },
305
+ label
306
+ ) : null;
307
+ return /* @__PURE__ */ import_react8.default.createElement(
308
+ import_react_native5.Pressable,
309
+ {
310
+ onPress: (event) => {
311
+ if (disabled) return;
312
+ context?.onSelectionChange?.(itemKey);
313
+ onPress?.(event);
314
+ },
315
+ onLongPress,
316
+ disabled,
317
+ accessibilityRole: "tab",
318
+ accessibilityState: { selected: !!selected, disabled },
319
+ accessibilityLabel,
320
+ testID,
321
+ style: styles.itemPressable
322
+ },
323
+ /* @__PURE__ */ import_react8.default.createElement(
324
+ import_react_native5.View,
325
+ {
326
+ style: [
327
+ styles.itemContainer,
328
+ isInline && styles.itemContainerInline,
329
+ {
330
+ paddingTop: sizeStyles.itemPaddingTop,
331
+ paddingBottom: sizeStyles.itemPaddingBottom
332
+ },
333
+ disabled && styles.disabled,
334
+ style,
335
+ customAppearance?.container
336
+ ]
337
+ },
338
+ /* @__PURE__ */ import_react8.default.createElement(
339
+ import_react_native5.Animated.View,
340
+ {
341
+ style: [
342
+ styles.indicator,
343
+ {
344
+ width: resolvedIndicatorWidth,
345
+ height: resolvedIndicatorHeight,
346
+ marginBottom: !isInline && resolvedShowLabel ? sizeStyles.labelSpacing : 0
347
+ },
348
+ customAppearance?.indicator
349
+ ]
350
+ },
351
+ /* @__PURE__ */ import_react8.default.createElement(
352
+ import_react_native5.Animated.View,
353
+ {
354
+ style: [
355
+ styles.indicatorBackground,
356
+ {
357
+ width: resolvedIndicatorWidth,
358
+ height: resolvedIndicatorHeight,
359
+ borderRadius: resolvedIndicatorHeight / 2,
360
+ backgroundColor: colors2.indicatorColor,
361
+ transform: [{ scale: indicatorScale }],
362
+ opacity: indicatorOpacity
363
+ }
364
+ ]
365
+ }
366
+ ),
367
+ /* @__PURE__ */ import_react8.default.createElement(
368
+ import_react_native5.View,
369
+ {
370
+ style: styles.indicatorContent,
371
+ onLayout: (event) => {
372
+ if (!isInline && !isIconOnly) return;
373
+ const nextWidth = Math.ceil(event.nativeEvent.layout.width);
374
+ const nextHeight = Math.ceil(event.nativeEvent.layout.height);
375
+ setContentSize(
376
+ (prev) => prev.width === nextWidth && prev.height === nextHeight ? prev : { width: nextWidth, height: nextHeight }
377
+ );
378
+ }
379
+ },
380
+ iconNode,
381
+ badge ? /* @__PURE__ */ import_react8.default.createElement(import_react_native5.View, { style: styles.badgeContainer }, badge) : null,
382
+ isInline ? labelNode : null
383
+ )
384
+ ),
385
+ !isInline ? labelNode : null
386
+ )
387
+ );
388
+ };
389
+
390
+ // src/components/bottom-tab-bar/bottom-tab-bar.tsx
391
+ var isExpoRouterMode = (props) => {
392
+ return "state" in props && "navigation" in props && "descriptors" in props && !!props.state && !!props.navigation && !!props.descriptors;
393
+ };
394
+ var getRouteLabel = (route, options, focused, color, variant) => {
395
+ if (typeof options.tabBarLabel === "function") {
396
+ return options.tabBarLabel({
397
+ focused,
398
+ color,
399
+ children: options.title ?? route.name,
400
+ position: variant === "inline" ? "beside-icon" : "below-icon"
401
+ });
402
+ }
403
+ if (typeof options.tabBarLabel === "string") {
404
+ return options.tabBarLabel;
405
+ }
406
+ if (typeof options.title === "string") {
407
+ return options.title;
408
+ }
409
+ return route.name;
410
+ };
411
+ var BottomTabBar = (props) => {
412
+ const {
413
+ themeColor = "primary",
414
+ size = "md",
415
+ variant = "stacked",
416
+ isDisabled = false,
417
+ showLabel = true,
418
+ insetBottom = 0,
419
+ indicatorColor,
420
+ activeColor,
421
+ inactiveColor,
422
+ style,
423
+ customAppearance
424
+ } = props;
425
+ const sizeStyles = useBottomTabBarSizeStyles(size);
426
+ const colors2 = useBottomTabBarColors(
427
+ themeColor,
428
+ activeColor,
429
+ inactiveColor,
430
+ indicatorColor
431
+ );
432
+ if (isExpoRouterMode(props)) {
433
+ const { state, descriptors, navigation, insets } = props;
434
+ const currentRoute = state.routes[state.index];
435
+ const focusedOptions = descriptors[currentRoute.key]?.options;
436
+ const focusedStyle = focusedOptions?.tabBarStyle;
437
+ if (focusedStyle?.display === "none") {
438
+ return null;
439
+ }
440
+ const routerInsetBottom = insets?.bottom ?? insetBottom;
441
+ return /* @__PURE__ */ import_react9.default.createElement(
442
+ import_react_native6.View,
443
+ {
444
+ style: [
445
+ styles.container,
446
+ {
447
+ minHeight: sizeStyles.minHeight + routerInsetBottom,
448
+ paddingBottom: routerInsetBottom,
449
+ backgroundColor: colors2.containerColor,
450
+ borderTopColor: colors2.borderColor
451
+ },
452
+ style,
453
+ customAppearance?.container
454
+ ]
455
+ },
456
+ state.routes.filter((route) => descriptors[route.key]?.options.href !== null).map((route) => {
457
+ const routeOptions = descriptors[route.key]?.options ?? {};
458
+ const focused = currentRoute.key === route.key;
459
+ const routeActiveColor = routeOptions.tabBarActiveTintColor ?? activeColor;
460
+ const routeInactiveColor = routeOptions.tabBarInactiveTintColor ?? inactiveColor;
461
+ const labelColor = focused ? routeActiveColor ?? colors2.activeColor : routeInactiveColor ?? colors2.inactiveColor;
462
+ return /* @__PURE__ */ import_react9.default.createElement(
463
+ BottomTabBarItem,
464
+ {
465
+ key: route.key,
466
+ itemKey: route.key,
467
+ label: getRouteLabel(
468
+ route,
469
+ routeOptions,
470
+ focused,
471
+ labelColor,
472
+ variant
473
+ ),
474
+ icon: routeOptions.tabBarIcon,
475
+ isSelected: focused,
476
+ showLabel: routeOptions.tabBarShowLabel ?? showLabel,
477
+ activeColor: routeActiveColor,
478
+ inactiveColor: routeInactiveColor,
479
+ badge: routeOptions.tabBarBadge,
480
+ accessibilityLabel: routeOptions.tabBarAccessibilityLabel,
481
+ testID: routeOptions.tabBarButtonTestID,
482
+ style: routeOptions.tabBarItemStyle,
483
+ isDisabled,
484
+ onPress: () => {
485
+ const event = navigation.emit({
486
+ type: "tabPress",
487
+ target: route.key,
488
+ canPreventDefault: true
489
+ });
490
+ if (!focused && !event.defaultPrevented) {
491
+ navigation.navigate(route.name, route.params);
492
+ }
493
+ },
494
+ onLongPress: () => {
495
+ navigation.emit({
496
+ type: "tabLongPress",
497
+ target: route.key
498
+ });
499
+ }
500
+ }
501
+ );
502
+ })
503
+ );
504
+ }
505
+ const { children, selectedKey, defaultSelectedKey, onSelectionChange } = props;
506
+ const firstItemKey = import_react9.default.useMemo(() => {
507
+ const child = import_react9.default.Children.toArray(children)[0];
508
+ if (import_react9.default.isValidElement(child)) {
509
+ return child.props.itemKey;
510
+ }
511
+ return void 0;
512
+ }, [children]);
513
+ const isControlled = typeof selectedKey === "string";
514
+ const [internalSelectedKey, setInternalSelectedKey] = (0, import_react9.useState)(
515
+ defaultSelectedKey ?? firstItemKey
516
+ );
517
+ const resolvedSelectedKey = isControlled ? selectedKey : internalSelectedKey;
518
+ const handleSelectionChange = (nextKey) => {
519
+ if (!isControlled) {
520
+ setInternalSelectedKey(nextKey);
521
+ }
522
+ onSelectionChange?.(nextKey);
523
+ };
524
+ const contextValue = (0, import_react9.useMemo)(
525
+ () => ({
526
+ selectedKey: resolvedSelectedKey,
527
+ onSelectionChange: handleSelectionChange,
528
+ isDisabled,
529
+ showLabel,
530
+ size,
531
+ variant,
532
+ themeColor,
533
+ indicatorColor,
534
+ activeColor,
535
+ inactiveColor
536
+ }),
537
+ [
538
+ activeColor,
539
+ inactiveColor,
540
+ indicatorColor,
541
+ isDisabled,
542
+ resolvedSelectedKey,
543
+ showLabel,
544
+ size,
545
+ variant,
546
+ themeColor
547
+ ]
548
+ );
549
+ return /* @__PURE__ */ import_react9.default.createElement(BottomTabBarContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react9.default.createElement(
550
+ import_react_native6.View,
551
+ {
552
+ style: [
553
+ styles.container,
554
+ {
555
+ minHeight: sizeStyles.minHeight + insetBottom,
556
+ paddingBottom: insetBottom,
557
+ backgroundColor: colors2.containerColor,
558
+ borderTopColor: colors2.borderColor
559
+ },
560
+ style,
561
+ customAppearance?.container
562
+ ]
563
+ },
564
+ children
565
+ ));
566
+ };
567
+ // Annotate the CommonJS export names for ESM import in node:
568
+ 0 && (module.exports = {
569
+ BottomTabBar,
570
+ BottomTabBarItem
571
+ });