@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,372 +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; }
2
-
3
-
4
- var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
5
-
6
- // src/components/dialog/dialog.tsx
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
- var _react = require('react'); var _react2 = _interopRequireDefault(_react);
16
- var _reactnative = require('react-native');
17
-
18
-
19
-
20
-
21
-
22
- var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
23
- var _reactnativeworklets = require('react-native-worklets');
24
- var _core = require('@xaui/core');
25
- var _icons = require('@xaui/icons');
26
-
27
- // src/components/dialog/dialog.style.ts
28
-
29
- var styles = _reactnative.StyleSheet.create({
30
- root: {
31
- flex: 1
32
- },
33
- backdrop: {
34
- ..._reactnative.StyleSheet.absoluteFillObject
35
- },
36
- backdropTransparent: {
37
- backgroundColor: "transparent"
38
- },
39
- backdropBlurred: {
40
- backgroundColor: "rgba(15, 23, 42, 0.35)"
41
- },
42
- backdropOpaque: {
43
- backgroundColor: "rgba(15, 23, 42, 0.55)"
44
- },
45
- placementBase: {
46
- flex: 1,
47
- paddingHorizontal: 16
48
- },
49
- placementTop: {
50
- justifyContent: "flex-start",
51
- paddingTop: 44,
52
- paddingBottom: 16
53
- },
54
- placementCenter: {
55
- justifyContent: "center",
56
- paddingVertical: 16
57
- },
58
- placementBottom: {
59
- justifyContent: "flex-end",
60
- paddingTop: 16,
61
- paddingBottom: 28
62
- },
63
- dialog: {
64
- width: "100%",
65
- alignSelf: "center",
66
- overflow: "hidden",
67
- borderWidth: 1
68
- },
69
- sizeSm: {
70
- maxWidth: 360
71
- },
72
- sizeMd: {
73
- maxWidth: 520
74
- },
75
- sizeLg: {
76
- maxWidth: 700
77
- },
78
- sizeFull: {
79
- maxWidth: "100%",
80
- flex: 1
81
- },
82
- header: {
83
- paddingTop: 18,
84
- paddingBottom: 12,
85
- paddingHorizontal: 20,
86
- flexDirection: "row",
87
- alignItems: "flex-start",
88
- justifyContent: "space-between",
89
- gap: 12
90
- },
91
- headerContent: {
92
- flex: 1
93
- },
94
- headerText: {
95
- fontSize: 20,
96
- lineHeight: 26,
97
- fontWeight: "700"
98
- },
99
- body: {
100
- paddingHorizontal: 20,
101
- paddingVertical: 12,
102
- gap: 10
103
- },
104
- bodyText: {
105
- fontSize: 15,
106
- lineHeight: 22
107
- },
108
- footer: {
109
- paddingTop: 8,
110
- paddingBottom: 18,
111
- paddingHorizontal: 20,
112
- flexDirection: "row",
113
- justifyContent: "flex-end",
114
- alignItems: "center",
115
- gap: 8
116
- },
117
- closeButton: {
118
- padding: 4,
119
- borderRadius: 999,
120
- alignItems: "center",
121
- justifyContent: "center"
122
- }
123
- });
124
-
125
- // src/components/dialog/dialog.tsx
126
- var DialogContext = _react.createContext.call(void 0, {});
127
- var sizeStyles = {
128
- sm: styles.sizeSm,
129
- md: styles.sizeMd,
130
- lg: styles.sizeLg,
131
- full: styles.sizeFull
132
- };
133
- var placementStyles = {
134
- top: styles.placementTop,
135
- center: styles.placementCenter,
136
- bottom: styles.placementBottom
137
- };
138
- var backdropStyles = {
139
- transparent: styles.backdropTransparent,
140
- blurred: styles.backdropBlurred,
141
- opaque: styles.backdropOpaque
142
- };
143
- var ENTER_DURATION = 240;
144
- var EXIT_DURATION = 180;
145
- function getTranslateOffset(placement, animationType) {
146
- if (animationType === "slide") {
147
- if (placement === "top") return -28;
148
- if (placement === "bottom") return 28;
149
- return 18;
150
- }
151
- if (placement === "top") return -18;
152
- if (placement === "bottom") return 18;
153
- return 10;
154
- }
155
- var resolveChildrenContent = (content, textStyle) => {
156
- if (content === void 0 || content === null) return null;
157
- if (typeof content === "string" || typeof content === "number") {
158
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: textStyle }, content);
159
- }
160
- return content;
161
- };
162
- var Dialog = ({
163
- children,
164
- isOpen,
165
- onClose,
166
- onOpenChange,
167
- size = "md",
168
- placement = "center",
169
- radius = "lg",
170
- backdrop = "opaque",
171
- closeOnBackdropPress = true,
172
- hideBackdrop = false,
173
- animationType = "fade",
174
- disableAnimation = false,
175
- style,
176
- customAppearance
177
- }) => {
178
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
179
- const radiusStyles = _chunk7UFBLUMVcjs.useBorderRadiusStyles.call(void 0, radius);
180
- const [shouldRender, setShouldRender] = _react.useState.call(void 0, isOpen);
181
- const openRef = _react.useRef.call(void 0, isOpen);
182
- const shouldAnimate = !disableAnimation && animationType !== "none";
183
- const initialOffset = getTranslateOffset(placement, animationType);
184
- const backdropOpacity = _reactnativereanimated.useSharedValue.call(void 0, isOpen ? 1 : 0);
185
- const dialogOpacity = _reactnativereanimated.useSharedValue.call(void 0, isOpen ? 1 : 0);
186
- const dialogTranslate = _reactnativereanimated.useSharedValue.call(void 0, isOpen ? 0 : initialOffset);
187
- const dialogScale = _reactnativereanimated.useSharedValue.call(void 0, isOpen ? 1 : placement === "center" ? 0.98 : 1);
188
- const requestClose = _react.useCallback.call(void 0, () => {
189
- _optionalChain([onOpenChange, 'optionalCall', _ => _(false)]);
190
- _optionalChain([onClose, 'optionalCall', _2 => _2()]);
191
- }, [onClose, onOpenChange]);
192
- const handleBackdropPress = () => {
193
- if (closeOnBackdropPress) {
194
- requestClose();
195
- }
196
- };
197
- const finishClosing = _react.useCallback.call(void 0, () => {
198
- if (!openRef.current) {
199
- setShouldRender(false);
200
- }
201
- }, []);
202
- _react.useEffect.call(void 0, () => {
203
- openRef.current = isOpen;
204
- }, [isOpen]);
205
- _react.useEffect.call(void 0, () => {
206
- if (isOpen && !shouldRender) {
207
- setShouldRender(true);
208
- }
209
- }, [isOpen, shouldRender]);
210
- _react.useEffect.call(void 0, () => {
211
- if (!shouldRender) return;
212
- if (!shouldAnimate) {
213
- backdropOpacity.value = isOpen ? 1 : 0;
214
- dialogOpacity.value = isOpen ? 1 : 0;
215
- dialogTranslate.value = 0;
216
- dialogScale.value = 1;
217
- if (!isOpen) {
218
- setShouldRender(false);
219
- }
220
- return;
221
- }
222
- const offset = getTranslateOffset(placement, animationType);
223
- if (isOpen) {
224
- backdropOpacity.value = 0;
225
- dialogOpacity.value = 0;
226
- dialogTranslate.value = offset;
227
- dialogScale.value = placement === "center" ? 0.98 : 1;
228
- backdropOpacity.value = _reactnativereanimated.withTiming.call(void 0, 1, {
229
- duration: 210,
230
- easing: _reactnativereanimated.Easing.out(_reactnativereanimated.Easing.quad)
231
- });
232
- dialogOpacity.value = _reactnativereanimated.withTiming.call(void 0, 1, {
233
- duration: 220,
234
- easing: _reactnativereanimated.Easing.out(_reactnativereanimated.Easing.quad)
235
- });
236
- dialogTranslate.value = _reactnativereanimated.withTiming.call(void 0, 0, {
237
- duration: ENTER_DURATION,
238
- easing: _reactnativereanimated.Easing.out(_reactnativereanimated.Easing.cubic)
239
- });
240
- dialogScale.value = _reactnativereanimated.withTiming.call(void 0, 1, {
241
- duration: 220,
242
- easing: _reactnativereanimated.Easing.out(_reactnativereanimated.Easing.quad)
243
- });
244
- return;
245
- }
246
- backdropOpacity.value = _reactnativereanimated.withTiming.call(void 0, 0, {
247
- duration: 150,
248
- easing: _reactnativereanimated.Easing.in(_reactnativereanimated.Easing.quad)
249
- });
250
- dialogTranslate.value = _reactnativereanimated.withTiming.call(void 0, offset, {
251
- duration: EXIT_DURATION,
252
- easing: _reactnativereanimated.Easing.in(_reactnativereanimated.Easing.cubic)
253
- });
254
- dialogScale.value = _reactnativereanimated.withTiming.call(void 0, placement === "center" ? 0.98 : 1, {
255
- duration: 150,
256
- easing: _reactnativereanimated.Easing.in(_reactnativereanimated.Easing.quad)
257
- });
258
- dialogOpacity.value = _reactnativereanimated.withTiming.call(void 0,
259
- 0,
260
- {
261
- duration: EXIT_DURATION,
262
- easing: _reactnativereanimated.Easing.in(_reactnativereanimated.Easing.quad)
263
- },
264
- (finished) => {
265
- if (finished) {
266
- _reactnativeworklets.scheduleOnRN.call(void 0, finishClosing);
267
- }
268
- }
269
- );
270
- }, [
271
- animationType,
272
- backdropOpacity,
273
- dialogOpacity,
274
- dialogScale,
275
- dialogTranslate,
276
- finishClosing,
277
- isOpen,
278
- placement,
279
- shouldAnimate,
280
- shouldRender
281
- ]);
282
- const backdropAnimatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
283
- opacity: backdropOpacity.value
284
- }));
285
- const dialogAnimatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
286
- opacity: dialogOpacity.value,
287
- transform: [{ translateY: dialogTranslate.value }, { scale: dialogScale.value }]
288
- }));
289
- const dialogContextValue = _react.useMemo.call(void 0,
290
- () => ({
291
- onClose: requestClose,
292
- customAppearance
293
- }),
294
- [customAppearance, requestClose]
295
- );
296
- if (!shouldRender) return null;
297
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.Modal, { visible: true, transparent: true, animationType: "none", onRequestClose: requestClose }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.root }, !hideBackdrop && /* @__PURE__ */ _react2.default.createElement(
298
- AnimatedPressable,
299
- {
300
- style: [
301
- styles.backdrop,
302
- backdropStyles[backdrop],
303
- backdropAnimatedStyle,
304
- _optionalChain([customAppearance, 'optionalAccess', _3 => _3.backdrop])
305
- ],
306
- onPress: handleBackdropPress
307
- }
308
- ), /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.placementBase, placementStyles[placement]] }, /* @__PURE__ */ _react2.default.createElement(DialogContext.Provider, { value: dialogContextValue }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Pressable, { onPress: (event) => event.stopPropagation() }, /* @__PURE__ */ _react2.default.createElement(
309
- _reactnativereanimated2.default.View,
310
- {
311
- style: [
312
- styles.dialog,
313
- sizeStyles[size],
314
- radiusStyles,
315
- dialogAnimatedStyle,
316
- {
317
- backgroundColor: theme.colors.background,
318
- borderColor: _core.withOpacity.call(void 0, theme.colors.foreground, 0.14)
319
- },
320
- theme.shadows.lg,
321
- _optionalChain([customAppearance, 'optionalAccess', _4 => _4.container]),
322
- style
323
- ]
324
- },
325
- children
326
- ))))));
327
- };
328
- var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
329
- var DialogHeader = ({
330
- children,
331
- isClosable = false,
332
- closeButton,
333
- onClose,
334
- style
335
- }) => {
336
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
337
- const { onClose: contextClose, customAppearance } = _react.useContext.call(void 0, DialogContext);
338
- const close = _nullishCoalesce(onClose, () => ( contextClose));
339
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.header, _optionalChain([customAppearance, 'optionalAccess', _5 => _5.header]), style] }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.headerContent }, resolveChildrenContent(children, [
340
- styles.headerText,
341
- { color: theme.colors.foreground },
342
- _optionalChain([customAppearance, 'optionalAccess', _6 => _6.headerText])
343
- ])), isClosable && /* @__PURE__ */ _react2.default.createElement(
344
- _reactnative.Pressable,
345
- {
346
- accessibilityRole: "button",
347
- accessibilityLabel: "Close dialog",
348
- onPress: close,
349
- style: [styles.closeButton, _optionalChain([customAppearance, 'optionalAccess', _7 => _7.closeButton])]
350
- },
351
- _nullishCoalesce(closeButton, () => ( /* @__PURE__ */ _react2.default.createElement(_icons.CloseIcon, { size: 22, color: theme.colors.foreground })))
352
- ));
353
- };
354
- var DialogBody = ({ children, style }) => {
355
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
356
- const { customAppearance } = _react.useContext.call(void 0, DialogContext);
357
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.body, _optionalChain([customAppearance, 'optionalAccess', _8 => _8.body]), style] }, resolveChildrenContent(children, [
358
- styles.bodyText,
359
- { color: _core.withOpacity.call(void 0, theme.colors.foreground, 0.9) },
360
- _optionalChain([customAppearance, 'optionalAccess', _9 => _9.bodyText])
361
- ]));
362
- };
363
- var DialogFooter = ({ children, style }) => {
364
- const { customAppearance } = _react.useContext.call(void 0, DialogContext);
365
- return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.footer, _optionalChain([customAppearance, 'optionalAccess', _10 => _10.footer]), style] }, children);
366
- };
367
-
368
-
369
-
370
-
371
-
372
- exports.Dialog = Dialog; exports.DialogBody = DialogBody; exports.DialogFooter = DialogFooter; exports.DialogHeader = DialogHeader;
@@ -1,151 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { ModalProps, ViewStyle, TextStyle } from 'react-native';
3
- import { Radius } from '@xaui/core/types';
4
-
5
- type DialogSize = 'sm' | 'md' | 'lg' | 'full';
6
- type DialogPlacement = 'top' | 'center' | 'bottom';
7
- type DialogBackdrop = 'transparent' | 'blurred' | 'opaque';
8
- type DialogCustomAppearance = {
9
- /**
10
- * Custom style for the overlay backdrop.
11
- */
12
- backdrop?: ViewStyle;
13
- /**
14
- * Custom style for the dialog container.
15
- */
16
- container?: ViewStyle;
17
- /**
18
- * Custom style for the dialog header section.
19
- */
20
- header?: ViewStyle;
21
- /**
22
- * Custom style for the dialog body section.
23
- */
24
- body?: ViewStyle;
25
- /**
26
- * Custom style for the dialog footer section.
27
- */
28
- footer?: ViewStyle;
29
- /**
30
- * Custom style for the close button.
31
- */
32
- closeButton?: ViewStyle;
33
- /**
34
- * Custom style for default title text rendered in DialogHeader.
35
- */
36
- headerText?: TextStyle;
37
- /**
38
- * Custom style for default body text rendered in DialogBody.
39
- */
40
- bodyText?: TextStyle;
41
- };
42
- type DialogEvents = {
43
- /**
44
- * Called when the dialog requests to close.
45
- */
46
- onClose?: () => void;
47
- /**
48
- * Called whenever open state changes.
49
- */
50
- onOpenChange?: (isOpen: boolean) => void;
51
- };
52
- type DialogProps = {
53
- /**
54
- * Dialog content.
55
- */
56
- children: ReactNode;
57
- /**
58
- * Controls visibility.
59
- * @default false
60
- */
61
- isOpen: boolean;
62
- /**
63
- * Dialog size preset.
64
- * @default 'md'
65
- */
66
- size?: DialogSize;
67
- /**
68
- * Dialog placement on screen.
69
- * @default 'center'
70
- */
71
- placement?: DialogPlacement;
72
- /**
73
- * Border radius of the dialog container.
74
- * @default 'lg'
75
- */
76
- radius?: Radius;
77
- /**
78
- * Controls backdrop intensity.
79
- * @default 'opaque'
80
- */
81
- backdrop?: DialogBackdrop;
82
- /**
83
- * If true, backdrop press closes the dialog.
84
- * @default true
85
- */
86
- closeOnBackdropPress?: boolean;
87
- /**
88
- * Whether to hide the backdrop layer.
89
- * @default false
90
- */
91
- hideBackdrop?: boolean;
92
- /**
93
- * Modal animation type.
94
- * @default 'fade'
95
- */
96
- animationType?: ModalProps['animationType'];
97
- /**
98
- * Disable animation by forcing `animationType="none"`.
99
- * @default false
100
- */
101
- disableAnimation?: boolean;
102
- /**
103
- * Extra style for the dialog container.
104
- */
105
- style?: ViewStyle;
106
- /**
107
- * Custom styles per section.
108
- */
109
- customAppearance?: DialogCustomAppearance;
110
- } & DialogEvents;
111
- type DialogHeaderProps = {
112
- children?: ReactNode;
113
- /**
114
- * Whether to show a close button in header.
115
- * @default false
116
- */
117
- isClosable?: boolean;
118
- /**
119
- * Custom close button element.
120
- */
121
- closeButton?: ReactNode;
122
- /**
123
- * Optional close callback override for this header.
124
- */
125
- onClose?: () => void;
126
- /**
127
- * Custom style for header container.
128
- */
129
- style?: ViewStyle;
130
- };
131
- type DialogBodyProps = {
132
- children?: ReactNode;
133
- /**
134
- * Custom style for body container.
135
- */
136
- style?: ViewStyle;
137
- };
138
- type DialogFooterProps = {
139
- children?: ReactNode;
140
- /**
141
- * Custom style for footer container.
142
- */
143
- style?: ViewStyle;
144
- };
145
-
146
- declare const Dialog: React.FC<DialogProps>;
147
- declare const DialogHeader: React.FC<DialogHeaderProps>;
148
- declare const DialogBody: React.FC<DialogBodyProps>;
149
- declare const DialogFooter: React.FC<DialogFooterProps>;
150
-
151
- export { Dialog, type DialogBackdrop, DialogBody, type DialogBodyProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, type DialogPlacement, type DialogProps, type DialogSize };
@@ -1,151 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { ModalProps, ViewStyle, TextStyle } from 'react-native';
3
- import { Radius } from '@xaui/core/types';
4
-
5
- type DialogSize = 'sm' | 'md' | 'lg' | 'full';
6
- type DialogPlacement = 'top' | 'center' | 'bottom';
7
- type DialogBackdrop = 'transparent' | 'blurred' | 'opaque';
8
- type DialogCustomAppearance = {
9
- /**
10
- * Custom style for the overlay backdrop.
11
- */
12
- backdrop?: ViewStyle;
13
- /**
14
- * Custom style for the dialog container.
15
- */
16
- container?: ViewStyle;
17
- /**
18
- * Custom style for the dialog header section.
19
- */
20
- header?: ViewStyle;
21
- /**
22
- * Custom style for the dialog body section.
23
- */
24
- body?: ViewStyle;
25
- /**
26
- * Custom style for the dialog footer section.
27
- */
28
- footer?: ViewStyle;
29
- /**
30
- * Custom style for the close button.
31
- */
32
- closeButton?: ViewStyle;
33
- /**
34
- * Custom style for default title text rendered in DialogHeader.
35
- */
36
- headerText?: TextStyle;
37
- /**
38
- * Custom style for default body text rendered in DialogBody.
39
- */
40
- bodyText?: TextStyle;
41
- };
42
- type DialogEvents = {
43
- /**
44
- * Called when the dialog requests to close.
45
- */
46
- onClose?: () => void;
47
- /**
48
- * Called whenever open state changes.
49
- */
50
- onOpenChange?: (isOpen: boolean) => void;
51
- };
52
- type DialogProps = {
53
- /**
54
- * Dialog content.
55
- */
56
- children: ReactNode;
57
- /**
58
- * Controls visibility.
59
- * @default false
60
- */
61
- isOpen: boolean;
62
- /**
63
- * Dialog size preset.
64
- * @default 'md'
65
- */
66
- size?: DialogSize;
67
- /**
68
- * Dialog placement on screen.
69
- * @default 'center'
70
- */
71
- placement?: DialogPlacement;
72
- /**
73
- * Border radius of the dialog container.
74
- * @default 'lg'
75
- */
76
- radius?: Radius;
77
- /**
78
- * Controls backdrop intensity.
79
- * @default 'opaque'
80
- */
81
- backdrop?: DialogBackdrop;
82
- /**
83
- * If true, backdrop press closes the dialog.
84
- * @default true
85
- */
86
- closeOnBackdropPress?: boolean;
87
- /**
88
- * Whether to hide the backdrop layer.
89
- * @default false
90
- */
91
- hideBackdrop?: boolean;
92
- /**
93
- * Modal animation type.
94
- * @default 'fade'
95
- */
96
- animationType?: ModalProps['animationType'];
97
- /**
98
- * Disable animation by forcing `animationType="none"`.
99
- * @default false
100
- */
101
- disableAnimation?: boolean;
102
- /**
103
- * Extra style for the dialog container.
104
- */
105
- style?: ViewStyle;
106
- /**
107
- * Custom styles per section.
108
- */
109
- customAppearance?: DialogCustomAppearance;
110
- } & DialogEvents;
111
- type DialogHeaderProps = {
112
- children?: ReactNode;
113
- /**
114
- * Whether to show a close button in header.
115
- * @default false
116
- */
117
- isClosable?: boolean;
118
- /**
119
- * Custom close button element.
120
- */
121
- closeButton?: ReactNode;
122
- /**
123
- * Optional close callback override for this header.
124
- */
125
- onClose?: () => void;
126
- /**
127
- * Custom style for header container.
128
- */
129
- style?: ViewStyle;
130
- };
131
- type DialogBodyProps = {
132
- children?: ReactNode;
133
- /**
134
- * Custom style for body container.
135
- */
136
- style?: ViewStyle;
137
- };
138
- type DialogFooterProps = {
139
- children?: ReactNode;
140
- /**
141
- * Custom style for footer container.
142
- */
143
- style?: ViewStyle;
144
- };
145
-
146
- declare const Dialog: React.FC<DialogProps>;
147
- declare const DialogHeader: React.FC<DialogHeaderProps>;
148
- declare const DialogBody: React.FC<DialogBodyProps>;
149
- declare const DialogFooter: React.FC<DialogFooterProps>;
150
-
151
- export { Dialog, type DialogBackdrop, DialogBody, type DialogBodyProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, type DialogPlacement, type DialogProps, type DialogSize };