@xaui/native 0.2.7 → 0.9.1-alpha.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 (224) hide show
  1. package/dist/chunk-JDS6KGCM.cjs +791 -0
  2. package/dist/chunk-T3ZI2PZ6.js +791 -0
  3. package/dist/index.cjs +32 -1
  4. package/dist/index.d.cts +2 -2
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +32 -0
  7. package/dist/theme/index.cjs +32 -0
  8. package/dist/theme/index.d.cts +669 -0
  9. package/dist/theme/index.d.ts +669 -0
  10. package/dist/theme/index.js +32 -0
  11. package/package.json +26 -249
  12. package/README.md +0 -178
  13. package/dist/alert/index.cjs +0 -356
  14. package/dist/alert/index.d.cts +0 -90
  15. package/dist/alert/index.d.ts +0 -90
  16. package/dist/alert/index.js +0 -356
  17. package/dist/app-bar/index.cjs +0 -148
  18. package/dist/app-bar/index.d.cts +0 -59
  19. package/dist/app-bar/index.d.ts +0 -59
  20. package/dist/app-bar/index.js +0 -148
  21. package/dist/autocomplete/index.cjs +0 -1122
  22. package/dist/autocomplete/index.d.cts +0 -88
  23. package/dist/autocomplete/index.d.ts +0 -88
  24. package/dist/autocomplete/index.js +0 -1122
  25. package/dist/avatar/index.cjs +0 -281
  26. package/dist/avatar/index.d.cts +0 -123
  27. package/dist/avatar/index.d.ts +0 -123
  28. package/dist/avatar/index.js +0 -281
  29. package/dist/badge/index.cjs +0 -197
  30. package/dist/badge/index.d.cts +0 -94
  31. package/dist/badge/index.d.ts +0 -94
  32. package/dist/badge/index.js +0 -197
  33. package/dist/bottom-sheet/index.cjs +0 -9
  34. package/dist/bottom-sheet/index.d.cts +0 -84
  35. package/dist/bottom-sheet/index.d.ts +0 -84
  36. package/dist/bottom-sheet/index.js +0 -9
  37. package/dist/bottom-tab-bar/index.cjs +0 -497
  38. package/dist/bottom-tab-bar/index.d.cts +0 -211
  39. package/dist/bottom-tab-bar/index.d.ts +0 -211
  40. package/dist/bottom-tab-bar/index.js +0 -497
  41. package/dist/button/index.cjs +0 -392
  42. package/dist/button/index.d.cts +0 -174
  43. package/dist/button/index.d.ts +0 -174
  44. package/dist/button/index.js +0 -392
  45. package/dist/button.type-j1ZdkkSl.d.cts +0 -4
  46. package/dist/button.type-j1ZdkkSl.d.ts +0 -4
  47. package/dist/card/index.cjs +0 -338
  48. package/dist/card/index.d.cts +0 -191
  49. package/dist/card/index.d.ts +0 -191
  50. package/dist/card/index.js +0 -338
  51. package/dist/carousel/index.cjs +0 -381
  52. package/dist/carousel/index.d.cts +0 -147
  53. package/dist/carousel/index.d.ts +0 -147
  54. package/dist/carousel/index.js +0 -381
  55. package/dist/chart/index.cjs +0 -1026
  56. package/dist/chart/index.d.cts +0 -218
  57. package/dist/chart/index.d.ts +0 -218
  58. package/dist/chart/index.js +0 -1026
  59. package/dist/checkbox/index.cjs +0 -443
  60. package/dist/checkbox/index.d.cts +0 -73
  61. package/dist/checkbox/index.d.ts +0 -73
  62. package/dist/checkbox/index.js +0 -443
  63. package/dist/chip/index.cjs +0 -503
  64. package/dist/chip/index.d.cts +0 -195
  65. package/dist/chip/index.d.ts +0 -195
  66. package/dist/chip/index.js +0 -503
  67. package/dist/chunk-4JFWQ5XT.js +0 -368
  68. package/dist/chunk-56RPWZD2.cjs +0 -9
  69. package/dist/chunk-7UFBLUMV.cjs +0 -136
  70. package/dist/chunk-A45TVXU5.js +0 -337
  71. package/dist/chunk-BYWUAPC4.cjs +0 -368
  72. package/dist/chunk-DECMUMCI.js +0 -0
  73. package/dist/chunk-DHSTKO3K.cjs +0 -19
  74. package/dist/chunk-DJ4Q37UT.cjs +0 -75
  75. package/dist/chunk-EUQDGTST.cjs +0 -1
  76. package/dist/chunk-GBHQCAKW.js +0 -19
  77. package/dist/chunk-RBSA4NH4.js +0 -136
  78. package/dist/chunk-SHBDANQN.js +0 -9
  79. package/dist/chunk-UGEINZM7.cjs +0 -290
  80. package/dist/chunk-UU4HHBDN.js +0 -290
  81. package/dist/chunk-VSZEXOUN.js +0 -384
  82. package/dist/chunk-YIEUN3G5.cjs +0 -384
  83. package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
  84. package/dist/chunk-ZY7IUTAT.js +0 -75
  85. package/dist/color-picker/index.cjs +0 -457
  86. package/dist/color-picker/index.d.cts +0 -124
  87. package/dist/color-picker/index.d.ts +0 -124
  88. package/dist/color-picker/index.js +0 -457
  89. package/dist/core/index.cjs +0 -24
  90. package/dist/core/index.d.cts +0 -28
  91. package/dist/core/index.d.ts +0 -28
  92. package/dist/core/index.js +0 -24
  93. package/dist/datepicker/index.cjs +0 -1625
  94. package/dist/datepicker/index.d.cts +0 -45
  95. package/dist/datepicker/index.d.ts +0 -45
  96. package/dist/datepicker/index.js +0 -1625
  97. package/dist/dialog/index.cjs +0 -372
  98. package/dist/dialog/index.d.cts +0 -151
  99. package/dist/dialog/index.d.ts +0 -151
  100. package/dist/dialog/index.js +0 -372
  101. package/dist/divider/index.cjs +0 -8
  102. package/dist/divider/index.d.cts +0 -30
  103. package/dist/divider/index.d.ts +0 -30
  104. package/dist/divider/index.js +0 -8
  105. package/dist/drawer/index.cjs +0 -237
  106. package/dist/drawer/index.d.cts +0 -58
  107. package/dist/drawer/index.d.ts +0 -58
  108. package/dist/drawer/index.js +0 -237
  109. package/dist/expansion-panel/index.cjs +0 -441
  110. package/dist/expansion-panel/index.d.cts +0 -153
  111. package/dist/expansion-panel/index.d.ts +0 -153
  112. package/dist/expansion-panel/index.js +0 -441
  113. package/dist/fab/index.cjs +0 -9
  114. package/dist/fab/index.d.cts +0 -10
  115. package/dist/fab/index.d.ts +0 -10
  116. package/dist/fab/index.js +0 -9
  117. package/dist/fab-menu/index.cjs +0 -330
  118. package/dist/fab-menu/index.d.cts +0 -125
  119. package/dist/fab-menu/index.d.ts +0 -125
  120. package/dist/fab-menu/index.js +0 -330
  121. package/dist/fab.type-CkUHmXU_.d.ts +0 -86
  122. package/dist/fab.type-DN0vtAh6.d.cts +0 -86
  123. package/dist/feature-discovery/index.cjs +0 -464
  124. package/dist/feature-discovery/index.d.cts +0 -82
  125. package/dist/feature-discovery/index.d.ts +0 -82
  126. package/dist/feature-discovery/index.js +0 -464
  127. package/dist/indicator/index.cjs +0 -8
  128. package/dist/indicator/index.d.cts +0 -47
  129. package/dist/indicator/index.d.ts +0 -47
  130. package/dist/indicator/index.js +0 -8
  131. package/dist/input/index.cjs +0 -1462
  132. package/dist/input/index.d.cts +0 -522
  133. package/dist/input/index.d.ts +0 -522
  134. package/dist/input/index.js +0 -1462
  135. package/dist/input-trigger/index.cjs +0 -197
  136. package/dist/input-trigger/index.d.cts +0 -11
  137. package/dist/input-trigger/index.d.ts +0 -11
  138. package/dist/input-trigger/index.js +0 -197
  139. package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
  140. package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
  141. package/dist/list/index.cjs +0 -395
  142. package/dist/list/index.d.cts +0 -188
  143. package/dist/list/index.d.ts +0 -188
  144. package/dist/list/index.js +0 -395
  145. package/dist/menu/index.cjs +0 -316
  146. package/dist/menu/index.d.cts +0 -115
  147. package/dist/menu/index.d.ts +0 -115
  148. package/dist/menu/index.js +0 -316
  149. package/dist/menubox/index.cjs +0 -297
  150. package/dist/menubox/index.d.cts +0 -98
  151. package/dist/menubox/index.d.ts +0 -98
  152. package/dist/menubox/index.js +0 -297
  153. package/dist/pager/index.cjs +0 -205
  154. package/dist/pager/index.d.cts +0 -93
  155. package/dist/pager/index.d.ts +0 -93
  156. package/dist/pager/index.js +0 -205
  157. package/dist/picker/index.cjs +0 -244
  158. package/dist/picker/index.d.cts +0 -121
  159. package/dist/picker/index.d.ts +0 -121
  160. package/dist/picker/index.js +0 -244
  161. package/dist/progress/index.cjs +0 -219
  162. package/dist/progress/index.d.cts +0 -47
  163. package/dist/progress/index.d.ts +0 -47
  164. package/dist/progress/index.js +0 -219
  165. package/dist/radio/index.cjs +0 -465
  166. package/dist/radio/index.d.cts +0 -145
  167. package/dist/radio/index.d.ts +0 -145
  168. package/dist/radio/index.js +0 -465
  169. package/dist/refresh-control/index.cjs +0 -45
  170. package/dist/refresh-control/index.d.cts +0 -55
  171. package/dist/refresh-control/index.d.ts +0 -55
  172. package/dist/refresh-control/index.js +0 -45
  173. package/dist/segment-button/index.cjs +0 -405
  174. package/dist/segment-button/index.d.cts +0 -141
  175. package/dist/segment-button/index.d.ts +0 -141
  176. package/dist/segment-button/index.js +0 -405
  177. package/dist/select/index.cjs +0 -878
  178. package/dist/select/index.d.cts +0 -192
  179. package/dist/select/index.d.ts +0 -192
  180. package/dist/select/index.js +0 -878
  181. package/dist/skeleton/index.cjs +0 -89
  182. package/dist/skeleton/index.d.cts +0 -45
  183. package/dist/skeleton/index.d.ts +0 -45
  184. package/dist/skeleton/index.js +0 -89
  185. package/dist/slider/index.cjs +0 -576
  186. package/dist/slider/index.d.cts +0 -171
  187. package/dist/slider/index.d.ts +0 -171
  188. package/dist/slider/index.js +0 -576
  189. package/dist/snackbar/index.cjs +0 -436
  190. package/dist/snackbar/index.d.cts +0 -174
  191. package/dist/snackbar/index.d.ts +0 -174
  192. package/dist/snackbar/index.js +0 -436
  193. package/dist/snippet/index.cjs +0 -314
  194. package/dist/snippet/index.d.cts +0 -95
  195. package/dist/snippet/index.d.ts +0 -95
  196. package/dist/snippet/index.js +0 -314
  197. package/dist/stepper/index.cjs +0 -550
  198. package/dist/stepper/index.d.cts +0 -137
  199. package/dist/stepper/index.d.ts +0 -137
  200. package/dist/stepper/index.js +0 -550
  201. package/dist/switch/index.cjs +0 -358
  202. package/dist/switch/index.d.cts +0 -28
  203. package/dist/switch/index.d.ts +0 -28
  204. package/dist/switch/index.js +0 -358
  205. package/dist/tabs/index.cjs +0 -440
  206. package/dist/tabs/index.d.cts +0 -180
  207. package/dist/tabs/index.d.ts +0 -180
  208. package/dist/tabs/index.js +0 -440
  209. package/dist/timepicker/index.cjs +0 -823
  210. package/dist/timepicker/index.d.cts +0 -215
  211. package/dist/timepicker/index.d.ts +0 -215
  212. package/dist/timepicker/index.js +0 -823
  213. package/dist/toolbar/index.cjs +0 -333
  214. package/dist/toolbar/index.d.cts +0 -100
  215. package/dist/toolbar/index.d.ts +0 -100
  216. package/dist/toolbar/index.js +0 -333
  217. package/dist/typography/index.cjs +0 -238
  218. package/dist/typography/index.d.cts +0 -113
  219. package/dist/typography/index.d.ts +0 -113
  220. package/dist/typography/index.js +0 -238
  221. package/dist/view/index.cjs +0 -1361
  222. package/dist/view/index.d.cts +0 -833
  223. package/dist/view/index.d.ts +0 -833
  224. package/dist/view/index.js +0 -1361
