@xaui/native 0.9.1-alpha.3 → 0.9.1-alpha.31
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-3FV4COTM.js +68 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-42FMGB5M.js +661 -0
- package/dist/chunk-4GTAZM2C.js +174 -0
- package/dist/chunk-4XPLPQLM.cjs +147 -0
- package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
- package/dist/chunk-5GO7MAVY.cjs +74 -0
- package/dist/chunk-5PTBRJM7.cjs +346 -0
- package/dist/chunk-5RQ7AZPN.cjs +455 -0
- package/dist/chunk-5Z4P6WHR.cjs +525 -0
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/chunk-7SEZGVTY.js +62 -0
- package/dist/chunk-7XKQJQF2.cjs +70 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
- package/dist/chunk-A5OCK3C2.js +525 -0
- package/dist/chunk-AETWQQWU.cjs +92 -0
- package/dist/chunk-ANNUYP55.cjs +431 -0
- package/dist/chunk-BA2DBSAN.js +102 -0
- package/dist/chunk-BFMTUMTU.js +669 -0
- package/dist/chunk-BVJQ3UPZ.js +62 -0
- package/dist/chunk-DFME724B.js +147 -0
- package/dist/chunk-E2CWBQTV.js +119 -0
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/chunk-F6CQ6CBI.cjs +112 -0
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G7K652GC.js +145 -0
- package/dist/chunk-GGW42MY4.js +20 -0
- package/dist/chunk-GLGU2WFL.cjs +190 -0
- package/dist/chunk-GPVNCJ3Z.cjs +696 -0
- package/dist/chunk-GVQOD3VW.js +74 -0
- package/dist/chunk-IHOCANCQ.js +293 -0
- package/dist/chunk-JDFV4W6N.cjs +700 -0
- package/dist/chunk-KOC3KQIT.js +124 -0
- package/dist/chunk-KPWZLUES.cjs +124 -0
- package/dist/chunk-L7JN6OBQ.cjs +314 -0
- package/dist/chunk-MC7SY2QH.cjs +20 -0
- package/dist/chunk-MDVSCWJI.js +314 -0
- package/dist/chunk-N527BTY4.cjs +366 -0
- package/dist/chunk-NYRXUGVL.js +104 -0
- package/dist/{chunk-AW63PTQ4.cjs → chunk-OHEHPQLC.cjs} +72 -72
- package/dist/chunk-Q3WFY5N3.js +366 -0
- package/dist/chunk-QGN2BBJO.cjs +104 -0
- package/dist/chunk-RDTKAAHX.js +346 -0
- package/dist/chunk-TGZZ3RZU.cjs +86 -0
- package/dist/{chunk-2KXQATVL.js → chunk-TZG3DERP.js} +46 -46
- package/dist/chunk-URSKA2VR.js +190 -0
- package/dist/chunk-V4WDMM6Z.js +86 -0
- package/dist/chunk-VJEER76X.js +455 -0
- package/dist/chunk-VZBWYWEI.cjs +736 -0
- package/dist/chunk-WR7YLDVV.cjs +68 -0
- package/dist/chunk-X4HQ4H2V.js +701 -0
- package/dist/chunk-XFSW3ZNI.cjs +145 -0
- package/dist/chunk-XQFAUDR2.cjs +62 -0
- package/dist/chunk-ZH5XVNHG.js +92 -0
- package/dist/chunk-ZH6BHLQR.js +431 -0
- package/dist/chunk-ZP2E2H2G.cjs +119 -0
- package/dist/chunk-ZVWXM3UK.cjs +293 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- package/dist/components/alert/index.cjs +20 -0
- package/dist/components/alert/index.d.cts +169 -0
- package/dist/components/alert/index.d.ts +169 -0
- package/dist/components/alert/index.js +20 -0
- package/dist/components/button/index.cjs +21 -0
- package/dist/components/button/index.d.cts +613 -0
- package/dist/components/button/index.d.ts +613 -0
- package/dist/components/button/index.js +21 -0
- package/dist/components/card/index.cjs +22 -0
- package/dist/components/card/index.d.cts +620 -0
- package/dist/components/card/index.d.ts +620 -0
- package/dist/components/card/index.js +22 -0
- package/dist/components/checkbox/index.cjs +26 -0
- package/dist/components/checkbox/index.d.cts +1136 -0
- package/dist/components/checkbox/index.d.ts +1136 -0
- package/dist/components/checkbox/index.js +26 -0
- package/dist/components/chip/index.cjs +20 -0
- package/dist/components/chip/index.d.cts +608 -0
- package/dist/components/chip/index.d.ts +608 -0
- package/dist/components/chip/index.js +20 -0
- package/dist/components/divider/index.cjs +13 -0
- package/dist/components/divider/index.d.cts +117 -0
- package/dist/components/divider/index.d.ts +117 -0
- package/dist/components/divider/index.js +13 -0
- package/dist/components/input/index.cjs +25 -0
- package/dist/components/input/index.d.cts +205 -0
- package/dist/components/input/index.d.ts +205 -0
- package/dist/components/input/index.js +25 -0
- package/dist/components/input-group/index.cjs +27 -0
- package/dist/components/input-group/index.d.cts +270 -0
- package/dist/components/input-group/index.d.ts +270 -0
- package/dist/components/input-group/index.js +27 -0
- package/dist/components/input-otp/index.cjs +29 -0
- package/dist/components/input-otp/index.d.cts +325 -0
- package/dist/components/input-otp/index.d.ts +325 -0
- package/dist/components/input-otp/index.js +29 -0
- package/dist/components/radio/index.cjs +26 -0
- package/dist/components/radio/index.d.cts +1102 -0
- package/dist/components/radio/index.d.ts +1102 -0
- package/dist/components/radio/index.js +26 -0
- package/dist/components/spinner/index.cjs +16 -0
- package/dist/components/spinner/index.d.cts +104 -0
- package/dist/components/spinner/index.d.ts +104 -0
- package/dist/components/spinner/index.js +16 -0
- package/dist/components/switch/index.cjs +27 -0
- package/dist/components/switch/index.d.cts +1154 -0
- package/dist/components/switch/index.d.ts +1154 -0
- package/dist/components/switch/index.js +27 -0
- package/dist/components/text-area/index.cjs +14 -0
- package/dist/components/text-area/index.d.cts +73 -0
- package/dist/components/text-area/index.d.ts +73 -0
- package/dist/components/text-area/index.js +14 -0
- package/dist/components/typography/index.cjs +15 -0
- package/dist/components/typography/index.d.cts +116 -0
- package/dist/components/typography/index.d.ts +116 -0
- package/dist/components/typography/index.js +15 -0
- package/dist/components/view/index.cjs +17 -0
- package/dist/components/view/index.d.cts +152 -0
- package/dist/components/view/index.d.ts +152 -0
- package/dist/components/view/index.js +17 -0
- package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
- package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
- package/dist/icon.type-Kml72iSz.d.ts +73 -0
- package/dist/icon.type-d_i9ma-i.d.cts +73 -0
- package/dist/index.cjs +252 -4
- package/dist/index.d.cts +110 -4
- package/dist/index.d.ts +110 -4
- package/dist/index.js +271 -23
- package/dist/input.type-BUMDlzL9.d.cts +167 -0
- package/dist/input.type-D2qgi03E.d.ts +167 -0
- package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
- package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
- package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
- package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
- package/dist/system/index.cjs +60 -3
- package/dist/system/index.d.cts +347 -181
- package/dist/system/index.d.ts +347 -181
- package/dist/system/index.js +71 -14
- package/dist/theme/index.cjs +4 -3
- package/dist/theme/index.d.cts +34 -23
- package/dist/theme/index.d.ts +34 -23
- package/dist/theme/index.js +3 -2
- package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
- package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
- package/package.json +184 -18
- package/dist/chunk-QAMNNTGM.js +0 -637
- package/dist/chunk-V63JO65F.cjs +0 -637
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
import { useControllableState } from "./chunk-F6W3JQ7K.js";
|
|
2
|
+
import { PressableFeedback } from "./chunk-BFMTUMTU.js";
|
|
3
|
+
import { usePressState } from "./chunk-423RQBOX.js";
|
|
4
|
+
import { createRecipe, radiusAxis } from "./chunk-4GTAZM2C.js";
|
|
5
|
+
import { useXAUITheme } from "./chunk-A3EGFI6T.js";
|
|
6
|
+
import { childrenToString, createSlotContext } from "./chunk-E2CWBQTV.js";
|
|
7
|
+
import { useStyleProps } from "./chunk-URSKA2VR.js";
|
|
8
|
+
|
|
9
|
+
// src/components/switch/switch-label.tsx
|
|
10
|
+
import { forwardRef } from "react";
|
|
11
|
+
import { Text } from "react-native";
|
|
12
|
+
|
|
13
|
+
// src/components/switch/switch.context.ts
|
|
14
|
+
var [SwitchProvider, useSwitch] = createSlotContext("Switch");
|
|
15
|
+
|
|
16
|
+
// src/components/switch/switch-label.tsx
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
var SwitchLabel = forwardRef(function SwitchLabel2({
|
|
19
|
+
children,
|
|
20
|
+
style,
|
|
21
|
+
...props
|
|
22
|
+
}, ref) {
|
|
23
|
+
const {
|
|
24
|
+
labelStyle
|
|
25
|
+
} = useSwitch();
|
|
26
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
27
|
+
return /* @__PURE__ */jsx(Text, {
|
|
28
|
+
ref,
|
|
29
|
+
style: [labelStyle, styleProps, style],
|
|
30
|
+
...rest,
|
|
31
|
+
children
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
SwitchLabel.displayName = "XAUI.Switch.Label";
|
|
35
|
+
|
|
36
|
+
// src/components/switch/switch-thumb.tsx
|
|
37
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
38
|
+
import { I18nManager, View } from "react-native";
|
|
39
|
+
import Animated, { interpolateColor, useAnimatedStyle, useDerivedValue, withTiming } from "react-native-reanimated";
|
|
40
|
+
|
|
41
|
+
// src/components/switch/switch.style.ts
|
|
42
|
+
var SWITCH_DURATION = 175;
|
|
43
|
+
|
|
44
|
+
// src/components/switch/switch-thumb.tsx
|
|
45
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
46
|
+
var SwitchThumb = forwardRef2(function SwitchThumb2({
|
|
47
|
+
children,
|
|
48
|
+
animation = true,
|
|
49
|
+
style,
|
|
50
|
+
...props
|
|
51
|
+
}, ref) {
|
|
52
|
+
const {
|
|
53
|
+
thumbStyle,
|
|
54
|
+
thumb,
|
|
55
|
+
travel,
|
|
56
|
+
isSelected
|
|
57
|
+
} = useSwitch();
|
|
58
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
59
|
+
const base = [thumbStyle, styleProps, style];
|
|
60
|
+
const distance = I18nManager.isRTL ? -travel : travel;
|
|
61
|
+
if (!animation) {
|
|
62
|
+
return /* @__PURE__ */jsx2(View, {
|
|
63
|
+
ref,
|
|
64
|
+
...rest,
|
|
65
|
+
style: [base, {
|
|
66
|
+
backgroundColor: isSelected ? thumb.on : thumb.off,
|
|
67
|
+
transform: [{
|
|
68
|
+
translateX: isSelected ? distance : 0
|
|
69
|
+
}]
|
|
70
|
+
}],
|
|
71
|
+
children
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return /* @__PURE__ */jsx2(SlidingThumb, {
|
|
75
|
+
ref,
|
|
76
|
+
style: base,
|
|
77
|
+
colors: thumb,
|
|
78
|
+
distance,
|
|
79
|
+
isSelected,
|
|
80
|
+
...rest,
|
|
81
|
+
children
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
SwitchThumb.displayName = "XAUI.Switch.Thumb";
|
|
85
|
+
const _worklet_8529533919367_init_data = {
|
|
86
|
+
code: "function chunk42FMGB5MJs1(){const{withTiming,isSelected,SWITCH_DURATION}=this.__closure;return withTiming(isSelected?1:0,{duration:SWITCH_DURATION});}",
|
|
87
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-42FMGB5M.js",
|
|
88
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunk42FMGB5MJs1\",\"withTiming\",\"isSelected\",\"SWITCH_DURATION\",\"__closure\",\"duration\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-42FMGB5M.js\"],\"mappings\":\"AA4FmC,SAAAA,gBAAMA,CAAA,QAAAC,UAAA,CAAAC,UAAA,CAAAC,eAAA,OAAAC,SAAA,CAErC,MAAO,CAAAH,UAAU,CAACC,UAAU,CAAG,CAAC,CAAG,CAAC,CAAE,CAAEG,QAAQ,CAAEF,eAAgB,CAAC,CAAC,CACtE\",\"ignoreList\":[]}"
|
|
89
|
+
};
|
|
90
|
+
const _worklet_5196381840933_init_data = {
|
|
91
|
+
code: "function chunk42FMGB5MJs2(){const{progress,distance,interpolateColor,colors}=this.__closure;return{transform:[{translateX:progress.value*distance}],backgroundColor:interpolateColor(progress.value,[0,1],[colors.off,colors.on])};}",
|
|
92
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-42FMGB5M.js",
|
|
93
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunk42FMGB5MJs2\",\"progress\",\"distance\",\"interpolateColor\",\"colors\",\"__closure\",\"transform\",\"translateX\",\"value\",\"backgroundColor\",\"off\",\"on\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-42FMGB5M.js\"],\"mappings\":\"AAgGyC,SAAAA,gBAAMA,CAAA,QAAAC,QAAA,CAAAC,QAAA,CAAAC,gBAAA,CAAAC,MAAA,OAAAC,SAAA,CAE3C,MAAO,CACLC,SAAS,CAAE,CAAC,CAAEC,UAAU,CAAEN,QAAQ,CAACO,KAAK,CAAGN,QAAS,CAAC,CAAC,CACtDO,eAAe,CAAEN,gBAAgB,CAC/BF,QAAQ,CAACO,KAAK,CACd,CAAC,CAAC,CAAE,CAAC,CAAC,CACN,CAACJ,MAAM,CAACM,GAAG,CAAEN,MAAM,CAACO,EAAE,CACxB,CACF,CAAC,CACH\",\"ignoreList\":[]}"
|
|
94
|
+
};
|
|
95
|
+
var SlidingThumb = forwardRef2(function SlidingThumb2({
|
|
96
|
+
style,
|
|
97
|
+
colors,
|
|
98
|
+
distance,
|
|
99
|
+
isSelected,
|
|
100
|
+
children,
|
|
101
|
+
...rest
|
|
102
|
+
}, ref) {
|
|
103
|
+
const progress = useDerivedValue(function chunk42FMGB5MJs1Factory({
|
|
104
|
+
_worklet_8529533919367_init_data,
|
|
105
|
+
withTiming,
|
|
106
|
+
isSelected,
|
|
107
|
+
SWITCH_DURATION
|
|
108
|
+
}) {
|
|
109
|
+
const _e = [new global.Error(), -4, -27];
|
|
110
|
+
const chunk42FMGB5MJs1 = function () {
|
|
111
|
+
return withTiming(isSelected ? 1 : 0, {
|
|
112
|
+
duration: SWITCH_DURATION
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
chunk42FMGB5MJs1.__closure = {
|
|
116
|
+
withTiming,
|
|
117
|
+
isSelected,
|
|
118
|
+
SWITCH_DURATION
|
|
119
|
+
};
|
|
120
|
+
chunk42FMGB5MJs1.__workletHash = 8529533919367;
|
|
121
|
+
chunk42FMGB5MJs1.__pluginVersion = "0.7.4";
|
|
122
|
+
chunk42FMGB5MJs1.__initData = _worklet_8529533919367_init_data;
|
|
123
|
+
chunk42FMGB5MJs1.__stackDetails = _e;
|
|
124
|
+
return chunk42FMGB5MJs1;
|
|
125
|
+
}({
|
|
126
|
+
_worklet_8529533919367_init_data,
|
|
127
|
+
withTiming,
|
|
128
|
+
isSelected,
|
|
129
|
+
SWITCH_DURATION
|
|
130
|
+
}), [isSelected]);
|
|
131
|
+
const animatedStyle = useAnimatedStyle(function chunk42FMGB5MJs2Factory({
|
|
132
|
+
_worklet_5196381840933_init_data,
|
|
133
|
+
progress,
|
|
134
|
+
distance,
|
|
135
|
+
interpolateColor,
|
|
136
|
+
colors
|
|
137
|
+
}) {
|
|
138
|
+
const _e = [new global.Error(), -5, -27];
|
|
139
|
+
const chunk42FMGB5MJs2 = function () {
|
|
140
|
+
return {
|
|
141
|
+
transform: [{
|
|
142
|
+
translateX: progress.value * distance
|
|
143
|
+
}],
|
|
144
|
+
backgroundColor: interpolateColor(progress.value, [0, 1], [colors.off, colors.on])
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
chunk42FMGB5MJs2.__closure = {
|
|
148
|
+
progress,
|
|
149
|
+
distance,
|
|
150
|
+
interpolateColor,
|
|
151
|
+
colors
|
|
152
|
+
};
|
|
153
|
+
chunk42FMGB5MJs2.__workletHash = 5196381840933;
|
|
154
|
+
chunk42FMGB5MJs2.__pluginVersion = "0.7.4";
|
|
155
|
+
chunk42FMGB5MJs2.__initData = _worklet_5196381840933_init_data;
|
|
156
|
+
chunk42FMGB5MJs2.__stackDetails = _e;
|
|
157
|
+
return chunk42FMGB5MJs2;
|
|
158
|
+
}({
|
|
159
|
+
_worklet_5196381840933_init_data,
|
|
160
|
+
progress,
|
|
161
|
+
distance,
|
|
162
|
+
interpolateColor,
|
|
163
|
+
colors
|
|
164
|
+
}), [progress, distance, colors.off, colors.on]);
|
|
165
|
+
return /* @__PURE__ */jsx2(Animated.View, {
|
|
166
|
+
ref,
|
|
167
|
+
...rest,
|
|
168
|
+
style: [style, animatedStyle],
|
|
169
|
+
children
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// src/components/switch/switch-track.tsx
|
|
174
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
175
|
+
import { View as View2 } from "react-native";
|
|
176
|
+
import Animated2, { interpolateColor as interpolateColor2, useAnimatedStyle as useAnimatedStyle2, useDerivedValue as useDerivedValue2, withTiming as withTiming2 } from "react-native-reanimated";
|
|
177
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
178
|
+
var SwitchTrack = forwardRef3(function SwitchTrack2({
|
|
179
|
+
children,
|
|
180
|
+
animation = true,
|
|
181
|
+
style,
|
|
182
|
+
...props
|
|
183
|
+
}, ref) {
|
|
184
|
+
const {
|
|
185
|
+
trackStyle,
|
|
186
|
+
track,
|
|
187
|
+
isSelected
|
|
188
|
+
} = useSwitch();
|
|
189
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
190
|
+
const base = [trackStyle, styleProps, style];
|
|
191
|
+
if (!animation) {
|
|
192
|
+
return /* @__PURE__ */jsx3(View2, {
|
|
193
|
+
ref,
|
|
194
|
+
...rest,
|
|
195
|
+
style: [base, {
|
|
196
|
+
backgroundColor: isSelected ? track.on : track.off
|
|
197
|
+
}],
|
|
198
|
+
children
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return /* @__PURE__ */jsx3(CrossfadingTrack, {
|
|
202
|
+
ref,
|
|
203
|
+
style: base,
|
|
204
|
+
colors: track,
|
|
205
|
+
isSelected,
|
|
206
|
+
...rest,
|
|
207
|
+
children
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
SwitchTrack.displayName = "XAUI.Switch.Track";
|
|
211
|
+
const _worklet_844474600069_init_data = {
|
|
212
|
+
code: "function chunk42FMGB5MJs3(){const{withTiming2,isSelected,SWITCH_DURATION}=this.__closure;return withTiming2(isSelected?1:0,{duration:SWITCH_DURATION});}",
|
|
213
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-42FMGB5M.js",
|
|
214
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunk42FMGB5MJs3\",\"withTiming2\",\"isSelected\",\"SWITCH_DURATION\",\"__closure\",\"duration\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-42FMGB5M.js\"],\"mappings\":\"AAqJoC,SAAAA,gBAAMA,CAAA,QAAAC,WAAA,CAAAC,UAAA,CAAAC,eAAA,OAAAC,SAAA,CAEtC,MAAO,CAAAH,WAAW,CAACC,UAAU,CAAG,CAAC,CAAG,CAAC,CAAE,CAAEG,QAAQ,CAAEF,eAAgB,CAAC,CAAC,CACvE\",\"ignoreList\":[]}"
|
|
215
|
+
};
|
|
216
|
+
const _worklet_2775350926179_init_data = {
|
|
217
|
+
code: "function chunk42FMGB5MJs4(){const{interpolateColor2,progress,colors}=this.__closure;return{backgroundColor:interpolateColor2(progress.value,[0,1],[colors.off,colors.on])};}",
|
|
218
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-42FMGB5M.js",
|
|
219
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunk42FMGB5MJs4\",\"interpolateColor2\",\"progress\",\"colors\",\"__closure\",\"backgroundColor\",\"value\",\"off\",\"on\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-42FMGB5M.js\"],\"mappings\":\"AAyJ0C,SAAAA,gBAAMA,CAAA,QAAAC,iBAAA,CAAAC,QAAA,CAAAC,MAAA,OAAAC,SAAA,CAE5C,MAAO,CACLC,eAAe,CAAEJ,iBAAiB,CAChCC,QAAQ,CAACI,KAAK,CACd,CAAC,CAAC,CAAE,CAAC,CAAC,CACN,CAACH,MAAM,CAACI,GAAG,CAAEJ,MAAM,CAACK,EAAE,CACxB,CACF,CAAC,CACH\",\"ignoreList\":[]}"
|
|
220
|
+
};
|
|
221
|
+
var CrossfadingTrack = forwardRef3(function CrossfadingTrack2({
|
|
222
|
+
style,
|
|
223
|
+
colors,
|
|
224
|
+
isSelected,
|
|
225
|
+
children,
|
|
226
|
+
...rest
|
|
227
|
+
}, ref) {
|
|
228
|
+
const progress = useDerivedValue2(function chunk42FMGB5MJs3Factory({
|
|
229
|
+
_worklet_844474600069_init_data,
|
|
230
|
+
withTiming2,
|
|
231
|
+
isSelected,
|
|
232
|
+
SWITCH_DURATION
|
|
233
|
+
}) {
|
|
234
|
+
const _e = [new global.Error(), -4, -27];
|
|
235
|
+
const chunk42FMGB5MJs3 = function () {
|
|
236
|
+
return withTiming2(isSelected ? 1 : 0, {
|
|
237
|
+
duration: SWITCH_DURATION
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
chunk42FMGB5MJs3.__closure = {
|
|
241
|
+
withTiming2,
|
|
242
|
+
isSelected,
|
|
243
|
+
SWITCH_DURATION
|
|
244
|
+
};
|
|
245
|
+
chunk42FMGB5MJs3.__workletHash = 844474600069;
|
|
246
|
+
chunk42FMGB5MJs3.__pluginVersion = "0.7.4";
|
|
247
|
+
chunk42FMGB5MJs3.__initData = _worklet_844474600069_init_data;
|
|
248
|
+
chunk42FMGB5MJs3.__stackDetails = _e;
|
|
249
|
+
return chunk42FMGB5MJs3;
|
|
250
|
+
}({
|
|
251
|
+
_worklet_844474600069_init_data,
|
|
252
|
+
withTiming2,
|
|
253
|
+
isSelected,
|
|
254
|
+
SWITCH_DURATION
|
|
255
|
+
}), [isSelected]);
|
|
256
|
+
const animatedStyle = useAnimatedStyle2(function chunk42FMGB5MJs4Factory({
|
|
257
|
+
_worklet_2775350926179_init_data,
|
|
258
|
+
interpolateColor2,
|
|
259
|
+
progress,
|
|
260
|
+
colors
|
|
261
|
+
}) {
|
|
262
|
+
const _e = [new global.Error(), -4, -27];
|
|
263
|
+
const chunk42FMGB5MJs4 = function () {
|
|
264
|
+
return {
|
|
265
|
+
backgroundColor: interpolateColor2(progress.value, [0, 1], [colors.off, colors.on])
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
chunk42FMGB5MJs4.__closure = {
|
|
269
|
+
interpolateColor2,
|
|
270
|
+
progress,
|
|
271
|
+
colors
|
|
272
|
+
};
|
|
273
|
+
chunk42FMGB5MJs4.__workletHash = 2775350926179;
|
|
274
|
+
chunk42FMGB5MJs4.__pluginVersion = "0.7.4";
|
|
275
|
+
chunk42FMGB5MJs4.__initData = _worklet_2775350926179_init_data;
|
|
276
|
+
chunk42FMGB5MJs4.__stackDetails = _e;
|
|
277
|
+
return chunk42FMGB5MJs4;
|
|
278
|
+
}({
|
|
279
|
+
_worklet_2775350926179_init_data,
|
|
280
|
+
interpolateColor2,
|
|
281
|
+
progress,
|
|
282
|
+
colors
|
|
283
|
+
}), [progress, colors.off, colors.on]);
|
|
284
|
+
return /* @__PURE__ */jsx3(Animated2.View, {
|
|
285
|
+
ref,
|
|
286
|
+
...rest,
|
|
287
|
+
style: [style, animatedStyle],
|
|
288
|
+
children
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// src/components/switch/switch.tsx
|
|
293
|
+
import { forwardRef as forwardRef4, useCallback, useMemo } from "react";
|
|
294
|
+
import { StyleSheet } from "react-native";
|
|
295
|
+
|
|
296
|
+
// src/components/switch/switch.recipe.ts
|
|
297
|
+
var SLOTS = ["root", "track", "trackSelected", "thumb", "thumbSelected", "label"];
|
|
298
|
+
var VARIANT_TOKENS = {
|
|
299
|
+
primary: {
|
|
300
|
+
bg: "default",
|
|
301
|
+
fg: "white",
|
|
302
|
+
bgSelected: "accent",
|
|
303
|
+
fgSelected: "accentForeground"
|
|
304
|
+
},
|
|
305
|
+
secondary: {
|
|
306
|
+
bg: "default",
|
|
307
|
+
fg: "white",
|
|
308
|
+
bgSelected: "accent",
|
|
309
|
+
fgSelected: "accentForeground"
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
function sizeAxis(step) {
|
|
313
|
+
const {
|
|
314
|
+
track,
|
|
315
|
+
height,
|
|
316
|
+
thumb,
|
|
317
|
+
padding,
|
|
318
|
+
gap,
|
|
319
|
+
label
|
|
320
|
+
} = step;
|
|
321
|
+
return theme => {
|
|
322
|
+
const trackHeight = theme.spacing(height);
|
|
323
|
+
const knob = theme.spacing(thumb);
|
|
324
|
+
return {
|
|
325
|
+
root: {
|
|
326
|
+
gap: theme.spacing(gap)
|
|
327
|
+
},
|
|
328
|
+
track: {
|
|
329
|
+
width: theme.spacing(track),
|
|
330
|
+
height: trackHeight
|
|
331
|
+
},
|
|
332
|
+
thumb: {
|
|
333
|
+
width: knob,
|
|
334
|
+
height: knob,
|
|
335
|
+
// `start`, never `left` (R13): the knob rests at the leading edge, and RTL mirrors
|
|
336
|
+
// the logical property and only it.
|
|
337
|
+
start: theme.spacing(padding),
|
|
338
|
+
top: (trackHeight - knob) / 2
|
|
339
|
+
},
|
|
340
|
+
label: {
|
|
341
|
+
fontSize: theme.fontSizes[label],
|
|
342
|
+
lineHeight: theme.lineHeights[label]
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
var INSIDE = {
|
|
348
|
+
sm: {
|
|
349
|
+
track: 11,
|
|
350
|
+
height: 6.5,
|
|
351
|
+
thumb: 5,
|
|
352
|
+
padding: 0.75,
|
|
353
|
+
gap: 2,
|
|
354
|
+
label: "sm"
|
|
355
|
+
},
|
|
356
|
+
md: {
|
|
357
|
+
track: 12,
|
|
358
|
+
height: 7,
|
|
359
|
+
thumb: 5.5,
|
|
360
|
+
padding: 0.75,
|
|
361
|
+
gap: 2,
|
|
362
|
+
label: "md"
|
|
363
|
+
},
|
|
364
|
+
lg: {
|
|
365
|
+
track: 14,
|
|
366
|
+
height: 8,
|
|
367
|
+
thumb: 6.5,
|
|
368
|
+
padding: 0.75,
|
|
369
|
+
gap: 2.5,
|
|
370
|
+
label: "lg"
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
var OVERLAP = {
|
|
374
|
+
sm: {
|
|
375
|
+
track: 11,
|
|
376
|
+
height: 4.5,
|
|
377
|
+
thumb: 6,
|
|
378
|
+
padding: 0,
|
|
379
|
+
gap: 2,
|
|
380
|
+
label: "sm"
|
|
381
|
+
},
|
|
382
|
+
md: {
|
|
383
|
+
track: 12,
|
|
384
|
+
height: 4.5,
|
|
385
|
+
thumb: 6.5,
|
|
386
|
+
padding: 0,
|
|
387
|
+
gap: 2,
|
|
388
|
+
label: "md"
|
|
389
|
+
},
|
|
390
|
+
lg: {
|
|
391
|
+
track: 14,
|
|
392
|
+
height: 5,
|
|
393
|
+
thumb: 7.5,
|
|
394
|
+
padding: 0,
|
|
395
|
+
gap: 2.5,
|
|
396
|
+
label: "lg"
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
var switchRecipe = createRecipe({
|
|
400
|
+
slots: SLOTS,
|
|
401
|
+
base: theme => ({
|
|
402
|
+
root: {
|
|
403
|
+
flexDirection: "row",
|
|
404
|
+
alignItems: "center",
|
|
405
|
+
alignSelf: "flex-start"
|
|
406
|
+
},
|
|
407
|
+
track: {
|
|
408
|
+
borderRadius: theme.radius.full,
|
|
409
|
+
borderCurve: "continuous",
|
|
410
|
+
// Never `hidden`: on `secondary` the thumb stands outside the track, and clipping it
|
|
411
|
+
// would cut the knob in half rather than let it overlap.
|
|
412
|
+
overflow: "visible"
|
|
413
|
+
},
|
|
414
|
+
thumb: {
|
|
415
|
+
position: "absolute",
|
|
416
|
+
borderRadius: theme.radius.full,
|
|
417
|
+
alignItems: "center",
|
|
418
|
+
justifyContent: "center",
|
|
419
|
+
// The knob is the thing that moves, and a shadow is what says so.
|
|
420
|
+
...theme.shadows.field
|
|
421
|
+
},
|
|
422
|
+
label: {
|
|
423
|
+
fontFamily: theme.fontFamilies.body,
|
|
424
|
+
color: theme.colors.foreground
|
|
425
|
+
}
|
|
426
|
+
}),
|
|
427
|
+
variantTokens: VARIANT_TOKENS,
|
|
428
|
+
/**
|
|
429
|
+
* Four colours on four slots, and the two `*Selected` ones exist to be **flattened into
|
|
430
|
+
* values** rather than rendered: the track crosses from one to the other and the thumb
|
|
431
|
+
* with it, which is an interpolation on the UI thread rather than a style swap.
|
|
432
|
+
*
|
|
433
|
+
* They are roles for the reason the `Checkbox`'s are: the tint pass re-runs `paint` and
|
|
434
|
+
* never the axes, so this is what makes `color` the colour the switch turns on to.
|
|
435
|
+
*/
|
|
436
|
+
paint: (_theme, colors) => ({
|
|
437
|
+
track: {
|
|
438
|
+
backgroundColor: colors.bg
|
|
439
|
+
},
|
|
440
|
+
trackSelected: {
|
|
441
|
+
backgroundColor: colors.bgSelected
|
|
442
|
+
},
|
|
443
|
+
thumb: {
|
|
444
|
+
backgroundColor: colors.fg
|
|
445
|
+
},
|
|
446
|
+
thumbSelected: {
|
|
447
|
+
backgroundColor: colors.fgSelected
|
|
448
|
+
}
|
|
449
|
+
}),
|
|
450
|
+
variants: {
|
|
451
|
+
/**
|
|
452
|
+
* Declared and empty, which is unusual and deliberate: **every** number of this
|
|
453
|
+
* component depends on the shape as well as the size, so the whole table lives in the
|
|
454
|
+
* compounds below. The axis is here because the selection needs it to be typed, and
|
|
455
|
+
* because a reader looking for "what does `size` do" should find the answer next to
|
|
456
|
+
* the other axes rather than infer it from an absence.
|
|
457
|
+
*/
|
|
458
|
+
size: {
|
|
459
|
+
sm: () => ({}),
|
|
460
|
+
md: () => ({}),
|
|
461
|
+
lg: () => ({})
|
|
462
|
+
},
|
|
463
|
+
/**
|
|
464
|
+
* Both, always together: a track that lost its capsule while the knob kept its circle
|
|
465
|
+
* is a control rounded by halves. The knob's corner is the same named value rather
|
|
466
|
+
* than the track's less the padding — that nesting rule reaches zero before the outer
|
|
467
|
+
* radius does, and a sharp knob inside a slightly rounded track looks like a mistake.
|
|
468
|
+
*/
|
|
469
|
+
radius: radiusAxis("track", "thumb")
|
|
470
|
+
},
|
|
471
|
+
/** The six geometries — two shapes, three sizes — and nothing else. */
|
|
472
|
+
compoundVariants: [{
|
|
473
|
+
when: {
|
|
474
|
+
variant: "primary",
|
|
475
|
+
size: "sm"
|
|
476
|
+
},
|
|
477
|
+
style: sizeAxis(INSIDE.sm)
|
|
478
|
+
}, {
|
|
479
|
+
when: {
|
|
480
|
+
variant: "primary",
|
|
481
|
+
size: "md"
|
|
482
|
+
},
|
|
483
|
+
style: sizeAxis(INSIDE.md)
|
|
484
|
+
}, {
|
|
485
|
+
when: {
|
|
486
|
+
variant: "primary",
|
|
487
|
+
size: "lg"
|
|
488
|
+
},
|
|
489
|
+
style: sizeAxis(INSIDE.lg)
|
|
490
|
+
}, {
|
|
491
|
+
when: {
|
|
492
|
+
variant: "secondary",
|
|
493
|
+
size: "sm"
|
|
494
|
+
},
|
|
495
|
+
style: sizeAxis(OVERLAP.sm)
|
|
496
|
+
}, {
|
|
497
|
+
when: {
|
|
498
|
+
variant: "secondary",
|
|
499
|
+
size: "md"
|
|
500
|
+
},
|
|
501
|
+
style: sizeAxis(OVERLAP.md)
|
|
502
|
+
}, {
|
|
503
|
+
when: {
|
|
504
|
+
variant: "secondary",
|
|
505
|
+
size: "lg"
|
|
506
|
+
},
|
|
507
|
+
style: sizeAxis(OVERLAP.lg)
|
|
508
|
+
}],
|
|
509
|
+
states: {
|
|
510
|
+
disabled: theme => ({
|
|
511
|
+
root: {
|
|
512
|
+
opacity: theme.opacity.disabled
|
|
513
|
+
}
|
|
514
|
+
})
|
|
515
|
+
},
|
|
516
|
+
defaultVariants: {
|
|
517
|
+
variant: "primary",
|
|
518
|
+
size: "md"
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
// src/components/switch/switch.tsx
|
|
523
|
+
import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
524
|
+
var SwitchRoot = forwardRef4(function Switch({
|
|
525
|
+
children,
|
|
526
|
+
variant,
|
|
527
|
+
size,
|
|
528
|
+
radius,
|
|
529
|
+
color,
|
|
530
|
+
isSelected,
|
|
531
|
+
defaultSelected = false,
|
|
532
|
+
onSelectedChange,
|
|
533
|
+
isDisabled = false,
|
|
534
|
+
asChild = false,
|
|
535
|
+
accessibilityRole,
|
|
536
|
+
accessibilityState,
|
|
537
|
+
animation,
|
|
538
|
+
style,
|
|
539
|
+
onPress,
|
|
540
|
+
onPressIn,
|
|
541
|
+
onPressOut,
|
|
542
|
+
...props
|
|
543
|
+
}, ref) {
|
|
544
|
+
const theme = useXAUITheme();
|
|
545
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
546
|
+
const [isPressed, press] = usePressState({
|
|
547
|
+
onPressIn,
|
|
548
|
+
onPressOut
|
|
549
|
+
});
|
|
550
|
+
const [selected, setSelected] = useControllableState({
|
|
551
|
+
value: isSelected,
|
|
552
|
+
defaultValue: defaultSelected,
|
|
553
|
+
onChange: onSelectedChange
|
|
554
|
+
});
|
|
555
|
+
const handlePress = useCallback(event => {
|
|
556
|
+
setSelected(current => !current);
|
|
557
|
+
onPress?.(event);
|
|
558
|
+
}, [setSelected, onPress]);
|
|
559
|
+
const selection = {
|
|
560
|
+
variant,
|
|
561
|
+
size,
|
|
562
|
+
radius
|
|
563
|
+
};
|
|
564
|
+
const states = {
|
|
565
|
+
pressed: isPressed,
|
|
566
|
+
disabled: isDisabled
|
|
567
|
+
};
|
|
568
|
+
const styles = switchRecipe.resolve({
|
|
569
|
+
theme,
|
|
570
|
+
selection,
|
|
571
|
+
states
|
|
572
|
+
});
|
|
573
|
+
const tint = color ? switchRecipe.tint({
|
|
574
|
+
theme,
|
|
575
|
+
color,
|
|
576
|
+
selection,
|
|
577
|
+
states
|
|
578
|
+
}) : void 0;
|
|
579
|
+
const context = useMemo(() => {
|
|
580
|
+
const track = StyleSheet.flatten(styles.track);
|
|
581
|
+
const thumb = StyleSheet.flatten(styles.thumb);
|
|
582
|
+
return {
|
|
583
|
+
trackStyle: styles.track,
|
|
584
|
+
thumbStyle: styles.thumb,
|
|
585
|
+
labelStyle: styles.label,
|
|
586
|
+
// Values, not styles: the two ends of a colour that is crossed on the UI thread.
|
|
587
|
+
// The tint moves the "on" end alone — the track at rest keeps its neutral, because
|
|
588
|
+
// a switch that is off is off in every brand.
|
|
589
|
+
track: {
|
|
590
|
+
off: colorOf(track),
|
|
591
|
+
on: colorOf(StyleSheet.flatten([styles.trackSelected, tint?.trackSelected]))
|
|
592
|
+
},
|
|
593
|
+
thumb: {
|
|
594
|
+
off: colorOf(thumb),
|
|
595
|
+
on: colorOf(StyleSheet.flatten([styles.thumbSelected, tint?.thumbSelected]))
|
|
596
|
+
},
|
|
597
|
+
// The distance the knob slides, and the one number the recipe cannot write: it is
|
|
598
|
+
// the track's width less the thumb and the padding at both ends, and it has to be a
|
|
599
|
+
// number rather than a style because the slide happens in a worklet.
|
|
600
|
+
travel: travelOf(track, thumb),
|
|
601
|
+
isSelected: selected,
|
|
602
|
+
isDisabled
|
|
603
|
+
};
|
|
604
|
+
}, [styles, tint, selected, isDisabled]);
|
|
605
|
+
const rootStyle = [styles.root, styleProps, typeof style === "function" ? style({
|
|
606
|
+
pressed: isPressed
|
|
607
|
+
}) : style];
|
|
608
|
+
const text = childrenToString(children);
|
|
609
|
+
const content = text !== null ? /* @__PURE__ */jsxs(Fragment, {
|
|
610
|
+
children: [/* @__PURE__ */jsx4(SwitchTrack, {
|
|
611
|
+
children: /* @__PURE__ */jsx4(SwitchThumb, {})
|
|
612
|
+
}), /* @__PURE__ */jsx4(SwitchLabel, {
|
|
613
|
+
children: text
|
|
614
|
+
})]
|
|
615
|
+
}) : children ?? /* @__PURE__ */jsx4(SwitchTrack, {
|
|
616
|
+
children: /* @__PURE__ */jsx4(SwitchThumb, {})
|
|
617
|
+
});
|
|
618
|
+
return /* @__PURE__ */jsx4(SwitchProvider, {
|
|
619
|
+
value: context,
|
|
620
|
+
children: /* @__PURE__ */jsx4(PressableFeedback, {
|
|
621
|
+
ref,
|
|
622
|
+
isPressed,
|
|
623
|
+
isDisabled,
|
|
624
|
+
asChild,
|
|
625
|
+
animation,
|
|
626
|
+
accessibilityRole: accessibilityRole ?? "switch",
|
|
627
|
+
accessibilityState: {
|
|
628
|
+
checked: selected,
|
|
629
|
+
disabled: isDisabled,
|
|
630
|
+
...accessibilityState
|
|
631
|
+
},
|
|
632
|
+
...rest,
|
|
633
|
+
style: rootStyle,
|
|
634
|
+
onPress: handlePress,
|
|
635
|
+
onPressIn: press.onPressIn,
|
|
636
|
+
onPressOut: press.onPressOut,
|
|
637
|
+
children: asChild ? children : content
|
|
638
|
+
})
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
SwitchRoot.displayName = "XAUI.Switch.Root";
|
|
642
|
+
function colorOf(style) {
|
|
643
|
+
return typeof style.backgroundColor === "string" ? style.backgroundColor : "";
|
|
644
|
+
}
|
|
645
|
+
function travelOf(track, thumb) {
|
|
646
|
+
const width = pointsOf(track.width);
|
|
647
|
+
const knob = pointsOf(thumb.width);
|
|
648
|
+
const inset = pointsOf(thumb.start);
|
|
649
|
+
return Math.max(width - knob - inset * 2, 0);
|
|
650
|
+
}
|
|
651
|
+
function pointsOf(value) {
|
|
652
|
+
return typeof value === "number" ? value : 0;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// src/components/switch/index.ts
|
|
656
|
+
var Switch2 = Object.assign(SwitchRoot, {
|
|
657
|
+
Track: SwitchTrack,
|
|
658
|
+
Thumb: SwitchThumb,
|
|
659
|
+
Label: SwitchLabel
|
|
660
|
+
});
|
|
661
|
+
export { useSwitch, SwitchLabel, SwitchThumb, SwitchTrack, switchRecipe, SwitchRoot, Switch2 as Switch };
|