@nanahoshi/mona-ui 0.30.0 → 0.31.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 (109) hide show
  1. package/docs/api/button-group.md +1 -0
  2. package/docs/api/color-gradient.md +1 -0
  3. package/docs/api/color-palette.md +1 -0
  4. package/docs/api/color-picker.md +1 -0
  5. package/docs/api/form-field.md +88 -0
  6. package/docs/api/i18n.md +31 -0
  7. package/docs/api/locales.md +14 -14
  8. package/docs/api/segmented.md +1 -0
  9. package/docs/api/switch.md +1 -0
  10. package/docs/dropdown-list.md +1 -1
  11. package/docs/form-field.md +425 -0
  12. package/docs/forms.md +12 -4
  13. package/docs/label.md +4 -5
  14. package/docs/numeric-textbox.md +1 -1
  15. package/docs/radio-button.md +2 -1
  16. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +15 -4
  17. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +25 -1
  18. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +5 -2
  19. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +29 -3
  20. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +25 -1
  21. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +31 -3
  22. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +15 -4
  23. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +15 -4
  24. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +15 -4
  25. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +19 -7
  26. package/fesm2022/nanahoshi-mona-ui-editor.mjs +24 -4
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1 -0
  28. package/fesm2022/nanahoshi-mona-ui-form-field.mjs +666 -0
  29. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +31 -0
  30. package/fesm2022/nanahoshi-mona-ui-internal.mjs +27 -2
  31. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +27 -0
  32. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +13 -0
  33. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +19 -0
  34. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +19 -0
  35. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +13 -0
  36. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +19 -0
  37. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +13 -0
  38. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +13 -0
  39. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +23 -0
  40. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +19 -0
  41. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +23 -0
  42. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +13 -0
  43. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +13 -0
  44. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +13 -0
  45. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +19 -7
  46. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +14 -5
  47. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +6 -3
  48. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +15 -9
  49. package/fesm2022/nanahoshi-mona-ui-rating.mjs +6 -3
  50. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +25 -1
  51. package/fesm2022/nanahoshi-mona-ui-slider.mjs +8 -5
  52. package/fesm2022/nanahoshi-mona-ui-switch.mjs +25 -1
  53. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +6 -3
  54. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +15 -4
  55. package/form-field/package.json +4 -0
  56. package/i18n/catalogs/en-US.messages.json +13 -0
  57. package/llms.txt +3 -1
  58. package/locales/ar-sa/ar-sa.messages.json +13 -0
  59. package/locales/de-de/de-de.messages.json +13 -0
  60. package/locales/es-es/es-es.messages.json +13 -0
  61. package/locales/fr-fr/fr-fr.messages.json +13 -0
  62. package/locales/id-id/id-id.messages.json +13 -0
  63. package/locales/it-it/it-it.messages.json +13 -0
  64. package/locales/ja-jp/ja-jp.messages.json +13 -0
  65. package/locales/ko-kr/ko-kr.messages.json +13 -0
  66. package/locales/pl-pl/pl-pl.messages.json +13 -0
  67. package/locales/pt-br/pt-br.messages.json +13 -0
  68. package/locales/ru-ru/ru-ru.messages.json +13 -0
  69. package/locales/tr-tr/tr-tr.messages.json +13 -0
  70. package/locales/zh-cn/zh-cn.messages.json +13 -0
  71. package/locales/zh-tw/zh-tw.messages.json +13 -0
  72. package/package.json +5 -1
  73. package/types/nanahoshi-mona-ui-auto-complete.d.ts +2 -0
  74. package/types/nanahoshi-mona-ui-button-group.d.ts +11 -0
  75. package/types/nanahoshi-mona-ui-check-box.d.ts +1 -0
  76. package/types/nanahoshi-mona-ui-color-gradient.d.ts +11 -0
  77. package/types/nanahoshi-mona-ui-color-palette.d.ts +11 -0
  78. package/types/nanahoshi-mona-ui-color-picker.d.ts +11 -0
  79. package/types/nanahoshi-mona-ui-combo-box.d.ts +2 -0
  80. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -0
  81. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -0
  82. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +2 -0
  83. package/types/nanahoshi-mona-ui-form-field.d.ts +173 -0
  84. package/types/nanahoshi-mona-ui-i18n.d.ts +29 -0
  85. package/types/nanahoshi-mona-ui-internal.d.ts +39 -4
  86. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +13 -0
  87. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +13 -0
  88. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +13 -0
  89. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +13 -0
  90. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +13 -0
  91. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +13 -0
  92. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +13 -0
  93. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +13 -0
  94. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +13 -0
  95. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +13 -0
  96. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +13 -0
  97. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +13 -0
  98. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +13 -0
  99. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +13 -0
  100. package/types/nanahoshi-mona-ui-multi-select.d.ts +2 -0
  101. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +2 -0
  102. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  103. package/types/nanahoshi-mona-ui-radio-button.d.ts +2 -0
  104. package/types/nanahoshi-mona-ui-rating.d.ts +1 -0
  105. package/types/nanahoshi-mona-ui-segmented.d.ts +11 -0
  106. package/types/nanahoshi-mona-ui-slider.d.ts +1 -0
  107. package/types/nanahoshi-mona-ui-switch.d.ts +11 -0
  108. package/types/nanahoshi-mona-ui-text-box.d.ts +1 -0
  109. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -0
