@kanso-labs/react-native-kanso-ui 0.7.0 → 0.9.0
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/README.md +37 -0
- package/dist/badge/index.js +9 -68
- package/dist/badge/index.js.map +1 -1
- package/dist/button/index.d.ts +2 -1
- package/dist/button/index.js +1 -1
- package/dist/button/index.js.map +1 -1
- package/dist/button/palettes.d.ts +2 -0
- package/dist/button/pending.js +17 -21
- package/dist/button/pending.js.map +1 -1
- package/dist/calendar/index.js +1 -1
- package/dist/components/autocomplete/index.js +28 -26
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/avatar/index.js +2 -2
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +48 -0
- package/dist/components/badge/index.js +122 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/{badge → components/badge}/styles.js +10 -6
- package/dist/components/badge/styles.js.map +1 -0
- package/dist/components/breadcrumbs/index.d.ts +66 -0
- package/dist/components/breadcrumbs/index.js +285 -0
- package/dist/components/breadcrumbs/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +1 -1
- package/dist/components/calendar/index.js +77 -38
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +7 -1
- package/dist/components/checkbox/index.js +183 -138
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.d.ts +93 -0
- package/dist/components/checkbox-group/index.js +306 -0
- package/dist/components/checkbox-group/index.js.map +1 -0
- package/dist/components/chip-group/index.d.ts +4 -3
- package/dist/components/chip-group/index.js +47 -45
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/code/index.d.ts +25 -0
- package/dist/components/code/index.js +87 -0
- package/dist/components/code/index.js.map +1 -0
- package/dist/components/container/index.d.ts +47 -0
- package/dist/components/container/index.js +85 -0
- package/dist/components/container/index.js.map +1 -0
- package/dist/components/copy-field/index.d.ts +5 -5
- package/dist/components/copy-field/index.js +30 -28
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/currency/index.d.ts +2 -2
- package/dist/components/currency/index.js +3 -1
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/fab/index.d.ts +80 -0
- package/dist/components/fab/index.js +231 -0
- package/dist/components/fab/index.js.map +1 -0
- package/dist/components/fab-menu/index.d.ts +120 -0
- package/dist/components/fab-menu/index.js +640 -0
- package/dist/components/fab-menu/index.js.map +1 -0
- package/dist/components/feed/index.d.ts +57 -0
- package/dist/components/feed/index.js +167 -0
- package/dist/components/feed/index.js.map +1 -0
- package/dist/components/keycap/index.d.ts +27 -0
- package/dist/components/keycap/index.js +136 -0
- package/dist/components/keycap/index.js.map +1 -0
- package/dist/components/list/index.d.ts +6 -5
- package/dist/components/list/index.js +97 -106
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +4 -3
- package/dist/components/menu/index.js +33 -40
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +2 -1
- package/dist/components/meter/index.js +9 -7
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +7 -3
- package/dist/components/number-field/index.js +214 -192
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/product-icon/index.d.ts +2 -2
- package/dist/components/product-icon/index.js +2 -2
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/progress-indicator/index.d.ts +2 -1
- package/dist/components/progress-indicator/index.js +15 -13
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +3 -3
- package/dist/components/search-field/index.js +105 -104
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/separator/index.d.ts +3 -2
- package/dist/components/separator/index.js +29 -26
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +2 -2
- package/dist/components/sheet/index.js +22 -26
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +3 -3
- package/dist/components/snackbar/index.js +36 -34
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/supporting-pane/index.d.ts +44 -0
- package/dist/components/supporting-pane/index.js +109 -0
- package/dist/components/supporting-pane/index.js.map +1 -0
- package/dist/components/tag/index.d.ts +58 -0
- package/dist/components/tag/index.js +205 -0
- package/dist/components/tag/index.js.map +1 -0
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.js +49 -21
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +145 -0
- package/dist/components/text-area/index.js +231 -0
- package/dist/components/text-area/index.js.map +1 -0
- package/dist/components/text-field/index.d.ts +6 -3
- package/dist/components/text-field/index.js +3 -0
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +53 -0
- package/dist/components/toolbar/index.js +185 -0
- package/dist/components/toolbar/index.js.map +1 -0
- package/dist/control/group.js +23 -0
- package/dist/control/group.js.map +1 -0
- package/dist/fab/index.d.ts +19 -0
- package/dist/fab/index.js +147 -0
- package/dist/fab/index.js.map +1 -0
- package/dist/field/index.js +123 -79
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +18 -0
- package/dist/field/styles.js.map +1 -1
- package/dist/form/index.d.ts +1 -2
- package/dist/form/index.js +1 -1
- package/dist/form/index.js.map +1 -1
- package/dist/i18n/index.js +12 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +367 -0
- package/dist/i18n/messages.js.map +1 -1
- package/dist/i18n/provider.d.ts +53 -0
- package/dist/i18n/provider.js +96 -0
- package/dist/i18n/provider.js.map +1 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.js +17 -3
- package/dist/indicator/index.js +1 -2
- package/dist/indicator/index.js.map +1 -1
- package/dist/mark/index.js +77 -117
- package/dist/mark/index.js.map +1 -1
- package/dist/mark/initials.js.map +1 -1
- package/dist/modal/index.js +59 -46
- package/dist/modal/index.js.map +1 -1
- package/dist/navigation/index.js +8 -5
- package/dist/navigation/index.js.map +1 -1
- package/dist/number/count.js +15 -0
- package/dist/number/count.js.map +1 -0
- package/dist/number/locale.js.map +1 -1
- package/dist/overlay/host.js +30 -21
- package/dist/overlay/host.js.map +1 -1
- package/dist/overlay/placement.js +3 -1
- package/dist/overlay/placement.js.map +1 -1
- package/dist/separator/index.js +7 -0
- package/dist/separator/index.js.map +1 -0
- package/dist/typography/size.js +14 -0
- package/dist/typography/size.js.map +1 -0
- package/package.json +1 -1
- package/dist/badge/styles.js.map +0 -1
package/dist/field/index.js
CHANGED
|
@@ -5,6 +5,9 @@ import { usePressFeedback } from "../press/index.js";
|
|
|
5
5
|
import { useFontFamily } from "../typography/fonts.js";
|
|
6
6
|
import { useTypeRole } from "../typography/roles.js";
|
|
7
7
|
import { withOpacity } from "../theme/color.js";
|
|
8
|
+
import { formatCount } from "../number/count.js";
|
|
9
|
+
import { limitFor } from "../i18n/index.js";
|
|
10
|
+
import { useLocaleOf } from "../i18n/provider.js";
|
|
8
11
|
import { useInsideForm } from "../form/index.js";
|
|
9
12
|
import { fieldStylesOf } from "./styles.js";
|
|
10
13
|
import { c } from "react/compiler-runtime";
|
|
@@ -24,14 +27,13 @@ const OUTSIDE_BOX = {
|
|
|
24
27
|
};
|
|
25
28
|
const BoxContext = createContext(OUTSIDE_BOX);
|
|
26
29
|
const NO_PARTS = [];
|
|
27
|
-
let counterFormat;
|
|
28
30
|
/**
|
|
29
31
|
* How a field's control is described by the line under it: the error while
|
|
30
32
|
* there is one, otherwise the description, then the limit where there is a
|
|
31
33
|
* `maxLength`. Hand the result to {@link FieldInput} as `described`, and the
|
|
32
34
|
* same `id` to {@link FieldMessage}.
|
|
33
35
|
*/
|
|
34
|
-
function describedBy(id, { characterLimitLabel, description, error, maxLength }) {
|
|
36
|
+
function describedBy(id, { characterLimitLabel, description, error, locale, maxLength }) {
|
|
35
37
|
const ids = idsOf(id);
|
|
36
38
|
const message = error === void 0 ? {
|
|
37
39
|
id: ids.description,
|
|
@@ -40,7 +42,7 @@ function describedBy(id, { characterLimitLabel, description, error, maxLength })
|
|
|
40
42
|
id: ids.error,
|
|
41
43
|
text: error
|
|
42
44
|
};
|
|
43
|
-
const limit = limitOf(maxLength, characterLimitLabel);
|
|
45
|
+
const limit = limitOf(maxLength, characterLimitLabel, locale);
|
|
44
46
|
return [...message.text === "" ? [] : [message], ...limit === void 0 ? [] : [{
|
|
45
47
|
id: ids.limit,
|
|
46
48
|
text: limit
|
|
@@ -319,31 +321,52 @@ function FieldBox(t0) {
|
|
|
319
321
|
* in `described`, so a reader hears the unit the value is read against as a
|
|
320
322
|
* sighted one sees it beside the value: on iOS and Android as its hint, and
|
|
321
323
|
* under React Native Web through `aria-describedby`, which drops the hint.
|
|
324
|
+
*
|
|
325
|
+
* `multiline` makes it a text area, `rows` lines of body large tall at the
|
|
326
|
+
* least, its text from the top. iOS and Android grow a multi-line input with
|
|
327
|
+
* what it holds by themselves, so a height floor is all `autosize` asks of
|
|
328
|
+
* them, and `autosize={false}` sets the height instead, which they scroll
|
|
329
|
+
* inside. React Native Web's textarea keeps the height it is given, so there
|
|
330
|
+
* the control lies over a hidden copy of `value` that takes the height the
|
|
331
|
+
* text would, as web's text area lies over its replica. A control that grows
|
|
332
|
+
* is therefore handed its `value`.
|
|
322
333
|
*/
|
|
323
334
|
function FieldInput(t0) {
|
|
324
|
-
const $ = c(
|
|
335
|
+
const $ = c(26);
|
|
325
336
|
let prefix;
|
|
326
337
|
let props;
|
|
327
338
|
let suffix;
|
|
328
339
|
let t1;
|
|
329
340
|
let t2;
|
|
341
|
+
let t3;
|
|
342
|
+
let t4;
|
|
343
|
+
let t5;
|
|
330
344
|
if ($[0] !== t0) {
|
|
331
|
-
({
|
|
345
|
+
({autosize: t1, described: t2, multiline: t3, numeric: t4, prefix, rows: t5, suffix, ...props} = t0);
|
|
332
346
|
$[0] = t0;
|
|
333
347
|
$[1] = prefix;
|
|
334
348
|
$[2] = props;
|
|
335
349
|
$[3] = suffix;
|
|
336
350
|
$[4] = t1;
|
|
337
351
|
$[5] = t2;
|
|
352
|
+
$[6] = t3;
|
|
353
|
+
$[7] = t4;
|
|
354
|
+
$[8] = t5;
|
|
338
355
|
} else {
|
|
339
356
|
prefix = $[1];
|
|
340
357
|
props = $[2];
|
|
341
358
|
suffix = $[3];
|
|
342
359
|
t1 = $[4];
|
|
343
360
|
t2 = $[5];
|
|
361
|
+
t3 = $[6];
|
|
362
|
+
t4 = $[7];
|
|
363
|
+
t5 = $[8];
|
|
344
364
|
}
|
|
345
|
-
const
|
|
346
|
-
const
|
|
365
|
+
const autosize = t1 === void 0 ? true : t1;
|
|
366
|
+
const described = t2 === void 0 ? NO_PARTS : t2;
|
|
367
|
+
const multiline = t3 === void 0 ? false : t3;
|
|
368
|
+
const numeric = t4 === void 0 ? false : t4;
|
|
369
|
+
const rows = t5 === void 0 ? 1 : t5;
|
|
347
370
|
const box = use(BoxContext);
|
|
348
371
|
const theme = useTheme();
|
|
349
372
|
const styles = fieldStylesOf(theme);
|
|
@@ -358,72 +381,84 @@ function FieldInput(t0) {
|
|
|
358
381
|
const affixed = prefix !== void 0 || suffix !== void 0;
|
|
359
382
|
const clearance = box.underLabel ? marginTopOf(typography.bodySmallLineHeight * fontScale) : void 0;
|
|
360
383
|
const affixStyle = composeStyles(role, colorOf(muted));
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
384
|
+
const lines = typography.bodyLargeLineHeight * fontScale * (multiline ? rows : 1);
|
|
385
|
+
const copied = multiline && autosize && Platform.OS === "web";
|
|
386
|
+
const extent = multiline && !autosize ? heightOf(lines) : minHeightOf(lines);
|
|
387
|
+
let t6;
|
|
388
|
+
if ($[9] !== described || $[10] !== id || $[11] !== prefix || $[12] !== suffix) {
|
|
389
|
+
t6 = descriptionOf([
|
|
364
390
|
...affixPart(`${id}-prefix`, prefix),
|
|
365
391
|
...affixPart(`${id}-suffix`, suffix),
|
|
366
392
|
...described
|
|
367
393
|
]);
|
|
368
|
-
$[
|
|
369
|
-
$[
|
|
370
|
-
$[
|
|
371
|
-
$[
|
|
372
|
-
$[
|
|
373
|
-
} else
|
|
374
|
-
let
|
|
375
|
-
if ($[
|
|
376
|
-
|
|
377
|
-
$[
|
|
378
|
-
$[
|
|
379
|
-
} else
|
|
394
|
+
$[9] = described;
|
|
395
|
+
$[10] = id;
|
|
396
|
+
$[11] = prefix;
|
|
397
|
+
$[12] = suffix;
|
|
398
|
+
$[13] = t6;
|
|
399
|
+
} else t6 = $[13];
|
|
400
|
+
let t7;
|
|
401
|
+
if ($[14] !== box) {
|
|
402
|
+
t7 = webStateOf(box);
|
|
403
|
+
$[14] = box;
|
|
404
|
+
$[15] = t7;
|
|
405
|
+
} else t7 = $[15];
|
|
380
406
|
const control = /* @__PURE__ */ jsx(TextInput, {
|
|
381
407
|
...Platform.OS === "web" ? INHERITS_DIRECTION : void 0,
|
|
382
408
|
...props,
|
|
383
|
-
...
|
|
384
|
-
...
|
|
409
|
+
...t6,
|
|
410
|
+
...t7,
|
|
385
411
|
"aria-disabled": box.disabled,
|
|
386
412
|
cursorColor: caret,
|
|
413
|
+
multiline,
|
|
387
414
|
placeholderTextColor: muted,
|
|
388
415
|
selectionColor: caret,
|
|
389
|
-
style: composeStyles(role, styles.input, colorOf(content), numeric ? numericOf(mono) : void 0,
|
|
416
|
+
style: composeStyles(role, styles.input, colorOf(content), numeric ? numericOf(mono) : void 0, multiline ? styles.inputMultiline : void 0, copied ? styles.inputOverCopy : extent, affixed || copied ? void 0 : clearance),
|
|
390
417
|
underlineColorAndroid: "transparent"
|
|
391
418
|
});
|
|
419
|
+
if (copied) return /* @__PURE__ */ jsxs(View, {
|
|
420
|
+
style: composeStyles(styles.copied, clearance),
|
|
421
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
422
|
+
"aria-hidden": true,
|
|
423
|
+
style: composeStyles(role, styles.copy, extent),
|
|
424
|
+
children: `${props.value ?? ""} `
|
|
425
|
+
}), control]
|
|
426
|
+
});
|
|
392
427
|
if (!affixed) return control;
|
|
393
|
-
let
|
|
394
|
-
if ($[
|
|
395
|
-
|
|
428
|
+
let t8;
|
|
429
|
+
if ($[16] !== affixStyle || $[17] !== box.floated || $[18] !== id || $[19] !== prefix) {
|
|
430
|
+
t8 = prefix === void 0 ? null : /* @__PURE__ */ jsx(Affix, {
|
|
396
431
|
floated: box.floated,
|
|
397
432
|
id: `${id}-prefix`,
|
|
398
433
|
style: affixStyle,
|
|
399
434
|
children: prefix
|
|
400
435
|
});
|
|
401
|
-
$[
|
|
402
|
-
$[
|
|
403
|
-
$[
|
|
404
|
-
$[
|
|
405
|
-
$[
|
|
406
|
-
} else
|
|
407
|
-
let
|
|
408
|
-
if ($[
|
|
409
|
-
|
|
436
|
+
$[16] = affixStyle;
|
|
437
|
+
$[17] = box.floated;
|
|
438
|
+
$[18] = id;
|
|
439
|
+
$[19] = prefix;
|
|
440
|
+
$[20] = t8;
|
|
441
|
+
} else t8 = $[20];
|
|
442
|
+
let t9;
|
|
443
|
+
if ($[21] !== affixStyle || $[22] !== box.floated || $[23] !== id || $[24] !== suffix) {
|
|
444
|
+
t9 = suffix === void 0 ? null : /* @__PURE__ */ jsx(Affix, {
|
|
410
445
|
floated: box.floated,
|
|
411
446
|
id: `${id}-suffix`,
|
|
412
447
|
style: affixStyle,
|
|
413
448
|
children: suffix
|
|
414
449
|
});
|
|
415
|
-
$[
|
|
416
|
-
$[
|
|
417
|
-
$[
|
|
418
|
-
$[
|
|
419
|
-
$[
|
|
420
|
-
} else
|
|
450
|
+
$[21] = affixStyle;
|
|
451
|
+
$[22] = box.floated;
|
|
452
|
+
$[23] = id;
|
|
453
|
+
$[24] = suffix;
|
|
454
|
+
$[25] = t9;
|
|
455
|
+
} else t9 = $[25];
|
|
421
456
|
return /* @__PURE__ */ jsxs(View, {
|
|
422
457
|
style: composeStyles(styles.affixLine, clearance),
|
|
423
458
|
children: [
|
|
424
|
-
|
|
459
|
+
t8,
|
|
425
460
|
control,
|
|
426
|
-
|
|
461
|
+
t9
|
|
427
462
|
]
|
|
428
463
|
});
|
|
429
464
|
}
|
|
@@ -449,7 +484,7 @@ function FieldInput(t0) {
|
|
|
449
484
|
* once in the control's description instead.
|
|
450
485
|
*/
|
|
451
486
|
function FieldMessage(t0) {
|
|
452
|
-
const $ = c(
|
|
487
|
+
const $ = c(19);
|
|
453
488
|
const { characterCount: t1, characterLimitLabel, description, error, id, length: t2, maxLength } = t0;
|
|
454
489
|
const characterCount = t1 === void 0 ? false : t1;
|
|
455
490
|
const length = t2 === void 0 ? 0 : t2;
|
|
@@ -465,13 +500,15 @@ function FieldMessage(t0) {
|
|
|
465
500
|
} else t3 = $[1];
|
|
466
501
|
const ids = t3;
|
|
467
502
|
const invalid = error !== void 0;
|
|
503
|
+
const locale = useLocaleOf(void 0);
|
|
468
504
|
let t4;
|
|
469
|
-
if ($[2] !== characterLimitLabel || $[3] !== maxLength) {
|
|
470
|
-
t4 = limitOf(maxLength, characterLimitLabel);
|
|
505
|
+
if ($[2] !== characterLimitLabel || $[3] !== locale || $[4] !== maxLength) {
|
|
506
|
+
t4 = limitOf(maxLength, characterLimitLabel, locale);
|
|
471
507
|
$[2] = characterLimitLabel;
|
|
472
|
-
$[3] =
|
|
473
|
-
$[4] =
|
|
474
|
-
|
|
508
|
+
$[3] = locale;
|
|
509
|
+
$[4] = maxLength;
|
|
510
|
+
$[5] = t4;
|
|
511
|
+
} else t4 = $[5];
|
|
475
512
|
const limit = t4;
|
|
476
513
|
const insideForm = useInsideForm();
|
|
477
514
|
const collapsed = !invalid && description === void 0 && !characterCount && !insideForm;
|
|
@@ -487,7 +524,7 @@ function FieldMessage(t0) {
|
|
|
487
524
|
children: error
|
|
488
525
|
}) : null;
|
|
489
526
|
let t8;
|
|
490
|
-
if ($[
|
|
527
|
+
if ($[6] !== t6 || $[7] !== t7) {
|
|
491
528
|
t8 = /* @__PURE__ */ jsx(View, {
|
|
492
529
|
"aria-live": "polite",
|
|
493
530
|
...Platform.OS === "web" ? ATOMIC : void 0,
|
|
@@ -495,10 +532,10 @@ function FieldMessage(t0) {
|
|
|
495
532
|
style: t6,
|
|
496
533
|
children: t7
|
|
497
534
|
});
|
|
498
|
-
$[
|
|
499
|
-
$[
|
|
500
|
-
$[
|
|
501
|
-
} else t8 = $[
|
|
535
|
+
$[6] = t6;
|
|
536
|
+
$[7] = t7;
|
|
537
|
+
$[8] = t8;
|
|
538
|
+
} else t8 = $[8];
|
|
502
539
|
const t9 = invalid || description === void 0 ? null : /* @__PURE__ */ jsx(Text, {
|
|
503
540
|
...Platform.OS === "web" ? void 0 : HIDDEN,
|
|
504
541
|
id: ids.description,
|
|
@@ -506,23 +543,23 @@ function FieldMessage(t0) {
|
|
|
506
543
|
children: description
|
|
507
544
|
});
|
|
508
545
|
let t10;
|
|
509
|
-
if ($[
|
|
546
|
+
if ($[9] !== ids || $[10] !== limit) {
|
|
510
547
|
t10 = limit === void 0 || Platform.OS !== "web" ? null : /* @__PURE__ */ jsx(Text, {
|
|
511
548
|
id: ids.limit,
|
|
512
549
|
style: NOT_DRAWN,
|
|
513
550
|
children: limit
|
|
514
551
|
});
|
|
515
|
-
$[
|
|
516
|
-
$[
|
|
517
|
-
$[
|
|
518
|
-
} else t10 = $[
|
|
552
|
+
$[9] = ids;
|
|
553
|
+
$[10] = limit;
|
|
554
|
+
$[11] = t10;
|
|
555
|
+
} else t10 = $[11];
|
|
519
556
|
const t11 = characterCount ? /* @__PURE__ */ jsx(Text, {
|
|
520
557
|
"aria-hidden": true,
|
|
521
558
|
style: composeStyles(messageStyle, styles.counter),
|
|
522
|
-
children: countOf(length, maxLength)
|
|
559
|
+
children: countOf(length, maxLength, locale)
|
|
523
560
|
}) : null;
|
|
524
561
|
let t12;
|
|
525
|
-
if ($[
|
|
562
|
+
if ($[12] !== T0 || $[13] !== t10 || $[14] !== t11 || $[15] !== t5 || $[16] !== t8 || $[17] !== t9) {
|
|
526
563
|
t12 = /* @__PURE__ */ jsxs(T0, {
|
|
527
564
|
style: t5,
|
|
528
565
|
children: [
|
|
@@ -532,14 +569,14 @@ function FieldMessage(t0) {
|
|
|
532
569
|
t11
|
|
533
570
|
]
|
|
534
571
|
});
|
|
535
|
-
$[
|
|
536
|
-
$[
|
|
537
|
-
$[
|
|
538
|
-
$[
|
|
539
|
-
$[
|
|
540
|
-
$[
|
|
541
|
-
$[
|
|
542
|
-
} else t12 = $[
|
|
572
|
+
$[12] = T0;
|
|
573
|
+
$[13] = t10;
|
|
574
|
+
$[14] = t11;
|
|
575
|
+
$[15] = t5;
|
|
576
|
+
$[16] = t8;
|
|
577
|
+
$[17] = t9;
|
|
578
|
+
$[18] = t12;
|
|
579
|
+
} else t12 = $[18];
|
|
543
580
|
return t12;
|
|
544
581
|
}
|
|
545
582
|
/**
|
|
@@ -772,9 +809,8 @@ function BoxLabel(t0) {
|
|
|
772
809
|
function colorOf(color) {
|
|
773
810
|
return { color };
|
|
774
811
|
}
|
|
775
|
-
function countOf(length, maxLength) {
|
|
776
|
-
|
|
777
|
-
return maxLength === void 0 ? counterFormat.format(length) : `${counterFormat.format(length)}/${counterFormat.format(maxLength)}`;
|
|
812
|
+
function countOf(length, maxLength, locale) {
|
|
813
|
+
return maxLength === void 0 ? formatCount(length, locale) : `${formatCount(length, locale)}/${formatCount(maxLength, locale)}`;
|
|
778
814
|
}
|
|
779
815
|
function descriptionOf(parts) {
|
|
780
816
|
if (Platform.OS === "web") return parts.length === 0 ? void 0 : { "aria-describedby": parts.map((part) => part.id).join(" ") };
|
|
@@ -786,6 +822,9 @@ function focusOf(control) {
|
|
|
786
822
|
control.current?.focus();
|
|
787
823
|
};
|
|
788
824
|
}
|
|
825
|
+
function heightOf(height) {
|
|
826
|
+
return { height };
|
|
827
|
+
}
|
|
789
828
|
function iconStyleOf(color) {
|
|
790
829
|
return {
|
|
791
830
|
color,
|
|
@@ -800,12 +839,12 @@ function idsOf(id) {
|
|
|
800
839
|
};
|
|
801
840
|
}
|
|
802
841
|
/**
|
|
803
|
-
* The limit in words where there is one: the field's own, or
|
|
804
|
-
*
|
|
842
|
+
* The limit in words where there is one: the field's own, or the library's
|
|
843
|
+
* in `locale`.
|
|
805
844
|
*/
|
|
806
|
-
function limitOf(maxLength, label) {
|
|
845
|
+
function limitOf(maxLength, label, locale) {
|
|
807
846
|
if (maxLength === void 0) return;
|
|
808
|
-
return label ?? (maxLength
|
|
847
|
+
return label ?? limitFor(maxLength, locale);
|
|
809
848
|
}
|
|
810
849
|
function marginTopOf(marginTop) {
|
|
811
850
|
return { marginTop };
|
|
@@ -914,6 +953,11 @@ function FieldStroke(t0) {
|
|
|
914
953
|
} else t2 = $[4];
|
|
915
954
|
return t2;
|
|
916
955
|
}
|
|
956
|
+
/**
|
|
957
|
+
* Says an error on iOS as it arrives, where a live region says nothing. An
|
|
958
|
+
* error the field opened with is not said, and neither is one that has not
|
|
959
|
+
* changed.
|
|
960
|
+
*/
|
|
917
961
|
function useErrorAnnouncement(error) {
|
|
918
962
|
const $ = c(3);
|
|
919
963
|
const said = useRef(error);
|
|
@@ -1002,6 +1046,6 @@ function widthTo(onMeasure) {
|
|
|
1002
1046
|
};
|
|
1003
1047
|
}
|
|
1004
1048
|
//#endregion
|
|
1005
|
-
export { FieldBox, FieldInput, FieldMessage, FieldStates, FieldStroke, describedBy, useFieldFocus, useStrokeMotion };
|
|
1049
|
+
export { FieldBox, FieldInput, FieldMessage, FieldStates, FieldStroke, describedBy, useErrorAnnouncement, useFieldFocus, useStrokeMotion };
|
|
1006
1050
|
|
|
1007
1051
|
//# sourceMappingURL=index.js.map
|