@nanahoshi/mona-ui 0.25.1 → 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 (222) 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.mjs +12 -0
  75. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
  76. package/fesm2022/nanahoshi-mona-ui-chart.mjs +86 -0
  77. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
  78. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
  79. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
  80. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  81. package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
  82. package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
  83. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
  84. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
  85. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
  86. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
  87. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
  88. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
  89. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
  90. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
  91. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
  92. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
  93. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
  94. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
  95. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
  96. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
  97. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  98. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  99. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
  100. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
  101. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
  102. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
  103. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
  104. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
  105. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
  106. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
  107. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
  108. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
  109. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
  110. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
  111. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
  112. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
  113. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
  114. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
  117. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
  118. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
  119. package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
  120. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
  121. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
  122. package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
  123. package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
  124. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
  125. package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
  126. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
  127. package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
  128. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -0
  129. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
  130. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
  131. package/fesm2022/nanahoshi-mona-ui-slider.mjs +7 -2
  132. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
  133. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
  134. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
  135. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
  136. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
  137. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
  138. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
  139. package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
  140. package/i18n/catalogs/en-US.messages.json +10 -0
  141. package/internal/popup-menu/package.json +4 -0
  142. package/llms.txt +123 -0
  143. package/locales/ar-sa/ar-sa.messages.json +10 -0
  144. package/locales/de-de/de-de.messages.json +10 -0
  145. package/locales/es-es/es-es.messages.json +10 -0
  146. package/locales/fr-fr/fr-fr.messages.json +10 -0
  147. package/locales/id-id/id-id.messages.json +10 -0
  148. package/locales/it-it/it-it.messages.json +10 -0
  149. package/locales/ja-jp/ja-jp.messages.json +10 -0
  150. package/locales/ko-kr/ko-kr.messages.json +10 -0
  151. package/locales/pt-br/pt-br.messages.json +10 -0
  152. package/locales/ru-ru/ru-ru.messages.json +10 -0
  153. package/locales/tr-tr/tr-tr.messages.json +10 -0
  154. package/locales/zh-cn/zh-cn.messages.json +10 -0
  155. package/locales/zh-tw/zh-tw.messages.json +10 -0
  156. package/package.json +9 -1
  157. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
  158. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
  159. package/types/nanahoshi-mona-ui-button.d.ts +12 -0
  160. package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
  161. package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
  162. package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
  163. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
  164. package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
  165. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
  166. package/types/nanahoshi-mona-ui-command.d.ts +253 -0
  167. package/types/nanahoshi-mona-ui-common.d.ts +17 -1
  168. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
  169. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
  170. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
  171. package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
  172. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
  173. package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
  174. package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
  175. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
  176. package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
  177. package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
  178. package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
  179. package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
  180. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
  181. package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
  182. package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
  183. package/types/nanahoshi-mona-ui-label.d.ts +1 -0
  184. package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
  185. package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
  186. package/types/nanahoshi-mona-ui-list.d.ts +1 -1
  187. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
  188. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
  189. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
  190. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
  191. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
  192. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
  193. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
  194. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
  195. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
  196. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
  197. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
  198. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
  199. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
  200. package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
  201. package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
  202. package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
  203. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
  204. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  205. package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
  206. package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
  207. package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
  208. package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
  209. package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
  210. package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
  211. package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
  212. package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
  213. package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
  214. package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
  215. package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
  216. package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
  217. package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
  218. package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
  219. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
  220. package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
  221. package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
  222. package/types/nanahoshi-mona-ui-window.d.ts +66 -1