@@ -17,6 +17,7 @@ Component.
17
17
  | Name | Type | Default | Description |
18
18
  | --- | --- | --- | --- |
19
19
  | `allowEmpty` | `boolean` | `true` | When `false` and `selection` is `"single"`, a selected button stays selected until another one takes over: the active button can't be deselected, and clearing every `selected` brings it back. It doesn't choose a first button, and a `value` of `null` still clears the group, so a form can reset it. Has no effect in `"multiple"` mode. |
20
+ | `aria-describedby` | `string` | `""` | Id of an element that describes the button group, such as a hint or an error message. |
20
21
  | `aria-label` | `string \| undefined` | `undefined` | Accessible name for the host element. Override when multiple button groups appear on the same page so screen reader users can distinguish them. |
21
22
  | `aria-labelledby` | `string` | `""` | Id of the element that names the group. |
22
23
  | `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
@@ -15,6 +15,7 @@ Component.
15
15
 
16
16
  | Name | Type | Default | Description |
17
17
  | --- | --- | --- | --- |
18
+ | `aria-describedby` | `string` | `""` | Id of an element that describes the color gradient, such as a hint or an error message. |
18
19
  | `aria-label` | `string` | `""` | Accessible name of the group of controls. |
19
20
  | `aria-labelledby` | `string` | `""` | Id of the element that names the group of controls. |
20
21
  | `disabled` | `boolean` | `false` | Sets the disabled state of the color gradient. |
@@ -15,6 +15,7 @@ Component.
15
15
 
16
16
  | Name | Type | Default | Description |
17
17
  | --- | --- | --- | --- |
18
+ | `aria-describedby` | `string` | `""` | Id of an element that describes the color palette, such as a hint or an error message. |
18
19
  | `aria-label` | `string` | `""` | Accessible label for the color palette grid. |
19
20
  | `aria-labelledby` | `string` | `""` | Id of the element that names the color palette grid. |
20
21
  | `clearable` | `boolean` | `true` | Whether activating the selected tile clears the value. A required palette never clears. |
@@ -15,6 +15,7 @@ Component.
15
15
 
16
16
  | Name | Type | Default | Description |
17
17
  | --- | --- | --- | --- |
18
+ | `aria-describedby` | `string` | `""` | Id of an element that describes the color picker, such as a hint or an error message. |
18
19
  | `aria-label` | `string` | `""` | Accessible label for the color picker combobox. |
19
20
  | `aria-labelledby` | `string` | `""` | Id of the element that names the color picker. |
20
21
  | `closeOnSelect` | `boolean` | `true` | Whether to close the color picker when a color is selected. Only applies when the view is set to "palette". |
@@ -0,0 +1,88 @@
1
+ # `@nanahoshi/mona-ui/form-field`
2
+
3
+ Everything `@nanahoshi/mona-ui/form-field` exports.
4
+
5
+ **Guides:** [Form Field](../form-field.md)
6
+
7
+ ## `FormFieldComponent`
8
+
9
+ Component.
10
+
11
+ Puts a label, a hint and validation errors around one form control, and connects them to it.
12
+
13
+ **Selector:** `mona-form-field`
14
+
15
+ ### Inputs
16
+
17
+ | Name | Type | Default | Description |
18
+ | --- | --- | --- | --- |
19
+ | `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
20
+ | `error` | `string` | `""` | Text shown as an error, whether or not the control is touched, such as an error from a server. It comes before the errors of a bound signal form field. Set the control's own `invalid` and `touched` too, so it draws its error state. |
21
+ | `hint` | `string` | `""` | Help text shown below the control. It describes the control through `aria-describedby`. Ignored when `monaFormFieldHintTemplate` is provided. |
22
+ | `label` | `string` | `""` | The label shown above or beside the control. It names the control through `aria-labelledby`. Ignored when `monaFormFieldLabelTemplate` is provided. |
23
+ | `optional` | `boolean` | `false` | Whether to show optional-field text after the label. |
24
+ | `optionalText` | `string` | `""` | Text shown after the label when `optional` is set. |
25
+ | `orientation` | `FormFieldOrientation` | `"vertical"` | Where the label goes: above the control, or beside it in a column set by the `--mona-form-field-label-width` custom property (10rem by default). |
26
+ | `required` | `boolean` | `false` | Shows the required marker after the label. A bound signal form field with a `required` rule shows it too. The marker is hidden from assistive technology, which reads the control's own required state. |
27
+ | `showRequiredMarker` | `boolean` | `true` | Whether a required field shows its marker. Turn it off for a form that marks optional fields instead. |
28
+
29
+ ## `FormFieldErrorTemplateDirective`
30
+
31
+ Directive.
32
+
33
+ Renders each error the form field shows, in place of its message. The context's `$implicit` is the message and
34
+ `error` is the validation error, or null for the form field's `error` input.
35
+
36
+ **Selector:** `ng-template[monaFormFieldErrorTemplate]`
37
+
38
+ ### Template context
39
+
40
+ | Name | Type | Description |
41
+ | --- | --- | --- |
42
+ | `$implicit` | `string` | The message the form field would show: the validator's own, or the locale's message for the error's kind. |
43
+ | `error` | `ValidationError \| null` | The validation error, or null for the text of the form field's `error` input. |
44
+ | `message` | `string` | The same message as `$implicit`, for `let-message="message"`. |
45
+
46
+ ## `FormFieldHintTemplateDirective`
47
+
48
+ Directive.
49
+
50
+ Replaces the `hint` text with projected content, such as text with a link. It still describes the control. The
51
+ template has no context variables.
52
+
53
+ **Selector:** `ng-template[monaFormFieldHintTemplate]`
54
+
55
+ ## `FormFieldLabelTemplateDirective`
56
+
57
+ Directive.
58
+
59
+ Replaces the `label` text with projected content. Its text names the control, so keep interactive elements out of
60
+ it. The template has no context variables.
61
+
62
+ **Selector:** `ng-template[monaFormFieldLabelTemplate]`
63
+
64
+ ## `FormFieldErrorTemplateContext`
65
+
66
+ Interface.
67
+
68
+ The context of a `monaFormFieldErrorTemplate`, rendered once for each error the form field shows.
69
+
70
+ ### Properties
71
+
72
+ | Name | Type | Description |
73
+ | --- | --- | --- |
74
+ | `$implicit` (read-only) | `string` | The message the form field would show: the validator's own, or the locale's message for the error's kind. |
75
+ | `error` (read-only) | `ValidationError \| null` | The validation error, or null for the text of the form field's `error` input. |
76
+ | `message` (read-only) | `string` | The same message as `$implicit`, for `let-message="message"`. |
77
+
78
+ ## `FormFieldOrientation`
79
+
80
+ Type alias.
81
+
82
+ Where a form field puts its label: above the control (`vertical`) or beside it (`horizontal`).
83
+
84
+ ```typescript
85
+ type FormFieldOrientation = "horizontal" | "vertical";
86
+ ```
87
+
88
+ **Used by:** [`FormFieldComponent`](form-field.md#formfieldcomponent)
package/docs/api/i18n.md CHANGED
@@ -559,6 +559,36 @@ Interface.
559
559
 
560
560
  **Used by:** [`MonaLocaleMessages`](i18n.md#monalocalemessages), [`TREE_VIEW_DEFAULT_MESSAGES`](tree-view.md#tree-view-default-messages)
561
561
 
562
+ ## `MonaFormFieldMessages`
563
+
564
+ Interface.
565
+
566
+ The form field's optional marker and the error messages it shows for the built-in signal forms validators. A
567
+ validator's own `message` wins over these.
568
+
569
+ ### Properties
570
+
571
+ | Name | Type | Description |
572
+ | --- | --- | --- |
573
+ | `email` (read-only) | `string` | For an `email` error. |
574
+ | `invalid` (read-only) | `string` | For an error of a kind without a message of its own, such as a custom validator's or a parse error. |
575
+ | `optional` (read-only) | `string` | Shown after the label of a field marked `optional`. |
576
+ | `pattern` (read-only) | `string` | For a `pattern` error. |
577
+ | `required` (read-only) | `string` | For a `required` error. |
578
+
579
+ ### Methods
580
+
581
+ | Signature | Description |
582
+ | --- | --- |
583
+ | `max(max: number): string` | For a `max` error. |
584
+ | `maxDate(maxDate: string): string` | For a `maxDate` error, with the date formatted in the locale. |
585
+ | `maxLength(maxLength: number): string` | For a `maxLength` error. |
586
+ | `min(min: number): string` | For a `min` error. |
587
+ | `minDate(minDate: string): string` | For a `minDate` error, with the date formatted in the locale. |
588
+ | `minLength(minLength: number): string` | For a `minLength` error. |
589
+
590
+ **Used by:** [`MonaLocaleMessages`](i18n.md#monalocalemessages)
591
+
562
592
  ## `MonaChipMessages`
563
593
 
564
594
  Interface.
@@ -1162,6 +1192,7 @@ Interface.
1162
1192
  | `dropdowns` | `MonaDropdownsMessages` |
1163
1193
  | `editor` | `MonaEditorMessages` |
1164
1194
  | `filter` | `MonaFilterMessages` |
1195
+ | `formField` | `MonaFormFieldMessages` |
1165
1196
  | `grid` | `MonaGridMessages` |
1166
1197
  | `label` | `MonaLabelMessages` |
1167
1198
  | `list` | `MonaListMessages` |