@xaui/native 0.9.1-alpha.21 → 0.9.1-alpha.23
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-RMLFMRWL.js → chunk-2U6JR7BF.js} +5 -5
- package/dist/{chunk-N7C4UNUL.js → chunk-3JATAB7S.js} +23 -1
- package/dist/chunk-4MHJOWM4.cjs +364 -0
- package/dist/{chunk-2WMVDMFV.cjs → chunk-6HXWQ5AU.cjs} +2 -2
- package/dist/chunk-6WW4CSPY.cjs +82 -0
- package/dist/chunk-AHL33YAO.js +425 -0
- package/dist/{chunk-XHZBXYVU.js → chunk-AKXG43S4.js} +1 -1
- package/dist/{chunk-4NE3SLTM.cjs → chunk-BH5DSJVX.cjs} +102 -73
- package/dist/{chunk-BPBY7ON7.cjs → chunk-BNWS26PX.cjs} +19 -21
- package/dist/{chunk-5LC6KVL3.cjs → chunk-DXGQ43IV.cjs} +3 -3
- package/dist/chunk-E3LXUXE7.js +451 -0
- package/dist/{chunk-ISVUXVFL.js → chunk-FNQF4KQV.js} +19 -71
- package/dist/{chunk-YRCUALUQ.js → chunk-FTCTTBLG.js} +7 -9
- package/dist/{chunk-JL27KVRT.js → chunk-FVP5FUVS.js} +3 -3
- package/dist/{chunk-UL263KGM.cjs → chunk-GBPWTFTU.cjs} +10 -10
- package/dist/{chunk-TUJBDS5M.js → chunk-GG2WWCBK.js} +10 -10
- package/dist/{chunk-EVXZGNPA.cjs → chunk-HUZ4AUM2.cjs} +98 -98
- package/dist/chunk-I6PE5UUH.cjs +425 -0
- package/dist/{chunk-33QILJJH.cjs → chunk-IBEX4XGV.cjs} +11 -11
- package/dist/{chunk-IBRVMLUF.js → chunk-KM2TI5IC.js} +107 -80
- package/dist/chunk-OGC4RKE3.js +364 -0
- package/dist/{chunk-JXLRHKCQ.js → chunk-OYZYWWJ6.js} +1 -1
- package/dist/{chunk-EXX6ATAS.js → chunk-PMO62QK4.js} +101 -101
- package/dist/{chunk-UBA6AEY6.cjs → chunk-RAWOJ3N3.cjs} +8 -8
- package/dist/chunk-TIP3T7JJ.cjs +451 -0
- package/dist/{chunk-APCBIHLR.cjs → chunk-VDRRD6GM.cjs} +29 -81
- package/dist/{chunk-UVO4GFSW.cjs → chunk-YXVKQMCK.cjs} +23 -1
- package/dist/chunk-ZQ3JSWRO.js +82 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- package/dist/components/alert/index.cjs +17 -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 +17 -0
- package/dist/components/button/index.cjs +6 -7
- package/dist/components/button/index.d.cts +74 -125
- package/dist/components/button/index.d.ts +74 -125
- package/dist/components/button/index.js +5 -6
- package/dist/components/card/index.cjs +5 -6
- package/dist/components/card/index.d.cts +74 -74
- package/dist/components/card/index.d.ts +74 -74
- package/dist/components/card/index.js +4 -5
- package/dist/components/chip/index.cjs +17 -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 +17 -0
- package/dist/components/input/index.cjs +14 -0
- package/dist/components/input/index.d.cts +213 -0
- package/dist/components/input/index.d.ts +213 -0
- package/dist/components/input/index.js +14 -0
- package/dist/components/typography/index.cjs +4 -4
- package/dist/components/typography/index.d.cts +4 -4
- package/dist/components/typography/index.d.ts +4 -4
- package/dist/components/typography/index.js +3 -3
- package/dist/components/view/index.cjs +3 -3
- package/dist/components/view/index.d.cts +7 -7
- package/dist/components/view/index.d.ts +7 -7
- package/dist/components/view/index.js +2 -2
- package/dist/{create-recipe-CC3NNCqF.d.ts → create-recipe-C4JkINrA.d.ts} +18 -5
- package/dist/{create-recipe-CPBFg7ym.d.cts → create-recipe-dBN_ewZc.d.cts} +18 -5
- package/dist/{icon.type-Cs1tMX0W.d.cts → icon.type-CF4KiMKl.d.cts} +1 -1
- package/dist/{icon.type-BkcEPJbK.d.ts → icon.type-Dq4_qePa.d.ts} +1 -1
- package/dist/index.cjs +44 -14
- package/dist/index.d.cts +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/index.js +74 -44
- package/dist/{pressable-feedback.type-wfeiJz5m.d.cts → pressable-feedback.type-BA2C9sSz.d.cts} +1 -1
- package/dist/{pressable-feedback.type-DsvWZXWC.d.ts → pressable-feedback.type-Bs4dQlGj.d.ts} +1 -1
- package/dist/{style-props.type-B1BG5TCm.d.cts → style-props.type-CfnoGEP7.d.cts} +1 -1
- package/dist/{style-props.type-B1BG5TCm.d.ts → style-props.type-CfnoGEP7.d.ts} +1 -1
- package/dist/system/index.cjs +15 -7
- package/dist/system/index.d.cts +175 -101
- package/dist/system/index.d.ts +175 -101
- package/dist/system/index.js +15 -7
- package/dist/theme/index.cjs +2 -2
- package/dist/theme/index.d.cts +10 -10
- package/dist/theme/index.d.ts +10 -10
- package/dist/theme/index.js +1 -1
- package/package.json +31 -1
- package/dist/chunk-RRRGLRRP.cjs +0 -28
- package/dist/chunk-SGHP76GU.js +0 -28
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
+
|
|
4
|
+
var _chunkYXVKQMCKcjs = require('./chunk-YXVKQMCK.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
13
|
+
|
|
14
|
+
// src/components/input/input-description.tsx
|
|
15
|
+
var _react = require('react');
|
|
16
|
+
var _reactnative = require('react-native');
|
|
17
|
+
|
|
18
|
+
// src/components/input/input.context.ts
|
|
19
|
+
var [InputProvider, useInput] = _chunkHUZ4AUM2cjs.createSlotContext.call(void 0, "Input");
|
|
20
|
+
|
|
21
|
+
// src/components/input/input-description.tsx
|
|
22
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
23
|
+
var InputDescription = _react.forwardRef.call(void 0,
|
|
24
|
+
function InputDescription2({ children, style, nativeID, ...props }, ref) {
|
|
25
|
+
const { descriptionStyle, descriptionId } = useInput();
|
|
26
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
27
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
28
|
+
_reactnative.Text,
|
|
29
|
+
{
|
|
30
|
+
ref,
|
|
31
|
+
nativeID: _nullishCoalesce(nativeID, () => ( descriptionId)),
|
|
32
|
+
style: [descriptionStyle, styleProps, style],
|
|
33
|
+
...rest,
|
|
34
|
+
children
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
InputDescription.displayName = "XAUI.Input.Description";
|
|
40
|
+
|
|
41
|
+
// src/components/input/input-error.tsx
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
var InputError = _react.forwardRef.call(void 0, function InputError2({ children, style, ...props }, ref) {
|
|
46
|
+
const { errorStyle } = useInput();
|
|
47
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
48
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, style: [errorStyle, styleProps, style], ...rest, children });
|
|
49
|
+
});
|
|
50
|
+
InputError.displayName = "XAUI.Input.Error";
|
|
51
|
+
|
|
52
|
+
// src/components/input/input-field.tsx
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var InputField = _react.forwardRef.call(void 0, function InputField2({ style, onFocus, onBlur, placeholderTextColor, ...props }, ref) {
|
|
57
|
+
const {
|
|
58
|
+
fieldStyle,
|
|
59
|
+
placeholderTextColor: resolvedPlaceholder,
|
|
60
|
+
onFieldFocus,
|
|
61
|
+
onFieldBlur,
|
|
62
|
+
labelId,
|
|
63
|
+
descriptionId,
|
|
64
|
+
isDisabled,
|
|
65
|
+
isInvalid
|
|
66
|
+
} = useInput();
|
|
67
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
68
|
+
const handleFocus = _react.useCallback.call(void 0,
|
|
69
|
+
(event) => {
|
|
70
|
+
onFieldFocus(event);
|
|
71
|
+
_optionalChain([onFocus, 'optionalCall', _ => _(event)]);
|
|
72
|
+
},
|
|
73
|
+
[onFieldFocus, onFocus]
|
|
74
|
+
);
|
|
75
|
+
const handleBlur = _react.useCallback.call(void 0,
|
|
76
|
+
(event) => {
|
|
77
|
+
onFieldBlur(event);
|
|
78
|
+
_optionalChain([onBlur, 'optionalCall', _2 => _2(event)]);
|
|
79
|
+
},
|
|
80
|
+
[onFieldBlur, onBlur]
|
|
81
|
+
);
|
|
82
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
83
|
+
_reactnative.TextInput,
|
|
84
|
+
{
|
|
85
|
+
ref,
|
|
86
|
+
"aria-labelledby": labelId,
|
|
87
|
+
"aria-describedby": descriptionId,
|
|
88
|
+
"aria-invalid": isInvalid,
|
|
89
|
+
editable: !isDisabled,
|
|
90
|
+
accessibilityState: { disabled: isDisabled },
|
|
91
|
+
placeholderTextColor: _nullishCoalesce(placeholderTextColor, () => ( resolvedPlaceholder)),
|
|
92
|
+
...rest,
|
|
93
|
+
style: [fieldStyle, styleProps, style],
|
|
94
|
+
onFocus: handleFocus,
|
|
95
|
+
onBlur: handleBlur
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
InputField.displayName = "XAUI.Input.Field";
|
|
100
|
+
|
|
101
|
+
// src/components/input/input-label.tsx
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
var InputLabel = _react.forwardRef.call(void 0, function InputLabel2({ children, style, nativeID, ...props }, ref) {
|
|
106
|
+
const { labelStyle, labelId } = useInput();
|
|
107
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
108
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
109
|
+
_reactnative.Text,
|
|
110
|
+
{
|
|
111
|
+
ref,
|
|
112
|
+
nativeID: _nullishCoalesce(nativeID, () => ( labelId)),
|
|
113
|
+
style: [labelStyle, styleProps, style],
|
|
114
|
+
...rest,
|
|
115
|
+
children
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
InputLabel.displayName = "XAUI.Input.Label";
|
|
120
|
+
|
|
121
|
+
// src/components/input/input.tsx
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
// src/components/input/input.recipe.ts
|
|
126
|
+
var SLOTS = [
|
|
127
|
+
"root",
|
|
128
|
+
"label",
|
|
129
|
+
"field",
|
|
130
|
+
"placeholder",
|
|
131
|
+
"description",
|
|
132
|
+
"error"
|
|
133
|
+
];
|
|
134
|
+
var VARIANT_TOKENS = {
|
|
135
|
+
primary: {
|
|
136
|
+
bg: "fieldBackground",
|
|
137
|
+
border: "fieldBorder",
|
|
138
|
+
borderFocus: "fieldBorderFocus",
|
|
139
|
+
fg: "fieldForeground"
|
|
140
|
+
},
|
|
141
|
+
// `bg: 'default'` is the neutral *token*, not this variant's name — the two namespaces
|
|
142
|
+
// meet here and nowhere else. It is also what keeps a field visible on a card, where
|
|
143
|
+
// `fieldBackground` is the card's own colour.
|
|
144
|
+
secondary: {
|
|
145
|
+
bg: "default",
|
|
146
|
+
border: "fieldBorder",
|
|
147
|
+
borderFocus: "fieldBorderFocus",
|
|
148
|
+
fg: "fieldForeground"
|
|
149
|
+
},
|
|
150
|
+
tertiary: {
|
|
151
|
+
border: "fieldBorder",
|
|
152
|
+
borderFocus: "fieldBorderFocus",
|
|
153
|
+
fg: "fieldForeground"
|
|
154
|
+
},
|
|
155
|
+
ghost: { borderFocus: "fieldBorderFocus", fg: "fieldForeground" }
|
|
156
|
+
};
|
|
157
|
+
function sizeAxis(step) {
|
|
158
|
+
const { control, padding, gap, field, label, help } = step;
|
|
159
|
+
return (theme) => {
|
|
160
|
+
const inset = { paddingHorizontal: theme.spacing(LABEL_INSET) };
|
|
161
|
+
const helpType = {
|
|
162
|
+
fontSize: theme.fontSizes[help],
|
|
163
|
+
lineHeight: theme.lineHeights[help]
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
root: { gap: theme.spacing(gap) },
|
|
167
|
+
label: {
|
|
168
|
+
...inset,
|
|
169
|
+
fontSize: theme.fontSizes[label],
|
|
170
|
+
lineHeight: theme.lineHeights[label]
|
|
171
|
+
},
|
|
172
|
+
field: {
|
|
173
|
+
minHeight: theme.controlHeights[control],
|
|
174
|
+
paddingHorizontal: theme.spacing(padding),
|
|
175
|
+
fontSize: theme.fontSizes[field]
|
|
176
|
+
},
|
|
177
|
+
description: { ...inset, ...helpType },
|
|
178
|
+
error: { ...inset, ...helpType }
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
var LABEL_INSET = 1.5;
|
|
183
|
+
var SIZES = {
|
|
184
|
+
xs: {
|
|
185
|
+
control: "xs",
|
|
186
|
+
padding: 2.5,
|
|
187
|
+
gap: 1,
|
|
188
|
+
field: "sm",
|
|
189
|
+
label: "sm",
|
|
190
|
+
help: "xs",
|
|
191
|
+
labelInside: "xs"
|
|
192
|
+
},
|
|
193
|
+
sm: {
|
|
194
|
+
control: "sm",
|
|
195
|
+
padding: 3,
|
|
196
|
+
gap: 1,
|
|
197
|
+
field: "md",
|
|
198
|
+
label: "sm",
|
|
199
|
+
help: "xs",
|
|
200
|
+
labelInside: "xs"
|
|
201
|
+
},
|
|
202
|
+
md: {
|
|
203
|
+
control: "md",
|
|
204
|
+
padding: 3,
|
|
205
|
+
gap: 1.5,
|
|
206
|
+
field: "md",
|
|
207
|
+
label: "md",
|
|
208
|
+
help: "sm",
|
|
209
|
+
labelInside: "xs"
|
|
210
|
+
},
|
|
211
|
+
lg: {
|
|
212
|
+
control: "lg",
|
|
213
|
+
padding: 4,
|
|
214
|
+
gap: 2,
|
|
215
|
+
field: "lg",
|
|
216
|
+
label: "lg",
|
|
217
|
+
help: "md",
|
|
218
|
+
labelInside: "sm"
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
function insideLabel(step) {
|
|
222
|
+
const { control, padding, field, labelInside } = step;
|
|
223
|
+
return (theme) => {
|
|
224
|
+
const top = theme.spacing(LABEL_INSIDE_TOP);
|
|
225
|
+
const block = top + theme.lineHeights[labelInside];
|
|
226
|
+
return {
|
|
227
|
+
label: {
|
|
228
|
+
position: "absolute",
|
|
229
|
+
top,
|
|
230
|
+
// `start`, never `left` (R13): RTL mirrors the logical property and only it.
|
|
231
|
+
start: theme.spacing(padding),
|
|
232
|
+
paddingHorizontal: 0,
|
|
233
|
+
fontSize: theme.fontSizes[labelInside],
|
|
234
|
+
lineHeight: theme.lineHeights[labelInside]
|
|
235
|
+
},
|
|
236
|
+
// The height is built from the two lines it now holds rather than added to the
|
|
237
|
+
// control height: `controlHeights` already pays for centring one line, so adding
|
|
238
|
+
// the label's block to it would pay for that room twice. It is floored at the
|
|
239
|
+
// control height all the same, so a theme that raises `controlHeights` does not end
|
|
240
|
+
// up with an inside field shorter than the outside one beside it.
|
|
241
|
+
field: {
|
|
242
|
+
minHeight: Math.max(
|
|
243
|
+
block + theme.lineHeights[field] + top,
|
|
244
|
+
theme.controlHeights[control]
|
|
245
|
+
),
|
|
246
|
+
paddingTop: block,
|
|
247
|
+
paddingBottom: top
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
var LABEL_INSIDE_TOP = 1.5;
|
|
253
|
+
var inputRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
|
|
254
|
+
slots: SLOTS,
|
|
255
|
+
base: (theme) => ({
|
|
256
|
+
root: { flexDirection: "column" },
|
|
257
|
+
label: {
|
|
258
|
+
fontFamily: theme.fontFamilies.body,
|
|
259
|
+
fontWeight: theme.fontWeights.medium
|
|
260
|
+
},
|
|
261
|
+
field: {
|
|
262
|
+
fontFamily: theme.fontFamilies.body,
|
|
263
|
+
// `regular`, not `medium`: what the user typed is content, not a control's label,
|
|
264
|
+
// and a heavier weight makes a filled field read as a button.
|
|
265
|
+
fontWeight: theme.fontWeights.regular,
|
|
266
|
+
borderWidth: theme.borderWidth.field,
|
|
267
|
+
// The theme has a radius named for this component, so every size uses it and the
|
|
268
|
+
// `radius` axis is what overrides it — the same shape a `Chip` takes from `full`.
|
|
269
|
+
borderRadius: theme.radius.field,
|
|
270
|
+
borderCurve: "continuous",
|
|
271
|
+
// RN centres a single line inside `minHeight` on iOS and pins it to the top on
|
|
272
|
+
// Android. Saying it removes a difference nobody chose.
|
|
273
|
+
textAlignVertical: "center"
|
|
274
|
+
},
|
|
275
|
+
// Not a node — the root flattens this one into `placeholderTextColor`, which is a
|
|
276
|
+
// `TextInput` prop rather than a style.
|
|
277
|
+
placeholder: { color: theme.colors.fieldPlaceholder },
|
|
278
|
+
description: {
|
|
279
|
+
fontFamily: theme.fontFamilies.body,
|
|
280
|
+
color: theme.colors.muted
|
|
281
|
+
},
|
|
282
|
+
error: {
|
|
283
|
+
fontFamily: theme.fontFamilies.body,
|
|
284
|
+
color: theme.colors.danger
|
|
285
|
+
}
|
|
286
|
+
}),
|
|
287
|
+
variantTokens: VARIANT_TOKENS,
|
|
288
|
+
/**
|
|
289
|
+
* Where the variant's colours land. The border width follows the *presence* of the
|
|
290
|
+
* border role, so `ghost` needs no rule of its own to say it has no edge.
|
|
291
|
+
*
|
|
292
|
+
* The label is **not** painted from the variant: it sits outside the box, on the screen
|
|
293
|
+
* behind it, so it takes `foreground` and not the field's own text colour. That is also
|
|
294
|
+
* why a tinted input does not tint its label — the tint is the field's, not the form's.
|
|
295
|
+
*/
|
|
296
|
+
paint: (theme, colors) => ({
|
|
297
|
+
field: {
|
|
298
|
+
backgroundColor: colors.bg,
|
|
299
|
+
borderColor: colors.border,
|
|
300
|
+
borderWidth: colors.border ? theme.borderWidth.field : 0,
|
|
301
|
+
color: colors.fg
|
|
302
|
+
},
|
|
303
|
+
label: { color: theme.colors.foreground }
|
|
304
|
+
}),
|
|
305
|
+
/**
|
|
306
|
+
* Declaration order is application order, and it is load-bearing here: `isInvalid`
|
|
307
|
+
* comes after `size` so its border wins, and it must also outrank focus — which is why
|
|
308
|
+
* the root passes `focused` only when the field is *not* invalid, rather than relying
|
|
309
|
+
* on an order that states cannot express.
|
|
310
|
+
*/
|
|
311
|
+
variants: {
|
|
312
|
+
size: {
|
|
313
|
+
xs: sizeAxis(SIZES.xs),
|
|
314
|
+
sm: sizeAxis(SIZES.sm),
|
|
315
|
+
md: sizeAxis(SIZES.md),
|
|
316
|
+
lg: sizeAxis(SIZES.lg)
|
|
317
|
+
},
|
|
318
|
+
radius: _chunkYXVKQMCKcjs.radiusAxis.call(void 0, "field"),
|
|
319
|
+
/**
|
|
320
|
+
* `outside` is the base behaviour, so it adds nothing — it is declared because an
|
|
321
|
+
* axis needs both of its values for the selection to be typed, and because a reader
|
|
322
|
+
* looking for "what does outside do" should find the answer here rather than infer it
|
|
323
|
+
* from an absence. The size-dependent half of `inside` is in `compoundVariants`.
|
|
324
|
+
*/
|
|
325
|
+
labelPlacement: {
|
|
326
|
+
outside: () => ({}),
|
|
327
|
+
inside: () => ({})
|
|
328
|
+
},
|
|
329
|
+
isInvalid: {
|
|
330
|
+
true: (theme) => ({
|
|
331
|
+
field: { borderColor: theme.colors.danger },
|
|
332
|
+
// The label and the description turn with it: on a long form the field that is
|
|
333
|
+
// wrong has to be findable without reading every message.
|
|
334
|
+
label: { color: theme.colors.danger },
|
|
335
|
+
description: { color: theme.colors.danger }
|
|
336
|
+
})
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
/**
|
|
340
|
+
* The focus treatment is the border darkening towards the mode's ink — the theme's
|
|
341
|
+
* `fieldBorderFocus`, which is `fieldBorder` mixed 26% towards `fieldForeground`. No
|
|
342
|
+
* ring and no accent: a form where every focused field flashes the brand colour is a
|
|
343
|
+
* form where the accent has stopped meaning "the action".
|
|
344
|
+
*
|
|
345
|
+
* `borderFocus` is a role rather than a token named here, so a raw `color` follows the
|
|
346
|
+
* field into focus the same way it follows a `Button` into its pressed state.
|
|
347
|
+
*/
|
|
348
|
+
/**
|
|
349
|
+
* What `primary` adds to a filled field, and the four halves of the inside label that
|
|
350
|
+
* need to know the size — a compound is how the engine expresses a rule that depends on
|
|
351
|
+
* two axes at once.
|
|
352
|
+
*/
|
|
353
|
+
compoundVariants: [
|
|
354
|
+
{
|
|
355
|
+
when: { variant: "primary" },
|
|
356
|
+
style: (theme) => ({ field: theme.shadows.field })
|
|
357
|
+
},
|
|
358
|
+
{ when: { size: "xs", labelPlacement: "inside" }, style: insideLabel(SIZES.xs) },
|
|
359
|
+
{ when: { size: "sm", labelPlacement: "inside" }, style: insideLabel(SIZES.sm) },
|
|
360
|
+
{ when: { size: "md", labelPlacement: "inside" }, style: insideLabel(SIZES.md) },
|
|
361
|
+
{ when: { size: "lg", labelPlacement: "inside" }, style: insideLabel(SIZES.lg) }
|
|
362
|
+
],
|
|
363
|
+
states: {
|
|
364
|
+
focused: (_theme, colors) => ({ field: { borderColor: colors.borderFocus } }),
|
|
365
|
+
disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
|
|
366
|
+
},
|
|
367
|
+
defaultVariants: { variant: "secondary", size: "md", labelPlacement: "outside" }
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
// src/components/input/input.tsx
|
|
371
|
+
|
|
372
|
+
var InputRoot = _react.forwardRef.call(void 0, function Input({
|
|
373
|
+
children,
|
|
374
|
+
variant,
|
|
375
|
+
size,
|
|
376
|
+
radius,
|
|
377
|
+
labelPlacement,
|
|
378
|
+
color,
|
|
379
|
+
isInvalid = false,
|
|
380
|
+
isDisabled = false,
|
|
381
|
+
asChild = false,
|
|
382
|
+
style,
|
|
383
|
+
...props
|
|
384
|
+
}, ref) {
|
|
385
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
386
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
387
|
+
const [isFocused, setIsFocused] = _react.useState.call(void 0, false);
|
|
388
|
+
const onFieldFocus = _react.useCallback.call(void 0, () => setIsFocused(true), []);
|
|
389
|
+
const onFieldBlur = _react.useCallback.call(void 0, () => setIsFocused(false), []);
|
|
390
|
+
const id = _react.useId.call(void 0, );
|
|
391
|
+
const labelId = `${id}-label`;
|
|
392
|
+
const descriptionId = `${id}-description`;
|
|
393
|
+
const selection = {
|
|
394
|
+
variant,
|
|
395
|
+
size,
|
|
396
|
+
radius,
|
|
397
|
+
labelPlacement,
|
|
398
|
+
isInvalid: isInvalid ? "true" : void 0
|
|
399
|
+
};
|
|
400
|
+
const states = { focused: isFocused && !isInvalid, disabled: isDisabled };
|
|
401
|
+
const styles = inputRecipe.resolve({ theme, selection, states });
|
|
402
|
+
const tint = color ? inputRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
403
|
+
const context = _react.useMemo.call(void 0, () => {
|
|
404
|
+
const placeholder = _reactnative.StyleSheet.flatten(styles.placeholder);
|
|
405
|
+
return {
|
|
406
|
+
labelStyle: tint ? [styles.label, tint.label] : styles.label,
|
|
407
|
+
fieldStyle: tint ? [styles.field, tint.field] : styles.field,
|
|
408
|
+
descriptionStyle: styles.description,
|
|
409
|
+
errorStyle: styles.error,
|
|
410
|
+
// `ColorValue` also covers the platform's opaque colours, which `TextInput` cannot
|
|
411
|
+
// take for a placeholder.
|
|
412
|
+
placeholderTextColor: typeof placeholder.color === "string" ? placeholder.color : void 0,
|
|
413
|
+
onFieldFocus,
|
|
414
|
+
onFieldBlur,
|
|
415
|
+
labelId,
|
|
416
|
+
descriptionId,
|
|
417
|
+
isDisabled,
|
|
418
|
+
isInvalid
|
|
419
|
+
};
|
|
420
|
+
}, [
|
|
421
|
+
styles,
|
|
422
|
+
tint,
|
|
423
|
+
onFieldFocus,
|
|
424
|
+
onFieldBlur,
|
|
425
|
+
labelId,
|
|
426
|
+
descriptionId,
|
|
427
|
+
isDisabled,
|
|
428
|
+
isInvalid
|
|
429
|
+
]);
|
|
430
|
+
const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _3 => _3.root]), styleProps, style];
|
|
431
|
+
const surface = asChild ? (
|
|
432
|
+
// R12 — the caller's element *is* the column.
|
|
433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHUZ4AUM2cjs.Slot, { ref, ...rest, style: rootStyle, children })
|
|
434
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, ...rest, style: rootStyle, children });
|
|
435
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputProvider, { value: context, children: surface });
|
|
436
|
+
});
|
|
437
|
+
InputRoot.displayName = "XAUI.Input.Root";
|
|
438
|
+
|
|
439
|
+
// src/components/input/index.ts
|
|
440
|
+
var Input2 = Object.assign(InputRoot, {
|
|
441
|
+
Label: InputLabel,
|
|
442
|
+
Field: InputField,
|
|
443
|
+
Description: InputDescription,
|
|
444
|
+
Error: InputError
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
exports.useInput = useInput; exports.inputRecipe = inputRecipe; exports.Input = Input2;
|
|
@@ -36,15 +36,14 @@ function _optionalChain(ops) {
|
|
|
36
36
|
}
|
|
37
37
|
return value;
|
|
38
38
|
}
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var _chunkUVO4GFSWcjs = require('./chunk-UVO4GFSW.cjs');
|
|
43
|
-
var _chunkEVXZGNPAcjs = require('./chunk-EVXZGNPA.cjs');
|
|
39
|
+
var _chunkDXGQ43IVcjs = require('./chunk-DXGQ43IV.cjs');
|
|
40
|
+
var _chunkBH5DSJVXcjs = require('./chunk-BH5DSJVX.cjs');
|
|
41
|
+
var _chunkYXVKQMCKcjs = require('./chunk-YXVKQMCK.cjs');
|
|
44
42
|
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
43
|
+
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
45
44
|
|
|
46
45
|
// src/components/button/button.context.ts
|
|
47
|
-
var [ButtonProvider, useButton] =
|
|
46
|
+
var [ButtonProvider, useButton] = _chunkHUZ4AUM2cjs.createSlotContext.call(void 0, "Button");
|
|
48
47
|
|
|
49
48
|
// src/components/button/button-icon.tsx
|
|
50
49
|
var _jsxruntime = require('react/jsx-runtime');
|
|
@@ -56,7 +55,7 @@ function ButtonIcon({
|
|
|
56
55
|
const {
|
|
57
56
|
icon
|
|
58
57
|
} = useButton();
|
|
59
|
-
return /* @__PURE__ */_jsxruntime.jsx.call(void 0,
|
|
58
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _chunkDXGQ43IVcjs.Icon, {
|
|
60
59
|
size: _nullishCoalesce(size, () => icon.size),
|
|
61
60
|
color: _nullishCoalesce(color, () => icon.color),
|
|
62
61
|
...rest
|
|
@@ -76,7 +75,7 @@ var ButtonLabel = _react.forwardRef.call(void 0, function ButtonLabel2({
|
|
|
76
75
|
const {
|
|
77
76
|
labelStyle
|
|
78
77
|
} = useButton();
|
|
79
|
-
const [styleProps, rest] =
|
|
78
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
80
79
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.Text, {
|
|
81
80
|
ref,
|
|
82
81
|
numberOfLines,
|
|
@@ -100,7 +99,7 @@ function ButtonSpinner({
|
|
|
100
99
|
const {
|
|
101
100
|
spinnerStyle
|
|
102
101
|
} = useButton();
|
|
103
|
-
const [styleProps] =
|
|
102
|
+
const [styleProps] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
104
103
|
const ringStyle = [spinnerStyle, styleProps, style];
|
|
105
104
|
if (!animation) return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
|
|
106
105
|
style: ringStyle
|
|
@@ -110,10 +109,10 @@ function ButtonSpinner({
|
|
|
110
109
|
});
|
|
111
110
|
}
|
|
112
111
|
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\":[\"
|
|
112
|
+
const _worklet_12867052884334_init_data = {
|
|
113
|
+
code: "function chunkVDRRD6GMCjs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
|
|
114
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-VDRRD6GM.cjs",
|
|
115
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkVDRRD6GMCjs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-VDRRD6GM.cjs\"],\"mappings\":\"AAmF6E,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
116
|
};
|
|
118
117
|
function SpinningRing({
|
|
119
118
|
style
|
|
@@ -126,28 +125,28 @@ function SpinningRing({
|
|
|
126
125
|
}), -1, false);
|
|
127
126
|
return () => _reactnativereanimated.cancelAnimation.call(void 0, angle);
|
|
128
127
|
}, [angle]);
|
|
129
|
-
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function
|
|
130
|
-
|
|
128
|
+
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkVDRRD6GMCjs1Factory({
|
|
129
|
+
_worklet_12867052884334_init_data,
|
|
131
130
|
angle
|
|
132
131
|
}) {
|
|
133
132
|
const _e = [new global.Error(), -2, -27];
|
|
134
|
-
const
|
|
133
|
+
const chunkVDRRD6GMCjs1 = function () {
|
|
135
134
|
return {
|
|
136
135
|
transform: [{
|
|
137
136
|
rotate: `${angle.value}deg`
|
|
138
137
|
}]
|
|
139
138
|
};
|
|
140
139
|
};
|
|
141
|
-
|
|
140
|
+
chunkVDRRD6GMCjs1.__closure = {
|
|
142
141
|
angle
|
|
143
142
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return
|
|
143
|
+
chunkVDRRD6GMCjs1.__workletHash = 12867052884334;
|
|
144
|
+
chunkVDRRD6GMCjs1.__pluginVersion = "0.7.4";
|
|
145
|
+
chunkVDRRD6GMCjs1.__initData = _worklet_12867052884334_init_data;
|
|
146
|
+
chunkVDRRD6GMCjs1.__stackDetails = _e;
|
|
147
|
+
return chunkVDRRD6GMCjs1;
|
|
149
148
|
}({
|
|
150
|
-
|
|
149
|
+
_worklet_12867052884334_init_data,
|
|
151
150
|
angle
|
|
152
151
|
}), [angle]);
|
|
153
152
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
|
|
@@ -231,7 +230,7 @@ function sizeAxis(step) {
|
|
|
231
230
|
spinner: ring(theme, theme.fontSizes[glyph])
|
|
232
231
|
});
|
|
233
232
|
}
|
|
234
|
-
var buttonRecipe =
|
|
233
|
+
var buttonRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
|
|
235
234
|
slots: SLOTS,
|
|
236
235
|
base: theme => ({
|
|
237
236
|
root: {
|
|
@@ -307,58 +306,7 @@ var buttonRecipe = _chunkUVO4GFSWcjs.createRecipe.call(void 0, {
|
|
|
307
306
|
radius: "4xl"
|
|
308
307
|
})
|
|
309
308
|
},
|
|
310
|
-
radius:
|
|
311
|
-
xs: t => ({
|
|
312
|
-
root: {
|
|
313
|
-
borderRadius: t.radius.xs
|
|
314
|
-
}
|
|
315
|
-
}),
|
|
316
|
-
sm: t => ({
|
|
317
|
-
root: {
|
|
318
|
-
borderRadius: t.radius.sm
|
|
319
|
-
}
|
|
320
|
-
}),
|
|
321
|
-
md: t => ({
|
|
322
|
-
root: {
|
|
323
|
-
borderRadius: t.radius.md
|
|
324
|
-
}
|
|
325
|
-
}),
|
|
326
|
-
lg: t => ({
|
|
327
|
-
root: {
|
|
328
|
-
borderRadius: t.radius.lg
|
|
329
|
-
}
|
|
330
|
-
}),
|
|
331
|
-
xl: t => ({
|
|
332
|
-
root: {
|
|
333
|
-
borderRadius: t.radius.xl
|
|
334
|
-
}
|
|
335
|
-
}),
|
|
336
|
-
"2xl": t => ({
|
|
337
|
-
root: {
|
|
338
|
-
borderRadius: t.radius["2xl"]
|
|
339
|
-
}
|
|
340
|
-
}),
|
|
341
|
-
"3xl": t => ({
|
|
342
|
-
root: {
|
|
343
|
-
borderRadius: t.radius["3xl"]
|
|
344
|
-
}
|
|
345
|
-
}),
|
|
346
|
-
"4xl": t => ({
|
|
347
|
-
root: {
|
|
348
|
-
borderRadius: t.radius["4xl"]
|
|
349
|
-
}
|
|
350
|
-
}),
|
|
351
|
-
field: t => ({
|
|
352
|
-
root: {
|
|
353
|
-
borderRadius: t.radius.field
|
|
354
|
-
}
|
|
355
|
-
}),
|
|
356
|
-
full: t => ({
|
|
357
|
-
root: {
|
|
358
|
-
borderRadius: t.radius.full
|
|
359
|
-
}
|
|
360
|
-
})
|
|
361
|
-
},
|
|
309
|
+
radius: _chunkYXVKQMCKcjs.radiusAxis.call(void 0, "root"),
|
|
362
310
|
// A square on a fixed height. No width is computed, and none needs to be.
|
|
363
311
|
isIconOnly: {
|
|
364
312
|
true: () => ({
|
|
@@ -420,8 +368,8 @@ var ButtonRoot = _react.forwardRef.call(void 0, function Button({
|
|
|
420
368
|
...props
|
|
421
369
|
}, ref) {
|
|
422
370
|
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0);
|
|
423
|
-
const [styleProps, rest] =
|
|
424
|
-
const [isPressed, press] =
|
|
371
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
372
|
+
const [isPressed, press] = _chunkBH5DSJVXcjs.usePressState.call(void 0, {
|
|
425
373
|
onPressIn,
|
|
426
374
|
onPressOut
|
|
427
375
|
});
|
|
@@ -464,14 +412,14 @@ var ButtonRoot = _react.forwardRef.call(void 0, function Button({
|
|
|
464
412
|
const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _2 => _2.root]), styleProps, typeof style === "function" ? style({
|
|
465
413
|
pressed: isPressed
|
|
466
414
|
}) : style];
|
|
467
|
-
const text =
|
|
415
|
+
const text = _chunkHUZ4AUM2cjs.childrenToString.call(void 0, children);
|
|
468
416
|
const showSpinner = isLoading && !containsElementOfType(children, ButtonSpinner);
|
|
469
417
|
if (isIconOnly && !rest.accessibilityLabel && !rest["aria-label"]) {
|
|
470
|
-
|
|
418
|
+
_chunkBH5DSJVXcjs.warnDev.call(void 0, "Button: an icon-only button needs an `accessibilityLabel` \u2014 there is no text for a screen reader to read, so it announces as an unlabelled button.");
|
|
471
419
|
}
|
|
472
420
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, ButtonProvider, {
|
|
473
421
|
value: context,
|
|
474
|
-
children: /* @__PURE__ */_jsxruntime.jsx.call(void 0,
|
|
422
|
+
children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, _chunkBH5DSJVXcjs.PressableFeedback, {
|
|
475
423
|
ref,
|
|
476
424
|
isPressed,
|
|
477
425
|
isDisabled: isDisabled || isLoading,
|
|
@@ -145,6 +145,28 @@ function apply(fns, theme, colors) {
|
|
|
145
145
|
return merged;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
// src/system/recipe/radius-axis.ts
|
|
149
|
+
function radiusAxis(slot) {
|
|
150
|
+
const axis = {};
|
|
151
|
+
for (const key of RADIUS_KEYS) {
|
|
152
|
+
axis[key] = (theme) => ({ [slot]: { borderRadius: theme.radius[key] } });
|
|
153
|
+
}
|
|
154
|
+
return axis;
|
|
155
|
+
}
|
|
156
|
+
var RADIUS_KEYS = [
|
|
157
|
+
"xs",
|
|
158
|
+
"sm",
|
|
159
|
+
"md",
|
|
160
|
+
"lg",
|
|
161
|
+
"xl",
|
|
162
|
+
"2xl",
|
|
163
|
+
"3xl",
|
|
164
|
+
"4xl",
|
|
165
|
+
"field",
|
|
166
|
+
"full"
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
|
|
148
170
|
|
|
149
171
|
|
|
150
|
-
exports.createRecipe = createRecipe;
|
|
172
|
+
exports.createRecipe = createRecipe; exports.radiusAxis = radiusAxis;
|