@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,587 +1,808 @@
1
- import { PreventableEvent } from '@nanahoshi/mona-ui/common';
2
- import * as i0 from '@angular/core';
3
- import { Directive, computed, input, inject, signal, contentChild, TemplateRef, viewChildren, booleanAttribute, model, output, effect, Component } from '@angular/core';
4
- import { NgTemplateOutlet } from '@angular/common';
5
- import { LucideCheck, LucideCircleAlert } from '@lucide/angular';
6
- import { select } from '@mirei/ts-collections';
7
- import { formatNumber, injectComponentDirection, MonaI18nService } from '@nanahoshi/mona-ui/i18n';
8
- import { createElementControlId } from '@nanahoshi/mona-ui/internal';
9
- import { cva } from 'class-variance-authority';
10
-
11
- /**
12
- * What `mona-stepper` reports before a click or key changes the step. Call `preventDefault()` to stay on the current step.
13
- */
14
- class StepSelectEvent extends PreventableEvent {
15
- #index;
16
- #previousIndex;
17
- #step;
18
- constructor(index, previousIndex, step, originalEvent) {
19
- super("stepSelect", originalEvent);
20
- this.#index = index;
21
- this.#previousIndex = previousIndex;
22
- this.#step = step;
23
- }
24
- /** Zero-based index of the step being selected. */
25
- get index() {
26
- return this.#index;
27
- }
28
- /** Zero-based index of the step that is current now. */
29
- get previousIndex() {
30
- return this.#previousIndex;
31
- }
32
- /** The options of the step being selected. */
33
- get step() {
34
- return this.#step;
35
- }
36
- }
37
-
38
- /**
39
- * Marks an ng-template as the custom indicator template for mona-stepper.
40
- * The template context provides the step options, index, active state, and current step index.
41
- */
42
- class StepperIndicatorTemplateDirective {
43
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperIndicatorTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
44
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: StepperIndicatorTemplateDirective, isStandalone: true, selector: "ng-template[monaStepperIndicatorTemplate]", ngImport: i0 }); }
45
- }
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperIndicatorTemplateDirective, decorators: [{
47
- type: Directive,
48
- args: [{
49
- selector: "ng-template[monaStepperIndicatorTemplate]"
50
- }]
51
- }] });
52
-
53
- /**
54
- * Marks an ng-template as the custom label template for mona-stepper.
55
- * The template context provides the step options, index, active state, and current step index.
56
- */
57
- class StepperLabelTemplateDirective {
58
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperLabelTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
59
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: StepperLabelTemplateDirective, isStandalone: true, selector: "ng-template[monaStepperLabelTemplate]", ngImport: i0 }); }
60
- }
61
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperLabelTemplateDirective, decorators: [{
62
- type: Directive,
63
- args: [{
64
- selector: "ng-template[monaStepperLabelTemplate]"
65
- }]
66
- }] });
67
-
68
- /**
69
- * Marks an ng-template as the custom step template for mona-stepper.
70
- * When provided, this template replaces the entire default step indicator and label for each step.
71
- * The template context provides the step options, index, active state, and current step index.
72
- */
73
- class StepperStepTemplateDirective {
74
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperStepTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
75
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: StepperStepTemplateDirective, isStandalone: true, selector: "ng-template[monaStepperStepTemplate]", ngImport: i0 }); }
76
- }
77
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperStepTemplateDirective, decorators: [{
78
- type: Directive,
79
- args: [{
80
- selector: "ng-template[monaStepperStepTemplate]"
81
- }]
82
- }] });
83
-
1
+ import { PreventableEvent } from "@nanahoshi/mona-ui/common";
2
+ import * as i0 from "@angular/core";
3
+ import { Component, Directive, TemplateRef, booleanAttribute, computed, contentChild, effect, inject, input, model, output, signal, viewChildren } from "@angular/core";
4
+ import { NgTemplateOutlet } from "@angular/common";
5
+ import { LucideCheck, LucideCircleAlert } from "@lucide/angular";
6
+ import { select } from "@mirei/ts-collections";
7
+ import { MonaI18nService, formatNumber, injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
8
+ import { createElementControlId } from "@nanahoshi/mona-ui/internal";
9
+ import { cva } from "class-variance-authority";
10
+ var StepSelectEvent = class extends PreventableEvent {
11
+ #index;
12
+ #previousIndex;
13
+ #step;
14
+ constructor(index, previousIndex, step, originalEvent) {
15
+ super("stepSelect", originalEvent);
16
+ this.#index = index;
17
+ this.#previousIndex = previousIndex;
18
+ this.#step = step;
19
+ }
20
+ get index() {
21
+ return this.#index;
22
+ }
23
+ get previousIndex() {
24
+ return this.#previousIndex;
25
+ }
26
+ get step() {
27
+ return this.#step;
28
+ }
29
+ };
30
+ var StepperIndicatorTemplateDirective = class StepperIndicatorTemplateDirective {
31
+ static {
32
+ this.ɵfac = i0.ɵɵngDeclareFactory({
33
+ minVersion: "12.0.0",
34
+ version: "22.2.6",
35
+ ngImport: i0,
36
+ type: StepperIndicatorTemplateDirective,
37
+ deps: [],
38
+ target: i0.ɵɵFactoryTarget.Directive
39
+ });
40
+ }
41
+ static {
42
+ this.ɵdir = i0.ɵɵngDeclareDirective({
43
+ minVersion: "14.0.0",
44
+ version: "22.2.6",
45
+ type: StepperIndicatorTemplateDirective,
46
+ isStandalone: true,
47
+ selector: "ng-template[monaStepperIndicatorTemplate]",
48
+ ngImport: i0
49
+ });
50
+ }
51
+ };
52
+ i0.ɵɵngDeclareClassMetadata({
53
+ minVersion: "12.0.0",
54
+ version: "22.2.6",
55
+ ngImport: i0,
56
+ type: StepperIndicatorTemplateDirective,
57
+ decorators: [{
58
+ type: Directive,
59
+ args: [{ selector: "ng-template[monaStepperIndicatorTemplate]" }]
60
+ }]
61
+ });
62
+ var StepperLabelTemplateDirective = class StepperLabelTemplateDirective {
63
+ static {
64
+ this.ɵfac = i0.ɵɵngDeclareFactory({
65
+ minVersion: "12.0.0",
66
+ version: "22.2.6",
67
+ ngImport: i0,
68
+ type: StepperLabelTemplateDirective,
69
+ deps: [],
70
+ target: i0.ɵɵFactoryTarget.Directive
71
+ });
72
+ }
73
+ static {
74
+ this.ɵdir = i0.ɵɵngDeclareDirective({
75
+ minVersion: "14.0.0",
76
+ version: "22.2.6",
77
+ type: StepperLabelTemplateDirective,
78
+ isStandalone: true,
79
+ selector: "ng-template[monaStepperLabelTemplate]",
80
+ ngImport: i0
81
+ });
82
+ }
83
+ };
84
+ i0.ɵɵngDeclareClassMetadata({
85
+ minVersion: "12.0.0",
86
+ version: "22.2.6",
87
+ ngImport: i0,
88
+ type: StepperLabelTemplateDirective,
89
+ decorators: [{
90
+ type: Directive,
91
+ args: [{ selector: "ng-template[monaStepperLabelTemplate]" }]
92
+ }]
93
+ });
94
+ var StepperStepTemplateDirective = class StepperStepTemplateDirective {
95
+ static {
96
+ this.ɵfac = i0.ɵɵngDeclareFactory({
97
+ minVersion: "12.0.0",
98
+ version: "22.2.6",
99
+ ngImport: i0,
100
+ type: StepperStepTemplateDirective,
101
+ deps: [],
102
+ target: i0.ɵɵFactoryTarget.Directive
103
+ });
104
+ }
105
+ static {
106
+ this.ɵdir = i0.ɵɵngDeclareDirective({
107
+ minVersion: "14.0.0",
108
+ version: "22.2.6",
109
+ type: StepperStepTemplateDirective,
110
+ isStandalone: true,
111
+ selector: "ng-template[monaStepperStepTemplate]",
112
+ ngImport: i0
113
+ });
114
+ }
115
+ };
116
+ i0.ɵɵngDeclareClassMetadata({
117
+ minVersion: "12.0.0",
118
+ version: "22.2.6",
119
+ ngImport: i0,
120
+ type: StepperStepTemplateDirective,
121
+ decorators: [{
122
+ type: Directive,
123
+ args: [{ selector: "ng-template[monaStepperStepTemplate]" }]
124
+ }]
125
+ });
84
126
  const stepperBaseThemeVariants = cva(`
85
127
  relative
86
128
  `, {
87
- variants: {
88
- orientation: {
89
- horizontal: "grid h-auto w-full",
90
- // A flex row stretches the step list to the stepper's height.
91
- vertical: "flex h-full w-auto"
92
- }
93
- },
94
- defaultVariants: {
95
- orientation: "horizontal"
96
- }
129
+ variants: { orientation: {
130
+ horizontal: "grid h-auto w-full",
131
+ vertical: "flex h-full w-auto"
132
+ } },
133
+ defaultVariants: { orientation: "horizontal" }
97
134
  });
98
- /** The list is in the flow, so the stepper's box holds the indicators and labels. The track is drawn behind it. */
99
135
  const stepperStepListThemeVariants = cva(`
100
136
  relative z-1 col-span-full flex list-none
101
137
  font-medium
102
138
  `, {
103
- variants: {
104
- orientation: {
105
- horizontal: "w-full flex-row",
106
- vertical: "w-max flex-col"
107
- }
108
- },
109
- defaultVariants: {
110
- orientation: "horizontal"
111
- }
139
+ variants: { orientation: {
140
+ horizontal: "w-full flex-row",
141
+ vertical: "w-max flex-col"
142
+ } },
143
+ defaultVariants: { orientation: "horizontal" }
112
144
  });
113
145
  const stepperStepListItemThemeVariants = cva(`
114
146
  z-1 flex grow-1 shrink-0 basis-auto items-center
115
147
  `, {
116
- variants: {
117
- orientation: {
118
- horizontal: "flex-col gap-2",
119
- vertical: "flex-row justify-start gap-2"
120
- }
121
- },
122
- defaultVariants: {
123
- orientation: "horizontal"
124
- }
148
+ variants: { orientation: {
149
+ horizontal: "flex-col gap-2",
150
+ vertical: "flex-row justify-start gap-2"
151
+ } },
152
+ defaultVariants: { orientation: "horizontal" }
125
153
  });
126
154
  const stepperStepIndicatorThemeVariants = cva(`
127
155
  flex h-8 w-8 items-center justify-center
128
156
  border border-border cursor-[inherit]
129
157
  transition-colors duration-(--mona-motion-standard) ease-in-out
130
158
  focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-focus-indicator
131
- `, {
132
- variants: {
133
- invalid: {
134
- true: "border-2 border-error",
135
- false: ""
136
- },
137
- state: {
138
- completed: `
159
+ `, { variants: {
160
+ invalid: {
161
+ true: "border-2 border-error",
162
+ false: ""
163
+ },
164
+ state: {
165
+ completed: `
139
166
  bg-[var(--mona-indicator-color,var(--color-primary))]
140
167
  text-[var(--mona-indicator-foreground,var(--color-primary-foreground))]
141
168
  forced-colors:border-[Highlight]
142
169
  `,
143
- current: `
170
+ current: `
144
171
  bg-[var(--mona-indicator-color,var(--color-primary))]
145
172
  text-[var(--mona-indicator-foreground,var(--color-primary-foreground))]
146
173
  ring-2 ring-primary ring-offset-2 ring-offset-surface
147
174
  forced-colors:border-2 forced-colors:border-[Highlight]
148
175
  `,
149
- disabled: "border-dashed bg-surface-muted text-disabled-foreground",
150
- upcoming: "bg-surface-raised text-foreground"
151
- },
152
- rounded: {
153
- small: "rounded-sm",
154
- medium: "rounded-md",
155
- large: "rounded-lg",
156
- full: "rounded-full",
157
- none: "rounded-none"
158
- }
159
- }
160
- });
161
- /** The button around a `monaStepperStepTemplate`, whose looks are the template's. */
176
+ disabled: "border-dashed bg-surface-muted text-disabled-foreground",
177
+ upcoming: "bg-surface-raised text-foreground"
178
+ },
179
+ rounded: {
180
+ small: "rounded-sm",
181
+ medium: "rounded-md",
182
+ large: "rounded-lg",
183
+ full: "rounded-full",
184
+ none: "rounded-none"
185
+ }
186
+ } });
162
187
  const stepperStepButtonThemeVariants = cva(`
163
188
  cursor-[inherit] rounded-sm
164
189
  focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-indicator
165
190
  `);
166
- const stepperStepLabelThemeVariants = cva("", {
167
- variants: {
168
- state: {
169
- completed: "",
170
- current: "font-semibold",
171
- disabled: "text-disabled-foreground",
172
- upcoming: ""
173
- }
174
- }
175
- });
176
- /** Placed by the component, from the first indicator's centre to the last one's. */
191
+ const stepperStepLabelThemeVariants = cva("", { variants: { state: {
192
+ completed: "",
193
+ current: "font-semibold",
194
+ disabled: "text-disabled-foreground",
195
+ upcoming: ""
196
+ } } });
177
197
  const stepperTrackThemeVariants = cva(`
178
198
  absolute
179
199
  bg-surface-muted text-foreground
180
200
  border border-border-subtle
181
201
  `, {
182
- variants: {
183
- orientation: {
184
- horizontal: "h-2",
185
- vertical: "w-2"
186
- }
187
- },
188
- defaultVariants: {
189
- orientation: "horizontal"
190
- }
202
+ variants: { orientation: {
203
+ horizontal: "h-2",
204
+ vertical: "w-2"
205
+ } },
206
+ defaultVariants: { orientation: "horizontal" }
191
207
  });
192
208
  const stepperTrackLineThemeVariants = cva(`
193
209
  absolute start-0 top-0 bg-[var(--mona-indicator-color,var(--color-primary))]
194
210
  `, {
195
- variants: {
196
- orientation: {
197
- horizontal: "h-full transition-width duration-(--mona-motion-standard) ease-out",
198
- vertical: "w-full transition-height duration-(--mona-motion-standard) ease-out"
199
- }
200
- },
201
- defaultVariants: {
202
- orientation: "horizontal"
203
- }
211
+ variants: { orientation: {
212
+ horizontal: "h-full transition-width duration-(--mona-motion-standard) ease-out",
213
+ vertical: "w-full transition-height duration-(--mona-motion-standard) ease-out"
214
+ } },
215
+ defaultVariants: { orientation: "horizontal" }
216
+ });
217
+ var StepperIndicatorDirective = class StepperIndicatorDirective {
218
+ constructor() {
219
+ this.stepIndicatorClass = computed(() => {
220
+ const invalid = this.invalid();
221
+ const rounded = this.rounded();
222
+ const state = this.state();
223
+ return stepperStepIndicatorThemeVariants({
224
+ invalid,
225
+ rounded,
226
+ state
227
+ });
228
+ }, ...ngDevMode ? [{ debugName: "stepIndicatorClass" }] : /* istanbul ignore next */ []);
229
+ this.invalid = input.required(...ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []);
230
+ this.rounded = input.required(...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
231
+ this.state = input.required(...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
232
+ }
233
+ static {
234
+ this.ɵfac = i0.ɵɵngDeclareFactory({
235
+ minVersion: "12.0.0",
236
+ version: "22.2.6",
237
+ ngImport: i0,
238
+ type: StepperIndicatorDirective,
239
+ deps: [],
240
+ target: i0.ɵɵFactoryTarget.Directive
241
+ });
242
+ }
243
+ static {
244
+ this.ɵdir = i0.ɵɵngDeclareDirective({
245
+ minVersion: "17.1.0",
246
+ version: "22.2.6",
247
+ type: StepperIndicatorDirective,
248
+ isStandalone: true,
249
+ selector: "button[monaStepperIndicator]",
250
+ inputs: {
251
+ invalid: {
252
+ classPropertyName: "invalid",
253
+ publicName: "invalid",
254
+ isSignal: true,
255
+ isRequired: true,
256
+ transformFunction: null
257
+ },
258
+ rounded: {
259
+ classPropertyName: "rounded",
260
+ publicName: "rounded",
261
+ isSignal: true,
262
+ isRequired: true,
263
+ transformFunction: null
264
+ },
265
+ state: {
266
+ classPropertyName: "state",
267
+ publicName: "state",
268
+ isSignal: true,
269
+ isRequired: true,
270
+ transformFunction: null
271
+ }
272
+ },
273
+ host: { properties: { "class": "stepIndicatorClass()" } },
274
+ ngImport: i0
275
+ });
276
+ }
277
+ };
278
+ i0.ɵɵngDeclareClassMetadata({
279
+ minVersion: "12.0.0",
280
+ version: "22.2.6",
281
+ ngImport: i0,
282
+ type: StepperIndicatorDirective,
283
+ decorators: [{
284
+ type: Directive,
285
+ args: [{
286
+ selector: "button[monaStepperIndicator]",
287
+ host: { "[class]": "stepIndicatorClass()" }
288
+ }]
289
+ }],
290
+ propDecorators: {
291
+ invalid: [{
292
+ type: i0.Input,
293
+ args: [{
294
+ isSignal: true,
295
+ alias: "invalid",
296
+ required: true
297
+ }]
298
+ }],
299
+ rounded: [{
300
+ type: i0.Input,
301
+ args: [{
302
+ isSignal: true,
303
+ alias: "rounded",
304
+ required: true
305
+ }]
306
+ }],
307
+ state: [{
308
+ type: i0.Input,
309
+ args: [{
310
+ isSignal: true,
311
+ alias: "state",
312
+ required: true
313
+ }]
314
+ }]
315
+ }
204
316
  });
205
-
206
- class StepperIndicatorDirective {
207
- constructor() {
208
- this.stepIndicatorClass = computed(() => {
209
- const invalid = this.invalid();
210
- const rounded = this.rounded();
211
- const state = this.state();
212
- return stepperStepIndicatorThemeVariants({ invalid, rounded, state });
213
- }, /* @ts-ignore */
214
- ...(ngDevMode ? [{ debugName: "stepIndicatorClass" }] : /* istanbul ignore next */ []));
215
- this.invalid = input.required(/* @ts-ignore */
216
- ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
217
- this.rounded = input.required(/* @ts-ignore */
218
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
219
- this.state = input.required(/* @ts-ignore */
220
- ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
221
- }
222
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
223
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: StepperIndicatorDirective, isStandalone: true, selector: "button[monaStepperIndicator]", inputs: { invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: true, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: true, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "stepIndicatorClass()" } }, ngImport: i0 }); }
224
- }
225
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperIndicatorDirective, decorators: [{
226
- type: Directive,
227
- args: [{
228
- selector: "button[monaStepperIndicator]",
229
- host: {
230
- "[class]": "stepIndicatorClass()"
231
- }
232
- }]
233
- }], propDecorators: { invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: true }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: true }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: true }] }] } });
234
-
235
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
236
- // Edit the JSON file and run `npm run generate:locale-catalogs`.
237
317
  function localizeNumber(value, options) {
238
- return formatNumber(value, "en-US", options);
318
+ return formatNumber(value, "en-US", options);
239
319
  }
240
320
  const STEPPER_DEFAULT_MESSAGES = {
241
- stepCompleted: "Completed",
242
- stepInvalid: "Has errors",
243
- stepPosition: (current, total) => `Step ${localizeNumber(current)} of ${localizeNumber(total)}`,
244
- stepProgress: "Step progress",
245
- stepper: "Progress"
321
+ stepCompleted: "Completed",
322
+ stepInvalid: "Has errors",
323
+ stepPosition: (current, total) => `Step ${localizeNumber(current)} of ${localizeNumber(total)}`,
324
+ stepProgress: "Step progress",
325
+ stepper: "Progress"
246
326
  };
247
-
248
- /** What in a label or step template keeps its own clicks. */
249
327
  const PROJECTED_CONTROL_SELECTOR = "a[href], button, input, select, summary, textarea, [contenteditable], [tabindex]";
250
- class StepperComponent {
251
- /** The nearest steps on either side of the current one that aren't disabled: all that a linear stepper can reach. */
252
- #adjacentEnabledSteps;
253
- #direction;
254
- #i18n;
255
- #id;
256
- #trackItemSize;
257
- #trackLength;
258
- constructor() {
259
- /** The nearest steps on either side of the current one that aren't disabled: all that a linear stepper can reach. */
260
- this.#adjacentEnabledSteps = computed(() => {
261
- const active = this.activeStep();
262
- const enabled = this.viewSteps()
263
- .toArray()
264
- .filter(step => !step.options.disabled);
265
- if (!active) {
266
- return { next: undefined, previous: undefined };
267
- }
268
- return {
269
- next: enabled.find(step => step.index > active.index),
270
- previous: enabled.filter(step => step.index < active.index).pop()
271
- };
272
- }, /* @ts-ignore */
273
- ...(ngDevMode ? [{ debugName: "#adjacentEnabledSteps" }] : /* istanbul ignore next */ []));
274
- this.#direction = injectComponentDirection();
275
- this.#i18n = inject(MonaI18nService);
276
- this.#id = createElementControlId();
277
- this.#trackItemSize = computed(() => {
278
- const stepCount = this.viewSteps().length;
279
- return stepCount !== 0 ? 100 / stepCount : 0;
280
- }, /* @ts-ignore */
281
- ...(ngDevMode ? [{ debugName: "#trackItemSize" }] : /* istanbul ignore next */ []));
282
- this.#trackLength = computed(() => {
283
- const step = this.activeStep();
284
- const stepCount = this.viewSteps().length;
285
- return step && stepCount > 1 ? `${(100 / (stepCount - 1)) * step.index}%` : "0%";
286
- }, /* @ts-ignore */
287
- ...(ngDevMode ? [{ debugName: "#trackLength" }] : /* istanbul ignore next */ []));
288
- this.activeStep = computed(() => {
289
- const steps = this.viewSteps();
290
- if (steps.length === 0) {
291
- return undefined;
292
- }
293
- return steps.elementAt(this.normalizeIndex(this.step(), steps.length));
294
- }, /* @ts-ignore */
295
- ...(ngDevMode ? [{ debugName: "activeStep" }] : /* istanbul ignore next */ []));
296
- this.baseClass = computed(() => {
297
- const orientation = this.orientation();
298
- return stepperBaseThemeVariants({ orientation });
299
- }, /* @ts-ignore */
300
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
301
- this.highlightedStep = signal(0, /* @ts-ignore */
302
- ...(ngDevMode ? [{ debugName: "highlightedStep" }] : /* istanbul ignore next */ []));
303
- this.hostStyles = computed(() => {
304
- const orientation = this.orientation();
305
- const stepCount = this.viewSteps().length;
306
- return {
307
- gridTemplateColumns: orientation === "horizontal" ? `repeat(${stepCount * 2}, 1fr)` : undefined,
308
- gridTemplateRows: orientation === "vertical" ? `repeat(${stepCount * 2}, 1fr)` : undefined
309
- };
310
- }, /* @ts-ignore */
311
- ...(ngDevMode ? [{ debugName: "hostStyles" }] : /* istanbul ignore next */ []));
312
- this.indicatorTemplate = contentChild(StepperIndicatorTemplateDirective, {
313
- read: TemplateRef
314
- });
315
- this.isRtl = computed(() => this.#direction() === "rtl", /* @ts-ignore */
316
- ...(ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []));
317
- this.labelTemplate = contentChild(StepperLabelTemplateDirective, { read: TemplateRef });
318
- this.listClass = computed(() => {
319
- const orientation = this.orientation();
320
- return stepperStepListThemeVariants({ orientation });
321
- }, /* @ts-ignore */
322
- ...(ngDevMode ? [{ debugName: "listClass" }] : /* istanbul ignore next */ []));
323
- this.listItemClass = computed(() => {
324
- const orientation = this.orientation();
325
- return stepperStepListItemThemeVariants({ orientation });
326
- }, /* @ts-ignore */
327
- ...(ngDevMode ? [{ debugName: "listItemClass" }] : /* istanbul ignore next */ []));
328
- this.messages = this.#i18n.componentMessages("stepper", STEPPER_DEFAULT_MESSAGES);
329
- this.progressMax = computed(() => Math.max(this.viewSteps().length - 1, 0), /* @ts-ignore */
330
- ...(ngDevMode ? [{ debugName: "progressMax" }] : /* istanbul ignore next */ []));
331
- this.progressText = computed(() => {
332
- const active = this.activeStep();
333
- return active ? this.positionText(active.index + 1) : null;
334
- }, /* @ts-ignore */
335
- ...(ngDevMode ? [{ debugName: "progressText" }] : /* istanbul ignore next */ []));
336
- this.stepButtonClass = computed(() => {
337
- return stepperStepButtonThemeVariants();
338
- }, /* @ts-ignore */
339
- ...(ngDevMode ? [{ debugName: "stepButtonClass" }] : /* istanbul ignore next */ []));
340
- this.stepButtons = viewChildren("stepButton", /* @ts-ignore */
341
- ...(ngDevMode ? [{ debugName: "stepButtons" }] : /* istanbul ignore next */ []));
342
- this.stepTemplate = contentChild(StepperStepTemplateDirective, {
343
- read: TemplateRef
344
- });
345
- this.trackClass = computed(() => {
346
- const orientation = this.orientation();
347
- return stepperTrackThemeVariants({ orientation });
348
- }, /* @ts-ignore */
349
- ...(ngDevMode ? [{ debugName: "trackClass" }] : /* istanbul ignore next */ []));
350
- this.trackInnerStyles = computed(() => {
351
- const orientation = this.orientation();
352
- const length = this.#trackLength();
353
- return {
354
- [orientation === "horizontal" ? "width" : "height"]: length
355
- };
356
- }, /* @ts-ignore */
357
- ...(ngDevMode ? [{ debugName: "trackInnerStyles" }] : /* istanbul ignore next */ []));
358
- this.trackItemStyles = computed(() => {
359
- const orientation = this.orientation();
360
- const itemSize = this.#trackItemSize();
361
- return {
362
- [orientation === "horizontal" ? "maxWidth" : "maxHeight"]: `${itemSize}%`
363
- };
364
- }, /* @ts-ignore */
365
- ...(ngDevMode ? [{ debugName: "trackItemStyles" }] : /* istanbul ignore next */ []));
366
- this.trackLineClass = computed(() => {
367
- const orientation = this.orientation();
368
- return stepperTrackLineThemeVariants({ orientation });
369
- }, /* @ts-ignore */
370
- ...(ngDevMode ? [{ debugName: "trackLineClass" }] : /* istanbul ignore next */ []));
371
- this.trackStyles = computed(() => {
372
- // Each step takes an equal share, with its indicator centred in it along the track. Across it, the 2rem
373
- // indicator's centre is 1rem in, and the 0.5rem track is centred on that.
374
- const edge = `${this.#trackItemSize() / 2}%`;
375
- return this.orientation() === "horizontal"
376
- ? { insetInlineEnd: edge, insetInlineStart: edge, top: "0.75rem" }
377
- : { bottom: edge, insetInlineStart: "0.75rem", top: edge };
378
- }, /* @ts-ignore */
379
- ...(ngDevMode ? [{ debugName: "trackStyles" }] : /* istanbul ignore next */ []));
380
- this.viewSteps = computed(() => {
381
- const steps = this.steps();
382
- return select(steps, (step, index) => ({
383
- options: step,
384
- index
385
- })).toImmutableSet();
386
- }, /* @ts-ignore */
387
- ...(ngDevMode ? [{ debugName: "viewSteps" }] : /* istanbul ignore next */ []));
388
- /**
389
- * @description Sets the accessible label for the stepper group.
390
- * @default ""
391
- */
392
- this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
393
- /**
394
- * @description Sets the flow of the stepper.
395
- * If set to true, the user will only be able to navigate to the previous or the next step.
396
- * @default true
397
- */
398
- this.linear = input(true, { ...(ngDevMode ? { debugName: "linear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
399
- /**
400
- * @description Sets the orientation of the stepper.
401
- */
402
- this.orientation = input("horizontal", /* @ts-ignore */
403
- ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
404
- /**
405
- * @description Sets the accessible label for the progress bar element.
406
- * @default ""
407
- */
408
- this.progressAriaLabel = input("", /* @ts-ignore */
409
- ...(ngDevMode ? [{ debugName: "progressAriaLabel" }] : /* istanbul ignore next */ []));
410
- /**
411
- * @description Sets the roundness of the stepper steps.
412
- */
413
- this.rounded = input("full", /* @ts-ignore */
414
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
415
- /**
416
- * @description Sets the active step of the stepper.
417
- */
418
- this.step = model(0, /* @ts-ignore */
419
- ...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
420
- /**
421
- * @description Emitted before a click or key changes the step. Call `preventDefault()` to stay on the current step,
422
- * for example while its form is invalid. It doesn't fire when `step` is written from outside.
423
- */
424
- this.stepSelect = output();
425
- /**
426
- * @description Sets the steps of the stepper.
427
- */
428
- this.steps = input([], /* @ts-ignore */
429
- ...(ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []));
430
- effect(() => {
431
- const requested = this.step();
432
- const stepCount = this.viewSteps().length;
433
- if (stepCount === 0) {
434
- return; // Steps may still be on their way, so the value can't be judged yet.
435
- }
436
- const index = this.normalizeIndex(requested, stepCount);
437
- if (index !== requested) {
438
- this.step.set(index);
439
- }
440
- this.highlightedStep.set(index);
441
- });
442
- }
443
- descriptionId(step) {
444
- return `${this.#id}-${step.index}-description`;
445
- }
446
- formatStepNumber(value) {
447
- if (value == null) {
448
- return "";
449
- }
450
- return formatNumber(value, this.#i18n.localeId(), {
451
- maximumFractionDigits: 0,
452
- useGrouping: false
453
- });
454
- }
455
- isStepActive(step) {
456
- const active = this.activeStep();
457
- return active != null && step.index <= active.index;
458
- }
459
- isStepLocked(step) {
460
- if (step.options.disabled) {
461
- return true;
462
- }
463
- if (!this.linear()) {
464
- return false;
465
- }
466
- const active = this.activeStep();
467
- if (!active || step.index === active.index) {
468
- return false;
469
- }
470
- const { next, previous } = this.#adjacentEnabledSteps();
471
- return step.index !== next?.index && step.index !== previous?.index;
472
- }
473
- labelClass(state) {
474
- return stepperStepLabelThemeVariants({ state });
475
- }
476
- onIndicatorFocus(step) {
477
- this.highlightedStep.set(step.index);
478
- }
479
- /**
480
- * Enter and Space aren't here: they reach the step as the click a native button makes of them. Only the step buttons'
481
- * own keys count, so a control in a template keeps its arrows, and a modified key stays the browser's.
482
- */
483
- onKeydown(event) {
484
- if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
485
- return;
486
- }
487
- if (!this.stepButtons().some(button => button.nativeElement === event.target)) {
488
- return;
489
- }
490
- const orientation = this.orientation();
491
- const isRtl = this.isRtl();
492
- let previousKey = orientation === "vertical" ? "ArrowUp" : "ArrowLeft";
493
- let nextKey = orientation === "vertical" ? "ArrowDown" : "ArrowRight";
494
- if (orientation === "horizontal" && isRtl) {
495
- previousKey = "ArrowRight";
496
- nextKey = "ArrowLeft";
497
- }
498
- const reachable = this.viewSteps()
499
- .toArray()
500
- .filter(step => !this.isStepLocked(step));
501
- const current = this.highlightedStep();
502
- let target;
503
- if (event.key === previousKey) {
504
- target = reachable.filter(step => step.index < current).pop();
505
- }
506
- else if (event.key === nextKey) {
507
- target = reachable.find(step => step.index > current);
508
- }
509
- else if (event.key === "Home") {
510
- target = reachable[0];
511
- }
512
- else if (event.key === "End") {
513
- target = reachable[reachable.length - 1];
514
- }
515
- else {
516
- return;
517
- }
518
- event.preventDefault();
519
- if (target) {
520
- this.highlightedStep.set(target.index);
521
- this.stepButtons()[target.index]?.nativeElement.focus();
522
- }
523
- }
524
- onStepClick(step, event) {
525
- const control = event.target.closest(PROJECTED_CONTROL_SELECTOR);
526
- if (control && !this.stepButtons().some(button => button.nativeElement === control)) {
527
- return;
528
- }
529
- this.setActiveStep(step, event);
530
- }
531
- positionText(position) {
532
- return this.messages().stepPosition(position, this.viewSteps().length);
533
- }
534
- stepState(step) {
535
- const active = this.activeStep();
536
- if (step.index === active?.index) {
537
- return "current";
538
- }
539
- if (step.options.disabled) {
540
- return "disabled";
541
- }
542
- return (step.options.completed ?? (active != null && step.index < active.index)) ? "completed" : "upcoming";
543
- }
544
- normalizeIndex(value, stepCount) {
545
- return Number.isFinite(value) ? Math.min(Math.max(Math.trunc(value), 0), stepCount - 1) : 0;
546
- }
547
- setActiveStep(step, event) {
548
- const active = this.activeStep();
549
- if (this.isStepLocked(step) || step.index === active?.index) {
550
- return;
551
- }
552
- const selectEvent = new StepSelectEvent(step.index, active?.index ?? 0, step.options, event);
553
- this.stepSelect.emit(selectEvent);
554
- if (selectEvent.isDefaultPrevented()) {
555
- return;
556
- }
557
- this.step.set(step.index);
558
- this.highlightedStep.set(step.index);
559
- }
560
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
561
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: StepperComponent, isStandalone: true, selector: "mona-stepper", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, progressAriaLabel: { classPropertyName: "progressAriaLabel", publicName: "progressAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, steps: { classPropertyName: "steps", publicName: "steps", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { step: "stepChange", stepSelect: "stepSelect" }, host: { attributes: { "role": "group" }, listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.aria-label": "ariaLabel() || messages().stepper", "class": "baseClass()", "style": "hostStyles()" } }, queries: [{ propertyName: "indicatorTemplate", first: true, predicate: StepperIndicatorTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: StepperLabelTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "stepTemplate", first: true, predicate: StepperStepTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "stepButtons", predicate: ["stepButton"], descendants: true, isSignal: true }], ngImport: i0, template: "<ol role=\"list\" [class]=\"listClass()\">\n @for (step of viewSteps(); track step.index) {\n @let active = isStepActive(step);\n @let locked = isStepLocked(step);\n @let state = stepState(step);\n @let invalid = !!step.options.invalid;\n @let options = step.options;\n @let index = step.index;\n @let currentIndex = activeStep()?.index ?? -1;\n @let disabled = !!options.disabled;\n @let focusable = step.index === highlightedStep();\n <li\n [class]=\"listItemClass()\"\n [class.cursor-pointer]=\"!locked\"\n [class.cursor-not-allowed]=\"locked\"\n [style]=\"trackItemStyles()\"\n (click)=\"onStepClick(step, $event)\">\n @if (stepTemplate()) {\n <button\n #stepButton\n type=\"button\"\n [class]=\"stepButtonClass()\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n <ng-container\n [ngTemplateOutlet]=\"stepTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n </button>\n } @else {\n <button\n #stepButton\n monaStepperIndicator\n type=\"button\"\n [invalid]=\"invalid\"\n [rounded]=\"rounded()\"\n [state]=\"state\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n @if (indicatorTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"indicatorTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else if (invalid) {\n <svg lucideCircleAlert [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else if (state === \"completed\") {\n <svg lucideCheck [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else {\n {{ formatStepNumber(step.index + 1) }}\n }\n </button>\n }\n @if (labelTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else {\n <span [class]=\"labelClass(state)\" aria-hidden=\"true\">{{ options.label }}</span>\n }\n </li>\n }\n</ol>\n<!-- Read through aria-describedby, which also works on hidden text. Nothing here is shown or read twice. -->\n<div hidden>\n @for (step of viewSteps(); track step.index) {\n <span [id]=\"descriptionId(step)\">\n <span>{{ positionText(step.index + 1) }}</span>\n @if (stepState(step) === \"completed\") {\n <span> {{ messages().stepCompleted }}</span>\n }\n @if (step.options.invalid) {\n <span> {{ messages().stepInvalid }}</span>\n }\n </span>\n }\n</div>\n<div\n [class]=\"trackClass()\"\n [style]=\"trackStyles()\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"activeStep()?.index ?? 0\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"progressMax()\"\n [attr.aria-valuetext]=\"progressText()\"\n [attr.aria-label]=\"progressAriaLabel() || messages().stepProgress\">\n <div [class]=\"trackLineClass()\" [style]=\"trackInnerStyles()\"></div>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: StepperIndicatorDirective, selector: "button[monaStepperIndicator]", inputs: ["invalid", "rounded", "state"] }, { kind: "component", type: LucideCheck, selector: "svg[lucideCheck]" }, { kind: "component", type: LucideCircleAlert, selector: "svg[lucideCircleAlert], svg[lucideAlertCircle]" }] }); }
562
- }
563
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperComponent, decorators: [{
564
- type: Component,
565
- args: [{ selector: "mona-stepper", imports: [NgTemplateOutlet, StepperIndicatorDirective, LucideCheck, LucideCircleAlert], host: {
566
- role: "group",
567
- "[attr.aria-label]": "ariaLabel() || messages().stepper",
568
- "[class]": "baseClass()",
569
- "[style]": "hostStyles()",
570
- "(keydown)": "onKeydown($event)"
571
- }, template: "<ol role=\"list\" [class]=\"listClass()\">\n @for (step of viewSteps(); track step.index) {\n @let active = isStepActive(step);\n @let locked = isStepLocked(step);\n @let state = stepState(step);\n @let invalid = !!step.options.invalid;\n @let options = step.options;\n @let index = step.index;\n @let currentIndex = activeStep()?.index ?? -1;\n @let disabled = !!options.disabled;\n @let focusable = step.index === highlightedStep();\n <li\n [class]=\"listItemClass()\"\n [class.cursor-pointer]=\"!locked\"\n [class.cursor-not-allowed]=\"locked\"\n [style]=\"trackItemStyles()\"\n (click)=\"onStepClick(step, $event)\">\n @if (stepTemplate()) {\n <button\n #stepButton\n type=\"button\"\n [class]=\"stepButtonClass()\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n <ng-container\n [ngTemplateOutlet]=\"stepTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n </button>\n } @else {\n <button\n #stepButton\n monaStepperIndicator\n type=\"button\"\n [invalid]=\"invalid\"\n [rounded]=\"rounded()\"\n [state]=\"state\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n @if (indicatorTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"indicatorTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else if (invalid) {\n <svg lucideCircleAlert [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else if (state === \"completed\") {\n <svg lucideCheck [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else {\n {{ formatStepNumber(step.index + 1) }}\n }\n </button>\n }\n @if (labelTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else {\n <span [class]=\"labelClass(state)\" aria-hidden=\"true\">{{ options.label }}</span>\n }\n </li>\n }\n</ol>\n<!-- Read through aria-describedby, which also works on hidden text. Nothing here is shown or read twice. -->\n<div hidden>\n @for (step of viewSteps(); track step.index) {\n <span [id]=\"descriptionId(step)\">\n <span>{{ positionText(step.index + 1) }}</span>\n @if (stepState(step) === \"completed\") {\n <span> {{ messages().stepCompleted }}</span>\n }\n @if (step.options.invalid) {\n <span> {{ messages().stepInvalid }}</span>\n }\n </span>\n }\n</div>\n<div\n [class]=\"trackClass()\"\n [style]=\"trackStyles()\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"activeStep()?.index ?? 0\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"progressMax()\"\n [attr.aria-valuetext]=\"progressText()\"\n [attr.aria-label]=\"progressAriaLabel() || messages().stepProgress\">\n <div [class]=\"trackLineClass()\" [style]=\"trackInnerStyles()\"></div>\n</div>\n" }]
572
- }], ctorParameters: () => [], propDecorators: { indicatorTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StepperIndicatorTemplateDirective), { ...{
573
- read: TemplateRef
574
- }, isSignal: true }] }], labelTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StepperLabelTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], stepButtons: [{ type: i0.ViewChildren, args: ["stepButton", { isSignal: true }] }], stepTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StepperStepTemplateDirective), { ...{
575
- read: TemplateRef
576
- }, isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], linear: [{ type: i0.Input, args: [{ isSignal: true, alias: "linear", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], progressAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "progressAriaLabel", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }, { type: i0.Output, args: ["stepChange"] }], stepSelect: [{ type: i0.Output, args: ["stepSelect"] }], steps: [{ type: i0.Input, args: [{ isSignal: true, alias: "steps", required: false }] }] } });
577
-
578
- /*
579
- * Public API Surface of @nanahoshi/mona-ui/stepper
580
- */
581
-
582
- /**
583
- * Generated bundle index. Do not edit.
584
- */
585
-
328
+ var StepperComponent = class StepperComponent {
329
+ #adjacentEnabledSteps;
330
+ #direction;
331
+ #i18n;
332
+ #id;
333
+ #trackItemSize;
334
+ #trackLength;
335
+ constructor() {
336
+ this.#adjacentEnabledSteps = computed(() => {
337
+ const active = this.activeStep();
338
+ const enabled = this.viewSteps().toArray().filter((step) => !step.options.disabled);
339
+ if (!active) return {
340
+ next: void 0,
341
+ previous: void 0
342
+ };
343
+ return {
344
+ next: enabled.find((step) => step.index > active.index),
345
+ previous: enabled.filter((step) => step.index < active.index).pop()
346
+ };
347
+ }, ...ngDevMode ? [{ debugName: "#adjacentEnabledSteps" }] : /* istanbul ignore next */ []);
348
+ this.#direction = injectComponentDirection();
349
+ this.#i18n = inject(MonaI18nService);
350
+ this.#id = createElementControlId();
351
+ this.#trackItemSize = computed(() => {
352
+ const stepCount = this.viewSteps().length;
353
+ return stepCount !== 0 ? 100 / stepCount : 0;
354
+ }, ...ngDevMode ? [{ debugName: "#trackItemSize" }] : /* istanbul ignore next */ []);
355
+ this.#trackLength = computed(() => {
356
+ const step = this.activeStep();
357
+ const stepCount = this.viewSteps().length;
358
+ return step && stepCount > 1 ? `${100 / (stepCount - 1) * step.index}%` : "0%";
359
+ }, ...ngDevMode ? [{ debugName: "#trackLength" }] : /* istanbul ignore next */ []);
360
+ this.activeStep = computed(() => {
361
+ const steps = this.viewSteps();
362
+ if (steps.length === 0) return;
363
+ return steps.elementAt(this.normalizeIndex(this.step(), steps.length));
364
+ }, ...ngDevMode ? [{ debugName: "activeStep" }] : /* istanbul ignore next */ []);
365
+ this.baseClass = computed(() => {
366
+ const orientation = this.orientation();
367
+ return stepperBaseThemeVariants({ orientation });
368
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
369
+ this.highlightedStep = signal(0, ...ngDevMode ? [{ debugName: "highlightedStep" }] : /* istanbul ignore next */ []);
370
+ this.hostStyles = computed(() => {
371
+ const orientation = this.orientation();
372
+ const stepCount = this.viewSteps().length;
373
+ return {
374
+ gridTemplateColumns: orientation === "horizontal" ? `repeat(${stepCount * 2}, 1fr)` : void 0,
375
+ gridTemplateRows: orientation === "vertical" ? `repeat(${stepCount * 2}, 1fr)` : void 0
376
+ };
377
+ }, ...ngDevMode ? [{ debugName: "hostStyles" }] : /* istanbul ignore next */ []);
378
+ this.indicatorTemplate = contentChild(StepperIndicatorTemplateDirective, { read: TemplateRef });
379
+ this.isRtl = computed(() => this.#direction() === "rtl", ...ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []);
380
+ this.labelTemplate = contentChild(StepperLabelTemplateDirective, { read: TemplateRef });
381
+ this.listClass = computed(() => {
382
+ const orientation = this.orientation();
383
+ return stepperStepListThemeVariants({ orientation });
384
+ }, ...ngDevMode ? [{ debugName: "listClass" }] : /* istanbul ignore next */ []);
385
+ this.listItemClass = computed(() => {
386
+ const orientation = this.orientation();
387
+ return stepperStepListItemThemeVariants({ orientation });
388
+ }, ...ngDevMode ? [{ debugName: "listItemClass" }] : /* istanbul ignore next */ []);
389
+ this.messages = this.#i18n.componentMessages("stepper", STEPPER_DEFAULT_MESSAGES);
390
+ this.progressMax = computed(() => Math.max(this.viewSteps().length - 1, 0), ...ngDevMode ? [{ debugName: "progressMax" }] : /* istanbul ignore next */ []);
391
+ this.progressText = computed(() => {
392
+ const active = this.activeStep();
393
+ return active ? this.positionText(active.index + 1) : null;
394
+ }, ...ngDevMode ? [{ debugName: "progressText" }] : /* istanbul ignore next */ []);
395
+ this.stepButtonClass = computed(() => {
396
+ return stepperStepButtonThemeVariants();
397
+ }, ...ngDevMode ? [{ debugName: "stepButtonClass" }] : /* istanbul ignore next */ []);
398
+ this.stepButtons = viewChildren("stepButton", ...ngDevMode ? [{ debugName: "stepButtons" }] : /* istanbul ignore next */ []);
399
+ this.stepTemplate = contentChild(StepperStepTemplateDirective, { read: TemplateRef });
400
+ this.trackClass = computed(() => {
401
+ const orientation = this.orientation();
402
+ return stepperTrackThemeVariants({ orientation });
403
+ }, ...ngDevMode ? [{ debugName: "trackClass" }] : /* istanbul ignore next */ []);
404
+ this.trackInnerStyles = computed(() => {
405
+ const orientation = this.orientation();
406
+ const length = this.#trackLength();
407
+ return { [orientation === "horizontal" ? "width" : "height"]: length };
408
+ }, ...ngDevMode ? [{ debugName: "trackInnerStyles" }] : /* istanbul ignore next */ []);
409
+ this.trackItemStyles = computed(() => {
410
+ const orientation = this.orientation();
411
+ const itemSize = this.#trackItemSize();
412
+ return { [orientation === "horizontal" ? "maxWidth" : "maxHeight"]: `${itemSize}%` };
413
+ }, ...ngDevMode ? [{ debugName: "trackItemStyles" }] : /* istanbul ignore next */ []);
414
+ this.trackLineClass = computed(() => {
415
+ const orientation = this.orientation();
416
+ return stepperTrackLineThemeVariants({ orientation });
417
+ }, ...ngDevMode ? [{ debugName: "trackLineClass" }] : /* istanbul ignore next */ []);
418
+ this.trackStyles = computed(() => {
419
+ const edge = `${this.#trackItemSize() / 2}%`;
420
+ return this.orientation() === "horizontal" ? {
421
+ insetInlineEnd: edge,
422
+ insetInlineStart: edge,
423
+ top: "0.75rem"
424
+ } : {
425
+ bottom: edge,
426
+ insetInlineStart: "0.75rem",
427
+ top: edge
428
+ };
429
+ }, ...ngDevMode ? [{ debugName: "trackStyles" }] : /* istanbul ignore next */ []);
430
+ this.viewSteps = computed(() => {
431
+ const steps = this.steps();
432
+ return select(steps, (step, index) => ({
433
+ options: step,
434
+ index
435
+ })).toImmutableSet();
436
+ }, ...ngDevMode ? [{ debugName: "viewSteps" }] : /* istanbul ignore next */ []);
437
+ this.ariaLabel = input("", {
438
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
439
+ alias: "aria-label"
440
+ });
441
+ this.linear = input(true, {
442
+ ...ngDevMode ? { debugName: "linear" } : /* istanbul ignore next */ {},
443
+ transform: booleanAttribute
444
+ });
445
+ this.orientation = input("horizontal", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
446
+ this.progressAriaLabel = input("", ...ngDevMode ? [{ debugName: "progressAriaLabel" }] : /* istanbul ignore next */ []);
447
+ this.rounded = input("full", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
448
+ this.step = model(0, ...ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []);
449
+ this.stepSelect = output();
450
+ this.steps = input([], ...ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []);
451
+ effect(() => {
452
+ const requested = this.step();
453
+ const stepCount = this.viewSteps().length;
454
+ if (stepCount === 0) return;
455
+ const index = this.normalizeIndex(requested, stepCount);
456
+ if (index !== requested) this.step.set(index);
457
+ this.highlightedStep.set(index);
458
+ });
459
+ }
460
+ descriptionId(step) {
461
+ return `${this.#id}-${step.index}-description`;
462
+ }
463
+ formatStepNumber(value) {
464
+ if (value == null) return "";
465
+ return formatNumber(value, this.#i18n.localeId(), {
466
+ maximumFractionDigits: 0,
467
+ useGrouping: false
468
+ });
469
+ }
470
+ isStepActive(step) {
471
+ const active = this.activeStep();
472
+ return active != null && step.index <= active.index;
473
+ }
474
+ isStepLocked(step) {
475
+ if (step.options.disabled) return true;
476
+ if (!this.linear()) return false;
477
+ const active = this.activeStep();
478
+ if (!active || step.index === active.index) return false;
479
+ const { next, previous } = this.#adjacentEnabledSteps();
480
+ return step.index !== next?.index && step.index !== previous?.index;
481
+ }
482
+ labelClass(state) {
483
+ return stepperStepLabelThemeVariants({ state });
484
+ }
485
+ onIndicatorFocus(step) {
486
+ this.highlightedStep.set(step.index);
487
+ }
488
+ onKeydown(event) {
489
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
490
+ if (!this.stepButtons().some((button) => button.nativeElement === event.target)) return;
491
+ const orientation = this.orientation();
492
+ const isRtl = this.isRtl();
493
+ let previousKey = orientation === "vertical" ? "ArrowUp" : "ArrowLeft";
494
+ let nextKey = orientation === "vertical" ? "ArrowDown" : "ArrowRight";
495
+ if (orientation === "horizontal" && isRtl) {
496
+ previousKey = "ArrowRight";
497
+ nextKey = "ArrowLeft";
498
+ }
499
+ const reachable = this.viewSteps().toArray().filter((step) => !this.isStepLocked(step));
500
+ const current = this.highlightedStep();
501
+ let target;
502
+ if (event.key === previousKey) target = reachable.filter((step) => step.index < current).pop();
503
+ else if (event.key === nextKey) target = reachable.find((step) => step.index > current);
504
+ else if (event.key === "Home") target = reachable[0];
505
+ else if (event.key === "End") target = reachable[reachable.length - 1];
506
+ else return;
507
+ event.preventDefault();
508
+ if (target) {
509
+ this.highlightedStep.set(target.index);
510
+ this.stepButtons()[target.index]?.nativeElement.focus();
511
+ }
512
+ }
513
+ onStepClick(step, event) {
514
+ const control = event.target.closest(PROJECTED_CONTROL_SELECTOR);
515
+ if (control && !this.stepButtons().some((button) => button.nativeElement === control)) return;
516
+ this.setActiveStep(step, event);
517
+ }
518
+ positionText(position) {
519
+ return this.messages().stepPosition(position, this.viewSteps().length);
520
+ }
521
+ stepState(step) {
522
+ const active = this.activeStep();
523
+ if (step.index === active?.index) return "current";
524
+ if (step.options.disabled) return "disabled";
525
+ return step.options.completed ?? (active != null && step.index < active.index) ? "completed" : "upcoming";
526
+ }
527
+ normalizeIndex(value, stepCount) {
528
+ return Number.isFinite(value) ? Math.min(Math.max(Math.trunc(value), 0), stepCount - 1) : 0;
529
+ }
530
+ setActiveStep(step, event) {
531
+ const active = this.activeStep();
532
+ if (this.isStepLocked(step) || step.index === active?.index) return;
533
+ const selectEvent = new StepSelectEvent(step.index, active?.index ?? 0, step.options, event);
534
+ this.stepSelect.emit(selectEvent);
535
+ if (selectEvent.isDefaultPrevented()) return;
536
+ this.step.set(step.index);
537
+ this.highlightedStep.set(step.index);
538
+ }
539
+ static {
540
+ this.ɵfac = i0.ɵɵngDeclareFactory({
541
+ minVersion: "12.0.0",
542
+ version: "22.2.6",
543
+ ngImport: i0,
544
+ type: StepperComponent,
545
+ deps: [],
546
+ target: i0.ɵɵFactoryTarget.Component
547
+ });
548
+ }
549
+ static {
550
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
551
+ minVersion: "17.0.0",
552
+ version: "22.2.6",
553
+ type: StepperComponent,
554
+ isStandalone: true,
555
+ selector: "mona-stepper",
556
+ inputs: {
557
+ ariaLabel: {
558
+ classPropertyName: "ariaLabel",
559
+ publicName: "aria-label",
560
+ isSignal: true,
561
+ isRequired: false,
562
+ transformFunction: null
563
+ },
564
+ linear: {
565
+ classPropertyName: "linear",
566
+ publicName: "linear",
567
+ isSignal: true,
568
+ isRequired: false,
569
+ transformFunction: null
570
+ },
571
+ orientation: {
572
+ classPropertyName: "orientation",
573
+ publicName: "orientation",
574
+ isSignal: true,
575
+ isRequired: false,
576
+ transformFunction: null
577
+ },
578
+ progressAriaLabel: {
579
+ classPropertyName: "progressAriaLabel",
580
+ publicName: "progressAriaLabel",
581
+ isSignal: true,
582
+ isRequired: false,
583
+ transformFunction: null
584
+ },
585
+ rounded: {
586
+ classPropertyName: "rounded",
587
+ publicName: "rounded",
588
+ isSignal: true,
589
+ isRequired: false,
590
+ transformFunction: null
591
+ },
592
+ step: {
593
+ classPropertyName: "step",
594
+ publicName: "step",
595
+ isSignal: true,
596
+ isRequired: false,
597
+ transformFunction: null
598
+ },
599
+ steps: {
600
+ classPropertyName: "steps",
601
+ publicName: "steps",
602
+ isSignal: true,
603
+ isRequired: false,
604
+ transformFunction: null
605
+ }
606
+ },
607
+ outputs: {
608
+ step: "stepChange",
609
+ stepSelect: "stepSelect"
610
+ },
611
+ host: {
612
+ attributes: { "role": "group" },
613
+ listeners: { "keydown": "onKeydown($event)" },
614
+ properties: {
615
+ "attr.aria-label": "ariaLabel() || messages().stepper",
616
+ "class": "baseClass()",
617
+ "style": "hostStyles()"
618
+ }
619
+ },
620
+ queries: [
621
+ {
622
+ propertyName: "indicatorTemplate",
623
+ first: true,
624
+ predicate: StepperIndicatorTemplateDirective,
625
+ descendants: true,
626
+ read: TemplateRef,
627
+ isSignal: true
628
+ },
629
+ {
630
+ propertyName: "labelTemplate",
631
+ first: true,
632
+ predicate: StepperLabelTemplateDirective,
633
+ descendants: true,
634
+ read: TemplateRef,
635
+ isSignal: true
636
+ },
637
+ {
638
+ propertyName: "stepTemplate",
639
+ first: true,
640
+ predicate: StepperStepTemplateDirective,
641
+ descendants: true,
642
+ read: TemplateRef,
643
+ isSignal: true
644
+ }
645
+ ],
646
+ viewQueries: [{
647
+ propertyName: "stepButtons",
648
+ predicate: ["stepButton"],
649
+ descendants: true,
650
+ isSignal: true
651
+ }],
652
+ ngImport: i0,
653
+ template: "<ol role=\"list\" [class]=\"listClass()\">\n @for (step of viewSteps(); track step.index) {\n @let active = isStepActive(step);\n @let locked = isStepLocked(step);\n @let state = stepState(step);\n @let invalid = !!step.options.invalid;\n @let options = step.options;\n @let index = step.index;\n @let currentIndex = activeStep()?.index ?? -1;\n @let disabled = !!options.disabled;\n @let focusable = step.index === highlightedStep();\n <li\n [class]=\"listItemClass()\"\n [class.cursor-pointer]=\"!locked\"\n [class.cursor-not-allowed]=\"locked\"\n [style]=\"trackItemStyles()\"\n (click)=\"onStepClick(step, $event)\">\n @if (stepTemplate()) {\n <button\n #stepButton\n type=\"button\"\n [class]=\"stepButtonClass()\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n <ng-container\n [ngTemplateOutlet]=\"stepTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n </button>\n } @else {\n <button\n #stepButton\n monaStepperIndicator\n type=\"button\"\n [invalid]=\"invalid\"\n [rounded]=\"rounded()\"\n [state]=\"state\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n @if (indicatorTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"indicatorTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else if (invalid) {\n <svg lucideCircleAlert [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else if (state === \"completed\") {\n <svg lucideCheck [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else {\n {{ formatStepNumber(step.index + 1) }}\n }\n </button>\n }\n @if (labelTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else {\n <span [class]=\"labelClass(state)\" aria-hidden=\"true\">{{ options.label }}</span>\n }\n </li>\n }\n</ol>\n<!-- Read through aria-describedby, which also works on hidden text. Nothing here is shown or read twice. -->\n<div hidden>\n @for (step of viewSteps(); track step.index) {\n <span [id]=\"descriptionId(step)\">\n <span>{{ positionText(step.index + 1) }}</span>\n @if (stepState(step) === \"completed\") {\n <span> {{ messages().stepCompleted }}</span>\n }\n @if (step.options.invalid) {\n <span> {{ messages().stepInvalid }}</span>\n }\n </span>\n }\n</div>\n<div\n [class]=\"trackClass()\"\n [style]=\"trackStyles()\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"activeStep()?.index ?? 0\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"progressMax()\"\n [attr.aria-valuetext]=\"progressText()\"\n [attr.aria-label]=\"progressAriaLabel() || messages().stepProgress\">\n <div [class]=\"trackLineClass()\" [style]=\"trackInnerStyles()\"></div>\n</div>\n",
654
+ dependencies: [
655
+ {
656
+ kind: "directive",
657
+ type: NgTemplateOutlet,
658
+ selector: "[ngTemplateOutlet]",
659
+ inputs: [
660
+ "ngTemplateOutletContext",
661
+ "ngTemplateOutlet",
662
+ "ngTemplateOutletInjector"
663
+ ]
664
+ },
665
+ {
666
+ kind: "directive",
667
+ type: StepperIndicatorDirective,
668
+ selector: "button[monaStepperIndicator]",
669
+ inputs: [
670
+ "invalid",
671
+ "rounded",
672
+ "state"
673
+ ]
674
+ },
675
+ {
676
+ kind: "component",
677
+ type: LucideCheck,
678
+ selector: "svg[lucideCheck]"
679
+ },
680
+ {
681
+ kind: "component",
682
+ type: LucideCircleAlert,
683
+ selector: "svg[lucideCircleExclamationPoint], svg[lucideAlertCircle], svg[lucideCircleAlert]"
684
+ }
685
+ ]
686
+ });
687
+ }
688
+ };
689
+ i0.ɵɵngDeclareClassMetadata({
690
+ minVersion: "12.0.0",
691
+ version: "22.2.6",
692
+ ngImport: i0,
693
+ type: StepperComponent,
694
+ decorators: [{
695
+ type: Component,
696
+ args: [{
697
+ selector: "mona-stepper",
698
+ imports: [
699
+ NgTemplateOutlet,
700
+ StepperIndicatorDirective,
701
+ LucideCheck,
702
+ LucideCircleAlert
703
+ ],
704
+ host: {
705
+ role: "group",
706
+ "[attr.aria-label]": "ariaLabel() || messages().stepper",
707
+ "[class]": "baseClass()",
708
+ "[style]": "hostStyles()",
709
+ "(keydown)": "onKeydown($event)"
710
+ },
711
+ template: "<ol role=\"list\" [class]=\"listClass()\">\n @for (step of viewSteps(); track step.index) {\n @let active = isStepActive(step);\n @let locked = isStepLocked(step);\n @let state = stepState(step);\n @let invalid = !!step.options.invalid;\n @let options = step.options;\n @let index = step.index;\n @let currentIndex = activeStep()?.index ?? -1;\n @let disabled = !!options.disabled;\n @let focusable = step.index === highlightedStep();\n <li\n [class]=\"listItemClass()\"\n [class.cursor-pointer]=\"!locked\"\n [class.cursor-not-allowed]=\"locked\"\n [style]=\"trackItemStyles()\"\n (click)=\"onStepClick(step, $event)\">\n @if (stepTemplate()) {\n <button\n #stepButton\n type=\"button\"\n [class]=\"stepButtonClass()\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n <ng-container\n [ngTemplateOutlet]=\"stepTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n </button>\n } @else {\n <button\n #stepButton\n monaStepperIndicator\n type=\"button\"\n [invalid]=\"invalid\"\n [rounded]=\"rounded()\"\n [state]=\"state\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n @if (indicatorTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"indicatorTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else if (invalid) {\n <svg lucideCircleAlert [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else if (state === \"completed\") {\n <svg lucideCheck [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else {\n {{ formatStepNumber(step.index + 1) }}\n }\n </button>\n }\n @if (labelTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else {\n <span [class]=\"labelClass(state)\" aria-hidden=\"true\">{{ options.label }}</span>\n }\n </li>\n }\n</ol>\n<!-- Read through aria-describedby, which also works on hidden text. Nothing here is shown or read twice. -->\n<div hidden>\n @for (step of viewSteps(); track step.index) {\n <span [id]=\"descriptionId(step)\">\n <span>{{ positionText(step.index + 1) }}</span>\n @if (stepState(step) === \"completed\") {\n <span> {{ messages().stepCompleted }}</span>\n }\n @if (step.options.invalid) {\n <span> {{ messages().stepInvalid }}</span>\n }\n </span>\n }\n</div>\n<div\n [class]=\"trackClass()\"\n [style]=\"trackStyles()\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"activeStep()?.index ?? 0\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"progressMax()\"\n [attr.aria-valuetext]=\"progressText()\"\n [attr.aria-label]=\"progressAriaLabel() || messages().stepProgress\">\n <div [class]=\"trackLineClass()\" [style]=\"trackInnerStyles()\"></div>\n</div>\n"
712
+ }]
713
+ }],
714
+ ctorParameters: () => [],
715
+ propDecorators: {
716
+ indicatorTemplate: [{
717
+ type: i0.ContentChild,
718
+ args: [i0.forwardRef(() => StepperIndicatorTemplateDirective), {
719
+ read: TemplateRef,
720
+ isSignal: true
721
+ }]
722
+ }],
723
+ labelTemplate: [{
724
+ type: i0.ContentChild,
725
+ args: [i0.forwardRef(() => StepperLabelTemplateDirective), {
726
+ read: TemplateRef,
727
+ isSignal: true
728
+ }]
729
+ }],
730
+ stepButtons: [{
731
+ type: i0.ViewChildren,
732
+ args: ["stepButton", { isSignal: true }]
733
+ }],
734
+ stepTemplate: [{
735
+ type: i0.ContentChild,
736
+ args: [i0.forwardRef(() => StepperStepTemplateDirective), {
737
+ read: TemplateRef,
738
+ isSignal: true
739
+ }]
740
+ }],
741
+ ariaLabel: [{
742
+ type: i0.Input,
743
+ args: [{
744
+ isSignal: true,
745
+ alias: "aria-label",
746
+ required: false
747
+ }]
748
+ }],
749
+ linear: [{
750
+ type: i0.Input,
751
+ args: [{
752
+ isSignal: true,
753
+ alias: "linear",
754
+ required: false
755
+ }]
756
+ }],
757
+ orientation: [{
758
+ type: i0.Input,
759
+ args: [{
760
+ isSignal: true,
761
+ alias: "orientation",
762
+ required: false
763
+ }]
764
+ }],
765
+ progressAriaLabel: [{
766
+ type: i0.Input,
767
+ args: [{
768
+ isSignal: true,
769
+ alias: "progressAriaLabel",
770
+ required: false
771
+ }]
772
+ }],
773
+ rounded: [{
774
+ type: i0.Input,
775
+ args: [{
776
+ isSignal: true,
777
+ alias: "rounded",
778
+ required: false
779
+ }]
780
+ }],
781
+ step: [{
782
+ type: i0.Input,
783
+ args: [{
784
+ isSignal: true,
785
+ alias: "step",
786
+ required: false
787
+ }]
788
+ }, {
789
+ type: i0.Output,
790
+ args: ["stepChange"]
791
+ }],
792
+ stepSelect: [{
793
+ type: i0.Output,
794
+ args: ["stepSelect"]
795
+ }],
796
+ steps: [{
797
+ type: i0.Input,
798
+ args: [{
799
+ isSignal: true,
800
+ alias: "steps",
801
+ required: false
802
+ }]
803
+ }]
804
+ }
805
+ });
586
806
  export { STEPPER_DEFAULT_MESSAGES, StepSelectEvent, StepperComponent, StepperIndicatorTemplateDirective, StepperLabelTemplateDirective, StepperStepTemplateDirective };
587
- //# sourceMappingURL=nanahoshi-mona-ui-stepper.mjs.map
807
+
808
+ //# sourceMappingURL=nanahoshi-mona-ui-stepper.mjs.map