@xaui/native 0.9.1-alpha.25 → 0.9.1-alpha.26
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-3LKGVKQY.cjs +145 -0
- package/dist/{chunk-GSEK6OCY.cjs → chunk-5OXZIZRZ.cjs} +7 -7
- package/dist/{chunk-YEW5LPWL.cjs → chunk-JCKVYYZO.cjs} +42 -4
- package/dist/{chunk-MRYLLKML.js → chunk-PQHC65AG.js} +15 -15
- package/dist/{chunk-ZDCGPK5Z.js → chunk-TR2TGPDQ.js} +1 -1
- package/dist/{chunk-2OY76YNB.js → chunk-V2FQN6ZK.js} +42 -4
- package/dist/chunk-WEMZ4VMC.js +145 -0
- package/dist/{chunk-EWBBDVTM.cjs → chunk-WVCAFORA.cjs} +15 -15
- package/dist/components/alert/index.cjs +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/button/index.cjs +3 -3
- package/dist/components/button/index.js +2 -2
- package/dist/components/chip/index.cjs +3 -3
- package/dist/components/chip/index.js +2 -2
- package/dist/components/input/index.cjs +2 -2
- package/dist/components/input/index.d.cts +3 -3
- package/dist/components/input/index.d.ts +3 -3
- package/dist/components/input/index.js +1 -1
- package/dist/components/input-group/index.cjs +26 -0
- package/dist/components/input-group/index.d.cts +270 -0
- package/dist/components/input-group/index.d.ts +270 -0
- package/dist/components/input-group/index.js +26 -0
- package/dist/components/text-area/index.cjs +3 -3
- package/dist/components/text-area/index.d.cts +1 -1
- package/dist/components/text-area/index.d.ts +1 -1
- package/dist/components/text-area/index.js +2 -2
- package/dist/index.cjs +27 -9
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +39 -21
- package/dist/{input.type-BpJeUIe8.d.cts → input.type-BUMDlzL9.d.cts} +18 -2
- package/dist/{input.type-DjyZ6P2C.d.ts → input.type-D2qgi03E.d.ts} +18 -2
- package/dist/system/index.cjs +2 -2
- package/dist/system/index.js +5 -5
- package/package.json +11 -1
- package/dist/{chunk-4J26FA6O.js → chunk-3WISQT22.js} +3 -3
- package/dist/{chunk-AV5LMFS3.cjs → chunk-I7G77Q65.cjs} +2 -2
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
var _chunkB4W2XNBPcjs = require('./chunk-B4W2XNBP.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkJCKVYYZOcjs = require('./chunk-JCKVYYZO.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
13
|
+
|
|
14
|
+
// src/components/input-group/input-group-field.tsx
|
|
15
|
+
var _react = require('react');
|
|
16
|
+
|
|
17
|
+
// src/components/input-group/input-group.context.ts
|
|
18
|
+
var [InputGroupProvider, useInputGroup] = _chunkHUZ4AUM2cjs.createSlotContext.call(void 0, "InputGroup");
|
|
19
|
+
|
|
20
|
+
// src/components/input-group/input-group.utils.ts
|
|
21
|
+
function decoratorPadding(prefixWidth, suffixWidth) {
|
|
22
|
+
const paddingStart = prefixWidth > 0 ? prefixWidth : void 0;
|
|
23
|
+
const paddingEnd = suffixWidth > 0 ? suffixWidth : void 0;
|
|
24
|
+
if (paddingStart === void 0 && paddingEnd === void 0) return void 0;
|
|
25
|
+
return { paddingStart, paddingEnd };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/components/input-group/input-group-field.tsx
|
|
29
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
30
|
+
var InputGroupField = _react.forwardRef.call(void 0,
|
|
31
|
+
function InputGroupField2({ style, ...props }, ref) {
|
|
32
|
+
const { prefixWidth, suffixWidth } = useInputGroup();
|
|
33
|
+
const padding = _react.useMemo.call(void 0,
|
|
34
|
+
() => decoratorPadding(prefixWidth, suffixWidth),
|
|
35
|
+
[prefixWidth, suffixWidth]
|
|
36
|
+
);
|
|
37
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJCKVYYZOcjs.InputField, { ref, ...props, style: [padding, style] });
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
InputGroupField.displayName = "XAUI.InputGroup.Field";
|
|
41
|
+
|
|
42
|
+
// src/components/input-group/input-group-icon.tsx
|
|
43
|
+
|
|
44
|
+
function InputGroupIcon({ size, color, ...rest }) {
|
|
45
|
+
const { icon } = _chunkJCKVYYZOcjs.useInput.call(void 0, );
|
|
46
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB4W2XNBPcjs.Icon, { size: _nullishCoalesce(size, () => ( icon.size)), color: _nullishCoalesce(color, () => ( icon.color)), ...rest });
|
|
47
|
+
}
|
|
48
|
+
InputGroupIcon.displayName = "XAUI.InputGroup.Icon";
|
|
49
|
+
|
|
50
|
+
// src/components/input-group/input-group-prefix.tsx
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
// src/components/input-group/input-group-decorator.tsx
|
|
54
|
+
|
|
55
|
+
var _reactnative = require('react-native');
|
|
56
|
+
|
|
57
|
+
var InputGroupDecorator = _react.forwardRef.call(void 0,
|
|
58
|
+
function InputGroupDecorator2({ side, children, isDecorative = false, onLayout, style, ...props }, ref) {
|
|
59
|
+
const { prefixStyle, suffixStyle, isDisabled } = _chunkJCKVYYZOcjs.useInput.call(void 0, );
|
|
60
|
+
const { setPrefixWidth, setSuffixWidth } = useInputGroup();
|
|
61
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
62
|
+
const report = side === "prefix" ? setPrefixWidth : setSuffixWidth;
|
|
63
|
+
const handleLayout = _react.useCallback.call(void 0,
|
|
64
|
+
(event) => {
|
|
65
|
+
report(event.nativeEvent.layout.width);
|
|
66
|
+
_optionalChain([onLayout, 'optionalCall', _ => _(event)]);
|
|
67
|
+
},
|
|
68
|
+
[report, onLayout]
|
|
69
|
+
);
|
|
70
|
+
const isInert = isDecorative || isDisabled;
|
|
71
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
72
|
+
_reactnative.View,
|
|
73
|
+
{
|
|
74
|
+
ref,
|
|
75
|
+
accessibilityElementsHidden: isDecorative || void 0,
|
|
76
|
+
importantForAccessibility: isDecorative ? "no-hide-descendants" : void 0,
|
|
77
|
+
pointerEvents: isInert ? "none" : void 0,
|
|
78
|
+
...rest,
|
|
79
|
+
style: [side === "prefix" ? prefixStyle : suffixStyle, styleProps, style],
|
|
80
|
+
onLayout: handleLayout,
|
|
81
|
+
children
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
InputGroupDecorator.displayName = "XAUI.InputGroup.Decorator";
|
|
87
|
+
|
|
88
|
+
// src/components/input-group/input-group-prefix.tsx
|
|
89
|
+
|
|
90
|
+
var InputGroupPrefix = _react.forwardRef.call(void 0,
|
|
91
|
+
function InputGroupPrefix2(props, ref) {
|
|
92
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputGroupDecorator, { ref, side: "prefix", ...props });
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
InputGroupPrefix.displayName = "XAUI.InputGroup.Prefix";
|
|
96
|
+
|
|
97
|
+
// src/components/input-group/input-group-suffix.tsx
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
var InputGroupSuffix = _react.forwardRef.call(void 0,
|
|
101
|
+
function InputGroupSuffix2(props, ref) {
|
|
102
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputGroupDecorator, { ref, side: "suffix", ...props });
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
InputGroupSuffix.displayName = "XAUI.InputGroup.Suffix";
|
|
106
|
+
|
|
107
|
+
// src/components/input-group/input-group.tsx
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
var InputGroupRoot = _react.forwardRef.call(void 0, function InputGroup({ children, asChild = false, style, ...props }, ref) {
|
|
112
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
113
|
+
const [prefixWidth, setPrefixWidth] = _react.useState.call(void 0, 0);
|
|
114
|
+
const [suffixWidth, setSuffixWidth] = _react.useState.call(void 0, 0);
|
|
115
|
+
const context = _react.useMemo.call(void 0,
|
|
116
|
+
() => ({ prefixWidth, suffixWidth, setPrefixWidth, setSuffixWidth }),
|
|
117
|
+
[prefixWidth, suffixWidth]
|
|
118
|
+
);
|
|
119
|
+
const rootStyle = [styleProps, style];
|
|
120
|
+
const surface = asChild ? (
|
|
121
|
+
// R12 — the caller's element *is* the row.
|
|
122
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHUZ4AUM2cjs.Slot, { ref, ...rest, style: rootStyle, children })
|
|
123
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, ...rest, style: rootStyle, children });
|
|
124
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputGroupProvider, { value: context, children: surface });
|
|
125
|
+
});
|
|
126
|
+
InputGroupRoot.displayName = "XAUI.InputGroup.Root";
|
|
127
|
+
|
|
128
|
+
// src/components/input-group/index.ts
|
|
129
|
+
var InputGroup2 = Object.assign(InputGroupRoot, {
|
|
130
|
+
Prefix: InputGroupPrefix,
|
|
131
|
+
Field: InputGroupField,
|
|
132
|
+
Suffix: InputGroupSuffix,
|
|
133
|
+
Icon: InputGroupIcon
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
exports.useInputGroup = useInputGroup; exports.decoratorPadding = decoratorPadding; exports.InputGroupField = InputGroupField; exports.InputGroupIcon = InputGroupIcon; exports.InputGroupPrefix = InputGroupPrefix; exports.InputGroupSuffix = InputGroupSuffix; exports.InputGroupRoot = InputGroupRoot; exports.InputGroup = InputGroup2;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkJCKVYYZOcjs = require('./chunk-JCKVYYZO.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@ var [TextAreaProvider, useTextArea] = _chunkHUZ4AUM2cjs.createSlotContext.call(v
|
|
|
21
21
|
var _jsxruntime = require('react/jsx-runtime');
|
|
22
22
|
var TextAreaField = _react.forwardRef.call(void 0,
|
|
23
23
|
function TextAreaField2({ style, scrollEnabled, ...props }, ref) {
|
|
24
|
-
const { textAreaStyle, textArea } =
|
|
24
|
+
const { textAreaStyle, textArea } = _chunkJCKVYYZOcjs.useInput.call(void 0, );
|
|
25
25
|
const { rows, maxRows } = useTextArea();
|
|
26
26
|
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
27
27
|
const height = _react.useMemo.call(void 0, () => {
|
|
@@ -35,7 +35,7 @@ var TextAreaField = _react.forwardRef.call(void 0,
|
|
|
35
35
|
};
|
|
36
36
|
}, [rows, maxRows, textArea]);
|
|
37
37
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
38
|
-
|
|
38
|
+
_chunkJCKVYYZOcjs.InputField,
|
|
39
39
|
{
|
|
40
40
|
ref,
|
|
41
41
|
multiline: true,
|
|
@@ -54,16 +54,16 @@ TextAreaField.displayName = "XAUI.TextArea.Field";
|
|
|
54
54
|
var DEFAULT_ROWS = 3;
|
|
55
55
|
var TextAreaRoot = _react.forwardRef.call(void 0, function TextArea({ rows = DEFAULT_ROWS, maxRows, children, ...props }, ref) {
|
|
56
56
|
const context = _react.useMemo.call(void 0, () => ({ rows, maxRows }), [rows, maxRows]);
|
|
57
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextAreaProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
57
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextAreaProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJCKVYYZOcjs.InputRoot, { ref, ...props, children }) });
|
|
58
58
|
});
|
|
59
59
|
TextAreaRoot.displayName = "XAUI.TextArea.Root";
|
|
60
60
|
|
|
61
61
|
// src/components/text-area/index.ts
|
|
62
62
|
var TextArea2 = Object.assign(TextAreaRoot, {
|
|
63
|
-
Label:
|
|
63
|
+
Label: _chunkJCKVYYZOcjs.InputLabel,
|
|
64
64
|
Field: TextAreaField,
|
|
65
|
-
Description:
|
|
66
|
-
Error:
|
|
65
|
+
Description: _chunkJCKVYYZOcjs.InputDescription,
|
|
66
|
+
Error: _chunkJCKVYYZOcjs.InputError
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
|
|
@@ -130,7 +130,10 @@ var SLOTS = [
|
|
|
130
130
|
"textArea",
|
|
131
131
|
"placeholder",
|
|
132
132
|
"description",
|
|
133
|
-
"error"
|
|
133
|
+
"error",
|
|
134
|
+
"prefix",
|
|
135
|
+
"suffix",
|
|
136
|
+
"icon"
|
|
134
137
|
];
|
|
135
138
|
var VARIANT_TOKENS = {
|
|
136
139
|
primary: {
|
|
@@ -156,13 +159,17 @@ var VARIANT_TOKENS = {
|
|
|
156
159
|
ghost: { borderFocus: "fieldBorderFocus", fg: "fieldForeground" }
|
|
157
160
|
};
|
|
158
161
|
function sizeAxis(step) {
|
|
159
|
-
const { control, padding, gap, field, label, help, textAreaPadding } = step;
|
|
162
|
+
const { control, padding, gap, field, label, help, glyph, textAreaPadding } = step;
|
|
160
163
|
return (theme) => {
|
|
161
164
|
const inset = { paddingHorizontal: theme.spacing(LABEL_INSET) };
|
|
162
165
|
const helpType = {
|
|
163
166
|
fontSize: theme.fontSizes[help],
|
|
164
167
|
lineHeight: theme.lineHeights[help]
|
|
165
168
|
};
|
|
169
|
+
const decorator = {
|
|
170
|
+
paddingHorizontal: theme.spacing(padding),
|
|
171
|
+
gap: theme.spacing(padding)
|
|
172
|
+
};
|
|
166
173
|
return {
|
|
167
174
|
root: { gap: theme.spacing(gap) },
|
|
168
175
|
label: {
|
|
@@ -185,11 +192,23 @@ function sizeAxis(step) {
|
|
|
185
192
|
paddingBottom: theme.spacing(textAreaPadding)
|
|
186
193
|
},
|
|
187
194
|
description: { ...inset, ...helpType },
|
|
188
|
-
error: { ...inset, ...helpType }
|
|
195
|
+
error: { ...inset, ...helpType },
|
|
196
|
+
prefix: decorator,
|
|
197
|
+
suffix: decorator,
|
|
198
|
+
icon: { fontSize: theme.fontSizes[glyph] }
|
|
189
199
|
};
|
|
190
200
|
};
|
|
191
201
|
}
|
|
192
202
|
var LABEL_INSET = 1.5;
|
|
203
|
+
var DECORATOR = {
|
|
204
|
+
position: "absolute",
|
|
205
|
+
top: 0,
|
|
206
|
+
bottom: 0,
|
|
207
|
+
flexDirection: "row",
|
|
208
|
+
alignItems: "center",
|
|
209
|
+
justifyContent: "center",
|
|
210
|
+
zIndex: 10
|
|
211
|
+
};
|
|
193
212
|
var SIZES = {
|
|
194
213
|
xs: {
|
|
195
214
|
control: "xs",
|
|
@@ -198,6 +217,7 @@ var SIZES = {
|
|
|
198
217
|
field: "sm",
|
|
199
218
|
label: "sm",
|
|
200
219
|
help: "xs",
|
|
220
|
+
glyph: "md",
|
|
201
221
|
labelInside: "xs",
|
|
202
222
|
textAreaPadding: 1.5
|
|
203
223
|
},
|
|
@@ -208,6 +228,7 @@ var SIZES = {
|
|
|
208
228
|
field: "md",
|
|
209
229
|
label: "sm",
|
|
210
230
|
help: "xs",
|
|
231
|
+
glyph: "lg",
|
|
211
232
|
labelInside: "xs",
|
|
212
233
|
textAreaPadding: 2
|
|
213
234
|
},
|
|
@@ -218,6 +239,7 @@ var SIZES = {
|
|
|
218
239
|
field: "md",
|
|
219
240
|
label: "md",
|
|
220
241
|
help: "sm",
|
|
242
|
+
glyph: "lg",
|
|
221
243
|
labelInside: "xs",
|
|
222
244
|
textAreaPadding: 2
|
|
223
245
|
},
|
|
@@ -228,6 +250,7 @@ var SIZES = {
|
|
|
228
250
|
field: "lg",
|
|
229
251
|
label: "lg",
|
|
230
252
|
help: "md",
|
|
253
|
+
glyph: "xl",
|
|
231
254
|
labelInside: "sm",
|
|
232
255
|
textAreaPadding: 2.5
|
|
233
256
|
}
|
|
@@ -303,7 +326,13 @@ var inputRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
|
|
|
303
326
|
error: {
|
|
304
327
|
fontFamily: theme.fontFamilies.body,
|
|
305
328
|
color: theme.colors.danger
|
|
306
|
-
}
|
|
329
|
+
},
|
|
330
|
+
prefix: { ...DECORATOR, start: 0 },
|
|
331
|
+
suffix: { ...DECORATOR, end: 0 },
|
|
332
|
+
// The glyph sits with the placeholder rather than with the value: a search mark or a
|
|
333
|
+
// lock is decoration for the text, not text. `paint` leaves it alone, so a tinted
|
|
334
|
+
// filled field is the one case where the caller names a colour on the icon itself.
|
|
335
|
+
icon: { color: theme.colors.fieldPlaceholder }
|
|
307
336
|
}),
|
|
308
337
|
variantTokens: VARIANT_TOKENS,
|
|
309
338
|
/**
|
|
@@ -423,6 +452,7 @@ var InputRoot = _react.forwardRef.call(void 0, function Input({
|
|
|
423
452
|
const tint = color ? inputRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
424
453
|
const context = _react.useMemo.call(void 0, () => {
|
|
425
454
|
const placeholder = _reactnative.StyleSheet.flatten(styles.placeholder);
|
|
455
|
+
const icon = _reactnative.StyleSheet.flatten(styles.icon);
|
|
426
456
|
const textArea = _reactnative.StyleSheet.flatten(styles.textArea);
|
|
427
457
|
return {
|
|
428
458
|
labelStyle: tint ? [styles.label, tint.label] : styles.label,
|
|
@@ -436,6 +466,14 @@ var InputRoot = _react.forwardRef.call(void 0, function Input({
|
|
|
436
466
|
},
|
|
437
467
|
descriptionStyle: styles.description,
|
|
438
468
|
errorStyle: styles.error,
|
|
469
|
+
prefixStyle: styles.prefix,
|
|
470
|
+
suffixStyle: styles.suffix,
|
|
471
|
+
icon: {
|
|
472
|
+
size: icon.fontSize,
|
|
473
|
+
// `ColorValue` also covers the platform's opaque colours, which an icon component
|
|
474
|
+
// takes as a `string` and nothing else.
|
|
475
|
+
color: typeof icon.color === "string" ? icon.color : void 0
|
|
476
|
+
},
|
|
439
477
|
// `ColorValue` also covers the platform's opaque colours, which `TextInput` cannot
|
|
440
478
|
// take for a placeholder.
|
|
441
479
|
placeholderTextColor: typeof placeholder.color === "string" ? placeholder.color : void 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Icon } from "./chunk-ICR42HHG.js";
|
|
2
1
|
import { PressableFeedback, usePressState } from "./chunk-4HELPMAK.js";
|
|
2
|
+
import { Icon } from "./chunk-ICR42HHG.js";
|
|
3
3
|
import { warnDev } from "./chunk-EGLLDKN6.js";
|
|
4
4
|
import { createRecipe, radiusAxis } from "./chunk-3JATAB7S.js";
|
|
5
5
|
import { childrenToString, createSlotContext, useStyleProps } from "./chunk-PMO62QK4.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_146491499400_init_data = {
|
|
78
|
+
code: "function chunkPQHC65AGJs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
|
|
79
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-PQHC65AG.js",
|
|
80
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkPQHC65AGJs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-PQHC65AG.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 chunkPQHC65AGJs1Factory({
|
|
94
|
+
_worklet_146491499400_init_data,
|
|
95
95
|
angle
|
|
96
96
|
}) {
|
|
97
97
|
const _e = [new global.Error(), -2, -27];
|
|
98
|
-
const
|
|
98
|
+
const chunkPQHC65AGJs1 = function () {
|
|
99
99
|
return {
|
|
100
100
|
transform: [{
|
|
101
101
|
rotate: `${angle.value}deg`
|
|
102
102
|
}]
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
|
-
|
|
105
|
+
chunkPQHC65AGJs1.__closure = {
|
|
106
106
|
angle
|
|
107
107
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return
|
|
108
|
+
chunkPQHC65AGJs1.__workletHash = 146491499400;
|
|
109
|
+
chunkPQHC65AGJs1.__pluginVersion = "0.7.4";
|
|
110
|
+
chunkPQHC65AGJs1.__initData = _worklet_146491499400_init_data;
|
|
111
|
+
chunkPQHC65AGJs1.__stackDetails = _e;
|
|
112
|
+
return chunkPQHC65AGJs1;
|
|
113
113
|
}({
|
|
114
|
-
|
|
114
|
+
_worklet_146491499400_init_data,
|
|
115
115
|
angle
|
|
116
116
|
}), [angle]);
|
|
117
117
|
return /* @__PURE__ */jsx3(Animated.View, {
|
|
@@ -130,7 +130,10 @@ var SLOTS = [
|
|
|
130
130
|
"textArea",
|
|
131
131
|
"placeholder",
|
|
132
132
|
"description",
|
|
133
|
-
"error"
|
|
133
|
+
"error",
|
|
134
|
+
"prefix",
|
|
135
|
+
"suffix",
|
|
136
|
+
"icon"
|
|
134
137
|
];
|
|
135
138
|
var VARIANT_TOKENS = {
|
|
136
139
|
primary: {
|
|
@@ -156,13 +159,17 @@ var VARIANT_TOKENS = {
|
|
|
156
159
|
ghost: { borderFocus: "fieldBorderFocus", fg: "fieldForeground" }
|
|
157
160
|
};
|
|
158
161
|
function sizeAxis(step) {
|
|
159
|
-
const { control, padding, gap, field, label, help, textAreaPadding } = step;
|
|
162
|
+
const { control, padding, gap, field, label, help, glyph, textAreaPadding } = step;
|
|
160
163
|
return (theme) => {
|
|
161
164
|
const inset = { paddingHorizontal: theme.spacing(LABEL_INSET) };
|
|
162
165
|
const helpType = {
|
|
163
166
|
fontSize: theme.fontSizes[help],
|
|
164
167
|
lineHeight: theme.lineHeights[help]
|
|
165
168
|
};
|
|
169
|
+
const decorator = {
|
|
170
|
+
paddingHorizontal: theme.spacing(padding),
|
|
171
|
+
gap: theme.spacing(padding)
|
|
172
|
+
};
|
|
166
173
|
return {
|
|
167
174
|
root: { gap: theme.spacing(gap) },
|
|
168
175
|
label: {
|
|
@@ -185,11 +192,23 @@ function sizeAxis(step) {
|
|
|
185
192
|
paddingBottom: theme.spacing(textAreaPadding)
|
|
186
193
|
},
|
|
187
194
|
description: { ...inset, ...helpType },
|
|
188
|
-
error: { ...inset, ...helpType }
|
|
195
|
+
error: { ...inset, ...helpType },
|
|
196
|
+
prefix: decorator,
|
|
197
|
+
suffix: decorator,
|
|
198
|
+
icon: { fontSize: theme.fontSizes[glyph] }
|
|
189
199
|
};
|
|
190
200
|
};
|
|
191
201
|
}
|
|
192
202
|
var LABEL_INSET = 1.5;
|
|
203
|
+
var DECORATOR = {
|
|
204
|
+
position: "absolute",
|
|
205
|
+
top: 0,
|
|
206
|
+
bottom: 0,
|
|
207
|
+
flexDirection: "row",
|
|
208
|
+
alignItems: "center",
|
|
209
|
+
justifyContent: "center",
|
|
210
|
+
zIndex: 10
|
|
211
|
+
};
|
|
193
212
|
var SIZES = {
|
|
194
213
|
xs: {
|
|
195
214
|
control: "xs",
|
|
@@ -198,6 +217,7 @@ var SIZES = {
|
|
|
198
217
|
field: "sm",
|
|
199
218
|
label: "sm",
|
|
200
219
|
help: "xs",
|
|
220
|
+
glyph: "md",
|
|
201
221
|
labelInside: "xs",
|
|
202
222
|
textAreaPadding: 1.5
|
|
203
223
|
},
|
|
@@ -208,6 +228,7 @@ var SIZES = {
|
|
|
208
228
|
field: "md",
|
|
209
229
|
label: "sm",
|
|
210
230
|
help: "xs",
|
|
231
|
+
glyph: "lg",
|
|
211
232
|
labelInside: "xs",
|
|
212
233
|
textAreaPadding: 2
|
|
213
234
|
},
|
|
@@ -218,6 +239,7 @@ var SIZES = {
|
|
|
218
239
|
field: "md",
|
|
219
240
|
label: "md",
|
|
220
241
|
help: "sm",
|
|
242
|
+
glyph: "lg",
|
|
221
243
|
labelInside: "xs",
|
|
222
244
|
textAreaPadding: 2
|
|
223
245
|
},
|
|
@@ -228,6 +250,7 @@ var SIZES = {
|
|
|
228
250
|
field: "lg",
|
|
229
251
|
label: "lg",
|
|
230
252
|
help: "md",
|
|
253
|
+
glyph: "xl",
|
|
231
254
|
labelInside: "sm",
|
|
232
255
|
textAreaPadding: 2.5
|
|
233
256
|
}
|
|
@@ -303,7 +326,13 @@ var inputRecipe = createRecipe({
|
|
|
303
326
|
error: {
|
|
304
327
|
fontFamily: theme.fontFamilies.body,
|
|
305
328
|
color: theme.colors.danger
|
|
306
|
-
}
|
|
329
|
+
},
|
|
330
|
+
prefix: { ...DECORATOR, start: 0 },
|
|
331
|
+
suffix: { ...DECORATOR, end: 0 },
|
|
332
|
+
// The glyph sits with the placeholder rather than with the value: a search mark or a
|
|
333
|
+
// lock is decoration for the text, not text. `paint` leaves it alone, so a tinted
|
|
334
|
+
// filled field is the one case where the caller names a colour on the icon itself.
|
|
335
|
+
icon: { color: theme.colors.fieldPlaceholder }
|
|
307
336
|
}),
|
|
308
337
|
variantTokens: VARIANT_TOKENS,
|
|
309
338
|
/**
|
|
@@ -423,6 +452,7 @@ var InputRoot = forwardRef5(function Input({
|
|
|
423
452
|
const tint = color ? inputRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
424
453
|
const context = useMemo(() => {
|
|
425
454
|
const placeholder = StyleSheet.flatten(styles.placeholder);
|
|
455
|
+
const icon = StyleSheet.flatten(styles.icon);
|
|
426
456
|
const textArea = StyleSheet.flatten(styles.textArea);
|
|
427
457
|
return {
|
|
428
458
|
labelStyle: tint ? [styles.label, tint.label] : styles.label,
|
|
@@ -436,6 +466,14 @@ var InputRoot = forwardRef5(function Input({
|
|
|
436
466
|
},
|
|
437
467
|
descriptionStyle: styles.description,
|
|
438
468
|
errorStyle: styles.error,
|
|
469
|
+
prefixStyle: styles.prefix,
|
|
470
|
+
suffixStyle: styles.suffix,
|
|
471
|
+
icon: {
|
|
472
|
+
size: icon.fontSize,
|
|
473
|
+
// `ColorValue` also covers the platform's opaque colours, which an icon component
|
|
474
|
+
// takes as a `string` and nothing else.
|
|
475
|
+
color: typeof icon.color === "string" ? icon.color : void 0
|
|
476
|
+
},
|
|
439
477
|
// `ColorValue` also covers the platform's opaque colours, which `TextInput` cannot
|
|
440
478
|
// take for a placeholder.
|
|
441
479
|
placeholderTextColor: typeof placeholder.color === "string" ? placeholder.color : void 0,
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Icon
|
|
3
|
+
} from "./chunk-ICR42HHG.js";
|
|
4
|
+
import {
|
|
5
|
+
InputField,
|
|
6
|
+
useInput
|
|
7
|
+
} from "./chunk-V2FQN6ZK.js";
|
|
8
|
+
import {
|
|
9
|
+
Slot,
|
|
10
|
+
createSlotContext,
|
|
11
|
+
useStyleProps
|
|
12
|
+
} from "./chunk-PMO62QK4.js";
|
|
13
|
+
|
|
14
|
+
// src/components/input-group/input-group-field.tsx
|
|
15
|
+
import { forwardRef, useMemo } from "react";
|
|
16
|
+
|
|
17
|
+
// src/components/input-group/input-group.context.ts
|
|
18
|
+
var [InputGroupProvider, useInputGroup] = createSlotContext("InputGroup");
|
|
19
|
+
|
|
20
|
+
// src/components/input-group/input-group.utils.ts
|
|
21
|
+
function decoratorPadding(prefixWidth, suffixWidth) {
|
|
22
|
+
const paddingStart = prefixWidth > 0 ? prefixWidth : void 0;
|
|
23
|
+
const paddingEnd = suffixWidth > 0 ? suffixWidth : void 0;
|
|
24
|
+
if (paddingStart === void 0 && paddingEnd === void 0) return void 0;
|
|
25
|
+
return { paddingStart, paddingEnd };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/components/input-group/input-group-field.tsx
|
|
29
|
+
import { jsx } from "react/jsx-runtime";
|
|
30
|
+
var InputGroupField = forwardRef(
|
|
31
|
+
function InputGroupField2({ style, ...props }, ref) {
|
|
32
|
+
const { prefixWidth, suffixWidth } = useInputGroup();
|
|
33
|
+
const padding = useMemo(
|
|
34
|
+
() => decoratorPadding(prefixWidth, suffixWidth),
|
|
35
|
+
[prefixWidth, suffixWidth]
|
|
36
|
+
);
|
|
37
|
+
return /* @__PURE__ */ jsx(InputField, { ref, ...props, style: [padding, style] });
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
InputGroupField.displayName = "XAUI.InputGroup.Field";
|
|
41
|
+
|
|
42
|
+
// src/components/input-group/input-group-icon.tsx
|
|
43
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
44
|
+
function InputGroupIcon({ size, color, ...rest }) {
|
|
45
|
+
const { icon } = useInput();
|
|
46
|
+
return /* @__PURE__ */ jsx2(Icon, { size: size ?? icon.size, color: color ?? icon.color, ...rest });
|
|
47
|
+
}
|
|
48
|
+
InputGroupIcon.displayName = "XAUI.InputGroup.Icon";
|
|
49
|
+
|
|
50
|
+
// src/components/input-group/input-group-prefix.tsx
|
|
51
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
52
|
+
|
|
53
|
+
// src/components/input-group/input-group-decorator.tsx
|
|
54
|
+
import { forwardRef as forwardRef2, useCallback } from "react";
|
|
55
|
+
import { View } from "react-native";
|
|
56
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
57
|
+
var InputGroupDecorator = forwardRef2(
|
|
58
|
+
function InputGroupDecorator2({ side, children, isDecorative = false, onLayout, style, ...props }, ref) {
|
|
59
|
+
const { prefixStyle, suffixStyle, isDisabled } = useInput();
|
|
60
|
+
const { setPrefixWidth, setSuffixWidth } = useInputGroup();
|
|
61
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
62
|
+
const report = side === "prefix" ? setPrefixWidth : setSuffixWidth;
|
|
63
|
+
const handleLayout = useCallback(
|
|
64
|
+
(event) => {
|
|
65
|
+
report(event.nativeEvent.layout.width);
|
|
66
|
+
onLayout?.(event);
|
|
67
|
+
},
|
|
68
|
+
[report, onLayout]
|
|
69
|
+
);
|
|
70
|
+
const isInert = isDecorative || isDisabled;
|
|
71
|
+
return /* @__PURE__ */ jsx3(
|
|
72
|
+
View,
|
|
73
|
+
{
|
|
74
|
+
ref,
|
|
75
|
+
accessibilityElementsHidden: isDecorative || void 0,
|
|
76
|
+
importantForAccessibility: isDecorative ? "no-hide-descendants" : void 0,
|
|
77
|
+
pointerEvents: isInert ? "none" : void 0,
|
|
78
|
+
...rest,
|
|
79
|
+
style: [side === "prefix" ? prefixStyle : suffixStyle, styleProps, style],
|
|
80
|
+
onLayout: handleLayout,
|
|
81
|
+
children
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
InputGroupDecorator.displayName = "XAUI.InputGroup.Decorator";
|
|
87
|
+
|
|
88
|
+
// src/components/input-group/input-group-prefix.tsx
|
|
89
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
90
|
+
var InputGroupPrefix = forwardRef3(
|
|
91
|
+
function InputGroupPrefix2(props, ref) {
|
|
92
|
+
return /* @__PURE__ */ jsx4(InputGroupDecorator, { ref, side: "prefix", ...props });
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
InputGroupPrefix.displayName = "XAUI.InputGroup.Prefix";
|
|
96
|
+
|
|
97
|
+
// src/components/input-group/input-group-suffix.tsx
|
|
98
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
99
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
100
|
+
var InputGroupSuffix = forwardRef4(
|
|
101
|
+
function InputGroupSuffix2(props, ref) {
|
|
102
|
+
return /* @__PURE__ */ jsx5(InputGroupDecorator, { ref, side: "suffix", ...props });
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
InputGroupSuffix.displayName = "XAUI.InputGroup.Suffix";
|
|
106
|
+
|
|
107
|
+
// src/components/input-group/input-group.tsx
|
|
108
|
+
import { forwardRef as forwardRef5, useMemo as useMemo2, useState } from "react";
|
|
109
|
+
import { View as View2 } from "react-native";
|
|
110
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
111
|
+
var InputGroupRoot = forwardRef5(function InputGroup({ children, asChild = false, style, ...props }, ref) {
|
|
112
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
113
|
+
const [prefixWidth, setPrefixWidth] = useState(0);
|
|
114
|
+
const [suffixWidth, setSuffixWidth] = useState(0);
|
|
115
|
+
const context = useMemo2(
|
|
116
|
+
() => ({ prefixWidth, suffixWidth, setPrefixWidth, setSuffixWidth }),
|
|
117
|
+
[prefixWidth, suffixWidth]
|
|
118
|
+
);
|
|
119
|
+
const rootStyle = [styleProps, style];
|
|
120
|
+
const surface = asChild ? (
|
|
121
|
+
// R12 — the caller's element *is* the row.
|
|
122
|
+
/* @__PURE__ */ jsx6(Slot, { ref, ...rest, style: rootStyle, children })
|
|
123
|
+
) : /* @__PURE__ */ jsx6(View2, { ref, ...rest, style: rootStyle, children });
|
|
124
|
+
return /* @__PURE__ */ jsx6(InputGroupProvider, { value: context, children: surface });
|
|
125
|
+
});
|
|
126
|
+
InputGroupRoot.displayName = "XAUI.InputGroup.Root";
|
|
127
|
+
|
|
128
|
+
// src/components/input-group/index.ts
|
|
129
|
+
var InputGroup2 = Object.assign(InputGroupRoot, {
|
|
130
|
+
Prefix: InputGroupPrefix,
|
|
131
|
+
Field: InputGroupField,
|
|
132
|
+
Suffix: InputGroupSuffix,
|
|
133
|
+
Icon: InputGroupIcon
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export {
|
|
137
|
+
useInputGroup,
|
|
138
|
+
decoratorPadding,
|
|
139
|
+
InputGroupField,
|
|
140
|
+
InputGroupIcon,
|
|
141
|
+
InputGroupPrefix,
|
|
142
|
+
InputGroupSuffix,
|
|
143
|
+
InputGroupRoot,
|
|
144
|
+
InputGroup2 as InputGroup
|
|
145
|
+
};
|