@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,24 +1,38 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunkLUPCPLNDcjs = require('./chunk-LUPCPLND.cjs');
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
var _chunkWDDXU3OHcjs = require('./chunk-WDDXU3OH.cjs');
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
|
|
8
|
-
var _chunk7B3UBUC6cjs = require('./chunk-7B3UBUC6.cjs');
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
var _chunkDRMT346Wcjs = require('./chunk-DRMT346W.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkEKS3W46Mcjs = require('./chunk-EKS3W46M.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkWFEMJCXOcjs = require('./chunk-WFEMJCXO.cjs');
|
|
18
|
+
|
|
19
|
+
|
|
15
20
|
|
|
16
21
|
|
|
22
|
+
var _chunk4KFKWBN5cjs = require('./chunk-4KFKWBN5.cjs');
|
|
17
23
|
|
|
18
|
-
var _chunk54FJOKANcjs = require('./chunk-54FJOKAN.cjs');
|
|
19
24
|
|
|
25
|
+
var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
var _chunkTGMVEHV7cjs = require('./chunk-TGMVEHV7.cjs');
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _chunk7DPL3ZDScjs = require('./chunk-7DPL3ZDS.cjs');
|
|
20
32
|
|
|
21
|
-
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
|
|
22
36
|
|
|
23
37
|
|
|
24
38
|
|
|
@@ -35,60 +49,18 @@ var _react = require('react');
|
|
|
35
49
|
var _reactnative = require('react-native');
|
|
36
50
|
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
37
51
|
|
|
38
|
-
// src/components/select/select.context.ts
|
|
39
|
-
var [SelectProvider, useSelect] = _chunk54FJOKANcjs.createSlotContext.call(void 0, "Select");
|
|
40
|
-
var [SelectItemProvider, useSelectItem] = _chunk54FJOKANcjs.createSlotContext.call(void 0, "Select.Item");
|
|
41
|
-
|
|
42
|
-
// src/components/select/select.animation.ts
|
|
43
|
-
|
|
44
|
-
var INDICATOR_SPRING = {
|
|
45
|
-
damping: 140,
|
|
46
|
-
stiffness: 1e3,
|
|
47
|
-
mass: 4
|
|
48
|
-
};
|
|
49
|
-
var INDICATOR_ROTATION = [0, -180];
|
|
50
|
-
var ENTER_MS = 200;
|
|
51
|
-
var EXIT_MS = 150;
|
|
52
|
-
function contentEntering(placement) {
|
|
53
|
-
const from = placement === "bottom" ? -8 : 8;
|
|
54
|
-
return new (0, _reactnativereanimated.Keyframe)({
|
|
55
|
-
0: {
|
|
56
|
-
opacity: 0,
|
|
57
|
-
transform: [{ translateY: from }, { scale: 0.95 }]
|
|
58
|
-
},
|
|
59
|
-
100: {
|
|
60
|
-
opacity: 1,
|
|
61
|
-
transform: [{ translateY: 0 }, { scale: 1 }],
|
|
62
|
-
easing: _reactnativereanimated.Easing.out(_reactnativereanimated.Easing.cubic)
|
|
63
|
-
}
|
|
64
|
-
}).duration(ENTER_MS);
|
|
65
|
-
}
|
|
66
|
-
function contentExiting(placement) {
|
|
67
|
-
const to = placement === "bottom" ? -8 : 8;
|
|
68
|
-
return new (0, _reactnativereanimated.Keyframe)({
|
|
69
|
-
0: { opacity: 1, transform: [{ translateY: 0 }, { scale: 1 }] },
|
|
70
|
-
100: {
|
|
71
|
-
opacity: 0,
|
|
72
|
-
transform: [{ translateY: to }, { scale: 0.95 }],
|
|
73
|
-
easing: _reactnativereanimated.Easing.in(_reactnativereanimated.Easing.cubic)
|
|
74
|
-
}
|
|
75
|
-
}).duration(EXIT_MS);
|
|
76
|
-
}
|
|
77
|
-
var overlayEntering = new (0, _reactnativereanimated.Keyframe)({
|
|
78
|
-
0: { opacity: 0 },
|
|
79
|
-
100: { opacity: 1 }
|
|
80
|
-
}).duration(ENTER_MS);
|
|
81
|
-
var overlayExiting = new (0, _reactnativereanimated.Keyframe)({
|
|
82
|
-
0: { opacity: 1 },
|
|
83
|
-
100: { opacity: 0 }
|
|
84
|
-
}).duration(EXIT_MS);
|
|
85
|
-
|
|
86
52
|
// src/components/select/select-item.tsx
|
|
87
53
|
|
|
88
54
|
|
|
89
55
|
// src/components/select/select-item-label.tsx
|
|
90
56
|
|
|
91
57
|
|
|
58
|
+
|
|
59
|
+
// src/components/select/select.context.ts
|
|
60
|
+
var [SelectProvider, useSelect] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Select");
|
|
61
|
+
var [SelectItemProvider, useSelectItem] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Select.Item");
|
|
62
|
+
|
|
63
|
+
// src/components/select/select-item-label.tsx
|
|
92
64
|
var _jsxruntime = require('react/jsx-runtime');
|
|
93
65
|
var SelectItemLabel = _react.forwardRef.call(void 0,
|
|
94
66
|
function SelectItemLabel2({ children, numberOfLines = 1, style, ...props }, ref) {
|
|
@@ -134,7 +106,7 @@ var SelectItem = _react.forwardRef.call(void 0, function SelectItem2({
|
|
|
134
106
|
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
135
107
|
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
136
108
|
const isSelected = selected === value;
|
|
137
|
-
const text = typeof children === "function" ? null :
|
|
109
|
+
const text = typeof children === "function" ? null : _chunk7GHM4GKLcjs.childrenToString.call(void 0, children);
|
|
138
110
|
const registered = _nullishCoalesce(_nullishCoalesce(label, () => ( text)), () => ( void 0));
|
|
139
111
|
_react.useEffect.call(void 0, () => {
|
|
140
112
|
if (registered !== void 0) registerLabel(value, registered);
|
|
@@ -151,7 +123,7 @@ var SelectItem = _react.forwardRef.call(void 0, function SelectItem2({
|
|
|
151
123
|
[isSelected, isPressed, isDisabled]
|
|
152
124
|
);
|
|
153
125
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectItemProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
154
|
-
|
|
126
|
+
_chunkTGMVEHV7cjs.PressableFeedback,
|
|
155
127
|
{
|
|
156
128
|
ref,
|
|
157
129
|
isPressed,
|
|
@@ -181,45 +153,6 @@ SelectItem.displayName = "XAUI.Select.Item";
|
|
|
181
153
|
|
|
182
154
|
// src/components/select/select.utils.ts
|
|
183
155
|
|
|
184
|
-
function resolvePlacement(input) {
|
|
185
|
-
const { anchor, content, window, offset, alignOffset, insets } = input;
|
|
186
|
-
const available = window.width - insets.start - insets.end;
|
|
187
|
-
const width = Math.min(resolveWidth(input), Math.max(available, 0));
|
|
188
|
-
const placement = choosePlacement(input);
|
|
189
|
-
const maxHeight = Math.max(roomFor(placement, input), 0);
|
|
190
|
-
const height = Math.min(content.height, maxHeight);
|
|
191
|
-
const top = placement === "bottom" ? anchor.y + anchor.height + offset : anchor.y - offset - height;
|
|
192
|
-
const start = clamp(
|
|
193
|
-
alignedStart(input, width) + alignOffset,
|
|
194
|
-
insets.start,
|
|
195
|
-
Math.max(window.width - insets.end - width, insets.start)
|
|
196
|
-
);
|
|
197
|
-
return { top, start, width, maxHeight, placement };
|
|
198
|
-
}
|
|
199
|
-
function resolveWidth({ width, anchor, content }) {
|
|
200
|
-
if (width === "trigger") return anchor.width;
|
|
201
|
-
if (width === "content-fit") return content.width;
|
|
202
|
-
return width;
|
|
203
|
-
}
|
|
204
|
-
function choosePlacement(input) {
|
|
205
|
-
const { placement, avoidCollisions, content } = input;
|
|
206
|
-
if (!avoidCollisions) return placement;
|
|
207
|
-
if (roomFor(placement, input) >= content.height) return placement;
|
|
208
|
-
const other = placement === "bottom" ? "top" : "bottom";
|
|
209
|
-
return roomFor(other, input) > roomFor(placement, input) ? other : placement;
|
|
210
|
-
}
|
|
211
|
-
function roomFor(placement, input) {
|
|
212
|
-
const { anchor, window, offset, insets } = input;
|
|
213
|
-
return placement === "bottom" ? window.height - insets.bottom - (anchor.y + anchor.height) - offset : anchor.y - insets.top - offset;
|
|
214
|
-
}
|
|
215
|
-
function alignedStart({ align, anchor }, width) {
|
|
216
|
-
if (align === "start") return anchor.x;
|
|
217
|
-
if (align === "end") return anchor.x + anchor.width - width;
|
|
218
|
-
return anchor.x + (anchor.width - width) / 2;
|
|
219
|
-
}
|
|
220
|
-
function clamp(value, min, max) {
|
|
221
|
-
return Math.min(Math.max(value, min), max);
|
|
222
|
-
}
|
|
223
156
|
function collectItemLabels(children, isItem) {
|
|
224
157
|
const found = [];
|
|
225
158
|
const walk = (node) => {
|
|
@@ -227,7 +160,7 @@ function collectItemLabels(children, isItem) {
|
|
|
227
160
|
if (!_react.isValidElement.call(void 0, child)) return;
|
|
228
161
|
const props = child.props;
|
|
229
162
|
if (isItem(child.type) && typeof props.value === "string") {
|
|
230
|
-
const label = _nullishCoalesce(props.label, () => (
|
|
163
|
+
const label = _nullishCoalesce(props.label, () => ( _chunk7GHM4GKLcjs.childrenToString.call(void 0, props.children)));
|
|
231
164
|
if (label !== null && label !== void 0) found.push([props.value, label]);
|
|
232
165
|
return;
|
|
233
166
|
}
|
|
@@ -240,15 +173,15 @@ function collectItemLabels(children, isItem) {
|
|
|
240
173
|
|
|
241
174
|
// src/components/select/select-content.tsx
|
|
242
175
|
|
|
176
|
+
|
|
243
177
|
var DEFAULT_OFFSET = 8;
|
|
244
|
-
var ZERO = { x: 0, y: 0 };
|
|
245
|
-
var isSelectItem = (type) => type === SelectItem;
|
|
246
178
|
var DEFAULT_INSETS = {
|
|
247
179
|
top: 12,
|
|
248
180
|
bottom: 12,
|
|
249
181
|
start: 12,
|
|
250
182
|
end: 12
|
|
251
183
|
};
|
|
184
|
+
var isSelectItem = (type) => type === SelectItem;
|
|
252
185
|
var SelectContent = _react.forwardRef.call(void 0,
|
|
253
186
|
function SelectContent2({
|
|
254
187
|
children,
|
|
@@ -264,56 +197,37 @@ var SelectContent = _react.forwardRef.call(void 0,
|
|
|
264
197
|
...props
|
|
265
198
|
}, ref) {
|
|
266
199
|
const context = useSelect();
|
|
267
|
-
const { contentStyle, isOpen, anchor } = context;
|
|
200
|
+
const { contentStyle, isOpen, anchor, registerLabel } = context;
|
|
268
201
|
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
const { registerLabel } = context;
|
|
273
|
-
_react.useEffect.call(void 0, () => {
|
|
274
|
-
for (const [value, label] of collectItemLabels(children, isSelectItem)) {
|
|
275
|
-
registerLabel(value, label);
|
|
276
|
-
}
|
|
277
|
-
}, [children, registerLabel]);
|
|
278
|
-
if (!isOpen && measured !== null) setMeasured(null);
|
|
279
|
-
if (!isOpen || anchor === null) return null;
|
|
280
|
-
const measure = (event) => {
|
|
281
|
-
_optionalChain([onLayout, 'optionalCall', _3 => _3(event)]);
|
|
282
|
-
const { width: w, height: h } = event.nativeEvent.layout;
|
|
283
|
-
if (measured === null || measured.height !== h || measured.width !== w) {
|
|
284
|
-
setMeasured({ width: w, height: h });
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
const local = { ...anchor, x: anchor.x - origin.x, y: anchor.y - origin.y };
|
|
288
|
-
const position = measured && resolvePlacement({
|
|
289
|
-
anchor: local,
|
|
290
|
-
content: measured,
|
|
291
|
-
// The window in the host's own coordinates, for the same reason as the anchor.
|
|
292
|
-
window: {
|
|
293
|
-
width: window.width - origin.x,
|
|
294
|
-
height: window.height - origin.y
|
|
295
|
-
},
|
|
202
|
+
const { position, onContentLayout, measuringStyle } = _chunkLUPCPLNDcjs.useAnchoredPosition.call(void 0, {
|
|
203
|
+
anchor,
|
|
204
|
+
isOpen,
|
|
296
205
|
placement,
|
|
297
206
|
align,
|
|
298
207
|
width,
|
|
299
208
|
offset,
|
|
300
209
|
alignOffset,
|
|
301
210
|
avoidCollisions,
|
|
302
|
-
insets: { ...DEFAULT_INSETS, ...insets }
|
|
211
|
+
insets: { ...DEFAULT_INSETS, ...insets },
|
|
212
|
+
onLayout
|
|
303
213
|
});
|
|
214
|
+
_react.useEffect.call(void 0, () => {
|
|
215
|
+
for (const [value, label] of collectItemLabels(children, isSelectItem)) {
|
|
216
|
+
registerLabel(value, label);
|
|
217
|
+
}
|
|
218
|
+
}, [children, registerLabel]);
|
|
219
|
+
if (!isOpen || anchor === null) return null;
|
|
304
220
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWDDXU3OHcjs.Portal, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
305
221
|
_reactnativereanimated2.default.View,
|
|
306
222
|
{
|
|
307
223
|
ref,
|
|
308
|
-
entering: position ?
|
|
309
|
-
exiting: position ?
|
|
310
|
-
onLayout:
|
|
224
|
+
entering: position ? _chunkEKS3W46Mcjs.anchoredEntering.call(void 0, position.placement) : void 0,
|
|
225
|
+
exiting: position ? _chunkEKS3W46Mcjs.anchoredExiting.call(void 0, position.placement) : void 0,
|
|
226
|
+
onLayout: onContentLayout,
|
|
311
227
|
...rest,
|
|
312
228
|
style: [
|
|
313
229
|
contentStyle,
|
|
314
|
-
|
|
315
|
-
// finally will, and invisible so the reader never sees it at the wrong place.
|
|
316
|
-
position === null ? { opacity: 0, top: 0, start: 0, width: local.width } : {
|
|
230
|
+
position === null ? measuringStyle : {
|
|
317
231
|
top: position.top,
|
|
318
232
|
start: position.start,
|
|
319
233
|
width: position.width,
|
|
@@ -332,7 +246,7 @@ var SelectContent = _react.forwardRef.call(void 0,
|
|
|
332
246
|
}
|
|
333
247
|
)
|
|
334
248
|
},
|
|
335
|
-
_nullishCoalesce(_optionalChain([position, 'optionalAccess',
|
|
249
|
+
_nullishCoalesce(_optionalChain([position, 'optionalAccess', _2 => _2.placement]), () => ( "measuring"))
|
|
336
250
|
) }) });
|
|
337
251
|
}
|
|
338
252
|
);
|
|
@@ -347,45 +261,23 @@ SelectContent.displayName = "XAUI.Select.Content";
|
|
|
347
261
|
|
|
348
262
|
|
|
349
263
|
|
|
350
|
-
// src/components/select/chevron-down-icon.tsx
|
|
351
|
-
var _reactnativesvg = require('react-native-svg');
|
|
352
|
-
|
|
353
|
-
function ChevronDownIcon({
|
|
354
|
-
size = 20,
|
|
355
|
-
color = "currentColor"
|
|
356
|
-
}) {
|
|
357
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativesvg.Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
358
|
-
_reactnativesvg.Path,
|
|
359
|
-
{
|
|
360
|
-
d: "m6 9 6 6 6-6",
|
|
361
|
-
stroke: color,
|
|
362
|
-
strokeWidth: 2,
|
|
363
|
-
strokeLinecap: "round",
|
|
364
|
-
strokeLinejoin: "round"
|
|
365
|
-
}
|
|
366
|
-
) });
|
|
367
|
-
}
|
|
368
|
-
ChevronDownIcon.displayName = "XAUI.Select.ChevronDownIcon";
|
|
369
|
-
|
|
370
|
-
// src/components/select/select-indicator.tsx
|
|
371
|
-
|
|
372
264
|
function SelectIndicator({
|
|
373
|
-
as = ChevronDownIcon,
|
|
265
|
+
as = _chunk4KFKWBN5cjs.ChevronDownIcon,
|
|
374
266
|
...props
|
|
375
267
|
}) {
|
|
376
268
|
const { indicatorStyle, isOpen } = useSelect();
|
|
377
269
|
const progress = _reactnativereanimated.useSharedValue.call(void 0, isOpen ? 1 : 0);
|
|
378
270
|
_react.useEffect.call(void 0, () => {
|
|
379
|
-
progress.set(_reactnativereanimated.withSpring.call(void 0, isOpen ? 1 : 0, INDICATOR_SPRING));
|
|
271
|
+
progress.set(_reactnativereanimated.withSpring.call(void 0, isOpen ? 1 : 0, _chunkEKS3W46Mcjs.INDICATOR_SPRING));
|
|
380
272
|
}, [isOpen, progress]);
|
|
381
273
|
const rotation = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
|
|
382
274
|
transform: [
|
|
383
275
|
{
|
|
384
|
-
rotate: `${_reactnativereanimated.interpolate.call(void 0, progress.get(), [0, 1], [INDICATOR_ROTATION[0], INDICATOR_ROTATION[1]])}deg`
|
|
276
|
+
rotate: `${_reactnativereanimated.interpolate.call(void 0, progress.get(), [0, 1], [_chunkEKS3W46Mcjs.INDICATOR_ROTATION[0], _chunkEKS3W46Mcjs.INDICATOR_ROTATION[1]])}deg`
|
|
385
277
|
}
|
|
386
278
|
]
|
|
387
279
|
}));
|
|
388
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { style: [indicatorStyle, rotation], children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
280
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { style: [indicatorStyle, rotation], children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.Icon, { as, ...props }) });
|
|
389
281
|
}
|
|
390
282
|
SelectIndicator.displayName = "XAUI.Select.Indicator";
|
|
391
283
|
|
|
@@ -406,7 +298,7 @@ SelectItemDescription.displayName = "XAUI.Select.ItemDescription";
|
|
|
406
298
|
|
|
407
299
|
|
|
408
300
|
// src/components/select/check-icon.tsx
|
|
409
|
-
|
|
301
|
+
var _reactnativesvg = require('react-native-svg');
|
|
410
302
|
|
|
411
303
|
function CheckIcon({
|
|
412
304
|
size = 20,
|
|
@@ -434,7 +326,7 @@ function SelectItemIndicator({
|
|
|
434
326
|
}) {
|
|
435
327
|
const { itemIndicatorStyle, checkColor } = useSelect();
|
|
436
328
|
const { isSelected } = useSelectItem();
|
|
437
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: itemIndicatorStyle, children: isSelected ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
329
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: itemIndicatorStyle, children: isSelected ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.Icon, { as, color: _nullishCoalesce(color, () => ( checkColor)), ...props }) : null });
|
|
438
330
|
}
|
|
439
331
|
SelectItemIndicator.displayName = "XAUI.Select.ItemIndicator";
|
|
440
332
|
|
|
@@ -474,8 +366,8 @@ var SelectOverlay = _react.forwardRef.call(void 0,
|
|
|
474
366
|
AnimatedPressable,
|
|
475
367
|
{
|
|
476
368
|
ref,
|
|
477
|
-
entering: overlayEntering,
|
|
478
|
-
exiting: overlayExiting,
|
|
369
|
+
entering: _chunkEKS3W46Mcjs.overlayEntering,
|
|
370
|
+
exiting: _chunkEKS3W46Mcjs.overlayExiting,
|
|
479
371
|
accessibilityRole: "none",
|
|
480
372
|
importantForAccessibility: "no",
|
|
481
373
|
onPress: isDismissable ? close : void 0,
|
|
@@ -517,15 +409,15 @@ var SelectTrigger = _react.forwardRef.call(void 0,
|
|
|
517
409
|
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
518
410
|
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
519
411
|
const node = _react.useRef.call(void 0, null);
|
|
520
|
-
const refs =
|
|
412
|
+
const refs = _chunkWFEMJCXOcjs.useMergedRef.call(void 0, node, ref);
|
|
521
413
|
const measure = _react.useCallback.call(void 0, () => {
|
|
522
|
-
_optionalChain([node, 'access',
|
|
414
|
+
_optionalChain([node, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.measureInWindow, 'call', _5 => _5((x, y, width, height) => {
|
|
523
415
|
setAnchor({ x, y, width, height });
|
|
524
416
|
})]);
|
|
525
417
|
}, [setAnchor]);
|
|
526
418
|
const handleLayout = _react.useCallback.call(void 0,
|
|
527
419
|
(event) => {
|
|
528
|
-
_optionalChain([onLayout, 'optionalCall',
|
|
420
|
+
_optionalChain([onLayout, 'optionalCall', _6 => _6(event)]);
|
|
529
421
|
measure();
|
|
530
422
|
},
|
|
531
423
|
[measure, onLayout]
|
|
@@ -535,14 +427,14 @@ var SelectTrigger = _react.forwardRef.call(void 0,
|
|
|
535
427
|
}, [isOpen, measure]);
|
|
536
428
|
const handlePress = _react.useCallback.call(void 0,
|
|
537
429
|
(event) => {
|
|
538
|
-
_optionalChain([onPress, 'optionalCall',
|
|
430
|
+
_optionalChain([onPress, 'optionalCall', _7 => _7(event)]);
|
|
539
431
|
measure();
|
|
540
432
|
toggle();
|
|
541
433
|
},
|
|
542
434
|
[measure, onPress, toggle]
|
|
543
435
|
);
|
|
544
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
545
|
-
|
|
436
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.IconContext.Provider, { value: glyph, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
437
|
+
_chunkTGMVEHV7cjs.PressableFeedback,
|
|
546
438
|
{
|
|
547
439
|
ref: refs,
|
|
548
440
|
isPressed,
|
|
@@ -601,22 +493,6 @@ SelectValue.displayName = "XAUI.Select.Value";
|
|
|
601
493
|
|
|
602
494
|
// src/components/select/select.hook.ts
|
|
603
495
|
|
|
604
|
-
function useControllableState({
|
|
605
|
-
value,
|
|
606
|
-
defaultValue,
|
|
607
|
-
onChange
|
|
608
|
-
}) {
|
|
609
|
-
const isControlled = _react.useRef.call(void 0, value !== void 0).current;
|
|
610
|
-
const [uncontrolled, setUncontrolled] = _react.useState.call(void 0, defaultValue);
|
|
611
|
-
const set = _react.useCallback.call(void 0,
|
|
612
|
-
(next) => {
|
|
613
|
-
if (!isControlled) setUncontrolled(next);
|
|
614
|
-
_optionalChain([onChange, 'optionalCall', _10 => _10(next)]);
|
|
615
|
-
},
|
|
616
|
-
[isControlled, onChange]
|
|
617
|
-
);
|
|
618
|
-
return [isControlled ? value : uncontrolled, set];
|
|
619
|
-
}
|
|
620
496
|
function useLabelRegistry() {
|
|
621
497
|
const labels = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
|
|
622
498
|
const [, force] = _react.useState.call(void 0, 0);
|
|
@@ -869,12 +745,12 @@ function Select({
|
|
|
869
745
|
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
870
746
|
const { labelFor, registerLabel } = useLabelRegistry();
|
|
871
747
|
const [anchor, setAnchor] = _react.useState.call(void 0, null);
|
|
872
|
-
const [value, setValue] = useControllableState({
|
|
748
|
+
const [value, setValue] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
873
749
|
value: controlledValue,
|
|
874
750
|
defaultValue,
|
|
875
751
|
onChange: onValueChange
|
|
876
752
|
});
|
|
877
|
-
const [isOpen
|
|
753
|
+
const [isOpen, setOpen] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
878
754
|
value: controlledOpen,
|
|
879
755
|
defaultValue: defaultOpen,
|
|
880
756
|
onChange: onOpenChange
|
|
@@ -911,7 +787,7 @@ function Select({
|
|
|
911
787
|
const context = _react.useMemo.call(void 0, () => {
|
|
912
788
|
const indicator = _reactnative.StyleSheet.flatten([
|
|
913
789
|
styles.indicator,
|
|
914
|
-
_optionalChain([tint, 'optionalAccess',
|
|
790
|
+
_optionalChain([tint, 'optionalAccess', _8 => _8.indicator])
|
|
915
791
|
]);
|
|
916
792
|
const itemLabel = _reactnative.StyleSheet.flatten([styles.itemLabel]);
|
|
917
793
|
const tintedPlaceholder = tint ? _reactnative.StyleSheet.flatten([tint.value]).color : void 0;
|
|
@@ -1002,5 +878,4 @@ var Select2 = Object.assign(Select, {
|
|
|
1002
878
|
|
|
1003
879
|
|
|
1004
880
|
|
|
1005
|
-
|
|
1006
|
-
exports.useSelect = useSelect; exports.useSelectItem = useSelectItem; exports.SelectItemLabel = SelectItemLabel; exports.SelectItem = SelectItem; exports.SelectContent = SelectContent; exports.ChevronDownIcon = ChevronDownIcon; exports.SelectIndicator = SelectIndicator; exports.SelectItemDescription = SelectItemDescription; exports.CheckIcon = CheckIcon; exports.SelectItemIndicator = SelectItemIndicator; exports.SelectLabel = SelectLabel; exports.SelectOverlay = SelectOverlay; exports.SelectTrigger = SelectTrigger; exports.SelectValue = SelectValue; exports.selectRecipe = selectRecipe; exports.Select = Select; exports.Select2 = Select2;
|
|
881
|
+
exports.useSelect = useSelect; exports.useSelectItem = useSelectItem; exports.SelectItemLabel = SelectItemLabel; exports.SelectItem = SelectItem; exports.SelectContent = SelectContent; exports.SelectIndicator = SelectIndicator; exports.SelectItemDescription = SelectItemDescription; exports.CheckIcon = CheckIcon; exports.SelectItemIndicator = SelectItemIndicator; exports.SelectLabel = SelectLabel; exports.SelectOverlay = SelectOverlay; exports.SelectTrigger = SelectTrigger; exports.SelectValue = SelectValue; exports.selectRecipe = selectRecipe; exports.Select = Select; exports.Select2 = Select2;
|
|
@@ -2,8 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
var _chunkH4E4HDEPcjs = require('./chunk-H4E4HDEP.cjs');
|
|
4
4
|
|
|
5
|
-
// src/system/slot/
|
|
5
|
+
// src/system/slot/children-to-string.ts
|
|
6
6
|
var _react = require('react');
|
|
7
|
+
function childrenToString(children) {
|
|
8
|
+
const text = stringify(children);
|
|
9
|
+
return text === null || text === "" ? null : text;
|
|
10
|
+
}
|
|
11
|
+
function stringify(node) {
|
|
12
|
+
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
13
|
+
if (typeof node === "string") return node;
|
|
14
|
+
if (typeof node === "number") return String(node);
|
|
15
|
+
if (_react.isValidElement.call(void 0, node)) return null;
|
|
16
|
+
if (Array.isArray(node)) {
|
|
17
|
+
let text = "";
|
|
18
|
+
for (const child of node) {
|
|
19
|
+
const part = stringify(child);
|
|
20
|
+
if (part === null) return null;
|
|
21
|
+
text += part;
|
|
22
|
+
}
|
|
23
|
+
return text;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/system/slot/create-slot-context.ts
|
|
29
|
+
|
|
7
30
|
function createSlotContext(name) {
|
|
8
31
|
const Context = _react.createContext.call(void 0, null);
|
|
9
32
|
Context.displayName = `XAUI.${name}.Context`;
|
|
@@ -88,32 +111,9 @@ function refOf(element) {
|
|
|
88
111
|
return _nullishCoalesce(fromProps, () => ( fromElement));
|
|
89
112
|
}
|
|
90
113
|
|
|
91
|
-
// src/system/slot/children-to-string.ts
|
|
92
|
-
|
|
93
|
-
function childrenToString(children) {
|
|
94
|
-
const text = stringify(children);
|
|
95
|
-
return text === null || text === "" ? null : text;
|
|
96
|
-
}
|
|
97
|
-
function stringify(node) {
|
|
98
|
-
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
99
|
-
if (typeof node === "string") return node;
|
|
100
|
-
if (typeof node === "number") return String(node);
|
|
101
|
-
if (_react.isValidElement.call(void 0, node)) return null;
|
|
102
|
-
if (Array.isArray(node)) {
|
|
103
|
-
let text = "";
|
|
104
|
-
for (const child of node) {
|
|
105
|
-
const part = stringify(child);
|
|
106
|
-
if (part === null) return null;
|
|
107
|
-
text += part;
|
|
108
|
-
}
|
|
109
|
-
return text;
|
|
110
|
-
}
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
exports.
|
|
119
|
+
exports.childrenToString = childrenToString; exports.createSlotContext = createSlotContext; exports.mergeProps = mergeProps; exports.Slot = Slot;
|