@nanahoshi/mona-ui 0.27.2 → 0.29.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 (213) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/locales.md +8 -0
  3. package/docs/api/popup.md +1 -1
  4. package/docs/api/theme.md +2 -2
  5. package/docs/chart.md +14 -0
  6. package/docs/editor.md +2 -0
  7. package/docs/installation.md +147 -15
  8. package/docs/introduction.md +37 -15
  9. package/docs/theming-built-in-themes.md +67 -0
  10. package/docs/theming-custom-colors.md +274 -0
  11. package/docs/theming-custom-themes.md +168 -0
  12. package/docs/theming.md +164 -248
  13. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  14. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  15. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  16. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  17. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  18. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2071 -1573
  19. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  20. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  21. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  22. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  23. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  24. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  25. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  26. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  27. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  28. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  29. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  30. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  31. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  32. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  33. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  34. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  35. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  37. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  38. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  39. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  40. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  41. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  42. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  49. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  50. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  51. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  52. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  53. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  54. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  55. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  56. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  57. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  58. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  59. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  60. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  61. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  62. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  63. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  65. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  66. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  67. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  68. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  70. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +599 -0
  71. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  72. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  73. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  74. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  75. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  76. package/fesm2022/nanahoshi-mona-ui-locales.mjs +61 -77
  77. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  78. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  79. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  80. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  81. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  82. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  83. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  84. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  85. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  86. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  87. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  88. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  89. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  90. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  91. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  92. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  93. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  94. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  95. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  96. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  97. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  98. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  99. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  100. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  101. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  102. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  103. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  104. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  105. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  106. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  107. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  108. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  109. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  110. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  111. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  112. package/llms.txt +7 -3
  113. package/locales/pl-pl/package.json +4 -0
  114. package/locales/pl-pl/pl-pl.messages.json +536 -0
  115. package/package.json +66 -23
  116. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  117. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  118. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  119. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  120. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  121. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  122. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  123. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  124. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  125. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  126. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  127. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  128. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  129. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  130. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  131. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  132. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  133. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  134. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  135. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  136. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  137. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  138. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  139. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  140. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  141. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  142. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  143. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  144. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  145. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  146. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  147. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  148. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  149. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  150. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  151. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  152. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  153. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  154. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  155. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  156. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  157. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  158. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  159. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +540 -0
  168. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  169. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  170. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  171. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  172. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  173. package/types/nanahoshi-mona-ui-locales.d.ts +18 -19
  174. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  175. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  176. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  177. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  178. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  179. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  180. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  181. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  182. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  183. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  184. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  185. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  186. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  187. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  188. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  189. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  190. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  191. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  192. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  193. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  194. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  195. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  196. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  197. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  198. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  199. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  200. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  201. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  202. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  203. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  204. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  205. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  206. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  207. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  208. package/types/nanahoshi-mona-ui.d.ts +1 -2
  209. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  210. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  211. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  212. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  213. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,181 +1,244 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, signal, input, booleanAttribute, effect, untracked, forwardRef, Component, Directive, inject, ElementRef, computed, contentChildren, TemplateRef, contentChild, viewChild, model, DestroyRef, isDevMode, afterNextRender } from '@angular/core';
3
- import { NgTemplateOutlet } from '@angular/common';
4
- import { LucideMinus, LucidePlus } from '@lucide/angular';
5
- import { CollapsibleTriggerDirective, COLLAPSIBLE_CONFIG } from '@nanahoshi/mona-ui/collapsible';
6
- import { createElementControlId } from '@nanahoshi/mona-ui/internal';
7
- import { twMerge } from 'tailwind-merge';
8
- import { cva } from 'class-variance-authority';
9
-
10
- /**
11
- * Lets a panel join the nearest accordion, wherever its template is. A nested accordion's panels find the inner one, so
12
- * they aren't counted as the outer one's.
13
- */
1
+ import * as i0 from "@angular/core";
2
+ import { Component, DestroyRef, Directive, ElementRef, InjectionToken, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, contentChildren, effect, forwardRef, inject, input, isDevMode, model, signal, untracked, viewChild } from "@angular/core";
3
+ import { NgTemplateOutlet } from "@angular/common";
4
+ import { LucideMinus, LucidePlus } from "@lucide/angular";
5
+ import { COLLAPSIBLE_CONFIG, CollapsibleTriggerDirective } from "@nanahoshi/mona-ui/collapsible";
6
+ import { createElementControlId } from "@nanahoshi/mona-ui/internal";
7
+ import { twMerge } from "tailwind-merge";
8
+ import { cva } from "class-variance-authority";
14
9
  const EXPANSION_PANEL_ACCORDION = new InjectionToken("EXPANSION_PANEL_ACCORDION");