@@ -1,392 +0,0 @@
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 _chunkYIEUN3G5cjs = require('../chunk-YIEUN3G5.cjs');
4
- require('../chunk-56RPWZD2.cjs');
5
-
6
-
7
-
8
- var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
9
-
10
- // src/components/button/button.tsx
11
- var _react = require('react'); var _react2 = _interopRequireDefault(_react);
12
- var _reactnative = require('react-native');
13
-
14
- // src/components/button/button.style.ts
15
-
16
- var styles = _reactnative.StyleSheet.create({
17
- button: {
18
- flexDirection: "row",
19
- alignItems: "center",
20
- justifyContent: "center",
21
- overflow: "hidden"
22
- },
23
- contentContainer: {
24
- flexDirection: "row",
25
- alignItems: "center",
26
- justifyContent: "center",
27
- gap: 8
28
- },
29
- text: {
30
- fontWeight: "500",
31
- textAlign: "center"
32
- },
33
- startContent: {
34
- marginRight: 4
35
- },
36
- endContent: {
37
- marginLeft: 4
38
- },
39
- spinner: {
40
- marginHorizontal: 4
41
- },
42
- fullWidth: {
43
- flexShrink: 1,
44
- flexBasis: "auto",
45
- width: "100%"
46
- },
47
- disabled: {
48
- opacity: 0.5
49
- },
50
- disabledText: {
51
- opacity: 0.7
52
- }
53
- });
54
-
55
- // src/components/button/button.hook.ts
56
-
57
- var _core = require('@xaui/core');
58
- var useTextStyles = (themeColor, variant) => {
59
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
60
- const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
61
- const colorScheme = theme.colors[safeThemeColor];
62
- const textColor = _react.useMemo.call(void 0, () => {
63
- if (variant === "solid") return colorScheme.onMain;
64
- if (variant === "flat" || variant === "faded") return colorScheme.onContainer;
65
- return colorScheme.main;
66
- }, [variant, colorScheme]);
67
- return {
68
- textColor
69
- };
70
- };
71
- function useSizesStyles(size) {
72
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
73
- const sizeStyles = _react.useMemo.call(void 0, () => {
74
- const sizes = {
75
- xs: {
76
- paddingHorizontal: theme.spacing.sm,
77
- paddingVertical: theme.spacing.xs,
78
- minHeight: theme.componentSizes.xs,
79
- fontSize: theme.fontSizes.xs
80
- },
81
- sm: {
82
- paddingHorizontal: theme.spacing.md,
83
- paddingVertical: theme.spacing.xs,
84
- minHeight: theme.componentSizes.sm,
85
- fontSize: theme.fontSizes.sm
86
- },
87
- md: {
88
- paddingHorizontal: theme.spacing.md,
89
- paddingVertical: theme.spacing.sm,
90
- minHeight: theme.componentSizes.md,
91
- fontSize: theme.fontSizes.md
92
- },
93
- lg: {
94
- paddingHorizontal: theme.spacing.lg,
95
- paddingVertical: theme.spacing.md,
96
- minHeight: theme.componentSizes.lg,
97
- fontSize: theme.fontSizes.lg
98
- }
99
- };
100
- return sizes[size];
101
- }, [size, theme]);
102
- const spinnerSize = _react.useMemo.call(void 0, () => {
103
- const sizes = {
104
- xs: 14,
105
- sm: 16,
106
- md: 18,
107
- lg: 20
108
- };
109
- return sizes[size];
110
- }, [size]);
111
- return { sizeStyles, spinnerSize };
112
- }
113
- function useVariantSizesStyles(themeColor, variant, elevation = 0) {
114
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
115
- const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
116
- const colorScheme = theme.colors[safeThemeColor];
117
- const variantStyles = _react.useMemo.call(void 0, () => {
118
- const styles2 = {
119
- solid: {
120
- backgroundColor: colorScheme.main,
121
- borderWidth: 0
122
- },
123
- bordered: {
124
- backgroundColor: "transparent",
125
- borderWidth: theme.borderWidth.md,
126
- borderColor: colorScheme.main
127
- },
128
- flat: {
129
- backgroundColor: colorScheme.container,
130
- borderWidth: 0
131
- },
132
- light: {
133
- backgroundColor: "transparent",
134
- borderWidth: 0
135
- },
136
- faded: {
137
- backgroundColor: colorScheme.container,
138
- borderWidth: theme.borderWidth.md,
139
- borderColor: colorScheme.main
140
- }
141
- };
142
- const baseStyle = styles2[variant];
143
- const shouldApplyElevation = variant !== "bordered" && variant !== "light";
144
- const shadowStyles = elevation === 0 ? {} : elevation === 1 ? theme.shadows.sm : elevation === 2 ? theme.shadows.md : elevation === 3 ? theme.shadows.lg : theme.shadows.xl;
145
- return {
146
- ...baseStyle,
147
- ...shouldApplyElevation ? shadowStyles : {},
148
- ...shouldApplyElevation && elevation > 0 ? { elevation } : {}
149
- };
150
- }, [variant, colorScheme, theme, elevation]);
151
- return variantStyles;
152
- }
153
-
154
- // src/components/button/button.animation.ts
155
-
156
- var runPressInAnimation = (animatedScale, animatedOpacity) => {
157
- _reactnative.Animated.parallel([
158
- _reactnative.Animated.spring(animatedScale, {
159
- toValue: 0.975,
160
- useNativeDriver: true,
161
- speed: 50,
162
- bounciness: 0
163
- }),
164
- _reactnative.Animated.timing(animatedOpacity, {
165
- toValue: 0.9,
166
- duration: 100,
167
- useNativeDriver: true
168
- })
169
- ]).start();
170
- };
171
- var runPressOutAnimation = (animatedScale, animatedOpacity) => {
172
- _reactnative.Animated.parallel([
173
- _reactnative.Animated.spring(animatedScale, {
174
- toValue: 1,
175
- useNativeDriver: true,
176
- speed: 50,
177
- bounciness: 0
178
- }),
179
- _reactnative.Animated.timing(animatedOpacity, {
180
- toValue: 1,
181
- duration: 100,
182
- useNativeDriver: true
183
- })
184
- ]).start();
185
- };
186
-
187
- // src/components/button/button.tsx
188
- var Button = ({
189
- children,
190
- themeColor = "primary",
191
- variant = "solid",
192
- size = "md",
193
- radius = "md",
194
- startContent,
195
- endContent,
196
- spinnerPlacement = "start",
197
- fullWidth = false,
198
- isDisabled = false,
199
- isLoading = false,
200
- elevation = 0,
201
- customAppearance,
202
- onPress,
203
- onLongPress,
204
- onPressIn,
205
- onPressOut
206
- }) => {
207
- const animatedScale = _react2.default.useRef(new _reactnative.Animated.Value(1)).current;
208
- const animatedOpacity = _react2.default.useRef(new _reactnative.Animated.Value(1)).current;
209
- const { sizeStyles, spinnerSize } = useSizesStyles(size);
210
- const radiusStyles = _chunk7UFBLUMVcjs.useBorderRadiusStyles.call(void 0, radius);
211
- const variantStyles = useVariantSizesStyles(themeColor, variant, elevation);
212
- const { textColor } = useTextStyles(themeColor, variant);
213
- const handlePressIn = (event) => {
214
- if (!isDisabled && !isLoading) {
215
- runPressInAnimation(animatedScale, animatedOpacity);
216
- }
217
- _optionalChain([onPressIn, 'optionalCall', _ => _(event)]);
218
- };
219
- const handlePressOut = (event) => {
220
- if (!isDisabled && !isLoading) {
221
- runPressOutAnimation(animatedScale, animatedOpacity);
222
- }
223
- _optionalChain([onPressOut, 'optionalCall', _2 => _2(event)]);
224
- };
225
- const spinner = /* @__PURE__ */ _react2.default.createElement(
226
- _chunkYIEUN3G5cjs.ActivityIndicator,
227
- {
228
- variant: "circular",
229
- themeColor: variant === "solid" ? void 0 : themeColor,
230
- color: variant === "solid" ? textColor : void 0,
231
- size: spinnerSize
232
- }
233
- );
234
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [fullWidth && styles.fullWidth, _optionalChain([customAppearance, 'optionalAccess', _3 => _3.container])] }, /* @__PURE__ */ _react2.default.createElement(
235
- _reactnative.Pressable,
236
- {
237
- onPress: isDisabled || isLoading ? void 0 : onPress,
238
- onLongPress: isDisabled || isLoading ? void 0 : onLongPress,
239
- onPressIn: handlePressIn,
240
- onPressOut: handlePressOut,
241
- disabled: isDisabled || isLoading
242
- },
243
- /* @__PURE__ */ _react2.default.createElement(
244
- _reactnative.Animated.View,
245
- {
246
- style: [
247
- styles.button,
248
- sizeStyles,
249
- radiusStyles,
250
- variantStyles,
251
- fullWidth && styles.fullWidth,
252
- isDisabled && styles.disabled,
253
- {
254
- transform: [{ scale: animatedScale }],
255
- opacity: animatedOpacity
256
- },
257
- _optionalChain([customAppearance, 'optionalAccess', _4 => _4.button])
258
- ]
259
- },
260
- /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.contentContainer }, startContent && (!isLoading || spinnerPlacement !== "start") && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.startContent }, startContent), isLoading && spinnerPlacement === "start" && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.spinner }, spinner), /* @__PURE__ */ _react2.default.createElement(
261
- _reactnative.Text,
262
- {
263
- style: [
264
- styles.text,
265
- { fontSize: sizeStyles.fontSize, color: textColor },
266
- isDisabled && styles.disabledText,
267
- _optionalChain([customAppearance, 'optionalAccess', _5 => _5.text])
268
- ]
269
- },
270
- children
271
- ), isLoading && spinnerPlacement === "end" && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.spinner }, spinner), endContent && (!isLoading || spinnerPlacement !== "end") && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.endContent }, endContent))
272
- )
273
- ));
274
- };
275
-
276
- // src/components/button/icon-button.tsx
277
-
278
-
279
-
280
- // src/components/button/icon-button.style.ts
281
-
282
- var iconButtonStyles = _reactnative.StyleSheet.create({
283
- container: {
284
- alignItems: "center",
285
- justifyContent: "center"
286
- },
287
- button: {
288
- alignItems: "center",
289
- justifyContent: "center",
290
- aspectRatio: 1
291
- },
292
- disabled: {
293
- opacity: 0.5
294
- }
295
- });
296
-
297
- // src/components/button/icon-button.hook.ts
298
-
299
- var useIconButtonSizeStyles = (size) => {
300
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
301
- return _react.useMemo.call(void 0, () => {
302
- const sizeMap = {
303
- xs: { width: theme.componentSizes.xs, height: theme.componentSizes.xs },
304
- sm: { width: theme.componentSizes.sm, height: theme.componentSizes.sm },
305
- md: { width: theme.componentSizes.md, height: theme.componentSizes.md },
306
- lg: { width: theme.componentSizes.lg, height: theme.componentSizes.md }
307
- };
308
- return sizeMap[size];
309
- }, [size, theme]);
310
- };
311
-
312
- // src/components/button/icon-button.tsx
313
- var IconButton = ({
314
- icon,
315
- themeColor = "primary",
316
- variant = "solid",
317
- size = "md",
318
- radius = "md",
319
- isDisabled = false,
320
- isLoading = false,
321
- elevation = 0,
322
- customAppearance,
323
- onPress,
324
- onLongPress,
325
- onPressIn,
326
- onPressOut
327
- }) => {
328
- const animatedScale = _react2.default.useRef(new _reactnative.Animated.Value(1)).current;
329
- const animatedOpacity = _react2.default.useRef(new _reactnative.Animated.Value(1)).current;
330
- const sizeStyles = useIconButtonSizeStyles(size);
331
- const radiusStyles = _chunk7UFBLUMVcjs.useBorderRadiusStyles.call(void 0, radius);
332
- const variantStyles = useVariantSizesStyles(themeColor, variant, elevation);
333
- const { textColor } = useTextStyles(themeColor, variant);
334
- const handlePressIn = (event) => {
335
- if (!isDisabled && !isLoading) {
336
- runPressInAnimation(animatedScale, animatedOpacity);
337
- }
338
- _optionalChain([onPressIn, 'optionalCall', _6 => _6(event)]);
339
- };
340
- const handlePressOut = (event) => {
341
- if (!isDisabled && !isLoading) {
342
- runPressOutAnimation(animatedScale, animatedOpacity);
343
- }
344
- _optionalChain([onPressOut, 'optionalCall', _7 => _7(event)]);
345
- };
346
- const spinnerSize = {
347
- xs: 14,
348
- sm: 16,
349
- md: 18,
350
- lg: 20
351
- }[size];
352
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [iconButtonStyles.container, _optionalChain([customAppearance, 'optionalAccess', _8 => _8.container])] }, /* @__PURE__ */ _react2.default.createElement(
353
- _reactnative.Pressable,
354
- {
355
- onPress: isDisabled || isLoading ? void 0 : onPress,
356
- onLongPress: isDisabled || isLoading ? void 0 : onLongPress,
357
- onPressIn: handlePressIn,
358
- onPressOut: handlePressOut,
359
- disabled: isDisabled || isLoading
360
- },
361
- /* @__PURE__ */ _react2.default.createElement(
362
- _reactnative.Animated.View,
363
- {
364
- style: [
365
- iconButtonStyles.button,
366
- sizeStyles,
367
- radiusStyles,
368
- variantStyles,
369
- isDisabled && iconButtonStyles.disabled,
370
- {
371
- transform: [{ scale: animatedScale }],
372
- opacity: animatedOpacity
373
- },
374
- _optionalChain([customAppearance, 'optionalAccess', _9 => _9.button])
375
- ]
376
- },
377
- isLoading ? /* @__PURE__ */ _react2.default.createElement(
378
- _chunkYIEUN3G5cjs.ActivityIndicator,
379
- {
380
- variant: "circular",
381
- themeColor: variant === "solid" ? void 0 : themeColor,
382
- color: variant === "solid" ? textColor : void 0,
383
- size: spinnerSize
384
- }
385
- ) : icon
386
- )
387
- ));
388
- };
389
-
390
-
391
-
392
- exports.Button = Button; exports.IconButton = IconButton;
@@ -1,174 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { ViewStyle, TextStyle, GestureResponderEvent } from 'react-native';
3
- import { ThemeColor, Size } from '@xaui/core/types';
4
-
5
- type ButtonVariant = 'solid' | 'bordered' | 'flat' | 'light' | 'faded';
6
- type ButtonRadius = 'none' | 'sm' | 'md' | 'lg' | 'full';
7
- type SpinnerPlacement = 'start' | 'end';
8
- type ElevationLevel = 0 | 1 | 2 | 3 | 4;
9
- type ButtonCustomAppearance = {
10
- /**
11
- * Custom styles for the outer container
12
- */
13
- container?: ViewStyle;
14
- /**
15
- * Custom styles for the button
16
- */
17
- button?: ViewStyle;
18
- /**
19
- * Custom styles for the button text
20
- */
21
- text?: TextStyle;
22
- };
23
- type ButtonProps = {
24
- /**
25
- * The content to display in the button.
26
- */
27
- children: ReactNode;
28
- /**
29
- * The theme color of the button.
30
- * @default 'default'
31
- */
32
- themeColor?: ThemeColor;
33
- /**
34
- * The variant of the button.
35
- * @default 'solid'
36
- */
37
- variant?: ButtonVariant;
38
- /**
39
- * The size of the button.
40
- * @default 'md'
41
- */
42
- size?: Size;
43
- /**
44
- * The border radius of the button.
45
- * @default 'md'
46
- */
47
- radius?: ButtonRadius;
48
- /**
49
- * Content to display at the start of the button.
50
- */
51
- startContent?: ReactNode;
52
- /**
53
- * Content to display at the end of the button.
54
- */
55
- endContent?: ReactNode;
56
- /**
57
- * The placement of the spinner when isLoading is true.
58
- * @default 'start'
59
- */
60
- spinnerPlacement?: SpinnerPlacement;
61
- /**
62
- * Whether the button should take the full width of its container.
63
- * @default false
64
- */
65
- fullWidth?: boolean;
66
- /**
67
- * Whether the button is disabled.
68
- * @default false
69
- */
70
- isDisabled?: boolean;
71
- /**
72
- * Whether the button is in a loading state.
73
- * @default false
74
- */
75
- isLoading?: boolean;
76
- /**
77
- * Android elevation level from 0 to 4.
78
- * Does not apply to `bordered` and `light` variants.
79
- * @default 0
80
- */
81
- elevation?: ElevationLevel;
82
- /**
83
- * Custom appearance styles for button parts
84
- */
85
- customAppearance?: ButtonCustomAppearance;
86
- /**
87
- * Callback fired when the button is pressed.
88
- */
89
- onPress?: (event: GestureResponderEvent) => void;
90
- /**
91
- * Callback fired when the button is long pressed.
92
- */
93
- onLongPress?: (event: GestureResponderEvent) => void;
94
- /**
95
- * Callback fired when the button press starts.
96
- */
97
- onPressIn?: (event: GestureResponderEvent) => void;
98
- /**
99
- * Callback fired when the button press ends.
100
- */
101
- onPressOut?: (event: GestureResponderEvent) => void;
102
- };
103
-
104
- declare const Button: React.FC<ButtonProps>;
105
-
106
- type IconButtonProps = {
107
- /**
108
- * Icon to display in the button
109
- */
110
- icon: ReactNode;
111
- /**
112
- * Button size
113
- * @default 'md'
114
- */
115
- size?: Size;
116
- /**
117
- * Button variant
118
- * @default 'solid'
119
- */
120
- variant?: ButtonVariant;
121
- /**
122
- * Theme color
123
- * @default 'primary'
124
- */
125
- themeColor?: ThemeColor;
126
- /**
127
- * Border radius
128
- * @default 'md'
129
- */
130
- radius?: ButtonRadius;
131
- /**
132
- * Whether the button is disabled
133
- * @default false
134
- */
135
- isDisabled?: boolean;
136
- /**
137
- * Whether the button is loading
138
- * @default false
139
- */
140
- isLoading?: boolean;
141
- /**
142
- * Android elevation level from 0 to 4.
143
- * Does not apply to `bordered` and `light` variants.
144
- * @default 0
145
- */
146
- elevation?: ElevationLevel;
147
- /**
148
- * Custom appearance overrides
149
- */
150
- customAppearance?: {
151
- container?: ViewStyle;
152
- button?: ViewStyle;
153
- };
154
- /**
155
- * Press handler
156
- */
157
- onPress?: (event: GestureResponderEvent) => void;
158
- /**
159
- * Long press handler
160
- */
161
- onLongPress?: (event: GestureResponderEvent) => void;
162
- /**
163
- * Press in handler
164
- */
165
- onPressIn?: (event: GestureResponderEvent) => void;
166
- /**
167
- * Press out handler
168
- */
169
- onPressOut?: (event: GestureResponderEvent) => void;
170
- };
171
-
172
- declare const IconButton: React.FC<IconButtonProps>;
173
-
174
- export { Button, type ButtonProps, type ButtonRadius, type ButtonVariant, IconButton, type IconButtonProps, type SpinnerPlacement };