@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.
- package/dist/chunk-JDS6KGCM.cjs +791 -0
- package/dist/chunk-T3ZI2PZ6.js +791 -0
- package/dist/index.cjs +32 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -0
- package/dist/theme/index.cjs +32 -0
- package/dist/theme/index.d.cts +669 -0
- package/dist/theme/index.d.ts +669 -0
- package/dist/theme/index.js +32 -0
- package/package.json +26 -249
- package/README.md +0 -178
- package/dist/alert/index.cjs +0 -340
- package/dist/alert/index.d.cts +0 -46
- package/dist/alert/index.d.ts +0 -46
- package/dist/alert/index.js +0 -340
- package/dist/app-bar/index.cjs +0 -148
- package/dist/app-bar/index.d.cts +0 -59
- package/dist/app-bar/index.d.ts +0 -59
- package/dist/app-bar/index.js +0 -148
- package/dist/autocomplete/index.cjs +0 -1122
- package/dist/autocomplete/index.d.cts +0 -88
- package/dist/autocomplete/index.d.ts +0 -88
- package/dist/autocomplete/index.js +0 -1122
- package/dist/avatar/index.cjs +0 -281
- package/dist/avatar/index.d.cts +0 -123
- package/dist/avatar/index.d.ts +0 -123
- package/dist/avatar/index.js +0 -281
- package/dist/badge/index.cjs +0 -197
- package/dist/badge/index.d.cts +0 -94
- package/dist/badge/index.d.ts +0 -94
- package/dist/badge/index.js +0 -197
- package/dist/bottom-sheet/index.cjs +0 -9
- package/dist/bottom-sheet/index.d.cts +0 -84
- package/dist/bottom-sheet/index.d.ts +0 -84
- package/dist/bottom-sheet/index.js +0 -9
- package/dist/bottom-tab-bar/index.cjs +0 -497
- package/dist/bottom-tab-bar/index.d.cts +0 -211
- package/dist/bottom-tab-bar/index.d.ts +0 -211
- package/dist/bottom-tab-bar/index.js +0 -497
- package/dist/button/index.cjs +0 -392
- package/dist/button/index.d.cts +0 -174
- package/dist/button/index.d.ts +0 -174
- package/dist/button/index.js +0 -392
- package/dist/button.type-j1ZdkkSl.d.cts +0 -4
- package/dist/button.type-j1ZdkkSl.d.ts +0 -4
- package/dist/card/index.cjs +0 -338
- package/dist/card/index.d.cts +0 -191
- package/dist/card/index.d.ts +0 -191
- package/dist/card/index.js +0 -338
- package/dist/carousel/index.cjs +0 -381
- package/dist/carousel/index.d.cts +0 -147
- package/dist/carousel/index.d.ts +0 -147
- package/dist/carousel/index.js +0 -381
- package/dist/chart/index.cjs +0 -1026
- package/dist/chart/index.d.cts +0 -218
- package/dist/chart/index.d.ts +0 -218
- package/dist/chart/index.js +0 -1026
- package/dist/checkbox/index.cjs +0 -443
- package/dist/checkbox/index.d.cts +0 -73
- package/dist/checkbox/index.d.ts +0 -73
- package/dist/checkbox/index.js +0 -443
- package/dist/chip/index.cjs +0 -503
- package/dist/chip/index.d.cts +0 -195
- package/dist/chip/index.d.ts +0 -195
- package/dist/chip/index.js +0 -503
- package/dist/chunk-4JFWQ5XT.js +0 -368
- package/dist/chunk-56RPWZD2.cjs +0 -9
- package/dist/chunk-7UFBLUMV.cjs +0 -136
- package/dist/chunk-A45TVXU5.js +0 -337
- package/dist/chunk-BYWUAPC4.cjs +0 -368
- package/dist/chunk-DECMUMCI.js +0 -0
- package/dist/chunk-DHSTKO3K.cjs +0 -19
- package/dist/chunk-DJ4Q37UT.cjs +0 -75
- package/dist/chunk-EUQDGTST.cjs +0 -1
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-RBSA4NH4.js +0 -136
- package/dist/chunk-SHBDANQN.js +0 -9
- package/dist/chunk-UGEINZM7.cjs +0 -290
- package/dist/chunk-UU4HHBDN.js +0 -290
- package/dist/chunk-VSZEXOUN.js +0 -384
- package/dist/chunk-YIEUN3G5.cjs +0 -384
- package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
- package/dist/chunk-ZY7IUTAT.js +0 -75
- package/dist/color-picker/index.cjs +0 -457
- package/dist/color-picker/index.d.cts +0 -124
- package/dist/color-picker/index.d.ts +0 -124
- package/dist/color-picker/index.js +0 -457
- package/dist/core/index.cjs +0 -24
- package/dist/core/index.d.cts +0 -28
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -24
- package/dist/datepicker/index.cjs +0 -1625
- package/dist/datepicker/index.d.cts +0 -45
- package/dist/datepicker/index.d.ts +0 -45
- package/dist/datepicker/index.js +0 -1625
- package/dist/dialog/index.cjs +0 -372
- package/dist/dialog/index.d.cts +0 -151
- package/dist/dialog/index.d.ts +0 -151
- package/dist/dialog/index.js +0 -372
- package/dist/divider/index.cjs +0 -8
- package/dist/divider/index.d.cts +0 -30
- package/dist/divider/index.d.ts +0 -30
- package/dist/divider/index.js +0 -8
- package/dist/drawer/index.cjs +0 -237
- package/dist/drawer/index.d.cts +0 -58
- package/dist/drawer/index.d.ts +0 -58
- package/dist/drawer/index.js +0 -237
- package/dist/expansion-panel/index.cjs +0 -441
- package/dist/expansion-panel/index.d.cts +0 -153
- package/dist/expansion-panel/index.d.ts +0 -153
- package/dist/expansion-panel/index.js +0 -441
- package/dist/fab/index.cjs +0 -9
- package/dist/fab/index.d.cts +0 -10
- package/dist/fab/index.d.ts +0 -10
- package/dist/fab/index.js +0 -9
- package/dist/fab-menu/index.cjs +0 -330
- package/dist/fab-menu/index.d.cts +0 -125
- package/dist/fab-menu/index.d.ts +0 -125
- package/dist/fab-menu/index.js +0 -330
- package/dist/fab.type-CkUHmXU_.d.ts +0 -86
- package/dist/fab.type-DN0vtAh6.d.cts +0 -86
- package/dist/feature-discovery/index.cjs +0 -464
- package/dist/feature-discovery/index.d.cts +0 -82
- package/dist/feature-discovery/index.d.ts +0 -82
- package/dist/feature-discovery/index.js +0 -464
- package/dist/indicator/index.cjs +0 -8
- package/dist/indicator/index.d.cts +0 -47
- package/dist/indicator/index.d.ts +0 -47
- package/dist/indicator/index.js +0 -8
- package/dist/input/index.cjs +0 -1462
- package/dist/input/index.d.cts +0 -522
- package/dist/input/index.d.ts +0 -522
- package/dist/input/index.js +0 -1462
- package/dist/input-trigger/index.cjs +0 -197
- package/dist/input-trigger/index.d.cts +0 -11
- package/dist/input-trigger/index.d.ts +0 -11
- package/dist/input-trigger/index.js +0 -197
- package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
- package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
- package/dist/list/index.cjs +0 -395
- package/dist/list/index.d.cts +0 -188
- package/dist/list/index.d.ts +0 -188
- package/dist/list/index.js +0 -395
- package/dist/menu/index.cjs +0 -316
- package/dist/menu/index.d.cts +0 -115
- package/dist/menu/index.d.ts +0 -115
- package/dist/menu/index.js +0 -316
- package/dist/menubox/index.cjs +0 -297
- package/dist/menubox/index.d.cts +0 -98
- package/dist/menubox/index.d.ts +0 -98
- package/dist/menubox/index.js +0 -297
- package/dist/pager/index.cjs +0 -205
- package/dist/pager/index.d.cts +0 -93
- package/dist/pager/index.d.ts +0 -93
- package/dist/pager/index.js +0 -205
- package/dist/picker/index.cjs +0 -244
- package/dist/picker/index.d.cts +0 -121
- package/dist/picker/index.d.ts +0 -121
- package/dist/picker/index.js +0 -244
- package/dist/progress/index.cjs +0 -219
- package/dist/progress/index.d.cts +0 -47
- package/dist/progress/index.d.ts +0 -47
- package/dist/progress/index.js +0 -219
- package/dist/radio/index.cjs +0 -465
- package/dist/radio/index.d.cts +0 -145
- package/dist/radio/index.d.ts +0 -145
- package/dist/radio/index.js +0 -465
- package/dist/refresh-control/index.cjs +0 -45
- package/dist/refresh-control/index.d.cts +0 -55
- package/dist/refresh-control/index.d.ts +0 -55
- package/dist/refresh-control/index.js +0 -45
- package/dist/segment-button/index.cjs +0 -405
- package/dist/segment-button/index.d.cts +0 -141
- package/dist/segment-button/index.d.ts +0 -141
- package/dist/segment-button/index.js +0 -405
- package/dist/select/index.cjs +0 -878
- package/dist/select/index.d.cts +0 -192
- package/dist/select/index.d.ts +0 -192
- package/dist/select/index.js +0 -878
- package/dist/skeleton/index.cjs +0 -89
- package/dist/skeleton/index.d.cts +0 -45
- package/dist/skeleton/index.d.ts +0 -45
- package/dist/skeleton/index.js +0 -89
- package/dist/slider/index.cjs +0 -576
- package/dist/slider/index.d.cts +0 -171
- package/dist/slider/index.d.ts +0 -171
- package/dist/slider/index.js +0 -576
- package/dist/snackbar/index.cjs +0 -436
- package/dist/snackbar/index.d.cts +0 -174
- package/dist/snackbar/index.d.ts +0 -174
- package/dist/snackbar/index.js +0 -436
- package/dist/snippet/index.cjs +0 -314
- package/dist/snippet/index.d.cts +0 -95
- package/dist/snippet/index.d.ts +0 -95
- package/dist/snippet/index.js +0 -314
- package/dist/stepper/index.cjs +0 -550
- package/dist/stepper/index.d.cts +0 -137
- package/dist/stepper/index.d.ts +0 -137
- package/dist/stepper/index.js +0 -550
- package/dist/switch/index.cjs +0 -358
- package/dist/switch/index.d.cts +0 -28
- package/dist/switch/index.d.ts +0 -28
- package/dist/switch/index.js +0 -358
- package/dist/tabs/index.cjs +0 -440
- package/dist/tabs/index.d.cts +0 -180
- package/dist/tabs/index.d.ts +0 -180
- package/dist/tabs/index.js +0 -440
- package/dist/timepicker/index.cjs +0 -823
- package/dist/timepicker/index.d.cts +0 -215
- package/dist/timepicker/index.d.ts +0 -215
- package/dist/timepicker/index.js +0 -823
- package/dist/toolbar/index.cjs +0 -333
- package/dist/toolbar/index.d.cts +0 -100
- package/dist/toolbar/index.d.ts +0 -100
- package/dist/toolbar/index.js +0 -333
- package/dist/typography/index.cjs +0 -238
- package/dist/typography/index.d.cts +0 -113
- package/dist/typography/index.d.ts +0 -113
- package/dist/typography/index.js +0 -238
- package/dist/view/index.cjs +0 -1361
- package/dist/view/index.d.cts +0 -833
- package/dist/view/index.d.ts +0 -833
- package/dist/view/index.js +0 -1361
package/dist/dialog/index.js
DELETED
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useBorderRadiusStyles,
|
|
3
|
-
useXUITheme
|
|
4
|
-
} from "../chunk-RBSA4NH4.js";
|
|
5
|
-
|
|
6
|
-
// src/components/dialog/dialog.tsx
|
|
7
|
-
import React, {
|
|
8
|
-
createContext,
|
|
9
|
-
useCallback,
|
|
10
|
-
useContext,
|
|
11
|
-
useEffect,
|
|
12
|
-
useMemo,
|
|
13
|
-
useRef,
|
|
14
|
-
useState
|
|
15
|
-
} from "react";
|
|
16
|
-
import { Modal, Pressable, Text, View } from "react-native";
|
|
17
|
-
import Animated, {
|
|
18
|
-
Easing,
|
|
19
|
-
useAnimatedStyle,
|
|
20
|
-
useSharedValue,
|
|
21
|
-
withTiming
|
|
22
|
-
} from "react-native-reanimated";
|
|
23
|
-
import { scheduleOnRN } from "react-native-worklets";
|
|
24
|
-
import { withOpacity } from "@xaui/core";
|
|
25
|
-
import { CloseIcon } from "@xaui/icons";
|
|
26
|
-
|
|
27
|
-
// src/components/dialog/dialog.style.ts
|
|
28
|
-
import { StyleSheet } from "react-native";
|
|
29
|
-
var styles = StyleSheet.create({
|
|
30
|
-
root: {
|
|
31
|
-
flex: 1
|
|
32
|
-
},
|
|
33
|
-
backdrop: {
|
|
34
|
-
...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 = createContext({});
|
|
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__ */ React.createElement(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 = useXUITheme();
|
|
179
|
-
const radiusStyles = useBorderRadiusStyles(radius);
|
|
180
|
-
const [shouldRender, setShouldRender] = useState(isOpen);
|
|
181
|
-
const openRef = useRef(isOpen);
|
|
182
|
-
const shouldAnimate = !disableAnimation && animationType !== "none";
|
|
183
|
-
const initialOffset = getTranslateOffset(placement, animationType);
|
|
184
|
-
const backdropOpacity = useSharedValue(isOpen ? 1 : 0);
|
|
185
|
-
const dialogOpacity = useSharedValue(isOpen ? 1 : 0);
|
|
186
|
-
const dialogTranslate = useSharedValue(isOpen ? 0 : initialOffset);
|
|
187
|
-
const dialogScale = useSharedValue(isOpen ? 1 : placement === "center" ? 0.98 : 1);
|
|
188
|
-
const requestClose = useCallback(() => {
|
|
189
|
-
onOpenChange?.(false);
|
|
190
|
-
onClose?.();
|
|
191
|
-
}, [onClose, onOpenChange]);
|
|
192
|
-
const handleBackdropPress = () => {
|
|
193
|
-
if (closeOnBackdropPress) {
|
|
194
|
-
requestClose();
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
const finishClosing = useCallback(() => {
|
|
198
|
-
if (!openRef.current) {
|
|
199
|
-
setShouldRender(false);
|
|
200
|
-
}
|
|
201
|
-
}, []);
|
|
202
|
-
useEffect(() => {
|
|
203
|
-
openRef.current = isOpen;
|
|
204
|
-
}, [isOpen]);
|
|
205
|
-
useEffect(() => {
|
|
206
|
-
if (isOpen && !shouldRender) {
|
|
207
|
-
setShouldRender(true);
|
|
208
|
-
}
|
|
209
|
-
}, [isOpen, shouldRender]);
|
|
210
|
-
useEffect(() => {
|
|
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 = withTiming(1, {
|
|
229
|
-
duration: 210,
|
|
230
|
-
easing: Easing.out(Easing.quad)
|
|
231
|
-
});
|
|
232
|
-
dialogOpacity.value = withTiming(1, {
|
|
233
|
-
duration: 220,
|
|
234
|
-
easing: Easing.out(Easing.quad)
|
|
235
|
-
});
|
|
236
|
-
dialogTranslate.value = withTiming(0, {
|
|
237
|
-
duration: ENTER_DURATION,
|
|
238
|
-
easing: Easing.out(Easing.cubic)
|
|
239
|
-
});
|
|
240
|
-
dialogScale.value = withTiming(1, {
|
|
241
|
-
duration: 220,
|
|
242
|
-
easing: Easing.out(Easing.quad)
|
|
243
|
-
});
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
backdropOpacity.value = withTiming(0, {
|
|
247
|
-
duration: 150,
|
|
248
|
-
easing: Easing.in(Easing.quad)
|
|
249
|
-
});
|
|
250
|
-
dialogTranslate.value = withTiming(offset, {
|
|
251
|
-
duration: EXIT_DURATION,
|
|
252
|
-
easing: Easing.in(Easing.cubic)
|
|
253
|
-
});
|
|
254
|
-
dialogScale.value = withTiming(placement === "center" ? 0.98 : 1, {
|
|
255
|
-
duration: 150,
|
|
256
|
-
easing: Easing.in(Easing.quad)
|
|
257
|
-
});
|
|
258
|
-
dialogOpacity.value = withTiming(
|
|
259
|
-
0,
|
|
260
|
-
{
|
|
261
|
-
duration: EXIT_DURATION,
|
|
262
|
-
easing: Easing.in(Easing.quad)
|
|
263
|
-
},
|
|
264
|
-
(finished) => {
|
|
265
|
-
if (finished) {
|
|
266
|
-
scheduleOnRN(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 = useAnimatedStyle(() => ({
|
|
283
|
-
opacity: backdropOpacity.value
|
|
284
|
-
}));
|
|
285
|
-
const dialogAnimatedStyle = useAnimatedStyle(() => ({
|
|
286
|
-
opacity: dialogOpacity.value,
|
|
287
|
-
transform: [{ translateY: dialogTranslate.value }, { scale: dialogScale.value }]
|
|
288
|
-
}));
|
|
289
|
-
const dialogContextValue = useMemo(
|
|
290
|
-
() => ({
|
|
291
|
-
onClose: requestClose,
|
|
292
|
-
customAppearance
|
|
293
|
-
}),
|
|
294
|
-
[customAppearance, requestClose]
|
|
295
|
-
);
|
|
296
|
-
if (!shouldRender) return null;
|
|
297
|
-
return /* @__PURE__ */ React.createElement(Modal, { visible: true, transparent: true, animationType: "none", onRequestClose: requestClose }, /* @__PURE__ */ React.createElement(View, { style: styles.root }, !hideBackdrop && /* @__PURE__ */ React.createElement(
|
|
298
|
-
AnimatedPressable,
|
|
299
|
-
{
|
|
300
|
-
style: [
|
|
301
|
-
styles.backdrop,
|
|
302
|
-
backdropStyles[backdrop],
|
|
303
|
-
backdropAnimatedStyle,
|
|
304
|
-
customAppearance?.backdrop
|
|
305
|
-
],
|
|
306
|
-
onPress: handleBackdropPress
|
|
307
|
-
}
|
|
308
|
-
), /* @__PURE__ */ React.createElement(View, { style: [styles.placementBase, placementStyles[placement]] }, /* @__PURE__ */ React.createElement(DialogContext.Provider, { value: dialogContextValue }, /* @__PURE__ */ React.createElement(Pressable, { onPress: (event) => event.stopPropagation() }, /* @__PURE__ */ React.createElement(
|
|
309
|
-
Animated.View,
|
|
310
|
-
{
|
|
311
|
-
style: [
|
|
312
|
-
styles.dialog,
|
|
313
|
-
sizeStyles[size],
|
|
314
|
-
radiusStyles,
|
|
315
|
-
dialogAnimatedStyle,
|
|
316
|
-
{
|
|
317
|
-
backgroundColor: theme.colors.background,
|
|
318
|
-
borderColor: withOpacity(theme.colors.foreground, 0.14)
|
|
319
|
-
},
|
|
320
|
-
theme.shadows.lg,
|
|
321
|
-
customAppearance?.container,
|
|
322
|
-
style
|
|
323
|
-
]
|
|
324
|
-
},
|
|
325
|
-
children
|
|
326
|
-
))))));
|
|
327
|
-
};
|
|
328
|
-
var AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
329
|
-
var DialogHeader = ({
|
|
330
|
-
children,
|
|
331
|
-
isClosable = false,
|
|
332
|
-
closeButton,
|
|
333
|
-
onClose,
|
|
334
|
-
style
|
|
335
|
-
}) => {
|
|
336
|
-
const theme = useXUITheme();
|
|
337
|
-
const { onClose: contextClose, customAppearance } = useContext(DialogContext);
|
|
338
|
-
const close = onClose ?? contextClose;
|
|
339
|
-
return /* @__PURE__ */ React.createElement(View, { style: [styles.header, customAppearance?.header, style] }, /* @__PURE__ */ React.createElement(View, { style: styles.headerContent }, resolveChildrenContent(children, [
|
|
340
|
-
styles.headerText,
|
|
341
|
-
{ color: theme.colors.foreground },
|
|
342
|
-
customAppearance?.headerText
|
|
343
|
-
])), isClosable && /* @__PURE__ */ React.createElement(
|
|
344
|
-
Pressable,
|
|
345
|
-
{
|
|
346
|
-
accessibilityRole: "button",
|
|
347
|
-
accessibilityLabel: "Close dialog",
|
|
348
|
-
onPress: close,
|
|
349
|
-
style: [styles.closeButton, customAppearance?.closeButton]
|
|
350
|
-
},
|
|
351
|
-
closeButton ?? /* @__PURE__ */ React.createElement(CloseIcon, { size: 22, color: theme.colors.foreground })
|
|
352
|
-
));
|
|
353
|
-
};
|
|
354
|
-
var DialogBody = ({ children, style }) => {
|
|
355
|
-
const theme = useXUITheme();
|
|
356
|
-
const { customAppearance } = useContext(DialogContext);
|
|
357
|
-
return /* @__PURE__ */ React.createElement(View, { style: [styles.body, customAppearance?.body, style] }, resolveChildrenContent(children, [
|
|
358
|
-
styles.bodyText,
|
|
359
|
-
{ color: withOpacity(theme.colors.foreground, 0.9) },
|
|
360
|
-
customAppearance?.bodyText
|
|
361
|
-
]));
|
|
362
|
-
};
|
|
363
|
-
var DialogFooter = ({ children, style }) => {
|
|
364
|
-
const { customAppearance } = useContext(DialogContext);
|
|
365
|
-
return /* @__PURE__ */ React.createElement(View, { style: [styles.footer, customAppearance?.footer, style] }, children);
|
|
366
|
-
};
|
|
367
|
-
export {
|
|
368
|
-
Dialog,
|
|
369
|
-
DialogBody,
|
|
370
|
-
DialogFooter,
|
|
371
|
-
DialogHeader
|
|
372
|
-
};
|
package/dist/divider/index.cjs
DELETED
package/dist/divider/index.d.cts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
3
|
-
|
|
4
|
-
type DividerOrientation = 'horizontal' | 'vertical';
|
|
5
|
-
type DividerProps = {
|
|
6
|
-
/**
|
|
7
|
-
* The size (thickness) of the divider in pixels.
|
|
8
|
-
* @default 1
|
|
9
|
-
*/
|
|
10
|
-
size?: number;
|
|
11
|
-
/**
|
|
12
|
-
* The theme color of the divider.
|
|
13
|
-
* @default 'default'
|
|
14
|
-
*/
|
|
15
|
-
themeColor?: ThemeColor;
|
|
16
|
-
/**
|
|
17
|
-
* Custom color for the divider.
|
|
18
|
-
* If provided, this will override themeColor.
|
|
19
|
-
*/
|
|
20
|
-
color?: string;
|
|
21
|
-
/**
|
|
22
|
-
* The orientation of the divider.
|
|
23
|
-
* @default 'horizontal'
|
|
24
|
-
*/
|
|
25
|
-
orientation?: DividerOrientation;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
declare const Divider: React.FC<DividerProps>;
|
|
29
|
-
|
|
30
|
-
export { Divider, type DividerOrientation, type DividerProps };
|
package/dist/divider/index.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
3
|
-
|
|
4
|
-
type DividerOrientation = 'horizontal' | 'vertical';
|
|
5
|
-
type DividerProps = {
|
|
6
|
-
/**
|
|
7
|
-
* The size (thickness) of the divider in pixels.
|
|
8
|
-
* @default 1
|
|
9
|
-
*/
|
|
10
|
-
size?: number;
|
|
11
|
-
/**
|
|
12
|
-
* The theme color of the divider.
|
|
13
|
-
* @default 'default'
|
|
14
|
-
*/
|
|
15
|
-
themeColor?: ThemeColor;
|
|
16
|
-
/**
|
|
17
|
-
* Custom color for the divider.
|
|
18
|
-
* If provided, this will override themeColor.
|
|
19
|
-
*/
|
|
20
|
-
color?: string;
|
|
21
|
-
/**
|
|
22
|
-
* The orientation of the divider.
|
|
23
|
-
* @default 'horizontal'
|
|
24
|
-
*/
|
|
25
|
-
orientation?: DividerOrientation;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
declare const Divider: React.FC<DividerProps>;
|
|
29
|
-
|
|
30
|
-
export { Divider, type DividerOrientation, type DividerProps };
|
package/dist/divider/index.js
DELETED
package/dist/drawer/index.cjs
DELETED
|
@@ -1,237 +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/drawer/drawer.tsx
|
|
7
|
-
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
8
|
-
var _reactnative = require('react-native');
|
|
9
|
-
|
|
10
|
-
// src/components/drawer/drawer.hook.ts
|
|
11
|
-
|
|
12
|
-
var _core = require('@xaui/core');
|
|
13
|
-
var useDrawerStyles = (themeColor, position, width, height) => {
|
|
14
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
15
|
-
return _react.useMemo.call(void 0, () => {
|
|
16
|
-
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
17
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
18
|
-
const isDefaultThemeColor = safeThemeColor === "default";
|
|
19
|
-
const defaultBackgroundColor = theme.mode === "dark" ? theme.colors.default.container : "#FFFFFF";
|
|
20
|
-
const backgroundColor = isDefaultThemeColor ? defaultBackgroundColor : colorScheme.container;
|
|
21
|
-
const sizeStyle = position === "left" || position === "right" ? { width } : { height };
|
|
22
|
-
return {
|
|
23
|
-
backgroundColor,
|
|
24
|
-
...sizeStyle
|
|
25
|
-
};
|
|
26
|
-
}, [height, position, theme, themeColor, width]);
|
|
27
|
-
};
|
|
28
|
-
var getTranslateValue = (position, size) => {
|
|
29
|
-
switch (position) {
|
|
30
|
-
case "left":
|
|
31
|
-
return { x: -size, y: 0 };
|
|
32
|
-
case "right":
|
|
33
|
-
return { x: size, y: 0 };
|
|
34
|
-
case "top":
|
|
35
|
-
return { x: 0, y: -size };
|
|
36
|
-
case "bottom":
|
|
37
|
-
return { x: 0, y: size };
|
|
38
|
-
default:
|
|
39
|
-
return { x: -size, y: 0 };
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// src/components/drawer/drawer.style.ts
|
|
44
|
-
|
|
45
|
-
var styles = _reactnative.StyleSheet.create({
|
|
46
|
-
overlay: {
|
|
47
|
-
position: "absolute",
|
|
48
|
-
top: 0,
|
|
49
|
-
left: 0,
|
|
50
|
-
right: 0,
|
|
51
|
-
bottom: 0,
|
|
52
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
53
|
-
},
|
|
54
|
-
drawerContainer: {
|
|
55
|
-
position: "absolute",
|
|
56
|
-
backgroundColor: "#ffffff"
|
|
57
|
-
},
|
|
58
|
-
drawerLeft: {
|
|
59
|
-
top: 0,
|
|
60
|
-
left: 0,
|
|
61
|
-
bottom: 0
|
|
62
|
-
},
|
|
63
|
-
drawerRight: {
|
|
64
|
-
top: 0,
|
|
65
|
-
right: 0,
|
|
66
|
-
bottom: 0
|
|
67
|
-
},
|
|
68
|
-
drawerTop: {
|
|
69
|
-
top: 0,
|
|
70
|
-
left: 0,
|
|
71
|
-
right: 0
|
|
72
|
-
},
|
|
73
|
-
drawerBottom: {
|
|
74
|
-
bottom: 0,
|
|
75
|
-
left: 0,
|
|
76
|
-
right: 0
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// src/components/drawer/drawer.tsx
|
|
81
|
-
var Drawer = ({
|
|
82
|
-
children,
|
|
83
|
-
isOpen,
|
|
84
|
-
position = "left",
|
|
85
|
-
themeColor = "default",
|
|
86
|
-
width = 280,
|
|
87
|
-
height = 280,
|
|
88
|
-
showOverlay = true,
|
|
89
|
-
onClose,
|
|
90
|
-
customStyle,
|
|
91
|
-
disableAnimation = false
|
|
92
|
-
}) => {
|
|
93
|
-
const DRAWER_ANIMATION_DURATION = 250;
|
|
94
|
-
const [isModalMounted, setIsModalMounted] = _react.useState.call(void 0, false);
|
|
95
|
-
const [isModalVisible, setIsModalVisible] = _react.useState.call(void 0, false);
|
|
96
|
-
const isModalMountedRef = _react.useRef.call(void 0, false);
|
|
97
|
-
const animationRef = _react.useRef.call(void 0, null);
|
|
98
|
-
const size = position === "left" || position === "right" ? width : height;
|
|
99
|
-
const initialTranslateValues = _react.useMemo.call(void 0,
|
|
100
|
-
() => getTranslateValue(position, size),
|
|
101
|
-
[position, size]
|
|
102
|
-
);
|
|
103
|
-
const translateX = _react.useRef.call(void 0, new _reactnative.Animated.Value(initialTranslateValues.x)).current;
|
|
104
|
-
const translateY = _react.useRef.call(void 0, new _reactnative.Animated.Value(initialTranslateValues.y)).current;
|
|
105
|
-
const overlayOpacity = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
106
|
-
const containerStyle = useDrawerStyles(themeColor, position, width, height);
|
|
107
|
-
const positionStyle = position === "left" ? styles.drawerLeft : position === "right" ? styles.drawerRight : position === "top" ? styles.drawerTop : styles.drawerBottom;
|
|
108
|
-
_react.useEffect.call(void 0, () => {
|
|
109
|
-
const translateValues = getTranslateValue(position, size);
|
|
110
|
-
if (animationRef.current) {
|
|
111
|
-
animationRef.current.stop();
|
|
112
|
-
animationRef.current = null;
|
|
113
|
-
}
|
|
114
|
-
if (isOpen) {
|
|
115
|
-
if (!isModalMountedRef.current) {
|
|
116
|
-
translateX.setValue(translateValues.x);
|
|
117
|
-
translateY.setValue(translateValues.y);
|
|
118
|
-
overlayOpacity.setValue(0);
|
|
119
|
-
isModalMountedRef.current = true;
|
|
120
|
-
setIsModalMounted(true);
|
|
121
|
-
setIsModalVisible(true);
|
|
122
|
-
}
|
|
123
|
-
if (disableAnimation) {
|
|
124
|
-
translateX.setValue(0);
|
|
125
|
-
translateY.setValue(0);
|
|
126
|
-
overlayOpacity.setValue(1);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
const animation2 = _reactnative.Animated.parallel([
|
|
130
|
-
_reactnative.Animated.timing(translateX, {
|
|
131
|
-
toValue: 0,
|
|
132
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
133
|
-
easing: _reactnative.Easing.out(_reactnative.Easing.cubic),
|
|
134
|
-
useNativeDriver: true
|
|
135
|
-
}),
|
|
136
|
-
_reactnative.Animated.timing(translateY, {
|
|
137
|
-
toValue: 0,
|
|
138
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
139
|
-
easing: _reactnative.Easing.out(_reactnative.Easing.cubic),
|
|
140
|
-
useNativeDriver: true
|
|
141
|
-
}),
|
|
142
|
-
_reactnative.Animated.timing(overlayOpacity, {
|
|
143
|
-
toValue: 1,
|
|
144
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
145
|
-
useNativeDriver: true
|
|
146
|
-
})
|
|
147
|
-
]);
|
|
148
|
-
animationRef.current = animation2;
|
|
149
|
-
animation2.start(() => {
|
|
150
|
-
if (animationRef.current === animation2) {
|
|
151
|
-
animationRef.current = null;
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if (!isModalMountedRef.current) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
if (disableAnimation) {
|
|
160
|
-
translateX.setValue(translateValues.x);
|
|
161
|
-
translateY.setValue(translateValues.y);
|
|
162
|
-
overlayOpacity.setValue(0);
|
|
163
|
-
isModalMountedRef.current = false;
|
|
164
|
-
setIsModalVisible(false);
|
|
165
|
-
setIsModalMounted(false);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const animation = _reactnative.Animated.parallel([
|
|
169
|
-
_reactnative.Animated.timing(translateX, {
|
|
170
|
-
toValue: translateValues.x,
|
|
171
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
172
|
-
easing: _reactnative.Easing.in(_reactnative.Easing.cubic),
|
|
173
|
-
useNativeDriver: true
|
|
174
|
-
}),
|
|
175
|
-
_reactnative.Animated.timing(translateY, {
|
|
176
|
-
toValue: translateValues.y,
|
|
177
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
178
|
-
easing: _reactnative.Easing.in(_reactnative.Easing.cubic),
|
|
179
|
-
useNativeDriver: true
|
|
180
|
-
}),
|
|
181
|
-
_reactnative.Animated.timing(overlayOpacity, {
|
|
182
|
-
toValue: 0,
|
|
183
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
184
|
-
useNativeDriver: true
|
|
185
|
-
})
|
|
186
|
-
]);
|
|
187
|
-
animationRef.current = animation;
|
|
188
|
-
animation.start(({ finished }) => {
|
|
189
|
-
if (animationRef.current === animation) {
|
|
190
|
-
animationRef.current = null;
|
|
191
|
-
}
|
|
192
|
-
if (finished) {
|
|
193
|
-
isModalMountedRef.current = false;
|
|
194
|
-
setIsModalVisible(false);
|
|
195
|
-
setIsModalMounted(false);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}, [
|
|
199
|
-
isOpen,
|
|
200
|
-
position,
|
|
201
|
-
size,
|
|
202
|
-
disableAnimation,
|
|
203
|
-
translateX,
|
|
204
|
-
translateY,
|
|
205
|
-
overlayOpacity
|
|
206
|
-
]);
|
|
207
|
-
if (!isModalMounted) {
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
210
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
211
|
-
_reactnative.Modal,
|
|
212
|
-
{
|
|
213
|
-
transparent: true,
|
|
214
|
-
visible: isModalVisible,
|
|
215
|
-
animationType: "none",
|
|
216
|
-
onRequestClose: onClose
|
|
217
|
-
},
|
|
218
|
-
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: { flex: 1 } }, showOverlay && /* @__PURE__ */ _react2.default.createElement(_reactnative.Pressable, { onPress: onClose, style: { flex: 1 } }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: [styles.overlay, { opacity: overlayOpacity }] })), /* @__PURE__ */ _react2.default.createElement(
|
|
219
|
-
_reactnative.Animated.View,
|
|
220
|
-
{
|
|
221
|
-
style: [
|
|
222
|
-
styles.drawerContainer,
|
|
223
|
-
positionStyle,
|
|
224
|
-
containerStyle,
|
|
225
|
-
{
|
|
226
|
-
transform: [{ translateX }, { translateY }]
|
|
227
|
-
},
|
|
228
|
-
customStyle
|
|
229
|
-
]
|
|
230
|
-
},
|
|
231
|
-
children
|
|
232
|
-
))
|
|
233
|
-
);
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
exports.Drawer = Drawer;
|