15
-
16
- /**
17
- * @description
18
- * Groups `mona-expansion-panel` elements: only one is open at a time unless `multiple` is set, and Up, Down, Home and End
19
- * move between their headers. Adds no role of its own, as the pattern asks: each panel brings its heading and region.
20
- */
21
- class AccordionComponent {
22
- #registered;
23
- #openPanels;
24
- constructor() {
25
- this.#registered = signal([], /* @ts-ignore */
26
- ...(ngDevMode ? [{ debugName: "#registered" }] : /* istanbul ignore next */ []));
27
- this.#openPanels = [];
28
- /**
29
- * @description Lets several panels stay open. Without it, opening a panel closes the others, however it was opened.
30
- * @default false
31
- */
32
- this.multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
33
- effect(() => {
34
- const open = this.#inDocumentOrder().filter(panel => panel.expanded());
35
- const multiple = this.multiple();
36
- untracked(() => this.#enforceSingleOpen(open, multiple));
37
- });
38
- }
39
- /**
40
- * @internal
41
- */
42
- register(panel) {
43
- this.#registered.update(panels => [...panels, panel]);
44
- return () => this.#registered.update(panels => panels.filter(other => other !== panel));
45
- }
46
- onKeydown(event) {
47
- if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
48
- return;
49
- }
50
- const panels = this.#inDocumentOrder().filter(panel => !panel.disabled());
51
- const current = panels.findIndex(panel => panel.ownsTrigger(event.target));
52
- if (current === -1) {
53
- return;
54
- }
55
- const target = this.#targetFor(event.key, panels, current);
56
- if (target) {
57
- event.preventDefault();
58
- target.focus();
59
- }
60
- }
61
- /** The panel opened last is the one that stays, so a panel opened by a binding wins just as a clicked one does. */
62
- #enforceSingleOpen(open, multiple) {
63
- const previous = this.#openPanels;
64
- this.#openPanels = open;
65
- if (multiple || open.length < 2) {
66
- return;
67
- }
68
- const keep = open.filter(panel => !previous.includes(panel)).at(-1) ?? open[0];
69
- open.filter(panel => panel !== keep).forEach(panel => panel.collapse());
70
- }
71
- /** Worked out each time, because a panel can be moved without anything registering. */
72
- #inDocumentOrder() {
73
- return [...this.#registered()].sort((first, second) => first.compareDocumentOrder(second));
74
- }
75
- #targetFor(key, panels, current) {
76
- switch (key) {
77
- case "ArrowDown":
78
- return panels[(current + 1) % panels.length];
79
- case "ArrowUp":
80
- return panels[(current - 1 + panels.length) % panels.length];
81
- case "Home":
82
- return panels[0];
83
- case "End":
84
- return panels[panels.length - 1];
85
- default:
86
- return undefined;
87
- }
88
- }
89
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AccordionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
90
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: AccordionComponent, isStandalone: true, selector: "mona-accordion", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onKeydown($event)" }, classAttribute: "block w-full" }, providers: [{ provide: EXPANSION_PANEL_ACCORDION, useExisting: forwardRef(() => AccordionComponent) }], ngImport: i0, template: ` <ng-content></ng-content> `, isInline: true }); }
91
- }
92
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AccordionComponent, decorators: [{
93
- type: Component,
94
- args: [{
95
- selector: "mona-accordion",
96
- template: ` <ng-content></ng-content> `,
97
- host: {
98
- class: "block w-full",
99
- "(keydown)": "onKeydown($event)"
100
- },
101
- providers: [{ provide: EXPANSION_PANEL_ACCORDION, useExisting: forwardRef(() => AccordionComponent) }]
102
- }]
103
- }], ctorParameters: () => [], propDecorators: { multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }] } });
104
-
105
- /**
106
- * Injects content beside the header's button, between the title and the toggle icon. Its controls are the application's
107
- * own: their clicks and keys don't reach the button, and they need their own accessible names. The template has no
108
- * context variables.
109
- */
110
- class ExpansionPanelActionsTemplateDirective {
111
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelActionsTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
112
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ExpansionPanelActionsTemplateDirective, isStandalone: true, selector: "ng-template[monaExpansionPanelActionsTemplate]", ngImport: i0 }); }
113
- }
114
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelActionsTemplateDirective, decorators: [{
115
- type: Directive,
116
- args: [{
117
- selector: "ng-template[monaExpansionPanelActionsTemplate]"
118
- }]
119
- }] });
120
-
121
- /** Replaces the default plus/minus toggle icon. */
122
- class ExpansionPanelIconTemplateDirective {
123
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelIconTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
124
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ExpansionPanelIconTemplateDirective, isStandalone: true, selector: "ng-template[monaExpansionPanelIconTemplate]", ngImport: i0 }); }
125
- }
126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelIconTemplateDirective, decorators: [{
127
- type: Directive,
128
- args: [{
129
- selector: "ng-template[monaExpansionPanelIconTemplate]"
130
- }]
131
- }] });
132
-
133
- /**
134
- * Replaces the string `title` in the header's button with projected content. It can't hold controls, since it's inside
135
- * a button. The template has no context variables.
136
- */
137
- class ExpansionPanelTitleTemplateDirective {
138
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelTitleTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
139
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ExpansionPanelTitleTemplateDirective, isStandalone: true, selector: "ng-template[monaExpansionPanelTitleTemplate]", ngImport: i0 }); }
140
- }
141
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelTitleTemplateDirective, decorators: [{
142
- type: Directive,
143
- args: [{
144
- selector: "ng-template[monaExpansionPanelTitleTemplate]"
145
- }]
146
- }] });
147
-
10
+ var AccordionComponent = class AccordionComponent {
11
+ #registered;
12
+ #openPanels;
13
+ constructor() {
14
+ this.#registered = signal([], ...ngDevMode ? [{ debugName: "#registered" }] : /* istanbul ignore next */ []);
15
+ this.#openPanels = [];
16
+ this.multiple = input(false, {
17
+ ...ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {},
18
+ transform: booleanAttribute
19
+ });
20
+ effect(() => {
21
+ const open = this.#inDocumentOrder().filter((panel) => panel.expanded());
22
+ const multiple = this.multiple();
23
+ untracked(() => this.#enforceSingleOpen(open, multiple));
24
+ });
25
+ }
26
+ register(panel) {
27
+ this.#registered.update((panels) => [...panels, panel]);
28
+ return () => this.#registered.update((panels) => panels.filter((other) => other !== panel));
29
+ }
30
+ onKeydown(event) {
31
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
32
+ const panels = this.#inDocumentOrder().filter((panel) => !panel.disabled());
33
+ const current = panels.findIndex((panel) => panel.ownsTrigger(event.target));
34
+ if (current === -1) return;
35
+ const target = this.#targetFor(event.key, panels, current);
36
+ if (target) {
37
+ event.preventDefault();
38
+ target.focus();
39
+ }
40
+ }
41
+ #enforceSingleOpen(open, multiple) {
42
+ const previous = this.#openPanels;
43
+ this.#openPanels = open;
44
+ if (multiple || open.length < 2) return;
45
+ const keep = open.filter((panel) => !previous.includes(panel)).at(-1) ?? open[0];
46
+ open.filter((panel) => panel !== keep).forEach((panel) => panel.collapse());
47
+ }
48
+ #inDocumentOrder() {
49
+ return [...this.#registered()].sort((first, second) => first.compareDocumentOrder(second));
50
+ }
51
+ #targetFor(key, panels, current) {
52
+ switch (key) {
53
+ case "ArrowDown": return panels[(current + 1) % panels.length];
54
+ case "ArrowUp": return panels[(current - 1 + panels.length) % panels.length];
55
+ case "Home": return panels[0];
56
+ case "End": return panels[panels.length - 1];
57
+ default: return;
58
+ }
59
+ }
60
+ static {
61
+ this.ɵfac = i0.ɵɵngDeclareFactory({
62
+ minVersion: "12.0.0",
63
+ version: "22.2.6",
64
+ ngImport: i0,
65
+ type: AccordionComponent,
66
+ deps: [],
67
+ target: i0.ɵɵFactoryTarget.Component
68
+ });
69
+ }
70
+ static {
71
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
72
+ minVersion: "17.1.0",
73
+ version: "22.2.6",
74
+ type: AccordionComponent,
75
+ isStandalone: true,
76
+ selector: "mona-accordion",
77
+ inputs: { multiple: {
78
+ classPropertyName: "multiple",
79
+ publicName: "multiple",
80
+ isSignal: true,
81
+ isRequired: false,
82
+ transformFunction: null
83
+ } },
84
+ host: {
85
+ listeners: { "keydown": "onKeydown($event)" },
86
+ classAttribute: "block w-full"
87
+ },
88
+ providers: [{
89
+ provide: EXPANSION_PANEL_ACCORDION,
90
+ useExisting: forwardRef(() => AccordionComponent)
91
+ }],
92
+ ngImport: i0,
93
+ template: ` <ng-content></ng-content> `,
94
+ isInline: true
95
+ });
96
+ }
97
+ };
98
+ i0.ɵɵngDeclareClassMetadata({
99
+ minVersion: "12.0.0",
100
+ version: "22.2.6",
101
+ ngImport: i0,
102
+ type: AccordionComponent,
103
+ decorators: [{
104
+ type: Component,
105
+ args: [{
106
+ selector: "mona-accordion",
107
+ template: ` <ng-content></ng-content> `,
108
+ host: {
109
+ class: "block w-full",
110
+ "(keydown)": "onKeydown($event)"
111
+ },
112
+ providers: [{
113
+ provide: EXPANSION_PANEL_ACCORDION,
114
+ useExisting: forwardRef(() => AccordionComponent)
115
+ }]
116
+ }]
117
+ }],
118
+ ctorParameters: () => [],
119
+ propDecorators: { multiple: [{
120
+ type: i0.Input,
121
+ args: [{
122
+ isSignal: true,
123
+ alias: "multiple",
124
+ required: false
125
+ }]
126
+ }] }
127
+ });
128
+ var ExpansionPanelActionsTemplateDirective = class ExpansionPanelActionsTemplateDirective {
129
+ static {
130
+ this.ɵfac = i0.ɵɵngDeclareFactory({
131
+ minVersion: "12.0.0",
132
+ version: "22.2.6",
133
+ ngImport: i0,
134
+ type: ExpansionPanelActionsTemplateDirective,
135
+ deps: [],
136
+ target: i0.ɵɵFactoryTarget.Directive
137
+ });
138
+ }
139
+ static {
140
+ this.ɵdir = i0.ɵɵngDeclareDirective({
141
+ minVersion: "14.0.0",
142
+ version: "22.2.6",
143
+ type: ExpansionPanelActionsTemplateDirective,
144
+ isStandalone: true,
145
+ selector: "ng-template[monaExpansionPanelActionsTemplate]",
146
+ ngImport: i0
147
+ });
148
+ }
149
+ };
150
+ i0.ɵɵngDeclareClassMetadata({
151
+ minVersion: "12.0.0",
152
+ version: "22.2.6",
153
+ ngImport: i0,
154
+ type: ExpansionPanelActionsTemplateDirective,
155
+ decorators: [{
156
+ type: Directive,
157
+ args: [{ selector: "ng-template[monaExpansionPanelActionsTemplate]" }]
158
+ }]
159
+ });
160
+ var ExpansionPanelIconTemplateDirective = class ExpansionPanelIconTemplateDirective {
161
+ static {
162
+ this.ɵfac = i0.ɵɵngDeclareFactory({
163
+ minVersion: "12.0.0",
164
+ version: "22.2.6",
165
+ ngImport: i0,
166
+ type: ExpansionPanelIconTemplateDirective,
167
+ deps: [],
168
+ target: i0.ɵɵFactoryTarget.Directive
169
+ });
170
+ }
171
+ static {
172
+ this.ɵdir = i0.ɵɵngDeclareDirective({
173
+ minVersion: "14.0.0",
174
+ version: "22.2.6",
175
+ type: ExpansionPanelIconTemplateDirective,
176
+ isStandalone: true,
177
+ selector: "ng-template[monaExpansionPanelIconTemplate]",
178
+ ngImport: i0
179
+ });
180
+ }
181
+ };
182
+ i0.ɵɵngDeclareClassMetadata({
183
+ minVersion: "12.0.0",
184
+ version: "22.2.6",
185
+ ngImport: i0,
186
+ type: ExpansionPanelIconTemplateDirective,
187
+ decorators: [{
188
+ type: Directive,
189
+ args: [{ selector: "ng-template[monaExpansionPanelIconTemplate]" }]
190
+ }]
191
+ });
192
+ var ExpansionPanelTitleTemplateDirective = class ExpansionPanelTitleTemplateDirective {
193
+ static {
194
+ this.ɵfac = i0.ɵɵngDeclareFactory({
195
+ minVersion: "12.0.0",
196
+ version: "22.2.6",
197
+ ngImport: i0,
198
+ type: ExpansionPanelTitleTemplateDirective,
199
+ deps: [],
200
+ target: i0.ɵɵFactoryTarget.Directive
201
+ });
202
+ }
203
+ static {
204
+ this.ɵdir = i0.ɵɵngDeclareDirective({
205
+ minVersion: "14.0.0",
206
+ version: "22.2.6",
207
+ type: ExpansionPanelTitleTemplateDirective,
208
+ isStandalone: true,
209
+ selector: "ng-template[monaExpansionPanelTitleTemplate]",
210
+ ngImport: i0
211
+ });
212
+ }
213
+ };
214
+ i0.ɵɵngDeclareClassMetadata({
215
+ minVersion: "12.0.0",
216
+ version: "22.2.6",
217
+ ngImport: i0,
218
+ type: ExpansionPanelTitleTemplateDirective,
219
+ decorators: [{
220
+ type: Directive,
221
+ args: [{ selector: "ng-template[monaExpansionPanelTitleTemplate]" }]
222
+ }]
223
+ });
148
224
  const expansionPanelBaseThemeVariants = cva(`
149
225
  relative block w-full overflow-hidden
150
226
  bg-surface text-foreground border border-border
151
227
  not-last:border-b-transparent not-last:rounded-b-none not-first:rounded-t-none
152
- `, {
153
- variants: {
154
- rounded: {
155
- small: "rounded-sm",
156
- medium: "rounded-md",
157
- large: "rounded-lg",
158
- none: "rounded-none"
159
- }
160
- }
161
- });
162
- /**
163
- * Three columns: title, actions, icon. The heading and its button span them all through subgrid and put the title and
164
- * icon in the outer two, so the button fills the row while the actions, its sibling, sit in the middle one above it.
165
- */
228
+ `, { variants: { rounded: {
229
+ small: "rounded-sm",
230
+ medium: "rounded-md",
231
+ large: "rounded-lg",
232
+ none: "rounded-none"
233
+ } } });
166
234
  const expansionPanelHeaderThemeVariants = cva(`
