@xaui/native 0.2.8 → 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 -340
  14. package/dist/alert/index.d.cts +0 -46
  15. package/dist/alert/index.d.ts +0 -46
  16. package/dist/alert/index.js +0 -340
  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,340 +0,0 @@
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(); } } 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; }require('../chunk-56RPWZD2.cjs');
2
-
3
-
4
- var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
5
-
6
- // src/components/alert/alert.tsx
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
- var _react = require('react'); var _react2 = _interopRequireDefault(_react);
15
- var _reactnative = require('react-native');
16
-
17
-
18
-
19
-
20
- var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
21
- var _reactnativeworklets = require('react-native-worklets');
22
-
23
- // src/components/alert/alert.style.ts
24
-
25
- var styles = _reactnative.StyleSheet.create({
26
- container: {
27
- flexDirection: "row",
28
- alignItems: "center",
29
- width: "100%",
30
- gap: 12
31
- },
32
- mainWrapper: {
33
- flex: 1,
34
- justifyContent: "center",
35
- gap: 2
36
- },
37
- title: {
38
- fontWeight: "600"
39
- },
40
- description: {
41
- fontWeight: "400"
42
- },
43
- iconWrapper: {
44
- width: 36,
45
- height: 36,
46
- borderRadius: 18,
47
- alignItems: "center",
48
- justifyContent: "center"
49
- },
50
- iconText: {
51
- fontWeight: "600"
52
- },
53
- closeButton: {
54
- alignSelf: "flex-start",
55
- padding: 4
56
- },
57
- extraContent: {
58
- marginTop: 4
59
- }
60
- });
61
-
62
- // src/components/alert/alert.hook.ts
63
-
64
- var _core = require('@xaui/core');
65
- var useAlertColorScheme = (themeColor) => {
66
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
67
- const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
68
- return {
69
- theme,
70
- colorScheme: theme.colors[safeThemeColor],
71
- isDefault: safeThemeColor === "default"
72
- };
73
- };
74
- var useAlertContainerStyles = (themeColor, variant) => {
75
- const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
76
- const containerStyles = _react.useMemo.call(void 0, () => {
77
- const backgroundColor = variant === "solid" ? colorScheme.main : variant === "flat" ? colorScheme.container : variant === "faded" ? _core.withOpacity.call(void 0, colorScheme.container, 0.75) : "transparent";
78
- const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.md : 0;
79
- const borderColor = variant === "bordered" ? _core.withOpacity.call(void 0, colorScheme.main, 0.75) : variant === "faded" ? _core.withOpacity.call(void 0, isDefault ? theme.colors.foreground : colorScheme.main, 0.25) : "transparent";
80
- return {
81
- backgroundColor,
82
- borderColor,
83
- borderWidth,
84
- paddingVertical: theme.spacing.sm,
85
- paddingHorizontal: theme.spacing.md
86
- };
87
- }, [colorScheme, isDefault, theme, variant]);
88
- return containerStyles;
89
- };
90
- var useAlertIconWrapperStyles = (themeColor, variant) => {
91
- const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
92
- const iconWrapperStyles = _react.useMemo.call(void 0, () => {
93
- const backgroundColor = variant === "solid" ? _core.withOpacity.call(void 0, colorScheme.onMain, 0.16) : _core.withOpacity.call(void 0, isDefault ? theme.colors.foreground : colorScheme.main, 0.12);
94
- const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.xs : 0;
95
- const borderColor = _core.withOpacity.call(void 0,
96
- isDefault ? theme.colors.foreground : colorScheme.main,
97
- 0.2
98
- );
99
- return {
100
- backgroundColor,
101
- borderColor,
102
- borderWidth
103
- };
104
- }, [colorScheme, isDefault, theme, variant]);
105
- return iconWrapperStyles;
106
- };
107
- var useAlertTextStyles = (themeColor, variant) => {
108
- const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
109
- const textStyles = _react.useMemo.call(void 0, () => {
110
- const baseTextColor = variant === "solid" ? colorScheme.onMain : variant === "flat" || variant === "faded" ? isDefault ? theme.colors.foreground : colorScheme.onContainer : isDefault ? theme.colors.foreground : colorScheme.main;
111
- return {
112
- titleStyles: {
113
- color: baseTextColor,
114
- fontSize: theme.fontSizes.sm,
115
- fontWeight: theme.fontWeights.semibold
116
- },
117
- descriptionStyles: {
118
- color: _core.withOpacity.call(void 0, baseTextColor, 0.75),
119
- fontSize: theme.fontSizes.xs,
120
- fontWeight: theme.fontWeights.normal
121
- },
122
- iconColor: baseTextColor,
123
- closeButtonColor: baseTextColor
124
- };
125
- }, [colorScheme, isDefault, theme, variant]);
126
- return textStyles;
127
- };
128
-
129
- // src/components/alert/alert-icons.tsx
130
-
131
- var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);
132
- function InfoIcon({ color, size }) {
133
- return /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ _react2.default.createElement(
134
- _reactnativesvg.Line,
135
- {
136
- x1: 12,
137
- y1: 10,
138
- x2: 12,
139
- y2: 16,
140
- stroke: color,
141
- strokeWidth: 2,
142
- strokeLinecap: "round"
143
- }
144
- ), /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 7, r: 1, fill: color }));
145
- }
146
- function SuccessIcon({ color, size }) {
147
- return /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ _react2.default.createElement(
148
- _reactnativesvg.Path,
149
- {
150
- d: "M7 12.5L10.2 15.5L17 9",
151
- stroke: color,
152
- strokeWidth: 2,
153
- strokeLinecap: "round",
154
- strokeLinejoin: "round"
155
- }
156
- ));
157
- }
158
- function WarningIcon({ color, size }) {
159
- return /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ _react2.default.createElement(
160
- _reactnativesvg.Path,
161
- {
162
- d: "M12 3L22 20H2L12 3Z",
163
- stroke: color,
164
- strokeWidth: 2,
165
- strokeLinejoin: "round"
166
- }
167
- ), /* @__PURE__ */ _react2.default.createElement(
168
- _reactnativesvg.Line,
169
- {
170
- x1: 12,
171
- y1: 9,
172
- x2: 12,
173
- y2: 14,
174
- stroke: color,
175
- strokeWidth: 2,
176
- strokeLinecap: "round"
177
- }
178
- ), /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 17, r: 1, fill: color }));
179
- }
180
- function DangerIcon({ color, size }) {
181
- return /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ _react2.default.createElement(
182
- _reactnativesvg.Line,
183
- {
184
- x1: 9,
185
- y1: 9,
186
- x2: 15,
187
- y2: 15,
188
- stroke: color,
189
- strokeWidth: 2,
190
- strokeLinecap: "round"
191
- }
192
- ), /* @__PURE__ */ _react2.default.createElement(
193
- _reactnativesvg.Line,
194
- {
195
- x1: 15,
196
- y1: 9,
197
- x2: 9,
198
- y2: 15,
199
- stroke: color,
200
- strokeWidth: 2,
201
- strokeLinecap: "round"
202
- }
203
- ));
204
- }
205
-
206
- // src/components/alert/alert.tsx
207
- var _icons = require('@xaui/icons');
208
- var iconMap = {
209
- default: InfoIcon,
210
- primary: InfoIcon,
211
- secondary: InfoIcon,
212
- tertiary: InfoIcon,
213
- success: SuccessIcon,
214
- warning: WarningIcon,
215
- danger: DangerIcon
216
- };
217
- var Alert = ({
218
- title,
219
- description,
220
- icon,
221
- themeColor = "default",
222
- variant = "flat",
223
- radius = 8,
224
- isClosable = false,
225
- hideIcon = false,
226
- closeButton,
227
- isVisible,
228
- style,
229
- titleStyle,
230
- descriptionStyle,
231
- children,
232
- onClose,
233
- onVisibleChange
234
- }) => {
235
- const [internalVisible, setInternalVisible] = _react.useState.call(void 0, _nullishCoalesce(isVisible, () => ( true)));
236
- const [shouldRender, setShouldRender] = _react.useState.call(void 0, _nullishCoalesce(isVisible, () => ( true)));
237
- const isControlled = typeof isVisible === "boolean";
238
- const visible = isControlled ? isVisible : internalVisible;
239
- const opacity = _reactnativereanimated.useSharedValue.call(void 0, 1);
240
- const scale = _reactnativereanimated.useSharedValue.call(void 0, 1);
241
- const containerStyles = useAlertContainerStyles(themeColor, variant);
242
- const iconWrapperStyles = useAlertIconWrapperStyles(themeColor, variant);
243
- const { titleStyles, descriptionStyles, iconColor, closeButtonColor } = useAlertTextStyles(themeColor, variant);
244
- const finishClosing = _react.useCallback.call(void 0, () => {
245
- setShouldRender(false);
246
- if (!isControlled) {
247
- setInternalVisible(false);
248
- }
249
- _optionalChain([onVisibleChange, 'optionalCall', _ => _(false)]);
250
- _optionalChain([onClose, 'optionalCall', _2 => _2()]);
251
- }, [isControlled, onClose, onVisibleChange]);
252
- const handleClose = _react.useCallback.call(void 0, () => {
253
- if (!visible) return;
254
- opacity.value = _reactnativereanimated.withTiming.call(void 0, 0, { duration: 250 });
255
- scale.value = _reactnativereanimated.withTiming.call(void 0, 0.95, { duration: 250 }, (finished) => {
256
- if (finished) {
257
- _reactnativeworklets.scheduleOnRN.call(void 0, finishClosing);
258
- }
259
- });
260
- }, [finishClosing, opacity, scale, visible]);
261
- _react.useEffect.call(void 0, () => {
262
- if (visible && !shouldRender) {
263
- setShouldRender(true);
264
- opacity.value = 0;
265
- scale.value = 0.95;
266
- opacity.value = _reactnativereanimated.withTiming.call(void 0, 1, { duration: 250 });
267
- scale.value = _reactnativereanimated.withTiming.call(void 0, 1, { duration: 250 });
268
- return;
269
- }
270
- if (!visible && shouldRender) {
271
- handleClose();
272
- }
273
- }, [visible, shouldRender, opacity, scale, handleClose]);
274
- const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
275
- opacity: opacity.value,
276
- transform: [{ scale: scale.value }]
277
- }));
278
- const IconComponent = _nullishCoalesce(iconMap[themeColor], () => ( InfoIcon));
279
- const shouldShowClose = Boolean(closeButton || isClosable || onClose);
280
- const renderIcon = () => {
281
- if (hideIcon) return null;
282
- if (icon && _react.isValidElement.call(void 0, icon)) {
283
- return _react.cloneElement.call(void 0, icon, { color: iconColor, size: 22 });
284
- }
285
- if (icon) {
286
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.iconText, { color: iconColor }] }, icon);
287
- }
288
- return /* @__PURE__ */ _react2.default.createElement(IconComponent, { color: iconColor, size: 22 });
289
- };
290
- const renderContentText = (content) => {
291
- if (content === null || content === void 0) return null;
292
- if (typeof content === "string" || typeof content === "number") {
293
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.description, descriptionStyles, descriptionStyle] }, content);
294
- }
295
- return content;
296
- };
297
- const titleNode = _react.useMemo.call(void 0, () => {
298
- if (title === null || title === void 0) return null;
299
- if (typeof title === "string" || typeof title === "number") {
300
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.title, titleStyles, titleStyle] }, title);
301
- }
302
- return title;
303
- }, [title, titleStyle, titleStyles]);
304
- const descriptionNode = renderContentText(description);
305
- const childrenNode = renderContentText(children);
306
- const closeButtonNode = _react.useMemo.call(void 0, () => {
307
- if (!closeButton) return null;
308
- if (!_react.isValidElement.call(void 0, closeButton)) return closeButton;
309
- const existingOnPress = closeButton.props.onPress;
310
- return _react.cloneElement.call(void 0, closeButton, {
311
- onPress: (event) => {
312
- _optionalChain([existingOnPress, 'optionalCall', _3 => _3(event)]);
313
- handleClose();
314
- }
315
- });
316
- }, [closeButton, handleClose]);
317
- if (!shouldRender) return null;
318
- return /* @__PURE__ */ _react2.default.createElement(
319
- _reactnativereanimated2.default.View,
320
- {
321
- accessibilityRole: "alert",
322
- style: [styles.container, containerStyles, { borderRadius: radius }, style, animatedStyle]
323
- },
324
- !hideIcon && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.iconWrapper, iconWrapperStyles] }, renderIcon()),
325
- /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.mainWrapper }, titleNode, descriptionNode, childrenNode && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.extraContent }, childrenNode)),
326
- shouldShowClose && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null, _nullishCoalesce(closeButtonNode, () => ( /* @__PURE__ */ _react2.default.createElement(
327
- _reactnative.Pressable,
328
- {
329
- accessibilityRole: "button",
330
- accessibilityLabel: "Close",
331
- onPress: handleClose,
332
- style: styles.closeButton
333
- },
334
- /* @__PURE__ */ _react2.default.createElement(_icons.CloseIcon, { size: 20, color: closeButtonColor })
335
- ))))
336
- );
337
- };
338
-
339
-
340
- exports.Alert = Alert;
@@ -1,46 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { ViewStyle, TextStyle } from 'react-native';
3
- import { ThemeColor } from '@xaui/core/types';
4
-
5
- /** Visual style of the alert container. */
6
- type AlertVariant = 'solid' | 'bordered' | 'flat' | 'faded' | 'glass';
7
- type AlertEvents = {
8
- /** Called when the alert finishes closing. */
9
- onClose?: () => void;
10
- /** Called whenever the visibility state changes. */
11
- onVisibleChange?: (isVisible: boolean) => void;
12
- };
13
- type AlertProps = {
14
- /** Main heading displayed inside the alert. */
15
- title?: ReactNode;
16
- /** Supporting text below the title. */
17
- description?: ReactNode;
18
- /** Custom icon element — overrides the default theme icon. */
19
- icon?: ReactNode;
20
- /** Color scheme applied to the alert. Defaults to `'default'`. */
21
- themeColor?: ThemeColor;
22
- /** Visual style variant. Defaults to `'flat'`. */
23
- variant?: AlertVariant;
24
- /** Border radius in pixels. Defaults to `8`. */
25
- radius?: number;
26
- /** Whether to display a close button. */
27
- isClosable?: boolean;
28
- /** Hide the leading icon. */
29
- hideIcon?: boolean;
30
- /** Custom element rendered as the close button. */
31
- closeButton?: ReactNode;
32
- /** Controls visibility externally (controlled mode). */
33
- isVisible?: boolean;
34
- /** Override styles for the container. */
35
- style?: ViewStyle;
36
- /** Override styles for the title text. */
37
- titleStyle?: TextStyle;
38
- /** Override styles for the description text. */
39
- descriptionStyle?: TextStyle;
40
- /** Additional content rendered below the description. */
41
- children?: ReactNode;
42
- } & AlertEvents;
43
-
44
- declare const Alert: React.FC<AlertProps>;
45
-
46
- export { Alert, type AlertProps, type AlertVariant };
@@ -1,46 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { ViewStyle, TextStyle } from 'react-native';
3
- import { ThemeColor } from '@xaui/core/types';
4
-
5
- /** Visual style of the alert container. */
6
- type AlertVariant = 'solid' | 'bordered' | 'flat' | 'faded' | 'glass';
7
- type AlertEvents = {
8
- /** Called when the alert finishes closing. */
9
- onClose?: () => void;
10
- /** Called whenever the visibility state changes. */
11
- onVisibleChange?: (isVisible: boolean) => void;
12
- };
13
- type AlertProps = {
14
- /** Main heading displayed inside the alert. */
15
- title?: ReactNode;
16
- /** Supporting text below the title. */
17
- description?: ReactNode;
18
- /** Custom icon element — overrides the default theme icon. */
19
- icon?: ReactNode;
20
- /** Color scheme applied to the alert. Defaults to `'default'`. */
21
- themeColor?: ThemeColor;
22
- /** Visual style variant. Defaults to `'flat'`. */
23
- variant?: AlertVariant;
24
- /** Border radius in pixels. Defaults to `8`. */
25
- radius?: number;
26
- /** Whether to display a close button. */
27
- isClosable?: boolean;
28
- /** Hide the leading icon. */
29
- hideIcon?: boolean;
30
- /** Custom element rendered as the close button. */
31
- closeButton?: ReactNode;
32
- /** Controls visibility externally (controlled mode). */
33
- isVisible?: boolean;
34
- /** Override styles for the container. */
35
- style?: ViewStyle;
36
- /** Override styles for the title text. */
37
- titleStyle?: TextStyle;
38
- /** Override styles for the description text. */
39
- descriptionStyle?: TextStyle;
40
- /** Additional content rendered below the description. */
41
- children?: ReactNode;
42
- } & AlertEvents;
43
-
44
- declare const Alert: React.FC<AlertProps>;
45
-
46
- export { Alert, type AlertProps, type AlertVariant };