@nanahoshi/mona-ui 0.25.0 → 0.26.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 (227) hide show
  1. package/README.md +2 -0
  2. package/command/package.json +4 -0
  3. package/docs/auto-complete.md +733 -0
  4. package/docs/avatar.md +220 -0
  5. package/docs/breadcrumb.md +320 -0
  6. package/docs/button-group.md +392 -0
  7. package/docs/button.md +256 -0
  8. package/docs/calendar.md +515 -0
  9. package/docs/card.md +292 -0
  10. package/docs/chart.md +4058 -0
  11. package/docs/checkbox.md +374 -0
  12. package/docs/chip.md +339 -0
  13. package/docs/circular-progress-bar.md +287 -0
  14. package/docs/collapsible.md +308 -0
  15. package/docs/color-gradient.md +336 -0
  16. package/docs/color-palette.md +317 -0
  17. package/docs/color-picker.md +387 -0
  18. package/docs/combo-box.md +764 -0
  19. package/docs/command.md +582 -0
  20. package/docs/contextmenu.md +530 -0
  21. package/docs/date-picker.md +251 -0
  22. package/docs/datetime-picker.md +284 -0
  23. package/docs/decimal-textbox.md +260 -0
  24. package/docs/dialog.md +822 -0
  25. package/docs/dropdown-button.md +507 -0
  26. package/docs/dropdown-list.md +779 -0
  27. package/docs/editor.md +374 -0
  28. package/docs/expansion-panel.md +348 -0
  29. package/docs/fieldset.md +217 -0
  30. package/docs/forms.md +162 -0
  31. package/docs/grid.md +2053 -0
  32. package/docs/input.md +197 -0
  33. package/docs/installation.md +54 -0
  34. package/docs/introduction.md +46 -0
  35. package/docs/label.md +340 -0
  36. package/docs/list-box.md +637 -0
  37. package/docs/list-view.md +584 -0
  38. package/docs/menubar.md +559 -0
  39. package/docs/multi-select.md +765 -0
  40. package/docs/notification.md +460 -0
  41. package/docs/numeric-textbox.md +301 -0
  42. package/docs/otp-input.md +539 -0
  43. package/docs/pager.md +513 -0
  44. package/docs/placeholder.md +176 -0
  45. package/docs/popover.md +423 -0
  46. package/docs/popup-menu.md +658 -0
  47. package/docs/popup.md +617 -0
  48. package/docs/progress-bar.md +368 -0
  49. package/docs/radio-button.md +451 -0
  50. package/docs/range-slider.md +367 -0
  51. package/docs/rating.md +518 -0
  52. package/docs/scroll-view.md +375 -0
  53. package/docs/segmented.md +434 -0
  54. package/docs/sheet.md +348 -0
  55. package/docs/sidebar.md +1126 -0
  56. package/docs/skeleton.md +181 -0
  57. package/docs/slider.md +423 -0
  58. package/docs/spinner.md +370 -0
  59. package/docs/split-button.md +522 -0
  60. package/docs/splitter.md +342 -0
  61. package/docs/stepper.md +539 -0
  62. package/docs/switch.md +340 -0
  63. package/docs/tabs.md +542 -0
  64. package/docs/textarea.md +196 -0
  65. package/docs/textbox.md +332 -0
  66. package/docs/theming.md +403 -0
  67. package/docs/time-picker.md +254 -0
  68. package/docs/tooltip-directive.md +340 -0
  69. package/docs/tooltip.md +321 -0
  70. package/docs/tree-view.md +1018 -0
  71. package/docs/window.md +663 -0
  72. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  73. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
  74. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +1 -1
  75. package/fesm2022/nanahoshi-mona-ui-button.mjs +14 -2
  76. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
  77. package/fesm2022/nanahoshi-mona-ui-chart.mjs +108 -22
  78. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
  79. package/fesm2022/nanahoshi-mona-ui-chip.mjs +1 -1
  80. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
  81. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
  82. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  83. package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
  84. package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
  85. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
  86. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
  87. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
  88. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
  89. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
  90. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
  91. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
  92. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
  93. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
  94. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
  95. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
  96. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
  97. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
  98. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
  99. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  100. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  101. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
  102. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
  103. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
  104. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
  105. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
  106. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
  107. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
  108. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
  109. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
  110. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
  111. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
  112. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
  113. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
  114. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
  117. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
  118. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
  119. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
  120. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
  121. package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
  122. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
  123. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
  124. package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
  125. package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
  126. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
  127. package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
  128. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
  129. package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
  130. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +7 -3
  131. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +2 -1
  132. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
  133. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
  134. package/fesm2022/nanahoshi-mona-ui-slider.mjs +8 -3
  135. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +10 -7
  136. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
  137. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
  138. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
  139. package/fesm2022/nanahoshi-mona-ui-theme.mjs +53 -21
  140. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
  141. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
  142. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
  143. package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
  144. package/i18n/catalogs/en-US.messages.json +10 -0
  145. package/internal/popup-menu/package.json +4 -0
  146. package/llms.txt +123 -0
  147. package/locales/ar-sa/ar-sa.messages.json +10 -0
  148. package/locales/de-de/de-de.messages.json +10 -0
  149. package/locales/es-es/es-es.messages.json +10 -0
  150. package/locales/fr-fr/fr-fr.messages.json +10 -0
  151. package/locales/id-id/id-id.messages.json +10 -0
  152. package/locales/it-it/it-it.messages.json +10 -0
  153. package/locales/ja-jp/ja-jp.messages.json +10 -0
  154. package/locales/ko-kr/ko-kr.messages.json +10 -0
  155. package/locales/pt-br/pt-br.messages.json +10 -0
  156. package/locales/ru-ru/ru-ru.messages.json +10 -0
  157. package/locales/tr-tr/tr-tr.messages.json +10 -0
  158. package/locales/zh-cn/zh-cn.messages.json +10 -0
  159. package/locales/zh-tw/zh-tw.messages.json +10 -0
  160. package/package.json +9 -1
  161. package/styles.css +12 -2
  162. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
  163. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
  164. package/types/nanahoshi-mona-ui-button.d.ts +12 -0
  165. package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
  166. package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
  167. package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
  168. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
  169. package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
  170. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
  171. package/types/nanahoshi-mona-ui-command.d.ts +253 -0
  172. package/types/nanahoshi-mona-ui-common.d.ts +17 -1
  173. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
  174. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
  175. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
  176. package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
  177. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
  178. package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
  179. package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
  180. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
  181. package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
  182. package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
  183. package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
  184. package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
  185. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
  186. package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
  187. package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
  188. package/types/nanahoshi-mona-ui-label.d.ts +1 -0
  189. package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
  190. package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
  191. package/types/nanahoshi-mona-ui-list.d.ts +1 -1
  192. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
  193. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
  194. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
  195. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
  196. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
  197. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
  198. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
  199. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
  200. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
  201. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
  202. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
  203. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
  204. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
  205. package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
  206. package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
  207. package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
  208. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
  209. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  210. package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
  211. package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
  212. package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
  213. package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
  214. package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
  215. package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
  216. package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
  217. package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
  218. package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
  219. package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
  220. package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
  221. package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
  222. package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
  223. package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
  224. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
  225. package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
  226. package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
  227. package/types/nanahoshi-mona-ui-window.d.ts +66 -1
