@xaui/native 0.9.1-alpha.26 → 0.9.1-alpha.27
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-2EBB5BO3.cjs +361 -0
- package/dist/{chunk-PQHC65AG.js → chunk-56KVKM27.js} +15 -15
- package/dist/{chunk-BULNTP5N.cjs → chunk-63TWVWHG.cjs} +9 -45
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/{chunk-WVCAFORA.cjs → chunk-CQRUNV6S.cjs} +15 -15
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-LGVIZAB2.js +503 -0
- package/dist/{chunk-I6UCYAO2.js → chunk-N4UJYDOW.js} +23 -56
- package/dist/components/alert/index.cjs +1 -1
- package/dist/components/alert/index.d.cts +1 -1
- package/dist/components/alert/index.d.ts +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/button/index.cjs +3 -3
- package/dist/components/button/index.d.cts +1 -1
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/button/index.js +2 -2
- package/dist/components/card/index.d.cts +1 -1
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/checkbox/index.cjs +23 -0
- package/dist/components/checkbox/index.d.cts +1137 -0
- package/dist/components/checkbox/index.d.ts +1137 -0
- package/dist/components/checkbox/index.js +23 -0
- package/dist/components/chip/index.cjs +3 -3
- package/dist/components/chip/index.d.cts +1 -1
- package/dist/components/chip/index.d.ts +1 -1
- package/dist/components/chip/index.js +2 -2
- package/dist/components/input/index.d.cts +3 -3
- package/dist/components/input/index.d.ts +3 -3
- package/dist/components/input-otp/index.cjs +3 -2
- package/dist/components/input-otp/index.d.cts +3 -3
- package/dist/components/input-otp/index.d.ts +3 -3
- package/dist/components/input-otp/index.js +2 -1
- package/dist/components/typography/index.d.cts +1 -1
- package/dist/components/typography/index.d.ts +1 -1
- package/dist/{create-recipe-dBN_ewZc.d.cts → create-recipe-CWvI5ot3.d.cts} +8 -1
- package/dist/{create-recipe-C4JkINrA.d.ts → create-recipe-DUo8doTt.d.ts} +8 -1
- package/dist/index.cjs +28 -12
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +31 -15
- package/dist/system/index.cjs +1 -1
- package/dist/system/index.d.cts +2 -2
- package/dist/system/index.d.ts +2 -2
- package/dist/system/index.js +1 -1
- package/package.json +11 -1
- package/dist/{chunk-3WISQT22.js → chunk-EHARM2EN.js} +3 -3
- package/dist/{chunk-I7G77Q65.cjs → chunk-H7DVR52Z.cjs} +2 -2
|
@@ -0,0 +1,361 @@
|
|
|
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 _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkIG4Q3WQOcjs = require('./chunk-IG4Q3WQO.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkYXVKQMCKcjs = require('./chunk-YXVKQMCK.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
20
|
+
|
|
21
|
+
// src/components/checkbox/checkbox-indicator.tsx
|
|
22
|
+
var _react = require('react');
|
|
23
|
+
var _reactnative = require('react-native');
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
29
|
+
|
|
30
|
+
// src/components/checkbox/checkbox.context.ts
|
|
31
|
+
var [CheckboxProvider, useCheckbox] = _chunkHUZ4AUM2cjs.createSlotContext.call(void 0, "Checkbox");
|
|
32
|
+
|
|
33
|
+
// src/components/checkbox/checkbox-indicator.tsx
|
|
34
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
35
|
+
var DURATION = 120;
|
|
36
|
+
var FROM_SCALE = 0.8;
|
|
37
|
+
var CheckboxIndicator = _react.forwardRef.call(void 0,
|
|
38
|
+
function CheckboxIndicator2({ children, animation = true, style, ...props }, ref) {
|
|
39
|
+
const { indicatorStyle, isSelected, isIndeterminate } = useCheckbox();
|
|
40
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
41
|
+
const isFilled = isSelected || isIndeterminate;
|
|
42
|
+
const mark = _nullishCoalesce(children, () => ( (isIndeterminate ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dash, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, {}))));
|
|
43
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, ...rest, style: [indicatorStyle, styleProps, style], children: animation ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AnimatedFill, { isSelected: isFilled, children: mark }) : isFilled && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StaticFill, { children: mark }) });
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
CheckboxIndicator.displayName = "XAUI.Checkbox.Indicator";
|
|
47
|
+
function AnimatedFill({
|
|
48
|
+
isSelected,
|
|
49
|
+
children
|
|
50
|
+
}) {
|
|
51
|
+
const { fillStyle } = useCheckbox();
|
|
52
|
+
const progress = _reactnativereanimated.useDerivedValue.call(void 0,
|
|
53
|
+
() => _reactnativereanimated.withTiming.call(void 0, isSelected ? 1 : 0, { duration: DURATION }),
|
|
54
|
+
[isSelected]
|
|
55
|
+
);
|
|
56
|
+
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
|
|
57
|
+
opacity: progress.value,
|
|
58
|
+
transform: [{ scale: FROM_SCALE + (1 - FROM_SCALE) * progress.value }]
|
|
59
|
+
}));
|
|
60
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { style: [fillStyle, animatedStyle], children });
|
|
61
|
+
}
|
|
62
|
+
function StaticFill({ children }) {
|
|
63
|
+
const { fillStyle } = useCheckbox();
|
|
64
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: fillStyle, children });
|
|
65
|
+
}
|
|
66
|
+
function Check() {
|
|
67
|
+
const { checkStyle } = useCheckbox();
|
|
68
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: checkStyle });
|
|
69
|
+
}
|
|
70
|
+
function Dash() {
|
|
71
|
+
const { dashStyle } = useCheckbox();
|
|
72
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: dashStyle });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/components/checkbox/checkbox-label.tsx
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
var CheckboxLabel = _react.forwardRef.call(void 0,
|
|
80
|
+
function CheckboxLabel2({ children, style, ...props }, ref) {
|
|
81
|
+
const { labelStyle } = useCheckbox();
|
|
82
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
83
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, style: [labelStyle, styleProps, style], ...rest, children });
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
CheckboxLabel.displayName = "XAUI.Checkbox.Label";
|
|
87
|
+
|
|
88
|
+
// src/components/checkbox/checkbox.tsx
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
// src/components/checkbox/checkbox.recipe.ts
|
|
92
|
+
var SLOTS = ["root", "indicator", "fill", "check", "dash", "label"];
|
|
93
|
+
var VARIANT_TOKENS = {
|
|
94
|
+
primary: {
|
|
95
|
+
bg: "fieldBackground",
|
|
96
|
+
border: "fieldBorder",
|
|
97
|
+
bgSelected: "accent",
|
|
98
|
+
fgSelected: "accentForeground"
|
|
99
|
+
},
|
|
100
|
+
// `bg: 'default'` is the neutral *token*, not this variant's name — the two namespaces
|
|
101
|
+
// meet here as they do on the `Input`, and for the same reason: on a card,
|
|
102
|
+
// `fieldBackground` is the card's own colour and the box would vanish into it.
|
|
103
|
+
secondary: {
|
|
104
|
+
bg: "default",
|
|
105
|
+
border: "fieldBorder",
|
|
106
|
+
bgSelected: "accent",
|
|
107
|
+
fgSelected: "accentForeground"
|
|
108
|
+
},
|
|
109
|
+
tertiary: {
|
|
110
|
+
border: "fieldBorder",
|
|
111
|
+
bgSelected: "accent",
|
|
112
|
+
fgSelected: "accentForeground"
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
function sizeAxis(step) {
|
|
116
|
+
const { box, radius, label, gap, stroke } = step;
|
|
117
|
+
return (theme) => {
|
|
118
|
+
const side = theme.spacing(box);
|
|
119
|
+
return {
|
|
120
|
+
root: { gap: theme.spacing(gap) },
|
|
121
|
+
indicator: { width: side, height: side, borderRadius: theme.radius[radius] },
|
|
122
|
+
check: {
|
|
123
|
+
width: side * CHECK_WIDTH,
|
|
124
|
+
height: side * CHECK_HEIGHT,
|
|
125
|
+
borderStartWidth: stroke,
|
|
126
|
+
borderBottomWidth: stroke,
|
|
127
|
+
// An "L" has its ink in one corner, not in the middle of its box, so rotating it
|
|
128
|
+
// about that box's centre leaves the tick sitting low. Rotating by −45° maps a
|
|
129
|
+
// point to `(dy − dx)·√2/2`, and over the two strokes that spans `H` at the top
|
|
130
|
+
// and `H − t − W` at the bottom — an ink centre `(H − t)·√2/4` **below** the box
|
|
131
|
+
// centre, which flexbox then dutifully centres. Lifting by exactly that is what
|
|
132
|
+
// makes the mark look centred rather than measure centred.
|
|
133
|
+
//
|
|
134
|
+
// Both transforms live here, and not half here and half in a sheet, because
|
|
135
|
+
// `transform` is a whole value: the recipe's merge replaces it rather than
|
|
136
|
+
// blending, so a second step would drop the first.
|
|
137
|
+
transform: [
|
|
138
|
+
{ translateY: -((side * CHECK_HEIGHT - stroke) * Math.SQRT2) / 4 },
|
|
139
|
+
{ rotate: "-45deg" }
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
// The third state's mark: the check's long stroke, on its own and level.
|
|
143
|
+
dash: {
|
|
144
|
+
width: side * CHECK_WIDTH,
|
|
145
|
+
height: stroke,
|
|
146
|
+
borderRadius: stroke / 2
|
|
147
|
+
},
|
|
148
|
+
label: {
|
|
149
|
+
fontSize: theme.fontSizes[label],
|
|
150
|
+
lineHeight: theme.lineHeights[label]
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
var CHECK_WIDTH = 0.5;
|
|
156
|
+
var CHECK_HEIGHT = 0.25;
|
|
157
|
+
var SIZES = {
|
|
158
|
+
sm: { box: 5, radius: "sm", gap: 2, label: "sm", stroke: 2 },
|
|
159
|
+
md: { box: 6, radius: "md", gap: 2, label: "md", stroke: 2 },
|
|
160
|
+
lg: { box: 7, radius: "md", gap: 2.5, label: "lg", stroke: 2.5 }
|
|
161
|
+
};
|
|
162
|
+
var checkboxRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
|
|
163
|
+
slots: SLOTS,
|
|
164
|
+
base: (theme) => ({
|
|
165
|
+
root: { flexDirection: "row", alignItems: "center", alignSelf: "flex-start" },
|
|
166
|
+
indicator: {
|
|
167
|
+
alignItems: "center",
|
|
168
|
+
justifyContent: "center",
|
|
169
|
+
borderWidth: theme.borderWidth.field,
|
|
170
|
+
borderCurve: "continuous",
|
|
171
|
+
// The fill is laid inside the box and has to stop at its corners.
|
|
172
|
+
overflow: "hidden"
|
|
173
|
+
},
|
|
174
|
+
// Laid over the box rather than sized to it: the two corners are the indicator's, and
|
|
175
|
+
// an inset of zero is what keeps the fill inside the border it is clipped by.
|
|
176
|
+
fill: {
|
|
177
|
+
position: "absolute",
|
|
178
|
+
top: 0,
|
|
179
|
+
bottom: 0,
|
|
180
|
+
start: 0,
|
|
181
|
+
end: 0,
|
|
182
|
+
alignItems: "center",
|
|
183
|
+
justifyContent: "center"
|
|
184
|
+
},
|
|
185
|
+
label: {
|
|
186
|
+
fontFamily: theme.fontFamilies.body,
|
|
187
|
+
color: theme.colors.foreground
|
|
188
|
+
}
|
|
189
|
+
}),
|
|
190
|
+
variantTokens: VARIANT_TOKENS,
|
|
191
|
+
/**
|
|
192
|
+
* Where the variant's colours land. The border width follows the *presence* of the
|
|
193
|
+
* border role, exactly as on the `Input`.
|
|
194
|
+
*
|
|
195
|
+
* `bgSelected` and `fgSelected` are painted unconditionally, on two slots the indicator
|
|
196
|
+
* only mounts while it is ticked — which is what keeps selection out of the cache key
|
|
197
|
+
* and inside the tint pass at the same time. An axis would have given up the second.
|
|
198
|
+
*/
|
|
199
|
+
paint: (theme, colors) => ({
|
|
200
|
+
indicator: {
|
|
201
|
+
backgroundColor: colors.bg,
|
|
202
|
+
borderColor: colors.border,
|
|
203
|
+
borderWidth: colors.border ? theme.borderWidth.field : 0
|
|
204
|
+
},
|
|
205
|
+
fill: { backgroundColor: colors.bgSelected },
|
|
206
|
+
check: { borderColor: colors.fgSelected },
|
|
207
|
+
dash: { backgroundColor: colors.fgSelected }
|
|
208
|
+
}),
|
|
209
|
+
variants: {
|
|
210
|
+
size: {
|
|
211
|
+
sm: sizeAxis(SIZES.sm),
|
|
212
|
+
md: sizeAxis(SIZES.md),
|
|
213
|
+
lg: sizeAxis(SIZES.lg)
|
|
214
|
+
},
|
|
215
|
+
radius: _chunkYXVKQMCKcjs.radiusAxis.call(void 0, "indicator"),
|
|
216
|
+
/**
|
|
217
|
+
* Declared after `size` so its border wins. The resting fill is dropped rather than
|
|
218
|
+
* repainted — `undefined` over a colour is what RN reads as "no background" — because
|
|
219
|
+
* a box that is wrong should read as an outline, not as a filled control that happens
|
|
220
|
+
* to be red at the edge. HeroUI reaches the same shape with a compound.
|
|
221
|
+
*/
|
|
222
|
+
isInvalid: {
|
|
223
|
+
true: (theme) => ({
|
|
224
|
+
indicator: { borderColor: theme.colors.danger, backgroundColor: void 0 },
|
|
225
|
+
fill: { backgroundColor: theme.colors.danger },
|
|
226
|
+
check: { borderColor: theme.colors.dangerForeground },
|
|
227
|
+
dash: { backgroundColor: theme.colors.dangerForeground },
|
|
228
|
+
// The label turns with it: on a long form the field that is wrong has to be
|
|
229
|
+
// findable without reading every message.
|
|
230
|
+
label: { color: theme.colors.danger }
|
|
231
|
+
})
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
/** What `primary` adds to a filled box — the `Input`'s compound, on a smaller field. */
|
|
235
|
+
compoundVariants: [
|
|
236
|
+
{
|
|
237
|
+
when: { variant: "primary" },
|
|
238
|
+
style: (theme) => ({ indicator: theme.shadows.field })
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
states: {
|
|
242
|
+
disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
|
|
243
|
+
},
|
|
244
|
+
defaultVariants: { variant: "secondary", size: "md" }
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
// src/components/checkbox/checkbox.tsx
|
|
248
|
+
|
|
249
|
+
var CheckboxRoot = _react.forwardRef.call(void 0, function Checkbox({
|
|
250
|
+
children,
|
|
251
|
+
variant,
|
|
252
|
+
size,
|
|
253
|
+
radius,
|
|
254
|
+
color,
|
|
255
|
+
isSelected,
|
|
256
|
+
defaultSelected = false,
|
|
257
|
+
onSelectedChange,
|
|
258
|
+
isIndeterminate = false,
|
|
259
|
+
isInvalid = false,
|
|
260
|
+
isDisabled = false,
|
|
261
|
+
asChild = false,
|
|
262
|
+
accessibilityRole,
|
|
263
|
+
accessibilityState,
|
|
264
|
+
animation,
|
|
265
|
+
style,
|
|
266
|
+
onPress,
|
|
267
|
+
onPressIn,
|
|
268
|
+
onPressOut,
|
|
269
|
+
...props
|
|
270
|
+
}, ref) {
|
|
271
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
272
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
273
|
+
const [isPressed, press] = _chunkIG4Q3WQOcjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
274
|
+
const [selected, setSelected] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
275
|
+
value: isSelected,
|
|
276
|
+
defaultValue: defaultSelected,
|
|
277
|
+
onChange: onSelectedChange
|
|
278
|
+
});
|
|
279
|
+
const handlePress = _react.useCallback.call(void 0,
|
|
280
|
+
(event) => {
|
|
281
|
+
setSelected((current) => isIndeterminate ? true : !current);
|
|
282
|
+
_optionalChain([onPress, 'optionalCall', _ => _(event)]);
|
|
283
|
+
},
|
|
284
|
+
[setSelected, isIndeterminate, onPress]
|
|
285
|
+
);
|
|
286
|
+
const selection = {
|
|
287
|
+
variant,
|
|
288
|
+
size,
|
|
289
|
+
radius,
|
|
290
|
+
isInvalid: isInvalid ? "true" : void 0
|
|
291
|
+
};
|
|
292
|
+
const states = { pressed: isPressed, disabled: isDisabled };
|
|
293
|
+
const styles = checkboxRecipe.resolve({ theme, selection, states });
|
|
294
|
+
const tint = color && !isInvalid ? checkboxRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
295
|
+
const context = _react.useMemo.call(void 0,
|
|
296
|
+
() => ({
|
|
297
|
+
indicatorStyle: tint ? [styles.indicator, tint.indicator] : styles.indicator,
|
|
298
|
+
fillStyle: tint ? [styles.fill, tint.fill] : styles.fill,
|
|
299
|
+
checkStyle: tint ? [styles.check, tint.check] : styles.check,
|
|
300
|
+
dashStyle: tint ? [styles.dash, tint.dash] : styles.dash,
|
|
301
|
+
labelStyle: styles.label,
|
|
302
|
+
isSelected: selected,
|
|
303
|
+
isIndeterminate,
|
|
304
|
+
isDisabled,
|
|
305
|
+
isInvalid
|
|
306
|
+
}),
|
|
307
|
+
[styles, tint, selected, isIndeterminate, isDisabled, isInvalid]
|
|
308
|
+
);
|
|
309
|
+
const rootStyle = [
|
|
310
|
+
styles.root,
|
|
311
|
+
_optionalChain([tint, 'optionalAccess', _2 => _2.root]),
|
|
312
|
+
styleProps,
|
|
313
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
314
|
+
];
|
|
315
|
+
const text = _chunkHUZ4AUM2cjs.childrenToString.call(void 0, children);
|
|
316
|
+
const content = text !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
317
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CheckboxIndicator, {}),
|
|
318
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CheckboxLabel, { children: text })
|
|
319
|
+
] }) : _nullishCoalesce(children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CheckboxIndicator, {})));
|
|
320
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CheckboxProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
321
|
+
_chunkIG4Q3WQOcjs.PressableFeedback,
|
|
322
|
+
{
|
|
323
|
+
ref,
|
|
324
|
+
isPressed,
|
|
325
|
+
isDisabled,
|
|
326
|
+
asChild,
|
|
327
|
+
animation,
|
|
328
|
+
accessibilityRole: _nullishCoalesce(accessibilityRole, () => ( "checkbox")),
|
|
329
|
+
accessibilityState: {
|
|
330
|
+
// `'mixed'` is the platform's own word for the third state, and it is the only
|
|
331
|
+
// thing that tells a screen reader this box speaks for rows it cannot see.
|
|
332
|
+
checked: isIndeterminate ? "mixed" : selected,
|
|
333
|
+
disabled: isDisabled,
|
|
334
|
+
...accessibilityState
|
|
335
|
+
},
|
|
336
|
+
"aria-invalid": isInvalid,
|
|
337
|
+
...rest,
|
|
338
|
+
style: rootStyle,
|
|
339
|
+
onPress: handlePress,
|
|
340
|
+
onPressIn: press.onPressIn,
|
|
341
|
+
onPressOut: press.onPressOut,
|
|
342
|
+
children: asChild ? children : content
|
|
343
|
+
}
|
|
344
|
+
) });
|
|
345
|
+
});
|
|
346
|
+
CheckboxRoot.displayName = "XAUI.Checkbox.Root";
|
|
347
|
+
|
|
348
|
+
// src/components/checkbox/index.ts
|
|
349
|
+
var Checkbox2 = Object.assign(CheckboxRoot, {
|
|
350
|
+
Indicator: CheckboxIndicator,
|
|
351
|
+
Label: CheckboxLabel
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
exports.useCheckbox = useCheckbox; exports.CheckboxIndicator = CheckboxIndicator; exports.CheckboxLabel = CheckboxLabel; exports.checkboxRecipe = checkboxRecipe; exports.CheckboxRoot = CheckboxRoot; exports.Checkbox = Checkbox2;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PressableFeedback, usePressState } from "./chunk-4HELPMAK.js";
|
|
2
|
-
import { Icon } from "./chunk-ICR42HHG.js";
|
|
3
2
|
import { warnDev } from "./chunk-EGLLDKN6.js";
|
|
3
|
+
import { Icon } from "./chunk-ICR42HHG.js";
|
|
4
4
|
import { createRecipe, radiusAxis } from "./chunk-3JATAB7S.js";
|
|
5
5
|
import { childrenToString, createSlotContext, useStyleProps } from "./chunk-PMO62QK4.js";
|
|
6
6
|
import { useXAUITheme } from "./chunk-A3EGFI6T.js";
|
|
@@ -74,10 +74,10 @@ function ButtonSpinner({
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
ButtonSpinner.displayName = "XAUI.Button.Spinner";
|
|
77
|
-
const
|
|
78
|
-
code: "function
|
|
79
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-
|
|
80
|
-
sourceMap: "{\"version\":3,\"names\":[\"
|
|
77
|
+
const _worklet_633469242714_init_data = {
|
|
78
|
+
code: "function chunk56KVKM27Js1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
|
|
79
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-56KVKM27.js",
|
|
80
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunk56KVKM27Js1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-56KVKM27.js\"],\"mappings\":\"AAqFyC,SAAAA,gBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE3C,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
|
|
81
81
|
};
|
|
82
82
|
function SpinningRing({
|
|
83
83
|
style
|
|
@@ -90,28 +90,28 @@ function SpinningRing({
|
|
|
90
90
|
}), -1, false);
|
|
91
91
|
return () => cancelAnimation(angle);
|
|
92
92
|
}, [angle]);
|
|
93
|
-
const animatedStyle = useAnimatedStyle(function
|
|
94
|
-
|
|
93
|
+
const animatedStyle = useAnimatedStyle(function chunk56KVKM27Js1Factory({
|
|
94
|
+
_worklet_633469242714_init_data,
|
|
95
95
|
angle
|
|
96
96
|
}) {
|
|
97
97
|
const _e = [new global.Error(), -2, -27];
|
|
98
|
-
const
|
|
98
|
+
const chunk56KVKM27Js1 = function () {
|
|
99
99
|
return {
|
|
100
100
|
transform: [{
|
|
101
101
|
rotate: `${angle.value}deg`
|
|
102
102
|
}]
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
|
-
|
|
105
|
+
chunk56KVKM27Js1.__closure = {
|
|
106
106
|
angle
|
|
107
107
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return
|
|
108
|
+
chunk56KVKM27Js1.__workletHash = 633469242714;
|
|
109
|
+
chunk56KVKM27Js1.__pluginVersion = "0.7.4";
|
|
110
|
+
chunk56KVKM27Js1.__initData = _worklet_633469242714_init_data;
|
|
111
|
+
chunk56KVKM27Js1.__stackDetails = _e;
|
|
112
|
+
return chunk56KVKM27Js1;
|
|
113
113
|
}({
|
|
114
|
-
|
|
114
|
+
_worklet_633469242714_init_data,
|
|
115
115
|
angle
|
|
116
116
|
}), [angle]);
|
|
117
117
|
return /* @__PURE__ */jsx3(Animated.View, {
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
3
|
+
var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -179,41 +179,6 @@ InputOTPSeparator.displayName = "XAUI.InputOTP.Separator";
|
|
|
179
179
|
// src/components/input-otp/input-otp.hook.ts
|
|
180
180
|
|
|
181
181
|
|
|
182
|
-
// src/hooks/use-controllable-state.ts
|
|
183
|
-
|
|
184
|
-
function useControllableState({
|
|
185
|
-
value,
|
|
186
|
-
defaultValue,
|
|
187
|
-
onChange
|
|
188
|
-
}) {
|
|
189
|
-
const [uncontrolled, setUncontrolled] = _react.useState.call(void 0, defaultValue);
|
|
190
|
-
const isControlled = value !== void 0;
|
|
191
|
-
const current = isControlled ? value : uncontrolled;
|
|
192
|
-
useControlWarning(isControlled);
|
|
193
|
-
const latest = _react.useRef.call(void 0, current);
|
|
194
|
-
latest.current = current;
|
|
195
|
-
const onChangeRef = _react.useRef.call(void 0, onChange);
|
|
196
|
-
onChangeRef.current = onChange;
|
|
197
|
-
const controlled = _react.useRef.call(void 0, isControlled);
|
|
198
|
-
controlled.current = isControlled;
|
|
199
|
-
const set = _react.useCallback.call(void 0, (next) => {
|
|
200
|
-
const resolved = typeof next === "function" ? next(latest.current) : next;
|
|
201
|
-
if (resolved === latest.current) return;
|
|
202
|
-
if (!controlled.current) setUncontrolled(resolved);
|
|
203
|
-
_optionalChain([onChangeRef, 'access', _6 => _6.current, 'optionalCall', _7 => _7(resolved)]);
|
|
204
|
-
}, []);
|
|
205
|
-
return [current, set];
|
|
206
|
-
}
|
|
207
|
-
function useControlWarning(isControlled) {
|
|
208
|
-
const wasControlled = _react.useRef.call(void 0, isControlled);
|
|
209
|
-
if (wasControlled.current !== isControlled) {
|
|
210
|
-
_chunkEJQCQPETcjs.warnDev.call(void 0,
|
|
211
|
-
`a component switched from ${wasControlled.current ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Decide for the life of the component: pass \`value\` always, or never. Passing \`undefined\` for a value you do control reads as "uncontrolled" here.`
|
|
212
|
-
);
|
|
213
|
-
wasControlled.current = isControlled;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
182
|
// src/components/input-otp/input-otp.utils.ts
|
|
218
183
|
function buildSlots({
|
|
219
184
|
value,
|
|
@@ -240,7 +205,7 @@ function placeholderFor(placeholder, index) {
|
|
|
240
205
|
}
|
|
241
206
|
function extractPastedCode(pasted, maxLength) {
|
|
242
207
|
const match = pasted.match(new RegExp(`(?<!\\d)(\\d{${maxLength}})(?!\\d)`));
|
|
243
|
-
return _nullishCoalesce(_optionalChain([match, 'optionalAccess',
|
|
208
|
+
return _nullishCoalesce(_optionalChain([match, 'optionalAccess', _6 => _6[1]]), () => ( ""));
|
|
244
209
|
}
|
|
245
210
|
function isPaste(text, previous) {
|
|
246
211
|
return text.length > previous.length + 1;
|
|
@@ -259,7 +224,7 @@ function useInputOTPState({
|
|
|
259
224
|
pattern,
|
|
260
225
|
placeholder
|
|
261
226
|
}) {
|
|
262
|
-
const [value, setValue] = useControllableState({
|
|
227
|
+
const [value, setValue] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
263
228
|
value: valueProp,
|
|
264
229
|
defaultValue,
|
|
265
230
|
onChange: onChangeTextProp
|
|
@@ -282,18 +247,18 @@ function useInputOTPState({
|
|
|
282
247
|
const next = candidate.slice(0, current.maxLength);
|
|
283
248
|
if (next.length > 0 && current.regexp && !current.regexp.test(next)) return;
|
|
284
249
|
current.setValue(next);
|
|
285
|
-
if (next.length === current.maxLength) _optionalChain([current, 'access',
|
|
250
|
+
if (next.length === current.maxLength) _optionalChain([current, 'access', _7 => _7.onComplete, 'optionalCall', _8 => _8(next)]);
|
|
286
251
|
}, []);
|
|
287
252
|
const onFocus = _react.useCallback.call(void 0, () => setIsFocused(true), []);
|
|
288
253
|
const onBlur = _react.useCallback.call(void 0, () => setIsFocused(false), []);
|
|
289
254
|
const handle = _react.useMemo.call(void 0,
|
|
290
255
|
() => ({
|
|
291
|
-
focus: () => _optionalChain([inputRef, 'access',
|
|
292
|
-
blur: () => _optionalChain([inputRef, 'access',
|
|
256
|
+
focus: () => _optionalChain([inputRef, 'access', _9 => _9.current, 'optionalAccess', _10 => _10.focus, 'call', _11 => _11()]),
|
|
257
|
+
blur: () => _optionalChain([inputRef, 'access', _12 => _12.current, 'optionalAccess', _13 => _13.blur, 'call', _14 => _14()]),
|
|
293
258
|
// Both halves: the native buffer and our value. Clearing one and not the other is
|
|
294
259
|
// how a cleared field comes back on the next keystroke.
|
|
295
260
|
clear: () => {
|
|
296
|
-
_optionalChain([inputRef, 'access',
|
|
261
|
+
_optionalChain([inputRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.clear, 'call', _17 => _17()]);
|
|
297
262
|
latest.current.setValue("");
|
|
298
263
|
}
|
|
299
264
|
}),
|
|
@@ -567,7 +532,7 @@ var InputOTPRoot = _react.forwardRef.call(void 0,
|
|
|
567
532
|
isInvalid
|
|
568
533
|
]
|
|
569
534
|
);
|
|
570
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputOTPProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: [styles.root, _optionalChain([tint, 'optionalAccess',
|
|
535
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputOTPProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: [styles.root, _optionalChain([tint, 'optionalAccess', _18 => _18.root]), styleProps, style], ...rest, children: [
|
|
571
536
|
children,
|
|
572
537
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
573
538
|
_reactnative.TextInput,
|
|
@@ -616,5 +581,4 @@ var InputOTP2 = Object.assign(InputOTPRoot, {
|
|
|
616
581
|
|
|
617
582
|
|
|
618
583
|
|
|
619
|
-
|
|
620
|
-
exports.useInputOTP = useInputOTP; exports.useInputOTPBox = useInputOTPBox; exports.useControllableState = useControllableState; exports.buildSlots = buildSlots; exports.extractPastedCode = extractPastedCode; exports.OTP_DIGITS = OTP_DIGITS; exports.OTP_LETTERS = OTP_LETTERS; exports.OTP_ALPHANUMERIC = OTP_ALPHANUMERIC; exports.inputOTPRecipe = inputOTPRecipe; exports.InputOTP = InputOTP2;
|
|
584
|
+
exports.useInputOTP = useInputOTP; exports.useInputOTPBox = useInputOTPBox; exports.buildSlots = buildSlots; exports.extractPastedCode = extractPastedCode; exports.OTP_DIGITS = OTP_DIGITS; exports.OTP_LETTERS = OTP_LETTERS; exports.OTP_ALPHANUMERIC = OTP_ALPHANUMERIC; exports.inputOTPRecipe = inputOTPRecipe; exports.InputOTP = InputOTP2;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkEJQCQPETcjs = require('./chunk-EJQCQPET.cjs');
|
|
4
|
+
|
|
5
|
+
// src/hooks/use-controllable-state.ts
|
|
6
|
+
var _react = require('react');
|
|
7
|
+
function useControllableState({
|
|
8
|
+
value,
|
|
9
|
+
defaultValue,
|
|
10
|
+
onChange
|
|
11
|
+
}) {
|
|
12
|
+
const [uncontrolled, setUncontrolled] = _react.useState.call(void 0, defaultValue);
|
|
13
|
+
const isControlled = value !== void 0;
|
|
14
|
+
const current = isControlled ? value : uncontrolled;
|
|
15
|
+
useControlWarning(isControlled);
|
|
16
|
+
const latest = _react.useRef.call(void 0, current);
|
|
17
|
+
latest.current = current;
|
|
18
|
+
const onChangeRef = _react.useRef.call(void 0, onChange);
|
|
19
|
+
onChangeRef.current = onChange;
|
|
20
|
+
const controlled = _react.useRef.call(void 0, isControlled);
|
|
21
|
+
controlled.current = isControlled;
|
|
22
|
+
const set = _react.useCallback.call(void 0, (next) => {
|
|
23
|
+
const resolved = typeof next === "function" ? next(latest.current) : next;
|
|
24
|
+
if (resolved === latest.current) return;
|
|
25
|
+
if (!controlled.current) setUncontrolled(resolved);
|
|
26
|
+
_optionalChain([onChangeRef, 'access', _ => _.current, 'optionalCall', _2 => _2(resolved)]);
|
|
27
|
+
}, []);
|
|
28
|
+
return [current, set];
|
|
29
|
+
}
|
|
30
|
+
function useControlWarning(isControlled) {
|
|
31
|
+
const wasControlled = _react.useRef.call(void 0, isControlled);
|
|
32
|
+
if (wasControlled.current !== isControlled) {
|
|
33
|
+
_chunkEJQCQPETcjs.warnDev.call(void 0,
|
|
34
|
+
`a component switched from ${wasControlled.current ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Decide for the life of the component: pass \`value\` always, or never. Passing \`undefined\` for a value you do control reads as "uncontrolled" here.`
|
|
35
|
+
);
|
|
36
|
+
wasControlled.current = isControlled;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
exports.useControllableState = useControllableState;
|
|
@@ -37,8 +37,8 @@ function _optionalChain(ops) {
|
|
|
37
37
|
return value;
|
|
38
38
|
}
|
|
39
39
|
var _chunkIG4Q3WQOcjs = require('./chunk-IG4Q3WQO.cjs');
|
|
40
|
-
var _chunkB4W2XNBPcjs = require('./chunk-B4W2XNBP.cjs');
|
|
41
40
|
var _chunkEJQCQPETcjs = require('./chunk-EJQCQPET.cjs');
|
|
41
|
+
var _chunkB4W2XNBPcjs = require('./chunk-B4W2XNBP.cjs');
|
|
42
42
|
var _chunkYXVKQMCKcjs = require('./chunk-YXVKQMCK.cjs');
|
|
43
43
|
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
44
44
|
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
@@ -110,10 +110,10 @@ function ButtonSpinner({
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
ButtonSpinner.displayName = "XAUI.Button.Spinner";
|
|
113
|
-
const
|
|
114
|
-
code: "function
|
|
115
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-
|
|
116
|
-
sourceMap: "{\"version\":3,\"names\":[\"
|
|
113
|
+
const _worklet_3366338208300_init_data = {
|
|
114
|
+
code: "function chunkCQRUNV6SCjs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
|
|
115
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-CQRUNV6S.cjs",
|
|
116
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkCQRUNV6SCjs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-CQRUNV6S.cjs\"],\"mappings\":\"AAqF6E,SAAAA,iBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE/E,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
|
|
117
117
|
};
|
|
118
118
|
function SpinningRing({
|
|
119
119
|
style
|
|
@@ -126,28 +126,28 @@ function SpinningRing({
|
|
|
126
126
|
}), -1, false);
|
|
127
127
|
return () => _reactnativereanimated.cancelAnimation.call(void 0, angle);
|
|
128
128
|
}, [angle]);
|
|
129
|
-
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function
|
|
130
|
-
|
|
129
|
+
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkCQRUNV6SCjs1Factory({
|
|
130
|
+
_worklet_3366338208300_init_data,
|
|
131
131
|
angle
|
|
132
132
|
}) {
|
|
133
133
|
const _e = [new global.Error(), -2, -27];
|
|
134
|
-
const
|
|
134
|
+
const chunkCQRUNV6SCjs1 = function () {
|
|
135
135
|
return {
|
|
136
136
|
transform: [{
|
|
137
137
|
rotate: `${angle.value}deg`
|
|
138
138
|
}]
|
|
139
139
|
};
|
|
140
140
|
};
|
|
141
|
-
|
|
141
|
+
chunkCQRUNV6SCjs1.__closure = {
|
|
142
142
|
angle
|
|
143
143
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return
|
|
144
|
+
chunkCQRUNV6SCjs1.__workletHash = 3366338208300;
|
|
145
|
+
chunkCQRUNV6SCjs1.__pluginVersion = "0.7.4";
|
|
146
|
+
chunkCQRUNV6SCjs1.__initData = _worklet_3366338208300_init_data;
|
|
147
|
+
chunkCQRUNV6SCjs1.__stackDetails = _e;
|
|
148
|
+
return chunkCQRUNV6SCjs1;
|
|
149
149
|
}({
|
|
150
|
-
|
|
150
|
+
_worklet_3366338208300_init_data,
|
|
151
151
|
angle
|
|
152
152
|
}), [angle]);
|
|
153
153
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
|