@xaui/native 0.0.26 → 0.0.28

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 (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -228
  3. package/dist/alert/index.cjs +92 -166
  4. package/dist/alert/index.js +2 -1
  5. package/dist/app-bar/index.cjs +24 -98
  6. package/dist/app-bar/index.js +2 -1
  7. package/dist/autocomplete/index.cjs +192 -281
  8. package/dist/autocomplete/index.js +36 -48
  9. package/dist/avatar/index.cjs +59 -133
  10. package/dist/avatar/index.js +2 -1
  11. package/dist/badge/index.cjs +26 -99
  12. package/dist/badge/index.js +2 -1
  13. package/dist/bottom-sheet/index.cjs +5 -456
  14. package/dist/bottom-sheet/index.js +4 -363
  15. package/dist/bottom-tab-bar/index.cjs +93 -167
  16. package/dist/bottom-tab-bar/index.js +2 -2
  17. package/dist/button/index.cjs +73 -525
  18. package/dist/button/index.js +3 -2
  19. package/dist/card/index.cjs +76 -169
  20. package/dist/card/index.js +2 -2
  21. package/dist/carousel/index.cjs +68 -145
  22. package/dist/carousel/index.js +1 -1
  23. package/dist/chart/index.cjs +132 -173
  24. package/dist/checkbox/index.cjs +70 -143
  25. package/dist/checkbox/index.js +2 -1
  26. package/dist/chip/index.cjs +89 -164
  27. package/dist/chip/index.js +2 -1
  28. package/dist/chunk-BD72HIPR.cjs +75 -0
  29. package/dist/chunk-DHSTKO3K.cjs +19 -0
  30. package/dist/{chunk-CZFDZPAS.js → chunk-DXXNBF5P.js} +5 -0
  31. package/dist/{chunk-UI5L26KD.js → chunk-F7WH4DMG.js} +1 -1
  32. package/dist/chunk-GBHQCAKW.js +19 -0
  33. package/dist/chunk-HC2SSHNU.js +368 -0
  34. package/dist/chunk-HSPTLUFA.cjs +7 -0
  35. package/dist/chunk-JEGEPGVU.js +287 -0
  36. package/dist/chunk-KTLGDLCB.cjs +287 -0
  37. package/dist/{chunk-GHCVNQET.js → chunk-LTKYHG5V.js} +5 -12
  38. package/dist/{chunk-ULJSCNPE.js → chunk-LUBWRVI2.js} +1 -1
  39. package/dist/chunk-OQ2BLOOG.cjs +138 -0
  40. package/dist/chunk-QMYWIWSX.cjs +384 -0
  41. package/dist/chunk-XFPPR2VB.cjs +368 -0
  42. package/dist/core/index.cjs +22 -168
  43. package/dist/core/index.d.cts +1 -1
  44. package/dist/core/index.d.ts +1 -1
  45. package/dist/core/index.js +5 -3
  46. package/dist/datepicker/index.cjs +239 -320
  47. package/dist/datepicker/index.js +2 -1
  48. package/dist/divider/index.cjs +5 -145
  49. package/dist/divider/index.js +3 -2
  50. package/dist/drawer/index.cjs +39 -112
  51. package/dist/drawer/index.js +2 -1
  52. package/dist/expansion-panel/index.cjs +91 -230
  53. package/dist/expansion-panel/index.js +3 -2
  54. package/dist/fab/index.cjs +6 -722
  55. package/dist/fab/index.js +4 -3
  56. package/dist/fab-menu/index.cjs +81 -814
  57. package/dist/fab-menu/index.js +4 -3
  58. package/dist/feature-discovery/index.cjs +72 -139
  59. package/dist/feature-discovery/index.js +2 -2
  60. package/dist/index.cjs +1 -18
  61. package/dist/indicator/index.cjs +5 -445
  62. package/dist/indicator/index.js +3 -2
  63. package/dist/input/index.cjs +214 -282
  64. package/dist/input/index.js +2 -2
  65. package/dist/list/index.cjs +71 -146
  66. package/dist/list/index.js +2 -1
  67. package/dist/menu/index.cjs +59 -127
  68. package/dist/menu/index.js +2 -2
  69. package/dist/menubox/index.cjs +60 -132
  70. package/dist/menubox/index.js +2 -1
  71. package/dist/pager/index.cjs +42 -80
  72. package/dist/progress/index.cjs +43 -114
  73. package/dist/progress/index.js +2 -1
  74. package/dist/radio/index.cjs +82 -154
  75. package/dist/radio/index.js +2 -1
  76. package/dist/segment-button/index.cjs +60 -147
  77. package/dist/segment-button/index.js +2 -2
  78. package/dist/select/index.cjs +149 -224
  79. package/dist/select/index.js +10 -22
  80. package/dist/skeleton/index.cjs +23 -94
  81. package/dist/skeleton/index.js +2 -2
  82. package/dist/slider/index.cjs +77 -156
  83. package/dist/slider/index.js +2 -1
  84. package/dist/snackbar/index.cjs +420 -0
  85. package/dist/snackbar/index.d.cts +175 -0
  86. package/dist/snackbar/index.d.ts +175 -0
  87. package/dist/snackbar/index.js +420 -0
  88. package/dist/stepper/index.cjs +121 -195
  89. package/dist/stepper/index.js +2 -1
  90. package/dist/switch/index.cjs +48 -121
  91. package/dist/switch/index.js +2 -1
  92. package/dist/tabs/index.cjs +67 -151
  93. package/dist/tabs/index.js +2 -1
  94. package/dist/timepicker/index.cjs +135 -593
  95. package/dist/timepicker/index.js +24 -383
  96. package/dist/toolbar/index.cjs +59 -128
  97. package/dist/toolbar/index.js +2 -1
  98. package/dist/typography/index.cjs +37 -92
  99. package/dist/typography/index.d.cts +1 -1
  100. package/dist/typography/index.d.ts +1 -1
  101. package/dist/typography/index.js +20 -1
  102. package/dist/view/index.cjs +178 -223
  103. package/package.json +7 -1
  104. package/dist/chunk-3XSXTM3G.js +0 -661
  105. package/dist/chunk-4KSZLONZ.js +0 -79
  106. package/dist/chunk-I4V5Y5GD.js +0 -76
  107. package/dist/chunk-URBEEDFX.js +0 -79
@@ -0,0 +1,287 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkQMYWIWSXcjs = require('./chunk-QMYWIWSX.cjs');
4
+
5
+
6
+ var _chunkOQ2BLOOGcjs = require('./chunk-OQ2BLOOG.cjs');
7
+
8
+ // src/components/fab/fab.tsx
9
+ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
10
+ var _reactnative = require('react-native');
11
+
12
+ // src/components/fab/fab.style.ts
13
+
14
+ var styles = _reactnative.StyleSheet.create({
15
+ container: {
16
+ alignSelf: "flex-start"
17
+ },
18
+ fab: {
19
+ flexDirection: "row",
20
+ alignItems: "center",
21
+ justifyContent: "center",
22
+ overflow: "hidden"
23
+ },
24
+ contentContainer: {
25
+ flexDirection: "row",
26
+ alignItems: "center",
27
+ justifyContent: "center",
28
+ gap: 12
29
+ },
30
+ label: {
31
+ fontWeight: "500"
32
+ },
33
+ disabled: {
34
+ opacity: 0.5
35
+ }
36
+ });
37
+
38
+ // src/components/fab/fab.hook.ts
39
+
40
+ var _core = require('@xaui/core');
41
+ function useFabSizeStyles(size) {
42
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
43
+ const sizeStyles = _react.useMemo.call(void 0, () => {
44
+ const sizes = {
45
+ sm: {
46
+ width: 40,
47
+ height: 40,
48
+ borderRadius: theme.borderRadius.lg,
49
+ iconSize: 24,
50
+ fontSize: theme.fontSizes.sm
51
+ },
52
+ md: {
53
+ width: 56,
54
+ height: 56,
55
+ borderRadius: theme.borderRadius.xl,
56
+ iconSize: 24,
57
+ fontSize: theme.fontSizes.md
58
+ },
59
+ lg: {
60
+ width: 96,
61
+ height: 96,
62
+ borderRadius: theme.borderRadius["2xl"],
63
+ iconSize: 36,
64
+ fontSize: theme.fontSizes.lg
65
+ }
66
+ };
67
+ return sizes[size];
68
+ }, [size, theme]);
69
+ const extendedSizeStyles = _react.useMemo.call(void 0, () => {
70
+ const sizes = {
71
+ sm: {
72
+ height: 40,
73
+ borderRadius: theme.borderRadius.lg,
74
+ paddingHorizontal: theme.spacing.md,
75
+ iconSize: 20,
76
+ fontSize: theme.fontSizes.sm
77
+ },
78
+ md: {
79
+ height: 56,
80
+ borderRadius: theme.borderRadius.xl,
81
+ paddingHorizontal: theme.spacing.lg,
82
+ iconSize: 24,
83
+ fontSize: theme.fontSizes.md
84
+ },
85
+ lg: {
86
+ height: 80,
87
+ borderRadius: theme.borderRadius["2xl"],
88
+ paddingHorizontal: theme.spacing.xl,
89
+ iconSize: 28,
90
+ fontSize: theme.fontSizes.lg
91
+ }
92
+ };
93
+ return sizes[size];
94
+ }, [size, theme]);
95
+ return { sizeStyles, extendedSizeStyles };
96
+ }
97
+ function useFabVariantStyles(themeColor, variant, elevation = 0) {
98
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
99
+ const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
100
+ const colorScheme = theme.colors[safeThemeColor];
101
+ const variantStyles = _react.useMemo.call(void 0, () => {
102
+ const variantMap = {
103
+ solid: {
104
+ backgroundColor: colorScheme.main,
105
+ borderWidth: 0
106
+ },
107
+ flat: {
108
+ backgroundColor: colorScheme.background,
109
+ borderWidth: 0
110
+ },
111
+ outlined: {
112
+ backgroundColor: "transparent",
113
+ borderWidth: theme.borderWidth.md,
114
+ borderColor: colorScheme.main
115
+ }
116
+ };
117
+ const baseStyle = variantMap[variant];
118
+ const shouldApplyElevation = variant !== "outlined";
119
+ const shadowStyles = elevation === 0 ? {} : elevation === 1 ? theme.shadows.sm : elevation === 2 ? theme.shadows.md : elevation === 3 ? theme.shadows.lg : theme.shadows.xl;
120
+ return {
121
+ ...baseStyle,
122
+ ...shouldApplyElevation ? shadowStyles : {},
123
+ ...shouldApplyElevation && elevation > 0 ? { elevation } : {}
124
+ };
125
+ }, [variant, colorScheme, theme, elevation]);
126
+ return variantStyles;
127
+ }
128
+ function useFabIconColor(themeColor, variant) {
129
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
130
+ const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
131
+ const colorScheme = theme.colors[safeThemeColor];
132
+ const iconColor = _react.useMemo.call(void 0, () => {
133
+ if (variant === "solid") {
134
+ return colorScheme.foreground;
135
+ }
136
+ return colorScheme.main;
137
+ }, [variant, colorScheme]);
138
+ return { iconColor };
139
+ }
140
+ function useFabRadiusValue(radius, fallback) {
141
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
142
+ return _react.useMemo.call(void 0, () => {
143
+ if (!radius) return fallback;
144
+ const radiusMap = {
145
+ none: theme.borderRadius.none,
146
+ sm: theme.borderRadius.sm,
147
+ md: theme.borderRadius.md,
148
+ lg: theme.borderRadius.lg,
149
+ full: theme.borderRadius.full
150
+ };
151
+ return radiusMap[radius];
152
+ }, [fallback, radius, theme]);
153
+ }
154
+
155
+ // src/components/fab/fab.animation.ts
156
+
157
+ var runFabPressInAnimation = (animatedScale, animatedOpacity) => {
158
+ _reactnative.Animated.parallel([
159
+ _reactnative.Animated.spring(animatedScale, {
160
+ toValue: 0.92,
161
+ useNativeDriver: true,
162
+ speed: 50,
163
+ bounciness: 0
164
+ }),
165
+ _reactnative.Animated.timing(animatedOpacity, {
166
+ toValue: 0.85,
167
+ duration: 100,
168
+ useNativeDriver: true
169
+ })
170
+ ]).start();
171
+ };
172
+ var runFabPressOutAnimation = (animatedScale, animatedOpacity) => {
173
+ _reactnative.Animated.parallel([
174
+ _reactnative.Animated.spring(animatedScale, {
175
+ toValue: 1,
176
+ useNativeDriver: true,
177
+ speed: 50,
178
+ bounciness: 0
179
+ }),
180
+ _reactnative.Animated.timing(animatedOpacity, {
181
+ toValue: 1,
182
+ duration: 100,
183
+ useNativeDriver: true
184
+ })
185
+ ]).start();
186
+ };
187
+
188
+ // src/components/fab/fab.tsx
189
+ var Fab = ({
190
+ icon,
191
+ label,
192
+ themeColor = "primary",
193
+ variant = "solid",
194
+ size = "md",
195
+ radius,
196
+ isDisabled = false,
197
+ isLoading = false,
198
+ elevation = 0,
199
+ customAppearance,
200
+ onPress,
201
+ onLongPress,
202
+ onPressIn,
203
+ onPressOut
204
+ }) => {
205
+ const animatedScale = _react2.default.useRef(new _reactnative.Animated.Value(1)).current;
206
+ const animatedOpacity = _react2.default.useRef(new _reactnative.Animated.Value(1)).current;
207
+ const { sizeStyles, extendedSizeStyles } = useFabSizeStyles(size);
208
+ const variantStyles = useFabVariantStyles(themeColor, variant, elevation);
209
+ const { iconColor } = useFabIconColor(themeColor, variant);
210
+ const isExtended = !!label;
211
+ const resolvedRadius = useFabRadiusValue(
212
+ radius,
213
+ isExtended ? extendedSizeStyles.borderRadius : sizeStyles.borderRadius
214
+ );
215
+ const handlePressIn = (event) => {
216
+ if (!isDisabled && !isLoading) {
217
+ runFabPressInAnimation(animatedScale, animatedOpacity);
218
+ }
219
+ _optionalChain([onPressIn, 'optionalCall', _ => _(event)]);
220
+ };
221
+ const handlePressOut = (event) => {
222
+ if (!isDisabled && !isLoading) {
223
+ runFabPressOutAnimation(animatedScale, animatedOpacity);
224
+ }
225
+ _optionalChain([onPressOut, 'optionalCall', _2 => _2(event)]);
226
+ };
227
+ const fabDimensionStyles = isExtended ? {
228
+ height: extendedSizeStyles.height,
229
+ borderRadius: resolvedRadius,
230
+ paddingHorizontal: extendedSizeStyles.paddingHorizontal
231
+ } : {
232
+ width: sizeStyles.width,
233
+ height: sizeStyles.height,
234
+ borderRadius: resolvedRadius
235
+ };
236
+ return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, _optionalChain([customAppearance, 'optionalAccess', _3 => _3.container])] }, /* @__PURE__ */ _react2.default.createElement(
237
+ _reactnative.Pressable,
238
+ {
239
+ onPress: isDisabled || isLoading ? void 0 : onPress,
240
+ onLongPress: isDisabled || isLoading ? void 0 : onLongPress,
241
+ onPressIn: handlePressIn,
242
+ onPressOut: handlePressOut,
243
+ disabled: isDisabled || isLoading
244
+ },
245
+ /* @__PURE__ */ _react2.default.createElement(
246
+ _reactnative.Animated.View,
247
+ {
248
+ style: [
249
+ styles.fab,
250
+ fabDimensionStyles,
251
+ variantStyles,
252
+ isDisabled && styles.disabled,
253
+ {
254
+ transform: [{ scale: animatedScale }],
255
+ opacity: animatedOpacity
256
+ },
257
+ _optionalChain([customAppearance, 'optionalAccess', _4 => _4.fab])
258
+ ]
259
+ },
260
+ isLoading ? /* @__PURE__ */ _react2.default.createElement(
261
+ _chunkQMYWIWSXcjs.ActivityIndicator,
262
+ {
263
+ variant: "circular",
264
+ themeColor: variant === "solid" ? void 0 : themeColor,
265
+ color: variant === "solid" ? iconColor : void 0,
266
+ size: isExtended ? extendedSizeStyles.iconSize : sizeStyles.iconSize
267
+ }
268
+ ) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.contentContainer }, icon, isExtended && /* @__PURE__ */ _react2.default.createElement(
269
+ _reactnative.Text,
270
+ {
271
+ style: [
272
+ styles.label,
273
+ {
274
+ fontSize: isExtended ? extendedSizeStyles.fontSize : sizeStyles.fontSize,
275
+ color: iconColor
276
+ }
277
+ ]
278
+ },
279
+ label
280
+ ))
281
+ )
282
+ ));
283
+ };
284
+
285
+
286
+
287
+ exports.Fab = Fab;
@@ -1,9 +1,3 @@
1
- // src/core/theme-context.tsx
2
- import React3, { createContext as createContext2 } from "react";
3
- import { useColorScheme } from "react-native";
4
- import { defaultTheme } from "@xaui/core/theme";
5
- import { colors } from "@xaui/core/palette";
6
-
7
1
  // src/core/portal/portal.tsx
