@xaui/native 0.9.1-alpha.37 → 0.9.1-alpha.39
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-OULTSBKU.js → chunk-26OGEFQI.js} +1 -1
- package/dist/chunk-2EGR4LWD.js +145 -0
- package/dist/{chunk-TJHYSSBZ.js → chunk-346QBNUD.js} +1 -1
- package/dist/chunk-37L7YGZV.cjs +425 -0
- package/dist/{chunk-PPWXLZGL.js → chunk-3GFRSZYR.js} +15 -23
- package/dist/{chunk-DKH6BNPF.cjs → chunk-3JXI2IHV.cjs} +13 -13
- package/dist/{chunk-7B3UBUC6.cjs → chunk-4KFKWBN5.cjs} +23 -2
- package/dist/{chunk-IGLKACSR.cjs → chunk-4KSKQD37.cjs} +5 -5
- package/dist/{chunk-UBOXW5WO.cjs → chunk-54CWXA34.cjs} +61 -61
- package/dist/chunk-64MXEVT3.js +66 -0
- package/dist/{chunk-ZJWEVFAO.cjs → chunk-66FOASTP.cjs} +9 -9
- package/dist/{chunk-5PPNDKRX.js → chunk-6CO6FM67.js} +16 -16
- package/dist/{chunk-DVDQSW7U.cjs → chunk-76XDVA24.cjs} +65 -190
- package/dist/{chunk-54FJOKAN.cjs → chunk-7GHM4GKL.cjs} +25 -25
- package/dist/chunk-7KLBTMXV.cjs +478 -0
- package/dist/{chunk-AP6RVIIK.cjs → chunk-7TOG4TVU.cjs} +21 -21
- package/dist/{chunk-LEWW24RQ.cjs → chunk-A7YB7YWX.cjs} +3 -3
- package/dist/{chunk-3P6M2R4S.cjs → chunk-AAVCMCJ3.cjs} +4 -4
- package/dist/{chunk-VFTT3Q4B.cjs → chunk-BNFIFRQA.cjs} +3 -3
- package/dist/{chunk-JXNFOOKC.js → chunk-DY3SUG5P.js} +5 -5
- package/dist/chunk-EKS3W46M.cjs +66 -0
- package/dist/{chunk-EOJ5MYAQ.js → chunk-EYD4H4X6.js} +4 -4
- package/dist/{chunk-RGKWNK4T.js → chunk-FBCWNXZC.js} +58 -58
- package/dist/{chunk-HXW4ANVB.js → chunk-FHUYHV6J.js} +25 -4
- package/dist/chunk-GJSFKH4L.js +586 -0
- package/dist/{chunk-6G3XWPNP.js → chunk-HA6BFY3A.js} +3 -3
- package/dist/{chunk-FTQHDJYL.cjs → chunk-HOI5425P.cjs} +9 -9
- package/dist/{chunk-XWY4DF37.js → chunk-JKP4TPIL.js} +86 -289
- package/dist/{chunk-YXPYOOHU.js → chunk-K72UDPVN.js} +27 -27
- package/dist/{chunk-NTD3NPRX.cjs → chunk-KSUV74BE.cjs} +2 -2
- package/dist/{chunk-UGF35NSE.js → chunk-LIUO6D3D.js} +75 -75
- package/dist/{chunk-E3X5ODKQ.js → chunk-LTX6TB5I.js} +1 -1
- package/dist/chunk-LUPCPLND.cjs +145 -0
- package/dist/{chunk-BORJJYDW.js → chunk-MXGER5PI.js} +2 -2
- package/dist/{chunk-GTT4NHS2.cjs → chunk-NCCRQK3P.cjs} +11 -11
- package/dist/chunk-NCTOTTVW.js +13 -0
- package/dist/{chunk-NKPTXTTS.js → chunk-QZ24MZRX.js} +3 -3
- package/dist/{chunk-7LSY4WFL.js → chunk-R7BU4CPS.js} +2 -2
- package/dist/{chunk-JB5LGQ54.cjs → chunk-RKCWYUGA.cjs} +3 -3
- package/dist/{chunk-SMW6ZWMH.js → chunk-S2WNWMNT.js} +1 -1
- package/dist/{chunk-WVLSQO6K.cjs → chunk-S4QUM4EE.cjs} +9 -9
- package/dist/{chunk-SO5UAGIU.js → chunk-SACDOFGF.js} +15 -15
- package/dist/{chunk-CUQTAPBU.cjs → chunk-SIP5J7HU.cjs} +17 -17
- package/dist/{chunk-O3A3DBSZ.js → chunk-SZLXPF3G.js} +1 -1
- package/dist/{chunk-437QULXO.cjs → chunk-TDTUAIFF.cjs} +5 -5
- package/dist/{chunk-DRMT346W.cjs → chunk-TGMVEHV7.cjs} +64 -64
- package/dist/{chunk-TDYPY2J7.js → chunk-TRETQZEW.js} +7 -7
- package/dist/{chunk-ITURCQMQ.cjs → chunk-URA25DU4.cjs} +5 -5
- package/dist/{chunk-4PTWZCOK.js → chunk-USF6EWYR.js} +7 -7
- package/dist/{chunk-P747CRAY.cjs → chunk-VZK3NLBH.cjs} +9 -9
- package/dist/chunk-WFEMJCXO.cjs +13 -0
- package/dist/chunk-XAFP5JLK.js +425 -0
- package/dist/{chunk-RVRVGG73.js → chunk-XNMZQSY5.js} +2 -2
- package/dist/{chunk-K4TWKF5U.cjs → chunk-XSQPVDFH.cjs} +15 -25
- package/dist/{chunk-JDSE4TQL.js → chunk-XTC2SLFT.js} +1 -1
- package/dist/{chunk-C5VDFRAD.cjs → chunk-XWNG2U4K.cjs} +2 -2
- package/dist/components/accordion/index.cjs +35 -0
- package/dist/components/accordion/index.d.cts +299 -0
- package/dist/components/accordion/index.d.ts +299 -0
- package/dist/components/accordion/index.js +35 -0
- package/dist/components/alert/index.cjs +7 -7
- package/dist/components/alert/index.d.cts +2 -2
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert/index.js +6 -6
- package/dist/components/avatar/index.cjs +4 -4
- package/dist/components/avatar/index.d.cts +3 -3
- package/dist/components/avatar/index.d.ts +3 -3
- package/dist/components/avatar/index.js +3 -3
- package/dist/components/badge/index.cjs +3 -3
- package/dist/components/badge/index.d.cts +1 -1
- package/dist/components/badge/index.d.ts +1 -1
- package/dist/components/badge/index.js +2 -2
- package/dist/components/button/index.cjs +8 -7
- package/dist/components/button/index.d.cts +204 -204
- package/dist/components/button/index.d.ts +204 -204
- package/dist/components/button/index.js +7 -6
- package/dist/components/card/index.cjs +5 -5
- package/dist/components/card/index.d.cts +206 -206
- package/dist/components/card/index.d.ts +206 -206
- package/dist/components/card/index.js +4 -4
- package/dist/components/checkbox/index.cjs +5 -5
- package/dist/components/checkbox/index.d.cts +408 -408
- package/dist/components/checkbox/index.d.ts +408 -408
- package/dist/components/checkbox/index.js +4 -4
- package/dist/components/chip/index.cjs +7 -7
- package/dist/components/chip/index.d.cts +205 -205
- package/dist/components/chip/index.d.ts +205 -205
- package/dist/components/chip/index.js +6 -6
- package/dist/components/divider/index.cjs +3 -3
- package/dist/components/divider/index.d.cts +3 -3
- package/dist/components/divider/index.d.ts +3 -3
- package/dist/components/divider/index.js +2 -2
- package/dist/components/field-group/index.cjs +5 -5
- package/dist/components/field-group/index.d.cts +8 -8
- package/dist/components/field-group/index.d.ts +8 -8
- package/dist/components/field-group/index.js +4 -4
- package/dist/components/input-otp/index.cjs +3 -3
- package/dist/components/input-otp/index.d.cts +2 -2
- package/dist/components/input-otp/index.d.ts +2 -2
- package/dist/components/input-otp/index.js +2 -2
- package/dist/components/popover/index.cjs +37 -0
- package/dist/components/popover/index.d.cts +254 -0
- package/dist/components/popover/index.d.ts +254 -0
- package/dist/components/popover/index.js +37 -0
- package/dist/components/radio/index.cjs +5 -5
- package/dist/components/radio/index.d.cts +419 -419
- package/dist/components/radio/index.d.ts +419 -419
- package/dist/components/radio/index.js +4 -4
- package/dist/components/select/index.cjs +10 -7
- package/dist/components/select/index.d.cts +24 -45
- package/dist/components/select/index.d.ts +24 -45
- package/dist/components/select/index.js +9 -6
- package/dist/components/skeleton/index.d.cts +1 -1
- package/dist/components/skeleton/index.d.ts +1 -1
- package/dist/components/spinner/index.cjs +5 -4
- package/dist/components/spinner/index.d.cts +1 -1
- package/dist/components/spinner/index.d.ts +1 -1
- package/dist/components/spinner/index.js +4 -3
- package/dist/components/switch/index.cjs +5 -5
- package/dist/components/switch/index.d.cts +409 -409
- package/dist/components/switch/index.d.ts +409 -409
- package/dist/components/switch/index.js +4 -4
- package/dist/components/text-area/index.cjs +4 -4
- package/dist/components/text-area/index.js +3 -3
- package/dist/components/text-field/index.cjs +3 -3
- package/dist/components/text-field/index.d.cts +3 -3
- package/dist/components/text-field/index.d.ts +3 -3
- package/dist/components/text-field/index.js +2 -2
- package/dist/components/typography/index.cjs +3 -3
- package/dist/components/typography/index.d.cts +5 -5
- package/dist/components/typography/index.d.ts +5 -5
- package/dist/components/typography/index.js +2 -2
- package/dist/components/view/index.cjs +3 -3
- package/dist/components/view/index.d.cts +8 -8
- package/dist/components/view/index.d.ts +8 -8
- package/dist/components/view/index.js +2 -2
- package/dist/index.cjs +89 -28
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +109 -48
- package/dist/placement-DHa0Rrh1.d.cts +38 -0
- package/dist/placement-DHa0Rrh1.d.ts +38 -0
- package/dist/system/index.cjs +24 -8
- package/dist/system/index.d.cts +83 -34
- package/dist/system/index.d.ts +83 -34
- package/dist/system/index.js +24 -8
- package/package.json +21 -1
- /package/dist/{chunk-OJCCV65P.cjs → chunk-GGW43Q37.cjs} +0 -0
- /package/dist/{chunk-MESKS6AI.js → chunk-WHJTBTYM.js} +0 -0
|
@@ -1,99 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useAnchoredPosition } from "./chunk-2EGR4LWD.js";
|
|
2
|
+
import { Portal } from "./chunk-2PMXMKS5.js";
|
|
3
|
+
import { INDICATOR_ROTATION, INDICATOR_SPRING, anchoredEntering, anchoredExiting, overlayEntering, overlayExiting } from "./chunk-64MXEVT3.js";
|
|
4
|
+
import { useMergedRef } from "./chunk-NCTOTTVW.js";
|
|
5
|
+
import { ChevronDownIcon, Icon, IconContext } from "./chunk-FHUYHV6J.js";
|
|
6
|
+
import { useControllableState } from "./chunk-F6W3JQ7K.js";
|
|
7
|
+
import { PressableFeedback } from "./chunk-LIUO6D3D.js";
|
|
4
8
|
import { usePressState } from "./chunk-423RQBOX.js";
|
|
5
|
-
import { childrenToString, createSlotContext } from "./chunk-
|
|
6
|
-
import { mergeRefs } from "./chunk-36PRYGAM.js";
|
|
9
|
+
import { childrenToString, createSlotContext } from "./chunk-K72UDPVN.js";
|
|
7
10
|
import { createRecipe, radiusAxis } from "./chunk-4GTAZM2C.js";
|
|
8
11
|
import { useXAUITheme } from "./chunk-A3EGFI6T.js";
|
|
9
12
|
import { useStyleProps } from "./chunk-M63GFNKV.js";
|
|
10
13
|
|
|
11
14
|
// src/components/select/select-content.tsx
|
|
12
|
-
import { forwardRef as forwardRef3
|
|
13
|
-
import { ScrollView
|
|
15
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
16
|
+
import { ScrollView } from "react-native";
|
|
14
17
|
import Animated from "react-native-reanimated";
|
|
15
18
|
|
|
16
|
-
// src/components/select/select.context.ts
|
|
17
|
-
var [SelectProvider, useSelect] = createSlotContext("Select");
|
|
18
|
-
var [SelectItemProvider, useSelectItem] = createSlotContext("Select.Item");
|
|
19
|
-
|
|
20
|
-
// src/components/select/select.animation.ts
|
|
21
|
-
import { Easing, Keyframe } from "react-native-reanimated";
|
|
22
|
-
var INDICATOR_SPRING = {
|
|
23
|
-
damping: 140,
|
|
24
|
-
stiffness: 1e3,
|
|
25
|
-
mass: 4
|
|
26
|
-
};
|
|
27
|
-
var INDICATOR_ROTATION = [0, -180];
|
|
28
|
-
var ENTER_MS = 200;
|
|
29
|
-
var EXIT_MS = 150;
|
|
30
|
-
function contentEntering(placement) {
|
|
31
|
-
const from = placement === "bottom" ? -8 : 8;
|
|
32
|
-
return new Keyframe({
|
|
33
|
-
0: {
|
|
34
|
-
opacity: 0,
|
|
35
|
-
transform: [{
|
|
36
|
-
translateY: from
|
|
37
|
-
}, {
|
|
38
|
-
scale: 0.95
|
|
39
|
-
}]
|
|
40
|
-
},
|
|
41
|
-
100: {
|
|
42
|
-
opacity: 1,
|
|
43
|
-
transform: [{
|
|
44
|
-
translateY: 0
|
|
45
|
-
}, {
|
|
46
|
-
scale: 1
|
|
47
|
-
}],
|
|
48
|
-
easing: Easing.out(Easing.cubic)
|
|
49
|
-
}
|
|
50
|
-
}).duration(ENTER_MS);
|
|
51
|
-
}
|
|
52
|
-
function contentExiting(placement) {
|
|
53
|
-
const to = placement === "bottom" ? -8 : 8;
|
|
54
|
-
return new Keyframe({
|
|
55
|
-
0: {
|
|
56
|
-
opacity: 1,
|
|
57
|
-
transform: [{
|
|
58
|
-
translateY: 0
|
|
59
|
-
}, {
|
|
60
|
-
scale: 1
|
|
61
|
-
}]
|
|
62
|
-
},
|
|
63
|
-
100: {
|
|
64
|
-
opacity: 0,
|
|
65
|
-
transform: [{
|
|
66
|
-
translateY: to
|
|
67
|
-
}, {
|
|
68
|
-
scale: 0.95
|
|
69
|
-
}],
|
|
70
|
-
easing: Easing.in(Easing.cubic)
|
|
71
|
-
}
|
|
72
|
-
}).duration(EXIT_MS);
|
|
73
|
-
}
|
|
74
|
-
var overlayEntering = new Keyframe({
|
|
75
|
-
0: {
|
|
76
|
-
opacity: 0
|
|
77
|
-
},
|
|
78
|
-
100: {
|
|
79
|
-
opacity: 1
|
|
80
|
-
}
|
|
81
|
-
}).duration(ENTER_MS);
|
|
82
|
-
var overlayExiting = new Keyframe({
|
|
83
|
-
0: {
|
|
84
|
-
opacity: 1
|
|
85
|
-
},
|
|
86
|
-
100: {
|
|
87
|
-
opacity: 0
|
|
88
|
-
}
|
|
89
|
-
}).duration(EXIT_MS);
|
|
90
|
-
|
|
91
19
|
// src/components/select/select-item.tsx
|
|
92
20
|
import { forwardRef as forwardRef2, useCallback, useEffect, useMemo } from "react";
|
|
93
21
|
|
|
94
22
|
// src/components/select/select-item-label.tsx
|
|
95
23
|
import { forwardRef } from "react";
|
|
96
24
|
import { Text } from "react-native";
|
|
25
|
+
|
|
26
|
+
// src/components/select/select.context.ts
|
|
27
|
+
var [SelectProvider, useSelect] = createSlotContext("Select");
|
|
28
|
+
var [SelectItemProvider, useSelectItem] = createSlotContext("Select.Item");
|
|
29
|
+
|
|
30
|
+
// src/components/select/select-item-label.tsx
|
|
97
31
|
import { jsx } from "react/jsx-runtime";
|
|
98
32
|
var SelectItemLabel = forwardRef(function SelectItemLabel2({
|
|
99
33
|
children,
|
|
@@ -190,70 +124,6 @@ SelectItem.displayName = "XAUI.Select.Item";
|
|
|
190
124
|
|
|
191
125
|
// src/components/select/select.utils.ts
|
|
192
126
|
import { Children, isValidElement } from "react";
|
|
193
|
-
function resolvePlacement(input) {
|
|
194
|
-
const {
|
|
195
|
-
anchor,
|
|
196
|
-
content,
|
|
197
|
-
window,
|
|
198
|
-
offset,
|
|
199
|
-
alignOffset,
|
|
200
|
-
insets
|
|
201
|
-
} = input;
|
|
202
|
-
const available = window.width - insets.start - insets.end;
|
|
203
|
-
const width = Math.min(resolveWidth(input), Math.max(available, 0));
|
|
204
|
-
const placement = choosePlacement(input);
|
|
205
|
-
const maxHeight = Math.max(roomFor(placement, input), 0);
|
|
206
|
-
const height = Math.min(content.height, maxHeight);
|
|
207
|
-
const top = placement === "bottom" ? anchor.y + anchor.height + offset : anchor.y - offset - height;
|
|
208
|
-
const start = clamp(alignedStart(input, width) + alignOffset, insets.start, Math.max(window.width - insets.end - width, insets.start));
|
|
209
|
-
return {
|
|
210
|
-
top,
|
|
211
|
-
start,
|
|
212
|
-
width,
|
|
213
|
-
maxHeight,
|
|
214
|
-
placement
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
function resolveWidth({
|
|
218
|
-
width,
|
|
219
|
-
anchor,
|
|
220
|
-
content
|
|
221
|
-
}) {
|
|
222
|
-
if (width === "trigger") return anchor.width;
|
|
223
|
-
if (width === "content-fit") return content.width;
|
|
224
|
-
return width;
|
|
225
|
-
}
|
|
226
|
-
function choosePlacement(input) {
|
|
227
|
-
const {
|
|
228
|
-
placement,
|
|
229
|
-
avoidCollisions,
|
|
230
|
-
content
|
|
231
|
-
} = input;
|
|
232
|
-
if (!avoidCollisions) return placement;
|
|
233
|
-
if (roomFor(placement, input) >= content.height) return placement;
|
|
234
|
-
const other = placement === "bottom" ? "top" : "bottom";
|
|
235
|
-
return roomFor(other, input) > roomFor(placement, input) ? other : placement;
|
|
236
|
-
}
|
|
237
|
-
function roomFor(placement, input) {
|
|
238
|
-
const {
|
|
239
|
-
anchor,
|
|
240
|
-
window,
|
|
241
|
-
offset,
|
|
242
|
-
insets
|
|
243
|
-
} = input;
|
|
244
|
-
return placement === "bottom" ? window.height - insets.bottom - (anchor.y + anchor.height) - offset : anchor.y - insets.top - offset;
|
|
245
|
-
}
|
|
246
|
-
function alignedStart({
|
|
247
|
-
align,
|
|
248
|
-
anchor
|
|
249
|
-
}, width) {
|
|
250
|
-
if (align === "start") return anchor.x;
|
|
251
|
-
if (align === "end") return anchor.x + anchor.width - width;
|
|
252
|
-
return anchor.x + (anchor.width - width) / 2;
|
|
253
|
-
}
|
|
254
|
-
function clamp(value, min, max) {
|
|
255
|
-
return Math.min(Math.max(value, min), max);
|
|
256
|
-
}
|
|
257
127
|
function collectItemLabels(children, isItem) {
|
|
258
128
|
const found = [];
|
|
259
129
|
const walk = node => {
|
|
@@ -273,19 +143,16 @@ function collectItemLabels(children, isItem) {
|
|
|
273
143
|
}
|
|
274
144
|
|
|
275
145
|
// src/components/select/select-content.tsx
|
|
146
|
+
import { useEffect as useEffect2 } from "react";
|
|
276
147
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
277
148
|
var DEFAULT_OFFSET = 8;
|
|
278
|
-
var ZERO = {
|
|
279
|
-
x: 0,
|
|
280
|
-
y: 0
|
|
281
|
-
};
|
|
282
|
-
var isSelectItem = type => type === SelectItem;
|
|
283
149
|
var DEFAULT_INSETS = {
|
|
284
150
|
top: 12,
|
|
285
151
|
bottom: 12,
|
|
286
152
|
start: 12,
|
|
287
153
|
end: 12
|
|
288
154
|
};
|
|
155
|
+
var isSelectItem = type => type === SelectItem;
|
|
289
156
|
var SelectContent = forwardRef3(function SelectContent2({
|
|
290
157
|
children,
|
|
291
158
|
placement = "bottom",
|
|
@@ -303,48 +170,17 @@ var SelectContent = forwardRef3(function SelectContent2({
|
|
|
303
170
|
const {
|
|
304
171
|
contentStyle,
|
|
305
172
|
isOpen,
|
|
306
|
-
anchor
|
|
173
|
+
anchor,
|
|
174
|
+
registerLabel
|
|
307
175
|
} = context;
|
|
308
176
|
const [styleProps, rest] = useStyleProps(props);
|
|
309
|
-
const window = useWindowDimensions();
|
|
310
|
-
const origin = useContext(PortalContext)?.origin ?? ZERO;
|
|
311
|
-
const [measured, setMeasured] = useState(null);
|
|
312
177
|
const {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}, [children, registerLabel]);
|
|
320
|
-
if (!isOpen && measured !== null) setMeasured(null);
|
|
321
|
-
if (!isOpen || anchor === null) return null;
|
|
322
|
-
const measure = event => {
|
|
323
|
-
onLayout?.(event);
|
|
324
|
-
const {
|
|
325
|
-
width: w,
|
|
326
|
-
height: h
|
|
327
|
-
} = event.nativeEvent.layout;
|
|
328
|
-
if (measured === null || measured.height !== h || measured.width !== w) {
|
|
329
|
-
setMeasured({
|
|
330
|
-
width: w,
|
|
331
|
-
height: h
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
const local = {
|
|
336
|
-
...anchor,
|
|
337
|
-
x: anchor.x - origin.x,
|
|
338
|
-
y: anchor.y - origin.y
|
|
339
|
-
};
|
|
340
|
-
const position = measured && resolvePlacement({
|
|
341
|
-
anchor: local,
|
|
342
|
-
content: measured,
|
|
343
|
-
// The window in the host's own coordinates, for the same reason as the anchor.
|
|
344
|
-
window: {
|
|
345
|
-
width: window.width - origin.x,
|
|
346
|
-
height: window.height - origin.y
|
|
347
|
-
},
|
|
178
|
+
position,
|
|
179
|
+
onContentLayout,
|
|
180
|
+
measuringStyle
|
|
181
|
+
} = useAnchoredPosition({
|
|
182
|
+
anchor,
|
|
183
|
+
isOpen,
|
|
348
184
|
placement,
|
|
349
185
|
align,
|
|
350
186
|
width,
|
|
@@ -354,26 +190,25 @@ var SelectContent = forwardRef3(function SelectContent2({
|
|
|
354
190
|
insets: {
|
|
355
191
|
...DEFAULT_INSETS,
|
|
356
192
|
...insets
|
|
357
|
-
}
|
|
193
|
+
},
|
|
194
|
+
onLayout
|
|
358
195
|
});
|
|
196
|
+
useEffect2(() => {
|
|
197
|
+
for (const [value, label] of collectItemLabels(children, isSelectItem)) {
|
|
198
|
+
registerLabel(value, label);
|
|
199
|
+
}
|
|
200
|
+
}, [children, registerLabel]);
|
|
201
|
+
if (!isOpen || anchor === null) return null;
|
|
359
202
|
return /* @__PURE__ */jsx3(Portal, {
|
|
360
203
|
children: /* @__PURE__ */jsx3(SelectProvider, {
|
|
361
204
|
value: context,
|
|
362
205
|
children: /* @__PURE__ */jsx3(Animated.View, {
|
|
363
206
|
ref,
|
|
364
|
-
entering: position ?
|
|
365
|
-
exiting: position ?
|
|
366
|
-
onLayout:
|
|
207
|
+
entering: position ? anchoredEntering(position.placement) : void 0,
|
|
208
|
+
exiting: position ? anchoredExiting(position.placement) : void 0,
|
|
209
|
+
onLayout: onContentLayout,
|
|
367
210
|
...rest,
|
|
368
|
-
style: [contentStyle,
|
|
369
|
-
// The measuring pass: laid out at the trigger's width so the rows wrap as they
|
|
370
|
-
// finally will, and invisible so the reader never sees it at the wrong place.
|
|
371
|
-
position === null ? {
|
|
372
|
-
opacity: 0,
|
|
373
|
-
top: 0,
|
|
374
|
-
start: 0,
|
|
375
|
-
width: local.width
|
|
376
|
-
} : {
|
|
211
|
+
style: [contentStyle, position === null ? measuringStyle : {
|
|
377
212
|
top: position.top,
|
|
378
213
|
start: position.start,
|
|
379
214
|
width: position.width,
|
|
@@ -394,36 +229,11 @@ SelectContent.displayName = "XAUI.Select.Content";
|
|
|
394
229
|
// src/components/select/select-indicator.tsx
|
|
395
230
|
import { useEffect as useEffect3 } from "react";
|
|
396
231
|
import Animated2, { interpolate, useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated";
|
|
397
|
-
|
|
398
|
-
// src/components/select/chevron-down-icon.tsx
|
|
399
|
-
import { Path, Svg } from "react-native-svg";
|
|
400
232
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
return /* @__PURE__ */jsx4(Svg, {
|
|
406
|
-
width: size,
|
|
407
|
-
height: size,
|
|
408
|
-
viewBox: "0 0 24 24",
|
|
409
|
-
fill: "none",
|
|
410
|
-
children: /* @__PURE__ */jsx4(Path, {
|
|
411
|
-
d: "m6 9 6 6 6-6",
|
|
412
|
-
stroke: color,
|
|
413
|
-
strokeWidth: 2,
|
|
414
|
-
strokeLinecap: "round",
|
|
415
|
-
strokeLinejoin: "round"
|
|
416
|
-
})
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
ChevronDownIcon.displayName = "XAUI.Select.ChevronDownIcon";
|
|
420
|
-
|
|
421
|
-
// src/components/select/select-indicator.tsx
|
|
422
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
423
|
-
const _worklet_11336077885044_init_data = {
|
|
424
|
-
code: "function chunkXWY4DF37Js1(){const{interpolate,progress,INDICATOR_ROTATION}=this.__closure;return{transform:[{rotate:interpolate(progress.get(),[0,1],[INDICATOR_ROTATION[0],INDICATOR_ROTATION[1]])+\"deg\"}]};}",
|
|
425
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-XWY4DF37.js",
|
|
426
|
-
sourceMap: "{\"version\":3,\"names\":[\"chunkXWY4DF37Js1\",\"interpolate\",\"progress\",\"INDICATOR_ROTATION\",\"__closure\",\"transform\",\"rotate\",\"get\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-XWY4DF37.js\"],\"mappings\":\"AA4XoC,SAAAA,iBAAA,QAAAC,WAAA,CAAAC,QAAA,CAAAC,kBAAA,OAAAC,SAAA,OAAO,CACvCC,SAAS,CAAE,CACT,CACEC,MAAM,CAAKL,WAAW,CAACC,QAAQ,CAACK,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAACJ,kBAAkB,CAAC,CAAC,CAAC,CAAEA,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,MAChG,CAAC,CAEL,CAAC\",\"ignoreList\":[]}"
|
|
233
|
+
const _worklet_11125272119572_init_data = {
|
|
234
|
+
code: "function chunkJKP4TPILJs1(){const{interpolate,progress,INDICATOR_ROTATION}=this.__closure;return{transform:[{rotate:interpolate(progress.get(),[0,1],[INDICATOR_ROTATION[0],INDICATOR_ROTATION[1]])+\"deg\"}]};}",
|
|
235
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-JKP4TPIL.js",
|
|
236
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkJKP4TPILJs1\",\"interpolate\",\"progress\",\"INDICATOR_ROTATION\",\"__closure\",\"transform\",\"rotate\",\"get\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-JKP4TPIL.js\"],\"mappings\":\"AAgRoC,SAAAA,iBAAA,QAAAC,WAAA,CAAAC,QAAA,CAAAC,kBAAA,OAAAC,SAAA,OAAO,CACvCC,SAAS,CAAE,CACT,CACEC,MAAM,CAAKL,WAAW,CAACC,QAAQ,CAACK,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAACJ,kBAAkB,CAAC,CAAC,CAAC,CAAEA,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,MAChG,CAAC,CAEL,CAAC\",\"ignoreList\":[]}"
|
|
427
237
|
};
|
|
428
238
|
function SelectIndicator({
|
|
429
239
|
as = ChevronDownIcon,
|
|
@@ -437,37 +247,37 @@ function SelectIndicator({
|
|
|
437
247
|
useEffect3(() => {
|
|
438
248
|
progress.set(withSpring(isOpen ? 1 : 0, INDICATOR_SPRING));
|
|
439
249
|
}, [isOpen, progress]);
|
|
440
|
-
const rotation = useAnimatedStyle(function
|
|
441
|
-
|
|
250
|
+
const rotation = useAnimatedStyle(function chunkJKP4TPILJs1Factory({
|
|
251
|
+
_worklet_11125272119572_init_data,
|
|
442
252
|
interpolate,
|
|
443
253
|
progress,
|
|
444
254
|
INDICATOR_ROTATION
|
|
445
255
|
}) {
|
|
446
256
|
const _e = [new global.Error(), -4, -27];
|
|
447
|
-
const
|
|
257
|
+
const chunkJKP4TPILJs1 = () => ({
|
|
448
258
|
transform: [{
|
|
449
259
|
rotate: `${interpolate(progress.get(), [0, 1], [INDICATOR_ROTATION[0], INDICATOR_ROTATION[1]])}deg`
|
|
450
260
|
}]
|
|
451
261
|
});
|
|
452
|
-
|
|
262
|
+
chunkJKP4TPILJs1.__closure = {
|
|
453
263
|
interpolate,
|
|
454
264
|
progress,
|
|
455
265
|
INDICATOR_ROTATION
|
|
456
266
|
};
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
return
|
|
267
|
+
chunkJKP4TPILJs1.__workletHash = 11125272119572;
|
|
268
|
+
chunkJKP4TPILJs1.__pluginVersion = "0.7.4";
|
|
269
|
+
chunkJKP4TPILJs1.__initData = _worklet_11125272119572_init_data;
|
|
270
|
+
chunkJKP4TPILJs1.__stackDetails = _e;
|
|
271
|
+
return chunkJKP4TPILJs1;
|
|
462
272
|
}({
|
|
463
|
-
|
|
273
|
+
_worklet_11125272119572_init_data,
|
|
464
274
|
interpolate,
|
|
465
275
|
progress,
|
|
466
276
|
INDICATOR_ROTATION
|
|
467
277
|
}));
|
|
468
|
-
return /* @__PURE__ */
|
|
278
|
+
return /* @__PURE__ */jsx4(Animated2.View, {
|
|
469
279
|
style: [indicatorStyle, rotation],
|
|
470
|
-
children: /* @__PURE__ */
|
|
280
|
+
children: /* @__PURE__ */jsx4(Icon, {
|
|
471
281
|
as,
|
|
472
282
|
...props
|
|
473
283
|
})
|
|
@@ -478,7 +288,7 @@ SelectIndicator.displayName = "XAUI.Select.Indicator";
|
|
|
478
288
|
// src/components/select/select-item-description.tsx
|
|
479
289
|
import { forwardRef as forwardRef4 } from "react";
|
|
480
290
|
import { Text as Text2 } from "react-native";
|
|
481
|
-
import { jsx as
|
|
291
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
482
292
|
var SelectItemDescription = forwardRef4(function SelectItemDescription2({
|
|
483
293
|
children,
|
|
484
294
|
style,
|
|
@@ -488,7 +298,7 @@ var SelectItemDescription = forwardRef4(function SelectItemDescription2({
|
|
|
488
298
|
itemDescriptionStyle
|
|
489
299
|
} = useSelect();
|
|
490
300
|
const [styleProps, rest] = useStyleProps(props);
|
|
491
|
-
return /* @__PURE__ */
|
|
301
|
+
return /* @__PURE__ */jsx5(Text2, {
|
|
492
302
|
ref,
|
|
493
303
|
...rest,
|
|
494
304
|
style: [itemDescriptionStyle, styleProps, style],
|
|
@@ -501,18 +311,18 @@ SelectItemDescription.displayName = "XAUI.Select.ItemDescription";
|
|
|
501
311
|
import { View } from "react-native";
|
|
502
312
|
|
|
503
313
|
// src/components/select/check-icon.tsx
|
|
504
|
-
import { Path
|
|
505
|
-
import { jsx as
|
|
314
|
+
import { Path, Svg } from "react-native-svg";
|
|
315
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
506
316
|
function CheckIcon({
|
|
507
317
|
size = 20,
|
|
508
318
|
color = "currentColor"
|
|
509
319
|
}) {
|
|
510
|
-
return /* @__PURE__ */
|
|
320
|
+
return /* @__PURE__ */jsx6(Svg, {
|
|
511
321
|
width: size,
|
|
512
322
|
height: size,
|
|
513
323
|
viewBox: "0 0 24 24",
|
|
514
324
|
fill: "none",
|
|
515
|
-
children: /* @__PURE__ */
|
|
325
|
+
children: /* @__PURE__ */jsx6(Path, {
|
|
516
326
|
d: "m20 6-11 11-5-5",
|
|
517
327
|
stroke: color,
|
|
518
328
|
strokeWidth: 2,
|
|
@@ -524,7 +334,7 @@ function CheckIcon({
|
|
|
524
334
|
CheckIcon.displayName = "XAUI.Select.CheckIcon";
|
|
525
335
|
|
|
526
336
|
// src/components/select/select-item-indicator.tsx
|
|
527
|
-
import { jsx as
|
|
337
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
528
338
|
function SelectItemIndicator({
|
|
529
339
|
as = CheckIcon,
|
|
530
340
|
color,
|
|
@@ -537,9 +347,9 @@ function SelectItemIndicator({
|
|
|
537
347
|
const {
|
|
538
348
|
isSelected
|
|
539
349
|
} = useSelectItem();
|
|
540
|
-
return /* @__PURE__ */
|
|
350
|
+
return /* @__PURE__ */jsx7(View, {
|
|
541
351
|
style: itemIndicatorStyle,
|
|
542
|
-
children: isSelected ? /* @__PURE__ */
|
|
352
|
+
children: isSelected ? /* @__PURE__ */jsx7(Icon, {
|
|
543
353
|
as,
|
|
544
354
|
color: color ?? checkColor,
|
|
545
355
|
...props
|
|
@@ -551,7 +361,7 @@ SelectItemIndicator.displayName = "XAUI.Select.ItemIndicator";
|
|
|
551
361
|
// src/components/select/select-label.tsx
|
|
552
362
|
import { forwardRef as forwardRef5 } from "react";
|
|
553
363
|
import { Text as Text3 } from "react-native";
|
|
554
|
-
import { jsx as
|
|
364
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
555
365
|
var SelectLabel = forwardRef5(function SelectLabel2({
|
|
556
366
|
children,
|
|
557
367
|
accessibilityRole = "header",
|
|
@@ -562,7 +372,7 @@ var SelectLabel = forwardRef5(function SelectLabel2({
|
|
|
562
372
|
labelStyle
|
|
563
373
|
} = useSelect();
|
|
564
374
|
const [styleProps, rest] = useStyleProps(props);
|
|
565
|
-
return /* @__PURE__ */
|
|
375
|
+
return /* @__PURE__ */jsx8(Text3, {
|
|
566
376
|
ref,
|
|
567
377
|
accessibilityRole,
|
|
568
378
|
...rest,
|
|
@@ -576,7 +386,7 @@ SelectLabel.displayName = "XAUI.Select.Label";
|
|
|
576
386
|
import { forwardRef as forwardRef6 } from "react";
|
|
577
387
|
import { Pressable } from "react-native";
|
|
578
388
|
import Animated3 from "react-native-reanimated";
|
|
579
|
-
import { jsx as
|
|
389
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
580
390
|
var AnimatedPressable = Animated3.createAnimatedComponent(Pressable);
|
|
581
391
|
var SelectOverlay = forwardRef6(function SelectOverlay2({
|
|
582
392
|
children,
|
|
@@ -592,10 +402,10 @@ var SelectOverlay = forwardRef6(function SelectOverlay2({
|
|
|
592
402
|
} = context;
|
|
593
403
|
const [styleProps, rest] = useStyleProps(props);
|
|
594
404
|
if (!isOpen) return null;
|
|
595
|
-
return /* @__PURE__ */
|
|
596
|
-
children: /* @__PURE__ */
|
|
405
|
+
return /* @__PURE__ */jsx9(Portal, {
|
|
406
|
+
children: /* @__PURE__ */jsx9(SelectProvider, {
|
|
597
407
|
value: context,
|
|
598
|
-
children: /* @__PURE__ */
|
|
408
|
+
children: /* @__PURE__ */jsx9(AnimatedPressable, {
|
|
599
409
|
ref,
|
|
600
410
|
entering: overlayEntering,
|
|
601
411
|
exiting: overlayExiting,
|
|
@@ -612,8 +422,8 @@ var SelectOverlay = forwardRef6(function SelectOverlay2({
|
|
|
612
422
|
SelectOverlay.displayName = "XAUI.Select.Overlay";
|
|
613
423
|
|
|
614
424
|
// src/components/select/select-trigger.tsx
|
|
615
|
-
import { forwardRef as forwardRef7, useCallback as useCallback2, useEffect as useEffect4,
|
|
616
|
-
import { jsx as
|
|
425
|
+
import { forwardRef as forwardRef7, useCallback as useCallback2, useEffect as useEffect4, useRef } from "react";
|
|
426
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
617
427
|
var SelectTrigger = forwardRef7(function SelectTrigger2({
|
|
618
428
|
children,
|
|
619
429
|
asChild = false,
|
|
@@ -642,7 +452,7 @@ var SelectTrigger = forwardRef7(function SelectTrigger2({
|
|
|
642
452
|
onPressOut
|
|
643
453
|
});
|
|
644
454
|
const node = useRef(null);
|
|
645
|
-
const refs =
|
|
455
|
+
const refs = useMergedRef(node, ref);
|
|
646
456
|
const measure = useCallback2(() => {
|
|
647
457
|
node.current?.measureInWindow((x, y, width, height) => {
|
|
648
458
|
setAnchor({
|
|
@@ -665,9 +475,9 @@ var SelectTrigger = forwardRef7(function SelectTrigger2({
|
|
|
665
475
|
measure();
|
|
666
476
|
toggle();
|
|
667
477
|
}, [measure, onPress, toggle]);
|
|
668
|
-
return /* @__PURE__ */
|
|
478
|
+
return /* @__PURE__ */jsx10(IconContext.Provider, {
|
|
669
479
|
value: glyph,
|
|
670
|
-
children: /* @__PURE__ */
|
|
480
|
+
children: /* @__PURE__ */jsx10(PressableFeedback, {
|
|
671
481
|
ref: refs,
|
|
672
482
|
isPressed,
|
|
673
483
|
isDisabled,
|
|
@@ -696,7 +506,7 @@ SelectTrigger.displayName = "XAUI.Select.Trigger";
|
|
|
696
506
|
// src/components/select/select-value.tsx
|
|
697
507
|
import { forwardRef as forwardRef8 } from "react";
|
|
698
508
|
import { Text as Text4 } from "react-native";
|
|
699
|
-
import { jsx as
|
|
509
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
700
510
|
var SelectValue = forwardRef8(function SelectValue2({
|
|
701
511
|
placeholder,
|
|
702
512
|
children,
|
|
@@ -713,7 +523,7 @@ var SelectValue = forwardRef8(function SelectValue2({
|
|
|
713
523
|
const [styleProps, rest] = useStyleProps(props);
|
|
714
524
|
const label = children ?? (value !== void 0 ? labelFor(value) : void 0);
|
|
715
525
|
const isEmpty = label === void 0 || label === "";
|
|
716
|
-
return /* @__PURE__ */
|
|
526
|
+
return /* @__PURE__ */jsx11(Text4, {
|
|
717
527
|
ref,
|
|
718
528
|
numberOfLines,
|
|
719
529
|
...rest,
|
|
@@ -724,34 +534,21 @@ var SelectValue = forwardRef8(function SelectValue2({
|
|
|
724
534
|
SelectValue.displayName = "XAUI.Select.Value";
|
|
725
535
|
|
|
726
536
|
// src/components/select/select.tsx
|
|
727
|
-
import { useCallback as useCallback4, useMemo as
|
|
537
|
+
import { useCallback as useCallback4, useMemo as useMemo3, useState as useState2 } from "react";
|
|
728
538
|
import { StyleSheet } from "react-native";
|
|
729
539
|
|
|
730
540
|
// src/components/select/select.hook.ts
|
|
731
|
-
import { useCallback as useCallback3, useMemo as
|
|
732
|
-
function useControllableState({
|
|
733
|
-
value,
|
|
734
|
-
defaultValue,
|
|
735
|
-
onChange
|
|
736
|
-
}) {
|
|
737
|
-
const isControlled = useRef2(value !== void 0).current;
|
|
738
|
-
const [uncontrolled, setUncontrolled] = useState2(defaultValue);
|
|
739
|
-
const set = useCallback3(next => {
|
|
740
|
-
if (!isControlled) setUncontrolled(next);
|
|
741
|
-
onChange?.(next);
|
|
742
|
-
}, [isControlled, onChange]);
|
|
743
|
-
return [isControlled ? value : uncontrolled, set];
|
|
744
|
-
}
|
|
541
|
+
import { useCallback as useCallback3, useMemo as useMemo2, useRef as useRef2, useState } from "react";
|
|
745
542
|
function useLabelRegistry() {
|
|
746
543
|
const labels = useRef2(/* @__PURE__ */new Map());
|
|
747
|
-
const [, force] =
|
|
544
|
+
const [, force] = useState(0);
|
|
748
545
|
const registerLabel = useCallback3((value, label) => {
|
|
749
546
|
if (labels.current.get(value) === label) return;
|
|
750
547
|
labels.current.set(value, label);
|
|
751
548
|
force(n => n + 1);
|
|
752
549
|
}, []);
|
|
753
550
|
const labelFor = useCallback3(value => labels.current.get(value), []);
|
|
754
|
-
return
|
|
551
|
+
return useMemo2(() => ({
|
|
755
552
|
labelFor,
|
|
756
553
|
registerLabel
|
|
757
554
|
}), [labelFor, registerLabel]);
|
|
@@ -1011,7 +808,7 @@ var selectRecipe = createRecipe({
|
|
|
1011
808
|
});
|
|
1012
809
|
|
|
1013
810
|
// src/components/select/select.tsx
|
|
1014
|
-
import { jsx as
|
|
811
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1015
812
|
function Select({
|
|
1016
813
|
children,
|
|
1017
814
|
variant,
|
|
@@ -1032,13 +829,13 @@ function Select({
|
|
|
1032
829
|
labelFor,
|
|
1033
830
|
registerLabel
|
|
1034
831
|
} = useLabelRegistry();
|
|
1035
|
-
const [anchor, setAnchor] =
|
|
832
|
+
const [anchor, setAnchor] = useState2(null);
|
|
1036
833
|
const [value, setValue] = useControllableState({
|
|
1037
834
|
value: controlledValue,
|
|
1038
835
|
defaultValue,
|
|
1039
836
|
onChange: onValueChange
|
|
1040
837
|
});
|
|
1041
|
-
const [isOpen
|
|
838
|
+
const [isOpen, setOpen] = useControllableState({
|
|
1042
839
|
value: controlledOpen,
|
|
1043
840
|
defaultValue: defaultOpen,
|
|
1044
841
|
onChange: onOpenChange
|
|
@@ -1077,7 +874,7 @@ function Select({
|
|
|
1077
874
|
setValue(next);
|
|
1078
875
|
setOpen(false);
|
|
1079
876
|
}, [registerLabel, setValue, setOpen]);
|
|
1080
|
-
const context =
|
|
877
|
+
const context = useMemo3(() => {
|
|
1081
878
|
const indicator = StyleSheet.flatten([styles.indicator, tint?.indicator]);
|
|
1082
879
|
const itemLabel = StyleSheet.flatten([styles.itemLabel]);
|
|
1083
880
|
const tintedPlaceholder = tint ? StyleSheet.flatten([tint.value]).color : void 0;
|
|
@@ -1120,7 +917,7 @@ function Select({
|
|
|
1120
917
|
registerLabel
|
|
1121
918
|
};
|
|
1122
919
|
}, [styles, pressed, tint, value, isOpen, isDisabled, isInvalid, open, close, toggle, select, anchor, labelFor, registerLabel]);
|
|
1123
|
-
return /* @__PURE__ */
|
|
920
|
+
return /* @__PURE__ */jsx12(SelectProvider, {
|
|
1124
921
|
value: context,
|
|
1125
922
|
children
|
|
1126
923
|
});
|
|
@@ -1140,4 +937,4 @@ var Select2 = Object.assign(Select, {
|
|
|
1140
937
|
ItemDescription: SelectItemDescription,
|
|
1141
938
|
ItemIndicator: SelectItemIndicator
|
|
1142
939
|
});
|
|
1143
|
-
export { useSelect, useSelectItem, SelectItemLabel, SelectItem, SelectContent,
|
|
940
|
+
export { useSelect, useSelectItem, SelectItemLabel, SelectItem, SelectContent, SelectIndicator, SelectItemDescription, CheckIcon, SelectItemIndicator, SelectLabel, SelectOverlay, SelectTrigger, SelectValue, selectRecipe, Select, Select2 };
|