@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.
Files changed (150) hide show
  1. package/README.md +37 -0
  2. package/dist/badge/index.js +9 -68
  3. package/dist/badge/index.js.map +1 -1
  4. package/dist/button/index.d.ts +2 -1
  5. package/dist/button/index.js +1 -1
  6. package/dist/button/index.js.map +1 -1
  7. package/dist/button/palettes.d.ts +2 -0
  8. package/dist/button/pending.js +17 -21
  9. package/dist/button/pending.js.map +1 -1
  10. package/dist/calendar/index.js +1 -1
  11. package/dist/components/autocomplete/index.js +28 -26
  12. package/dist/components/autocomplete/index.js.map +1 -1
  13. package/dist/components/avatar/index.d.ts +2 -2
  14. package/dist/components/avatar/index.js +2 -2
  15. package/dist/components/avatar/index.js.map +1 -1
  16. package/dist/components/badge/index.d.ts +48 -0
  17. package/dist/components/badge/index.js +122 -0
  18. package/dist/components/badge/index.js.map +1 -0
  19. package/dist/{badge → components/badge}/styles.js +10 -6
  20. package/dist/components/badge/styles.js.map +1 -0
  21. package/dist/components/breadcrumbs/index.d.ts +66 -0
  22. package/dist/components/breadcrumbs/index.js +285 -0
  23. package/dist/components/breadcrumbs/index.js.map +1 -0
  24. package/dist/components/calendar/index.d.ts +1 -1
  25. package/dist/components/calendar/index.js +77 -38
  26. package/dist/components/calendar/index.js.map +1 -1
  27. package/dist/components/checkbox/index.d.ts +7 -1
  28. package/dist/components/checkbox/index.js +183 -138
  29. package/dist/components/checkbox/index.js.map +1 -1
  30. package/dist/components/checkbox-group/index.d.ts +93 -0
  31. package/dist/components/checkbox-group/index.js +306 -0
  32. package/dist/components/checkbox-group/index.js.map +1 -0
  33. package/dist/components/chip-group/index.d.ts +4 -3
  34. package/dist/components/chip-group/index.js +47 -45
  35. package/dist/components/chip-group/index.js.map +1 -1
  36. package/dist/components/code/index.d.ts +25 -0
  37. package/dist/components/code/index.js +87 -0
  38. package/dist/components/code/index.js.map +1 -0
  39. package/dist/components/container/index.d.ts +47 -0
  40. package/dist/components/container/index.js +85 -0
  41. package/dist/components/container/index.js.map +1 -0
  42. package/dist/components/copy-field/index.d.ts +5 -5
  43. package/dist/components/copy-field/index.js +30 -28
  44. package/dist/components/copy-field/index.js.map +1 -1
  45. package/dist/components/currency/index.d.ts +2 -2
  46. package/dist/components/currency/index.js +3 -1
  47. package/dist/components/currency/index.js.map +1 -1
  48. package/dist/components/fab/index.d.ts +80 -0
  49. package/dist/components/fab/index.js +231 -0
  50. package/dist/components/fab/index.js.map +1 -0
  51. package/dist/components/fab-menu/index.d.ts +120 -0
  52. package/dist/components/fab-menu/index.js +640 -0
  53. package/dist/components/fab-menu/index.js.map +1 -0
  54. package/dist/components/feed/index.d.ts +57 -0
  55. package/dist/components/feed/index.js +167 -0
  56. package/dist/components/feed/index.js.map +1 -0
  57. package/dist/components/keycap/index.d.ts +27 -0
  58. package/dist/components/keycap/index.js +136 -0
  59. package/dist/components/keycap/index.js.map +1 -0
  60. package/dist/components/list/index.d.ts +6 -5
  61. package/dist/components/list/index.js +97 -106
  62. package/dist/components/list/index.js.map +1 -1
  63. package/dist/components/menu/index.d.ts +4 -3
  64. package/dist/components/menu/index.js +33 -40
  65. package/dist/components/menu/index.js.map +1 -1
  66. package/dist/components/meter/index.d.ts +2 -1
  67. package/dist/components/meter/index.js +9 -7
  68. package/dist/components/meter/index.js.map +1 -1
  69. package/dist/components/number-field/index.d.ts +7 -3
  70. package/dist/components/number-field/index.js +214 -192
  71. package/dist/components/number-field/index.js.map +1 -1
  72. package/dist/components/product-icon/index.d.ts +2 -2
  73. package/dist/components/product-icon/index.js +2 -2
  74. package/dist/components/product-icon/index.js.map +1 -1
  75. package/dist/components/progress-indicator/index.d.ts +2 -1
  76. package/dist/components/progress-indicator/index.js +15 -13
  77. package/dist/components/progress-indicator/index.js.map +1 -1
  78. package/dist/components/search-field/index.d.ts +3 -3
  79. package/dist/components/search-field/index.js +105 -104
  80. package/dist/components/search-field/index.js.map +1 -1
  81. package/dist/components/separator/index.d.ts +3 -2
  82. package/dist/components/separator/index.js +29 -26
  83. package/dist/components/separator/index.js.map +1 -1
  84. package/dist/components/sheet/index.d.ts +2 -2
  85. package/dist/components/sheet/index.js +22 -26
  86. package/dist/components/sheet/index.js.map +1 -1
  87. package/dist/components/snackbar/index.d.ts +3 -3
  88. package/dist/components/snackbar/index.js +36 -34
  89. package/dist/components/snackbar/index.js.map +1 -1
  90. package/dist/components/supporting-pane/index.d.ts +44 -0
  91. package/dist/components/supporting-pane/index.js +109 -0
  92. package/dist/components/supporting-pane/index.js.map +1 -0
  93. package/dist/components/tag/index.d.ts +58 -0
  94. package/dist/components/tag/index.js +205 -0
  95. package/dist/components/tag/index.js.map +1 -0
  96. package/dist/components/text/index.d.ts +1 -1
  97. package/dist/components/text/index.js +49 -21
  98. package/dist/components/text/index.js.map +1 -1
  99. package/dist/components/text-area/index.d.ts +145 -0
  100. package/dist/components/text-area/index.js +231 -0
  101. package/dist/components/text-area/index.js.map +1 -0
  102. package/dist/components/text-field/index.d.ts +6 -3
  103. package/dist/components/text-field/index.js +3 -0
  104. package/dist/components/text-field/index.js.map +1 -1
  105. package/dist/components/toolbar/index.d.ts +53 -0
  106. package/dist/components/toolbar/index.js +185 -0
  107. package/dist/components/toolbar/index.js.map +1 -0
  108. package/dist/control/group.js +23 -0
  109. package/dist/control/group.js.map +1 -0
  110. package/dist/fab/index.d.ts +19 -0
  111. package/dist/fab/index.js +147 -0
  112. package/dist/fab/index.js.map +1 -0
  113. package/dist/field/index.js +123 -79
  114. package/dist/field/index.js.map +1 -1
  115. package/dist/field/styles.js +18 -0
  116. package/dist/field/styles.js.map +1 -1
  117. package/dist/form/index.d.ts +1 -2
  118. package/dist/form/index.js +1 -1
  119. package/dist/form/index.js.map +1 -1
  120. package/dist/i18n/index.js +12 -1
  121. package/dist/i18n/index.js.map +1 -1
  122. package/dist/i18n/messages.js +367 -0
  123. package/dist/i18n/messages.js.map +1 -1
  124. package/dist/i18n/provider.d.ts +53 -0
  125. package/dist/i18n/provider.js +96 -0
  126. package/dist/i18n/provider.js.map +1 -0
  127. package/dist/index.d.ts +19 -4
  128. package/dist/index.js +17 -3
  129. package/dist/indicator/index.js +1 -2
  130. package/dist/indicator/index.js.map +1 -1
  131. package/dist/mark/index.js +77 -117
  132. package/dist/mark/index.js.map +1 -1
  133. package/dist/mark/initials.js.map +1 -1
  134. package/dist/modal/index.js +59 -46
  135. package/dist/modal/index.js.map +1 -1
  136. package/dist/navigation/index.js +8 -5
  137. package/dist/navigation/index.js.map +1 -1
  138. package/dist/number/count.js +15 -0
  139. package/dist/number/count.js.map +1 -0
  140. package/dist/number/locale.js.map +1 -1
  141. package/dist/overlay/host.js +30 -21
  142. package/dist/overlay/host.js.map +1 -1
  143. package/dist/overlay/placement.js +3 -1
  144. package/dist/overlay/placement.js.map +1 -1
  145. package/dist/separator/index.js +7 -0
  146. package/dist/separator/index.js.map +1 -0
  147. package/dist/typography/size.js +14 -0
  148. package/dist/typography/size.js.map +1 -0
  149. package/package.json +1 -1
  150. package/dist/badge/styles.js.map +0 -1
