@xaui/native 0.2.8 → 0.9.1-alpha.1

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 (234) hide show
  1. package/dist/chunk-KFCORXWW.cjs +150 -0
  2. package/dist/chunk-M7P46XKI.cjs +100 -0
  3. package/dist/chunk-N357EQCZ.js +150 -0
  4. package/dist/chunk-NHPQQQ7P.cjs +734 -0
  5. package/dist/chunk-PBVPOX7D.js +734 -0
  6. package/dist/chunk-RBNCR5KB.js +100 -0
  7. package/dist/index.cjs +40 -1
  8. package/dist/index.d.cts +5 -2
  9. package/dist/index.d.ts +5 -2
  10. package/dist/index.js +40 -0
  11. package/dist/system/index.cjs +7 -0
  12. package/dist/system/index.d.cts +83 -0
  13. package/dist/system/index.d.ts +83 -0
  14. package/dist/system/index.js +7 -0
  15. package/dist/theme/index.cjs +36 -0
  16. package/dist/theme/index.d.cts +539 -0
  17. package/dist/theme/index.d.ts +539 -0
  18. package/dist/theme/index.js +36 -0
  19. package/dist/theme.type-B3ODSLbB.d.cts +153 -0
  20. package/dist/theme.type-B3ODSLbB.d.ts +153 -0
  21. package/package.json +30 -248
  22. package/README.md +0 -178
  23. package/dist/alert/index.cjs +0 -340
  24. package/dist/alert/index.d.cts +0 -46
  25. package/dist/alert/index.d.ts +0 -46
  26. package/dist/alert/index.js +0 -340
  27. package/dist/app-bar/index.cjs +0 -148
  28. package/dist/app-bar/index.d.cts +0 -59
  29. package/dist/app-bar/index.d.ts +0 -59
  30. package/dist/app-bar/index.js +0 -148
  31. package/dist/autocomplete/index.cjs +0 -1122
  32. package/dist/autocomplete/index.d.cts +0 -88
  33. package/dist/autocomplete/index.d.ts +0 -88
  34. package/dist/autocomplete/index.js +0 -1122
  35. package/dist/avatar/index.cjs +0 -281
  36. package/dist/avatar/index.d.cts +0 -123
  37. package/dist/avatar/index.d.ts +0 -123
  38. package/dist/avatar/index.js +0 -281
  39. package/dist/badge/index.cjs +0 -197
  40. package/dist/badge/index.d.cts +0 -94
  41. package/dist/badge/index.d.ts +0 -94
  42. package/dist/badge/index.js +0 -197
  43. package/dist/bottom-sheet/index.cjs +0 -9
  44. package/dist/bottom-sheet/index.d.cts +0 -84
  45. package/dist/bottom-sheet/index.d.ts +0 -84
  46. package/dist/bottom-sheet/index.js +0 -9
  47. package/dist/bottom-tab-bar/index.cjs +0 -497
  48. package/dist/bottom-tab-bar/index.d.cts +0 -211
  49. package/dist/bottom-tab-bar/index.d.ts +0 -211
  50. package/dist/bottom-tab-bar/index.js +0 -497
  51. package/dist/button/index.cjs +0 -392
  52. package/dist/button/index.d.cts +0 -174
  53. package/dist/button/index.d.ts +0 -174
  54. package/dist/button/index.js +0 -392
  55. package/dist/button.type-j1ZdkkSl.d.cts +0 -4
  56. package/dist/button.type-j1ZdkkSl.d.ts +0 -4
  57. package/dist/card/index.cjs +0 -338
  58. package/dist/card/index.d.cts +0 -191
  59. package/dist/card/index.d.ts +0 -191
  60. package/dist/card/index.js +0 -338
  61. package/dist/carousel/index.cjs +0 -381
  62. package/dist/carousel/index.d.cts +0 -147
  63. package/dist/carousel/index.d.ts +0 -147
  64. package/dist/carousel/index.js +0 -381
  65. package/dist/chart/index.cjs +0 -1026
  66. package/dist/chart/index.d.cts +0 -218
  67. package/dist/chart/index.d.ts +0 -218
  68. package/dist/chart/index.js +0 -1026
  69. package/dist/checkbox/index.cjs +0 -443
  70. package/dist/checkbox/index.d.cts +0 -73
  71. package/dist/checkbox/index.d.ts +0 -73
  72. package/dist/checkbox/index.js +0 -443
  73. package/dist/chip/index.cjs +0 -503
  74. package/dist/chip/index.d.cts +0 -195
  75. package/dist/chip/index.d.ts +0 -195
  76. package/dist/chip/index.js +0 -503
  77. package/dist/chunk-4JFWQ5XT.js +0 -368
  78. package/dist/chunk-56RPWZD2.cjs +0 -9
  79. package/dist/chunk-7UFBLUMV.cjs +0 -136
  80. package/dist/chunk-A45TVXU5.js +0 -337
  81. package/dist/chunk-BYWUAPC4.cjs +0 -368
  82. package/dist/chunk-DECMUMCI.js +0 -0
  83. package/dist/chunk-DHSTKO3K.cjs +0 -19
  84. package/dist/chunk-DJ4Q37UT.cjs +0 -75
  85. package/dist/chunk-EUQDGTST.cjs +0 -1
  86. package/dist/chunk-GBHQCAKW.js +0 -19
  87. package/dist/chunk-RBSA4NH4.js +0 -136
  88. package/dist/chunk-SHBDANQN.js +0 -9
  89. package/dist/chunk-UGEINZM7.cjs +0 -290
  90. package/dist/chunk-UU4HHBDN.js +0 -290
  91. package/dist/chunk-VSZEXOUN.js +0 -384
  92. package/dist/chunk-YIEUN3G5.cjs +0 -384
  93. package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
  94. package/dist/chunk-ZY7IUTAT.js +0 -75
  95. package/dist/color-picker/index.cjs +0 -457
  96. package/dist/color-picker/index.d.cts +0 -124
  97. package/dist/color-picker/index.d.ts +0 -124
  98. package/dist/color-picker/index.js +0 -457
  99. package/dist/core/index.cjs +0 -24
  100. package/dist/core/index.d.cts +0 -28
  101. package/dist/core/index.d.ts +0 -28
  102. package/dist/core/index.js +0 -24
  103. package/dist/datepicker/index.cjs +0 -1625
  104. package/dist/datepicker/index.d.cts +0 -45
  105. package/dist/datepicker/index.d.ts +0 -45
  106. package/dist/datepicker/index.js +0 -1625
  107. package/dist/dialog/index.cjs +0 -372
  108. package/dist/dialog/index.d.cts +0 -151
  109. package/dist/dialog/index.d.ts +0 -151
  110. package/dist/dialog/index.js +0 -372
  111. package/dist/divider/index.cjs +0 -8
  112. package/dist/divider/index.d.cts +0 -30
  113. package/dist/divider/index.d.ts +0 -30
  114. package/dist/divider/index.js +0 -8
  115. package/dist/drawer/index.cjs +0 -237
  116. package/dist/drawer/index.d.cts +0 -58
  117. package/dist/drawer/index.d.ts +0 -58
  118. package/dist/drawer/index.js +0 -237
  119. package/dist/expansion-panel/index.cjs +0 -441
  120. package/dist/expansion-panel/index.d.cts +0 -153
  121. package/dist/expansion-panel/index.d.ts +0 -153
  122. package/dist/expansion-panel/index.js +0 -441
  123. package/dist/fab/index.cjs +0 -9
  124. package/dist/fab/index.d.cts +0 -10
  125. package/dist/fab/index.d.ts +0 -10
  126. package/dist/fab/index.js +0 -9
  127. package/dist/fab-menu/index.cjs +0 -330
  128. package/dist/fab-menu/index.d.cts +0 -125
  129. package/dist/fab-menu/index.d.ts +0 -125
  130. package/dist/fab-menu/index.js +0 -330
  131. package/dist/fab.type-CkUHmXU_.d.ts +0 -86
  132. package/dist/fab.type-DN0vtAh6.d.cts +0 -86
  133. package/dist/feature-discovery/index.cjs +0 -464
  134. package/dist/feature-discovery/index.d.cts +0 -82
  135. package/dist/feature-discovery/index.d.ts +0 -82
  136. package/dist/feature-discovery/index.js +0 -464
  137. package/dist/indicator/index.cjs +0 -8
  138. package/dist/indicator/index.d.cts +0 -47
  139. package/dist/indicator/index.d.ts +0 -47
  140. package/dist/indicator/index.js +0 -8
  141. package/dist/input/index.cjs +0 -1462
  142. package/dist/input/index.d.cts +0 -522
  143. package/dist/input/index.d.ts +0 -522
  144. package/dist/input/index.js +0 -1462
  145. package/dist/input-trigger/index.cjs +0 -197
  146. package/dist/input-trigger/index.d.cts +0 -11
  147. package/dist/input-trigger/index.d.ts +0 -11
  148. package/dist/input-trigger/index.js +0 -197
  149. package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
  150. package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
  151. package/dist/list/index.cjs +0 -395
  152. package/dist/list/index.d.cts +0 -188
  153. package/dist/list/index.d.ts +0 -188
  154. package/dist/list/index.js +0 -395
  155. package/dist/menu/index.cjs +0 -316
  156. package/dist/menu/index.d.cts +0 -115
  157. package/dist/menu/index.d.ts +0 -115
  158. package/dist/menu/index.js +0 -316
  159. package/dist/menubox/index.cjs +0 -297
  160. package/dist/menubox/index.d.cts +0 -98
  161. package/dist/menubox/index.d.ts +0 -98
  162. package/dist/menubox/index.js +0 -297
  163. package/dist/pager/index.cjs +0 -205
  164. package/dist/pager/index.d.cts +0 -93
  165. package/dist/pager/index.d.ts +0 -93
  166. package/dist/pager/index.js +0 -205
  167. package/dist/picker/index.cjs +0 -244
  168. package/dist/picker/index.d.cts +0 -121
  169. package/dist/picker/index.d.ts +0 -121
  170. package/dist/picker/index.js +0 -244
  171. package/dist/progress/index.cjs +0 -219
  172. package/dist/progress/index.d.cts +0 -47
  173. package/dist/progress/index.d.ts +0 -47
  174. package/dist/progress/index.js +0 -219
  175. package/dist/radio/index.cjs +0 -465
  176. package/dist/radio/index.d.cts +0 -145
  177. package/dist/radio/index.d.ts +0 -145
  178. package/dist/radio/index.js +0 -465
  179. package/dist/refresh-control/index.cjs +0 -45
  180. package/dist/refresh-control/index.d.cts +0 -55
  181. package/dist/refresh-control/index.d.ts +0 -55
  182. package/dist/refresh-control/index.js +0 -45
  183. package/dist/segment-button/index.cjs +0 -405
  184. package/dist/segment-button/index.d.cts +0 -141
  185. package/dist/segment-button/index.d.ts +0 -141
  186. package/dist/segment-button/index.js +0 -405
  187. package/dist/select/index.cjs +0 -878
  188. package/dist/select/index.d.cts +0 -192
  189. package/dist/select/index.d.ts +0 -192
  190. package/dist/select/index.js +0 -878
  191. package/dist/skeleton/index.cjs +0 -89
  192. package/dist/skeleton/index.d.cts +0 -45
  193. package/dist/skeleton/index.d.ts +0 -45
  194. package/dist/skeleton/index.js +0 -89
  195. package/dist/slider/index.cjs +0 -576
  196. package/dist/slider/index.d.cts +0 -171
  197. package/dist/slider/index.d.ts +0 -171
  198. package/dist/slider/index.js +0 -576
  199. package/dist/snackbar/index.cjs +0 -436
  200. package/dist/snackbar/index.d.cts +0 -174
  201. package/dist/snackbar/index.d.ts +0 -174
  202. package/dist/snackbar/index.js +0 -436
  203. package/dist/snippet/index.cjs +0 -314
  204. package/dist/snippet/index.d.cts +0 -95
  205. package/dist/snippet/index.d.ts +0 -95
  206. package/dist/snippet/index.js +0 -314
  207. package/dist/stepper/index.cjs +0 -550
  208. package/dist/stepper/index.d.cts +0 -137
  209. package/dist/stepper/index.d.ts +0 -137
  210. package/dist/stepper/index.js +0 -550
  211. package/dist/switch/index.cjs +0 -358
  212. package/dist/switch/index.d.cts +0 -28
  213. package/dist/switch/index.d.ts +0 -28
  214. package/dist/switch/index.js +0 -358
  215. package/dist/tabs/index.cjs +0 -440
  216. package/dist/tabs/index.d.cts +0 -180
  217. package/dist/tabs/index.d.ts +0 -180
  218. package/dist/tabs/index.js +0 -440
  219. package/dist/timepicker/index.cjs +0 -823
  220. package/dist/timepicker/index.d.cts +0 -215
  221. package/dist/timepicker/index.d.ts +0 -215
  222. package/dist/timepicker/index.js +0 -823
  223. package/dist/toolbar/index.cjs +0 -333
  224. package/dist/toolbar/index.d.cts +0 -100
  225. package/dist/toolbar/index.d.ts +0 -100
  226. package/dist/toolbar/index.js +0 -333
  227. package/dist/typography/index.cjs +0 -238
  228. package/dist/typography/index.d.cts +0 -113
  229. package/dist/typography/index.d.ts +0 -113
  230. package/dist/typography/index.js +0 -238
  231. package/dist/view/index.cjs +0 -1361
  232. package/dist/view/index.d.cts +0 -833
  233. package/dist/view/index.d.ts +0 -833
  234. package/dist/view/index.js +0 -1361
