@nanahoshi/mona-ui 0.25.1 → 0.26.1

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 (233) hide show
  1. package/README.md +2 -0
  2. package/chart/README.md +2 -2
  3. package/command/package.json +4 -0
  4. package/docs/auto-complete.md +733 -0
  5. package/docs/avatar.md +220 -0
  6. package/docs/breadcrumb.md +320 -0
  7. package/docs/button-group.md +392 -0
  8. package/docs/button.md +256 -0
  9. package/docs/calendar.md +515 -0
  10. package/docs/card.md +292 -0
  11. package/docs/chart-bar.md +714 -0
  12. package/docs/chart-financial.md +567 -0
  13. package/docs/chart-funnel.md +546 -0
  14. package/docs/chart-heatmap.md +535 -0
  15. package/docs/chart-line-area.md +462 -0
  16. package/docs/chart-pie.md +645 -0
  17. package/docs/chart-radar.md +518 -0
  18. package/docs/chart-radial.md +658 -0
  19. package/docs/chart-scatter.md +479 -0
  20. package/docs/chart-treemap.md +651 -0
  21. package/docs/chart.md +2465 -0
  22. package/docs/checkbox.md +374 -0
  23. package/docs/chip.md +339 -0
  24. package/docs/circular-progress-bar.md +287 -0
  25. package/docs/collapsible.md +308 -0
  26. package/docs/color-gradient.md +336 -0
  27. package/docs/color-palette.md +317 -0
  28. package/docs/color-picker.md +387 -0
  29. package/docs/combo-box.md +764 -0
  30. package/docs/command.md +582 -0
  31. package/docs/contextmenu.md +530 -0
  32. package/docs/date-picker.md +251 -0
  33. package/docs/datetime-picker.md +284 -0
  34. package/docs/decimal-textbox.md +260 -0
  35. package/docs/dialog.md +822 -0
  36. package/docs/dropdown-button.md +507 -0
  37. package/docs/dropdown-list.md +779 -0
  38. package/docs/editor.md +374 -0
  39. package/docs/expansion-panel.md +348 -0
  40. package/docs/fieldset.md +217 -0
  41. package/docs/forms.md +162 -0
  42. package/docs/grid.md +2053 -0
  43. package/docs/input.md +197 -0
  44. package/docs/installation.md +54 -0
  45. package/docs/introduction.md +46 -0
  46. package/docs/label.md +340 -0
  47. package/docs/list-box.md +637 -0
  48. package/docs/list-view.md +584 -0
  49. package/docs/menubar.md +559 -0
  50. package/docs/multi-select.md +765 -0
  51. package/docs/notification.md +460 -0
  52. package/docs/numeric-textbox.md +301 -0
  53. package/docs/otp-input.md +539 -0
  54. package/docs/pager.md +513 -0
  55. package/docs/placeholder.md +176 -0
  56. package/docs/popover.md +423 -0
  57. package/docs/popup-menu.md +658 -0
  58. package/docs/popup.md +617 -0
  59. package/docs/progress-bar.md +368 -0
  60. package/docs/radio-button.md +451 -0
  61. package/docs/range-slider.md +367 -0
  62. package/docs/rating.md +518 -0
  63. package/docs/scroll-view.md +375 -0
  64. package/docs/segmented.md +434 -0
  65. package/docs/sheet.md +348 -0
  66. package/docs/sidebar.md +1126 -0
  67. package/docs/skeleton.md +181 -0
  68. package/docs/slider.md +423 -0
  69. package/docs/spinner.md +370 -0
  70. package/docs/split-button.md +522 -0
  71. package/docs/splitter.md +342 -0
  72. package/docs/stepper.md +539 -0
  73. package/docs/switch.md +340 -0
  74. package/docs/tabs.md +542 -0
  75. package/docs/textarea.md +196 -0
  76. package/docs/textbox.md +332 -0
  77. package/docs/theming.md +403 -0
  78. package/docs/time-picker.md +254 -0
  79. package/docs/tooltip-directive.md +340 -0
  80. package/docs/tooltip.md +321 -0
  81. package/docs/tree-view.md +1018 -0
  82. package/docs/window.md +663 -0
  83. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  84. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
  85. package/fesm2022/nanahoshi-mona-ui-button.mjs +12 -0
  86. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
  87. package/fesm2022/nanahoshi-mona-ui-chart.mjs +212 -66
  88. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
  89. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
  90. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
  91. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  92. package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
  93. package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
  94. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
  95. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
  96. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
  97. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
  98. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
  99. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
  100. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
  101. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
  102. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
  103. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
  104. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
  105. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
  106. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
  107. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
  108. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  109. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  110. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
  111. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
  112. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
  113. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
  114. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
  117. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
  118. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
  119. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
  120. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
  121. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
  122. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
  123. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
  124. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
  125. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
  126. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
  127. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
  128. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
  129. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
  130. package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
  131. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
  132. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
  133. package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
  134. package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
  135. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
  136. package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
  137. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
  138. package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
  139. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -0
  140. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
  141. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
  142. package/fesm2022/nanahoshi-mona-ui-slider.mjs +7 -2
  143. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
  144. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
  145. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
  146. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
  147. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
  148. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
  149. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
  150. package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
  151. package/i18n/catalogs/en-US.messages.json +10 -0
  152. package/internal/popup-menu/package.json +4 -0
  153. package/llms.txt +133 -0
  154. package/locales/ar-sa/ar-sa.messages.json +10 -0
  155. package/locales/de-de/de-de.messages.json +10 -0
  156. package/locales/es-es/es-es.messages.json +10 -0
  157. package/locales/fr-fr/fr-fr.messages.json +10 -0
  158. package/locales/id-id/id-id.messages.json +10 -0
  159. package/locales/it-it/it-it.messages.json +10 -0
  160. package/locales/ja-jp/ja-jp.messages.json +10 -0
  161. package/locales/ko-kr/ko-kr.messages.json +10 -0
  162. package/locales/pt-br/pt-br.messages.json +10 -0
  163. package/locales/ru-ru/ru-ru.messages.json +10 -0
  164. package/locales/tr-tr/tr-tr.messages.json +10 -0
  165. package/locales/zh-cn/zh-cn.messages.json +10 -0
  166. package/locales/zh-tw/zh-tw.messages.json +10 -0
  167. package/package.json +9 -1
  168. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
  169. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
  170. package/types/nanahoshi-mona-ui-button.d.ts +12 -0
  171. package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
  172. package/types/nanahoshi-mona-ui-chart.d.ts +250 -20
  173. package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
  174. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
  175. package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
  176. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
  177. package/types/nanahoshi-mona-ui-command.d.ts +253 -0
  178. package/types/nanahoshi-mona-ui-common.d.ts +17 -1
  179. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
  180. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
  181. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
  182. package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
  183. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
  184. package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
  185. package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
  186. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
  187. package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
  188. package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
  189. package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
  190. package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
  191. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
  192. package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
  193. package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
  194. package/types/nanahoshi-mona-ui-label.d.ts +1 -0
  195. package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
  196. package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
  197. package/types/nanahoshi-mona-ui-list.d.ts +1 -1
  198. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
  199. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
  200. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
  201. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
  202. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
  203. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
  204. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
  205. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
  206. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
  207. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
  208. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
  209. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
  210. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
  211. package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
  212. package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
  213. package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
  214. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
  215. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  216. package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
  217. package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
  218. package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
  219. package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
  220. package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
  221. package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
  222. package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
  223. package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
  224. package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
  225. package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
  226. package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
  227. package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
  228. package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
  229. package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
  230. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
  231. package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
  232. package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
  233. package/types/nanahoshi-mona-ui-window.d.ts +66 -1