167
235
  relative grid w-full grid-cols-[minmax(0,1fr)_auto_auto] items-stretch
168
236
  bg-surface-muted
169
- `, {
170
- variants: {
171
- collapsed: {
172
- true: "border-b-transparent",
173
- false: "border-0 border-b border-border-subtle"
174
- }
175
- }
176
- });
237
+ `, { variants: { collapsed: {
238
+ true: "border-b-transparent",
239
+ false: "border-0 border-b border-border-subtle"
240
+ } } });
177
241
  const expansionPanelHeadingThemeVariants = cva(`col-span-full row-start-1 grid grid-cols-subgrid`);
178
- /** Inset focus, because the panel clips anything outside it. */
179
242
  const expansionPanelTriggerThemeVariants = cva(`
180
243
  col-span-full grid grid-cols-subgrid items-center
181
244
  px-2 py-2
@@ -184,204 +247,359 @@ const expansionPanelTriggerThemeVariants = cva(`
184
247
  bg-transparent
185
248
  transition-colors duration-(--mona-motion-fast) motion-reduce:transition-none
186
249
  focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus-indicator
187
- `, {
188
- variants: {
189
- disabled: {
190
- true: "cursor-not-allowed bg-disabled-background text-disabled-foreground",
191
- false: "cursor-pointer text-foreground hover:bg-hover active:bg-active"
192
- }
193
- }
194
- });
250
+ `, { variants: { disabled: {
251
+ true: "cursor-not-allowed bg-disabled-background text-disabled-foreground",
252
+ false: "cursor-pointer text-foreground hover:bg-hover active:bg-active"
253
+ } } });
195
254
  const expansionPanelActionsThemeVariants = cva(`relative z-10 col-start-2 row-start-1 flex items-center self-center`);
