@xaui/native 0.9.1-alpha.24 → 0.9.1-alpha.25
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-6RO26ORT.js → chunk-2OY76YNB.js} +44 -10
- package/dist/{chunk-LIQTGAI7.cjs → chunk-BULNTP5N.cjs} +6 -7
- package/dist/chunk-GSEK6OCY.cjs +72 -0
- package/dist/{chunk-J4QE34AU.js → chunk-I6UCYAO2.js} +20 -21
- package/dist/{chunk-GBPWTFTU.cjs → chunk-OHEHPQLC.cjs} +10 -1
- package/dist/{chunk-GG2WWCBK.js → chunk-TZG3DERP.js} +10 -1
- package/dist/{chunk-P2XA4DV7.cjs → chunk-YEW5LPWL.cjs} +45 -11
- package/dist/chunk-ZDCGPK5Z.js +72 -0
- package/dist/components/input/index.cjs +12 -2
- package/dist/components/input/index.d.cts +109 -117
- package/dist/components/input/index.d.ts +109 -117
- package/dist/components/input/index.js +11 -1
- package/dist/components/input-otp/index.cjs +2 -2
- package/dist/components/input-otp/index.js +1 -1
- package/dist/components/text-area/index.cjs +13 -0
- package/dist/components/text-area/index.d.cts +73 -0
- package/dist/components/text-area/index.d.ts +73 -0
- package/dist/components/text-area/index.js +13 -0
- package/dist/index.cjs +22 -6
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +27 -11
- package/dist/input.type-BpJeUIe8.d.cts +151 -0
- package/dist/input.type-DjyZ6P2C.d.ts +151 -0
- package/dist/theme/index.cjs +2 -2
- package/dist/theme/index.js +1 -1
- package/package.json +11 -1
|
@@ -127,6 +127,7 @@ var SLOTS = [
|
|
|
127
127
|
"root",
|
|
128
128
|
"label",
|
|
129
129
|
"field",
|
|
130
|
+
"textArea",
|
|
130
131
|
"placeholder",
|
|
131
132
|
"description",
|
|
132
133
|
"error"
|
|
@@ -155,7 +156,7 @@ var VARIANT_TOKENS = {
|
|
|
155
156
|
ghost: { borderFocus: "fieldBorderFocus", fg: "fieldForeground" }
|
|
156
157
|
};
|
|
157
158
|
function sizeAxis(step) {
|
|
158
|
-
const { control, padding, gap, field, label, help } = step;
|
|
159
|
+
const { control, padding, gap, field, label, help, textAreaPadding } = step;
|
|
159
160
|
return (theme) => {
|
|
160
161
|
const inset = { paddingHorizontal: theme.spacing(LABEL_INSET) };
|
|
161
162
|
const helpType = {
|
|
@@ -174,6 +175,15 @@ function sizeAxis(step) {
|
|
|
174
175
|
paddingHorizontal: theme.spacing(padding),
|
|
175
176
|
fontSize: theme.fontSizes[field]
|
|
176
177
|
},
|
|
178
|
+
// Only what a multiline field *adds* — `Input.TextArea` layers this over the field's
|
|
179
|
+
// own style rather than restating it, so the colours, the border and the radius are
|
|
180
|
+
// resolved once for both. The height is not here: `rows` is a raw value, and the
|
|
181
|
+
// slot computes it from the two numbers below.
|
|
182
|
+
textArea: {
|
|
183
|
+
lineHeight: theme.lineHeights[field],
|
|
184
|
+
paddingTop: theme.spacing(textAreaPadding),
|
|
185
|
+
paddingBottom: theme.spacing(textAreaPadding)
|
|
186
|
+
},
|
|
177
187
|
description: { ...inset, ...helpType },
|
|
178
188
|
error: { ...inset, ...helpType }
|
|
179
189
|
};
|
|
@@ -184,38 +194,42 @@ var SIZES = {
|
|
|
184
194
|
xs: {
|
|
185
195
|
control: "xs",
|
|
186
196
|
padding: 2.5,
|
|
187
|
-
gap:
|
|
197
|
+
gap: 0.75,
|
|
188
198
|
field: "sm",
|
|
189
199
|
label: "sm",
|
|
190
200
|
help: "xs",
|
|
191
|
-
labelInside: "xs"
|
|
201
|
+
labelInside: "xs",
|
|
202
|
+
textAreaPadding: 1.5
|
|
192
203
|
},
|
|
193
204
|
sm: {
|
|
194
205
|
control: "sm",
|
|
195
206
|
padding: 3,
|
|
196
|
-
gap:
|
|
207
|
+
gap: 0.75,
|
|
197
208
|
field: "md",
|
|
198
209
|
label: "sm",
|
|
199
210
|
help: "xs",
|
|
200
|
-
labelInside: "xs"
|
|
211
|
+
labelInside: "xs",
|
|
212
|
+
textAreaPadding: 2
|
|
201
213
|
},
|
|
202
214
|
md: {
|
|
203
215
|
control: "md",
|
|
204
216
|
padding: 3,
|
|
205
|
-
gap: 1.
|
|
217
|
+
gap: 1.25,
|
|
206
218
|
field: "md",
|
|
207
219
|
label: "md",
|
|
208
220
|
help: "sm",
|
|
209
|
-
labelInside: "xs"
|
|
221
|
+
labelInside: "xs",
|
|
222
|
+
textAreaPadding: 2
|
|
210
223
|
},
|
|
211
224
|
lg: {
|
|
212
225
|
control: "lg",
|
|
213
226
|
padding: 4,
|
|
214
|
-
gap:
|
|
227
|
+
gap: 1.75,
|
|
215
228
|
field: "lg",
|
|
216
229
|
label: "lg",
|
|
217
230
|
help: "md",
|
|
218
|
-
labelInside: "sm"
|
|
231
|
+
labelInside: "sm",
|
|
232
|
+
textAreaPadding: 2.5
|
|
219
233
|
}
|
|
220
234
|
};
|
|
221
235
|
function insideLabel(step) {
|
|
@@ -245,7 +259,10 @@ function insideLabel(step) {
|
|
|
245
259
|
),
|
|
246
260
|
paddingTop: block,
|
|
247
261
|
paddingBottom: top
|
|
248
|
-
}
|
|
262
|
+
},
|
|
263
|
+
// The same room, because `Input.TextArea` layers its own padding over the field's
|
|
264
|
+
// and would otherwise put the first line back under the label.
|
|
265
|
+
textArea: { paddingTop: block, paddingBottom: top }
|
|
249
266
|
};
|
|
250
267
|
};
|
|
251
268
|
}
|
|
@@ -266,12 +283,16 @@ var inputRecipe = createRecipe({
|
|
|
266
283
|
borderWidth: theme.borderWidth.field,
|
|
267
284
|
// The theme has a radius named for this component, so every size uses it and the
|
|
268
285
|
// `radius` axis is what overrides it — the same shape a `Chip` takes from `full`.
|
|
286
|
+
// It is HeroUI's twelve points since the scale was aligned on theirs; it was 21,
|
|
287
|
+
// which put a 48-tall field at 87% of its geometric maximum.
|
|
269
288
|
borderRadius: theme.radius.field,
|
|
270
289
|
borderCurve: "continuous",
|
|
271
290
|
// RN centres a single line inside `minHeight` on iOS and pins it to the top on
|
|
272
291
|
// Android. Saying it removes a difference nobody chose.
|
|
273
292
|
textAlignVertical: "center"
|
|
274
293
|
},
|
|
294
|
+
// Several lines start at the top; only a single line is centred in its box.
|
|
295
|
+
textArea: { textAlignVertical: "top" },
|
|
275
296
|
// Not a node — the root flattens this one into `placeholderTextColor`, which is a
|
|
276
297
|
// `TextInput` prop rather than a style.
|
|
277
298
|
placeholder: { color: theme.colors.fieldPlaceholder },
|
|
@@ -402,9 +423,17 @@ var InputRoot = forwardRef5(function Input({
|
|
|
402
423
|
const tint = color ? inputRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
403
424
|
const context = useMemo(() => {
|
|
404
425
|
const placeholder = StyleSheet.flatten(styles.placeholder);
|
|
426
|
+
const textArea = StyleSheet.flatten(styles.textArea);
|
|
405
427
|
return {
|
|
406
428
|
labelStyle: tint ? [styles.label, tint.label] : styles.label,
|
|
407
429
|
fieldStyle: tint ? [styles.field, tint.field] : styles.field,
|
|
430
|
+
textAreaStyle: styles.textArea,
|
|
431
|
+
textArea: {
|
|
432
|
+
lineHeight: textArea.lineHeight ?? 0,
|
|
433
|
+
// `DimensionValue` also covers a percentage and `auto`, neither of which can be
|
|
434
|
+
// multiplied by a number of rows. The recipe only ever writes points here.
|
|
435
|
+
paddingVertical: typeof textArea.paddingBottom === "number" ? textArea.paddingBottom : 0
|
|
436
|
+
},
|
|
408
437
|
descriptionStyle: styles.description,
|
|
409
438
|
errorStyle: styles.error,
|
|
410
439
|
// `ColorValue` also covers the platform's opaque colours, which `TextInput` cannot
|
|
@@ -446,6 +475,11 @@ var Input2 = Object.assign(InputRoot, {
|
|
|
446
475
|
|
|
447
476
|
export {
|
|
448
477
|
useInput,
|
|
478
|
+
InputDescription,
|
|
479
|
+
InputError,
|
|
480
|
+
InputField,
|
|
481
|
+
InputLabel,
|
|
449
482
|
inputRecipe,
|
|
483
|
+
InputRoot,
|
|
450
484
|
Input2 as Input
|
|
451
485
|
};
|
|
@@ -372,13 +372,12 @@ var inputOTPRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
|
|
|
372
372
|
box: {
|
|
373
373
|
alignItems: "center",
|
|
374
374
|
justifyContent: "center",
|
|
375
|
-
// `lg` and not `field`,
|
|
376
|
-
//
|
|
377
|
-
//
|
|
378
|
-
//
|
|
379
|
-
//
|
|
380
|
-
//
|
|
381
|
-
// ours is 12.
|
|
375
|
+
// `lg` and not `field`, though the two are the same twelve points at the default
|
|
376
|
+
// base. The keys are kept apart on purpose: `field` is the corner a theme moves when
|
|
377
|
+
// it wants rounder *fields*, and a field is wide — a code box is very nearly square,
|
|
378
|
+
// 44 by 48 at `md`, where the geometric maximum is 22 and anything near it is a pill
|
|
379
|
+
// in all but name. Following `field` here would hand this component a shape that was
|
|
380
|
+
// never decided for it.
|
|
382
381
|
borderRadius: theme.radius.lg,
|
|
383
382
|
borderCurve: "continuous",
|
|
384
383
|
// The one root in the library that clips: the box has no shadow to lose and a
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkYEW5LPWLcjs = require('./chunk-YEW5LPWL.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
13
|
+
|
|
14
|
+
// src/components/text-area/text-area-field.tsx
|
|
15
|
+
var _react = require('react');
|
|
16
|
+
|
|
17
|
+
// src/components/text-area/text-area.context.ts
|
|
18
|
+
var [TextAreaProvider, useTextArea] = _chunkHUZ4AUM2cjs.createSlotContext.call(void 0, "TextArea");
|
|
19
|
+
|
|
20
|
+
// src/components/text-area/text-area-field.tsx
|
|
21
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
22
|
+
var TextAreaField = _react.forwardRef.call(void 0,
|
|
23
|
+
function TextAreaField2({ style, scrollEnabled, ...props }, ref) {
|
|
24
|
+
const { textAreaStyle, textArea } = _chunkYEW5LPWLcjs.useInput.call(void 0, );
|
|
25
|
+
const { rows, maxRows } = useTextArea();
|
|
26
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
27
|
+
const height = _react.useMemo.call(void 0, () => {
|
|
28
|
+
const chrome = textArea.paddingVertical * 2;
|
|
29
|
+
return {
|
|
30
|
+
minHeight: rows * textArea.lineHeight + chrome,
|
|
31
|
+
// Unset, the field grows for as long as the text does. With a ceiling it stops
|
|
32
|
+
// there and scrolls, which is the only case that needs `scrollEnabled` — a
|
|
33
|
+
// multiline field that can grow has nothing to scroll.
|
|
34
|
+
maxHeight: maxRows ? maxRows * textArea.lineHeight + chrome : void 0
|
|
35
|
+
};
|
|
36
|
+
}, [rows, maxRows, textArea]);
|
|
37
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
38
|
+
_chunkYEW5LPWLcjs.InputField,
|
|
39
|
+
{
|
|
40
|
+
ref,
|
|
41
|
+
multiline: true,
|
|
42
|
+
scrollEnabled: _nullishCoalesce(scrollEnabled, () => ( maxRows !== void 0)),
|
|
43
|
+
...rest,
|
|
44
|
+
style: [textAreaStyle, height, styleProps, style]
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
TextAreaField.displayName = "XAUI.TextArea.Field";
|
|
50
|
+
|
|
51
|
+
// src/components/text-area/text-area.tsx
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
var DEFAULT_ROWS = 3;
|
|
55
|
+
var TextAreaRoot = _react.forwardRef.call(void 0, function TextArea({ rows = DEFAULT_ROWS, maxRows, children, ...props }, ref) {
|
|
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, _chunkYEW5LPWLcjs.InputRoot, { ref, ...props, children }) });
|
|
58
|
+
});
|
|
59
|
+
TextAreaRoot.displayName = "XAUI.TextArea.Root";
|
|
60
|
+
|
|
61
|
+
// src/components/text-area/index.ts
|
|
62
|
+
var TextArea2 = Object.assign(TextAreaRoot, {
|
|
63
|
+
Label: _chunkYEW5LPWLcjs.InputLabel,
|
|
64
|
+
Field: TextAreaField,
|
|
65
|
+
Description: _chunkYEW5LPWLcjs.InputDescription,
|
|
66
|
+
Error: _chunkYEW5LPWLcjs.InputError
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
exports.useTextArea = useTextArea; exports.TextArea = TextArea2;
|
|
@@ -39,10 +39,10 @@ function InputOTPCaret({
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
InputOTPCaret.displayName = "XAUI.InputOTP.Caret";
|
|
42
|
-
const
|
|
43
|
-
code: "function
|
|
44
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-
|
|
45
|
-
sourceMap: "{\"version\":3,\"names\":[\"
|
|
42
|
+
const _worklet_4103709998384_init_data = {
|
|
43
|
+
code: "function chunkI6UCYAO2Js1(){const{opacity}=this.__closure;return{opacity:opacity.value};}",
|
|
44
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-I6UCYAO2.js",
|
|
45
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkI6UCYAO2Js1\",\"opacity\",\"__closure\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-I6UCYAO2.js\"],\"mappings\":\"AA4DyC,SAAAA,iBAAA,QAAAC,OAAA,OAAAC,SAAA,OAAO,CAAED,OAAO,CAAEA,OAAO,CAACE,KAAM,CAAC\",\"ignoreList\":[]}"
|
|
46
46
|
};
|
|
47
47
|
function BlinkingCaret({
|
|
48
48
|
style
|
|
@@ -55,24 +55,24 @@ function BlinkingCaret({
|
|
|
55
55
|
}), -1, true);
|
|
56
56
|
return () => cancelAnimation(opacity);
|
|
57
57
|
}, [opacity]);
|
|
58
|
-
const animatedStyle = useAnimatedStyle(function
|
|
59
|
-
|
|
58
|
+
const animatedStyle = useAnimatedStyle(function chunkI6UCYAO2Js1Factory({
|
|
59
|
+
_worklet_4103709998384_init_data,
|
|
60
60
|
opacity
|
|
61
61
|
}) {
|
|
62
62
|
const _e = [new global.Error(), -2, -27];
|
|
63
|
-
const
|
|
63
|
+
const chunkI6UCYAO2Js1 = () => ({
|
|
64
64
|
opacity: opacity.value
|
|
65
65
|
});
|
|
66
|
-
|
|
66
|
+
chunkI6UCYAO2Js1.__closure = {
|
|
67
67
|
opacity
|
|
68
68
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return
|
|
69
|
+
chunkI6UCYAO2Js1.__workletHash = 4103709998384;
|
|
70
|
+
chunkI6UCYAO2Js1.__pluginVersion = "0.7.4";
|
|
71
|
+
chunkI6UCYAO2Js1.__initData = _worklet_4103709998384_init_data;
|
|
72
|
+
chunkI6UCYAO2Js1.__stackDetails = _e;
|
|
73
|
+
return chunkI6UCYAO2Js1;
|
|
74
74
|
}({
|
|
75
|
-
|
|
75
|
+
_worklet_4103709998384_init_data,
|
|
76
76
|
opacity
|
|
77
77
|
}));
|
|
78
78
|
return /* @__PURE__ */jsx(Animated.View, {
|
|
@@ -474,13 +474,12 @@ var inputOTPRecipe = createRecipe({
|
|
|
474
474
|
box: {
|
|
475
475
|
alignItems: "center",
|
|
476
476
|
justifyContent: "center",
|
|
477
|
-
// `lg` and not `field`,
|
|
478
|
-
//
|
|
479
|
-
//
|
|
480
|
-
//
|
|
481
|
-
//
|
|
482
|
-
//
|
|
483
|
-
// ours is 12.
|
|
477
|
+
// `lg` and not `field`, though the two are the same twelve points at the default
|
|
478
|
+
// base. The keys are kept apart on purpose: `field` is the corner a theme moves when
|
|
479
|
+
// it wants rounder *fields*, and a field is wide — a code box is very nearly square,
|
|
480
|
+
// 44 by 48 at `md`, where the geometric maximum is 22 and anything near it is a pill
|
|
481
|
+
// in all but name. Following `field` here would hand this component a shape that was
|
|
482
|
+
// never decided for it.
|
|
484
483
|
borderRadius: theme.radius.lg,
|
|
485
484
|
borderCurve: "continuous",
|
|
486
485
|
// The one root in the library that clips: the box has no shadow to lose and a
|
|
@@ -62,7 +62,16 @@ function buildRadius(base) {
|
|
|
62
62
|
"2xl": base * 2,
|
|
63
63
|
"3xl": base * 3,
|
|
64
64
|
"4xl": base * 4,
|
|
65
|
-
|
|
65
|
+
/**
|
|
66
|
+
* HeroUI's value, reached from the other side of the scale: their `--radius-field` is
|
|
67
|
+
* an alias of their `--radius-xl`, and their base is 8 where ours is 12 — so their
|
|
68
|
+
* field corner is 12 points and, at our default base, so is this.
|
|
69
|
+
*
|
|
70
|
+
* It coincides with `lg` today and is still its own key, because that is what lets a
|
|
71
|
+
* theme round its fields without rounding its cards. It was `base * 1.75`, which put a
|
|
72
|
+
* 48-tall field at 87% of its geometric maximum — a gélule rather than a rounded box.
|
|
73
|
+
*/
|
|
74
|
+
field: base,
|
|
66
75
|
full: 9999
|
|
67
76
|
};
|
|
68
77
|
}
|
|
@@ -62,7 +62,16 @@ function buildRadius(base) {
|
|
|
62
62
|
"2xl": base * 2,
|
|
63
63
|
"3xl": base * 3,
|
|
64
64
|
"4xl": base * 4,
|
|
65
|
-
|
|
65
|
+
/**
|
|
66
|
+
* HeroUI's value, reached from the other side of the scale: their `--radius-field` is
|
|
67
|
+
* an alias of their `--radius-xl`, and their base is 8 where ours is 12 — so their
|
|
68
|
+
* field corner is 12 points and, at our default base, so is this.
|
|
69
|
+
*
|
|
70
|
+
* It coincides with `lg` today and is still its own key, because that is what lets a
|
|
71
|
+
* theme round its fields without rounding its cards. It was `base * 1.75`, which put a
|
|
72
|
+
* 48-tall field at 87% of its geometric maximum — a gélule rather than a rounded box.
|
|
73
|
+
*/
|
|
74
|
+
field: base,
|
|
66
75
|
full: 9999
|
|
67
76
|
};
|
|
68
77
|
}
|
|
@@ -127,6 +127,7 @@ var SLOTS = [
|
|
|
127
127
|
"root",
|
|
128
128
|
"label",
|
|
129
129
|
"field",
|
|
130
|
+
"textArea",
|
|
130
131
|
"placeholder",
|
|
131
132
|
"description",
|
|
132
133
|
"error"
|
|
@@ -155,7 +156,7 @@ var VARIANT_TOKENS = {
|
|
|
155
156
|
ghost: { borderFocus: "fieldBorderFocus", fg: "fieldForeground" }
|
|
156
157
|
};
|
|
157
158
|
function sizeAxis(step) {
|
|
158
|
-
const { control, padding, gap, field, label, help } = step;
|
|
159
|
+
const { control, padding, gap, field, label, help, textAreaPadding } = step;
|
|
159
160
|
return (theme) => {
|
|
160
161
|
const inset = { paddingHorizontal: theme.spacing(LABEL_INSET) };
|
|
161
162
|
const helpType = {
|
|
@@ -174,6 +175,15 @@ function sizeAxis(step) {
|
|
|
174
175
|
paddingHorizontal: theme.spacing(padding),
|
|
175
176
|
fontSize: theme.fontSizes[field]
|
|
176
177
|
},
|
|
178
|
+
// Only what a multiline field *adds* — `Input.TextArea` layers this over the field's
|
|
179
|
+
// own style rather than restating it, so the colours, the border and the radius are
|
|
180
|
+
// resolved once for both. The height is not here: `rows` is a raw value, and the
|
|
181
|
+
// slot computes it from the two numbers below.
|
|
182
|
+
textArea: {
|
|
183
|
+
lineHeight: theme.lineHeights[field],
|
|
184
|
+
paddingTop: theme.spacing(textAreaPadding),
|
|
185
|
+
paddingBottom: theme.spacing(textAreaPadding)
|
|
186
|
+
},
|
|
177
187
|
description: { ...inset, ...helpType },
|
|
178
188
|
error: { ...inset, ...helpType }
|
|
179
189
|
};
|
|
@@ -184,38 +194,42 @@ var SIZES = {
|
|
|
184
194
|
xs: {
|
|
185
195
|
control: "xs",
|
|
186
196
|
padding: 2.5,
|
|
187
|
-
gap:
|
|
197
|
+
gap: 0.75,
|
|
188
198
|
field: "sm",
|
|
189
199
|
label: "sm",
|
|
190
200
|
help: "xs",
|
|
191
|
-
labelInside: "xs"
|
|
201
|
+
labelInside: "xs",
|
|
202
|
+
textAreaPadding: 1.5
|
|
192
203
|
},
|
|
193
204
|
sm: {
|
|
194
205
|
control: "sm",
|
|
195
206
|
padding: 3,
|
|
196
|
-
gap:
|
|
207
|
+
gap: 0.75,
|
|
197
208
|
field: "md",
|
|
198
209
|
label: "sm",
|
|
199
210
|
help: "xs",
|
|
200
|
-
labelInside: "xs"
|
|
211
|
+
labelInside: "xs",
|
|
212
|
+
textAreaPadding: 2
|
|
201
213
|
},
|
|
202
214
|
md: {
|
|
203
215
|
control: "md",
|
|
204
216
|
padding: 3,
|
|
205
|
-
gap: 1.
|
|
217
|
+
gap: 1.25,
|
|
206
218
|
field: "md",
|
|
207
219
|
label: "md",
|
|
208
220
|
help: "sm",
|
|
209
|
-
labelInside: "xs"
|
|
221
|
+
labelInside: "xs",
|
|
222
|
+
textAreaPadding: 2
|
|
210
223
|
},
|
|
211
224
|
lg: {
|
|
212
225
|
control: "lg",
|
|
213
226
|
padding: 4,
|
|
214
|
-
gap:
|
|
227
|
+
gap: 1.75,
|
|
215
228
|
field: "lg",
|
|
216
229
|
label: "lg",
|
|
217
230
|
help: "md",
|
|
218
|
-
labelInside: "sm"
|
|
231
|
+
labelInside: "sm",
|
|
232
|
+
textAreaPadding: 2.5
|
|
219
233
|
}
|
|
220
234
|
};
|
|
221
235
|
function insideLabel(step) {
|
|
@@ -245,7 +259,10 @@ function insideLabel(step) {
|
|
|
245
259
|
),
|
|
246
260
|
paddingTop: block,
|
|
247
261
|
paddingBottom: top
|
|
248
|
-
}
|
|
262
|
+
},
|
|
263
|
+
// The same room, because `Input.TextArea` layers its own padding over the field's
|
|
264
|
+
// and would otherwise put the first line back under the label.
|
|
265
|
+
textArea: { paddingTop: block, paddingBottom: top }
|
|
249
266
|
};
|
|
250
267
|
};
|
|
251
268
|
}
|
|
@@ -266,12 +283,16 @@ var inputRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
|
|
|
266
283
|
borderWidth: theme.borderWidth.field,
|
|
267
284
|
// The theme has a radius named for this component, so every size uses it and the
|
|
268
285
|
// `radius` axis is what overrides it — the same shape a `Chip` takes from `full`.
|
|
286
|
+
// It is HeroUI's twelve points since the scale was aligned on theirs; it was 21,
|
|
287
|
+
// which put a 48-tall field at 87% of its geometric maximum.
|
|
269
288
|
borderRadius: theme.radius.field,
|
|
270
289
|
borderCurve: "continuous",
|
|
271
290
|
// RN centres a single line inside `minHeight` on iOS and pins it to the top on
|
|
272
291
|
// Android. Saying it removes a difference nobody chose.
|
|
273
292
|
textAlignVertical: "center"
|
|
274
293
|
},
|
|
294
|
+
// Several lines start at the top; only a single line is centred in its box.
|
|
295
|
+
textArea: { textAlignVertical: "top" },
|
|
275
296
|
// Not a node — the root flattens this one into `placeholderTextColor`, which is a
|
|
276
297
|
// `TextInput` prop rather than a style.
|
|
277
298
|
placeholder: { color: theme.colors.fieldPlaceholder },
|
|
@@ -402,9 +423,17 @@ var InputRoot = _react.forwardRef.call(void 0, function Input({
|
|
|
402
423
|
const tint = color ? inputRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
403
424
|
const context = _react.useMemo.call(void 0, () => {
|
|
404
425
|
const placeholder = _reactnative.StyleSheet.flatten(styles.placeholder);
|
|
426
|
+
const textArea = _reactnative.StyleSheet.flatten(styles.textArea);
|
|
405
427
|
return {
|
|
406
428
|
labelStyle: tint ? [styles.label, tint.label] : styles.label,
|
|
407
429
|
fieldStyle: tint ? [styles.field, tint.field] : styles.field,
|
|
430
|
+
textAreaStyle: styles.textArea,
|
|
431
|
+
textArea: {
|
|
432
|
+
lineHeight: _nullishCoalesce(textArea.lineHeight, () => ( 0)),
|
|
433
|
+
// `DimensionValue` also covers a percentage and `auto`, neither of which can be
|
|
434
|
+
// multiplied by a number of rows. The recipe only ever writes points here.
|
|
435
|
+
paddingVertical: typeof textArea.paddingBottom === "number" ? textArea.paddingBottom : 0
|
|
436
|
+
},
|
|
408
437
|
descriptionStyle: styles.description,
|
|
409
438
|
errorStyle: styles.error,
|
|
410
439
|
// `ColorValue` also covers the platform's opaque colours, which `TextInput` cannot
|
|
@@ -448,4 +477,9 @@ var Input2 = Object.assign(InputRoot, {
|
|
|
448
477
|
|
|
449
478
|
|
|
450
479
|
|
|
451
|
-
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
exports.useInput = useInput; exports.InputDescription = InputDescription; exports.InputError = InputError; exports.InputField = InputField; exports.InputLabel = InputLabel; exports.inputRecipe = inputRecipe; exports.InputRoot = InputRoot; exports.Input = Input2;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InputDescription,
|
|
3
|
+
InputError,
|
|
4
|
+
InputField,
|
|
5
|
+
InputLabel,
|
|
6
|
+
InputRoot,
|
|
7
|
+
useInput
|
|
8
|
+
} from "./chunk-2OY76YNB.js";
|
|
9
|
+
import {
|
|
10
|
+
createSlotContext,
|
|
11
|
+
useStyleProps
|
|
12
|
+
} from "./chunk-PMO62QK4.js";
|
|
13
|
+
|
|
14
|
+
// src/components/text-area/text-area-field.tsx
|
|
15
|
+
import { forwardRef, useMemo } from "react";
|
|
16
|
+
|
|
17
|
+
// src/components/text-area/text-area.context.ts
|
|
18
|
+
var [TextAreaProvider, useTextArea] = createSlotContext("TextArea");
|
|
19
|
+
|
|
20
|
+
// src/components/text-area/text-area-field.tsx
|
|
21
|
+
import { jsx } from "react/jsx-runtime";
|
|
22
|
+
var TextAreaField = forwardRef(
|
|
23
|
+
function TextAreaField2({ style, scrollEnabled, ...props }, ref) {
|
|
24
|
+
const { textAreaStyle, textArea } = useInput();
|
|
25
|
+
const { rows, maxRows } = useTextArea();
|
|
26
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
27
|
+
const height = useMemo(() => {
|
|
28
|
+
const chrome = textArea.paddingVertical * 2;
|
|
29
|
+
return {
|
|
30
|
+
minHeight: rows * textArea.lineHeight + chrome,
|
|
31
|
+
// Unset, the field grows for as long as the text does. With a ceiling it stops
|
|
32
|
+
// there and scrolls, which is the only case that needs `scrollEnabled` — a
|
|
33
|
+
// multiline field that can grow has nothing to scroll.
|
|
34
|
+
maxHeight: maxRows ? maxRows * textArea.lineHeight + chrome : void 0
|
|
35
|
+
};
|
|
36
|
+
}, [rows, maxRows, textArea]);
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
InputField,
|
|
39
|
+
{
|
|
40
|
+
ref,
|
|
41
|
+
multiline: true,
|
|
42
|
+
scrollEnabled: scrollEnabled ?? maxRows !== void 0,
|
|
43
|
+
...rest,
|
|
44
|
+
style: [textAreaStyle, height, styleProps, style]
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
TextAreaField.displayName = "XAUI.TextArea.Field";
|
|
50
|
+
|
|
51
|
+
// src/components/text-area/text-area.tsx
|
|
52
|
+
import { forwardRef as forwardRef2, useMemo as useMemo2 } from "react";
|
|
53
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
54
|
+
var DEFAULT_ROWS = 3;
|
|
55
|
+
var TextAreaRoot = forwardRef2(function TextArea({ rows = DEFAULT_ROWS, maxRows, children, ...props }, ref) {
|
|
56
|
+
const context = useMemo2(() => ({ rows, maxRows }), [rows, maxRows]);
|
|
57
|
+
return /* @__PURE__ */ jsx2(TextAreaProvider, { value: context, children: /* @__PURE__ */ jsx2(InputRoot, { ref, ...props, children }) });
|
|
58
|
+
});
|
|
59
|
+
TextAreaRoot.displayName = "XAUI.TextArea.Root";
|
|
60
|
+
|
|
61
|
+
// src/components/text-area/index.ts
|
|
62
|
+
var TextArea2 = Object.assign(TextAreaRoot, {
|
|
63
|
+
Label: InputLabel,
|
|
64
|
+
Field: TextAreaField,
|
|
65
|
+
Description: InputDescription,
|
|
66
|
+
Error: InputError
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
useTextArea,
|
|
71
|
+
TextArea2 as TextArea
|
|
72
|
+
};
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkYEW5LPWLcjs = require('../../chunk-YEW5LPWL.cjs');
|
|
6
11
|
require('../../chunk-YXVKQMCK.cjs');
|
|
7
12
|
require('../../chunk-HUZ4AUM2.cjs');
|
|
8
13
|
require('../../chunk-57SJ4LJF.cjs');
|
|
@@ -11,4 +16,9 @@ require('../../chunk-MC7SY2QH.cjs');
|
|
|
11
16
|
|
|
12
17
|
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.Input = _chunkYEW5LPWLcjs.Input; exports.InputDescription = _chunkYEW5LPWLcjs.InputDescription; exports.InputError = _chunkYEW5LPWLcjs.InputError; exports.InputField = _chunkYEW5LPWLcjs.InputField; exports.InputLabel = _chunkYEW5LPWLcjs.InputLabel; exports.InputRoot = _chunkYEW5LPWLcjs.InputRoot; exports.inputRecipe = _chunkYEW5LPWLcjs.inputRecipe; exports.useInput = _chunkYEW5LPWLcjs.useInput;
|