@xaui/native 0.9.1-alpha.22 → 0.9.1-alpha.24
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-KM2TI5IC.js → chunk-4HELPMAK.js} +76 -82
- package/dist/{chunk-AHL33YAO.js → chunk-4J26FA6O.js} +9 -7
- package/dist/{chunk-BNWS26PX.cjs → chunk-6FBGCF5T.cjs} +9 -7
- package/dist/chunk-6RO26ORT.js +451 -0
- package/dist/{chunk-ZQ3JSWRO.js → chunk-A4RGJBP2.js} +4 -2
- package/dist/{chunk-I6PE5UUH.cjs → chunk-AV5LMFS3.cjs} +13 -11
- package/dist/{chunk-OGC4RKE3.js → chunk-AXSJPWSJ.js} +5 -5
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/{chunk-VDRRD6GM.cjs → chunk-EWBBDVTM.cjs} +22 -21
- package/dist/{chunk-BH5DSJVX.cjs → chunk-IG4Q3WQO.cjs} +61 -68
- package/dist/{chunk-6WW4CSPY.cjs → chunk-J2JJLKLG.cjs} +6 -4
- package/dist/{chunk-4MHJOWM4.cjs → chunk-J4JFIC4W.cjs} +7 -7
- package/dist/chunk-J4QE34AU.js +732 -0
- package/dist/chunk-LIQTGAI7.cjs +621 -0
- package/dist/{chunk-FNQF4KQV.js → chunk-MRYLLKML.js} +18 -17
- package/dist/chunk-P2XA4DV7.cjs +451 -0
- package/dist/{chunk-FTCTTBLG.js → chunk-ZTA47PO5.js} +7 -5
- package/dist/components/alert/index.cjs +7 -6
- package/dist/components/alert/index.d.cts +2 -2
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert/index.js +6 -5
- package/dist/components/button/index.cjs +6 -5
- package/dist/components/button/index.d.cts +168 -168
- package/dist/components/button/index.d.ts +168 -168
- package/dist/components/button/index.js +5 -4
- package/dist/components/card/index.cjs +5 -4
- package/dist/components/card/index.d.cts +170 -170
- package/dist/components/card/index.d.ts +170 -170
- package/dist/components/card/index.js +4 -3
- package/dist/components/chip/index.cjs +7 -6
- package/dist/components/chip/index.d.cts +169 -169
- package/dist/components/chip/index.d.ts +169 -169
- package/dist/components/chip/index.js +6 -5
- 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/input-otp/index.cjs +27 -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 +27 -0
- package/dist/components/typography/index.cjs +3 -3
- package/dist/components/typography/index.d.cts +3 -3
- package/dist/components/typography/index.d.ts +3 -3
- package/dist/components/typography/index.js +2 -2
- package/dist/components/view/index.d.cts +6 -6
- package/dist/components/view/index.d.ts +6 -6
- package/dist/{create-recipe-CbXika57.d.ts → create-recipe-C4JkINrA.d.ts} +14 -2
- package/dist/{create-recipe-jHlk434p.d.cts → create-recipe-dBN_ewZc.d.cts} +14 -2
- package/dist/index.cjs +44 -50
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +64 -70
- package/dist/system/index.cjs +6 -5
- package/dist/system/index.d.cts +4 -4
- package/dist/system/index.d.ts +4 -4
- package/dist/system/index.js +5 -4
- package/package.json +21 -1
- package/dist/{chunk-DXGQ43IV.cjs → chunk-B4W2XNBP.cjs} +2 -2
- package/dist/{chunk-2U6JR7BF.js → chunk-G52TQJBI.js} +3 -3
- package/dist/{chunk-FVP5FUVS.js → chunk-ICR42HHG.js} +3 -3
- package/dist/{chunk-RAWOJ3N3.cjs → chunk-Y7U6ACMB.cjs} +2 -2
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRecipe,
|
|
3
|
+
radiusAxis
|
|
4
|
+
} from "./chunk-3JATAB7S.js";
|
|
5
|
+
import {
|
|
6
|
+
Slot,
|
|
7
|
+
createSlotContext,
|
|
8
|
+
useStyleProps
|
|
9
|
+
} from "./chunk-PMO62QK4.js";
|
|
10
|
+
import {
|
|
11
|
+
useXAUITheme
|
|
12
|
+
} from "./chunk-A3EGFI6T.js";
|
|
13
|
+
|
|
14
|
+
// src/components/input/input-description.tsx
|
|
15
|
+
import { forwardRef } from "react";
|
|
16
|
+
import { Text } from "react-native";
|
|
17
|
+
|
|
18
|
+
// src/components/input/input.context.ts
|
|
19
|
+
var [InputProvider, useInput] = createSlotContext("Input");
|
|
20
|
+
|
|
21
|
+
// src/components/input/input-description.tsx
|
|
22
|
+
import { jsx } from "react/jsx-runtime";
|
|
23
|
+
var InputDescription = forwardRef(
|
|
24
|
+
function InputDescription2({ children, style, nativeID, ...props }, ref) {
|
|
25
|
+
const { descriptionStyle, descriptionId } = useInput();
|
|
26
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
Text,
|
|
29
|
+
{
|
|
30
|
+
ref,
|
|
31
|
+
nativeID: 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
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
43
|
+
import { Text as Text2 } from "react-native";
|
|
44
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
45
|
+
var InputError = forwardRef2(function InputError2({ children, style, ...props }, ref) {
|
|
46
|
+
const { errorStyle } = useInput();
|
|
47
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
48
|
+
return /* @__PURE__ */ jsx2(Text2, { ref, style: [errorStyle, styleProps, style], ...rest, children });
|
|
49
|
+
});
|
|
50
|
+
InputError.displayName = "XAUI.Input.Error";
|
|
51
|
+
|
|
52
|
+
// src/components/input/input-field.tsx
|
|
53
|
+
import { forwardRef as forwardRef3, useCallback } from "react";
|
|
54
|
+
import { TextInput } from "react-native";
|
|
55
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
56
|
+
var InputField = forwardRef3(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] = useStyleProps(props);
|
|
68
|
+
const handleFocus = useCallback(
|
|
69
|
+
(event) => {
|
|
70
|
+
onFieldFocus(event);
|
|
71
|
+
onFocus?.(event);
|
|
72
|
+
},
|
|
73
|
+
[onFieldFocus, onFocus]
|
|
74
|
+
);
|
|
75
|
+
const handleBlur = useCallback(
|
|
76
|
+
(event) => {
|
|
77
|
+
onFieldBlur(event);
|
|
78
|
+
onBlur?.(event);
|
|
79
|
+
},
|
|
80
|
+
[onFieldBlur, onBlur]
|
|
81
|
+
);
|
|
82
|
+
return /* @__PURE__ */ jsx3(
|
|
83
|
+
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: 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
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
103
|
+
import { Text as Text3 } from "react-native";
|
|
104
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
105
|
+
var InputLabel = forwardRef4(function InputLabel2({ children, style, nativeID, ...props }, ref) {
|
|
106
|
+
const { labelStyle, labelId } = useInput();
|
|
107
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
108
|
+
return /* @__PURE__ */ jsx4(
|
|
109
|
+
Text3,
|
|
110
|
+
{
|
|
111
|
+
ref,
|
|
112
|
+
nativeID: 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
|
+
import { forwardRef as forwardRef5, useCallback as useCallback2, useId, useMemo, useState } from "react";
|
|
123
|
+
import { StyleSheet, View } from "react-native";
|
|
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 = createRecipe({
|
|
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: radiusAxis("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
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
372
|
+
var InputRoot = forwardRef5(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 = useXAUITheme();
|
|
386
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
387
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
388
|
+
const onFieldFocus = useCallback2(() => setIsFocused(true), []);
|
|
389
|
+
const onFieldBlur = useCallback2(() => setIsFocused(false), []);
|
|
390
|
+
const id = useId();
|
|
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 = useMemo(() => {
|
|
404
|
+
const placeholder = 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, tint?.root, styleProps, style];
|
|
431
|
+
const surface = asChild ? (
|
|
432
|
+
// R12 — the caller's element *is* the column.
|
|
433
|
+
/* @__PURE__ */ jsx5(Slot, { ref, ...rest, style: rootStyle, children })
|
|
434
|
+
) : /* @__PURE__ */ jsx5(View, { ref, ...rest, style: rootStyle, children });
|
|
435
|
+
return /* @__PURE__ */ jsx5(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
|
+
export {
|
|
448
|
+
useInput,
|
|
449
|
+
inputRecipe,
|
|
450
|
+
Input2 as Input
|
|
451
|
+
};
|
|
@@ -1,28 +1,30 @@
|
|
|
1
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
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkJ2JJLKLGcjs = require('./chunk-J2JJLKLG.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkB4W2XNBPcjs = require('./chunk-B4W2XNBP.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
var _chunkIG4Q3WQOcjs = require('./chunk-IG4Q3WQO.cjs');
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
var _chunkEJQCQPETcjs = require('./chunk-EJQCQPET.cjs');
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
|
|
16
18
|
var _chunkYXVKQMCKcjs = require('./chunk-YXVKQMCK.cjs');
|
|
17
19
|
|
|
18
20
|
|
|
19
|
-
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
|
|
24
|
+
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
23
25
|
|
|
24
26
|
|
|
25
|
-
var
|
|
27
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
26
28
|
|
|
27
29
|
// src/components/chip/chip-avatar.tsx
|
|
28
30
|
var _react = require('react');
|
|
@@ -52,7 +54,7 @@ ChipAvatar.displayName = "XAUI.Chip.Avatar";
|
|
|
52
54
|
var ChipClose = _react.forwardRef.call(void 0, function ChipClose2({ isDisabled, ...props }, ref) {
|
|
53
55
|
const { closeStyle, closeGlyphStyle, isDisabled: isChipDisabled } = useChip();
|
|
54
56
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
55
|
-
|
|
57
|
+
_chunkJ2JJLKLGcjs.CloseButton,
|
|
56
58
|
{
|
|
57
59
|
ref,
|
|
58
60
|
name: "Chip.Close",
|
|
@@ -80,7 +82,7 @@ ChipDot.displayName = "XAUI.Chip.Dot";
|
|
|
80
82
|
|
|
81
83
|
function ChipIcon({ size, color, ...rest }) {
|
|
82
84
|
const { icon } = useChip();
|
|
83
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
85
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB4W2XNBPcjs.Icon, { size: _nullishCoalesce(size, () => ( icon.size)), color: _nullishCoalesce(color, () => ( icon.color)), ...rest });
|
|
84
86
|
}
|
|
85
87
|
ChipIcon.displayName = "XAUI.Chip.Icon";
|
|
86
88
|
|
|
@@ -236,7 +238,7 @@ var chipRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
|
|
|
236
238
|
// The cross's own geometry — thickness and centring — belongs to the shared
|
|
237
239
|
// `CloseButton`; what stays below is the box and bar size this component's scale sets.
|
|
238
240
|
base: (theme) => ({
|
|
239
|
-
...
|
|
241
|
+
..._chunkJ2JJLKLGcjs.closeButtonBase.call(void 0, theme),
|
|
240
242
|
root: {
|
|
241
243
|
// A chip hugs its content where a `Button` fills its column. The difference is what
|
|
242
244
|
// the two are: a button is a control the layout sizes, a chip is a token *about*
|
|
@@ -329,7 +331,7 @@ var ChipRoot = _react.forwardRef.call(void 0, function Chip({
|
|
|
329
331
|
}, ref) {
|
|
330
332
|
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
331
333
|
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
332
|
-
const [isPressed, press] =
|
|
334
|
+
const [isPressed, press] = _chunkIG4Q3WQOcjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
333
335
|
const selection = { variant, size, radius };
|
|
334
336
|
const states = { pressed: isPressed, disabled: isDisabled };
|
|
335
337
|
const styles = chipRecipe.resolve({ theme, selection, states });
|
|
@@ -360,12 +362,12 @@ var ChipRoot = _react.forwardRef.call(void 0, function Chip({
|
|
|
360
362
|
const text = _chunkHUZ4AUM2cjs.childrenToString.call(void 0, children);
|
|
361
363
|
const content = text !== null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChipLabel, { children: text }) : children;
|
|
362
364
|
if (!isPressable && !asChild && (onPressIn || onPressOut || rest.onPress || rest.onLongPress)) {
|
|
363
|
-
|
|
365
|
+
_chunkEJQCQPETcjs.warnDev.call(void 0,
|
|
364
366
|
"Chip: a press handler needs `isPressable`. Without it the chip renders a View, which never receives the touch \u2014 add `isPressable` to make it a control. A `Chip.Close` is its own control and needs neither."
|
|
365
367
|
);
|
|
366
368
|
}
|
|
367
369
|
const surface = isPressable ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
368
|
-
|
|
370
|
+
_chunkIG4Q3WQOcjs.PressableFeedback,
|
|
369
371
|
{
|
|
370
372
|
ref,
|
|
371
373
|
isPressed,
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CloseButton,
|
|
3
3
|
closeButtonBase
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-A4RGJBP2.js";
|
|
5
5
|
import {
|
|
6
6
|
Icon
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ICR42HHG.js";
|
|
8
8
|
import {
|
|
9
9
|
createRecipe,
|
|
10
10
|
radiusAxis
|
|
11
11
|
} from "./chunk-3JATAB7S.js";
|
|
12
|
-
import {
|
|
13
|
-
useXAUITheme
|
|
14
|
-
} from "./chunk-A3EGFI6T.js";
|
|
15
12
|
import {
|
|
16
13
|
Slot,
|
|
17
14
|
childrenToString,
|
|
18
15
|
createSlotContext,
|
|
19
16
|
useStyleProps
|
|
20
17
|
} from "./chunk-PMO62QK4.js";
|
|
18
|
+
import {
|
|
19
|
+
useXAUITheme
|
|
20
|
+
} from "./chunk-A3EGFI6T.js";
|
|
21
21
|
|
|
22
22
|
// src/components/alert/alert-close.tsx
|
|
23
23
|
import { forwardRef } from "react";
|