196
255
  const expansionPanelHeaderTitleThemeVariants = cva(`col-start-1 row-start-1 min-w-0`);
197
- const expansionPanelIconContainerThemeVariants = cva(`col-start-3 row-start-1`, {
198
- variants: {
199
- hasTemplate: {
200
- true: "",
201
- false: "px-2"
202
- }
203
- }
204
- });
256
+ const expansionPanelIconContainerThemeVariants = cva(`col-start-3 row-start-1`, { variants: { hasTemplate: {
257
+ true: "",
258
+ false: "px-2"
259
+ } } });
205
260
  const expansionPanelContentThemeVariants = cva(`
206
261
  text-foreground
207
262
  grid
208
263
  transition-[grid-template-rows] duration-(--mona-motion-standard) ease-out motion-reduce:transition-none
209
264
  [&>div]:overflow-hidden
210
- `, {
211
- variants: {
212
- expanded: {
213
- true: "grid-rows-[1fr]",
214
- false: "grid-rows-[0fr]"
215
- }
216
- }
217
- });
218
-
219
- /** A level from 1 to 6, `null` for no heading at all, and the default for anything else. */
265
+ `, { variants: { expanded: {
266
+ true: "grid-rows-[1fr]",
267
+ false: "grid-rows-[0fr]"
268
+ } } });
220
269
  function toHeadingLevel(value) {
221
- if (value === null) {
222
- return null;
223
- }
224
- const level = Number(value);
225
- return Number.isInteger(level) && level >= 1 && level <= 6 ? level : 3;
270
+ if (value === null) return null;
271
+ const level = Number(value);
272
+ return Number.isInteger(level) && level >= 1 && level <= 6 ? level : 3;
226
273
  }
227
- /** `Node.DOCUMENT_POSITION_FOLLOWING`, written out because `Node` isn't a global on the server. */
228
274
  const DOCUMENT_POSITION_FOLLOWING = 4;
229
- class ExpansionPanelComponent {
230
- #host;
231
- constructor() {
232
- this.#host = inject(ElementRef).nativeElement;
233
- this.actionsClass = computed(() => {
234
- return expansionPanelActionsThemeVariants();
235
- }, /* @ts-ignore */
236
- ...(ngDevMode ? [{ debugName: "actionsClass" }] : /* istanbul ignore next */ []));
237
- this.actionsTemplateList = contentChildren(ExpansionPanelActionsTemplateDirective, { ...(ngDevMode ? { debugName: "actionsTemplateList" } : /* istanbul ignore next */ {}), read: TemplateRef });
238
- this.baseClass = computed(() => {
239
- const rounded = this.rounded();
240
- const variantClass = expansionPanelBaseThemeVariants({ rounded });
241
- return twMerge(variantClass, this.userClass());
242
- }, /* @ts-ignore */
243
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
244
- this.contentClass = computed(() => {
245
- const expanded = this.expanded();
246
- return expansionPanelContentThemeVariants({ expanded });
247
- }, /* @ts-ignore */
248
- ...(ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []));
249
- this.headerClass = computed(() => {
250
- return expansionPanelHeaderThemeVariants({ collapsed: !this.expanded() });
251
- }, /* @ts-ignore */
252
- ...(ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []));
253
- this.headerTitleClass = computed(() => {
254
- return expansionPanelHeaderTitleThemeVariants();
255
- }, /* @ts-ignore */
256
- ...(ngDevMode ? [{ debugName: "headerTitleClass" }] : /* istanbul ignore next */ []));
257
- this.headingClass = computed(() => {
258
- return expansionPanelHeadingThemeVariants();
259
- }, /* @ts-ignore */
260
- ...(ngDevMode ? [{ debugName: "headingClass" }] : /* istanbul ignore next */ []));
261
- this.iconContainerClass = computed(() => {
262
- const hasTemplate = !!this.iconTemplate();
263
- return expansionPanelIconContainerThemeVariants({ hasTemplate });
264
- }, /* @ts-ignore */
265
- ...(ngDevMode ? [{ debugName: "iconContainerClass" }] : /* istanbul ignore next */ []));
266
- this.iconTemplate = contentChild(ExpansionPanelIconTemplateDirective, { ...(ngDevMode ? { debugName: "iconTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
267
- this.titleTemplate = contentChild(ExpansionPanelTitleTemplateDirective, { ...(ngDevMode ? { debugName: "titleTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
268
- this.triggerClass = computed(() => {
269
- return expansionPanelTriggerThemeVariants({ disabled: this.disabled() });
270
- }, /* @ts-ignore */
271
- ...(ngDevMode ? [{ debugName: "triggerClass" }] : /* istanbul ignore next */ []));
272
- this.triggerElement = viewChild.required("trigger", /* @ts-ignore */
273
- ...(ngDevMode ? [{ debugName: "triggerElement" }] : /* istanbul ignore next */ []));
274
- this.triggerId = createElementControlId();
275
- /**
276
- * @description Always enabled. Satisfies the `CollapsibleConfig` contract for `monaCollapsibleTrigger`;
277
- * this component doesn't use `monaCollapsibleContent`, so no animation ever consults it.
278
- */
279
- this.animate = computed(() => true, /* @ts-ignore */
280
- ...(ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []));
281
- this.contentId = createElementControlId();
282
- /**
283
- * @description Disables the header: toggling by click or key, and the actions in it.
284
- * @default false
285
- */
286
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
287
- /**
288
- * @description Sets whether the expansion panel is expanded or collapsed.
289
- * @default false
290
- */
291
- this.expanded = model(false, /* @ts-ignore */
292
- ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
293
- /**
294
- * @description The level of the heading around the header's button, from 1 to 6. Set it to fit the page's outline, or
295
- * to `null` for no heading.
296
- * @default 3
297
- */
298
- this.headingLevel = input(3, { ...(ngDevMode ? { debugName: "headingLevel" } : /* istanbul ignore next */ {}), transform: toHeadingLevel });
299
- /**
300
- * @description Sets the border radius of the expansion panel.
301
- * @default "medium"
302
- */
303
- this.rounded = input("medium", /* @ts-ignore */
304
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
305
- /**
306
- * @description Sets the title of the expansion panel, which also names its button and region.
307
- * @default ""
308
- */
309
- this.title = input("", /* @ts-ignore */
310
- ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
311
- /**
312
- * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
313
- * @default ""
314
- */
315
- this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
316
- const accordion = inject(EXPANSION_PANEL_ACCORDION, { optional: true });
317
- if (accordion) {
318
- inject(DestroyRef).onDestroy(accordion.register(this));
319
- }
320
- if (isDevMode()) {
321
- afterNextRender({
322
- read: () => {
323
- const trigger = this.triggerElement().nativeElement;
324
- if (!trigger.textContent?.trim() && !trigger.querySelector("[aria-label], img[alt]")) {
325
- console.warn("mona-expansion-panel: a panel needs a title, or its button has no name.");
326
- }
327
- }
328
- });
329
- }
330
- }
331
- /** Collapses the panel, even when `disabled`. */
332
- collapse() {
333
- this.expanded.set(false);
334
- }
335
- /**
336
- * @internal
337
- */
338
- compareDocumentOrder(other) {
339
- return this.#host.compareDocumentPosition(other.#host) & DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
340
- }
341
- /** Expands the panel, even when `disabled`. */
342
- expand() {
343
- this.expanded.set(true);
344
- }
345
- /**
346
- * Moves focus to the panel's header button.
347
- */
348
- focus() {
349
- this.triggerElement().nativeElement.focus();
350
- }
351
- /**
352
- * @internal
353
- */
354
- ownsTrigger(element) {
355
- return this.triggerElement().nativeElement === element;
356
- }
357
- /** Toggles the panel, unless it's `disabled`. */
358
- toggle() {
359
- if (this.disabled()) {
360
- return;
361
- }
362
- this.expanded.update(expanded => !expanded);
363
- }
364
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
365
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ExpansionPanelComponent, isStandalone: true, selector: "mona-expansion-panel", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, headingLevel: { classPropertyName: "headingLevel", publicName: "headingLevel", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange" }, host: { properties: { "class": "baseClass()", "attr.title": "null" } }, providers: [{ provide: COLLAPSIBLE_CONFIG, useExisting: forwardRef(() => ExpansionPanelComponent) }], queries: [{ propertyName: "actionsTemplateList", predicate: ExpansionPanelActionsTemplateDirective, read: TemplateRef, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: ExpansionPanelIconTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "titleTemplate", first: true, predicate: ExpansionPanelTitleTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "triggerElement", first: true, predicate: ["trigger"], descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"headerClass()\">\n <!-- The button fills the row, so all of it toggles. The actions sit over it as its sibling, never inside it. -->\n <div\n [class]=\"headingClass()\"\n [attr.role]=\"headingLevel() === null ? null : 'heading'\"\n [attr.aria-level]=\"headingLevel()\">\n <button #trigger monaCollapsibleTrigger [id]=\"triggerId\" [class]=\"triggerClass()\">\n <span [class]=\"headerTitleClass()\">\n @if (titleTemplate()) {\n <ng-container [ngTemplateOutlet]=\"titleTemplate()\"></ng-container>\n } @else {\n {{ title() }}\n }\n </span>\n <span [class]=\"iconContainerClass()\">\n @if (iconTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: expanded() }\"></ng-container>\n } @else {\n @if (expanded()) {\n <svg lucideMinus [size]=\"14\" aria-hidden=\"true\"></svg>\n } @else {\n <svg lucidePlus [size]=\"14\" aria-hidden=\"true\"></svg>\n }\n }\n </span>\n </button>\n </div>\n @if (actionsTemplateList().length > 0) {\n <div [class]=\"actionsClass()\" [attr.inert]=\"disabled() ? true : null\">\n @for (action of actionsTemplateList(); track $index) {\n <ng-container [ngTemplateOutlet]=\"action\"></ng-container>\n }\n </div>\n }\n</div>\n<div\n [id]=\"contentId\"\n role=\"region\"\n [class]=\"contentClass()\"\n [attr.aria-labelledby]=\"triggerId\"\n [attr.aria-hidden]=\"!expanded()\"\n [attr.inert]=\"!expanded() ? true : undefined\">\n <div>\n <ng-content></ng-content>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideMinus, selector: "svg[lucideMinus]" }, { kind: "component", type: LucidePlus, selector: "svg[lucidePlus]" }, { kind: "directive", type: CollapsibleTriggerDirective, selector: "[monaCollapsibleTrigger]" }] }); }
366
- }
367
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelComponent, decorators: [{
368
- type: Component,
369
- args: [{ selector: "mona-expansion-panel", imports: [NgTemplateOutlet, LucideMinus, LucidePlus, CollapsibleTriggerDirective], host: {
370
- "[class]": "baseClass()",
371
- // A plain `title` attribute would stay on the host as a tooltip over the whole panel.
372
- "[attr.title]": "null"
373
- }, providers: [{ provide: COLLAPSIBLE_CONFIG, useExisting: forwardRef(() => ExpansionPanelComponent) }], template: "<div [class]=\"headerClass()\">\n <!-- The button fills the row, so all of it toggles. The actions sit over it as its sibling, never inside it. -->\n <div\n [class]=\"headingClass()\"\n [attr.role]=\"headingLevel() === null ? null : 'heading'\"\n [attr.aria-level]=\"headingLevel()\">\n <button #trigger monaCollapsibleTrigger [id]=\"triggerId\" [class]=\"triggerClass()\">\n <span [class]=\"headerTitleClass()\">\n @if (titleTemplate()) {\n <ng-container [ngTemplateOutlet]=\"titleTemplate()\"></ng-container>\n } @else {\n {{ title() }}\n }\n </span>\n <span [class]=\"iconContainerClass()\">\n @if (iconTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: expanded() }\"></ng-container>\n } @else {\n @if (expanded()) {\n <svg lucideMinus [size]=\"14\" aria-hidden=\"true\"></svg>\n } @else {\n <svg lucidePlus [size]=\"14\" aria-hidden=\"true\"></svg>\n }\n }\n </span>\n </button>\n </div>\n @if (actionsTemplateList().length > 0) {\n <div [class]=\"actionsClass()\" [attr.inert]=\"disabled() ? true : null\">\n @for (action of actionsTemplateList(); track $index) {\n <ng-container [ngTemplateOutlet]=\"action\"></ng-container>\n }\n </div>\n }\n</div>\n<div\n [id]=\"contentId\"\n role=\"region\"\n [class]=\"contentClass()\"\n [attr.aria-labelledby]=\"triggerId\"\n [attr.aria-hidden]=\"!expanded()\"\n [attr.inert]=\"!expanded() ? true : undefined\">\n <div>\n <ng-content></ng-content>\n </div>\n</div>\n" }]
374
- }], ctorParameters: () => [], propDecorators: { actionsTemplateList: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ExpansionPanelActionsTemplateDirective), { ...{
375
- read: TemplateRef
376
- }, isSignal: true }] }], iconTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ExpansionPanelIconTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], titleTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ExpansionPanelTitleTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], triggerElement: [{ type: i0.ViewChild, args: ["trigger", { isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }, { type: i0.Output, args: ["expandedChange"] }], headingLevel: [{ type: i0.Input, args: [{ isSignal: true, alias: "headingLevel", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
377
-
378
- /*
379
- * Public API Surface of @nanahoshi/mona-ui/expansion-panel
380
- */
381
-
382
- /**
383
- * Generated bundle index. Do not edit.
384
- */
385
-
275
+ var ExpansionPanelComponent = class ExpansionPanelComponent {
276
+ #host;
277
+ constructor() {
278
+ this.#host = inject(ElementRef).nativeElement;
279
+ this.actionsClass = computed(() => {
280
+ return expansionPanelActionsThemeVariants();
281
+ }, ...ngDevMode ? [{ debugName: "actionsClass" }] : /* istanbul ignore next */ []);
282
+ this.actionsTemplateList = contentChildren(ExpansionPanelActionsTemplateDirective, {
283
+ ...ngDevMode ? { debugName: "actionsTemplateList" } : /* istanbul ignore next */ {},
284
+ read: TemplateRef
285
+ });
286
+ this.baseClass = computed(() => {
287
+ const rounded = this.rounded();
288
+ const variantClass = expansionPanelBaseThemeVariants({ rounded });
289
+ return twMerge(variantClass, this.userClass());
290
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
291
+ this.contentClass = computed(() => {
292
+ const expanded = this.expanded();
293
+ return expansionPanelContentThemeVariants({ expanded });
294
+ }, ...ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []);
295
+ this.headerClass = computed(() => {
296
+ return expansionPanelHeaderThemeVariants({ collapsed: !this.expanded() });
297
+ }, ...ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []);
298
+ this.headerTitleClass = computed(() => {
299
+ return expansionPanelHeaderTitleThemeVariants();
300
+ }, ...ngDevMode ? [{ debugName: "headerTitleClass" }] : /* istanbul ignore next */ []);
301
+ this.headingClass = computed(() => {
302
+ return expansionPanelHeadingThemeVariants();
303
+ }, ...ngDevMode ? [{ debugName: "headingClass" }] : /* istanbul ignore next */ []);
304
+ this.iconContainerClass = computed(() => {
305
+ const hasTemplate = !!this.iconTemplate();
306
+ return expansionPanelIconContainerThemeVariants({ hasTemplate });
307
+ }, ...ngDevMode ? [{ debugName: "iconContainerClass" }] : /* istanbul ignore next */ []);
308
+ this.iconTemplate = contentChild(ExpansionPanelIconTemplateDirective, {
309
+ ...ngDevMode ? { debugName: "iconTemplate" } : /* istanbul ignore next */ {},
310
+ read: TemplateRef
311
+ });
312
+ this.titleTemplate = contentChild(ExpansionPanelTitleTemplateDirective, {
313
+ ...ngDevMode ? { debugName: "titleTemplate" } : /* istanbul ignore next */ {},
314
+ read: TemplateRef
315
+ });
316
+ this.triggerClass = computed(() => {
317
+ return expansionPanelTriggerThemeVariants({ disabled: this.disabled() });
318
+ }, ...ngDevMode ? [{ debugName: "triggerClass" }] : /* istanbul ignore next */ []);
319
+ this.triggerElement = viewChild.required("trigger", ...ngDevMode ? [{ debugName: "triggerElement" }] : /* istanbul ignore next */ []);
320
+ this.triggerId = createElementControlId();
321
+ this.animate = computed(() => true, ...ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []);
322
+ this.contentId = createElementControlId();
323
+ this.disabled = input(false, {
324
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
325
+ transform: booleanAttribute
326
+ });
327
+ this.expanded = model(false, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
328
+ this.headingLevel = input(3, {
329
+ ...ngDevMode ? { debugName: "headingLevel" } : /* istanbul ignore next */ {},
330
+ transform: toHeadingLevel
331
+ });
332
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
333
+ this.title = input("", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
334
+ this.userClass = input("", {
335
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
336
+ alias: "class"
337
+ });
338
+ const accordion = inject(EXPANSION_PANEL_ACCORDION, { optional: true });
339
+ if (accordion) inject(DestroyRef).onDestroy(accordion.register(this));
340
+ if (isDevMode()) afterNextRender({ read: () => {
341
+ const trigger = this.triggerElement().nativeElement;
342
+ if (!trigger.textContent?.trim() && !trigger.querySelector("[aria-label], img[alt]")) console.warn("mona-expansion-panel: a panel needs a title, or its button has no name.");
343
+ } });
344
+ }
345
+ collapse() {
346
+ this.expanded.set(false);
347
+ }
348
+ compareDocumentOrder(other) {
349
+ return this.#host.compareDocumentPosition(other.#host) & DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
350
+ }
351
+ expand() {
352
+ this.expanded.set(true);
353
+ }
354
+ focus() {
355
+ this.triggerElement().nativeElement.focus();
356
+ }
357
+ ownsTrigger(element) {
358
+ return this.triggerElement().nativeElement === element;
359
+ }
360
+ toggle() {
361
+ if (this.disabled()) return;
362
+ this.expanded.update((expanded) => !expanded);
363
+ }
364
+ static {
365
+ this.ɵfac = i0.ɵɵngDeclareFactory({
366
+ minVersion: "12.0.0",
367
+ version: "22.2.6",
368
+ ngImport: i0,
369
+ type: ExpansionPanelComponent,
370
+ deps: [],
371
+ target: i0.ɵɵFactoryTarget.Component
372
+ });
373
+ }
374
+ static {
375
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
376
+ minVersion: "17.0.0",
377
+ version: "22.2.6",
378
+ type: ExpansionPanelComponent,
379
+ isStandalone: true,
380
+ selector: "mona-expansion-panel",
381
+ inputs: {
382
+ disabled: {
383
+ classPropertyName: "disabled",
384
+ publicName: "disabled",
385
+ isSignal: true,
386
+ isRequired: false,
387
+ transformFunction: null
388
+ },
389
+ expanded: {
390
+ classPropertyName: "expanded",
391
+ publicName: "expanded",
392
+ isSignal: true,
393
+ isRequired: false,
394
+ transformFunction: null
395
+ },
396
+ headingLevel: {
397
+ classPropertyName: "headingLevel",
398
+ publicName: "headingLevel",
399
+ isSignal: true,
400
+ isRequired: false,
401
+ transformFunction: null
402
+ },
403
+ rounded: {
404
+ classPropertyName: "rounded",
405
+ publicName: "rounded",
406
+ isSignal: true,
407
+ isRequired: false,
408
+ transformFunction: null
409
+ },
410
+ title: {
411
+ classPropertyName: "title",
412
+ publicName: "title",
413
+ isSignal: true,
414
+ isRequired: false,
415
+ transformFunction: null
416
+ },
417
+ userClass: {
418
+ classPropertyName: "userClass",
419
+ publicName: "class",
420
+ isSignal: true,
421
+ isRequired: false,
422
+ transformFunction: null
423
+ }
424
+ },
425
+ outputs: { expanded: "expandedChange" },
426
+ host: { properties: {
427
+ "class": "baseClass()",
428
+ "attr.title": "null"
429
+ } },
430
+ providers: [{
431
+ provide: COLLAPSIBLE_CONFIG,
432
+ useExisting: forwardRef(() => ExpansionPanelComponent)
433
+ }],
434
+ queries: [
435
+ {
436
+ propertyName: "actionsTemplateList",
437
+ predicate: ExpansionPanelActionsTemplateDirective,
438
+ read: TemplateRef,
439
+ isSignal: true
440
+ },
441
+ {
442
+ propertyName: "iconTemplate",
443
+ first: true,
444
+ predicate: ExpansionPanelIconTemplateDirective,
445
+ descendants: true,
446
+ read: TemplateRef,
447
+ isSignal: true
448
+ },
449
+ {
450
+ propertyName: "titleTemplate",
451
+ first: true,
452
+ predicate: ExpansionPanelTitleTemplateDirective,
453
+ descendants: true,
454
+ read: TemplateRef,
455
+ isSignal: true
456
+ }
457
+ ],
458
+ viewQueries: [{
459
+ propertyName: "triggerElement",
460
+ first: true,
461
+ predicate: ["trigger"],
462
+ descendants: true,
463
+ isSignal: true
464
+ }],
465
+ ngImport: i0,
466
+ template: "<div [class]=\"headerClass()\">\n <!-- The button fills the row, so all of it toggles. The actions sit over it as its sibling, never inside it. -->\n <div\n [class]=\"headingClass()\"\n [attr.role]=\"headingLevel() === null ? null : 'heading'\"\n [attr.aria-level]=\"headingLevel()\">\n <button #trigger monaCollapsibleTrigger [id]=\"triggerId\" [class]=\"triggerClass()\">\n <span [class]=\"headerTitleClass()\">\n @if (titleTemplate()) {\n <ng-container [ngTemplateOutlet]=\"titleTemplate()\"></ng-container>\n } @else {\n {{ title() }}\n }\n </span>\n <span [class]=\"iconContainerClass()\">\n @if (iconTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: expanded() }\"></ng-container>\n } @else {\n @if (expanded()) {\n <svg lucideMinus [size]=\"14\" aria-hidden=\"true\"></svg>\n } @else {\n <svg lucidePlus [size]=\"14\" aria-hidden=\"true\"></svg>\n }\n }\n </span>\n </button>\n </div>\n @if (actionsTemplateList().length > 0) {\n <div [class]=\"actionsClass()\" [attr.inert]=\"disabled() ? true : null\">\n @for (action of actionsTemplateList(); track $index) {\n <ng-container [ngTemplateOutlet]=\"action\"></ng-container>\n }\n </div>\n }\n</div>\n<div\n [id]=\"contentId\"\n role=\"region\"\n [class]=\"contentClass()\"\n [attr.aria-labelledby]=\"triggerId\"\n [attr.aria-hidden]=\"!expanded()\"\n [attr.inert]=\"!expanded() ? true : undefined\">\n <div>\n <ng-content></ng-content>\n </div>\n</div>\n",
467
+ dependencies: [
468
+ {
469
+ kind: "directive",
470
+ type: NgTemplateOutlet,
471
+ selector: "[ngTemplateOutlet]",
472
+ inputs: [
473
+ "ngTemplateOutletContext",
474
+ "ngTemplateOutlet",
475
+ "ngTemplateOutletInjector"
476
+ ]
477
+ },
478
+ {
479
+ kind: "component",
480
+ type: LucideMinus,
481
+ selector: "svg[lucideMinus]"
482
+ },
483
+ {
484
+ kind: "component",
485
+ type: LucidePlus,
486
+ selector: "svg[lucidePlus]"
487
+ },
488
+ {
489
+ kind: "directive",
490
+ type: CollapsibleTriggerDirective,
491
+ selector: "[monaCollapsibleTrigger]"
492
+ }
493
+ ]
494
+ });
495
+ }
496
+ };
497
+ i0.ɵɵngDeclareClassMetadata({
498
+ minVersion: "12.0.0",
499
+ version: "22.2.6",
500
+ ngImport: i0,
501
+ type: ExpansionPanelComponent,
502
+ decorators: [{
503
+ type: Component,
504
+ args: [{
505
+ selector: "mona-expansion-panel",
506
+ imports: [
507
+ NgTemplateOutlet,
508
+ LucideMinus,
509
+ LucidePlus,
510
+ CollapsibleTriggerDirective
511
+ ],
512
+ host: {
513
+ "[class]": "baseClass()",
514
+ "[attr.title]": "null"
515
+ },
516
+ providers: [{
517
+ provide: COLLAPSIBLE_CONFIG,
518
+ useExisting: forwardRef(() => ExpansionPanelComponent)
519
+ }],
520
+ template: "<div [class]=\"headerClass()\">\n <!-- The button fills the row, so all of it toggles. The actions sit over it as its sibling, never inside it. -->\n <div\n [class]=\"headingClass()\"\n [attr.role]=\"headingLevel() === null ? null : 'heading'\"\n [attr.aria-level]=\"headingLevel()\">\n <button #trigger monaCollapsibleTrigger [id]=\"triggerId\" [class]=\"triggerClass()\">\n <span [class]=\"headerTitleClass()\">\n @if (titleTemplate()) {\n <ng-container [ngTemplateOutlet]=\"titleTemplate()\"></ng-container>\n } @else {\n {{ title() }}\n }\n </span>\n <span [class]=\"iconContainerClass()\">\n @if (iconTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: expanded() }\"></ng-container>\n } @else {\n @if (expanded()) {\n <svg lucideMinus [size]=\"14\" aria-hidden=\"true\"></svg>\n } @else {\n <svg lucidePlus [size]=\"14\" aria-hidden=\"true\"></svg>\n }\n }\n </span>\n </button>\n </div>\n @if (actionsTemplateList().length > 0) {\n <div [class]=\"actionsClass()\" [attr.inert]=\"disabled() ? true : null\">\n @for (action of actionsTemplateList(); track $index) {\n <ng-container [ngTemplateOutlet]=\"action\"></ng-container>\n }\n </div>\n }\n</div>\n<div\n [id]=\"contentId\"\n role=\"region\"\n [class]=\"contentClass()\"\n [attr.aria-labelledby]=\"triggerId\"\n [attr.aria-hidden]=\"!expanded()\"\n [attr.inert]=\"!expanded() ? true : undefined\">\n <div>\n <ng-content></ng-content>\n </div>\n</div>\n"
521
+ }]
522
+ }],
523
+ ctorParameters: () => [],
524
+ propDecorators: {
525
+ actionsTemplateList: [{
526
+ type: i0.ContentChildren,
527
+ args: [i0.forwardRef(() => ExpansionPanelActionsTemplateDirective), {
528
+ read: TemplateRef,
529
+ isSignal: true
530
+ }]
531
+ }],
532
+ iconTemplate: [{
533
+ type: i0.ContentChild,
534
+ args: [i0.forwardRef(() => ExpansionPanelIconTemplateDirective), {
535
+ read: TemplateRef,
536
+ isSignal: true
537
+ }]
538
+ }],
539
+ titleTemplate: [{
540
+ type: i0.ContentChild,
541
+ args: [i0.forwardRef(() => ExpansionPanelTitleTemplateDirective), {
542
+ read: TemplateRef,
543
+ isSignal: true
544
+ }]
545
+ }],
546
+ triggerElement: [{
547
+ type: i0.ViewChild,
548
+ args: ["trigger", { isSignal: true }]
549
+ }],
550
+ disabled: [{
551
+ type: i0.Input,
552
+ args: [{
553
+ isSignal: true,
554
+ alias: "disabled",
555
+ required: false
556
+ }]
557
+ }],
558
+ expanded: [{
559
+ type: i0.Input,
560
+ args: [{
561
+ isSignal: true,
562
+ alias: "expanded",
563
+ required: false
564
+ }]
565
+ }, {
566
+ type: i0.Output,
567
+ args: ["expandedChange"]
568
+ }],
569
+ headingLevel: [{
570
+ type: i0.Input,
571
+ args: [{
572
+ isSignal: true,
573
+ alias: "headingLevel",
574
+ required: false
575
+ }]
576
+ }],
577
+ rounded: [{
578
+ type: i0.Input,
579
+ args: [{
580
+ isSignal: true,
581
+ alias: "rounded",
582
+ required: false
583
+ }]
584
+ }],
585
+ title: [{
586
+ type: i0.Input,
587
+ args: [{
588
+ isSignal: true,
589
+ alias: "title",
590
+ required: false
591
+ }]
592
+ }],
593
+ userClass: [{
594
+ type: i0.Input,
595
+ args: [{
596
+ isSignal: true,
597
+ alias: "class",
598
+ required: false
599
+ }]
600
+ }]
601
+ }
602
+ });
386
603
  export { AccordionComponent, ExpansionPanelActionsTemplateDirective, ExpansionPanelComponent, ExpansionPanelIconTemplateDirective, ExpansionPanelTitleTemplateDirective };
387
- //# sourceMappingURL=nanahoshi-mona-ui-expansion-panel.mjs.map
604
+
605
+ //# sourceMappingURL=nanahoshi-mona-ui-expansion-panel.mjs.map