@@ -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(23);
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
- ({described: t1, numeric: t2, prefix, suffix, ...props} = t0);
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 described = t1 === void 0 ? NO_PARTS : t1;
346
- const numeric = t2 === void 0 ? false : t2;
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
- let t3;
362
- if ($[6] !== described || $[7] !== id || $[8] !== prefix || $[9] !== suffix) {
363
- t3 = descriptionOf([
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
- $[6] = described;
369
- $[7] = id;
370
- $[8] = prefix;
371
- $[9] = suffix;
372
- $[10] = t3;
373
- } else t3 = $[10];
374
- let t4;
375
- if ($[11] !== box) {
376
- t4 = webStateOf(box);
377
- $[11] = box;
378
- $[12] = t4;
379
- } else t4 = $[12];
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
- ...t3,
384
- ...t4,
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, minHeightOf(typography.bodyLargeLineHeight * fontScale), affixed ? void 0 : clearance),
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 t5;
394
- if ($[13] !== affixStyle || $[14] !== box.floated || $[15] !== id || $[16] !== prefix) {
395
- t5 = prefix === void 0 ? null : /* @__PURE__ */ jsx(Affix, {
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
- $[13] = affixStyle;
402
- $[14] = box.floated;
403
- $[15] = id;
404
- $[16] = prefix;
405
- $[17] = t5;
406
- } else t5 = $[17];
407
- let t6;
408
- if ($[18] !== affixStyle || $[19] !== box.floated || $[20] !== id || $[21] !== suffix) {
409
- t6 = suffix === void 0 ? null : /* @__PURE__ */ jsx(Affix, {
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
- $[18] = affixStyle;
416
- $[19] = box.floated;
417
- $[20] = id;
418
- $[21] = suffix;
419
- $[22] = t6;
420
- } else t6 = $[22];
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
- t5,
459
+ t8,
425
460
  control,
426
- t6
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(18);
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] = maxLength;
473
- $[4] = t4;
474
- } else t4 = $[4];
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 ($[5] !== t6 || $[6] !== t7) {
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
- $[5] = t6;
499
- $[6] = t7;
500
- $[7] = t8;
501
- } else t8 = $[7];
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 ($[8] !== ids || $[9] !== limit) {
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
- $[8] = ids;
516
- $[9] = limit;
517
- $[10] = t10;
518
- } else t10 = $[10];
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 ($[11] !== T0 || $[12] !== t10 || $[13] !== t11 || $[14] !== t5 || $[15] !== t8 || $[16] !== t9) {
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
- $[11] = T0;
536
- $[12] = t10;
537
- $[13] = t11;
538
- $[14] = t5;
539
- $[15] = t8;
540
- $[16] = t9;
541
- $[17] = t12;
542
- } else t12 = $[17];
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
- counterFormat ??= new Intl.NumberFormat();
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 English, which
804
- * an app in another language replaces through `characterLimitLabel`.
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 === 1 ? "Up to 1 character" : `Up to ${String(maxLength)} characters`);
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