@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,523 @@
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/tabs/index.ts
31
+ var tabs_exports = {};
32
+ __export(tabs_exports, {
33
+ Tab: () => Tab,
34
+ Tabs: () => Tabs
35
+ });
36
+ module.exports = __toCommonJS(tabs_exports);
37
+
38
+ // src/components/tabs/tabs.tsx
39
+ var import_react7 = __toESM(require("react"), 1);
40
+ var import_react_native6 = require("react-native");
41
+
42
+ // src/core/theme-hooks.ts
43
+ var import_react5 = require("react");
44
+ var import_react_native3 = require("react-native");
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
+ function useXUITheme() {
73
+ const theme = (0, import_react5.useContext)(XUIThemeContext);
74
+ if (!theme) {
75
+ throw new Error("useXUITheme must be used within XUIProvider");
76
+ }
77
+ return theme;
78
+ }
79
+ function useBorderRadiusStyles(radius) {
80
+ const theme = useXUITheme();
81
+ const borderRadius = (0, import_react5.useMemo)(() => {
82
+ const radiusMap = {
83
+ none: theme.borderRadius.none,
84
+ sm: theme.borderRadius.sm,
85
+ md: theme.borderRadius.md,
86
+ lg: theme.borderRadius.lg,
87
+ full: theme.borderRadius.full
88
+ };
89
+ return { borderRadius: radiusMap[radius] };
90
+ }, [radius, theme]);
91
+ return borderRadius;
92
+ }
93
+
94
+ // src/components/tabs/tabs.animation.ts
95
+ var import_react_native4 = require("react-native");
96
+ var runTabsCursorAnimation = (translateX, width, scaleX, toX, toWidth, duration) => {
97
+ scaleX.setValue(0.75);
98
+ import_react_native4.Animated.parallel([
99
+ import_react_native4.Animated.timing(translateX, {
100
+ toValue: toX,
101
+ duration,
102
+ easing: import_react_native4.Easing.inOut(import_react_native4.Easing.quad),
103
+ useNativeDriver: false
104
+ }),
105
+ import_react_native4.Animated.timing(width, {
106
+ toValue: toWidth,
107
+ duration,
108
+ easing: import_react_native4.Easing.inOut(import_react_native4.Easing.quad),
109
+ useNativeDriver: false
110
+ }),
111
+ import_react_native4.Animated.timing(scaleX, {
112
+ toValue: 1,
113
+ duration,
114
+ easing: import_react_native4.Easing.out(import_react_native4.Easing.quad),
115
+ useNativeDriver: false
116
+ })
117
+ ]).start();
118
+ };
119
+
120
+ // src/components/tabs/tabs.hook.ts
121
+ var import_react6 = require("react");
122
+ var import_core = require("@xaui/core");
123
+
124
+ // src/core/index.ts
125
+ var import_theme2 = require("@xaui/core/theme");
126
+
127
+ // src/components/tabs/tabs.hook.ts
128
+ function useTabsSizeStyles(size) {
129
+ const theme = useXUITheme();
130
+ return (0, import_react6.useMemo)(() => {
131
+ const sizes = {
132
+ xs: {
133
+ minHeight: 32,
134
+ paddingHorizontal: theme.spacing.sm,
135
+ paddingVertical: theme.spacing.xs,
136
+ fontSize: theme.fontSizes.xs
137
+ },
138
+ sm: {
139
+ minHeight: 36,
140
+ paddingHorizontal: theme.spacing.md,
141
+ paddingVertical: theme.spacing.xs,
142
+ fontSize: theme.fontSizes.sm
143
+ },
144
+ md: {
145
+ minHeight: 42,
146
+ paddingHorizontal: theme.spacing.md,
147
+ paddingVertical: theme.spacing.sm,
148
+ fontSize: theme.fontSizes.md
149
+ },
150
+ lg: {
151
+ minHeight: 50,
152
+ paddingHorizontal: theme.spacing.lg,
153
+ paddingVertical: theme.spacing.md,
154
+ fontSize: theme.fontSizes.lg
155
+ }
156
+ };
157
+ return sizes[size];
158
+ }, [size, theme]);
159
+ }
160
+ function useTabsVariantStyles(color, variant) {
161
+ const theme = useXUITheme();
162
+ const safeColor = (0, import_core.getSafeThemeColor)(color);
163
+ const palette = theme.colors[safeColor];
164
+ const cursorSolidColor = (0, import_core.withPaletteNumber)(palette.main, 400);
165
+ return (0, import_react6.useMemo)(() => {
166
+ const variants = {
167
+ solid: {
168
+ listBackgroundColor: palette.background,
169
+ listBorderColor: "transparent",
170
+ listBorderWidth: 0,
171
+ listPaddingHorizontal: 4,
172
+ cursorColor: cursorSolidColor,
173
+ textColor: palette.main,
174
+ selectedTextColor: palette.foreground,
175
+ cursorHeight: void 0,
176
+ cursorTop: 4,
177
+ cursorBottom: 4,
178
+ cursorShadow: true
179
+ },
180
+ bordered: {
181
+ listBackgroundColor: "transparent",
182
+ listBorderColor: `${palette.main}30`,
183
+ listBorderWidth: theme.borderWidth.md,
184
+ listPaddingHorizontal: 0,
185
+ cursorColor: cursorSolidColor,
186
+ textColor: palette.main,
187
+ selectedTextColor: palette.foreground,
188
+ cursorHeight: void 0,
189
+ cursorTop: 0,
190
+ cursorBottom: 0,
191
+ cursorShadow: false
192
+ },
193
+ light: {
194
+ listBackgroundColor: "transparent",
195
+ listBorderColor: "transparent",
196
+ listBorderWidth: 0,
197
+ listPaddingHorizontal: 0,
198
+ cursorColor: `${cursorSolidColor}25`,
199
+ textColor: palette.main,
200
+ selectedTextColor: palette.main,
201
+ cursorHeight: void 0,
202
+ cursorTop: 0,
203
+ cursorBottom: 0,
204
+ cursorShadow: false
205
+ },
206
+ underlined: {
207
+ listBackgroundColor: "transparent",
208
+ listBorderColor: `${palette.main}45`,
209
+ listBorderWidth: 0,
210
+ listPaddingHorizontal: 0,
211
+ cursorColor: cursorSolidColor,
212
+ textColor: `${palette.main}B0`,
213
+ selectedTextColor: palette.main,
214
+ cursorHeight: 2,
215
+ cursorTop: void 0,
216
+ cursorBottom: -2,
217
+ cursorShadow: false
218
+ }
219
+ };
220
+ return variants[variant];
221
+ }, [cursorSolidColor, palette, theme.borderWidth.md, variant]);
222
+ }
223
+
224
+ // src/components/tabs/tabs.style.ts
225
+ var import_react_native5 = require("react-native");
226
+ var styles = import_react_native5.StyleSheet.create({
227
+ container: {
228
+ width: "100%"
229
+ },
230
+ list: {
231
+ position: "relative",
232
+ flexDirection: "row",
233
+ alignItems: "stretch",
234
+ alignSelf: "flex-start"
235
+ },
236
+ fullWidth: {
237
+ width: "100%",
238
+ alignSelf: "stretch"
239
+ },
240
+ tabPressable: {
241
+ flex: 1,
242
+ zIndex: 1
243
+ },
244
+ tab: {
245
+ minWidth: 64,
246
+ alignItems: "center",
247
+ justifyContent: "center",
248
+ flexDirection: "row",
249
+ gap: 6
250
+ },
251
+ text: {
252
+ textAlign: "center",
253
+ fontWeight: "500"
254
+ },
255
+ cursor: {
256
+ position: "absolute",
257
+ left: 0
258
+ },
259
+ disabled: {
260
+ opacity: 0.5
261
+ },
262
+ content: {
263
+ marginTop: 12
264
+ }
265
+ });
266
+
267
+ // src/components/tabs/tabs.tsx
268
+ function isTabDisabled(item, disabledKeys, isDisabled) {
269
+ return isDisabled || item.isDisabled === true || disabledKeys?.includes(item.key) === true;
270
+ }
271
+ function getFallbackKey(items, disabledKeys, isDisabled) {
272
+ if (isDisabled) return "";
273
+ const firstEnabled = items.find((item) => !isTabDisabled(item, disabledKeys, false));
274
+ return firstEnabled?.key ?? "";
275
+ }
276
+ var Tab = () => null;
277
+ Tab.displayName = "Tab";
278
+ function toTabItems(children) {
279
+ return import_react7.default.Children.toArray(children).flatMap((child) => {
280
+ if (!import_react7.default.isValidElement(child) || child.type !== Tab) {
281
+ return [];
282
+ }
283
+ if (child.key == null) {
284
+ return [];
285
+ }
286
+ return [
287
+ {
288
+ key: String(child.key),
289
+ title: child.props.title,
290
+ startContent: child.props.startContent,
291
+ endContent: child.props.endContent,
292
+ isDisabled: child.props.isDisabled,
293
+ content: child.props.children
294
+ }
295
+ ];
296
+ });
297
+ }
298
+ var Tabs = ({
299
+ selectedKey: controlledSelectedKey,
300
+ defaultSelectedKey,
301
+ onSelectionChange,
302
+ disabledKeys,
303
+ color = "primary",
304
+ variant = "solid",
305
+ size = "md",
306
+ radius = "full",
307
+ fullWidth = false,
308
+ isDisabled = false,
309
+ disableAnimation = false,
310
+ animationDuration = 220,
311
+ renderTab,
312
+ children,
313
+ content,
314
+ customAppearance
315
+ }) => {
316
+ const items = (0, import_react7.useMemo)(() => toTabItems(children), [children]);
317
+ const isControlled = controlledSelectedKey !== void 0;
318
+ const initialKey = (0, import_react7.useMemo)(() => {
319
+ if (defaultSelectedKey) return defaultSelectedKey;
320
+ return getFallbackKey(items, disabledKeys, isDisabled);
321
+ }, [defaultSelectedKey, disabledKeys, isDisabled, items]);
322
+ const [internalSelectedKey, setInternalSelectedKey] = (0, import_react7.useState)(initialKey);
323
+ const [layouts, setLayouts] = (0, import_react7.useState)({});
324
+ const [listWidth, setListWidth] = (0, import_react7.useState)(0);
325
+ const selectedKey = (isControlled ? controlledSelectedKey : internalSelectedKey) ?? "";
326
+ const selectedItem = (0, import_react7.useMemo)(
327
+ () => items.find((item) => item.key === selectedKey),
328
+ [items, selectedKey]
329
+ );
330
+ const sizeStyles = useTabsSizeStyles(size);
331
+ const variantStyles = useTabsVariantStyles(color, variant);
332
+ const radiusStyles = useBorderRadiusStyles(radius);
333
+ const cursorTranslateX = (0, import_react7.useRef)(new import_react_native6.Animated.Value(0)).current;
334
+ const cursorWidth = (0, import_react7.useRef)(new import_react_native6.Animated.Value(0)).current;
335
+ const cursorScaleX = (0, import_react7.useRef)(new import_react_native6.Animated.Value(1)).current;
336
+ const prevCursorLayout = (0, import_react7.useRef)(null);
337
+ (0, import_react7.useEffect)(() => {
338
+ if (isControlled || selectedKey) return;
339
+ const nextFallback = getFallbackKey(items, disabledKeys, isDisabled);
340
+ if (nextFallback && nextFallback !== selectedKey) {
341
+ setInternalSelectedKey(nextFallback);
342
+ }
343
+ }, [disabledKeys, isControlled, isDisabled, items, selectedKey]);
344
+ (0, import_react7.useEffect)(() => {
345
+ if (!selectedKey) return;
346
+ const selectedLayout = layouts[selectedKey];
347
+ if (!selectedLayout) return;
348
+ const from = prevCursorLayout.current;
349
+ prevCursorLayout.current = selectedLayout;
350
+ if (disableAnimation || !from) {
351
+ cursorTranslateX.setValue(selectedLayout.x);
352
+ cursorWidth.setValue(selectedLayout.width);
353
+ cursorScaleX.setValue(1);
354
+ return;
355
+ }
356
+ runTabsCursorAnimation(
357
+ cursorTranslateX,
358
+ cursorWidth,
359
+ cursorScaleX,
360
+ selectedLayout.x,
361
+ selectedLayout.width,
362
+ animationDuration
363
+ );
364
+ }, [
365
+ animationDuration,
366
+ cursorTranslateX,
367
+ cursorWidth,
368
+ cursorScaleX,
369
+ disableAnimation,
370
+ layouts,
371
+ selectedKey
372
+ ]);
373
+ const onTabLayout = (0, import_react7.useCallback)(
374
+ (key, event) => {
375
+ const nextLayout = event.nativeEvent.layout;
376
+ setLayouts((prev) => {
377
+ const current = prev[key];
378
+ if (current && current.x === nextLayout.x && current.width === nextLayout.width) {
379
+ return prev;
380
+ }
381
+ const isBordered = variant === "bordered";
382
+ const isFirstTab = items[0]?.key === key;
383
+ let cursorWidth2 = nextLayout.width;
384
+ let cursorX = nextLayout.x;
385
+ if (isBordered) {
386
+ cursorWidth2 = nextLayout.width;
387
+ cursorX = nextLayout.x;
388
+ if (isFirstTab) {
389
+ cursorWidth2 = nextLayout.width + variantStyles.listBorderWidth;
390
+ cursorX = Math.max(0, nextLayout.x - variantStyles.listBorderWidth);
391
+ }
392
+ if (listWidth > 0) {
393
+ const maxWidth = Math.max(0, listWidth - cursorX);
394
+ cursorWidth2 = Math.min(cursorWidth2, maxWidth);
395
+ }
396
+ }
397
+ return {
398
+ ...prev,
399
+ [key]: { x: cursorX, width: cursorWidth2 }
400
+ };
401
+ });
402
+ },
403
+ [items, listWidth, setLayouts, variant, variantStyles.listBorderWidth]
404
+ );
405
+ const handleTabPress = (0, import_react7.useCallback)(
406
+ (item) => {
407
+ if (isTabDisabled(item, disabledKeys, isDisabled)) return;
408
+ if (!isControlled) {
409
+ setInternalSelectedKey(item.key);
410
+ }
411
+ onSelectionChange?.(item.key);
412
+ },
413
+ [disabledKeys, isControlled, isDisabled, onSelectionChange]
414
+ );
415
+ const shouldShowCursor = !!selectedKey && !!layouts[selectedKey] && !isDisabled && items.length > 0;
416
+ const resolvedContent = typeof content === "function" ? content({ selectedKey, selectedItem }) : content ?? selectedItem?.content;
417
+ return /* @__PURE__ */ import_react7.default.createElement(import_react_native6.View, { style: [styles.container, customAppearance?.container] }, /* @__PURE__ */ import_react7.default.createElement(
418
+ import_react_native6.View,
419
+ {
420
+ onLayout: (event) => setListWidth(event.nativeEvent.layout.width),
421
+ style: [
422
+ styles.list,
423
+ {
424
+ borderRadius: variant === "underlined" ? 0 : radiusStyles.borderRadius,
425
+ backgroundColor: variantStyles.listBackgroundColor,
426
+ borderColor: variantStyles.listBorderColor,
427
+ borderWidth: variantStyles.listBorderWidth,
428
+ borderBottomWidth: variant === "underlined" ? variantStyles.cursorHeight ?? 2 : variantStyles.listBorderWidth,
429
+ paddingHorizontal: variantStyles.listPaddingHorizontal,
430
+ ...variant === "bordered" && { overflow: "hidden" }
431
+ },
432
+ fullWidth && styles.fullWidth,
433
+ customAppearance?.list
434
+ ]
435
+ },
436
+ shouldShowCursor && /* @__PURE__ */ import_react7.default.createElement(
437
+ import_react_native6.Animated.View,
438
+ {
439
+ pointerEvents: "none",
440
+ style: [
441
+ styles.cursor,
442
+ {
443
+ bottom: variantStyles.cursorBottom,
444
+ borderRadius: variant === "underlined" ? 0 : Math.max(
445
+ 0,
446
+ radiusStyles.borderRadius - variantStyles.listBorderWidth
447
+ ),
448
+ width: cursorWidth,
449
+ backgroundColor: variantStyles.cursorColor,
450
+ transform: [
451
+ { translateX: cursorTranslateX },
452
+ { scaleX: cursorScaleX }
453
+ ],
454
+ ...variantStyles.cursorTop !== void 0 && {
455
+ top: variantStyles.cursorTop
456
+ },
457
+ ...variantStyles.cursorHeight !== void 0 && {
458
+ height: variantStyles.cursorHeight
459
+ },
460
+ ...variantStyles.cursorShadow && {
461
+ shadowColor: "#000",
462
+ shadowOffset: { width: 0, height: 1 },
463
+ shadowOpacity: 0.15,
464
+ shadowRadius: 3,
465
+ elevation: 2
466
+ }
467
+ },
468
+ customAppearance?.cursor
469
+ ]
470
+ }
471
+ ),
472
+ items.map((item) => {
473
+ const isSelected = selectedKey === item.key;
474
+ const disabled = isTabDisabled(item, disabledKeys, isDisabled);
475
+ return /* @__PURE__ */ import_react7.default.createElement(
476
+ import_react_native6.Pressable,
477
+ {
478
+ key: item.key,
479
+ onLayout: (event) => onTabLayout(item.key, event),
480
+ onPress: () => handleTabPress(item),
481
+ disabled,
482
+ style: [styles.tabPressable, disabled && styles.disabled]
483
+ },
484
+ /* @__PURE__ */ import_react7.default.createElement(
485
+ import_react_native6.View,
486
+ {
487
+ style: [
488
+ styles.tab,
489
+ {
490
+ minHeight: sizeStyles.minHeight,
491
+ paddingHorizontal: sizeStyles.paddingHorizontal,
492
+ paddingVertical: sizeStyles.paddingVertical
493
+ },
494
+ customAppearance?.tab,
495
+ isSelected && customAppearance?.selectedTab
496
+ ]
497
+ },
498
+ renderTab ? renderTab(item, { isSelected, isDisabled: disabled }) : /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, item.startContent, /* @__PURE__ */ import_react7.default.createElement(
499
+ import_react_native6.Text,
500
+ {
501
+ numberOfLines: 1,
502
+ style: [
503
+ styles.text,
504
+ {
505
+ color: isSelected ? variantStyles.selectedTextColor : variantStyles.textColor,
506
+ fontSize: sizeStyles.fontSize
507
+ },
508
+ customAppearance?.text,
509
+ isSelected && customAppearance?.selectedText
510
+ ]
511
+ },
512
+ item.title
513
+ ), item.endContent)
514
+ )
515
+ );
516
+ })
517
+ ), resolvedContent !== void 0 && /* @__PURE__ */ import_react7.default.createElement(import_react_native6.View, { style: [styles.content, customAppearance?.content] }, resolvedContent));
518
+ };
519
+ // Annotate the CommonJS export names for ESM import in node:
520
+ 0 && (module.exports = {
521
+ Tab,
522
+ Tabs
523
+ });
@@ -0,0 +1,176 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { ViewStyle, TextStyle } from 'react-native';
3
+ import { T as ThemeColor, S as Size, R as Radius } from '../index-BOw6tbkc.cjs';
4
+
5
+ type TabsVariant = 'solid' | 'bordered' | 'light' | 'underlined';
6
+ type TabsItem = {
7
+ /**
8
+ * Unique key for the tab.
9
+ */
10
+ key: string;
11
+ /**
12
+ * Label content for the tab trigger.
13
+ */
14
+ title: ReactNode;
15
+ /**
16
+ * Optional content displayed before the title.
17
+ */
18
+ startContent?: ReactNode;
19
+ /**
20
+ * Optional content displayed after the title.
21
+ */
22
+ endContent?: ReactNode;
23
+ /**
24
+ * Whether this tab is disabled.
25
+ * @default false
26
+ */
27
+ isDisabled?: boolean;
28
+ /**
29
+ * Optional content rendered when this tab is selected.
30
+ */
31
+ content?: ReactNode;
32
+ };
33
+ type TabProps = {
34
+ /**
35
+ * Label content for the tab trigger.
36
+ */
37
+ title: ReactNode;
38
+ /**
39
+ * Optional content displayed before the title.
40
+ */
41
+ startContent?: ReactNode;
42
+ /**
43
+ * Optional content displayed after the title.
44
+ */
45
+ endContent?: ReactNode;
46
+ /**
47
+ * Whether this tab is disabled.
48
+ * @default false
49
+ */
50
+ isDisabled?: boolean;
51
+ /**
52
+ * Optional content rendered when this tab is selected.
53
+ */
54
+ children?: ReactNode;
55
+ };
56
+ type TabsCustomAppearance = {
57
+ /**
58
+ * Custom styles for the outer container.
59
+ */
60
+ container?: ViewStyle;
61
+ /**
62
+ * Custom styles for the tabs list wrapper.
63
+ */
64
+ list?: ViewStyle;
65
+ /**
66
+ * Custom styles for each tab trigger.
67
+ */
68
+ tab?: ViewStyle;
69
+ /**
70
+ * Custom styles for the selected tab trigger.
71
+ */
72
+ selectedTab?: ViewStyle;
73
+ /**
74
+ * Custom styles for tab title text.
75
+ */
76
+ text?: TextStyle;
77
+ /**
78
+ * Custom styles for selected tab title text.
79
+ */
80
+ selectedText?: TextStyle;
81
+ /**
82
+ * Custom styles for the animated cursor.
83
+ */
84
+ cursor?: ViewStyle;
85
+ /**
86
+ * Custom styles for optional content area.
87
+ */
88
+ content?: ViewStyle;
89
+ };
90
+ type RenderTabState = {
91
+ isSelected: boolean;
92
+ isDisabled: boolean;
93
+ };
94
+ type RenderChildrenState = {
95
+ selectedKey: string;
96
+ selectedItem?: TabsItem;
97
+ };
98
+ type TabsProps = {
99
+ /**
100
+ * Controlled selected key.
101
+ */
102
+ selectedKey?: string;
103
+ /**
104
+ * Default selected key in uncontrolled mode.
105
+ */
106
+ defaultSelectedKey?: string;
107
+ /**
108
+ * Callback fired when selection changes.
109
+ */
110
+ onSelectionChange?: (key: string) => void;
111
+ /**
112
+ * Keys that should be disabled.
113
+ */
114
+ disabledKeys?: string[];
115
+ /**
116
+ * Theme color of tabs.
117
+ * @default 'primary'
118
+ */
119
+ color?: ThemeColor;
120
+ /**
121
+ * Visual variant.
122
+ * @default 'solid'
123
+ */
124
+ variant?: TabsVariant;
125
+ /**
126
+ * Size of tab triggers.
127
+ * @default 'md'
128
+ */
129
+ size?: Size;
130
+ /**
131
+ * Border radius for list and cursor.
132
+ * @default 'full'
133
+ */
134
+ radius?: Radius;
135
+ /**
136
+ * Whether tabs should stretch to full width.
137
+ * @default false
138
+ */
139
+ fullWidth?: boolean;
140
+ /**
141
+ * Whether all tabs are disabled.
142
+ * @default false
143
+ */
144
+ isDisabled?: boolean;
145
+ /**
146
+ * Disable cursor animation.
147
+ * @default false
148
+ */
149
+ disableAnimation?: boolean;
150
+ /**
151
+ * Animation duration in milliseconds.
152
+ * @default 220
153
+ */
154
+ animationDuration?: number;
155
+ /**
156
+ * Optional custom tab renderer.
157
+ */
158
+ renderTab?: (item: TabsItem, state: RenderTabState) => ReactNode;
159
+ /**
160
+ * Tab items as children.
161
+ */
162
+ children: ReactNode;
163
+ /**
164
+ * Optional content area rendered below the tabs.
165
+ */
166
+ content?: ReactNode | ((state: RenderChildrenState) => ReactNode);
167
+ /**
168
+ * Custom appearance overrides.
169
+ */
170
+ customAppearance?: TabsCustomAppearance;
171
+ };
172
+
173
+ declare const Tab: React.FC<TabProps>;
174
+ declare const Tabs: React.FC<TabsProps>;
175
+
176
+ export { Tab, type TabProps, Tabs, type TabsItem, type TabsProps, type TabsVariant };