8
2
  import { useContext, useEffect, useLayoutEffect, useRef } from "react";
9
3
 
@@ -57,6 +51,10 @@ var PortalHost = ({ children }) => {
57
51
  };
58
52
 
59
53
  // src/core/theme-context.tsx
54
+ import React3, { createContext as createContext2 } from "react";
55
+ import { useColorScheme } from "react-native";
56
+ import { defaultTheme } from "@xaui/core/theme";
57
+ import { colors } from "@xaui/core/palette";
60
58
  var XUIThemeContext = createContext2(null);
61
59
  function XUIProvider({
62
60
  children,
@@ -128,9 +126,6 @@ function useBorderRadiusStyles(radius) {
128
126
  return borderRadius;
129
127
  }
130
128
 
131
- // src/core/index.ts
132
- import { defaultDarkTheme, defaultTheme as defaultTheme2 } from "@xaui/core/theme";
133
-
134
129
  export {
135
130
  Portal,
136
131
  PortalHost,
@@ -139,7 +134,5 @@ export {
139
134
  useXUITheme,
140
135
  useXUIColors,
141
136
  useXUIPalette,
142
- useBorderRadiusStyles,
143
- defaultDarkTheme,
144
- defaultTheme2 as defaultTheme
137
+ useBorderRadiusStyles
145
138
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useXUITheme
3
- } from "./chunk-GHCVNQET.js";
3
+ } from "./chunk-LTKYHG5V.js";
4
4
 
5
5
  // src/components/divider/divider.tsx
6
6
  import React from "react";
@@ -0,0 +1,138 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/core/portal/portal.tsx
2
+ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
3
+
4
+ // src/core/portal/portal-context.ts
5
+
6
+ var PortalContext = _react.createContext.call(void 0, null);
7
+
8
+ // src/core/portal/portal.tsx
9
+ var portalId = 0;
10
+ var Portal = ({ children }) => {
11
+ const context = _react.useContext.call(void 0, PortalContext);
12
+ const keyRef = _react.useRef.call(void 0, `portal-${++portalId}`);
13
+ _react.useLayoutEffect.call(void 0, () => {
14
+ if (!context) return;
15
+ context.addPortal(keyRef.current, children);
16
+ }, [children, context]);
17
+ _react.useEffect.call(void 0, () => {
18
+ if (!context) return;
19
+ const key = keyRef.current;
20
+ return () => {
21
+ context.removePortal(key);
22
+ };
23
+ }, [context]);
24
+ return null;
25
+ };
26
+
27
+ // src/core/portal/portal-host.tsx
28
+
29
+ var _reactnative = require('react-native');
30
+ var hostStyles = _reactnative.StyleSheet.create({
31
+ container: {
32
+ flex: 1
33
+ }
34
+ });
35
+ var PortalHost = ({ children }) => {
36
+ const portals = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
37
+ const [, forceUpdate] = _react.useState.call(void 0, 0);
38
+ const addPortal = _react.useCallback.call(void 0, (key, element) => {
39
+ portals.current.set(key, element);
40
+ forceUpdate((n) => n + 1);
41
+ }, []);
42
+ const removePortal = _react.useCallback.call(void 0, (key) => {
43
+ portals.current.delete(key);
44
+ forceUpdate((n) => n + 1);
45
+ }, []);
46
+ const contextValue = _react.useMemo.call(void 0,
47
+ () => ({ addPortal, removePortal }),
48
+ [addPortal, removePortal]
49
+ );
50
+ return /* @__PURE__ */ _react2.default.createElement(PortalContext.Provider, { value: contextValue }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: hostStyles.container }, children, Array.from(portals.current.entries()).map(([key, element]) => /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, { key }, element))));
51
+ };
52
+
53
+ // src/core/theme-context.tsx
54
+
55
+
56
+ var _theme = require('@xaui/core/theme');
57
+ var _palette = require('@xaui/core/palette');
58
+ var XUIThemeContext = _react.createContext.call(void 0, null);
59
+ function XUIProvider({
60
+ children,
61
+ theme: lightTheme,
62
+ darkTheme
63
+ }) {
64
+ const colorScheme = _nullishCoalesce(_reactnative.useColorScheme.call(void 0, ), () => ( "light"));
65
+ const theme = _react2.default.useMemo(() => {
66
+ if (!darkTheme && !lightTheme) return _theme.defaultTheme;
67
+ const activeTheme = colorScheme === "dark" && darkTheme ? darkTheme : lightTheme;
68
+ const mode = colorScheme === "dark" && darkTheme ? "dark" : "light";
69
+ if (!activeTheme) return _theme.defaultTheme;
70
+ return {
71
+ ..._theme.defaultTheme,
72
+ ...activeTheme,
73
+ mode,
74
+ colors: {
75
+ ..._theme.defaultTheme.colors,
76
+ ...activeTheme.colors
77
+ },
78
+ fontFamilies: {
79
+ ..._theme.defaultTheme.fontFamilies,
80
+ ...activeTheme.fontFamilies
81
+ },
82
+ fontSizes: {
83
+ ..._theme.defaultTheme.fontSizes,
84
+ ...activeTheme.fontSizes
85
+ },
86
+ palette: _palette.colors
87
+ };
88
+ }, [lightTheme, darkTheme, colorScheme]);
89
+ return /* @__PURE__ */ _react2.default.createElement(XUIThemeContext.Provider, { value: theme }, /* @__PURE__ */ _react2.default.createElement(PortalHost, null, children));
90
+ }
91
+
92
+ // src/core/theme-hooks.ts
93
+
94
+
95
+ function useColorMode() {
96
+ const nativeScheme = _reactnative.useColorScheme.call(void 0, );
97
+ return _nullishCoalesce(nativeScheme, () => ( "light"));
98
+ }
99
+ function useXUITheme() {
100
+ const theme = _react.useContext.call(void 0, XUIThemeContext);
101
+ if (!theme) {
102
+ throw new Error("useXUITheme must be used within XUIProvider");
103
+ }
104
+ return theme;
105
+ }
106
+ function useXUIColors() {
107
+ const theme = useXUITheme();
108
+ return theme.colors;
109
+ }
110
+ function useXUIPalette() {
111
+ const theme = useXUITheme();
112
+ return _react.useMemo.call(void 0, () => theme.palette, [theme]);
113
+ }
114
+ function useBorderRadiusStyles(radius) {
115
+ const theme = useXUITheme();
116
+ const borderRadius = _react.useMemo.call(void 0, () => {
117
+ const radiusMap = {
118
+ none: theme.borderRadius.none,
119
+ sm: theme.borderRadius.sm,
120
+ md: theme.borderRadius.md,
121
+ lg: theme.borderRadius.lg,
122
+ full: theme.borderRadius.full
123
+ };
124
+ return { borderRadius: radiusMap[radius] };
125
+ }, [radius, theme]);
126
+ return borderRadius;
127
+ }
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+ exports.Portal = Portal; exports.PortalHost = PortalHost; exports.XUIProvider = XUIProvider; exports.useColorMode = useColorMode; exports.useXUITheme = useXUITheme; exports.useXUIColors = useXUIColors; exports.useXUIPalette = useXUIPalette; exports.useBorderRadiusStyles = useBorderRadiusStyles;