@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/picker/index.js
DELETED
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InputTrigger
|
|
3
|
-
} from "../chunk-A45TVXU5.js";
|
|
4
|
-
import {
|
|
5
|
-
BottomSheet
|
|
6
|
-
} from "../chunk-4JFWQ5XT.js";
|
|
7
|
-
import "../chunk-SHBDANQN.js";
|
|
8
|
-
import {
|
|
9
|
-
useXUITheme
|
|
10
|
-
} from "../chunk-RBSA4NH4.js";
|
|
11
|
-
|
|
12
|
-
// src/components/picker/picker.tsx
|
|
13
|
-
import React, { useState } from "react";
|
|
14
|
-
import { Pressable, ScrollView, Text, View } from "react-native";
|
|
15
|
-
import { getSafeThemeColor, withOpacity } from "@xaui/core";
|
|
16
|
-
|
|
17
|
-
// src/components/picker/picker.style.ts
|
|
18
|
-
import { StyleSheet } from "react-native";
|
|
19
|
-
var styles = StyleSheet.create({
|
|
20
|
-
sheetContent: {
|
|
21
|
-
flex: 1,
|
|
22
|
-
paddingBottom: 24
|
|
23
|
-
},
|
|
24
|
-
sheetTitle: {
|
|
25
|
-
paddingHorizontal: 20,
|
|
26
|
-
paddingTop: 4,
|
|
27
|
-
paddingBottom: 12,
|
|
28
|
-
fontSize: 16,
|
|
29
|
-
fontWeight: "600"
|
|
30
|
-
},
|
|
31
|
-
optionItem: {
|
|
32
|
-
flexDirection: "row",
|
|
33
|
-
alignItems: "center",
|
|
34
|
-
paddingHorizontal: 20,
|
|
35
|
-
paddingVertical: 14,
|
|
36
|
-
gap: 12
|
|
37
|
-
},
|
|
38
|
-
optionItemDisabled: {
|
|
39
|
-
opacity: 0.4
|
|
40
|
-
},
|
|
41
|
-
optionLabel: {
|
|
42
|
-
flex: 1,
|
|
43
|
-
fontSize: 16
|
|
44
|
-
},
|
|
45
|
-
checkmark: {
|
|
46
|
-
width: 20,
|
|
47
|
-
height: 20,
|
|
48
|
-
borderRadius: 10,
|
|
49
|
-
alignItems: "center",
|
|
50
|
-
justifyContent: "center"
|
|
51
|
-
},
|
|
52
|
-
divider: {
|
|
53
|
-
height: StyleSheet.hairlineWidth,
|
|
54
|
-
marginHorizontal: 20
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// src/components/picker/picker.tsx
|
|
59
|
-
var ChevronDownIcon = ({
|
|
60
|
-
color,
|
|
61
|
-
size
|
|
62
|
-
}) => /* @__PURE__ */ React.createElement(
|
|
63
|
-
View,
|
|
64
|
-
{
|
|
65
|
-
style: {
|
|
66
|
-
width: size,
|
|
67
|
-
height: size,
|
|
68
|
-
alignItems: "center",
|
|
69
|
-
justifyContent: "center"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
/* @__PURE__ */ React.createElement(
|
|
73
|
-
View,
|
|
74
|
-
{
|
|
75
|
-
style: {
|
|
76
|
-
width: size * 0.5,
|
|
77
|
-
height: size * 0.5,
|
|
78
|
-
borderRightWidth: 2,
|
|
79
|
-
borderBottomWidth: 2,
|
|
80
|
-
borderColor: color,
|
|
81
|
-
transform: [{ rotate: "45deg" }],
|
|
82
|
-
marginTop: -(size * 0.15)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
)
|
|
86
|
-
);
|
|
87
|
-
var CheckIcon = ({ color }) => /* @__PURE__ */ React.createElement(
|
|
88
|
-
View,
|
|
89
|
-
{
|
|
90
|
-
style: { width: 20, height: 20, alignItems: "center", justifyContent: "center" }
|
|
91
|
-
},
|
|
92
|
-
/* @__PURE__ */ React.createElement(
|
|
93
|
-
View,
|
|
94
|
-
{
|
|
95
|
-
style: {
|
|
96
|
-
width: 6,
|
|
97
|
-
height: 10,
|
|
98
|
-
borderRightWidth: 2,
|
|
99
|
-
borderBottomWidth: 2,
|
|
100
|
-
borderColor: color,
|
|
101
|
-
transform: [{ rotate: "45deg" }],
|
|
102
|
-
marginTop: -3
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
);
|
|
107
|
-
var OptionItem = ({
|
|
108
|
-
option,
|
|
109
|
-
isSelected,
|
|
110
|
-
themeColor,
|
|
111
|
-
foreground,
|
|
112
|
-
onSelect
|
|
113
|
-
}) => {
|
|
114
|
-
const handlePress = () => {
|
|
115
|
-
if (!option.disabled) {
|
|
116
|
-
onSelect(option.value);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
return /* @__PURE__ */ React.createElement(
|
|
120
|
-
Pressable,
|
|
121
|
-
{
|
|
122
|
-
onPress: handlePress,
|
|
123
|
-
style: [styles.optionItem, option.disabled && styles.optionItemDisabled],
|
|
124
|
-
disabled: option.disabled
|
|
125
|
-
},
|
|
126
|
-
/* @__PURE__ */ React.createElement(
|
|
127
|
-
Text,
|
|
128
|
-
{
|
|
129
|
-
style: [styles.optionLabel, { color: isSelected ? themeColor : foreground }]
|
|
130
|
-
},
|
|
131
|
-
option.label
|
|
132
|
-
),
|
|
133
|
-
isSelected && /* @__PURE__ */ React.createElement(CheckIcon, { color: themeColor })
|
|
134
|
-
);
|
|
135
|
-
};
|
|
136
|
-
var Picker = ({
|
|
137
|
-
options,
|
|
138
|
-
value,
|
|
139
|
-
placeholder = "Select an option...",
|
|
140
|
-
label,
|
|
141
|
-
labelPlacement = "outside",
|
|
142
|
-
description,
|
|
143
|
-
errorMessage,
|
|
144
|
-
sheetTitle,
|
|
145
|
-
themeColor = "primary",
|
|
146
|
-
variant = "colored",
|
|
147
|
-
size = "md",
|
|
148
|
-
radius = "md",
|
|
149
|
-
isOpened,
|
|
150
|
-
isDisabled = false,
|
|
151
|
-
isInvalid = false,
|
|
152
|
-
fullWidth = true,
|
|
153
|
-
sheetStyle,
|
|
154
|
-
endContent,
|
|
155
|
-
onValueChange,
|
|
156
|
-
onOpenChange,
|
|
157
|
-
onClose
|
|
158
|
-
}) => {
|
|
159
|
-
const [internalIsOpen, setInternalIsOpen] = useState(false);
|
|
160
|
-
const isControlled = isOpened !== void 0;
|
|
161
|
-
const isOpen = isControlled ? Boolean(isOpened) : internalIsOpen;
|
|
162
|
-
const theme = useXUITheme();
|
|
163
|
-
const sheetBackground = theme.mode === "dark" ? theme.colors.background : "#ffffff";
|
|
164
|
-
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
165
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
166
|
-
const selectedOption = options.find((opt) => opt.value === value);
|
|
167
|
-
const displayLabel = selectedOption?.label;
|
|
168
|
-
const setOpen = (nextOpen) => {
|
|
169
|
-
if (nextOpen && isDisabled) return;
|
|
170
|
-
if (!isControlled) {
|
|
171
|
-
setInternalIsOpen(nextOpen);
|
|
172
|
-
}
|
|
173
|
-
onOpenChange?.(nextOpen);
|
|
174
|
-
};
|
|
175
|
-
const handleOpen = () => {
|
|
176
|
-
setOpen(true);
|
|
177
|
-
};
|
|
178
|
-
const requestClose = () => {
|
|
179
|
-
setOpen(false);
|
|
180
|
-
};
|
|
181
|
-
const handleSheetClose = () => {
|
|
182
|
-
if (isOpen) {
|
|
183
|
-
setOpen(false);
|
|
184
|
-
}
|
|
185
|
-
onClose?.();
|
|
186
|
-
};
|
|
187
|
-
const handleSelect = (selectedValue) => {
|
|
188
|
-
onValueChange?.(selectedValue);
|
|
189
|
-
requestClose();
|
|
190
|
-
};
|
|
191
|
-
const chevronColor = withOpacity(theme.colors.foreground, 0.45);
|
|
192
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
193
|
-
InputTrigger,
|
|
194
|
-
{
|
|
195
|
-
value: displayLabel,
|
|
196
|
-
placeholder,
|
|
197
|
-
label,
|
|
198
|
-
labelPlacement,
|
|
199
|
-
description,
|
|
200
|
-
errorMessage,
|
|
201
|
-
themeColor,
|
|
202
|
-
variant,
|
|
203
|
-
size,
|
|
204
|
-
radius,
|
|
205
|
-
isDisabled,
|
|
206
|
-
isInvalid,
|
|
207
|
-
fullWidth,
|
|
208
|
-
endContent: endContent ?? /* @__PURE__ */ React.createElement(ChevronDownIcon, { color: chevronColor, size: 20 }),
|
|
209
|
-
onPress: handleOpen
|
|
210
|
-
}
|
|
211
|
-
), /* @__PURE__ */ React.createElement(
|
|
212
|
-
BottomSheet,
|
|
213
|
-
{
|
|
214
|
-
isOpen,
|
|
215
|
-
snapPoints: [Math.min(0.35 + options.length * 0.065, 0.85)],
|
|
216
|
-
themeColor,
|
|
217
|
-
onClose: handleSheetClose,
|
|
218
|
-
style: { backgroundColor: sheetBackground, ...sheetStyle }
|
|
219
|
-
},
|
|
220
|
-
/* @__PURE__ */ React.createElement(View, { style: styles.sheetContent }, sheetTitle ? /* @__PURE__ */ React.createElement(Text, { style: [styles.sheetTitle, { color: theme.colors.foreground }] }, sheetTitle) : null, /* @__PURE__ */ React.createElement(ScrollView, null, options.map((option, index) => /* @__PURE__ */ React.createElement(View, { key: option.value }, /* @__PURE__ */ React.createElement(
|
|
221
|
-
OptionItem,
|
|
222
|
-
{
|
|
223
|
-
option,
|
|
224
|
-
isSelected: option.value === value,
|
|
225
|
-
themeColor: colorScheme.main,
|
|
226
|
-
foreground: theme.colors.foreground,
|
|
227
|
-
onSelect: handleSelect
|
|
228
|
-
}
|
|
229
|
-
), index < options.length - 1 && /* @__PURE__ */ React.createElement(
|
|
230
|
-
View,
|
|
231
|
-
{
|
|
232
|
-
style: [
|
|
233
|
-
styles.divider,
|
|
234
|
-
{
|
|
235
|
-
backgroundColor: withOpacity(theme.colors.foreground, 0.06)
|
|
236
|
-
}
|
|
237
|
-
]
|
|
238
|
-
}
|
|
239
|
-
)))))
|
|
240
|
-
));
|
|
241
|
-
};
|
|
242
|
-
export {
|
|
243
|
-
Picker
|
|
244
|
-
};
|
package/dist/progress/index.cjs
DELETED
|
@@ -1,219 +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(); } }require('../chunk-56RPWZD2.cjs');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
|
|
5
|
-
|
|
6
|
-
// src/components/progress/progress.tsx
|
|
7
|
-
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
8
|
-
var _reactnative = require('react-native');
|
|
9
|
-
|
|
10
|
-
// src/components/progress/circular-progress-indicator.tsx
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
14
|
-
var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);
|
|
15
|
-
|
|
16
|
-
// src/components/progress/progress.hook.ts
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var MIN_VALUE = 0;
|
|
20
|
-
var MAX_VALUE = 1;
|
|
21
|
-
var clampProgress = (value) => Math.max(MIN_VALUE, Math.min(MAX_VALUE, value));
|
|
22
|
-
var useProgressAnimation = (value, disableAnimation) => {
|
|
23
|
-
const progressAnim = _reactnativereanimated.useSharedValue.call(void 0, clampProgress(value));
|
|
24
|
-
_react.useEffect.call(void 0, () => {
|
|
25
|
-
const clampedValue = clampProgress(value);
|
|
26
|
-
if (disableAnimation) {
|
|
27
|
-
progressAnim.value = clampedValue;
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
progressAnim.value = _reactnativereanimated.withTiming.call(void 0, clampedValue, {
|
|
31
|
-
duration: 500,
|
|
32
|
-
easing: _reactnativereanimated.Easing.bezier(0, 0, 0.2, 1)
|
|
33
|
-
});
|
|
34
|
-
}, [value, disableAnimation, progressAnim]);
|
|
35
|
-
return progressAnim;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// src/components/progress/progress.style.ts
|
|
39
|
-
|
|
40
|
-
var styles = _reactnative.StyleSheet.create({
|
|
41
|
-
container: {
|
|
42
|
-
flexShrink: 1,
|
|
43
|
-
flexBasis: "auto",
|
|
44
|
-
width: "100%"
|
|
45
|
-
},
|
|
46
|
-
track: {
|
|
47
|
-
width: "100%",
|
|
48
|
-
overflow: "hidden"
|
|
49
|
-
},
|
|
50
|
-
progress: {
|
|
51
|
-
height: "100%"
|
|
52
|
-
},
|
|
53
|
-
circleContainer: {
|
|
54
|
-
justifyContent: "center",
|
|
55
|
-
alignItems: "center"
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// src/components/progress/circular-progress-indicator.tsx
|
|
60
|
-
var AnimatedCircle = _reactnativereanimated2.default.createAnimatedComponent(_reactnativesvg.Circle);
|
|
61
|
-
var CircularProgressIndicator = ({
|
|
62
|
-
size = 40,
|
|
63
|
-
color,
|
|
64
|
-
backgroundColor,
|
|
65
|
-
value,
|
|
66
|
-
borderRadius,
|
|
67
|
-
disableAnimation
|
|
68
|
-
}) => {
|
|
69
|
-
const progressAnim = useProgressAnimation(value, disableAnimation);
|
|
70
|
-
const strokeWidth = size * 0.1;
|
|
71
|
-
const radius = (size - strokeWidth) / 2;
|
|
72
|
-
const circumference = 2 * Math.PI * radius;
|
|
73
|
-
const center = size / 2;
|
|
74
|
-
const strokeCap = borderRadius && borderRadius > 0 ? "round" : "butt";
|
|
75
|
-
const animatedProps = _reactnativereanimated.useAnimatedProps.call(void 0, () => ({
|
|
76
|
-
strokeDashoffset: circumference * (1 - progressAnim.value)
|
|
77
|
-
}));
|
|
78
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.circleContainer, { width: size, height: size }] }, /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, style: { transform: [{ rotate: "-90deg" }] } }, /* @__PURE__ */ _react2.default.createElement(
|
|
79
|
-
_reactnativesvg.Circle,
|
|
80
|
-
{
|
|
81
|
-
cx: center,
|
|
82
|
-
cy: center,
|
|
83
|
-
r: radius,
|
|
84
|
-
stroke: backgroundColor,
|
|
85
|
-
strokeWidth,
|
|
86
|
-
fill: "none"
|
|
87
|
-
}
|
|
88
|
-
), /* @__PURE__ */ _react2.default.createElement(
|
|
89
|
-
AnimatedCircle,
|
|
90
|
-
{
|
|
91
|
-
cx: center,
|
|
92
|
-
cy: center,
|
|
93
|
-
r: radius,
|
|
94
|
-
stroke: color,
|
|
95
|
-
strokeWidth,
|
|
96
|
-
strokeLinecap: strokeCap,
|
|
97
|
-
strokeDasharray: circumference,
|
|
98
|
-
animatedProps,
|
|
99
|
-
fill: "none"
|
|
100
|
-
}
|
|
101
|
-
)));
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// src/components/progress/linear-progress-indicator.tsx
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var LinearProgressIndicator = ({
|
|
109
|
-
size = 4,
|
|
110
|
-
color,
|
|
111
|
-
backgroundColor,
|
|
112
|
-
value,
|
|
113
|
-
borderRadius,
|
|
114
|
-
disableAnimation
|
|
115
|
-
}) => {
|
|
116
|
-
const progressAnim = useProgressAnimation(value, disableAnimation);
|
|
117
|
-
const radius = Math.max(0, Math.min(size / 2, _nullishCoalesce(borderRadius, () => ( 0))));
|
|
118
|
-
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
|
|
119
|
-
width: `${progressAnim.value * 100}%`
|
|
120
|
-
}));
|
|
121
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
122
|
-
_reactnative.View,
|
|
123
|
-
{
|
|
124
|
-
style: [
|
|
125
|
-
styles.track,
|
|
126
|
-
{
|
|
127
|
-
height: size,
|
|
128
|
-
backgroundColor,
|
|
129
|
-
borderRadius: radius
|
|
130
|
-
}
|
|
131
|
-
]
|
|
132
|
-
},
|
|
133
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
134
|
-
_reactnativereanimated2.default.View,
|
|
135
|
-
{
|
|
136
|
-
style: [
|
|
137
|
-
styles.progress,
|
|
138
|
-
animatedStyle,
|
|
139
|
-
{
|
|
140
|
-
backgroundColor: color,
|
|
141
|
-
borderRadius: radius
|
|
142
|
-
}
|
|
143
|
-
]
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// src/components/progress/progress.tsx
|
|
150
|
-
var Progress = (props) => {
|
|
151
|
-
const {
|
|
152
|
-
variant = "linear",
|
|
153
|
-
themeColor = "primary",
|
|
154
|
-
value,
|
|
155
|
-
color,
|
|
156
|
-
backgroundColor,
|
|
157
|
-
size,
|
|
158
|
-
disableAnimation = false
|
|
159
|
-
} = props;
|
|
160
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
161
|
-
const colorScheme = theme.colors[themeColor];
|
|
162
|
-
const mainColor = _nullishCoalesce(color, () => ( colorScheme.main));
|
|
163
|
-
const trackColor = _nullishCoalesce(backgroundColor, () => ( colorScheme.container));
|
|
164
|
-
const clampedValue = clampProgress(value);
|
|
165
|
-
const accessibilityValue = {
|
|
166
|
-
min: 0,
|
|
167
|
-
max: 100,
|
|
168
|
-
now: clampedValue * 100
|
|
169
|
-
};
|
|
170
|
-
if (variant === "circular") {
|
|
171
|
-
const circleSize = _nullishCoalesce(size, () => ( 40));
|
|
172
|
-
const borderRadius2 = "borderRadius" in props ? props.borderRadius : void 0;
|
|
173
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
174
|
-
_reactnative.View,
|
|
175
|
-
{
|
|
176
|
-
style: [styles.circleContainer, { width: circleSize, height: circleSize }],
|
|
177
|
-
accessible: true,
|
|
178
|
-
accessibilityRole: "progressbar",
|
|
179
|
-
accessibilityValue
|
|
180
|
-
},
|
|
181
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
182
|
-
CircularProgressIndicator,
|
|
183
|
-
{
|
|
184
|
-
size: circleSize,
|
|
185
|
-
color: mainColor,
|
|
186
|
-
backgroundColor: trackColor,
|
|
187
|
-
value: clampedValue,
|
|
188
|
-
borderRadius: borderRadius2,
|
|
189
|
-
disableAnimation
|
|
190
|
-
}
|
|
191
|
-
)
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
const linearSize = _nullishCoalesce(size, () => ( 4));
|
|
195
|
-
const borderRadius = "borderRadius" in props ? props.borderRadius : void 0;
|
|
196
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
197
|
-
_reactnative.View,
|
|
198
|
-
{
|
|
199
|
-
style: styles.container,
|
|
200
|
-
accessible: true,
|
|
201
|
-
accessibilityRole: "progressbar",
|
|
202
|
-
accessibilityValue
|
|
203
|
-
},
|
|
204
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
205
|
-
LinearProgressIndicator,
|
|
206
|
-
{
|
|
207
|
-
size: linearSize,
|
|
208
|
-
color: mainColor,
|
|
209
|
-
backgroundColor: trackColor,
|
|
210
|
-
value: clampedValue,
|
|
211
|
-
borderRadius,
|
|
212
|
-
disableAnimation
|
|
213
|
-
}
|
|
214
|
-
)
|
|
215
|
-
);
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
exports.Progress = Progress;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
3
|
-
|
|
4
|
-
type ProgressVariant = 'linear' | 'circular';
|
|
5
|
-
type ProgressIndicatorProps = {
|
|
6
|
-
/**
|
|
7
|
-
* The variant of the progress indicator.
|
|
8
|
-
* @default 'linear'
|
|
9
|
-
*/
|
|
10
|
-
variant?: ProgressVariant;
|
|
11
|
-
/**
|
|
12
|
-
* The size of the progress indicator (height for linear, diameter for circular).
|
|
13
|
-
* @default 4 for linear, 40 for circular
|
|
14
|
-
*/
|
|
15
|
-
size?: number;
|
|
16
|
-
/**
|
|
17
|
-
* The theme color of the progress indicator.
|
|
18
|
-
* @default 'primary'
|
|
19
|
-
*/
|
|
20
|
-
themeColor?: ThemeColor;
|
|
21
|
-
/**
|
|
22
|
-
* The custom color of the progress indicator.
|
|
23
|
-
* Overrides themeColor.
|
|
24
|
-
*/
|
|
25
|
-
color?: string;
|
|
26
|
-
/**
|
|
27
|
-
* The background color of the track.
|
|
28
|
-
*/
|
|
29
|
-
backgroundColor?: string;
|
|
30
|
-
/**
|
|
31
|
-
* The current value of the progress bar (0 to 1).
|
|
32
|
-
*/
|
|
33
|
-
value: number;
|
|
34
|
-
/**
|
|
35
|
-
* Whether to disable the animation.
|
|
36
|
-
* @default false
|
|
37
|
-
*/
|
|
38
|
-
disableAnimation?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* The border radius of the indicator and track.
|
|
41
|
-
*/
|
|
42
|
-
borderRadius?: number;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
declare const Progress: React.FC<ProgressIndicatorProps>;
|
|
46
|
-
|
|
47
|
-
export { Progress, type ProgressIndicatorProps };
|
package/dist/progress/index.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
3
|
-
|
|
4
|
-
type ProgressVariant = 'linear' | 'circular';
|
|
5
|
-
type ProgressIndicatorProps = {
|
|
6
|
-
/**
|
|
7
|
-
* The variant of the progress indicator.
|
|
8
|
-
* @default 'linear'
|
|
9
|
-
*/
|
|
10
|
-
variant?: ProgressVariant;
|
|
11
|
-
/**
|
|
12
|
-
* The size of the progress indicator (height for linear, diameter for circular).
|
|
13
|
-
* @default 4 for linear, 40 for circular
|
|
14
|
-
*/
|
|
15
|
-
size?: number;
|
|
16
|
-
/**
|
|
17
|
-
* The theme color of the progress indicator.
|
|
18
|
-
* @default 'primary'
|
|
19
|
-
*/
|
|
20
|
-
themeColor?: ThemeColor;
|
|
21
|
-
/**
|
|
22
|
-
* The custom color of the progress indicator.
|
|
23
|
-
* Overrides themeColor.
|
|
24
|
-
*/
|
|
25
|
-
color?: string;
|
|
26
|
-
/**
|
|
27
|
-
* The background color of the track.
|
|
28
|
-
*/
|
|
29
|
-
backgroundColor?: string;
|
|
30
|
-
/**
|
|
31
|
-
* The current value of the progress bar (0 to 1).
|
|
32
|
-
*/
|
|
33
|
-
value: number;
|
|
34
|
-
/**
|
|
35
|
-
* Whether to disable the animation.
|
|
36
|
-
* @default false
|
|
37
|
-
*/
|
|
38
|
-
disableAnimation?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* The border radius of the indicator and track.
|
|
41
|
-
*/
|
|
42
|
-
borderRadius?: number;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
declare const Progress: React.FC<ProgressIndicatorProps>;
|
|
46
|
-
|
|
47
|
-
export { Progress, type ProgressIndicatorProps };
|