@@ -0,0 +1,387 @@
1
+ # Color Picker
2
+
3
+ > A compact control that opens a color palette or gradient editor.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/color-picker`
6
+
7
+ **Selector:** `mona-color-picker`
8
+
9
+ `ColorPickerComponent` is a compact, combobox-style control that opens a popup containing either a color palette or a color gradient editor, with signal forms support via `FormValueControl<string | null>`.
10
+
11
+ ## Overview
12
+
13
+ Use `ColorPickerComponent` when screen space is limited and the color editor should stay collapsed until the user opens it. It wraps a preview swatch and dropdown trigger; activating it opens a popup containing either a `ColorPaletteComponent` grid (`view="palette"`) or a `ColorGradientComponent` editor (`view="gradient"`).
14
+
15
+ Use `ColorPaletteComponent` directly when the palette should always be visible inline. Use `ColorGradientComponent` directly when the gradient editor should always be visible inline. Use `ColorPickerComponent` when either of those should be presented as an on-demand popup instead.
16
+
17
+ > **Forms.** `ColorPickerComponent` implements `FormValueControl<string | null>` from `@angular/forms/signals`, so use `[formField]` with signal forms. It has no `ControlValueAccessor`, but `[(ngModel)]`, `[formControl]` and `formControlName` work too, because Angular binds a control's `value` and `touch` directly when it has no accessor.
18
+
19
+ ## Import & Quick Start
20
+
21
+ ```typescript
22
+ import { ColorPickerComponent } from "@nanahoshi/mona-ui/color-picker";
23
+ ```
24
+
25
+ **Direct value binding**
26
+
27
+ ```html
28
+ <mona-color-picker [(value)]="color"></mona-color-picker>
29
+ ```
30
+
31
+ ```typescript
32
+ protected readonly color = signal<string | null>("#3498db");
33
+ ```
34
+
35
+ **Signal forms**
36
+
37
+ ```typescript
38
+ import { signal } from "@angular/core";
39
+ import { FormField, form } from "@angular/forms/signals";
40
+ import { ColorPickerComponent } from "@nanahoshi/mona-ui/color-picker";
41
+
42
+ protected readonly form = form(signal<{ color: string | null }>({ color: "#3498db" }));
43
+ ```
44
+
45
+ ```html
46
+ <mona-color-picker [formField]="form.color" view="palette"></mona-color-picker>
47
+ ```
48
+
49
+ ## Anatomy
50
+
51
+ The host renders a preview swatch (the currently selected color, or a "no color" icon when `value` is `null`) followed by a dropdown chevron button. Activating the host opens a popup with the view selected by the `view` input.
52
+
53
+ **Custom preview template**
54
+
55
+ Project an `ng-template` with the `monaColorPickerValueTemplate` directive to replace the default swatch. See [Custom preview](#custom-preview).
56
+
57
+ | Directive selector | Template context |
58
+ |---|---|
59
+ | `ng-template[monaColorPickerValueTemplate]` | `ColorPickerValueTemplateContext` — exposes the current value as `$implicit`. |
60
+
61
+ `let-color` is typed `string | null`, and it's `null` when no color is selected.
62
+
63
+ ## Examples
64
+
65
+ ### Palette view
66
+
67
+ Accepts the same `palette`, `columns` and `tileSize` inputs as `ColorPaletteComponent`, and `columns` only applies to a custom palette. See the [Color Palette](color-palette.md) documentation for palette scheme details. `showClearButton` adds a button to the popup that resets `value` to `null`.
68
+
69
+ `palette-example.component.ts`
70
+
71
+ ```typescript
72
+ import { Component, signal } from "@angular/core";
73
+ import { ColorPickerComponent } from "@nanahoshi/mona-ui/color-picker";
74
+
75
+ @Component({
76
+ selector: "app-color-picker-palette-example",
77
+ imports: [ColorPickerComponent],
78
+ templateUrl: "./palette-example.component.html"
79
+ })
80
+ export class ColorPickerPaletteExampleComponent {
81
+ protected readonly color = signal<string | null>("#2563eb");
82
+ protected readonly colors = [
83
+ "#dc2626",
84
+ "#ea580c",
85
+ "#ca8a04",
86
+ "#16a34a",
87
+ "#0891b2",
88
+ "#2563eb",
89
+ "#7c3aed",
90
+ "#db2777",
91
+ "#57534e",
92
+ "#171717"
93
+ ];
94
+ }
95
+ ```
96
+
97
+ `palette-example.component.html`
98
+
99
+ ```html
100
+ <div class="flex items-center gap-3">
101
+ <mona-color-picker
102
+ aria-label="Tag color"
103
+ view="palette"
104
+ [columns]="5"
105
+ [palette]="colors"
106
+ [showClearButton]="true"
107
+ [(value)]="color" />
108
+ <span class="text-sm">Color: {{ color() ?? "none" }}</span>
109
+ </div>
110
+ ```
111
+
112
+ Tiles are 24 pixels by default, and the built-in schemes have 18 to 20 columns, so their popup is up to about 480 pixels wide. On a smaller screen, the popup stops short of the viewport's width and scrolls.
113
+
114
+ ### Gradient view
115
+
116
+ Accepts the `opacity` input, forwarded to the embedded `ColorGradientComponent`.
117
+
118
+ `gradient-example.component.ts`
119
+
120
+ ```typescript
121
+ import { Component, signal } from "@angular/core";
122
+ import { ColorPickerComponent } from "@nanahoshi/mona-ui/color-picker";
123
+
124
+ @Component({
125
+ selector: "app-color-picker-gradient-example",
126
+ imports: [ColorPickerComponent],
127
+ templateUrl: "./gradient-example.component.html"
128
+ })
129
+ export class ColorPickerGradientExampleComponent {
130
+ protected readonly color = signal<string | null>("#336699");
131
+ }
132
+ ```
133
+
134
+ `gradient-example.component.html`
135
+
136
+ ```html
137
+ <div class="flex items-center gap-3">
138
+ <mona-color-picker aria-label="Brand color" view="gradient" [opacity]="false" [(value)]="color" />
139
+ <span class="text-sm">Color: {{ color() ?? "none" }}</span>
140
+ </div>
141
+ ```
142
+
143
+ ### Custom preview
144
+
145
+ `let-current` is the selected color, or `null` when there is none.
146
+
147
+ `value-template-example.component.ts`
148
+
149
+ ```typescript
150
+ import { Component, signal } from "@angular/core";
151
+ import { ColorPickerComponent, ColorPickerValueTemplateDirective } from "@nanahoshi/mona-ui/color-picker";
152
+
153
+ @Component({
154
+ selector: "app-color-picker-value-template-example",
155
+ imports: [ColorPickerComponent, ColorPickerValueTemplateDirective],
156
+ templateUrl: "./value-template-example.component.html"
157
+ })
158
+ export class ColorPickerValueTemplateExampleComponent {
159
+ protected readonly color = signal<string | null>("#16a34a");
160
+ }
161
+ ```
162
+
163
+ `value-template-example.component.html`
164
+
165
+ ```html
166
+ <mona-color-picker aria-label="Text color" view="palette" [(value)]="color">
167
+ <ng-template monaColorPickerValueTemplate let-current>
168
+ <span class="font-mono text-xs">{{ current ?? "None" }}</span>
169
+ </ng-template>
170
+ </mona-color-picker>
171
+ ```
172
+
173
+ ### Keep the popup open after selecting
174
+
175
+ ```html
176
+ <mona-color-picker [(value)]="color" view="palette" [closeOnSelect]="false"></mona-color-picker>
177
+ ```
178
+
179
+ `closeOnSelect` only affects the palette view — selecting a swatch or clearing the color normally closes the popup; setting it to `false` keeps the popup open. The gradient view has its own Apply/Cancel flow (see the Color Gradient documentation) and is not affected by this input.
180
+
181
+ ### Clear button
182
+
183
+ `showClearButton`, shown in [Palette view](#palette-view), only applies to the palette view. It renders a button in the popup that resets `value` to `null`.
184
+
185
+ ## Appearance & Styling
186
+
187
+ ### Size and rounding
188
+
189
+ ```html
190
+ <mona-color-picker [(value)]="color" size="large" rounded="full"></mona-color-picker>
191
+ ```
192
+
193
+ Supported `size` values are `small`, `medium`, and `large`. Supported `rounded` values are `none`, `small`, `medium`, `large`, and `full`.
194
+
195
+ ## Behavior
196
+
197
+ - The popup opens anchored below the host, left-aligned, with no backdrop.
198
+ - Clicking outside the popup closes it. Focus stays on what the click focused, such as another field. If the click focused nothing, focus returns to the host.
199
+ - The popup does not automatically reposition to stay within the viewport near screen edges.
200
+ - `disabled` and `readonly` prevent the popup from opening, and close it if either becomes `true` while it's open.
201
+ - The popup closes when the picker is destroyed.
202
+ - Closing the popup returns focus to the host, unless the user moved it elsewhere, for example by clicking another field.
203
+ - In the gradient view, closing the popup by any means other than Apply discards what wasn't applied.
204
+ - A color the gradient can't read, such as `var(--brand)`, shows as no color in the gradient view and warns in development. Apply writes a value only after an edit, so that color stays as it was written. A color outside sRGB comes back as its closest sRGB color once edited.
205
+ - Choosing the color that's already selected keeps it and closes the popup. To clear, use `showClearButton`.
206
+
207
+ ## Forms Integration
208
+
209
+ `ColorPickerComponent` implements `FormValueControl<string | null>` from `@angular/forms/signals`.
210
+
211
+ ```typescript
212
+ import { signal } from "@angular/core";
213
+ import { FormField, disabled, form } from "@angular/forms/signals";
214
+
215
+ protected readonly form = form(signal<{ color: string | null }>({ color: "#3498db" }), schema => {
216
+ disabled(schema.color, { when: () => this.locked() });
217
+ });
218
+ ```
219
+
220
+ ```html
221
+ <mona-color-picker [formField]="form.color" view="palette"></mona-color-picker>
222
+ ```
223
+
224
+ The `touch` output fires when the host loses focus with the popup closed, when the clear button is used, and when the popup closes. Selecting a palette color counts through that close, so with `[closeOnSelect]="false"` it waits until the popup closes. Focus moving into the popup doesn't fire it. The signal forms `FormField` directive listens to this output to mark the field as touched.
225
+
226
+ ## Accessibility
227
+
228
+ ### Keyboard Map
229
+
230
+ **On the closed host:**
231
+
232
+ | Key | Action |
233
+ |---|---|
234
+ | `Enter` / `Space` / `ArrowDown` / `ArrowUp` | Opens the popup (when not `disabled` or `readonly`). |
235
+
236
+ **Inside the open popup:**
237
+
238
+ | Key | Action |
239
+ |---|---|
240
+ | `Escape` | Closes the popup, drops an unapplied edit in the gradient view, and returns focus to the host. |
241
+ | `Tab` / `Shift+Tab` | Moves through the popup's controls. Going past the last or first one closes the popup like `Escape` and returns focus to the host, so the next `Tab` continues down the page. The popup isn't modal and doesn't trap focus. |
242
+
243
+ The palette grid is one Tab stop, so `Tab` from a tile closes the popup, and `Shift+Tab` reaches the clear button when there is one.
244
+
245
+ Once focus moves into the popup content, the embedded component's own keyboard map applies: see the palette-view grid navigation in the [Color Palette](color-palette.md) documentation, or the gradient-view handle navigation in the [Color Gradient](color-gradient.md) documentation.
246
+
247
+ ### ARIA Roles
248
+
249
+ | Attribute | Where | Value |
250
+ |---|---|---|
251
+ | `role` | Host | `"combobox"` |
252
+ | `aria-haspopup` | Host | `"dialog"` |
253
+ | `aria-expanded` | Host | `"true"` while the popup is open, otherwise `"false"` |
254
+ | `aria-controls` | Host | The popup content element's `id`, only while it's open |
255
+ | `aria-label` | Host | The `aria-label` input, or `"Color picker"`. Absent when a label or `aria-labelledby` names the picker. |
256
+ | `aria-disabled` | Host | Reflects `disabled` |
257
+ | `aria-invalid` | Host | `"true"` once `touched` and either `invalid`, or `required` with no color. Otherwise absent. |
258
+ | `aria-readonly` | Host | Reflects `readonly` |
259
+ | `aria-required` | Host | Reflects `required` |
260
+ | `role` | Popup content | `"dialog"` |
261
+ | `aria-label` | Popup content | `"Color palette picker"` or `"Color gradient picker"`, matching `view` |
262
+ | `id` | Popup content | Matches the host's `aria-controls` |
263
+
264
+ The host also holds visually hidden text with the current color: its name when the palette gives it one, its value otherwise, or a translated "No color".
265
+
266
+ **Consumer responsibilities**
267
+
268
+ - Name each picker with `aria-label`, `aria-labelledby` or a `mona-label`, so screen reader users can tell them apart.
269
+
270
+ ### Focus Behavior
271
+
272
+ Opening the popup moves focus into its content: the selected color, or the first one, in the palette view, and the saturation/value handle in the gradient view. Closing the popup returns focus to the host unless the user moved it elsewhere. The popup does not implement a focus trap.
273
+
274
+ ## API
275
+
276
+ Everything below is imported from `@nanahoshi/mona-ui/color-picker`.
277
+
278
+ ### `ColorPickerComponent`
279
+
280
+ **Selector:** `mona-color-picker`
281
+ **Implements:** `FormValueControl<string \| null>`
282
+
283
+ #### Inputs
284
+
285
+ | Name | Type | Default | Description |
286
+ | --- | --- | --- | --- |
287
+ | `aria-label` | `string` | `""` | Accessible label for the color picker combobox. |
288
+ | `aria-labelledby` | `string` | `""` | Id of the element that names the color picker. |
289
+ | `closeOnSelect` | `boolean` | `true` | Whether to close the color picker when a color is selected. Only applies when the view is set to "palette". |
290
+ | `columns` | `number` | `10` | The number of columns to display in the color palette. Only applies when the view is set to "palette" and the palette is a custom array of colors. |
291
+ | `disabled` | `boolean` | `false` | Renders the component with reduced visual emphasis and removes pointer interaction. |
292
+ | `format` | `ColorOutputFormat` | `"hex"` | The format of the value the gradient view writes. Only applies when the view is set to "gradient". |
293
+ | `invalid` | `boolean` | `false` | Marks the color picker as invalid. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
294
+ | `opacity` | `boolean` | `true` | Whether to display the opacity slider. Only applies when the view is set to "gradient". |
295
+ | `palette` | `Iterable<string \| ColorPaletteItem> \| PaletteType` | `"flat"` | The type of color palette to use. This can be a predefined palette type like "flat", "material", or "websafe", or a custom iterable of CSS color strings or `{ color, name }` items. |
296
+ | `readonly` | `boolean` | `false` | Prevents value changes while preserving the component's visual state. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
297
+ | `required` | `boolean` | `false` | Sets whether the color picker is required. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
298
+ | `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Border-radius preset applied to the color picker. |
299
+ | `showButtons` | `boolean` | `true` | Whether the gradient view has Apply and Cancel buttons. Without them, each change writes the value at once. Only applies when the view is set to "gradient". |
300
+ | `showClearButton` | `boolean` | `false` | Whether to show the clear button to reset the color. This is only applicable when the view is set to "palette". |
301
+ | `size` | `"large" \| "medium" \| "small"` | `"medium"` | Size preset controlling the color picker's dimensions. |
302
+ | `tileSize` | `number` | `24` | The size of each palette tile, in pixels. Only applies when the view is set to "palette". Below 24, tiles miss the minimum target size of WCAG 2.5.8. |
303
+ | `touched` | `boolean` | `false` | Sets the touched state of the color picker. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
304
+ | `value` (two-way) | `string \| null` | `null` | Two-way bindable current color value. |
305
+ | `view` | `ColorPickerView` | `"gradient"` | The view mode of the color picker. This can be either "palette" or "gradient". |
306
+
307
+ #### Outputs
308
+
309
+ | Name | Type | Description |
310
+ | --- | --- | --- |
311
+ | `touch` | `void` | Emitted when focus leaves the color picker or its popup closes. A color selected with `closeOnSelect` off doesn't emit it until then. The `FormField` directive listens to this to mark the field as touched. |
312
+ | `valueChange` | `string \| null` | Emitted when `value` changes. |
313
+
314
+ #### Methods
315
+
316
+ | Signature | Description |
317
+ | --- | --- |
318
+ | `focus(options?: FocusOptions): void` | Moves focus to the color picker. |
319
+
320
+ ### `ColorPickerValueTemplateDirective`
321
+
322
+ **Selector:** `ng-template[monaColorPickerValueTemplate]`
323
+
324
+ #### Template context
325
+
326
+ | Name | Type |
327
+ | --- | --- |
328
+ | `$implicit` | `string \| null` |
329
+
330
+ ### Types
331
+
332
+ #### `COLOR_PICKER_DEFAULT_MESSAGES`
333
+
334
+ ```typescript
335
+ const COLOR_PICKER_DEFAULT_MESSAGES: MonaColorPickerMessages;
336
+ ```
337
+
338
+ #### `ColorPickerValueTemplateContext`
339
+
340
+ | Name | Type |
341
+ | --- | --- |
342
+ | `$implicit` | `string \| null` |
343
+
344
+ #### `ColorPickerView`
345
+
346
+ ```typescript
347
+ type ColorPickerView = "gradient" | "palette";
348
+ ```
349
+
350
+ #### `ColorOutputFormat`
351
+
352
+ From `@nanahoshi/mona-ui/common`.
353
+
354
+ ```typescript
355
+ type ColorOutputFormat = "hex" | "rgb" | "hsl";
356
+ ```
357
+
358
+ #### `ColorPaletteItem`
359
+
360
+ From `@nanahoshi/mona-ui/common`.
361
+
362
+ A swatch with a name of its own, for a palette whose colors mean something, such as brand colors.
363
+
364
+ | Name | Type | Description |
365
+ | --- | --- | --- |
366
+ | `color` (read-only) | `string` | Any CSS color. |
367
+ | `name?` (read-only) | `string` | What the color is called. Assistive technology reads it, and it shows as a tooltip. |
368
+
369
+ #### `MonaColorPickerMessages`
370
+
371
+ From `@nanahoshi/mona-ui/i18n`.
372
+
373
+ | Name | Type |
374
+ | --- | --- |
375
+ | `clearColor` (read-only) | `string` |
376
+ | `colorGradientPicker` (read-only) | `string` |
377
+ | `colorPalettePicker` (read-only) | `string` |
378
+ | `colorPicker` (read-only) | `string` |
379
+ | `noColor` (read-only) | `string` |
380
+
381
+ #### `PaletteType`
382
+
383
+ From `@nanahoshi/mona-ui/common`.
384
+
385
+ ```typescript
386
+ type PaletteType = "flat" | "material" | "websafe";
387
+ ```