@xaui/native 0.9.1-alpha.4 → 0.9.1-alpha.40
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-2EGR4LWD.js +145 -0
- package/dist/chunk-2NRZKJG7.js +531 -0
- package/dist/chunk-2PMXMKS5.js +67 -0
- package/dist/chunk-2XPG2243.js +586 -0
- package/dist/chunk-36PRYGAM.js +13 -0
- package/dist/chunk-3E7CDKFO.cjs +696 -0
- package/dist/chunk-3GFRSZYR.js +54 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-4CUZZWFW.js +92 -0
- package/dist/chunk-4GTAZM2C.js +174 -0
- package/dist/chunk-4KFKWBN5.cjs +89 -0
- package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
- package/dist/chunk-5R26NM4M.cjs +402 -0
- package/dist/chunk-5VKYNBNA.js +607 -0
- package/dist/chunk-64MXEVT3.js +66 -0
- package/dist/chunk-6DOLGZVV.cjs +147 -0
- package/dist/chunk-6L2TS2R3.cjs +92 -0
- package/dist/chunk-6UEZJRVI.js +669 -0
- package/dist/chunk-734MFAX4.js +27 -0
- package/dist/chunk-73RKQC5X.js +104 -0
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/chunk-7GHM4GKL.cjs +119 -0
- package/dist/chunk-7YF5NAHQ.cjs +74 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
- package/dist/chunk-ABAGZTXZ.cjs +736 -0
- package/dist/{chunk-AW63PTQ4.cjs → chunk-ACAPTWE3.cjs} +85 -81
- package/dist/chunk-AMCSSOJT.cjs +104 -0
- package/dist/chunk-BA2DBSAN.js +102 -0
- package/dist/chunk-BRRXFOBY.js +431 -0
- package/dist/chunk-C5YLPCFC.cjs +293 -0
- package/dist/chunk-DA3OKXHV.cjs +700 -0
- package/dist/chunk-DD4276RF.js +366 -0
- package/dist/chunk-DG2I4PJG.js +701 -0
- package/dist/chunk-DHGLGSH6.js +661 -0
- package/dist/chunk-DIBUQ46Y.js +346 -0
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/chunk-EKS3W46M.cjs +66 -0
- package/dist/chunk-EZEYMLO3.js +402 -0
- package/dist/chunk-F6CQ6CBI.cjs +112 -0
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-FHUYHV6J.js +89 -0
- package/dist/chunk-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G7P3ERYF.cjs +478 -0
- package/dist/chunk-GA6PBWNT.js +147 -0
- package/dist/chunk-GFUZ3MUT.cjs +455 -0
- package/dist/chunk-GGW43Q37.cjs +1 -0
- package/dist/chunk-GTR5X65M.cjs +27 -0
- package/dist/chunk-H4E4HDEP.cjs +13 -0
- package/dist/chunk-H7DS4IO7.js +198 -0
- package/dist/chunk-HDVVZG4S.cjs +198 -0
- package/dist/chunk-IKJVLJKT.js +151 -0
- package/dist/chunk-J3MB4PI5.cjs +531 -0
- package/dist/chunk-K72UDPVN.js +119 -0
- package/dist/chunk-KCMYU7WF.js +86 -0
- package/dist/chunk-LRN3RNDO.js +940 -0
- package/dist/chunk-LTX6TB5I.js +124 -0
- package/dist/chunk-LUPCPLND.cjs +145 -0
- package/dist/chunk-M63GFNKV.js +194 -0
- package/dist/chunk-N3KTZMPG.js +293 -0
- package/dist/chunk-NCTOTTVW.js +13 -0
- package/dist/chunk-NWGLP6JX.cjs +410 -0
- package/dist/chunk-R73XQK7X.cjs +314 -0
- package/dist/chunk-RU7JCMWC.cjs +881 -0
- package/dist/chunk-SNIHUKDA.cjs +184 -0
- package/dist/chunk-T5FV5F7A.cjs +607 -0
- package/dist/chunk-TDTUAIFF.cjs +153 -0
- package/dist/chunk-TJ74XVZN.cjs +431 -0
- package/dist/chunk-TK44VBIE.cjs +194 -0
- package/dist/chunk-UAWBAD4E.cjs +346 -0
- package/dist/chunk-UFTCTTKK.js +381 -0
- package/dist/chunk-WDDXU3OH.cjs +67 -0
- package/dist/chunk-WFEMJCXO.cjs +13 -0
- package/dist/chunk-WHJTBTYM.js +0 -0
- package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
- package/dist/chunk-XFPQFCEK.js +455 -0
- package/dist/chunk-XSQPVDFH.cjs +60 -0
- package/dist/chunk-XTC2SLFT.js +153 -0
- package/dist/chunk-XV735BSA.cjs +366 -0
- package/dist/chunk-XWNG2U4K.cjs +124 -0
- package/dist/chunk-YGYYJ3LQ.js +314 -0
- package/dist/chunk-YVHT2UVW.js +74 -0
- package/dist/chunk-ZFOOJK37.cjs +86 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- 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 +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/avatar/index.cjs +16 -0
- package/dist/components/avatar/index.d.cts +131 -0
- package/dist/components/avatar/index.d.ts +131 -0
- package/dist/components/avatar/index.js +16 -0
- package/dist/components/badge/index.cjs +15 -0
- package/dist/components/badge/index.d.cts +157 -0
- package/dist/components/badge/index.d.ts +157 -0
- package/dist/components/badge/index.js +15 -0
- package/dist/components/button/index.cjs +22 -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 +22 -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/field-group/index.cjs +27 -0
- package/dist/components/field-group/index.d.cts +270 -0
- package/dist/components/field-group/index.d.ts +270 -0
- package/dist/components/field-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/menu/index.cjs +49 -0
- package/dist/components/menu/index.d.cts +351 -0
- package/dist/components/menu/index.d.ts +351 -0
- package/dist/components/menu/index.js +49 -0
- package/dist/components/popover/index.cjs +38 -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 +38 -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/select/index.cjs +50 -0
- package/dist/components/select/index.d.cts +498 -0
- package/dist/components/select/index.d.ts +498 -0
- package/dist/components/select/index.js +50 -0
- package/dist/components/skeleton/index.cjs +11 -0
- package/dist/components/skeleton/index.d.cts +111 -0
- package/dist/components/skeleton/index.d.ts +111 -0
- package/dist/components/skeleton/index.js +11 -0
- package/dist/components/spinner/index.cjs +17 -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 +17 -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/text-field/index.cjs +25 -0
- package/dist/components/text-field/index.d.cts +205 -0
- package/dist/components/text-field/index.d.ts +205 -0
- package/dist/components/text-field/index.js +25 -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 +400 -4
- package/dist/index.d.cts +118 -4
- package/dist/index.d.ts +118 -4
- package/dist/index.js +423 -27
- package/dist/placement-DHa0Rrh1.d.cts +38 -0
- package/dist/placement-DHa0Rrh1.d.ts +38 -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 +73 -4
- package/dist/system/index.d.cts +379 -193
- package/dist/system/index.d.ts +379 -193
- package/dist/system/index.js +87 -18
- package/dist/text-field.type-0l73acce.d.ts +167 -0
- package/dist/text-field.type-DBh06DU5.d.cts +167 -0
- package/dist/theme/index.cjs +5 -3
- package/dist/theme/index.d.cts +55 -24
- package/dist/theme/index.d.ts +55 -24
- package/dist/theme/index.js +4 -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 +254 -18
- package/dist/chunk-ECDWSSHJ.js +0 -688
- package/dist/chunk-IYFGO523.cjs +0 -688
|
@@ -0,0 +1,881 @@
|
|
|
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
|
+
|
|
3
|
+
var _chunkLUPCPLNDcjs = require('./chunk-LUPCPLND.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWDDXU3OHcjs = require('./chunk-WDDXU3OH.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkEKS3W46Mcjs = require('./chunk-EKS3W46M.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkWFEMJCXOcjs = require('./chunk-WFEMJCXO.cjs');
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunk4KFKWBN5cjs = require('./chunk-4KFKWBN5.cjs');
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
var _chunk3E7CDKFOcjs = require('./chunk-3E7CDKFO.cjs');
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _chunk7DPL3ZDScjs = require('./chunk-7DPL3ZDS.cjs');
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
|
|
46
|
+
|
|
47
|
+
// src/components/select/select-content.tsx
|
|
48
|
+
var _react = require('react');
|
|
49
|
+
var _reactnative = require('react-native');
|
|
50
|
+
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
51
|
+
|
|
52
|
+
// src/components/select/select-item.tsx
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
// src/components/select/select-item-label.tsx
|
|
56
|
+
|
|
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
|
|
64
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
65
|
+
var SelectItemLabel = _react.forwardRef.call(void 0,
|
|
66
|
+
function SelectItemLabel2({ children, numberOfLines = 1, style, ...props }, ref) {
|
|
67
|
+
const { itemLabelStyle } = useSelect();
|
|
68
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
69
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
70
|
+
_reactnative.Text,
|
|
71
|
+
{
|
|
72
|
+
ref,
|
|
73
|
+
numberOfLines,
|
|
74
|
+
...rest,
|
|
75
|
+
style: [itemLabelStyle, styleProps, style],
|
|
76
|
+
children
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
SelectItemLabel.displayName = "XAUI.Select.ItemLabel";
|
|
82
|
+
|
|
83
|
+
// src/components/select/select-item.tsx
|
|
84
|
+
|
|
85
|
+
var SelectItem = _react.forwardRef.call(void 0, function SelectItem2({
|
|
86
|
+
value,
|
|
87
|
+
label,
|
|
88
|
+
children,
|
|
89
|
+
isDisabled = false,
|
|
90
|
+
asChild = false,
|
|
91
|
+
accessibilityRole = "menuitem",
|
|
92
|
+
accessibilityState,
|
|
93
|
+
style,
|
|
94
|
+
onPress,
|
|
95
|
+
onPressIn,
|
|
96
|
+
onPressOut,
|
|
97
|
+
...props
|
|
98
|
+
}, ref) {
|
|
99
|
+
const {
|
|
100
|
+
itemStyle,
|
|
101
|
+
itemPressedStyle,
|
|
102
|
+
value: selected,
|
|
103
|
+
select,
|
|
104
|
+
registerLabel
|
|
105
|
+
} = useSelect();
|
|
106
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
107
|
+
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
108
|
+
const isSelected = selected === value;
|
|
109
|
+
const text = typeof children === "function" ? null : _chunk7GHM4GKLcjs.childrenToString.call(void 0, children);
|
|
110
|
+
const registered = _nullishCoalesce(_nullishCoalesce(label, () => ( text)), () => ( void 0));
|
|
111
|
+
_react.useEffect.call(void 0, () => {
|
|
112
|
+
if (registered !== void 0) registerLabel(value, registered);
|
|
113
|
+
}, [registerLabel, value, registered]);
|
|
114
|
+
const handlePress = _react.useCallback.call(void 0,
|
|
115
|
+
(event) => {
|
|
116
|
+
_optionalChain([onPress, 'optionalCall', _ => _(event)]);
|
|
117
|
+
select(value, registered);
|
|
118
|
+
},
|
|
119
|
+
[onPress, select, value, registered]
|
|
120
|
+
);
|
|
121
|
+
const context = _react.useMemo.call(void 0,
|
|
122
|
+
() => ({ isSelected, isPressed, isDisabled }),
|
|
123
|
+
[isSelected, isPressed, isDisabled]
|
|
124
|
+
);
|
|
125
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectItemProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
126
|
+
_chunk3E7CDKFOcjs.PressableFeedback,
|
|
127
|
+
{
|
|
128
|
+
ref,
|
|
129
|
+
isPressed,
|
|
130
|
+
isDisabled,
|
|
131
|
+
asChild,
|
|
132
|
+
accessibilityRole,
|
|
133
|
+
accessibilityState: {
|
|
134
|
+
disabled: isDisabled,
|
|
135
|
+
selected: isSelected,
|
|
136
|
+
...accessibilityState
|
|
137
|
+
},
|
|
138
|
+
...rest,
|
|
139
|
+
style: [
|
|
140
|
+
itemStyle,
|
|
141
|
+
isPressed && itemPressedStyle,
|
|
142
|
+
styleProps,
|
|
143
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
144
|
+
],
|
|
145
|
+
onPress: handlePress,
|
|
146
|
+
onPressIn: press.onPressIn,
|
|
147
|
+
onPressOut: press.onPressOut,
|
|
148
|
+
children: typeof children === "function" ? children(context) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: text !== null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectItemLabel, { children: text }) : children })
|
|
149
|
+
}
|
|
150
|
+
) });
|
|
151
|
+
});
|
|
152
|
+
SelectItem.displayName = "XAUI.Select.Item";
|
|
153
|
+
|
|
154
|
+
// src/components/select/select.utils.ts
|
|
155
|
+
|
|
156
|
+
function collectItemLabels(children, isItem) {
|
|
157
|
+
const found = [];
|
|
158
|
+
const walk = (node) => {
|
|
159
|
+
_react.Children.forEach(node, (child) => {
|
|
160
|
+
if (!_react.isValidElement.call(void 0, child)) return;
|
|
161
|
+
const props = child.props;
|
|
162
|
+
if (isItem(child.type) && typeof props.value === "string") {
|
|
163
|
+
const label = _nullishCoalesce(props.label, () => ( _chunk7GHM4GKLcjs.childrenToString.call(void 0, props.children)));
|
|
164
|
+
if (label !== null && label !== void 0) found.push([props.value, label]);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
walk(props.children);
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
walk(children);
|
|
171
|
+
return found;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// src/components/select/select-content.tsx
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
var DEFAULT_OFFSET = 8;
|
|
178
|
+
var DEFAULT_INSETS = {
|
|
179
|
+
top: 12,
|
|
180
|
+
bottom: 12,
|
|
181
|
+
start: 12,
|
|
182
|
+
end: 12
|
|
183
|
+
};
|
|
184
|
+
var isSelectItem = (type) => type === SelectItem;
|
|
185
|
+
var SelectContent = _react.forwardRef.call(void 0,
|
|
186
|
+
function SelectContent2({
|
|
187
|
+
children,
|
|
188
|
+
placement = "bottom",
|
|
189
|
+
align = "center",
|
|
190
|
+
width = "trigger",
|
|
191
|
+
offset = DEFAULT_OFFSET,
|
|
192
|
+
alignOffset = 0,
|
|
193
|
+
avoidCollisions = true,
|
|
194
|
+
insets,
|
|
195
|
+
style,
|
|
196
|
+
onLayout,
|
|
197
|
+
...props
|
|
198
|
+
}, ref) {
|
|
199
|
+
const context = useSelect();
|
|
200
|
+
const { contentStyle, isOpen, anchor, registerLabel } = context;
|
|
201
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
202
|
+
const { position, onContentLayout, measuringStyle } = _chunkLUPCPLNDcjs.useAnchoredPosition.call(void 0, {
|
|
203
|
+
anchor,
|
|
204
|
+
isOpen,
|
|
205
|
+
placement,
|
|
206
|
+
align,
|
|
207
|
+
width,
|
|
208
|
+
offset,
|
|
209
|
+
alignOffset,
|
|
210
|
+
avoidCollisions,
|
|
211
|
+
insets: { ...DEFAULT_INSETS, ...insets },
|
|
212
|
+
onLayout
|
|
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;
|
|
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,
|
|
221
|
+
_reactnativereanimated2.default.View,
|
|
222
|
+
{
|
|
223
|
+
ref,
|
|
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,
|
|
227
|
+
...rest,
|
|
228
|
+
style: [
|
|
229
|
+
contentStyle,
|
|
230
|
+
position === null ? measuringStyle : {
|
|
231
|
+
top: position.top,
|
|
232
|
+
start: position.start,
|
|
233
|
+
width: position.width,
|
|
234
|
+
maxHeight: position.maxHeight
|
|
235
|
+
},
|
|
236
|
+
styleProps,
|
|
237
|
+
style
|
|
238
|
+
],
|
|
239
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
240
|
+
_reactnative.ScrollView,
|
|
241
|
+
{
|
|
242
|
+
bounces: false,
|
|
243
|
+
keyboardShouldPersistTaps: "handled",
|
|
244
|
+
showsVerticalScrollIndicator: false,
|
|
245
|
+
children
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
},
|
|
249
|
+
_nullishCoalesce(_optionalChain([position, 'optionalAccess', _2 => _2.placement]), () => ( "measuring"))
|
|
250
|
+
) }) });
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
SelectContent.displayName = "XAUI.Select.Content";
|
|
254
|
+
|
|
255
|
+
// src/components/select/select-indicator.tsx
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
function SelectIndicator({
|
|
265
|
+
as = _chunk4KFKWBN5cjs.ChevronDownIcon,
|
|
266
|
+
...props
|
|
267
|
+
}) {
|
|
268
|
+
const { indicatorStyle, isOpen } = useSelect();
|
|
269
|
+
const progress = _reactnativereanimated.useSharedValue.call(void 0, isOpen ? 1 : 0);
|
|
270
|
+
_react.useEffect.call(void 0, () => {
|
|
271
|
+
progress.set(_reactnativereanimated.withSpring.call(void 0, isOpen ? 1 : 0, _chunkEKS3W46Mcjs.INDICATOR_SPRING));
|
|
272
|
+
}, [isOpen, progress]);
|
|
273
|
+
const rotation = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
|
|
274
|
+
transform: [
|
|
275
|
+
{
|
|
276
|
+
rotate: `${_reactnativereanimated.interpolate.call(void 0, progress.get(), [0, 1], [_chunkEKS3W46Mcjs.INDICATOR_ROTATION[0], _chunkEKS3W46Mcjs.INDICATOR_ROTATION[1]])}deg`
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
}));
|
|
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 }) });
|
|
281
|
+
}
|
|
282
|
+
SelectIndicator.displayName = "XAUI.Select.Indicator";
|
|
283
|
+
|
|
284
|
+
// src/components/select/select-item-description.tsx
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
var SelectItemDescription = _react.forwardRef.call(void 0,
|
|
289
|
+
function SelectItemDescription2({ children, style, ...props }, ref) {
|
|
290
|
+
const { itemDescriptionStyle } = useSelect();
|
|
291
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
292
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, ...rest, style: [itemDescriptionStyle, styleProps, style], children });
|
|
293
|
+
}
|
|
294
|
+
);
|
|
295
|
+
SelectItemDescription.displayName = "XAUI.Select.ItemDescription";
|
|
296
|
+
|
|
297
|
+
// src/components/select/select-item-indicator.tsx
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
// src/components/select/check-icon.tsx
|
|
301
|
+
var _reactnativesvg = require('react-native-svg');
|
|
302
|
+
|
|
303
|
+
function CheckIcon({
|
|
304
|
+
size = 20,
|
|
305
|
+
color = "currentColor"
|
|
306
|
+
}) {
|
|
307
|
+
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,
|
|
308
|
+
_reactnativesvg.Path,
|
|
309
|
+
{
|
|
310
|
+
d: "m20 6-11 11-5-5",
|
|
311
|
+
stroke: color,
|
|
312
|
+
strokeWidth: 2,
|
|
313
|
+
strokeLinecap: "round",
|
|
314
|
+
strokeLinejoin: "round"
|
|
315
|
+
}
|
|
316
|
+
) });
|
|
317
|
+
}
|
|
318
|
+
CheckIcon.displayName = "XAUI.Select.CheckIcon";
|
|
319
|
+
|
|
320
|
+
// src/components/select/select-item-indicator.tsx
|
|
321
|
+
|
|
322
|
+
function SelectItemIndicator({
|
|
323
|
+
as = CheckIcon,
|
|
324
|
+
color,
|
|
325
|
+
...props
|
|
326
|
+
}) {
|
|
327
|
+
const { itemIndicatorStyle, checkColor } = useSelect();
|
|
328
|
+
const { isSelected } = useSelectItem();
|
|
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 });
|
|
330
|
+
}
|
|
331
|
+
SelectItemIndicator.displayName = "XAUI.Select.ItemIndicator";
|
|
332
|
+
|
|
333
|
+
// src/components/select/select-label.tsx
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
var SelectLabel = _react.forwardRef.call(void 0, function SelectLabel2({ children, accessibilityRole = "header", style, ...props }, ref) {
|
|
338
|
+
const { labelStyle } = useSelect();
|
|
339
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
340
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
341
|
+
_reactnative.Text,
|
|
342
|
+
{
|
|
343
|
+
ref,
|
|
344
|
+
accessibilityRole,
|
|
345
|
+
...rest,
|
|
346
|
+
style: [labelStyle, styleProps, style],
|
|
347
|
+
children
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
});
|
|
351
|
+
SelectLabel.displayName = "XAUI.Select.Label";
|
|
352
|
+
|
|
353
|
+
// src/components/select/select-overlay.tsx
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
|
|
359
|
+
var SelectOverlay = _react.forwardRef.call(void 0,
|
|
360
|
+
function SelectOverlay2({ children, isDismissable = true, style, ...props }, ref) {
|
|
361
|
+
const context = useSelect();
|
|
362
|
+
const { overlayStyle, isOpen, close } = context;
|
|
363
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
364
|
+
if (!isOpen) return null;
|
|
365
|
+
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,
|
|
366
|
+
AnimatedPressable,
|
|
367
|
+
{
|
|
368
|
+
ref,
|
|
369
|
+
entering: _chunkEKS3W46Mcjs.overlayEntering,
|
|
370
|
+
exiting: _chunkEKS3W46Mcjs.overlayExiting,
|
|
371
|
+
accessibilityRole: "none",
|
|
372
|
+
importantForAccessibility: "no",
|
|
373
|
+
onPress: isDismissable ? close : void 0,
|
|
374
|
+
...rest,
|
|
375
|
+
style: [overlayStyle, styleProps, style],
|
|
376
|
+
children
|
|
377
|
+
}
|
|
378
|
+
) }) });
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
SelectOverlay.displayName = "XAUI.Select.Overlay";
|
|
382
|
+
|
|
383
|
+
// src/components/select/select-trigger.tsx
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
var SelectTrigger = _react.forwardRef.call(void 0,
|
|
387
|
+
function SelectTrigger2({
|
|
388
|
+
children,
|
|
389
|
+
asChild = false,
|
|
390
|
+
accessibilityRole = "button",
|
|
391
|
+
accessibilityState,
|
|
392
|
+
style,
|
|
393
|
+
onLayout,
|
|
394
|
+
onPressIn,
|
|
395
|
+
onPressOut,
|
|
396
|
+
onPress,
|
|
397
|
+
...props
|
|
398
|
+
}, ref) {
|
|
399
|
+
const {
|
|
400
|
+
triggerStyle,
|
|
401
|
+
triggerPressedStyle,
|
|
402
|
+
glyph,
|
|
403
|
+
isOpen,
|
|
404
|
+
isDisabled,
|
|
405
|
+
isInvalid,
|
|
406
|
+
toggle,
|
|
407
|
+
setAnchor
|
|
408
|
+
} = useSelect();
|
|
409
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
410
|
+
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
411
|
+
const node = _react.useRef.call(void 0, null);
|
|
412
|
+
const refs = _chunkWFEMJCXOcjs.useMergedRef.call(void 0, node, ref);
|
|
413
|
+
const measure = _react.useCallback.call(void 0, () => {
|
|
414
|
+
_optionalChain([node, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.measureInWindow, 'call', _5 => _5((x, y, width, height) => {
|
|
415
|
+
setAnchor({ x, y, width, height });
|
|
416
|
+
})]);
|
|
417
|
+
}, [setAnchor]);
|
|
418
|
+
const handleLayout = _react.useCallback.call(void 0,
|
|
419
|
+
(event) => {
|
|
420
|
+
_optionalChain([onLayout, 'optionalCall', _6 => _6(event)]);
|
|
421
|
+
measure();
|
|
422
|
+
},
|
|
423
|
+
[measure, onLayout]
|
|
424
|
+
);
|
|
425
|
+
_react.useEffect.call(void 0, () => {
|
|
426
|
+
if (isOpen) measure();
|
|
427
|
+
}, [isOpen, measure]);
|
|
428
|
+
const handlePress = _react.useCallback.call(void 0,
|
|
429
|
+
(event) => {
|
|
430
|
+
_optionalChain([onPress, 'optionalCall', _7 => _7(event)]);
|
|
431
|
+
measure();
|
|
432
|
+
toggle();
|
|
433
|
+
},
|
|
434
|
+
[measure, onPress, toggle]
|
|
435
|
+
);
|
|
436
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.IconContext.Provider, { value: glyph, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
437
|
+
_chunk3E7CDKFOcjs.PressableFeedback,
|
|
438
|
+
{
|
|
439
|
+
ref: refs,
|
|
440
|
+
isPressed,
|
|
441
|
+
isDisabled,
|
|
442
|
+
asChild,
|
|
443
|
+
accessibilityRole,
|
|
444
|
+
accessibilityState: {
|
|
445
|
+
disabled: isDisabled,
|
|
446
|
+
expanded: isOpen,
|
|
447
|
+
...accessibilityState
|
|
448
|
+
},
|
|
449
|
+
"aria-invalid": isInvalid || void 0,
|
|
450
|
+
...rest,
|
|
451
|
+
onLayout: handleLayout,
|
|
452
|
+
style: [
|
|
453
|
+
triggerStyle,
|
|
454
|
+
isPressed && triggerPressedStyle,
|
|
455
|
+
styleProps,
|
|
456
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
457
|
+
],
|
|
458
|
+
onPress: handlePress,
|
|
459
|
+
onPressIn: press.onPressIn,
|
|
460
|
+
onPressOut: press.onPressOut,
|
|
461
|
+
children
|
|
462
|
+
}
|
|
463
|
+
) });
|
|
464
|
+
}
|
|
465
|
+
);
|
|
466
|
+
SelectTrigger.displayName = "XAUI.Select.Trigger";
|
|
467
|
+
|
|
468
|
+
// src/components/select/select-value.tsx
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
var SelectValue = _react.forwardRef.call(void 0, function SelectValue2({ placeholder, children, numberOfLines = 1, style, ...props }, ref) {
|
|
473
|
+
const { valueStyle, placeholderStyle, value, labelFor } = useSelect();
|
|
474
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
475
|
+
const label = _nullishCoalesce(children, () => ( (value !== void 0 ? labelFor(value) : void 0)));
|
|
476
|
+
const isEmpty = label === void 0 || label === "";
|
|
477
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
478
|
+
_reactnative.Text,
|
|
479
|
+
{
|
|
480
|
+
ref,
|
|
481
|
+
numberOfLines,
|
|
482
|
+
...rest,
|
|
483
|
+
style: [valueStyle, isEmpty && placeholderStyle, styleProps, style],
|
|
484
|
+
children: isEmpty ? placeholder : label
|
|
485
|
+
}
|
|
486
|
+
);
|
|
487
|
+
});
|
|
488
|
+
SelectValue.displayName = "XAUI.Select.Value";
|
|
489
|
+
|
|
490
|
+
// src/components/select/select.tsx
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
// src/components/select/select.hook.ts
|
|
495
|
+
|
|
496
|
+
function useLabelRegistry() {
|
|
497
|
+
const labels = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
|
|
498
|
+
const [, force] = _react.useState.call(void 0, 0);
|
|
499
|
+
const registerLabel = _react.useCallback.call(void 0, (value, label) => {
|
|
500
|
+
if (labels.current.get(value) === label) return;
|
|
501
|
+
labels.current.set(value, label);
|
|
502
|
+
force((n) => n + 1);
|
|
503
|
+
}, []);
|
|
504
|
+
const labelFor = _react.useCallback.call(void 0, (value) => labels.current.get(value), []);
|
|
505
|
+
return _react.useMemo.call(void 0, () => ({ labelFor, registerLabel }), [labelFor, registerLabel]);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// src/components/select/select.recipe.ts
|
|
509
|
+
var SLOTS = [
|
|
510
|
+
"trigger",
|
|
511
|
+
"value",
|
|
512
|
+
"placeholder",
|
|
513
|
+
"indicator",
|
|
514
|
+
"overlay",
|
|
515
|
+
"content",
|
|
516
|
+
"label",
|
|
517
|
+
"item",
|
|
518
|
+
"itemLabel",
|
|
519
|
+
"itemDescription",
|
|
520
|
+
"itemIndicator"
|
|
521
|
+
];
|
|
522
|
+
var VARIANT_TOKENS = {
|
|
523
|
+
primary: {
|
|
524
|
+
bg: "fieldBackground",
|
|
525
|
+
border: "fieldBorder",
|
|
526
|
+
borderFocus: "fieldBorderFocus",
|
|
527
|
+
fg: "fieldForeground"
|
|
528
|
+
},
|
|
529
|
+
secondary: {
|
|
530
|
+
bg: "default",
|
|
531
|
+
border: "fieldBorder",
|
|
532
|
+
borderFocus: "fieldBorderFocus",
|
|
533
|
+
fg: "fieldForeground"
|
|
534
|
+
},
|
|
535
|
+
tertiary: {
|
|
536
|
+
border: "fieldBorder",
|
|
537
|
+
borderFocus: "fieldBorderFocus",
|
|
538
|
+
fg: "fieldForeground"
|
|
539
|
+
},
|
|
540
|
+
ghost: { borderFocus: "fieldBorderFocus", fg: "fieldForeground" }
|
|
541
|
+
};
|
|
542
|
+
var SIZES = {
|
|
543
|
+
sm: {
|
|
544
|
+
control: "sm",
|
|
545
|
+
padding: 3,
|
|
546
|
+
gap: 2.5,
|
|
547
|
+
value: "md",
|
|
548
|
+
glyph: "lg",
|
|
549
|
+
listLabel: "xs",
|
|
550
|
+
description: "xs"
|
|
551
|
+
},
|
|
552
|
+
md: {
|
|
553
|
+
control: "md",
|
|
554
|
+
padding: 3,
|
|
555
|
+
gap: 3,
|
|
556
|
+
value: "md",
|
|
557
|
+
glyph: "lg",
|
|
558
|
+
listLabel: "sm",
|
|
559
|
+
description: "sm"
|
|
560
|
+
},
|
|
561
|
+
lg: {
|
|
562
|
+
control: "lg",
|
|
563
|
+
padding: 4,
|
|
564
|
+
gap: 3,
|
|
565
|
+
value: "lg",
|
|
566
|
+
glyph: "xl",
|
|
567
|
+
listLabel: "md",
|
|
568
|
+
description: "md"
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
var LIST = {
|
|
572
|
+
/** Panel padding, and the inset the rows sit in. */
|
|
573
|
+
padding: 3,
|
|
574
|
+
itemPaddingHorizontal: 2,
|
|
575
|
+
itemPaddingVertical: 3,
|
|
576
|
+
itemGap: 2,
|
|
577
|
+
labelPaddingHorizontal: 2,
|
|
578
|
+
labelPaddingVertical: 1.5,
|
|
579
|
+
/** The check's box, in spacing steps like the rest — five of them, HeroUI's twenty. */
|
|
580
|
+
indicator: 5
|
|
581
|
+
};
|
|
582
|
+
function sizeAxis(step) {
|
|
583
|
+
const { control, padding, gap, value, glyph, listLabel, description } = step;
|
|
584
|
+
return (theme) => {
|
|
585
|
+
const valueType = {
|
|
586
|
+
fontSize: theme.fontSizes[value],
|
|
587
|
+
lineHeight: theme.lineHeights[value]
|
|
588
|
+
};
|
|
589
|
+
return {
|
|
590
|
+
trigger: {
|
|
591
|
+
// Fixed, not a minimum: a control has a height, and a label too long for it
|
|
592
|
+
// truncates rather than deforming the field it shares a row with.
|
|
593
|
+
height: theme.controlHeights[control],
|
|
594
|
+
paddingHorizontal: theme.spacing(padding),
|
|
595
|
+
gap: theme.spacing(gap)
|
|
596
|
+
},
|
|
597
|
+
value: valueType,
|
|
598
|
+
placeholder: valueType,
|
|
599
|
+
indicator: { fontSize: theme.fontSizes[glyph] },
|
|
600
|
+
label: {
|
|
601
|
+
fontSize: theme.fontSizes[listLabel],
|
|
602
|
+
lineHeight: theme.lineHeights[listLabel]
|
|
603
|
+
},
|
|
604
|
+
itemLabel: valueType,
|
|
605
|
+
itemDescription: {
|
|
606
|
+
fontSize: theme.fontSizes[description],
|
|
607
|
+
lineHeight: theme.lineHeights[description]
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
var selectRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
|
|
613
|
+
slots: SLOTS,
|
|
614
|
+
base: (theme) => ({
|
|
615
|
+
trigger: {
|
|
616
|
+
flexDirection: "row",
|
|
617
|
+
alignItems: "center",
|
|
618
|
+
justifyContent: "space-between",
|
|
619
|
+
borderWidth: theme.borderWidth.field,
|
|
620
|
+
borderRadius: theme.radius.field,
|
|
621
|
+
borderCurve: "continuous"
|
|
622
|
+
},
|
|
623
|
+
value: {
|
|
624
|
+
fontFamily: theme.fontFamilies.body,
|
|
625
|
+
// `regular`, as on the field: a chosen value is content, not the control's label.
|
|
626
|
+
fontWeight: theme.fontWeights.regular,
|
|
627
|
+
// Without it a long value pushes the chevron off the end of the trigger instead of
|
|
628
|
+
// truncating, because a row gives a text node its intrinsic width by default.
|
|
629
|
+
flexShrink: 1
|
|
630
|
+
},
|
|
631
|
+
placeholder: { color: theme.colors.fieldPlaceholder },
|
|
632
|
+
indicator: { alignItems: "center", justifyContent: "center" },
|
|
633
|
+
overlay: { position: "absolute", top: 0, bottom: 0, start: 0, end: 0 },
|
|
634
|
+
content: {
|
|
635
|
+
position: "absolute",
|
|
636
|
+
backgroundColor: theme.colors.overlay,
|
|
637
|
+
padding: theme.spacing(LIST.padding),
|
|
638
|
+
// The panel is not the field, so it is rounder — but not by three steps of our
|
|
639
|
+
// scale. HeroUI's panel is their `--radius-3xl` on a base of 8, which is 24 points;
|
|
640
|
+
// ours is a base of 12, so the same 24 is `2xl`. Reading their key rather than
|
|
641
|
+
// their number is what put a 36-point corner on it and made it read as a pill.
|
|
642
|
+
borderRadius: theme.radius["2xl"],
|
|
643
|
+
borderCurve: "continuous",
|
|
644
|
+
...theme.shadows.overlay
|
|
645
|
+
},
|
|
646
|
+
label: {
|
|
647
|
+
fontFamily: theme.fontFamilies.body,
|
|
648
|
+
fontWeight: theme.fontWeights.medium,
|
|
649
|
+
color: theme.colors.muted,
|
|
650
|
+
paddingHorizontal: theme.spacing(LIST.labelPaddingHorizontal),
|
|
651
|
+
paddingVertical: theme.spacing(LIST.labelPaddingVertical)
|
|
652
|
+
},
|
|
653
|
+
item: {
|
|
654
|
+
flexDirection: "row",
|
|
655
|
+
alignItems: "center",
|
|
656
|
+
justifyContent: "space-between",
|
|
657
|
+
gap: theme.spacing(LIST.itemGap),
|
|
658
|
+
paddingHorizontal: theme.spacing(LIST.itemPaddingHorizontal),
|
|
659
|
+
paddingVertical: theme.spacing(LIST.itemPaddingVertical),
|
|
660
|
+
borderRadius: theme.radius.md,
|
|
661
|
+
borderCurve: "continuous"
|
|
662
|
+
},
|
|
663
|
+
itemLabel: {
|
|
664
|
+
fontFamily: theme.fontFamilies.body,
|
|
665
|
+
// `medium`, unlike the trigger's value: a row in a list is a target being offered,
|
|
666
|
+
// and the weight is what separates it from the description under it.
|
|
667
|
+
fontWeight: theme.fontWeights.medium,
|
|
668
|
+
color: theme.colors.overlayForeground,
|
|
669
|
+
flexShrink: 1
|
|
670
|
+
},
|
|
671
|
+
itemDescription: {
|
|
672
|
+
fontFamily: theme.fontFamilies.body,
|
|
673
|
+
color: theme.colors.muted
|
|
674
|
+
},
|
|
675
|
+
itemIndicator: {
|
|
676
|
+
width: theme.spacing(LIST.indicator),
|
|
677
|
+
height: theme.spacing(LIST.indicator),
|
|
678
|
+
alignItems: "center",
|
|
679
|
+
justifyContent: "center"
|
|
680
|
+
}
|
|
681
|
+
}),
|
|
682
|
+
variantTokens: VARIANT_TOKENS,
|
|
683
|
+
/**
|
|
684
|
+
* The variant paints the **trigger only**. The list is a floating surface of the
|
|
685
|
+
* theme's own — a `ghost` select does not open a ghost panel, it opens the same panel
|
|
686
|
+
* every other select opens, because the panel is not part of the control's emphasis.
|
|
687
|
+
*/
|
|
688
|
+
paint: (theme, colors) => ({
|
|
689
|
+
trigger: {
|
|
690
|
+
backgroundColor: colors.bg,
|
|
691
|
+
borderColor: colors.border,
|
|
692
|
+
borderWidth: colors.border ? theme.borderWidth.field : 0
|
|
693
|
+
},
|
|
694
|
+
value: { color: colors.fg },
|
|
695
|
+
indicator: { color: theme.colors.fieldPlaceholder }
|
|
696
|
+
}),
|
|
697
|
+
variants: {
|
|
698
|
+
size: {
|
|
699
|
+
sm: sizeAxis(SIZES.sm),
|
|
700
|
+
md: sizeAxis(SIZES.md),
|
|
701
|
+
lg: sizeAxis(SIZES.lg)
|
|
702
|
+
},
|
|
703
|
+
radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "trigger"),
|
|
704
|
+
/**
|
|
705
|
+
* Open is not `focused`: the field's focus border is what a keyboard gives a text
|
|
706
|
+
* input, and a select that is open has no caret in it. It borrows the same token
|
|
707
|
+
* because the two mean the same thing to the eye — this control is the live one.
|
|
708
|
+
*/
|
|
709
|
+
isOpen: {
|
|
710
|
+
true: (theme) => ({
|
|
711
|
+
trigger: { borderColor: theme.colors.fieldBorderFocus }
|
|
712
|
+
})
|
|
713
|
+
},
|
|
714
|
+
isInvalid: {
|
|
715
|
+
true: (theme) => ({ trigger: { borderColor: theme.colors.danger } })
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
states: {
|
|
719
|
+
pressed: (theme) => ({
|
|
720
|
+
trigger: { backgroundColor: theme.colors.fieldPressed },
|
|
721
|
+
item: { backgroundColor: theme.colors.defaultSoftPressed }
|
|
722
|
+
}),
|
|
723
|
+
disabled: (theme) => ({ trigger: { opacity: theme.opacity.disabled } })
|
|
724
|
+
},
|
|
725
|
+
defaultVariants: { variant: "primary", size: "md" }
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
// src/components/select/select.tsx
|
|
729
|
+
|
|
730
|
+
function Select({
|
|
731
|
+
children,
|
|
732
|
+
variant,
|
|
733
|
+
size,
|
|
734
|
+
radius,
|
|
735
|
+
color,
|
|
736
|
+
value: controlledValue,
|
|
737
|
+
defaultValue,
|
|
738
|
+
onValueChange,
|
|
739
|
+
isOpen: controlledOpen,
|
|
740
|
+
defaultOpen = false,
|
|
741
|
+
onOpenChange,
|
|
742
|
+
isDisabled = false,
|
|
743
|
+
isInvalid = false
|
|
744
|
+
}) {
|
|
745
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
746
|
+
const { labelFor, registerLabel } = useLabelRegistry();
|
|
747
|
+
const [anchor, setAnchor] = _react.useState.call(void 0, null);
|
|
748
|
+
const [value, setValue] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
749
|
+
value: controlledValue,
|
|
750
|
+
defaultValue,
|
|
751
|
+
onChange: onValueChange
|
|
752
|
+
});
|
|
753
|
+
const [isOpen, setOpen] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
754
|
+
value: controlledOpen,
|
|
755
|
+
defaultValue: defaultOpen,
|
|
756
|
+
onChange: onOpenChange
|
|
757
|
+
});
|
|
758
|
+
const selection = {
|
|
759
|
+
variant,
|
|
760
|
+
size,
|
|
761
|
+
radius,
|
|
762
|
+
isOpen: isOpen ? "true" : void 0,
|
|
763
|
+
isInvalid: isInvalid ? "true" : void 0
|
|
764
|
+
};
|
|
765
|
+
const styles = selectRecipe.resolve({
|
|
766
|
+
theme,
|
|
767
|
+
selection,
|
|
768
|
+
states: { disabled: isDisabled }
|
|
769
|
+
});
|
|
770
|
+
const pressed = selectRecipe.resolve({
|
|
771
|
+
theme,
|
|
772
|
+
selection,
|
|
773
|
+
states: { pressed: true }
|
|
774
|
+
});
|
|
775
|
+
const tint = color ? selectRecipe.tint({ theme, color, selection }) : void 0;
|
|
776
|
+
const open = _react.useCallback.call(void 0, () => setOpen(true), [setOpen]);
|
|
777
|
+
const close = _react.useCallback.call(void 0, () => setOpen(false), [setOpen]);
|
|
778
|
+
const toggle = _react.useCallback.call(void 0, () => setOpen(!isOpen), [isOpen, setOpen]);
|
|
779
|
+
const select = _react.useCallback.call(void 0,
|
|
780
|
+
(next, label) => {
|
|
781
|
+
if (label !== void 0) registerLabel(next, label);
|
|
782
|
+
setValue(next);
|
|
783
|
+
setOpen(false);
|
|
784
|
+
},
|
|
785
|
+
[registerLabel, setValue, setOpen]
|
|
786
|
+
);
|
|
787
|
+
const context = _react.useMemo.call(void 0, () => {
|
|
788
|
+
const indicator = _reactnative.StyleSheet.flatten([
|
|
789
|
+
styles.indicator,
|
|
790
|
+
_optionalChain([tint, 'optionalAccess', _8 => _8.indicator])
|
|
791
|
+
]);
|
|
792
|
+
const itemLabel = _reactnative.StyleSheet.flatten([styles.itemLabel]);
|
|
793
|
+
const tintedPlaceholder = tint ? _reactnative.StyleSheet.flatten([tint.value]).color : void 0;
|
|
794
|
+
return {
|
|
795
|
+
triggerStyle: tint ? [styles.trigger, tint.trigger] : styles.trigger,
|
|
796
|
+
triggerPressedStyle: pressed.trigger,
|
|
797
|
+
valueStyle: tint ? [styles.value, tint.value] : styles.value,
|
|
798
|
+
placeholderStyle: tintedPlaceholder ? [styles.placeholder, { color: tintedPlaceholder }] : styles.placeholder,
|
|
799
|
+
indicatorStyle: styles.indicator,
|
|
800
|
+
overlayStyle: styles.overlay,
|
|
801
|
+
contentStyle: styles.content,
|
|
802
|
+
labelStyle: styles.label,
|
|
803
|
+
itemStyle: styles.item,
|
|
804
|
+
itemPressedStyle: pressed.item,
|
|
805
|
+
itemLabelStyle: styles.itemLabel,
|
|
806
|
+
itemDescriptionStyle: styles.itemDescription,
|
|
807
|
+
itemIndicatorStyle: styles.itemIndicator,
|
|
808
|
+
glyph: {
|
|
809
|
+
size: indicator.fontSize,
|
|
810
|
+
// `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
|
|
811
|
+
// hand to a third-party component expecting a string.
|
|
812
|
+
color: typeof indicator.color === "string" ? indicator.color : void 0
|
|
813
|
+
},
|
|
814
|
+
// The check reads the row's own colour rather than the chevron's: it belongs to the
|
|
815
|
+
// list, and the chevron belongs to the field.
|
|
816
|
+
checkColor: typeof itemLabel.color === "string" ? itemLabel.color : void 0,
|
|
817
|
+
value,
|
|
818
|
+
isOpen,
|
|
819
|
+
isDisabled,
|
|
820
|
+
isInvalid,
|
|
821
|
+
open,
|
|
822
|
+
close,
|
|
823
|
+
toggle,
|
|
824
|
+
select,
|
|
825
|
+
anchor,
|
|
826
|
+
setAnchor,
|
|
827
|
+
labelFor,
|
|
828
|
+
registerLabel
|
|
829
|
+
};
|
|
830
|
+
}, [
|
|
831
|
+
styles,
|
|
832
|
+
pressed,
|
|
833
|
+
tint,
|
|
834
|
+
value,
|
|
835
|
+
isOpen,
|
|
836
|
+
isDisabled,
|
|
837
|
+
isInvalid,
|
|
838
|
+
open,
|
|
839
|
+
close,
|
|
840
|
+
toggle,
|
|
841
|
+
select,
|
|
842
|
+
anchor,
|
|
843
|
+
labelFor,
|
|
844
|
+
registerLabel
|
|
845
|
+
]);
|
|
846
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectProvider, { value: context, children });
|
|
847
|
+
}
|
|
848
|
+
Select.displayName = "XAUI.Select.Root";
|
|
849
|
+
|
|
850
|
+
// src/components/select/index.ts
|
|
851
|
+
var Select2 = Object.assign(Select, {
|
|
852
|
+
Trigger: SelectTrigger,
|
|
853
|
+
Value: SelectValue,
|
|
854
|
+
Indicator: SelectIndicator,
|
|
855
|
+
Overlay: SelectOverlay,
|
|
856
|
+
Content: SelectContent,
|
|
857
|
+
Label: SelectLabel,
|
|
858
|
+
Item: SelectItem,
|
|
859
|
+
ItemLabel: SelectItemLabel,
|
|
860
|
+
ItemDescription: SelectItemDescription,
|
|
861
|
+
ItemIndicator: SelectItemIndicator
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
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;
|