@@ -1,340 +0,0 @@
1
- import "../chunk-SHBDANQN.js";
2
- import {
3
- useXUITheme
4
- } from "../chunk-RBSA4NH4.js";
5
-
6
- // src/components/alert/alert.tsx
7
- import React2, {
8
- cloneElement,
9
- isValidElement,
10
- useCallback,
11
- useEffect,
12
- useMemo as useMemo2,
13
- useState
14
- } from "react";
15
- import { Pressable, Text, View } from "react-native";
16
- import Animated, {
17
- useAnimatedStyle,
18
- useSharedValue,
19
- withTiming
20
- } from "react-native-reanimated";
21
- import { scheduleOnRN } from "react-native-worklets";
22
-
23
- // src/components/alert/alert.style.ts
24
- import { StyleSheet } from "react-native";
25
- var styles = 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
- import { useMemo } from "react";
64
- import { getSafeThemeColor, withOpacity } from "@xaui/core";
65
- var useAlertColorScheme = (themeColor) => {
66
- const theme = useXUITheme();
67
- const safeThemeColor = getSafeThemeColor(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 = useMemo(() => {
77
- const backgroundColor = variant === "solid" ? colorScheme.main : variant === "flat" ? colorScheme.container : variant === "faded" ? withOpacity(colorScheme.container, 0.75) : "transparent";
78
- const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.md : 0;
79
- const borderColor = variant === "bordered" ? withOpacity(colorScheme.main, 0.75) : variant === "faded" ? withOpacity(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 = useMemo(() => {
93
- const backgroundColor = variant === "solid" ? withOpacity(colorScheme.onMain, 0.16) : withOpacity(isDefault ? theme.colors.foreground : colorScheme.main, 0.12);
94
- const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.xs : 0;
95
- const borderColor = withOpacity(
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 = useMemo(() => {
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: withOpacity(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
- import React from "react";
131
- import Svg, { Circle, Line, Path } from "react-native-svg";
132
- function InfoIcon({ color, size }) {
133
- return /* @__PURE__ */ React.createElement(Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React.createElement(Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ React.createElement(
134
- 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__ */ React.createElement(Circle, { cx: 12, cy: 7, r: 1, fill: color }));
145
- }
146
- function SuccessIcon({ color, size }) {
147
- return /* @__PURE__ */ React.createElement(Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React.createElement(Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ React.createElement(
148
- 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__ */ React.createElement(Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React.createElement(
160
- Path,
161
- {
162
- d: "M12 3L22 20H2L12 3Z",
163
- stroke: color,
164
- strokeWidth: 2,
165
- strokeLinejoin: "round"
166
- }
167
- ), /* @__PURE__ */ React.createElement(
168
- 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__ */ React.createElement(Circle, { cx: 12, cy: 17, r: 1, fill: color }));
179
- }
180
- function DangerIcon({ color, size }) {
181
- return /* @__PURE__ */ React.createElement(Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React.createElement(Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ React.createElement(
182
- 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__ */ React.createElement(
193
- 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
- import { CloseIcon } from "@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] = useState(isVisible ?? true);
236
- const [shouldRender, setShouldRender] = useState(isVisible ?? true);
237
- const isControlled = typeof isVisible === "boolean";
238
- const visible = isControlled ? isVisible : internalVisible;
239
- const opacity = useSharedValue(1);
240
- const scale = useSharedValue(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 = useCallback(() => {
245
- setShouldRender(false);
246
- if (!isControlled) {
247
- setInternalVisible(false);
248
- }
249
- onVisibleChange?.(false);
250
- onClose?.();
251
- }, [isControlled, onClose, onVisibleChange]);
252
- const handleClose = useCallback(() => {
253
- if (!visible) return;
254
- opacity.value = withTiming(0, { duration: 250 });
255
- scale.value = withTiming(0.95, { duration: 250 }, (finished) => {
256
- if (finished) {
257
- scheduleOnRN(finishClosing);
258
- }
259
- });
260
- }, [finishClosing, opacity, scale, visible]);
261
- useEffect(() => {
262
- if (visible && !shouldRender) {
263
- setShouldRender(true);
264
- opacity.value = 0;
265
- scale.value = 0.95;
266
- opacity.value = withTiming(1, { duration: 250 });
267
- scale.value = withTiming(1, { duration: 250 });
268
- return;
269
- }
270
- if (!visible && shouldRender) {
271
- handleClose();
272
- }
273
- }, [visible, shouldRender, opacity, scale, handleClose]);
274
- const animatedStyle = useAnimatedStyle(() => ({
275
- opacity: opacity.value,
276
- transform: [{ scale: scale.value }]
277
- }));
278
- const IconComponent = iconMap[themeColor] ?? InfoIcon;
279
- const shouldShowClose = Boolean(closeButton || isClosable || onClose);
280
- const renderIcon = () => {
281
- if (hideIcon) return null;
282
- if (icon && isValidElement(icon)) {
283
- return cloneElement(icon, { color: iconColor, size: 22 });
284
- }
285
- if (icon) {
286
- return /* @__PURE__ */ React2.createElement(Text, { style: [styles.iconText, { color: iconColor }] }, icon);
287
- }
288
- return /* @__PURE__ */ React2.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.createElement(Text, { style: [styles.description, descriptionStyles, descriptionStyle] }, content);
294
- }
295
- return content;
296
- };
297
- const titleNode = useMemo2(() => {
298
- if (title === null || title === void 0) return null;
299
- if (typeof title === "string" || typeof title === "number") {
300
- return /* @__PURE__ */ React2.createElement(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 = useMemo2(() => {
307
- if (!closeButton) return null;
308
- if (!isValidElement(closeButton)) return closeButton;
309
- const existingOnPress = closeButton.props.onPress;
310
- return cloneElement(closeButton, {
311
- onPress: (event) => {
312
- existingOnPress?.(event);
313
- handleClose();
314
- }
315
- });
316
- }, [closeButton, handleClose]);
317
- if (!shouldRender) return null;
318
- return /* @__PURE__ */ React2.createElement(
319
- Animated.View,
320
- {
321
- accessibilityRole: "alert",
322
- style: [styles.container, containerStyles, { borderRadius: radius }, style, animatedStyle]
323
- },
324
- !hideIcon && /* @__PURE__ */ React2.createElement(View, { style: [styles.iconWrapper, iconWrapperStyles] }, renderIcon()),
325
- /* @__PURE__ */ React2.createElement(View, { style: styles.mainWrapper }, titleNode, descriptionNode, childrenNode && /* @__PURE__ */ React2.createElement(View, { style: styles.extraContent }, childrenNode)),
326
- shouldShowClose && /* @__PURE__ */ React2.createElement(View, null, closeButtonNode ?? /* @__PURE__ */ React2.createElement(
327
- Pressable,
328
- {
329
- accessibilityRole: "button",
330
- accessibilityLabel: "Close",
331
- onPress: handleClose,
332
- style: styles.closeButton
333
- },
334
- /* @__PURE__ */ React2.createElement(CloseIcon, { size: 20, color: closeButtonColor })
335
- ))
336
- );
337
- };
338
- export {
339
- Alert
340
- };
@@ -1,148 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../chunk-56RPWZD2.cjs');
2
-
3
-
4
- var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
5
-
6
- // src/components/app-bar/app-bar.tsx
7
- var _react = require('react'); var _react2 = _interopRequireDefault(_react);
8
- var _reactnative = require('react-native');
9
- var _core = require('@xaui/core');
10
-
11
- // src/components/app-bar/app-bar.hook.ts
12
-
13
- var resolveShadowStyle = (elevation, shadows) => {
14
- if (elevation <= 1) {
15
- return shadows.sm;
16
- }
17
- if (elevation <= 2) {
18
- return shadows.md;
19
- }
20
- if (elevation <= 3) {
21
- return shadows.lg;
22
- }
23
- return shadows.xl;
24
- };
25
- var useAppBarElevationStyles = (elevation = 0) => {
26
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
27
- return _react.useMemo.call(void 0, () => {
28
- if (elevation <= 0) {
29
- return {};
30
- }
31
- return {
32
- ...resolveShadowStyle(elevation, theme.shadows),
33
- elevation
34
- };
35
- }, [elevation, theme.shadows]);
36
- };
37
-
38
- // src/components/app-bar/app-bar.style.ts
39
-
40
- var styles = _reactnative.StyleSheet.create({
41
- container: {
42
- flexShrink: 1,
43
- flexBasis: "auto",
44
- width: "100%"
45
- },
46
- floatingContainer: {
47
- paddingVertical: 8
48
- },
49
- appBar: {
50
- minHeight: 64,
51
- flexDirection: "row",
52
- alignItems: "center",
53
- paddingHorizontal: 16
54
- },
55
- docked: {
56
- width: "100%",
57
- borderRadius: 0
58
- },
59
- floating: {
60
- flexShrink: 1,
61
- flexBasis: "auto",
62
- maxWidth: "97%",
63
- borderRadius: 9999,
64
- alignSelf: "center"
65
- },
66
- startContent: {
67
- flexShrink: 0,
68
- flexDirection: "row",
69
- alignItems: "center",
70
- gap: 8,
71
- minWidth: 40
72
- },
73
- content: {
74
- flex: 1,
75
- alignItems: "center",
76
- justifyContent: "center",
77
- paddingHorizontal: 10
78
- },
79
- endContent: {
80
- flexShrink: 0,
81
- flexDirection: "row",
82
- alignItems: "center",
83
- justifyContent: "flex-end",
84
- gap: 8,
85
- minWidth: 40
86
- }
87
- });
88
-
89
- // src/components/app-bar/app-bar.tsx
90
- var AppBar = ({
91
- variant = "docked",
92
- elevation = 0,
93
- themeColor = "default",
94
- children,
95
- style
96
- }) => {
97
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
98
- const elevationStyles = useAppBarElevationStyles(elevation);
99
- const isFloating = variant === "floating";
100
- const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
101
- const colorScheme = theme.colors[safeThemeColor];
102
- const isDefaultThemeColor = safeThemeColor === "default";
103
- const backgroundColor = isDefaultThemeColor ? theme.mode === "dark" ? theme.colors.default.container : isFloating ? theme.palette.gray[200] : "#FFFFFF" : colorScheme.container;
104
- const borderBottomColor = isDefaultThemeColor ? theme.mode === "dark" ? "rgba(255, 255, 255, 0.06)" : "rgba(0, 0, 0, 0.08)" : colorScheme.main;
105
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, isFloating && styles.floatingContainer] }, /* @__PURE__ */ _react2.default.createElement(
106
- _reactnative.View,
107
- {
108
- style: [
109
- styles.appBar,
110
- isFloating ? styles.floating : styles.docked,
111
- {
112
- backgroundColor,
113
- borderBottomWidth: isFloating ? 0 : 1,
114
- borderBottomColor
115
- },
116
- elevationStyles,
117
- style
118
- ]
119
- },
120
- children
121
- ));
122
- };
123
- var AppBarStartContent = ({
124
- children,
125
- style
126
- }) => {
127
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.startContent, style] }, children);
128
- };
129
- var AppBarContent = ({
130
- children,
131
- alignment = "center",
132
- style
133
- }) => {
134
- const alignItems = alignment === "start" ? "flex-start" : alignment === "center" ? "center" : "flex-end";
135
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.content, { alignItems }, style] }, children);
136
- };
137
- var AppBarEndContent = ({
138
- children,
139
- style
140
- }) => {
141
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.endContent, style] }, children);
142
- };
143
-
144
-
145
-
146
-
147
-
148
- exports.AppBar = AppBar; exports.AppBarContent = AppBarContent; exports.AppBarEndContent = AppBarEndContent; exports.AppBarStartContent = AppBarStartContent;
@@ -1,59 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
3
- import { ThemeColor } from '@xaui/core/types';
4
-
5
- type AppBarVariant = 'docked' | 'floating';
6
- type AppBarProps = {
7
- /**
8
- * AppBar layout variant.
9
- * - docked: full-width app bar
10
- * - floating: rounded app bar that does not span full screen width
11
- * @default 'docked'
12
- */
13
- variant?: AppBarVariant;
14
- /**
15
- * Elevation intensity.
16
- * @default 0
17
- */
18
- elevation?: number;
19
- /**
20
- * Theme color used for the app bar surface.
21
- * @default 'default'
22
- */
23
- themeColor?: ThemeColor;
24
- /**
25
- * AppBar content.
26
- */
27
- children?: ReactNode;
28
- /**
29
- * Custom style for the app bar surface.
30
- */
31
- style?: StyleProp<ViewStyle>;
32
- };
33
- type AppBarSlotProps = {
34
- /**
35
- * Slot content.
36
- */
37
- children?: ReactNode;
38
- /**
39
- * Custom style for this slot.
40
- */
41
- style?: StyleProp<ViewStyle>;
42
- };
43
- type AppBarSlotContentAlignment = 'start' | 'center' | 'end';
44
- type AppBarStartContentProps = AppBarSlotProps;
45
- type AppBarContentProps = AppBarSlotProps & {
46
- /**
47
- * Horizontal alignment for content slot content.
48
- * @default 'center'
49
- */
50
- alignment?: AppBarSlotContentAlignment;
51
- };
52
- type AppBarEndContentProps = AppBarSlotProps;
53
-
54
- declare const AppBar: React.FC<AppBarProps>;
55
- declare const AppBarStartContent: React.FC<AppBarStartContentProps>;
56
- declare const AppBarContent: React.FC<AppBarContentProps>;
57
- declare const AppBarEndContent: React.FC<AppBarEndContentProps>;
58
-
59
- export { AppBar, AppBarContent, type AppBarContentProps, AppBarEndContent, type AppBarEndContentProps, type AppBarProps, type AppBarSlotProps, AppBarStartContent, type AppBarStartContentProps, type AppBarVariant };
@@ -1,59 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
3
- import { ThemeColor } from '@xaui/core/types';
4
-
5
- type AppBarVariant = 'docked' | 'floating';
6
- type AppBarProps = {
7
- /**
8
- * AppBar layout variant.
9
- * - docked: full-width app bar
10
- * - floating: rounded app bar that does not span full screen width
11
- * @default 'docked'
12
- */
13
- variant?: AppBarVariant;
14
- /**
15
- * Elevation intensity.
16
- * @default 0
17
- */
18
- elevation?: number;
19
- /**
20
- * Theme color used for the app bar surface.
21
- * @default 'default'
22
- */
23
- themeColor?: ThemeColor;
24
- /**
25
- * AppBar content.
26
- */
27
- children?: ReactNode;
28
- /**
29
- * Custom style for the app bar surface.
30
- */
31
- style?: StyleProp<ViewStyle>;
32
- };
33
- type AppBarSlotProps = {
34
- /**
35
- * Slot content.
36
- */
37
- children?: ReactNode;
38
- /**
39
- * Custom style for this slot.
40
- */
41
- style?: StyleProp<ViewStyle>;
42
- };
43
- type AppBarSlotContentAlignment = 'start' | 'center' | 'end';
44
- type AppBarStartContentProps = AppBarSlotProps;
45
- type AppBarContentProps = AppBarSlotProps & {
46
- /**
47
- * Horizontal alignment for content slot content.
48
- * @default 'center'
49
- */
50
- alignment?: AppBarSlotContentAlignment;
51
- };
52
- type AppBarEndContentProps = AppBarSlotProps;
53
-
54
- declare const AppBar: React.FC<AppBarProps>;
55
- declare const AppBarStartContent: React.FC<AppBarStartContentProps>;
56
- declare const AppBarContent: React.FC<AppBarContentProps>;
57
- declare const AppBarEndContent: React.FC<AppBarEndContentProps>;
58
-
59
- export { AppBar, AppBarContent, type AppBarContentProps, AppBarEndContent, type AppBarEndContentProps, type AppBarProps, type AppBarSlotProps, AppBarStartContent, type AppBarStartContentProps, type AppBarVariant };