@@ -0,0 +1,308 @@
1
+ # Collapsible
2
+
3
+ > A headless disclosure primitive for expandable regions.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/collapsible`
6
+
7
+ **Selectors:** `[monaCollapsible]`, `[monaCollapsibleTrigger]`, `[monaCollapsibleContent]`
8
+
9
+ Collapsible is a headless disclosure primitive. Apply the root, trigger, and content directives to the elements you already use to create an accessible expandable region without adding wrapper markup.
10
+
11
+ ## Overview
12
+
13
+ The Collapsible API is split into three directives:
14
+
15
+ - `CollapsibleDirective` is the headless root. It owns the `expanded` state and provides programmatic controls.
16
+ - `CollapsibleTriggerDirective` toggles the nearest root and wires disclosure attributes to the trigger element.
17
+ - `CollapsibleContentDirective` marks the content region, connects it to the trigger, and animates its measured height.
18
+
19
+ The directives add no wrapper elements. Apply them directly to the elements that should act as the root, trigger, and content region.
20
+
21
+ ## Import & Quick Start
22
+
23
+ ```typescript
24
+ import { Component, signal } from "@angular/core";
25
+ import {
26
+ CollapsibleContentDirective,
27
+ CollapsibleDirective,
28
+ CollapsibleTriggerDirective
29
+ } from "@nanahoshi/mona-ui/collapsible";
30
+ ```
31
+
32
+ Add the directives to a standalone component's `imports` array and bind the root's `expanded` model:
33
+
34
+ ```typescript
35
+ @Component({
36
+ selector: "app-project-details",
37
+ imports: [CollapsibleContentDirective, CollapsibleDirective, CollapsibleTriggerDirective],
38
+ template: `
39
+ <section monaCollapsible [(expanded)]="expanded">
40
+ <button monaCollapsibleTrigger type="button">Project details</button>
41
+ <div monaCollapsibleContent>
42
+ <p>Details are shown while the region is expanded.</p>
43
+ </div>
44
+ </section>
45
+ `
46
+ })
47
+ export class ProjectDetailsComponent {
48
+ protected readonly expanded = signal(false);
49
+ }
50
+ ```
51
+
52
+ The trigger and content directives find their nearest `[monaCollapsible]` root through the directive context. A root can be applied to a `div`, `section`, `li`, or another suitable container.
53
+
54
+ ## Examples
55
+
56
+ ### Two-way state
57
+
58
+ Use `[(expanded)]` when the consumer needs to observe and control the open state. Here it also turns the chevron.
59
+
60
+ `two-way-example.component.ts`
61
+
62
+ ```typescript
63
+ import { Component, signal } from "@angular/core";
64
+ import { LucideChevronDown } from "@lucide/angular";
65
+ import {
66
+ CollapsibleContentDirective,
67
+ CollapsibleDirective,
68
+ CollapsibleTriggerDirective
69
+ } from "@nanahoshi/mona-ui/collapsible";
70
+
71
+ @Component({
72
+ selector: "app-collapsible-two-way-example",
73
+ imports: [CollapsibleContentDirective, CollapsibleDirective, CollapsibleTriggerDirective, LucideChevronDown],
74
+ templateUrl: "./two-way-example.component.html"
75
+ })
76
+ export class CollapsibleTwoWayExampleComponent {
77
+ protected readonly expanded = signal(false);
78
+ }
79
+ ```
80
+
81
+ `two-way-example.component.html`
82
+
83
+ ```html
84
+ <section class="max-w-md rounded-md border border-border" monaCollapsible [(expanded)]="expanded">
85
+ <button class="flex w-full items-center justify-between px-4 py-3 text-left font-medium" monaCollapsibleTrigger type="button">
86
+ Advanced options
87
+ <svg class="transition-transform" lucideChevronDown aria-hidden="true" [class.rotate-180]="expanded()" [size]="16"></svg>
88
+ </button>
89
+ <div monaCollapsibleContent>
90
+ <ul class="list-disc border-t border-border px-8 py-3 text-sm">
91
+ <li>Keep a copy of every version</li>
92
+ <li>Send a summary every Monday</li>
93
+ </ul>
94
+ </div>
95
+ </section>
96
+ <p class="mt-2 text-sm">Expanded: {{ expanded() }}</p>
97
+ ```
98
+
99
+ ### Programmatic control
100
+
101
+ The root is exported as `monaCollapsible`, so `expand()`, `collapse()`, and `toggle()` can be called from a template reference. `disabled` prevents trigger interaction and makes `toggle()` do nothing, but `expand()` and `collapse()` still work.
102
+
103
+ `programmatic-example.component.ts`
104
+
105
+ ```typescript
106
+ import { Component, signal } from "@angular/core";
107
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
108
+ import {
109
+ CollapsibleContentDirective,
110
+ CollapsibleDirective,
111
+ CollapsibleTriggerDirective
112
+ } from "@nanahoshi/mona-ui/collapsible";
113
+
114
+ @Component({
115
+ selector: "app-collapsible-programmatic-example",
116
+ imports: [ButtonDirective, CollapsibleContentDirective, CollapsibleDirective, CollapsibleTriggerDirective],
117
+ templateUrl: "./programmatic-example.component.html"
118
+ })
119
+ export class CollapsibleProgrammaticExampleComponent {
120
+ protected readonly locked = signal(false);
121
+ }
122
+ ```
123
+
124
+ `programmatic-example.component.html`
125
+
126
+ ```html
127
+ <div class="flex flex-col gap-3">
128
+ <div class="flex flex-wrap gap-2">
129
+ <button monaButton type="button" (click)="log.expand()">Expand</button>
130
+ <button monaButton type="button" (click)="log.collapse()">Collapse</button>
131
+ <button monaButton type="button" [toggleable]="true" [(selected)]="locked">Lock the trigger</button>
132
+ </div>
133
+ <section #log="monaCollapsible" class="max-w-md rounded-md border border-border" monaCollapsible [disabled]="locked()">
134
+ <button class="w-full px-4 py-3 text-left font-medium" monaCollapsibleTrigger type="button">Build log</button>
135
+ <div monaCollapsibleContent>
136
+ <p class="border-t border-border px-4 py-3 text-sm">Compiled 42 files in 3.1 seconds. No warnings.</p>
137
+ </div>
138
+ </section>
139
+ </div>
140
+ ```
141
+
142
+ ## Behavior
143
+
144
+ ### Content height
145
+
146
+ The built-in height transition is skipped when the user asks for reduced motion. Set `animate` to `false` to provide your own transition instead.
147
+
148
+ Either way, the directive keeps closed content at an inline `height: 0` and removes it on opening, so a transition of your own has to animate `height`. The content's measured height is published as the `--mona-collapsible-content-height` custom property: give the open state that height, and the element grows to it. Clip the overflow yourself, since content spills out while it grows.
149
+
150
+ `custom-transition-example.component.ts`
151
+
152
+ ```typescript
153
+ import { Component, signal } from "@angular/core";
154
+ import { LucideChevronDown } from "@lucide/angular";
155
+ import {
156
+ CollapsibleContentDirective,
157
+ CollapsibleDirective,
158
+ CollapsibleTriggerDirective
159
+ } from "@nanahoshi/mona-ui/collapsible";
160
+
161
+ @Component({
162
+ selector: "app-collapsible-custom-transition-example",
163
+ imports: [CollapsibleContentDirective, CollapsibleDirective, CollapsibleTriggerDirective, LucideChevronDown],
164
+ templateUrl: "./custom-transition-example.component.html"
165
+ })
166
+ export class CollapsibleCustomTransitionExampleComponent {
167
+ protected readonly expanded = signal(false);
168
+ }
169
+ ```
170
+
171
+ `custom-transition-example.component.html`
172
+
173
+ ```html
174
+ <section class="max-w-md rounded-md border border-border" monaCollapsible [animate]="false" [(expanded)]="expanded">
175
+ <button class="flex w-full items-center justify-between px-4 py-3 text-left font-medium" monaCollapsibleTrigger type="button">
176
+ Shipping details
177
+ <svg class="transition-transform" lucideChevronDown aria-hidden="true" [class.rotate-180]="expanded()" [size]="16"></svg>
178
+ </button>
179
+ <div
180
+ class="overflow-hidden opacity-0 transition-[height,opacity] duration-500 ease-in-out motion-reduce:transition-none data-[state=open]:h-(--mona-collapsible-content-height) data-[state=open]:opacity-100"
181
+ monaCollapsibleContent>
182
+ <p class="border-t border-border px-4 py-3 text-sm">Orders placed before noon leave the warehouse the same day.</p>
183
+ </div>
184
+ </section>
185
+ ```
186
+
187
+ ### Padded content
188
+
189
+ The directive sets the content element's height, block padding and block border inline, so that nothing shows while it's closed. Those inline values are removed when it opens, along with any you set there yourself. Padding from a class survives that, and padding in `style` or a `[style.*]` binding doesn't, so the safe place for padding is an inner element:
190
+
191
+ ```html
192
+ <section monaCollapsible>
193
+ <button monaCollapsibleTrigger type="button">Details</button>
194
+ <div monaCollapsibleContent>
195
+ <div class="p-4">More information</div>
196
+ </div>
197
+ </section>
198
+ ```
199
+
200
+ - While closed, its block padding and border are set to `0` inline, along with its height, so that nothing shows. Padding you set inline on it won't survive a toggle, so put that on an inner element. See [Padded content](#padded-content).
201
+
202
+ ## Accessibility
203
+
204
+ Use a native `button` or `a` element for the trigger when possible. The trigger directive automatically manages the disclosure relationship:
205
+
206
+ | Attribute | Behavior |
207
+ |-----------|----------|
208
+ | `aria-expanded` | Reflects the root's current `expanded` state. |
209
+ | `aria-controls` | References the `id` on the content element, generated unless you gave it one. |
210
+ | `aria-disabled` | Set to `"true"` when the root is disabled. |
211
+
212
+ Native button triggers receive `type="button"` and use the browser's native role, focusability, and disabled behavior. A native `input` is disabled the same way, and a disabled `summary` doesn't open its `details`. Other trigger elements receive `role="button"` and `tabindex="0"`; `Enter` and `Space` toggle the root and prevent their default action. A non-native trigger, or an `a`, becomes unfocusable (`tabindex="-1"`) while disabled, and a disabled `a` doesn't follow its `href`.
213
+
214
+ A control inside a trigger, such as a button or an input in a `div` used as one, keeps its own clicks and keys, and doesn't toggle the root.
215
+
216
+ The content element is marked `inert` while collapsed, preventing focus from entering content that is not currently available. Its collapsed height is set in the first pass, so collapsed content doesn't paint open. Give every trigger an accessible name through visible text or an appropriate ARIA naming attribute.
217
+
218
+ ## API
219
+
220
+ Everything below is imported from `@nanahoshi/mona-ui/collapsible`.
221
+
222
+ ### `CollapsibleDirective`
223
+
224
+ Headless disclosure root. Adds no markup of its own, so it can be applied to any element
225
+ (`li`, `div`, `section`) and paired with `monaCollapsibleTrigger` and `monaCollapsibleContent`.
226
+
227
+ **Selector:** `[monaCollapsible]`
228
+ **Exported as:** `monaCollapsible`
229
+
230
+ #### Inputs
231
+
232
+ | Name | Type | Default | Description |
233
+ | --- | --- | --- | --- |
234
+ | `animate` | `boolean` | `true` | Enables the height transition applied to the collapsible content. |
235
+ | `disabled` | `boolean` | `false` | Suppresses toggling through the trigger. `expand()` and `collapse()` still apply. |
236
+ | `expanded` (two-way) | `boolean` | `false` | Sets whether the content is expanded. Supports two-way binding. |
237
+
238
+ #### Outputs
239
+
240
+ | Name | Type | Description |
241
+ | --- | --- | --- |
242
+ | `expandedChange` | `boolean` | Emitted when `expanded` changes. |
243
+
244
+ #### Properties
245
+
246
+ | Name | Type | Description |
247
+ | --- | --- | --- |
248
+ | `contentId` (read-only) | `string` | Id of the content element, which the trigger references through `aria-controls`. Generated, unless the content element has its own `id`. |
249
+
250
+ #### Methods
251
+
252
+ | Signature | Description |
253
+ | --- | --- |
254
+ | `collapse(): void` | Sets `expanded` to `false`. |
255
+ | `expand(): void` | Sets `expanded` to `true`. |
256
+ | `setContentId(id: string \| null): void` | Takes the ID the content element was given, so the trigger points at it. `CollapsibleContentDirective` calls it, so there's no need to. |
257
+ | `toggle(): void` | Toggles `expanded` unless the root is disabled. |
258
+
259
+ ### `CollapsibleContentDirective`
260
+
261
+ Animates the height of the collapsible content between `0` and its measured size. Adds no wrapper
262
+ element, so it can be applied directly to a `ul`, `div` or any other container with any number of children.
263
+
264
+ The measured size is also published on the host as the `--mona-collapsible-content-height` custom
265
+ property, so consumers can drive their own animation instead (pair it with `[animate]="false"` on the root).
266
+
267
+ **Selector:** `[monaCollapsibleContent]`
268
+
269
+ #### Inputs
270
+
271
+ | Name | Type | Default | Description |
272
+ | --- | --- | --- | --- |
273
+ | `id` | `string \| null` | `null` | The content's id, for when it has to be something in particular. Generated if not given. |
274
+
275
+ ### `CollapsibleTriggerDirective`
276
+
277
+ Toggles the closest `monaCollapsible`. Wires `aria-expanded` / `aria-controls` automatically and
278
+ only adds `role`, `tabindex` and keyboard handling when the host element is not already interactive.
279
+
280
+ **Selector:** `[monaCollapsibleTrigger]`
281
+
282
+ ### Types
283
+
284
+ #### `COLLAPSIBLE_CONFIG`
285
+
286
+ ```typescript
287
+ const COLLAPSIBLE_CONFIG: InjectionToken<CollapsibleConfig>;
288
+ ```
289
+
290
+ #### `CollapsibleConfig`
291
+
292
+ The contract a collapsible root exposes to its trigger and content parts.
293
+
294
+ | Name | Type |
295
+ | --- | --- |
296
+ | `animate` (read-only) | `Signal<boolean>` |
297
+ | `contentId` (read-only) | `string` |
298
+ | `disabled` (read-only) | `Signal<boolean>` |
299
+ | `expanded` (read-only) | `Signal<boolean>` |
300
+
301
+ **Methods**
302
+
303
+ | Signature | Description |
304
+ | --- | --- |
305
+ | `collapse(): void` | Collapses the content. |
306
+ | `expand(): void` | Expands the content. |
307
+ | `setContentId(id: string \| null): void` | Takes the id the content was given, so the trigger points at it. A root without it always uses `contentId`. |
308
+ | `toggle(): void` | Switches between expanded and collapsed. The trigger calls it on activation. |
@@ -0,0 +1,336 @@
1
+ # Color Gradient
2
+
3
+ > A color editor for saturation, value, hue and alpha.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/color-gradient`
6
+
7
+ **Selector:** `mona-color-gradient`
8
+
9
+ `ColorGradientComponent` is a color editor for selecting saturation, value, hue, and optional alpha, with hex/channel inputs and signal forms integration via `FormValueControl<string | null | undefined>`.
10
+
11
+ ## Overview
12
+
13
+ Use `ColorGradientComponent` when a user needs to choose a custom color rather than selecting from a fixed palette. It exposes a two-way `value` model, optional Apply/Cancel buttons, optional alpha editing, and channel inputs that can switch between RGB and HSV entry.
14
+
15
+ Use `ColorPaletteComponent` when the user should choose only from known colors. Use `ColorPickerComponent` when the color editor should open from a compact dropdown-style control.
16
+
17
+ > **Forms.** `ColorGradientComponent` implements `FormValueControl<string | null | undefined>` 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 { ColorGradientComponent } from "@nanahoshi/mona-ui/color-gradient";
23
+ ```
24
+
25
+ **Direct value binding**
26
+
27
+ ```html
28
+ <mona-color-gradient [(value)]="color"></mona-color-gradient>
29
+ ```
30
+
31
+ ```typescript
32
+ protected readonly color = signal<string | null | undefined>("#336699");
33
+ ```
34
+
35
+ **Signal forms**
36
+
37
+ ```typescript
38
+ import { signal } from "@angular/core";
39
+ import { FormField, form } from "@angular/forms/signals";
40
+ import { ColorGradientComponent } from "@nanahoshi/mona-ui/color-gradient";
41
+
42
+ protected readonly form = form(signal<{ color: string | null }>({ color: "#336699" }));
43
+ ```
44
+
45
+ ```html
46
+ <mona-color-gradient [formField]="form.color" [showButtons]="false"></mona-color-gradient>
47
+ ```
48
+
49
+ ## Examples
50
+
51
+ ### Apply and Cancel
52
+
53
+ With `showButtons` on, the default, `value` changes only when Apply is pressed. Use `(apply)` and `(cancel)` to react to the buttons.
54
+
55
+ `buttons-example.component.ts`
56
+
57
+ ```typescript
58
+ import { Component, signal } from "@angular/core";
59
+ import { ColorGradientComponent } from "@nanahoshi/mona-ui/color-gradient";
60
+
61
+ @Component({
62
+ selector: "app-color-gradient-buttons-example",
63
+ imports: [ColorGradientComponent],
64
+ templateUrl: "./buttons-example.component.html"
65
+ })
66
+ export class ColorGradientButtonsExampleComponent {
67
+ protected readonly color = signal<string | null | undefined>("#336699");
68
+ protected readonly lastAction = signal("none");
69
+ }
70
+ ```
71
+
72
+ `buttons-example.component.html`
73
+
74
+ ```html
75
+ <div class="flex flex-col items-start gap-2">
76
+ <mona-color-gradient
77
+ aria-label="Theme color"
78
+ [(value)]="color"
79
+ (apply)="lastAction.set('applied')"
80
+ (cancel)="lastAction.set('canceled')" />
81
+ <span aria-live="polite" class="text-sm">Saved: {{ color() }}, last action: {{ lastAction() }}</span>
82
+ </div>
83
+ ```
84
+
85
+ ### Immediate updates
86
+
87
+ Set `showButtons` to `false` when each adjustment should update the bound value immediately. `format` controls the emitted color string: `hex`, `rgb`, or `hsl`.
88
+
89
+ `immediate-example.component.ts`
90
+
91
+ ```typescript
92
+ import { Component, signal } from "@angular/core";
93
+ import { ColorGradientComponent } from "@nanahoshi/mona-ui/color-gradient";
94
+
95
+ @Component({
96
+ selector: "app-color-gradient-immediate-example",
97
+ imports: [ColorGradientComponent],
98
+ templateUrl: "./immediate-example.component.html"
99
+ })
100
+ export class ColorGradientImmediateExampleComponent {
101
+ protected readonly color = signal<string | null | undefined>("rgba(233, 69, 96, 1)");
102
+ }
103
+ ```
104
+
105
+ `immediate-example.component.html`
106
+
107
+ ```html
108
+ <div class="flex flex-col items-start gap-2">
109
+ <mona-color-gradient aria-label="Accent color" format="rgb" [showButtons]="false" [(value)]="color" />
110
+ <span class="text-sm">Value: {{ color() }}</span>
111
+ </div>
112
+ ```
113
+
114
+ ### Hide optional controls
115
+
116
+ Use this when the surrounding UI already provides text entry or when the editor should stay compact.
117
+
118
+ `compact-example.component.ts`
119
+
120
+ ```typescript
121
+ import { Component, signal } from "@angular/core";
122
+ import { ColorGradientComponent } from "@nanahoshi/mona-ui/color-gradient";
123
+
124
+ @Component({
125
+ selector: "app-color-gradient-compact-example",
126
+ imports: [ColorGradientComponent],
127
+ templateUrl: "./compact-example.component.html"
128
+ })
129
+ export class ColorGradientCompactExampleComponent {
130
+ protected readonly color = signal<string | null | undefined>("#0f3460");
131
+ }
132
+ ```
133
+
134
+ `compact-example.component.html`
135
+
136
+ ```html
137
+ <mona-color-gradient
138
+ aria-label="Label color"
139
+ [opacity]="false"
140
+ [showButtons]="false"
141
+ [showColorInputs]="false"
142
+ [showHexInput]="false"
143
+ [(value)]="color" />
144
+ ```
145
+
146
+ ## Appearance & Styling
147
+
148
+ ### Rounded variants
149
+
150
+ ```html
151
+ <mona-color-gradient [(value)]="color" rounded="large"></mona-color-gradient>
152
+ ```
153
+
154
+ Supported rounded values are `none`, `small`, `medium`, `large`, and `full`.
155
+
156
+ ## Behavior
157
+
158
+ ### Value Parsing & Output
159
+
160
+ The `value` model accepts `undefined`, `null`, and color strings. When `value` is `undefined`, the controls stay as they are, white to begin with. When `value` is `null`, the controls show no color.
161
+
162
+ It reads what the browser can paint:
163
+
164
+ | Input shape | Example |
165
+ |---------------|---------------------------------------------------------------------------|
166
+ | Hex | `#336699`, `#369`, `#336699cc` |
167
+ | RGB/RGBA | `rgb(51, 102, 153)`, `rgba(51, 102, 153, 0.8)`, `rgb(51 102 153 / 80%)` |
168
+ | HSL/HSLA | `hsl(210, 50%, 40%)`, `hsla(210.5, 50%, 40%, 0.8)`, `hsl(210 50% 40%)` |
169
+ | Anything else | `red`, `transparent`, `oklch(50% 0.1 200)`, through the browser's canvas |
170
+
171
+ A value it still can't read, such as `var(--brand)`, shows as no color and warns in development. Apply only writes after an edit, so that value and any other stay exactly as written until a user changes the color. The exception is a `value` of `undefined`, where Apply writes the color on screen. A color outside sRGB comes back as its closest sRGB color once edited.
172
+
173
+ When the component emits a value, the emitted string follows the `format` input:
174
+
175
+ | `format` | Written as |
176
+ |----------|------------------------------------------------------------|
177
+ | `hex` | `#336699`, or `#336699cc` when the color isn't fully opaque |
178
+ | `rgb` | `rgba(51, 102, 153, 0.8)`, with alpha always included |
179
+ | `hsl` | `hsla(210, 50%, 40%, 0.8)`, with alpha always included |
180
+
181
+ Alpha is written with as few decimals as read back the same, so a saved `0.5` stays `0.5`. HSL channels have one decimal, because whole percentages can't bring most colors back.
182
+
183
+ Cancel puts the controls back on `value`. With the buttons shown, Clear only empties the controls until Apply, and the previous color stays available until then. With `showButtons` off, Clear writes `null` at once.
184
+
185
+ ### Right to Left
186
+
187
+ The hue and alpha sliders stay left to right on an RTL page, like the saturation and value area, so each handle sits over the color it selects, and the right arrow moves up the scale.
188
+
189
+ ## Forms Integration
190
+
191
+ `ColorGradientComponent` implements `FormValueControl<string | null | undefined>` from `@angular/forms/signals`.
192
+
193
+ ```typescript
194
+ import { signal } from "@angular/core";
195
+ import { FormField, disabled, form } from "@angular/forms/signals";
196
+
197
+ protected readonly form = form(signal<{ color: string | null }>({ color: "#336699" }), schema => {
198
+ disabled(schema.color, { when: () => this.locked() });
199
+ });
200
+ ```
201
+
202
+ ```html
203
+ <mona-color-gradient [formField]="form.color" [showButtons]="false"></mona-color-gradient>
204
+ ```
205
+
206
+ The `touch` output fires when focus leaves the component. Moving between its controls doesn't fire it. The signal forms `FormField` directive listens to this output to mark the field as touched.
207
+
208
+ ## Accessibility
209
+
210
+ The host is a `role="group"` named by the `aria-label` input, `aria-labelledby` or a `mona-label`, or `"Color gradient"` otherwise. It has `aria-invalid="true"` once `touched` and either `invalid`, or `required` with no color. Every slider and input has a name of its own, and the alpha slider reads as a percentage. The saturation/value handle renders a focusable slider and exposes the current saturation and value.
211
+
212
+ | Attribute | When present | Value |
213
+ |------------------|---------------------------------------|--------------------------------------|
214
+ | `role` | Always on the saturation/value handle | `"slider"` |
215
+ | `aria-label` | Always on the saturation/value handle | `"Color saturation and value"` |
216
+ | `aria-valuemin` | Always on the saturation/value handle | `0` |
217
+ | `aria-valuemax` | Always on the saturation/value handle | `100` |
218
+ | `aria-valuenow` | Always on the saturation/value handle | Current saturation, `0` with no color |
219
+ | `aria-valuetext` | Always on the saturation/value handle | `"Saturation n%, Value n%"` |
220
+ | `aria-disabled` | When disabled | `true` |
221
+ | `aria-readonly` | When read-only | `true` |
222
+ | `tabindex` | Always on the saturation/value handle | `0` when enabled, `-1` when disabled |
223
+
224
+ The previous-color swatch has `role="button"`. The current-color preview is marked `aria-hidden`.
225
+
226
+ **Consumer responsibilities**
227
+
228
+ - Provide nearby text or form labeling that explains what color the control edits.
229
+ - When using signal forms, use `[formField]` so the form field can receive `value` and listen to `touch`.
230
+
231
+ ### Keyboard Interaction
232
+
233
+ The saturation/value handle is focusable when the component is enabled. Pressing anywhere in the area starts a drag with the primary button.
234
+
235
+ | Key | Action |
236
+ |---------------------|---------------------------------|
237
+ | `ArrowLeft` | Decrease saturation by 1 |
238
+ | `ArrowRight` | Increase saturation by 1 |
239
+ | `ArrowUp` | Increase value by 1 |
240
+ | `ArrowDown` | Decrease value by 1 |
241
+ | `Shift` + arrow key | Adjust by 10 instead of 1 |
242
+ | `PageUp` | Increase value by 25 |
243
+ | `PageDown` | Decrease value by 25 |
244
+ | `Home` | Move to saturation 0, value 100 |
245
+ | `End` | Move to saturation 100, value 0 |
246
+
247
+ The previous-color swatch is keyboard-activatable with `Enter` and `Space`.
248
+
249
+ ## API
250
+
251
+ Everything below is imported from `@nanahoshi/mona-ui/color-gradient`.
252
+
253
+ ### `ColorGradientComponent`
254
+
255
+ **Selector:** `mona-color-gradient`
256
+ **Implements:** `FormValueControl<string \| null \| undefined>`
257
+
258
+ #### Inputs
259
+
260
+ | Name | Type | Default | Description |
261
+ | --- | --- | --- | --- |
262
+ | `aria-label` | `string` | `""` | Accessible name of the group of controls. |
263
+ | `aria-labelledby` | `string` | `""` | Id of the element that names the group of controls. |
264
+ | `disabled` | `boolean` | `false` | Sets the disabled state of the color gradient. |
265
+ | `format` | `ColorOutputFormat` | `"hex"` | Specifies the format of the color output. |
266
+ | `invalid` | `boolean` | `false` | Marks the color gradient as invalid. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
267
+ | `opacity` | `boolean` | `true` | Specifies whether the color picker should display the alpha slider. |
268
+ | `readonly` | `boolean` | `false` | Prevents value changes while the control stays focusable and readable. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
269
+ | `required` | `boolean` | `false` | Marks the color gradient as required for form validation. |
270
+ | `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Specifies the rounded variant of the color picker. |
271
+ | `showButtons` | `boolean` | `true` | Specifies whether the color picker should display the buttons. When set to true, the color picker will display the "Apply" and "Cancel" buttons. When set to false, the color picker will not display the buttons and will emit the color value on change. |
272
+ | `showColorInputs` | `boolean` | `true` | Specifies whether the color picker should display the channel inputs (RGB or HSV). |
273
+ | `showHexInput` | `boolean` | `true` | Specifies whether the color picker should display the hex input. |
274
+ | `touched` | `boolean` | `false` | Marks the color gradient as touched. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
275
+ | `value` (two-way) | `string \| null \| undefined` | `undefined` | Two-way bindable current color value. When undefined, the component keeps its default internal color state (white, #ffffffff). |
276
+
277
+ #### Outputs
278
+
279
+ | Name | Type | Description |
280
+ | --- | --- | --- |
281
+ | `apply` | `void` | Emits when the Apply button is clicked. The `Apply` button is only displayed when `showButtons` is set to true. |
282
+ | `cancel` | `void` | Emits when the Cancel button is clicked, after the controls go back to the current value. The `Cancel` button is only displayed when `showButtons` is set to true. |
283
+ | `touch` | `void` | Emitted when focus leaves the color gradient. Moving between its own parts doesn't count. The `FormField` directive listens to this to mark the field as touched. |
284
+ | `valueChange` | `string \| null \| undefined` | Emitted when `value` changes. |
285
+
286
+ #### Methods
287
+
288
+ | Signature | Description |
289
+ | --- | --- |
290
+ | `focus(options?: FocusOptions): void` | Moves focus to the saturation and value handle. |
291
+
292
+ ### Types
293
+
294
+ #### `COLOR_GRADIENT_DEFAULT_MESSAGES`
295
+
296
+ ```typescript
297
+ const COLOR_GRADIENT_DEFAULT_MESSAGES: MonaColorGradientMessages;
298
+ ```
299
+
300
+ #### `ColorOutputFormat`
301
+
302
+ From `@nanahoshi/mona-ui/common`.
303
+
304
+ ```typescript
305
+ type ColorOutputFormat = "hex" | "rgb" | "hsl";
306
+ ```
307
+
308
+ #### `MonaColorGradientMessages`
309
+
310
+ From `@nanahoshi/mona-ui/i18n`.
311
+
312
+ | Name | Type |
313
+ | --- | --- |
314
+ | `alpha` (read-only) | `string` |
315
+ | `alphaText` (read-only) | `(opacity: number) => string` |
316
+ | `apply` (read-only) | `string` |
317
+ | `blue` (read-only) | `string` |
318
+ | `cancel` (read-only) | `string` |
319
+ | `clearColor` (read-only) | `string` |
320
+ | `colorCopied` (read-only) | `string` |
321
+ | `colorGradient` (read-only) | `string` |
322
+ | `copyAsHex` (read-only) | `string` |
323
+ | `copyAsRgb` (read-only) | `string` |
324
+ | `copyColor` (read-only) | `string` |
325
+ | `copyFailed` (read-only) | `string` |
326
+ | `currentColor` (read-only) | `string` |
327
+ | `green` (read-only) | `string` |
328
+ | `hexColor` (read-only) | `string` |
329
+ | `hue` (read-only) | `string` |
330
+ | `previousColor` (read-only) | `string` |
331
+ | `red` (read-only) | `string` |
332
+ | `saturation` (read-only) | `string` |
333
+ | `saturationAndValue` (read-only) | `string` |
334
+ | `saturationAndValueText` (read-only) | `(saturation: number, value: number) => string` |
335
+ | `switchColorMode` (read-only) | `string` |
336
+ | `value` (read-only) | `string` |