@@ -0,0 +1,522 @@
1
+ # Split Button
2
+
3
+ > A primary action button paired with a menu of secondary actions.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/split-button`
6
+
7
+ **Selectors:** `mona-split-button` · `mona-split-button-item` · `mona-split-button-group` · `mona-split-button-separator` · `mona-split-button-checkbox-item` · `mona-split-button-radio-group` · `mona-split-button-radio-item`
8
+
9
+ `SplitButtonComponent` renders a dual-action control combining a primary action button with a dropdown menu of secondary actions.
10
+
11
+ ## Overview
12
+
13
+ `SplitButtonComponent` is a compound control made of two adjacent buttons — a primary action button at the start and a menu toggle at the end (the right of it in left-to-right pages, the left in right-to-left ones) — that share the same visual style. Clicking the main button triggers `buttonClick` directly. Clicking the toggle opens a popup containing secondary actions structured as items, groups, separators, checkboxes, or radio groups.
14
+
15
+ **Use `SplitButtonComponent` when you need to:**
16
+
17
+ - Provide one default action alongside a set of related secondary actions (e.g., "Save" + "Save as…", "Publish" + "Schedule", "Download" + "Export formats")
18
+ - Keep the primary action one click away while making less-common actions discoverable without cluttering the toolbar
19
+
20
+ **Use `DropDownButtonComponent` instead when:**
21
+
22
+ - There is no single dominant action — all choices are peer options
23
+ - You do not need to distinguish between a primary click and a menu selection at the event level
24
+
25
+ ## Import & Quick Start
26
+
27
+ ```typescript
28
+ import { SplitButtonCheckboxItemComponent, SplitButtonComponent, SplitButtonGroupComponent, SplitButtonItemComponent, SplitButtonRadioGroupComponent, SplitButtonRadioItemComponent, SplitButtonSeparatorComponent } from "@nanahoshi/mona-ui/split-button";
29
+ ```
30
+
31
+ Add the components you need to your standalone component's `imports` array.
32
+
33
+ **Minimal example — a button with two menu items:**
34
+
35
+ ```html
36
+
37
+ <mona-split-button text="Save" (buttonClick)="onSave()">
38
+ <mona-split-button-item label="Save as…" (menuClick)="onSaveAs($event)"></mona-split-button-item>
39
+ <mona-split-button-item label="Export PDF" (menuClick)="onExport($event)"></mona-split-button-item>
40
+ </mona-split-button>
41
+ ```
42
+
43
+ ```typescript
44
+ import type { PopupMenuItemClickEvent } from "@nanahoshi/mona-ui/popup-menu";
45
+
46
+ protected onSave(): void { /* ... */ }
47
+ protected onSaveAs(event: PopupMenuItemClickEvent): void { /* ... */ }
48
+ protected onExport(event: PopupMenuItemClickEvent): void { /* ... */ }
49
+ ```
50
+
51
+ ## Anatomy
52
+
53
+ ### Content projection slots
54
+
55
+ Menu items are projected directly inside `<mona-split-button>` as child components. Only the split-button family of components (`mona-split-button-item`, `mona-split-button-group`, etc.) and their associated `ng-template` directives are valid children.
56
+
57
+ ```
58
+ mona-split-button
59
+ ├── mona-split-button-item — a regular clickable menu item
60
+ ├── mona-split-button-group — a titled group of items
61
+ │ └── mona-split-button-item
62
+ ├── mona-split-button-separator — a horizontal rule between groups
63
+ ├── mona-split-button-checkbox-item — a toggle menu item
64
+ └── mona-split-button-radio-group — a set of mutually exclusive choices
65
+ └── mona-split-button-radio-item
66
+ ```
67
+
68
+ ### Template directives
69
+
70
+ All template directives target `ng-template` elements. Templates placed directly inside `mona-split-button` apply to all matching items globally; templates nested inside a specific item override only that item.
71
+
72
+ | Directive attribute | Scope | Template context |
73
+ |-------------------------------------------|---------------|------------------------------------------------------|
74
+ | `monaSplitButtonTextTemplate` | Host button | None |
75
+ | `monaSplitButtonMenuButtonTemplate` | Toggle button | None |
76
+ | `monaSplitButtonMenuGroupTemplate` | Global/Group | `$implicit: string` (group title) |
77
+ | `monaSplitButtonMenuItemIconTemplate` | Global/Item | `$implicit` — menu item object (`label`, `disabled`) |
78
+ | `monaSplitButtonMenuItemShortcutTemplate` | Global/Item | `$implicit` — menu item object (`label`, `disabled`) |
79
+ | `monaSplitButtonMenuItemTextTemplate` | Global/Item | `$implicit` — menu item object (`label`, `disabled`) |
80
+
81
+ **Customize the main button label:**
82
+
83
+ ```html
84
+
85
+ <mona-split-button>
86
+ <ng-template monaSplitButtonTextTemplate>
87
+ <span class="text-primary font-semibold">Publish</span>
88
+ </ng-template>
89
+ </mona-split-button>
90
+ ```
91
+
92
+ **Customize the menu toggle icon:**
93
+
94
+ ```html
95
+
96
+ <mona-split-button>
97
+ <ng-template monaSplitButtonMenuButtonTemplate>
98
+ <svg lucideEllipsis [size]="14"></svg>
99
+ </ng-template>
100
+ </mona-split-button>
101
+ ```
102
+
103
+ **Custom text per menu item:**
104
+
105
+ ```html
106
+
107
+ <mona-split-button>
108
+ <mona-split-button-item label="Sign Out">
109
+ <ng-template monaSplitButtonMenuItemTextTemplate let-item>
110
+ <span class="text-destructive">{{ item.label }}</span>
111
+ </ng-template>
112
+ </mona-split-button-item>
113
+ </mona-split-button>
114
+ ```
115
+
116
+ **Global icon template (applies to all items):**
117
+
118
+ ```html
119
+
120
+ <mona-split-button>
121
+ <ng-template monaSplitButtonMenuItemIconTemplate let-item>
122
+ <svg lucideChevronRight [size]="12"></svg>
123
+ </ng-template>
124
+ <mona-split-button-item label="Profile"></mona-split-button-item>
125
+ <mona-split-button-item label="Settings"></mona-split-button-item>
126
+ </mona-split-button>
127
+ ```
128
+
129
+ ## Examples
130
+
131
+ ### Groups, submenus and disabled items
132
+
133
+ Use `mona-split-button-group` to add a labeled section header, and `mona-split-button-separator` between sections. An item with child items opens a submenu. The main button emits `buttonClick`, and every menu item emits `menuItemClick`.
134
+
135
+ Both the whole component and individual items can be disabled independently: `[disabled]` on `mona-split-button` disables both buttons, and on an item disables only that item.
136
+
137
+ `basic-example.component.ts`
138
+
139
+ ```typescript
140
+ import { Component, signal } from "@angular/core";
141
+ import type { PopupMenuItemClickEvent } from "@nanahoshi/mona-ui/popup-menu";
142
+ import {
143
+ SplitButtonComponent,
144
+ SplitButtonGroupComponent,
145
+ SplitButtonItemComponent,
146
+ SplitButtonSeparatorComponent
147
+ } from "@nanahoshi/mona-ui/split-button";
148
+
149
+ @Component({
150
+ selector: "app-split-button-basic-example",
151
+ imports: [SplitButtonComponent, SplitButtonGroupComponent, SplitButtonItemComponent, SplitButtonSeparatorComponent],
152
+ templateUrl: "./basic-example.component.html"
153
+ })
154
+ export class SplitButtonBasicExampleComponent {
155
+ protected readonly lastAction = signal("none");
156
+
157
+ protected onMenuItemClick(event: PopupMenuItemClickEvent): void {
158
+ this.lastAction.set(event.label);
159
+ }
160
+ }
161
+ ```
162
+
163
+ `basic-example.component.html`
164
+
165
+ ```html
166
+ <div class="flex flex-wrap items-center gap-3">
167
+ <mona-split-button
168
+ look="primary"
169
+ text="Publish"
170
+ (buttonClick)="lastAction.set('Publish')"
171
+ (menuItemClick)="onMenuItemClick($event)">
172
+ <mona-split-button-group title="Later">
173
+ <mona-split-button-item label="Schedule" />
174
+ <mona-split-button-item label="Save as draft" />
175
+ </mona-split-button-group>
176
+ <mona-split-button-separator />
177
+ <mona-split-button-item label="Share preview">
178
+ <mona-split-button-item label="Copy link" />
179
+ <mona-split-button-item label="Email" />
180
+ </mona-split-button-item>
181
+ <mona-split-button-item label="Unpublish" [disabled]="true" />
182
+ </mona-split-button>
183
+ <span aria-live="polite" class="text-sm">Last action: {{ lastAction() }}</span>
184
+ </div>
185
+ ```
186
+
187
+ ### Checkbox and radio items
188
+
189
+ `mona-split-button-checkbox-item` renders a toggleable item, and `mona-split-button-radio-group` a set of mutually exclusive options. Use `[(checked)]` and `[(value)]` for two-way binding, or the one-way input with `(checkedChange)` or `(valueChange)`.
190
+
191
+ `checkable-example.component.ts`
192
+
193
+ ```typescript
194
+ import { Component, signal } from "@angular/core";
195
+ import {
196
+ SplitButtonCheckboxItemComponent,
197
+ SplitButtonComponent,
198
+ SplitButtonRadioGroupComponent,
199
+ SplitButtonRadioItemComponent,
200
+ SplitButtonSeparatorComponent
201
+ } from "@nanahoshi/mona-ui/split-button";
202
+
203
+ @Component({
204
+ selector: "app-split-button-checkable-example",
205
+ imports: [
206
+ SplitButtonCheckboxItemComponent,
207
+ SplitButtonComponent,
208
+ SplitButtonRadioGroupComponent,
209
+ SplitButtonRadioItemComponent,
210
+ SplitButtonSeparatorComponent
211
+ ],
212
+ templateUrl: "./checkable-example.component.html"
213
+ })
214
+ export class SplitButtonCheckableExampleComponent {
215
+ protected readonly format = signal("pdf");
216
+ protected readonly includeComments = signal(false);
217
+ protected readonly lastExport = signal("none");
218
+
219
+ protected export(): void {
220
+ this.lastExport.set(`${this.format().toUpperCase()}${this.includeComments() ? " with comments" : ""}`);
221
+ }
222
+ }
223
+ ```
224
+
225
+ `checkable-example.component.html`
226
+
227
+ ```html
228
+ <div class="flex flex-wrap items-center gap-3">
229
+ <mona-split-button text="Export" (buttonClick)="export()">
230
+ <mona-split-button-radio-group title="Format" [(value)]="format">
231
+ <mona-split-button-radio-item label="PDF" value="pdf" />
232
+ <mona-split-button-radio-item label="Word" value="docx" />
233
+ <mona-split-button-radio-item label="Plain text" value="txt" />
234
+ </mona-split-button-radio-group>
235
+ <mona-split-button-separator />
236
+ <mona-split-button-checkbox-item label="Include comments" [(checked)]="includeComments" />
237
+ </mona-split-button>
238
+ <span aria-live="polite" class="text-sm">Last export: {{ lastExport() }}</span>
239
+ </div>
240
+ ```
241
+
242
+ ### Loading state
243
+
244
+ `loading` shows a spinner on the main button and keeps the menu from opening until it's `false` again.
245
+
246
+ `loading-example.component.ts`
247
+
248
+ ```typescript
249
+ import { Component, signal } from "@angular/core";
250
+ import { SplitButtonComponent, SplitButtonItemComponent } from "@nanahoshi/mona-ui/split-button";
251
+
252
+ @Component({
253
+ selector: "app-split-button-loading-example",
254
+ imports: [SplitButtonComponent, SplitButtonItemComponent],
255
+ templateUrl: "./loading-example.component.html"
256
+ })
257
+ export class SplitButtonLoadingExampleComponent {
258
+ protected readonly saving = signal(false);
259
+ protected readonly status = signal("Unsaved changes");
260
+
261
+ protected save(): void {
262
+ this.saving.set(true);
263
+ this.status.set("Saving…");
264
+ // Stands in for a request to the server.
265
+ setTimeout(() => {
266
+ this.saving.set(false);
267
+ this.status.set("All changes saved");
268
+ }, 1500);
269
+ }
270
+ }
271
+ ```
272
+
273
+ `loading-example.component.html`
274
+
275
+ ```html
276
+ <div class="flex flex-wrap items-center gap-3">
277
+ <mona-split-button text="Save" [loading]="saving()" (buttonClick)="save()" (menuItemClick)="save()">
278
+ <mona-split-button-item label="Save and close" />
279
+ <mona-split-button-item label="Save a copy" />
280
+ </mona-split-button>
281
+ <span aria-live="polite" class="text-sm">{{ status() }}</span>
282
+ </div>
283
+ ```
284
+
285
+ ## Behavior
286
+
287
+ ### Popup positioning
288
+
289
+ The popup menu anchors to the start edge of the main button (its left edge in left-to-right pages, its right edge in right-to-left ones) with a 2px vertical offset. The `popupWidth` input sets the minimum width of the popup in pixels; `0` means no minimum width. Clicking the main button while the menu is open closes the menu, then emits `buttonClick`.
290
+
291
+ ### Naming
292
+
293
+ The two buttons form a group (`role="group"`) named by the main button. The main button is named by its content: the `text`, or what a `monaSplitButtonTextTemplate` renders. Set `aria-label` only when the content isn't a name, as with `iconOnly`. The arrow is named "More {text} options" from `text` (or `aria-label`), or "Show menu options" when the main button has neither; `menuButtonAriaLabel` overrides it. Both come from the `splitButton` messages (`menuButtonWithText`, `menuButtonAriaLabel`). The `splitButton.splitButton` message is deprecated and no longer rendered.
294
+
295
+ ### Loading, disabled and button groups
296
+
297
+ `loading` shows a spinner on the main button, marks the group busy (`aria-busy`) and keeps the menu from opening. Starting to load, or becoming disabled, closes an open menu. Inside `mona-button-group`, both buttons take the group's look, size, rounding and disabled state; they aren't toggles and take no part in the group's selection.
298
+
299
+ ### Handling menu item events
300
+
301
+ `menuItemClick` on `SplitButtonComponent` fires for every item click in the popup (top-level aggregator). `menuClick` on individual `mona-split-button-item` / `mona-split-button-checkbox-item` / `mona-split-button-radio-item` fires only for that specific item. Use item-level `menuClick` when you need per-action handlers; use the top-level `menuItemClick` when you need a single entry point.
302
+
303
+ ### Identifying the clicked item
304
+
305
+ The click event's `value` is the item's `value` input, so handlers don't need to compare label text. For checkbox and radio items, `checked` is the state the item has once the click is applied. Calling `event.preventDefault()` on a checkbox item's `menuClick` keeps its state, and on a radio item's keeps the group's value.
306
+
307
+ ## Accessibility
308
+
309
+ ### Keyboard navigation
310
+
311
+ | Key | Target | Action |
312
+ |---------------------------------|-------------------|-------------------------------------------------------------------------------------------------------|
313
+ | `Tab` | Any button | Move focus between the main button and the menu toggle |
314
+ | `Enter` / `Space` | Main button | Trigger the primary action (`buttonClick`) |
315
+ | `Alt+ArrowDown` / `Alt+ArrowUp` | Main button | Open the menu with its first / last item highlighted; focus returns to the main button when it closes |
316
+ | `ArrowDown` / `Enter` / `Space` | Menu toggle | Open the menu with its first item highlighted |
317
+ | `ArrowUp` | Menu toggle | Open the menu with its last item highlighted |
318
+ | `Escape` | Menu (while open) | Close the menu and return focus to the button that opened it |
319
+
320
+ Inside the menu:
321
+
322
+ | Key | Action |
323
+ |-------------------|-------------------------------------------------------------------------------------------------------------|
324
+ | `ArrowDown` | Highlights the next item, wrapping to the first. Disabled items are highlighted too, but can't be activated |
325
+ | `ArrowUp` | Highlights the previous item, wrapping to the last |
326
+ | `ArrowRight` | Opens the highlighted item's submenu, if it has nested items |
327
+ | `ArrowLeft` | Closes the current submenu and returns to the parent level |
328
+ | `Home` | Highlights the first item |
329
+ | `End` | Highlights the last item |
330
+ | `Enter` / `Space` | Activates the highlighted item, or opens its submenu if it has nested items |
331
+ | `Escape` | Closes the open submenu, or the menu, returning focus to the button that opened it |
332
+ | `Tab` | Closes the menu and its submenus; focus moves on from the button that opened it |
333
+
334
+ ### ARIA
335
+
336
+ The host carries `role="group"` and `aria-labelledby` pointing at the main button, and `aria-busy` while loading.
337
+
338
+ The menu toggle button carries:
339
+
340
+ - `aria-haspopup="menu"` — tells AT that it controls a menu popup
341
+ - `aria-expanded` — reflects the open/closed state of the popup
342
+ - `aria-controls` — references the menu by ID while it is open
343
+ - `id` — names the menu, through the menu's `aria-labelledby`
344
+ - `aria-label` — "More {text} options", or "Show menu options" without `text`; override with `[menuButtonAriaLabel]`
345
+
346
+ The main button carries:
347
+
348
+ - `aria-label` — only when the `[aria-label]` input is set; otherwise its content names it
349
+ - `aria-labelledby` — forwarded from the `[aria-labelledby]` input; takes precedence over `aria-label` when set
350
+
351
+ ## API
352
+
353
+ Everything below is imported from `@nanahoshi/mona-ui/split-button`.
354
+
355
+ ### `SplitButtonComponent`
356
+
357
+ **Selector:** `mona-split-button`
358
+
359
+ #### Inputs
360
+
361
+ | Name | Type | Default | Description |
362
+ | --- | --- | --- | --- |
363
+ | `aria-label` | `string` | `""` | Accessible name for the main action button. Leave it empty when the button shows its name as text; set it (or `aria-labelledby`) when it shows only an icon. The pair of buttons is a group named by the main button. |
364
+ | `aria-labelledby` | `string` | `""` | ID of an external element that provides the accessible name for the main action button. Takes precedence over `aria-label` when both are set. |
365
+ | `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
366
+ | `disabled` | `boolean` | `false` | Renders the component with reduced visual emphasis and removes pointer interaction from both the main button and the menu toggle button. Disabling it closes the open menu. |
367
+ | `iconOnly` | `boolean` | `false` | Renders the main button as a square for icon-only content, removing horizontal text padding. Set `aria-label` so the main button has a name. |
368
+ | `loading` | `boolean` | `false` | Shows a loading indicator on the main button and keeps the menu from opening while an operation is in progress. Starting to load closes the open menu. |
369
+ | `look` | `"default" \| "error" \| "ghost" \| "info" \| "outline" \| "primary" \| "secondary" \| "success" \| "warning"` | `"default"` | Visual style preset applied to the button. |
370
+ | `menuButtonAriaLabel` | `string` | `""` | Accessible name for the menu toggle button. If not provided, it's the localized "More {text} options", or "Show menu options" when the main button has no `text` or `aria-label`. |
371
+ | `popupWidth` | `number` | `0` | Minimum width of the popup menu in pixels. A value of `0` means no minimum width is applied. |
372
+ | `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Border-radius preset applied to the button. |
373
+ | `size` | `"large" \| "medium" \| "small"` | `"medium"` | Size preset controlling the button's dimensions. |
374
+ | `text` | `string` | `""` | Primary text content displayed in the main action button. Ignored when a `monaSplitButtonTextTemplate` is provided. |
375
+
376
+ #### Outputs
377
+
378
+ | Name | Type | Description |
379
+ | --- | --- | --- |
380
+ | `buttonClick` | `MouseEvent` | Emitted when the main action button is clicked. |
381
+ | `menuItemClick` | `PopupMenuItemClickEvent` | Emitted when a menu item in the popup is clicked. |
382
+
383
+ ### `SplitButtonCheckboxItemComponent`
384
+
385
+ **Selector:** `mona-split-button-checkbox-item`
386
+ **Extends:** `PopupMenuCheckboxItemComponent`
387
+
388
+ #### Inputs
389
+
390
+ | Name | Type | Default | Description |
391
+ | --- | --- | --- | --- |
392
+ | `checked` (two-way) | `boolean` | `false` | The checked state of the menu item. Activating the item toggles it (unless its `menuClick` is prevented) and emits `checkedChange`, so it works with or without a two-way binding. |
393
+ | `disabled` | `boolean` | `false` | Sets the disabled state of the menu item. |
394
+ | `label` | `string` | `""` | The text of the menu item. |
395
+ | `value` | `unknown` | — | A value that identifies the item. It's the `value` of the item's `menuClick` events. |
396
+
397
+ #### Outputs
398
+
399
+ | Name | Type | Description |
400
+ | --- | --- | --- |
401
+ | `checkedChange` | `boolean` | Emitted when `checked` changes. |
402
+ | `menuClick` | `PopupMenuItemClickEvent` | The click event of the menu item. Emits when the menu item is selected by keyboard or mouse. |
403
+
404
+ ### `SplitButtonItemComponent`
405
+
406
+ **Selector:** `mona-split-button-item`
407
+ **Extends:** `PopupMenuItemComponent`
408
+
409
+ #### Inputs
410
+
411
+ | Name | Type | Default | Description |
412
+ | --- | --- | --- | --- |
413
+ | `disabled` | `boolean` | `false` | Sets the disabled state of the menu item. |
414
+ | `label` | `string` | `""` | The text of the menu item. |
415
+ | `value` | `unknown` | — | A value that identifies the item. It's the `value` of the item's `menuClick` events, so handlers don't depend on the label's text. |
416
+
417
+ #### Outputs
418
+
419
+ | Name | Type | Description |
420
+ | --- | --- | --- |
421
+ | `menuClick` | `PopupMenuItemClickEvent` | The click event of the menu item. Emits when the menu item is selected by keyboard or mouse. |
422
+
423
+ ### `SplitButtonRadioItemComponent`
424
+
425
+ **Selector:** `mona-split-button-radio-item`
426
+ **Extends:** `PopupMenuRadioItemComponent`
427
+
428
+ #### Inputs
429
+
430
+ | Name | Type | Default | Description |
431
+ | --- | --- | --- | --- |
432
+ | `disabled` | `boolean` | `false` | Sets the disabled state of the menu item. |
433
+ | `label` | `string` | `""` | The text of the menu item. |
434
+ | `value` (required) | `string` | — | The value of the radio item. |
435
+
436
+ #### Outputs
437
+
438
+ | Name | Type | Description |
439
+ | --- | --- | --- |
440
+ | `menuClick` | `PopupMenuItemClickEvent` | The click event of the menu item. Emits when the menu item is selected by keyboard or mouse, before the radio group selects it. Preventing it keeps the group's value and the menu open. |
441
+
442
+ ### `SplitButtonRadioGroupComponent`
443
+
444
+ **Selector:** `mona-split-button-radio-group`
445
+ **Extends:** `PopupMenuRadioGroupComponent`
446
+
447
+ #### Inputs
448
+
449
+ | Name | Type | Default | Description |
450
+ | --- | --- | --- | --- |
451
+ | `title` | `string` | `""` | The title of the radio group. |
452
+ | `value` (two-way) | `string` | `""` | The value of the selected radio item. |
453
+
454
+ #### Outputs
455
+
456
+ | Name | Type | Description |
457
+ | --- | --- | --- |
458
+ | `valueChange` | `string` | Emitted when `value` changes. |
459
+
460
+ ### `SplitButtonGroupComponent`
461
+
462
+ **Selector:** `mona-split-button-group`
463
+ **Extends:** `PopupMenuGroupComponent`
464
+
465
+ #### Inputs
466
+
467
+ | Name | Type | Default | Description |
468
+ | --- | --- | --- | --- |
469
+ | `title` | `string` | — | Sets the title of the menu group. |
470
+
471
+ ### `SplitButtonSeparatorComponent`
472
+
473
+ **Selector:** `mona-split-button-separator`
474
+ **Extends:** `PopupMenuSeparatorComponent`
475
+
476
+ ### `SplitButtonMenuButtonTemplateDirective`
477
+
478
+ **Selector:** `ng-template[monaSplitButtonMenuButtonTemplate]`
479
+
480
+ ### `SplitButtonMenuGroupTemplateDirective`
481
+
482
+ **Selector:** `ng-template[monaSplitButtonMenuGroupTemplate]`
483
+ **Extends:** `PopupMenuGroupTemplateDirective`
484
+
485
+ ### `SplitButtonMenuItemIconTemplateDirective`
486
+
487
+ **Selector:** `ng-template[monaSplitButtonMenuItemIconTemplate]`
488
+ **Extends:** `PopupMenuIconTemplateDirective`
489
+
490
+ ### `SplitButtonMenuItemShortcutTemplateDirective`
491
+
492
+ **Selector:** `ng-template[monaSplitButtonMenuItemShortcutTemplate]`
493
+ **Extends:** `PopupMenuShortcutTemplateDirective`
494
+
495
+ ### `SplitButtonMenuItemTextTemplateDirective`
496
+
497
+ **Selector:** `ng-template[monaSplitButtonMenuItemTextTemplate]`
498
+ **Extends:** `PopupMenuTextTemplateDirective`
499
+
500
+ ### `SplitButtonTextTemplateDirective`
501
+
502
+ **Selector:** `ng-template[monaSplitButtonTextTemplate]`
503
+
504
+ ### Types
505
+
506
+ #### `SPLIT_BUTTON_DEFAULT_MESSAGES`
507
+
508
+ ```typescript
509
+ const SPLIT_BUTTON_DEFAULT_MESSAGES: MonaSplitButtonMessages;
510
+ ```
511
+
512
+ #### `MonaSplitButtonMessages`
513
+
514
+ From `@nanahoshi/mona-ui/i18n`.
515
+
516
+ | Name | Type | Description |
517
+ | --- | --- | --- |
518
+ | `menuButtonAriaLabel` (read-only) | `string` | The arrow button's name when the main button has no `text` (it shows a template instead). |
519
+ | `menuButtonWithText` (read-only) | `(text: string) => string` | The arrow button's name, from the main button's `text`. |
520
+ | `splitButton` (read-only) | `(text: string) => string` | **Deprecated.** No longer rendered; the main button is named by its content or by `aria-label`. |
521
+
522
+ **Documented elsewhere:** [`PopupMenuCheckboxItemComponent`](popup-menu.md), [`PopupMenuGroupComponent`](popup-menu.md), [`PopupMenuGroupTemplateDirective`](popup-menu.md), [`PopupMenuIconTemplateDirective`](popup-menu.md), [`PopupMenuItemClickEvent`](popup-menu.md), [`PopupMenuItemComponent`](popup-menu.md), [`PopupMenuRadioGroupComponent`](popup-menu.md), [`PopupMenuRadioItemComponent`](popup-menu.md), [`PopupMenuSeparatorComponent`](popup-menu.md), [`PopupMenuShortcutTemplateDirective`](popup-menu.md), [`PopupMenuTextTemplateDirective`](popup-menu.md)