@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,34 +1,67 @@
1
- import { NgTemplateOutlet } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { input, inject, TemplateRef, Directive, DestroyRef, ElementRef, computed, signal, contentChild, viewChildren, booleanAttribute, output, model, afterNextRender, isDevMode, afterRenderEffect, Component } from '@angular/core';
4
- import { injectComponentDirection } from '@nanahoshi/mona-ui/i18n';
5
- import { themeControlSurfaceClasses, injectLabelAssociation, injectEffectiveDisabled, createElementControlId } from '@nanahoshi/mona-ui/internal';
6
- import { twMerge } from 'tailwind-merge';
7
- import { cva } from 'class-variance-authority';
8
-
9
- /**
10
- * @description Renders the visual content of every segmented option. Overrides the default label
11
- * text of each option. Bind the options, as `[monaSegmentedItemTemplate]="options"`, to type `let-option` from them.
12
- */
13
- class SegmentedItemTemplateDirective {
14
- constructor() {
15
- /** @description The options, to type `let-option` from them. It changes nothing else. */
16
- this.options = input(undefined, { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaSegmentedItemTemplate" });
17
- this.templateRef = inject(TemplateRef);
18
- }
19
- static ngTemplateContextGuard(_directive, _context) {
20
- return true;
21
- }
22
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SegmentedItemTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
23
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: SegmentedItemTemplateDirective, isStandalone: true, selector: "ng-template[monaSegmentedItemTemplate]", inputs: { options: { classPropertyName: "options", publicName: "monaSegmentedItemTemplate", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
24
- }
25
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SegmentedItemTemplateDirective, decorators: [{
26
- type: Directive,
27
- args: [{
28
- selector: "ng-template[monaSegmentedItemTemplate]"
29
- }]
30
- }], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaSegmentedItemTemplate", required: false }] }] } });
31
-
1
+ import { NgTemplateOutlet } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { Component, DestroyRef, Directive, ElementRef, TemplateRef, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, inject, input, isDevMode, model, output, signal, viewChildren } from "@angular/core";
4
+ import { injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
5
+ import { createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
6
+ import { twMerge } from "tailwind-merge";
7
+ import { cva } from "class-variance-authority";
8
+ var SegmentedItemTemplateDirective = class SegmentedItemTemplateDirective {
9
+ constructor() {
10
+ this.options = input(void 0, {
11
+ ...ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {},
12
+ alias: "monaSegmentedItemTemplate"
13
+ });
14
+ this.templateRef = inject(TemplateRef);
15
+ }
16
+ static ngTemplateContextGuard(_directive, _context) {
17
+ return true;
18
+ }
19
+ static {
20
+ this.ɵfac = i0.ɵɵngDeclareFactory({
21
+ minVersion: "12.0.0",
22
+ version: "22.2.6",
23
+ ngImport: i0,
24
+ type: SegmentedItemTemplateDirective,
25
+ deps: [],
26
+ target: i0.ɵɵFactoryTarget.Directive
27
+ });
28
+ }
29
+ static {
30
+ this.ɵdir = i0.ɵɵngDeclareDirective({
31
+ minVersion: "17.1.0",
32
+ version: "22.2.6",
33
+ type: SegmentedItemTemplateDirective,
34
+ isStandalone: true,
35
+ selector: "ng-template[monaSegmentedItemTemplate]",
36
+ inputs: { options: {
37
+ classPropertyName: "options",
38
+ publicName: "monaSegmentedItemTemplate",
39
+ isSignal: true,
40
+ isRequired: false,
41
+ transformFunction: null
42
+ } },
43
+ ngImport: i0
44
+ });
45
+ }
46
+ };
47
+ i0.ɵɵngDeclareClassMetadata({
48
+ minVersion: "12.0.0",
49
+ version: "22.2.6",
50
+ ngImport: i0,
51
+ type: SegmentedItemTemplateDirective,
52
+ decorators: [{
53
+ type: Directive,
54
+ args: [{ selector: "ng-template[monaSegmentedItemTemplate]" }]
55
+ }],
56
+ propDecorators: { options: [{
57
+ type: i0.Input,
58
+ args: [{
59
+ isSignal: true,
60
+ alias: "monaSegmentedItemTemplate",
61
+ required: false
62
+ }]
63
+ }] }
64
+ });
32
65
  const segmentedContainerThemeVariants = cva(`
33
66
  relative inline-flex items-center gap-0.5
34
67
  ${themeControlSurfaceClasses}
@@ -39,25 +72,25 @@ const segmentedContainerThemeVariants = cva(`
39
72
  data-[readonly='true']:[&_*]:cursor-default
40
73
  transition-colors duration-(--mona-motion-fast)
41
74
  `, {
42
- variants: {
43
- alignment: {
44
- start: "justify-start",
45
- center: "justify-center",
46
- end: "justify-end",
47
- stretch: "justify-stretch"
48
- },
49
- rounded: {
50
- none: "rounded-none",
51
- small: "rounded-sm",
52
- medium: "rounded-md",
53
- large: "rounded-lg",
54
- full: "rounded-full"
55
- }
56
- },
57
- defaultVariants: {
58
- alignment: "stretch",
59
- rounded: "medium"
60
- }
75
+ variants: {
76
+ alignment: {
77
+ start: "justify-start",
78
+ center: "justify-center",
79
+ end: "justify-end",
80
+ stretch: "justify-stretch"
81
+ },
82
+ rounded: {
83
+ none: "rounded-none",
84
+ small: "rounded-sm",
85
+ medium: "rounded-md",
86
+ large: "rounded-lg",
87
+ full: "rounded-full"
88
+ }
89
+ },
90
+ defaultVariants: {
91
+ alignment: "stretch",
92
+ rounded: "medium"
93
+ }
61
94
  });
62
95
  const segmentedOptionThemeVariants = cva(`
63
96
  relative flex cursor-pointer items-center justify-center gap-1
@@ -78,31 +111,31 @@ const segmentedOptionThemeVariants = cva(`
78
111
  has-[input:focus-visible]:outline-offset-1
79
112
  has-[input:focus-visible]:outline-focus-indicator
80
113
  `, {
81
- variants: {
82
- alignment: {
83
- start: "flex-none",
84
- center: "flex-none",
85
- end: "flex-none",
86
- stretch: "flex-1"
87
- },
88
- rounded: {
89
- none: "rounded-none",
90
- small: "rounded-xs",
91
- medium: "rounded-sm",
92
- large: "rounded-md",
93
- full: "rounded-full"
94
- },
95
- size: {
96
- small: "h-6 px-1.5 text-sm",
97
- medium: "h-8 px-2.5 text-sm",
98
- large: "h-10 px-3.5 text-base"
99
- }
100
- },
101
- defaultVariants: {
102
- alignment: "stretch",
103
- rounded: "medium",
104
- size: "medium"
105
- }
114
+ variants: {
115
+ alignment: {
116
+ start: "flex-none",
117
+ center: "flex-none",
118
+ end: "flex-none",
119
+ stretch: "flex-1"
120
+ },
121
+ rounded: {
122
+ none: "rounded-none",
123
+ small: "rounded-xs",
124
+ medium: "rounded-sm",
125
+ large: "rounded-md",
126
+ full: "rounded-full"
127
+ },
128
+ size: {
129
+ small: "h-6 px-1.5 text-sm",
130
+ medium: "h-8 px-2.5 text-sm",
131
+ large: "h-10 px-3.5 text-base"
132
+ }
133
+ },
134
+ defaultVariants: {
135
+ alignment: "stretch",
136
+ rounded: "medium",
137
+ size: "medium"
138
+ }
106
139
  });
107
140
  const segmentedIndicatorThemeVariants = cva(`
108
141
  pointer-events-none absolute top-0 left-0
@@ -111,23 +144,23 @@ const segmentedIndicatorThemeVariants = cva(`
111
144
  data-[disabled='true']:opacity-50
112
145
  motion-reduce:transition-none
113
146
  `, {
114
- variants: {
115
- animate: {
116
- true: "transition-[transform,width,height] duration-(--mona-motion-fast) ease-out",
117
- false: "transition-none"
118
- },
119
- rounded: {
120
- none: "rounded-none",
121
- small: "rounded-xs",
122
- medium: "rounded-sm",
123
- large: "rounded-md",
124
- full: "rounded-full"
125
- }
126
- },
127
- defaultVariants: {
128
- animate: true,
129
- rounded: "medium"
130
- }
147
+ variants: {
148
+ animate: {
149
+ true: "transition-[transform,width,height] duration-(--mona-motion-fast) ease-out",
150
+ false: "transition-none"
151
+ },
152
+ rounded: {
153
+ none: "rounded-none",
154
+ small: "rounded-xs",
155
+ medium: "rounded-sm",
156
+ large: "rounded-md",
157
+ full: "rounded-full"
158
+ }
159
+ },
160
+ defaultVariants: {
161
+ animate: true,
162
+ rounded: "medium"
163
+ }
131
164
  });
132
165
  const segmentedInputThemeVariants = cva(`
133
166
  peer absolute inset-0 z-10 h-full w-full
@@ -135,367 +168,584 @@ const segmentedInputThemeVariants = cva(`
135
168
  outline-none focus-visible:outline-hidden
136
169
  disabled:cursor-not-allowed
137
170
  `);
138
-
139
- class SegmentedComponent {
140
- #destroyRef;
141
- #direction;
142
- #hostElementRef;
143
- #label;
144
- #lastAnimatedIndex;
145
- #lastOptions;
146
- #lastSize;
147
- #observedOptionElements;
148
- #resizeObserver;
149
- constructor() {
150
- this.#destroyRef = inject(DestroyRef);
151
- this.#direction = injectComponentDirection();
152
- this.#hostElementRef = inject(ElementRef);
153
- this.#label = injectLabelAssociation({
154
- activate: () => this.focus(),
155
- ariaLabel: () => this.ariaLabel(),
156
- ariaLabelledBy: () => this.ariaLabelledBy()
157
- });
158
- this.#lastAnimatedIndex = null;
159
- this.#lastOptions = null;
160
- this.#lastSize = null;
161
- this.#observedOptionElements = [];
162
- this.#resizeObserver = null;
163
- this.containerClasses = computed(() => {
164
- const classes = segmentedContainerThemeVariants({ alignment: this.alignment(), rounded: this.rounded() });
165
- return twMerge(classes, this.userClass());
166
- }, /* @ts-ignore */
167
- ...(ngDevMode ? [{ debugName: "containerClasses" }] : /* istanbul ignore next */ []));
168
- this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
169
- this.geometryReady = computed(() => !!this.indicatorGeometry(), /* @ts-ignore */
170
- ...(ngDevMode ? [{ debugName: "geometryReady" }] : /* istanbul ignore next */ []));
171
- this.groupName = createElementControlId();
172
- this.indicatorClasses = computed(() => {
173
- const animate = this.animate() && this.indicatorTransitionEnabled();
174
- const rounded = this.rounded();
175
- return segmentedIndicatorThemeVariants({ animate, rounded });
176
- }, /* @ts-ignore */
177
- ...(ngDevMode ? [{ debugName: "indicatorClasses" }] : /* istanbul ignore next */ []));
178
- this.indicatorGeometry = signal(null, /* @ts-ignore */
179
- ...(ngDevMode ? [{ debugName: "indicatorGeometry" }] : /* istanbul ignore next */ []));
180
- this.indicatorInitialized = signal(false, /* @ts-ignore */
181
- ...(ngDevMode ? [{ debugName: "indicatorInitialized" }] : /* istanbul ignore next */ []));
182
- this.indicatorTransitionEnabled = signal(false, /* @ts-ignore */
183
- ...(ngDevMode ? [{ debugName: "indicatorTransitionEnabled" }] : /* istanbul ignore next */ []));
184
- this.inputClasses = computed(() => segmentedInputThemeVariants(), /* @ts-ignore */
185
- ...(ngDevMode ? [{ debugName: "inputClasses" }] : /* istanbul ignore next */ []));
186
- this.invalidState = computed(() => this.touched() && this.invalid(), /* @ts-ignore */
187
- ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
188
- this.itemTemplate = contentChild(SegmentedItemTemplateDirective, { ...(ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
189
- this.labelledBy = this.#label.labelledBy;
190
- this.optionClasses = computed(() => {
191
- const alignment = this.alignment();
192
- const rounded = this.rounded();
193
- const size = this.size();
194
- return segmentedOptionThemeVariants({ alignment, rounded, size });
195
- }, /* @ts-ignore */
196
- ...(ngDevMode ? [{ debugName: "optionClasses" }] : /* istanbul ignore next */ []));
197
- this.optionContexts = computed(() => {
198
- const disabled = this.effectiveDisabled();
199
- const value = this.value();
200
- return this.options().map((option, index) => ({
201
- $implicit: option,
202
- disabled: disabled || !!option.disabled,
203
- index,
204
- option,
205
- selected: option.value === value
206
- }));
207
- }, /* @ts-ignore */
208
- ...(ngDevMode ? [{ debugName: "optionContexts" }] : /* istanbul ignore next */ []));
209
- this.optionElements = viewChildren("optionElement", /* @ts-ignore */
210
- ...(ngDevMode ? [{ debugName: "optionElements" }] : /* istanbul ignore next */ []));
211
- this.radioInputs = viewChildren("radioInput", /* @ts-ignore */
212
- ...(ngDevMode ? [{ debugName: "radioInputs" }] : /* istanbul ignore next */ []));
213
- this.selectedIndex = computed(() => {
214
- const value = this.value();
215
- return this.options().findIndex(option => option.value === value);
216
- }, /* @ts-ignore */
217
- ...(ngDevMode ? [{ debugName: "selectedIndex" }] : /* istanbul ignore next */ []));
218
- this.selectedOptionDisabled = computed(() => {
219
- const selectedIndex = this.selectedIndex();
220
- if (selectedIndex === -1) {
221
- return false;
222
- }
223
- const option = this.options()[selectedIndex];
224
- return this.effectiveDisabled() || !!option?.disabled;
225
- }, /* @ts-ignore */
226
- ...(ngDevMode ? [{ debugName: "selectedOptionDisabled" }] : /* istanbul ignore next */ []));
227
- /**
228
- * @description Controls the alignment of the items inside the segmented component.
229
- * @default "stretch"
230
- */
231
- this.alignment = input("stretch", /* @ts-ignore */
232
- ...(ngDevMode ? [{ debugName: "alignment" }] : /* istanbul ignore next */ []));
233
- /**
234
- * @description Controls whether the selection indicator animates between selected options.
235
- * When false, selection changes are applied immediately without transition.
236
- * @default true
237
- */
238
- this.animate = input(true, { ...(ngDevMode ? { debugName: "animate" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
239
- /**
240
- * @description Accessible name for the radio group. Provide either `aria-label` or `aria-labelledby`.
241
- * @default null
242
- */
243
- this.ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
244
- /**
245
- * @description ID of an external element that provides the accessible name for the radio group.
246
- * @default null
247
- */
248
- this.ariaLabelledBy = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
249
- /**
250
- * @description Disables every option in the group and prevents value changes.
251
- * @default false
252
- */
253
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
254
- /**
255
- * @description Marks the component as invalid. Error styling requires both `invalid` and `touched` to be `true`.
256
- * When bound to a signal form field via `[formField]`, this is written by the signal forms `FormField` directive.
257
- * @default false
258
- */
259
- this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
260
- /**
261
- * @description The name of the radios, for a native `<form>`. Generated when empty, so two groups don't interfere.
262
- * When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
263
- * @default ""
264
- */
265
- this.name = input("", /* @ts-ignore */
266
- ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
267
- /**
268
- * @description The list of selectable options. Exactly one option is selected at a time.
269
- */
270
- this.options = input.required(/* @ts-ignore */
271
- ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
272
- /**
273
- * @description Prevents value changes while the control stays focusable and readable. When bound to a signal form
274
- * field via `[formField]`, this is written by the `FormField` directive.
275
- * @default false
276
- */
277
- this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
278
- /**
279
- * @description Marks the group as required, as `aria-required`. When bound to a signal form field via `[formField]`,
280
- * this is written by the `FormField` directive.
281
- * @default false
282
- */
283
- this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
284
- /**
285
- * @description Border-radius preset applied to the segmented container and its options.
286
- * @default "medium"
287
- */
288
- this.rounded = input("medium", /* @ts-ignore */
289
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
290
- /**
291
- * @description Size preset controlling the height, horizontal padding, text size, and spacing of each option.
292
- * @default "medium"
293
- */
294
- this.size = input("medium", /* @ts-ignore */
295
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
296
- /**
297
- * @description Emitted when the selected value changes or focus leaves the group.
298
- */
299
- this.touch = output();
300
- /**
301
- * @description Marks the component as touched. When bound to a signal form field via `[formField]`,
302
- * this is written by the signal forms `FormField` directive.
303
- * @default false
304
- */
305
- this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
306
- /**
307
- * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
308
- * @default ""
309
- */
310
- this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
311
- /**
312
- * @description The currently selected value. When it matches no current option, no option is checked.
313
- * A `null` value is allowed initially but cannot be restored through segmented interaction.
314
- * @default null
315
- */
316
- this.value = model(null, /* @ts-ignore */
317
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
318
- afterNextRender(() => {
319
- if (isDevMode() && !this.#label.labelledBy() && !this.ariaLabel()) {
320
- console.warn("[Mona Segmented] A segmented control needs an accessible name. Set aria-label, aria-labelledby " +
321
- "or use a mona-label.", this.#hostElementRef.nativeElement);
322
- }
323
- });
324
- // A browser checks a clicked radio on its own, and `[checked]` writes only when its binding changes, so a value
325
- // put back in the meantime would leave the rejected radio checked.
326
- afterRenderEffect({
327
- write: () => {
328
- const value = this.value();
329
- const options = this.options();
330
- this.radioInputs().forEach(({ nativeElement }, index) => {
331
- nativeElement.checked = options[index]?.value === value;
332
- });
333
- }
334
- });
335
- afterRenderEffect({
336
- read: () => {
337
- this.selectedIndex();
338
- // The options swap sides, with no change of size for the observer to report.
339
- this.#direction();
340
- const optionElements = this.optionElements();
341
- this.alignment();
342
- this.rounded();
343
- this.animate();
344
- const size = this.size();
345
- const options = this.options();
346
- const isSizeChange = this.#lastSize !== null && this.#lastSize !== size;
347
- const isOptionsChange = this.#lastOptions !== null && this.#lastOptions !== options;
348
- const suppressTransition = isSizeChange || isOptionsChange;
349
- this.#lastSize = size;
350
- this.#lastOptions = options;
351
- this.observeOptionElements(optionElements);
352
- this.updateIndicatorGeometry({ suppressTransition });
353
- }
354
- });
355
- afterNextRender({
356
- read: () => {
357
- this.setupResizeObserver();
358
- }
359
- });
360
- this.#destroyRef.onDestroy(() => {
361
- this.#resizeObserver?.disconnect();
362
- });
363
- }
364
- /**
365
- * @description Moves focus to the selected option, or the first enabled one.
366
- * @param options Options passed to the native `focus()` call, such as `preventScroll`.
367
- */
368
- focus(options) {
369
- const host = this.#hostElementRef.nativeElement;
370
- const target = host.querySelector("input:checked:not(:disabled)") ??
371
- host.querySelector("input:not(:disabled)");
372
- target?.focus(options);
373
- }
374
- /**
375
- * @internal
376
- */
377
- setLabelledBy(id) {
378
- this.#label.setLabelledBy(id);
379
- }
380
- onFocusOut(event) {
381
- const nextTarget = event.relatedTarget;
382
- if (nextTarget instanceof Node && this.#hostElementRef.nativeElement.contains(nextTarget)) {
383
- return;
384
- }
385
- this.touch.emit();
386
- }
387
- onOptionChange(option) {
388
- if (this.effectiveDisabled() || this.readonly() || option.disabled) {
389
- return;
390
- }
391
- this.value.set(option.value);
392
- this.touch.emit();
393
- }
394
- onOptionClick(event) {
395
- // Canceling the click makes the browser restore the previously checked option.
396
- if (this.readonly()) {
397
- event.preventDefault();
398
- }
399
- }
400
- observeOptionElements(optionElements) {
401
- if (!this.#resizeObserver) {
402
- return;
403
- }
404
- const elements = optionElements.map(optionElement => optionElement.nativeElement);
405
- for (const element of this.#observedOptionElements) {
406
- if (!elements.includes(element)) {
407
- this.#resizeObserver.unobserve(element);
408
- }
409
- }
410
- for (const element of elements) {
411
- if (!this.#observedOptionElements.includes(element)) {
412
- this.#resizeObserver.observe(element);
413
- }
414
- }
415
- this.#observedOptionElements = elements;
416
- }
417
- setupResizeObserver() {
418
- if (typeof ResizeObserver === "undefined") {
419
- return;
420
- }
421
- this.#resizeObserver = new ResizeObserver(() => {
422
- this.updateIndicatorGeometry({ suppressTransition: true });
423
- });
424
- this.#resizeObserver.observe(this.#hostElementRef.nativeElement);
425
- this.observeOptionElements(this.optionElements());
426
- }
427
- updateIndicatorGeometry(options) {
428
- const selectedIndex = this.selectedIndex();
429
- if (selectedIndex === -1) {
430
- this.#lastAnimatedIndex = null;
431
- this.indicatorGeometry.set(null);
432
- this.indicatorTransitionEnabled.set(false);
433
- return;
434
- }
435
- const optionElements = this.optionElements();
436
- const selectedElementRef = optionElements[selectedIndex];
437
- if (!selectedElementRef?.nativeElement) {
438
- this.#lastAnimatedIndex = null;
439
- this.indicatorGeometry.set(null);
440
- this.indicatorTransitionEnabled.set(false);
441
- return;
442
- }
443
- const option = selectedElementRef.nativeElement;
444
- // `offsetLeft`/`offsetTop`/`offsetWidth`/`offsetHeight` are pure layout values, relative to
445
- // the nearest positioned ancestor (the host, which is `position: relative` and the option's
446
- // direct parent). Unlike `getBoundingClientRect()`, they are unaffected by any CSS transform
447
- // an ancestor applies — e.g. the scale animation `mona-popup` plays while opening. Measuring
448
- // with `getBoundingClientRect()` there could capture a mid-transition (e.g. 95%-scaled)
449
- // snapshot that never gets corrected once the animation settles, undersizing/misplacing the
450
- // indicator relative to the option's real, final box.
451
- const x = option.offsetLeft;
452
- const y = option.offsetTop;
453
- const width = option.offsetWidth;
454
- const height = option.offsetHeight;
455
- const shouldAnimate = !options?.suppressTransition &&
456
- this.animate() &&
457
- this.indicatorInitialized() &&
458
- this.#lastAnimatedIndex !== null &&
459
- this.#lastAnimatedIndex !== selectedIndex;
460
- this.indicatorTransitionEnabled.set(shouldAnimate);
461
- this.indicatorGeometry.set({
462
- height,
463
- transform: `translate3d(${x}px, ${y}px, 0)`,
464
- width
465
- });
466
- this.#lastAnimatedIndex = selectedIndex;
467
- if (!this.indicatorInitialized()) {
468
- this.indicatorInitialized.set(true);
469
- }
470
- }
471
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SegmentedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
472
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SegmentedComponent, isStandalone: true, selector: "mona-segmented", inputs: { alignment: { classPropertyName: "alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touch: "touch", value: "valueChange" }, host: { listeners: { "focusout": "onFocusOut($event)" }, properties: { "attr.aria-disabled": "effectiveDisabled() || undefined", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.aria-label": "ariaLabel()", "attr.aria-labelledby": "labelledBy()", "attr.aria-readonly": "readonly() || null", "attr.aria-required": "required() || null", "attr.data-disabled": "effectiveDisabled()", "attr.data-readonly": "readonly() || null", "attr.data-invalid": "invalidState() || null", "attr.role": "'radiogroup'", "class": "containerClasses()" } }, queries: [{ propertyName: "itemTemplate", first: true, predicate: SegmentedItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "optionElements", predicate: ["optionElement"], descendants: true, isSignal: true }, { propertyName: "radioInputs", predicate: ["radioInput"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (indicatorGeometry(); as geometry) {\n <div\n aria-hidden=\"true\"\n [class]=\"indicatorClasses()\"\n [attr.data-disabled]=\"selectedOptionDisabled() ? 'true' : null\"\n [style.transform]=\"geometry.transform\"\n [style.width.px]=\"geometry.width\"\n [style.height.px]=\"geometry.height\"></div>\n}\n\n@for (option of options(); track option.value) {\n @let selected = option.value === value();\n @let optionDisabled = effectiveDisabled() || option.disabled;\n\n <label\n #optionElement\n [class]=\"optionClasses()\"\n [attr.data-selected]=\"selected\"\n [attr.data-indicator]=\"geometryReady() || null\"\n [attr.data-disabled]=\"optionDisabled\">\n <input\n #radioInput\n type=\"radio\"\n [name]=\"name() || groupName\"\n [value]=\"option.value\"\n [checked]=\"selected\"\n [disabled]=\"optionDisabled\"\n [class]=\"inputClasses()\"\n [attr.aria-label]=\"itemTemplate() ? option.label : null\"\n (change)=\"onOptionChange(option)\"\n (click)=\"onOptionClick($event)\" />\n\n <span\n class=\"pointer-events-none flex flex-1 items-center justify-center gap-1\n [border-radius:inherit]\">\n @if (itemTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContexts()[$index]\"></ng-container>\n } @else {\n {{ option.label }}\n }\n </span>\n </label>\n}\n\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
473
- }
474
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SegmentedComponent, decorators: [{
475
- type: Component,
476
- args: [{ selector: "mona-segmented", imports: [NgTemplateOutlet], host: {
477
- "[attr.aria-disabled]": "effectiveDisabled() || undefined",
478
- "[attr.aria-invalid]": "invalidState() ? 'true' : null",
479
- "[attr.aria-label]": "ariaLabel()",
480
- "[attr.aria-labelledby]": "labelledBy()",
481
- "[attr.aria-readonly]": "readonly() || null",
482
- "[attr.aria-required]": "required() || null",
483
- "[attr.data-disabled]": "effectiveDisabled()",
484
- "[attr.data-readonly]": "readonly() || null",
485
- "(focusout)": "onFocusOut($event)",
486
- "[attr.data-invalid]": "invalidState() || null",
487
- "[attr.role]": "'radiogroup'",
488
- "[class]": "containerClasses()"
489
- }, template: "@if (indicatorGeometry(); as geometry) {\n <div\n aria-hidden=\"true\"\n [class]=\"indicatorClasses()\"\n [attr.data-disabled]=\"selectedOptionDisabled() ? 'true' : null\"\n [style.transform]=\"geometry.transform\"\n [style.width.px]=\"geometry.width\"\n [style.height.px]=\"geometry.height\"></div>\n}\n\n@for (option of options(); track option.value) {\n @let selected = option.value === value();\n @let optionDisabled = effectiveDisabled() || option.disabled;\n\n <label\n #optionElement\n [class]=\"optionClasses()\"\n [attr.data-selected]=\"selected\"\n [attr.data-indicator]=\"geometryReady() || null\"\n [attr.data-disabled]=\"optionDisabled\">\n <input\n #radioInput\n type=\"radio\"\n [name]=\"name() || groupName\"\n [value]=\"option.value\"\n [checked]=\"selected\"\n [disabled]=\"optionDisabled\"\n [class]=\"inputClasses()\"\n [attr.aria-label]=\"itemTemplate() ? option.label : null\"\n (change)=\"onOptionChange(option)\"\n (click)=\"onOptionClick($event)\" />\n\n <span\n class=\"pointer-events-none flex flex-1 items-center justify-center gap-1\n [border-radius:inherit]\">\n @if (itemTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContexts()[$index]\"></ng-container>\n } @else {\n {{ option.label }}\n }\n </span>\n </label>\n}\n\n" }]
490
- }], ctorParameters: () => [], propDecorators: { itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SegmentedItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], optionElements: [{ type: i0.ViewChildren, args: ["optionElement", { isSignal: true }] }], radioInputs: [{ type: i0.ViewChildren, args: ["radioInput", { isSignal: true }] }], alignment: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignment", required: false }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
491
-
492
- /*
493
- * Public API Surface of @nanahoshi/mona-ui/segmented
494
- */
495
-
496
- /**
497
- * Generated bundle index. Do not edit.
498
- */
499
-
171
+ var SegmentedComponent = class SegmentedComponent {
172
+ #destroyRef;
173
+ #direction;
174
+ #hostElementRef;
175
+ #label;
176
+ #lastAnimatedIndex;
177
+ #lastOptions;
178
+ #lastSize;
179
+ #observedOptionElements;
180
+ #resizeObserver;
181
+ constructor() {
182
+ this.#destroyRef = inject(DestroyRef);
183
+ this.#direction = injectComponentDirection();
184
+ this.#hostElementRef = inject(ElementRef);
185
+ this.#label = injectLabelAssociation({
186
+ activate: () => this.focus(),
187
+ ariaLabel: () => this.ariaLabel(),
188
+ ariaLabelledBy: () => this.ariaLabelledBy()
189
+ });
190
+ this.#lastAnimatedIndex = null;
191
+ this.#lastOptions = null;
192
+ this.#lastSize = null;
193
+ this.#observedOptionElements = [];
194
+ this.#resizeObserver = null;
195
+ this.containerClasses = computed(() => {
196
+ const classes = segmentedContainerThemeVariants({
197
+ alignment: this.alignment(),
198
+ rounded: this.rounded()
199
+ });
200
+ return twMerge(classes, this.userClass());
201
+ }, ...ngDevMode ? [{ debugName: "containerClasses" }] : /* istanbul ignore next */ []);
202
+ this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
203
+ this.geometryReady = computed(() => !!this.indicatorGeometry(), ...ngDevMode ? [{ debugName: "geometryReady" }] : /* istanbul ignore next */ []);
204
+ this.groupName = createElementControlId();
205
+ this.indicatorClasses = computed(() => {
206
+ const animate = this.animate() && this.indicatorTransitionEnabled();
207
+ const rounded = this.rounded();
208
+ return segmentedIndicatorThemeVariants({
209
+ animate,
210
+ rounded
211
+ });
212
+ }, ...ngDevMode ? [{ debugName: "indicatorClasses" }] : /* istanbul ignore next */ []);
213
+ this.indicatorGeometry = signal(null, ...ngDevMode ? [{ debugName: "indicatorGeometry" }] : /* istanbul ignore next */ []);
214
+ this.indicatorInitialized = signal(false, ...ngDevMode ? [{ debugName: "indicatorInitialized" }] : /* istanbul ignore next */ []);
215
+ this.indicatorTransitionEnabled = signal(false, ...ngDevMode ? [{ debugName: "indicatorTransitionEnabled" }] : /* istanbul ignore next */ []);
216
+ this.inputClasses = computed(() => segmentedInputThemeVariants(), ...ngDevMode ? [{ debugName: "inputClasses" }] : /* istanbul ignore next */ []);
217
+ this.invalidState = computed(() => this.touched() && this.invalid(), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
218
+ this.itemTemplate = contentChild(SegmentedItemTemplateDirective, {
219
+ ...ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {},
220
+ read: TemplateRef
221
+ });
222
+ this.labelledBy = this.#label.labelledBy;
223
+ this.optionClasses = computed(() => {
224
+ const alignment = this.alignment();
225
+ const rounded = this.rounded();
226
+ const size = this.size();
227
+ return segmentedOptionThemeVariants({
228
+ alignment,
229
+ rounded,
230
+ size
231
+ });
232
+ }, ...ngDevMode ? [{ debugName: "optionClasses" }] : /* istanbul ignore next */ []);
233
+ this.optionContexts = computed(() => {
234
+ const disabled = this.effectiveDisabled();
235
+ const value = this.value();
236
+ return this.options().map((option, index) => ({
237
+ $implicit: option,
238
+ disabled: disabled || !!option.disabled,
239
+ index,
240
+ option,
241
+ selected: option.value === value
242
+ }));
243
+ }, ...ngDevMode ? [{ debugName: "optionContexts" }] : /* istanbul ignore next */ []);
244
+ this.optionElements = viewChildren("optionElement", ...ngDevMode ? [{ debugName: "optionElements" }] : /* istanbul ignore next */ []);
245
+ this.radioInputs = viewChildren("radioInput", ...ngDevMode ? [{ debugName: "radioInputs" }] : /* istanbul ignore next */ []);
246
+ this.selectedIndex = computed(() => {
247
+ const value = this.value();
248
+ return this.options().findIndex((option) => option.value === value);
249
+ }, ...ngDevMode ? [{ debugName: "selectedIndex" }] : /* istanbul ignore next */ []);
250
+ this.selectedOptionDisabled = computed(() => {
251
+ const selectedIndex = this.selectedIndex();
252
+ if (selectedIndex === -1) return false;
253
+ const option = this.options()[selectedIndex];
254
+ return this.effectiveDisabled() || !!option?.disabled;
255
+ }, ...ngDevMode ? [{ debugName: "selectedOptionDisabled" }] : /* istanbul ignore next */ []);
256
+ this.alignment = input("stretch", ...ngDevMode ? [{ debugName: "alignment" }] : /* istanbul ignore next */ []);
257
+ this.animate = input(true, {
258
+ ...ngDevMode ? { debugName: "animate" } : /* istanbul ignore next */ {},
259
+ transform: booleanAttribute
260
+ });
261
+ this.ariaLabel = input(null, {
262
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
263
+ alias: "aria-label"
264
+ });
265
+ this.ariaLabelledBy = input(null, {
266
+ ...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
267
+ alias: "aria-labelledby"
268
+ });
269
+ this.disabled = input(false, {
270
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
271
+ transform: booleanAttribute
272
+ });
273
+ this.invalid = input(false, {
274
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
275
+ transform: booleanAttribute
276
+ });
277
+ this.name = input("", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
278
+ this.options = input.required(...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
279
+ this.readonly = input(false, {
280
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
281
+ transform: booleanAttribute
282
+ });
283
+ this.required = input(false, {
284
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
285
+ transform: booleanAttribute
286
+ });
287
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
288
+ this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
289
+ this.touch = output();
290
+ this.touched = input(false, {
291
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
292
+ transform: booleanAttribute
293
+ });
294
+ this.userClass = input("", {
295
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
296
+ alias: "class"
297
+ });
298
+ this.value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
299
+ afterNextRender(() => {
300
+ if (isDevMode() && !this.#label.labelledBy() && !this.ariaLabel()) console.warn("[Mona Segmented] A segmented control needs an accessible name. Set aria-label, aria-labelledby or use a mona-label.", this.#hostElementRef.nativeElement);
301
+ });
302
+ afterRenderEffect({ write: () => {
303
+ const value = this.value();
304
+ const options = this.options();
305
+ this.radioInputs().forEach(({ nativeElement }, index) => {
306
+ nativeElement.checked = options[index]?.value === value;
307
+ });
308
+ } });
309
+ afterRenderEffect({ read: () => {
310
+ this.selectedIndex();
311
+ this.#direction();
312
+ const optionElements = this.optionElements();
313
+ this.alignment();
314
+ this.rounded();
315
+ this.animate();
316
+ const size = this.size();
317
+ const options = this.options();
318
+ const isSizeChange = this.#lastSize !== null && this.#lastSize !== size;
319
+ const isOptionsChange = this.#lastOptions !== null && this.#lastOptions !== options;
320
+ const suppressTransition = isSizeChange || isOptionsChange;
321
+ this.#lastSize = size;
322
+ this.#lastOptions = options;
323
+ this.observeOptionElements(optionElements);
324
+ this.updateIndicatorGeometry({ suppressTransition });
325
+ } });
326
+ afterNextRender({ read: () => {
327
+ this.setupResizeObserver();
328
+ } });
329
+ this.#destroyRef.onDestroy(() => {
330
+ this.#resizeObserver?.disconnect();
331
+ });
332
+ }
333
+ focus(options) {
334
+ const host = this.#hostElementRef.nativeElement;
335
+ (host.querySelector("input:checked:not(:disabled)") ?? host.querySelector("input:not(:disabled)"))?.focus(options);
336
+ }
337
+ setLabelledBy(id) {
338
+ this.#label.setLabelledBy(id);
339
+ }
340
+ onFocusOut(event) {
341
+ const nextTarget = event.relatedTarget;
342
+ if (nextTarget instanceof Node && this.#hostElementRef.nativeElement.contains(nextTarget)) return;
343
+ this.touch.emit();
344
+ }
345
+ onOptionChange(option) {
346
+ if (this.effectiveDisabled() || this.readonly() || option.disabled) return;
347
+ this.value.set(option.value);
348
+ this.touch.emit();
349
+ }
350
+ onOptionClick(event) {
351
+ if (this.readonly()) event.preventDefault();
352
+ }
353
+ observeOptionElements(optionElements) {
354
+ if (!this.#resizeObserver) return;
355
+ const elements = optionElements.map((optionElement) => optionElement.nativeElement);
356
+ for (const element of this.#observedOptionElements) if (!elements.includes(element)) this.#resizeObserver.unobserve(element);
357
+ for (const element of elements) if (!this.#observedOptionElements.includes(element)) this.#resizeObserver.observe(element);
358
+ this.#observedOptionElements = elements;
359
+ }
360
+ setupResizeObserver() {
361
+ if (typeof ResizeObserver === "undefined") return;
362
+ this.#resizeObserver = new ResizeObserver(() => {
363
+ this.updateIndicatorGeometry({ suppressTransition: true });
364
+ });
365
+ this.#resizeObserver.observe(this.#hostElementRef.nativeElement);
366
+ this.observeOptionElements(this.optionElements());
367
+ }
368
+ updateIndicatorGeometry(options) {
369
+ const selectedIndex = this.selectedIndex();
370
+ if (selectedIndex === -1) {
371
+ this.#lastAnimatedIndex = null;
372
+ this.indicatorGeometry.set(null);
373
+ this.indicatorTransitionEnabled.set(false);
374
+ return;
375
+ }
376
+ const selectedElementRef = this.optionElements()[selectedIndex];
377
+ if (!selectedElementRef?.nativeElement) {
378
+ this.#lastAnimatedIndex = null;
379
+ this.indicatorGeometry.set(null);
380
+ this.indicatorTransitionEnabled.set(false);
381
+ return;
382
+ }
383
+ const option = selectedElementRef.nativeElement;
384
+ const x = option.offsetLeft;
385
+ const y = option.offsetTop;
386
+ const width = option.offsetWidth;
387
+ const height = option.offsetHeight;
388
+ const shouldAnimate = !options?.suppressTransition && this.animate() && this.indicatorInitialized() && this.#lastAnimatedIndex !== null && this.#lastAnimatedIndex !== selectedIndex;
389
+ this.indicatorTransitionEnabled.set(shouldAnimate);
390
+ this.indicatorGeometry.set({
391
+ height,
392
+ transform: `translate3d(${x}px, ${y}px, 0)`,
393
+ width
394
+ });
395
+ this.#lastAnimatedIndex = selectedIndex;
396
+ if (!this.indicatorInitialized()) this.indicatorInitialized.set(true);
397
+ }
398
+ static {
399
+ this.ɵfac = i0.ɵɵngDeclareFactory({
400
+ minVersion: "12.0.0",
401
+ version: "22.2.6",
402
+ ngImport: i0,
403
+ type: SegmentedComponent,
404
+ deps: [],
405
+ target: i0.ɵɵFactoryTarget.Component
406
+ });
407
+ }
408
+ static {
409
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
410
+ minVersion: "17.0.0",
411
+ version: "22.2.6",
412
+ type: SegmentedComponent,
413
+ isStandalone: true,
414
+ selector: "mona-segmented",
415
+ inputs: {
416
+ alignment: {
417
+ classPropertyName: "alignment",
418
+ publicName: "alignment",
419
+ isSignal: true,
420
+ isRequired: false,
421
+ transformFunction: null
422
+ },
423
+ animate: {
424
+ classPropertyName: "animate",
425
+ publicName: "animate",
426
+ isSignal: true,
427
+ isRequired: false,
428
+ transformFunction: null
429
+ },
430
+ ariaLabel: {
431
+ classPropertyName: "ariaLabel",
432
+ publicName: "aria-label",
433
+ isSignal: true,
434
+ isRequired: false,
435
+ transformFunction: null
436
+ },
437
+ ariaLabelledBy: {
438
+ classPropertyName: "ariaLabelledBy",
439
+ publicName: "aria-labelledby",
440
+ isSignal: true,
441
+ isRequired: false,
442
+ transformFunction: null
443
+ },
444
+ disabled: {
445
+ classPropertyName: "disabled",
446
+ publicName: "disabled",
447
+ isSignal: true,
448
+ isRequired: false,
449
+ transformFunction: null
450
+ },
451
+ invalid: {
452
+ classPropertyName: "invalid",
453
+ publicName: "invalid",
454
+ isSignal: true,
455
+ isRequired: false,
456
+ transformFunction: null
457
+ },
458
+ name: {
459
+ classPropertyName: "name",
460
+ publicName: "name",
461
+ isSignal: true,
462
+ isRequired: false,
463
+ transformFunction: null
464
+ },
465
+ options: {
466
+ classPropertyName: "options",
467
+ publicName: "options",
468
+ isSignal: true,
469
+ isRequired: true,
470
+ transformFunction: null
471
+ },
472
+ readonly: {
473
+ classPropertyName: "readonly",
474
+ publicName: "readonly",
475
+ isSignal: true,
476
+ isRequired: false,
477
+ transformFunction: null
478
+ },
479
+ required: {
480
+ classPropertyName: "required",
481
+ publicName: "required",
482
+ isSignal: true,
483
+ isRequired: false,
484
+ transformFunction: null
485
+ },
486
+ rounded: {
487
+ classPropertyName: "rounded",
488
+ publicName: "rounded",
489
+ isSignal: true,
490
+ isRequired: false,
491
+ transformFunction: null
492
+ },
493
+ size: {
494
+ classPropertyName: "size",
495
+ publicName: "size",
496
+ isSignal: true,
497
+ isRequired: false,
498
+ transformFunction: null
499
+ },
500
+ touched: {
501
+ classPropertyName: "touched",
502
+ publicName: "touched",
503
+ isSignal: true,
504
+ isRequired: false,
505
+ transformFunction: null
506
+ },
507
+ userClass: {
508
+ classPropertyName: "userClass",
509
+ publicName: "class",
510
+ isSignal: true,
511
+ isRequired: false,
512
+ transformFunction: null
513
+ },
514
+ value: {
515
+ classPropertyName: "value",
516
+ publicName: "value",
517
+ isSignal: true,
518
+ isRequired: false,
519
+ transformFunction: null
520
+ }
521
+ },
522
+ outputs: {
523
+ touch: "touch",
524
+ value: "valueChange"
525
+ },
526
+ host: {
527
+ listeners: { "focusout": "onFocusOut($event)" },
528
+ properties: {
529
+ "attr.aria-disabled": "effectiveDisabled() || undefined",
530
+ "attr.aria-invalid": "invalidState() ? 'true' : null",
531
+ "attr.aria-label": "ariaLabel()",
532
+ "attr.aria-labelledby": "labelledBy()",
533
+ "attr.aria-readonly": "readonly() || null",
534
+ "attr.aria-required": "required() || null",
535
+ "attr.data-disabled": "effectiveDisabled()",
536
+ "attr.data-readonly": "readonly() || null",
537
+ "attr.data-invalid": "invalidState() || null",
538
+ "attr.role": "'radiogroup'",
539
+ "class": "containerClasses()"
540
+ }
541
+ },
542
+ queries: [{
543
+ propertyName: "itemTemplate",
544
+ first: true,
545
+ predicate: SegmentedItemTemplateDirective,
546
+ descendants: true,
547
+ read: TemplateRef,
548
+ isSignal: true
549
+ }],
550
+ viewQueries: [{
551
+ propertyName: "optionElements",
552
+ predicate: ["optionElement"],
553
+ descendants: true,
554
+ isSignal: true
555
+ }, {
556
+ propertyName: "radioInputs",
557
+ predicate: ["radioInput"],
558
+ descendants: true,
559
+ isSignal: true
560
+ }],
561
+ ngImport: i0,
562
+ template: "@if (indicatorGeometry(); as geometry) {\n <div\n aria-hidden=\"true\"\n [class]=\"indicatorClasses()\"\n [attr.data-disabled]=\"selectedOptionDisabled() ? 'true' : null\"\n [style.transform]=\"geometry.transform\"\n [style.width.px]=\"geometry.width\"\n [style.height.px]=\"geometry.height\"></div>\n}\n\n@for (option of options(); track option.value) {\n @let selected = option.value === value();\n @let optionDisabled = effectiveDisabled() || option.disabled;\n\n <label\n #optionElement\n [class]=\"optionClasses()\"\n [attr.data-selected]=\"selected\"\n [attr.data-indicator]=\"geometryReady() || null\"\n [attr.data-disabled]=\"optionDisabled\">\n <input\n #radioInput\n type=\"radio\"\n [name]=\"name() || groupName\"\n [value]=\"option.value\"\n [checked]=\"selected\"\n [disabled]=\"optionDisabled\"\n [class]=\"inputClasses()\"\n [attr.aria-label]=\"itemTemplate() ? option.label : null\"\n (change)=\"onOptionChange(option)\"\n (click)=\"onOptionClick($event)\" />\n\n <span\n class=\"pointer-events-none flex flex-1 items-center justify-center gap-1\n [border-radius:inherit]\">\n @if (itemTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContexts()[$index]\"></ng-container>\n } @else {\n {{ option.label }}\n }\n </span>\n </label>\n}\n\n",
563
+ dependencies: [{
564
+ kind: "directive",
565
+ type: NgTemplateOutlet,
566
+ selector: "[ngTemplateOutlet]",
567
+ inputs: [
568
+ "ngTemplateOutletContext",
569
+ "ngTemplateOutlet",
570
+ "ngTemplateOutletInjector"
571
+ ]
572
+ }]
573
+ });
574
+ }
575
+ };
576
+ i0.ɵɵngDeclareClassMetadata({
577
+ minVersion: "12.0.0",
578
+ version: "22.2.6",
579
+ ngImport: i0,
580
+ type: SegmentedComponent,
581
+ decorators: [{
582
+ type: Component,
583
+ args: [{
584
+ selector: "mona-segmented",
585
+ imports: [NgTemplateOutlet],
586
+ host: {
587
+ "[attr.aria-disabled]": "effectiveDisabled() || undefined",
588
+ "[attr.aria-invalid]": "invalidState() ? 'true' : null",
589
+ "[attr.aria-label]": "ariaLabel()",
590
+ "[attr.aria-labelledby]": "labelledBy()",
591
+ "[attr.aria-readonly]": "readonly() || null",
592
+ "[attr.aria-required]": "required() || null",
593
+ "[attr.data-disabled]": "effectiveDisabled()",
594
+ "[attr.data-readonly]": "readonly() || null",
595
+ "(focusout)": "onFocusOut($event)",
596
+ "[attr.data-invalid]": "invalidState() || null",
597
+ "[attr.role]": "'radiogroup'",
598
+ "[class]": "containerClasses()"
599
+ },
600
+ template: "@if (indicatorGeometry(); as geometry) {\n <div\n aria-hidden=\"true\"\n [class]=\"indicatorClasses()\"\n [attr.data-disabled]=\"selectedOptionDisabled() ? 'true' : null\"\n [style.transform]=\"geometry.transform\"\n [style.width.px]=\"geometry.width\"\n [style.height.px]=\"geometry.height\"></div>\n}\n\n@for (option of options(); track option.value) {\n @let selected = option.value === value();\n @let optionDisabled = effectiveDisabled() || option.disabled;\n\n <label\n #optionElement\n [class]=\"optionClasses()\"\n [attr.data-selected]=\"selected\"\n [attr.data-indicator]=\"geometryReady() || null\"\n [attr.data-disabled]=\"optionDisabled\">\n <input\n #radioInput\n type=\"radio\"\n [name]=\"name() || groupName\"\n [value]=\"option.value\"\n [checked]=\"selected\"\n [disabled]=\"optionDisabled\"\n [class]=\"inputClasses()\"\n [attr.aria-label]=\"itemTemplate() ? option.label : null\"\n (change)=\"onOptionChange(option)\"\n (click)=\"onOptionClick($event)\" />\n\n <span\n class=\"pointer-events-none flex flex-1 items-center justify-center gap-1\n [border-radius:inherit]\">\n @if (itemTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContexts()[$index]\"></ng-container>\n } @else {\n {{ option.label }}\n }\n </span>\n </label>\n}\n\n"
601
+ }]
602
+ }],
603
+ ctorParameters: () => [],
604
+ propDecorators: {
605
+ itemTemplate: [{
606
+ type: i0.ContentChild,
607
+ args: [i0.forwardRef(() => SegmentedItemTemplateDirective), {
608
+ read: TemplateRef,
609
+ isSignal: true
610
+ }]
611
+ }],
612
+ optionElements: [{
613
+ type: i0.ViewChildren,
614
+ args: ["optionElement", { isSignal: true }]
615
+ }],
616
+ radioInputs: [{
617
+ type: i0.ViewChildren,
618
+ args: ["radioInput", { isSignal: true }]
619
+ }],
620
+ alignment: [{
621
+ type: i0.Input,
622
+ args: [{
623
+ isSignal: true,
624
+ alias: "alignment",
625
+ required: false
626
+ }]
627
+ }],
628
+ animate: [{
629
+ type: i0.Input,
630
+ args: [{
631
+ isSignal: true,
632
+ alias: "animate",
633
+ required: false
634
+ }]
635
+ }],
636
+ ariaLabel: [{
637
+ type: i0.Input,
638
+ args: [{
639
+ isSignal: true,
640
+ alias: "aria-label",
641
+ required: false
642
+ }]
643
+ }],
644
+ ariaLabelledBy: [{
645
+ type: i0.Input,
646
+ args: [{
647
+ isSignal: true,
648
+ alias: "aria-labelledby",
649
+ required: false
650
+ }]
651
+ }],
652
+ disabled: [{
653
+ type: i0.Input,
654
+ args: [{
655
+ isSignal: true,
656
+ alias: "disabled",
657
+ required: false
658
+ }]
659
+ }],
660
+ invalid: [{
661
+ type: i0.Input,
662
+ args: [{
663
+ isSignal: true,
664
+ alias: "invalid",
665
+ required: false
666
+ }]
667
+ }],
668
+ name: [{
669
+ type: i0.Input,
670
+ args: [{
671
+ isSignal: true,
672
+ alias: "name",
673
+ required: false
674
+ }]
675
+ }],
676
+ options: [{
677
+ type: i0.Input,
678
+ args: [{
679
+ isSignal: true,
680
+ alias: "options",
681
+ required: true
682
+ }]
683
+ }],
684
+ readonly: [{
685
+ type: i0.Input,
686
+ args: [{
687
+ isSignal: true,
688
+ alias: "readonly",
689
+ required: false
690
+ }]
691
+ }],
692
+ required: [{
693
+ type: i0.Input,
694
+ args: [{
695
+ isSignal: true,
696
+ alias: "required",
697
+ required: false
698
+ }]
699
+ }],
700
+ rounded: [{
701
+ type: i0.Input,
702
+ args: [{
703
+ isSignal: true,
704
+ alias: "rounded",
705
+ required: false
706
+ }]
707
+ }],
708
+ size: [{
709
+ type: i0.Input,
710
+ args: [{
711
+ isSignal: true,
712
+ alias: "size",
713
+ required: false
714
+ }]
715
+ }],
716
+ touch: [{
717
+ type: i0.Output,
718
+ args: ["touch"]
719
+ }],
720
+ touched: [{
721
+ type: i0.Input,
722
+ args: [{
723
+ isSignal: true,
724
+ alias: "touched",
725
+ required: false
726
+ }]
727
+ }],
728
+ userClass: [{
729
+ type: i0.Input,
730
+ args: [{
731
+ isSignal: true,
732
+ alias: "class",
733
+ required: false
734
+ }]
735
+ }],
736
+ value: [{
737
+ type: i0.Input,
738
+ args: [{
739
+ isSignal: true,
740
+ alias: "value",
741
+ required: false
742
+ }]
743
+ }, {
744
+ type: i0.Output,
745
+ args: ["valueChange"]
746
+ }]
747
+ }
748
+ });
500
749
  export { SegmentedComponent, SegmentedItemTemplateDirective };
501
- //# sourceMappingURL=nanahoshi-mona-ui-segmented.mjs.map
750
+
751
+ //# sourceMappingURL=nanahoshi-mona-ui-segmented.mjs.map