@nanahoshi/mona-ui 0.27.2 → 0.28.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 (208) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/popup.md +1 -1
  3. package/docs/api/theme.md +2 -2
  4. package/docs/chart.md +14 -0
  5. package/docs/editor.md +2 -0
  6. package/docs/installation.md +147 -15
  7. package/docs/introduction.md +37 -15
  8. package/docs/theming-built-in-themes.md +67 -0
  9. package/docs/theming-custom-colors.md +274 -0
  10. package/docs/theming-custom-themes.md +168 -0
  11. package/docs/theming.md +164 -248
  12. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  13. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  14. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  15. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  16. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  17. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2070 -1573
  18. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  19. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  20. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  21. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  22. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  23. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  24. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  25. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  26. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  27. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  28. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  29. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  30. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  31. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  32. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  33. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  34. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  35. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  37. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  38. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  39. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  40. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  41. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  42. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  49. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  50. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  51. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  52. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  53. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  54. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  55. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  56. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  57. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  58. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  59. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  60. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  61. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  62. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  63. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  65. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  66. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  67. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  68. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  70. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  71. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  72. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  73. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  74. package/fesm2022/nanahoshi-mona-ui-locales.mjs +59 -77
  75. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  76. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  77. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  78. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  79. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  80. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  81. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  82. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  83. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  84. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  85. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  86. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  87. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  88. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  89. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  90. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  91. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  92. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  93. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  94. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  95. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  96. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  97. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  98. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  99. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  100. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  101. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  102. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  103. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  104. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  105. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  106. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  107. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  108. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  109. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  110. package/llms.txt +6 -2
  111. package/package.json +62 -23
  112. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  113. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  114. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  115. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  116. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  117. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  118. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  119. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  120. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  121. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  122. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  123. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  124. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  125. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  126. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  127. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  128. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  129. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  130. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  131. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  132. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  133. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  134. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  135. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  136. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  137. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  138. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  139. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  140. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  141. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  142. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  143. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  144. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  145. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  146. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  147. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  148. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  149. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  150. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  151. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  152. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  153. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  154. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  155. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  156. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  157. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  158. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  159. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  168. package/types/nanahoshi-mona-ui-locales.d.ts +17 -19
  169. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  170. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  171. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  172. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  173. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  174. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  175. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  176. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  177. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  178. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  179. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  180. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  181. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  182. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  183. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  184. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  185. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  186. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  187. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  188. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  189. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  190. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  191. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  192. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  193. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  194. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  195. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  196. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  197. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  198. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  199. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  200. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  201. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  202. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  203. package/types/nanahoshi-mona-ui.d.ts +1 -2
  204. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  205. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  206. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  207. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  208. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,86 +1,133 @@
1
- import { NgTemplateOutlet } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { inject, TemplateRef, Directive, DestroyRef, NgZone, computed, viewChild, contentChild, signal, input, booleanAttribute, numberAttribute, output, model, afterNextRender, isDevMode, Component } from '@angular/core';
4
- import { LucideStar, LucideHeart, LucideFlame, LucideDiamond, LucideCircle, LucideDynamicIcon } from '@lucide/angular';
5
- import { injectLabelAssociation, injectEffectiveDisabled, createElementControlId } from '@nanahoshi/mona-ui/internal';
6
- import { range } from '@mirei/ts-collections';
7
- import { formatNumber, injectComponentDirection, MonaI18nService } from '@nanahoshi/mona-ui/i18n';
8
- import { twMerge } from 'tailwind-merge';
9
- import { cva } from 'class-variance-authority';
10
-
11
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
12
- // Edit the JSON file and run `npm run generate:locale-catalogs`.
1
+ import { NgTemplateOutlet } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { Component, DestroyRef, Directive, NgZone, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, inject, input, isDevMode, model, numberAttribute, output, signal, viewChild } from "@angular/core";
4
+ import { LucideCircle, LucideDiamond, LucideDynamicIcon, LucideFlame, LucideHeart, LucideStar } from "@lucide/angular";
5
+ import { createElementControlId, injectEffectiveDisabled, injectLabelAssociation } from "@nanahoshi/mona-ui/internal";
6
+ import { range } from "@mirei/ts-collections";
7
+ import { MonaI18nService, formatNumber, injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
8
+ import { twMerge } from "tailwind-merge";
9
+ import { cva } from "class-variance-authority";
13
10
  function localizeNumber(value, options) {
14
- return formatNumber(value, "en-US", options);
11
+ return formatNumber(value, "en-US", options);
15
12
  }
16
13
  const RATING_DEFAULT_MESSAGES = {
17
- notRated: "Not rated",
18
- valueText: (value, max) => `${localizeNumber(value)} out of ${localizeNumber(max)}`
14
+ notRated: "Not rated",
15
+ valueText: (value, max) => `${localizeNumber(value)} out of ${localizeNumber(max)}`
19
16
  };
20
-
21
- /**
22
- * @description Renders the pointer-preview visual for rating items. Overrides the default preset
23
- * overlay whenever the visible state comes from pointer preview.
24
- */
25
- class RatingHoveredItemTemplateDirective {
26
- constructor() {
27
- this.templateRef = inject(TemplateRef);
28
- }
29
- static ngTemplateContextGuard(_directive, _context) {
30
- return true;
31
- }
32
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RatingHoveredItemTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
33
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: RatingHoveredItemTemplateDirective, isStandalone: true, selector: "ng-template[monaRatingHoveredItemTemplate]", ngImport: i0 }); }
34
- }
35
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RatingHoveredItemTemplateDirective, decorators: [{
36
- type: Directive,
37
- args: [{
38
- selector: "ng-template[monaRatingHoveredItemTemplate]"
39
- }]
40
- }] });
41
-
42
- /**
43
- * @description Renders the default (unselected) visual for every rating item. Overrides the
44
- * default preset icon for the base layer of each item.
45
- */
46
- class RatingItemTemplateDirective {
47
- constructor() {
48
- this.templateRef = inject(TemplateRef);
49
- }
50
- static ngTemplateContextGuard(_directive, _context) {
51
- return true;
52
- }
53
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RatingItemTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
54
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: RatingItemTemplateDirective, isStandalone: true, selector: "ng-template[monaRatingItemTemplate]", ngImport: i0 }); }
55
- }
56
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RatingItemTemplateDirective, decorators: [{
57
- type: Directive,
58
- args: [{
59
- selector: "ng-template[monaRatingItemTemplate]"
60
- }]
61
- }] });
62
-
63
- /**
64
- * @description Renders the committed selected visual for rating items. Overrides the default
65
- * preset overlay whenever the visible state comes from the committed value.
66
- */
67
- class RatingSelectedItemTemplateDirective {
68
- constructor() {
69
- this.templateRef = inject(TemplateRef);
70
- }
71
- static ngTemplateContextGuard(_directive, _context) {
72
- return true;
73
- }
74
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RatingSelectedItemTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
75
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: RatingSelectedItemTemplateDirective, isStandalone: true, selector: "ng-template[monaRatingSelectedItemTemplate]", ngImport: i0 }); }
76
- }
77
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RatingSelectedItemTemplateDirective, decorators: [{
78
- type: Directive,
79
- args: [{
80
- selector: "ng-template[monaRatingSelectedItemTemplate]"
81
- }]
82
- }] });
83
-
17
+ var RatingHoveredItemTemplateDirective = class RatingHoveredItemTemplateDirective {
18
+ constructor() {
19
+ this.templateRef = inject(TemplateRef);
20
+ }
21
+ static ngTemplateContextGuard(_directive, _context) {
22
+ return true;
23
+ }
24
+ static {
25
+ this.ɵfac = i0.ɵɵngDeclareFactory({
26
+ minVersion: "12.0.0",
27
+ version: "22.2.6",
28
+ ngImport: i0,
29
+ type: RatingHoveredItemTemplateDirective,
30
+ deps: [],
31
+ target: i0.ɵɵFactoryTarget.Directive
32
+ });
33
+ }
34
+ static {
35
+ this.ɵdir = i0.ɵɵngDeclareDirective({
36
+ minVersion: "14.0.0",
37
+ version: "22.2.6",
38
+ type: RatingHoveredItemTemplateDirective,
39
+ isStandalone: true,
40
+ selector: "ng-template[monaRatingHoveredItemTemplate]",
41
+ ngImport: i0
42
+ });
43
+ }
44
+ };
45
+ i0.ɵɵngDeclareClassMetadata({
46
+ minVersion: "12.0.0",
47
+ version: "22.2.6",
48
+ ngImport: i0,
49
+ type: RatingHoveredItemTemplateDirective,
50
+ decorators: [{
51
+ type: Directive,
52
+ args: [{ selector: "ng-template[monaRatingHoveredItemTemplate]" }]
53
+ }]
54
+ });
55
+ var RatingItemTemplateDirective = class RatingItemTemplateDirective {
56
+ constructor() {
57
+ this.templateRef = inject(TemplateRef);
58
+ }
59
+ static ngTemplateContextGuard(_directive, _context) {
60
+ return true;
61
+ }
62
+ static {
63
+ this.ɵfac = i0.ɵɵngDeclareFactory({
64
+ minVersion: "12.0.0",
65
+ version: "22.2.6",
66
+ ngImport: i0,
67
+ type: RatingItemTemplateDirective,
68
+ deps: [],
69
+ target: i0.ɵɵFactoryTarget.Directive
70
+ });
71
+ }
72
+ static {
73
+ this.ɵdir = i0.ɵɵngDeclareDirective({
74
+ minVersion: "14.0.0",
75
+ version: "22.2.6",
76
+ type: RatingItemTemplateDirective,
77
+ isStandalone: true,
78
+ selector: "ng-template[monaRatingItemTemplate]",
79
+ ngImport: i0
80
+ });
81
+ }
82
+ };
83
+ i0.ɵɵngDeclareClassMetadata({
84
+ minVersion: "12.0.0",
85
+ version: "22.2.6",
86
+ ngImport: i0,
87
+ type: RatingItemTemplateDirective,
88
+ decorators: [{
89
+ type: Directive,
90
+ args: [{ selector: "ng-template[monaRatingItemTemplate]" }]
91
+ }]
92
+ });
93
+ var RatingSelectedItemTemplateDirective = class RatingSelectedItemTemplateDirective {
94
+ constructor() {
95
+ this.templateRef = inject(TemplateRef);
96
+ }
97
+ static ngTemplateContextGuard(_directive, _context) {
98
+ return true;
99
+ }
100
+ static {
101
+ this.ɵfac = i0.ɵɵngDeclareFactory({
102
+ minVersion: "12.0.0",
103
+ version: "22.2.6",
104
+ ngImport: i0,
105
+ type: RatingSelectedItemTemplateDirective,
106
+ deps: [],
107
+ target: i0.ɵɵFactoryTarget.Directive
108
+ });
109
+ }
110
+ static {
111
+ this.ɵdir = i0.ɵɵngDeclareDirective({
112
+ minVersion: "14.0.0",
113
+ version: "22.2.6",
114
+ type: RatingSelectedItemTemplateDirective,
115
+ isStandalone: true,
116
+ selector: "ng-template[monaRatingSelectedItemTemplate]",
117
+ ngImport: i0
118
+ });
119
+ }
120
+ };
121
+ i0.ɵɵngDeclareClassMetadata({
122
+ minVersion: "12.0.0",
123
+ version: "22.2.6",
124
+ ngImport: i0,
125
+ type: RatingSelectedItemTemplateDirective,
126
+ decorators: [{
127
+ type: Directive,
128
+ args: [{ selector: "ng-template[monaRatingSelectedItemTemplate]" }]
129
+ }]
130
+ });
84
131
  const ratingContainerThemeVariants = cva(`inline-flex items-center gap-2.5`);
85
132
  const ratingControlThemeVariants = cva(`
86
133
  group
@@ -95,28 +142,20 @@ const ratingControlThemeVariants = cva(`
95
142
  data-[invalid="true"]:outline-2 data-[invalid="true"]:outline-error
96
143
  data-[invalid="true"]:focus-visible:outline-error
97
144
  `, {
98
- variants: {
99
- size: {
100
- small: "gap-1 p-0.5",
101
- medium: "gap-1 p-1",
102
- large: "gap-1.5 p-1.5"
103
- }
104
- },
105
- defaultVariants: {
106
- size: "medium"
107
- }
145
+ variants: { size: {
146
+ small: "gap-1 p-0.5",
147
+ medium: "gap-1 p-1",
148
+ large: "gap-1.5 p-1.5"
149
+ } },
150
+ defaultVariants: { size: "medium" }
108
151
  });
109
152
  const ratingItemThemeVariants = cva(`relative flex items-center justify-center overflow-hidden`, {
110
- variants: {
111
- size: {
112
- small: "h-6 w-6",
113
- medium: "h-7 w-7",
114
- large: "h-8 w-8"
115
- }
116
- },
117
- defaultVariants: {
118
- size: "medium"
119
- }
153
+ variants: { size: {
154
+ small: "h-6 w-6",
155
+ medium: "h-7 w-7",
156
+ large: "h-8 w-8"
157
+ } },
158
+ defaultVariants: { size: "medium" }
120
159
  });
121
160
  const ratingIconThemeVariants = cva(`
122
161
  block shrink-0
@@ -124,28 +163,20 @@ const ratingIconThemeVariants = cva(`
124
163
  transition-colors duration-(--mona-motion-fast)
125
164
  group-data-[disabled="true"]:text-disabled-foreground
126
165
  `, {
127
- variants: {
128
- size: {
129
- small: "h-4 w-4",
130
- medium: "h-5 w-5",
131
- large: "h-6 w-6"
132
- }
133
- },
134
- defaultVariants: {
135
- size: "medium"
136
- }
166
+ variants: { size: {
167
+ small: "h-4 w-4",
168
+ medium: "h-5 w-5",
169
+ large: "h-6 w-6"
170
+ } },
171
+ defaultVariants: { size: "medium" }
137
172
  });
138
173
  const ratingOverlayIconThemeVariants = cva(`block shrink-0`, {
139
- variants: {
140
- size: {
141
- small: "h-4 w-4",
142
- medium: "h-5 w-5",
143
- large: "h-6 w-6"
144
- }
145
- },
146
- defaultVariants: {
147
- size: "medium"
148
- }
174
+ variants: { size: {
175
+ small: "h-4 w-4",
176
+ medium: "h-5 w-5",
177
+ large: "h-6 w-6"
178
+ } },
179
+ defaultVariants: { size: "medium" }
149
180
  });
150
181
  const ratingOverlayClipThemeVariants = cva(`
151
182
  absolute bottom-0 start-0 top-0
@@ -157,529 +188,748 @@ const ratingOverlayContentThemeVariants = cva(`
157
188
  transition-colors duration-(--mona-motion-fast)
158
189
  group-data-[disabled="true"]:text-disabled-foreground
159
190
  `, {
160
- variants: {
161
- size: {
162
- small: "h-6 w-6",
163
- medium: "h-7 w-7",
164
- large: "h-8 w-8"
165
- }
166
- },
167
- defaultVariants: {
168
- size: "medium"
169
- }
191
+ variants: { size: {
192
+ small: "h-6 w-6",
193
+ medium: "h-7 w-7",
194
+ large: "h-8 w-8"
195
+ } },
196
+ defaultVariants: { size: "medium" }
170
197
  });
171
198
  const ratingLabelThemeVariants = cva(`whitespace-nowrap`, {
172
- variants: {
173
- size: {
174
- small: "text-sm",
175
- medium: "text-sm",
176
- large: "text-base"
177
- }
178
- },
179
- defaultVariants: {
180
- size: "medium"
181
- }
199
+ variants: { size: {
200
+ small: "text-sm",
201
+ medium: "text-sm",
202
+ large: "text-base"
203
+ } },
204
+ defaultVariants: { size: "medium" }
182
205
  });
183
-
184
206
  const DEFAULT_ITEMS_COUNT = 5;
185
- /**
186
- * Normalizes an arbitrary `itemsCount` value into a safe positive integer.
187
- * Numeric strings are converted, fractional values are floored, and
188
- * non-finite values fall back to the default.
189
- */
190
207
  function normalizeItemsCount(value) {
191
- if (typeof value === "string") {
192
- if (value.trim() === "") {
193
- return DEFAULT_ITEMS_COUNT;
194
- }
195
- value = Number(value);
196
- }
197
- if (typeof value !== "number" || !Number.isFinite(value)) {
198
- return DEFAULT_ITEMS_COUNT;
199
- }
200
- return Math.max(1, Math.floor(value));
208
+ if (typeof value === "string") {
209
+ if (value.trim() === "") return DEFAULT_ITEMS_COUNT;
210
+ value = Number(value);
211
+ }
212
+ if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_ITEMS_COUNT;
213
+ return Math.max(1, Math.floor(value));
201
214
  }
202
- /**
203
- * Returns the interaction step for the given precision.
204
- */
205
215
  function getRatingStep(precision) {
206
- return precision === "half" ? 0.5 : 1;
216
+ return precision === "half" ? .5 : 1;
207
217
  }
208
- /**
209
- * Rounds a value to the nearest multiple of the given step while avoiding
210
- * floating-point drift. The result is constrained to one decimal place.
211
- */
212
218
  function normalizeToStep(value, step) {
213
- const normalized = Math.round((value + Number.EPSILON) / step) * step;
214
- return Number(normalized.toFixed(1));
219
+ const normalized = Math.round((value + Number.EPSILON) / step) * step;
220
+ return Number(normalized.toFixed(1));
215
221
  }
216
- /**
217
- * Normalizes an externally supplied value for rendering and interaction.
218
- * Non-finite values become `0`, out-of-range values are clamped to the
219
- * valid domain, and the result is snapped to the active precision step.
220
- */
221
222
  function normalizeRatingValue(value, itemsCount, precision) {
222
- if (typeof value !== "number" || !Number.isFinite(value)) {
223
- return 0;
224
- }
225
- const clamped = Math.max(0, Math.min(itemsCount, value));
226
- return Math.max(0, Math.min(itemsCount, normalizeToStep(clamped, getRatingStep(precision))));
223
+ if (typeof value !== "number" || !Number.isFinite(value)) return 0;
224
+ return Math.max(0, Math.min(itemsCount, normalizeToStep(Math.max(0, Math.min(itemsCount, value)), getRatingStep(precision))));
227
225
  }
228
- /**
229
- * Fill amount for one item in continuous selection mode: every item at or
230
- * below the display value fills fully, one boundary item fills partially.
231
- */
232
226
  function getContinuousItemFill(displayValue, itemValue) {
233
- return Math.max(0, Math.min(1, displayValue - (itemValue - 1)));
227
+ return Math.max(0, Math.min(1, displayValue - (itemValue - 1)));
234
228
  }
235
- /**
236
- * Fill amount for one item in single selection mode: only the item
237
- * representing the display value fills, possibly partially.
238
- */
239
229
  function getSingleItemFill(displayValue, itemValue) {
240
- if (displayValue === 0) {
241
- return 0;
242
- }
243
- const activeItem = Math.ceil(displayValue);
244
- if (itemValue !== activeItem) {
245
- return 0;
246
- }
247
- return Math.max(0, Math.min(1, displayValue - (itemValue - 1)));
230
+ if (displayValue === 0) return 0;
231
+ if (itemValue !== Math.ceil(displayValue)) return 0;
232
+ return Math.max(0, Math.min(1, displayValue - (itemValue - 1)));
248
233
  }
249
- /**
250
- * Converts a pointer position inside an item into a candidate rating value.
251
- * Whole-item precision always selects the full item; half precision splits
252
- * the item into two horizontal regions, honoring the effective text
253
- * direction so the first visual half maps to the lower value.
254
- */
255
234
  function getPointerRatingValue(args) {
256
- const { clientX, direction, itemRect, itemValue, precision } = args;
257
- if (precision === "item") {
258
- return itemValue;
259
- }
260
- let ratio = (clientX - itemRect.left) / itemRect.width;
261
- if (direction === "rtl") {
262
- ratio = 1 - ratio;
263
- }
264
- return ratio <= 0.5 ? itemValue - 0.5 : itemValue;
235
+ const { clientX, direction, itemRect, itemValue, precision } = args;
236
+ if (precision === "item") return itemValue;
237
+ let ratio = (clientX - itemRect.left) / itemRect.width;
238
+ if (direction === "rtl") ratio = 1 - ratio;
239
+ return ratio <= .5 ? itemValue - .5 : itemValue;
265
240
  }
266
-
267
241
  const ratingIcons = {
268
- circle: LucideCircle,
269
- diamond: LucideDiamond,
270
- flame: LucideFlame,
271
- heart: LucideHeart,
272
- star: LucideStar
242
+ circle: LucideCircle,
243
+ diamond: LucideDiamond,
244
+ flame: LucideFlame,
245
+ heart: LucideHeart,
246
+ star: LucideStar
273
247
  };
274
- class RatingComponent {
275
- #destroyRef;
276
- #direction;
277
- #i18n;
278
- #label;
279
- #zone;
280
- constructor() {
281
- this.#destroyRef = inject(DestroyRef);
282
- this.#direction = injectComponentDirection();
283
- this.#i18n = inject(MonaI18nService);
284
- this.#label = injectLabelAssociation({
285
- activate: () => this.focus(),
286
- ariaLabel: () => this.ariaLabel(),
287
- ariaLabelledBy: () => this.ariaLabelledBy()
288
- });
289
- this.#zone = inject(NgZone);
290
- this.activeState = computed(() => this.previewActive() ? "hovered" : "selected", /* @ts-ignore */
291
- ...(ngDevMode ? [{ debugName: "activeState" }] : /* istanbul ignore next */ []));
292
- this.containerClasses = computed(() => twMerge(ratingContainerThemeVariants(), this.userClass()), /* @ts-ignore */
293
- ...(ngDevMode ? [{ debugName: "containerClasses" }] : /* istanbul ignore next */ []));
294
- this.controlClasses = computed(() => ratingControlThemeVariants({ size: this.size() }), /* @ts-ignore */
295
- ...(ngDevMode ? [{ debugName: "controlClasses" }] : /* istanbul ignore next */ []));
296
- this.controlElement = viewChild.required("ratingControl", /* @ts-ignore */
297
- ...(ngDevMode ? [{ debugName: "controlElement" }] : /* istanbul ignore next */ []));
298
- this.displayValue = computed(() => this.previewValue() ?? this.normalizedValue(), /* @ts-ignore */
299
- ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
300
- this.effectiveAriaLabelledBy = computed(() => {
301
- const labelledBy = this.#label.labelledBy();
302
- if (labelledBy) {
303
- return labelledBy;
304
- }
305
- if (!this.ariaLabel() && this.label()) {
306
- return this.labelId;
307
- }
308
- return null;
309
- }, /* @ts-ignore */
310
- ...(ngDevMode ? [{ debugName: "effectiveAriaLabelledBy" }] : /* istanbul ignore next */ []));
311
- this.effectiveAriaValueText = computed(() => {
312
- const custom = this.ariaValueText();
313
- if (custom) {
314
- return custom(this.normalizedValue(), this.itemsCount());
315
- }
316
- return this.normalizedValue() === 0
317
- ? this.messages().notRated
318
- : this.messages().valueText(this.normalizedValue(), this.itemsCount());
319
- }, /* @ts-ignore */
320
- ...(ngDevMode ? [{ debugName: "effectiveAriaValueText" }] : /* istanbul ignore next */ []));
321
- this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
322
- this.effectiveTabIndex = computed(() => (this.effectiveDisabled() ? -1 : this.tabindex()), /* @ts-ignore */
323
- ...(ngDevMode ? [{ debugName: "effectiveTabIndex" }] : /* istanbul ignore next */ []));
324
- this.hoveredTemplate = contentChild(RatingHoveredItemTemplateDirective, { ...(ngDevMode ? { debugName: "hoveredTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
325
- this.iconClasses = computed(() => ratingIconThemeVariants({ size: this.size() }), /* @ts-ignore */
326
- ...(ngDevMode ? [{ debugName: "iconClasses" }] : /* istanbul ignore next */ []));
327
- this.iconToRender = computed(() => ratingIcons[this.icon()], /* @ts-ignore */
328
- ...(ngDevMode ? [{ debugName: "iconToRender" }] : /* istanbul ignore next */ []));
329
- this.interactionDisabled = computed(() => this.effectiveDisabled() || this.readonly(), /* @ts-ignore */
330
- ...(ngDevMode ? [{ debugName: "interactionDisabled" }] : /* istanbul ignore next */ []));
331
- this.interactionStep = computed(() => getRatingStep(this.precision()), /* @ts-ignore */
332
- ...(ngDevMode ? [{ debugName: "interactionStep" }] : /* istanbul ignore next */ []));
333
- this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && this.normalizedValue() === 0)), /* @ts-ignore */
334
- ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
335
- this.isRtl = computed(() => this.#direction() === "rtl", /* @ts-ignore */
336
- ...(ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []));
337
- this.itemClasses = computed(() => ratingItemThemeVariants({ size: this.size() }), /* @ts-ignore */
338
- ...(ngDevMode ? [{ debugName: "itemClasses" }] : /* istanbul ignore next */ []));
339
- this.itemTemplate = contentChild(RatingItemTemplateDirective, { ...(ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
340
- this.items = computed(() => range(1, this.itemsCount())
341
- .select(itemValue => ({ index: itemValue - 1, itemValue }))
342
- .toArray(), /* @ts-ignore */
343
- ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
344
- this.labelClasses = computed(() => ratingLabelThemeVariants({ size: this.size() }), /* @ts-ignore */
345
- ...(ngDevMode ? [{ debugName: "labelClasses" }] : /* istanbul ignore next */ []));
346
- this.labelId = createElementControlId();
347
- this.messages = this.#i18n.componentMessages("rating", RATING_DEFAULT_MESSAGES);
348
- this.normalizedValue = computed(() => normalizeRatingValue(this.value(), this.itemsCount(), this.precision()), /* @ts-ignore */
349
- ...(ngDevMode ? [{ debugName: "normalizedValue" }] : /* istanbul ignore next */ []));
350
- this.overlayClipClasses = computed(() => ratingOverlayClipThemeVariants(), /* @ts-ignore */
351
- ...(ngDevMode ? [{ debugName: "overlayClipClasses" }] : /* istanbul ignore next */ []));
352
- this.overlayColor = computed(() => this.color() || "var(--color-primary)", /* @ts-ignore */
353
- ...(ngDevMode ? [{ debugName: "overlayColor" }] : /* istanbul ignore next */ []));
354
- this.overlayContentClasses = computed(() => ratingOverlayContentThemeVariants({ size: this.size() }), /* @ts-ignore */
355
- ...(ngDevMode ? [{ debugName: "overlayContentClasses" }] : /* istanbul ignore next */ []));
356
- this.overlayIconClasses = computed(() => ratingOverlayIconThemeVariants({ size: this.size() }), /* @ts-ignore */
357
- ...(ngDevMode ? [{ debugName: "overlayIconClasses" }] : /* istanbul ignore next */ []));
358
- this.overlayTemplate = computed(() => this.activeState() === "hovered" ? this.hoveredTemplate() : this.selectedTemplate(), /* @ts-ignore */
359
- ...(ngDevMode ? [{ debugName: "overlayTemplate" }] : /* istanbul ignore next */ []));
360
- this.previewActive = computed(() => this.previewValue() !== null, /* @ts-ignore */
361
- ...(ngDevMode ? [{ debugName: "previewActive" }] : /* istanbul ignore next */ []));
362
- this.previewValue = signal(null, /* @ts-ignore */
363
- ...(ngDevMode ? [{ debugName: "previewValue" }] : /* istanbul ignore next */ []));
364
- this.selectedTemplate = contentChild(RatingSelectedItemTemplateDirective, { ...(ngDevMode ? { debugName: "selectedTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
365
- /**
366
- * @description Associates help text or an error description with the focusable rating control.
367
- * @default null
368
- */
369
- this.ariaDescribedBy = input(null, { ...(ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {}), alias: "aria-describedby" });
370
- /**
371
- * @description Explicit accessible name for the rating control. Provide `aria-label`,
372
- * `aria-labelledby`, or `label` so assistive technology can announce the control.
373
- * @default null
374
- */
375
- this.ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
376
- /**
377
- * @description IDs of external elements providing the accessible name for the rating control.
378
- * @default null
379
- */
380
- this.ariaLabelledBy = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
381
- /**
382
- * @description Custom screen-reader value announcement. Receives the normalized value and the
383
- * item count and returns the string to expose through `aria-valuetext`.
384
- * @default null
385
- */
386
- this.ariaValueText = input(null, /* @ts-ignore */
387
- ...(ngDevMode ? [{ debugName: "ariaValueText" }] : /* istanbul ignore next */ []));
388
- /**
389
- * @description Lets a click on the current value clear the rating, so pointer and touch users can undo one. The
390
- * keyboard can always clear it with Home.
391
- * @default false
392
- */
393
- this.clearable = input(false, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
394
- /**
395
- * @description CSS color for selected and hovered rating visuals. Empty, `null`, and `undefined` values use the
396
- * primary theme color.
397
- * @default undefined
398
- */
399
- this.color = input(/* @ts-ignore */
400
- ...(ngDevMode ? [undefined, { debugName: "color" }] : /* istanbul ignore next */ []));
401
- /**
402
- * @description Disables pointer and keyboard interaction and removes the control from the tab
403
- * sequence. When bound to a signal form field via `[formField]`, this is written by the signal
404
- * forms `Field` directive.
405
- * @default false
406
- */
407
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
408
- /**
409
- * @description Built-in icon used for the default rating visuals. Choose `star`, `heart`,
410
- * `circle`, `diamond`, or `flame`; use item templates to supply a custom icon.
411
- * @default "star"
412
- */
413
- this.icon = input("star", /* @ts-ignore */
414
- ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
415
- /**
416
- * @description Marks the component as invalid. Error styling requires both `invalid` and
417
- * `touched` to be `true`. When bound to a signal form field via `[formField]`, this is written
418
- * by the signal forms `Field` directive.
419
- * @default false
420
- */
421
- this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
422
- /**
423
- * @description Number of rating items. Fractional values are floored and values below one are
424
- * raised to one.
425
- * @default 5
426
- */
427
- this.itemsCount = input(5, { ...(ngDevMode ? { debugName: "itemsCount" } : /* istanbul ignore next */ {}), transform: normalizeItemsCount });
428
- /**
429
- * @description Optional visible label rendered before or after the rating items. When no
430
- * explicit `aria-label` or `aria-labelledby` is supplied, the label provides the accessible
431
- * name.
432
- * @default null
433
- */
434
- this.label = input(null, /* @ts-ignore */
435
- ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
436
- /**
437
- * @description Places the visible label before or after the item group.
438
- * @default "after"
439
- */
440
- this.labelPosition = input("after", /* @ts-ignore */
441
- ...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
442
- /**
443
- * @description Selection granularity of the rating.
444
- * @default "item"
445
- */
446
- this.precision = input("item", /* @ts-ignore */
447
- ...(ngDevMode ? [{ debugName: "precision" }] : /* istanbul ignore next */ []));
448
- /**
449
- * @description Prevents value changes while preserving focusability and normal visual emphasis.
450
- * @default false
451
- */
452
- this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
453
- /**
454
- * @description Shows the invalid state while the rating is `0` and the control is touched. The `required` rule of
455
- * signal forms doesn't treat `0` as empty, so it won't fail the form by itself: use `min(path, 1)` to reject an
456
- * unrated value. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
457
- * @default false
458
- */
459
- this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
460
- /**
461
- * @description Controls cumulative or single-item filling.
462
- * @default "continuous"
463
- */
464
- this.selection = input("continuous", /* @ts-ignore */
465
- ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
466
- /**
467
- * @description Size preset controlling the icon dimensions, item hitboxes, spacing, and label
468
- * typography.
469
- * @default "medium"
470
- */
471
- this.size = input("medium", /* @ts-ignore */
472
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
473
- /**
474
- * @description Tab index applied to the focusable rating control when not disabled. Accepts a
475
- * numeric string and converts it to a number.
476
- * @default 0
477
- */
478
- this.tabindex = input(0, { ...(ngDevMode ? { debugName: "tabindex" } : /* istanbul ignore next */ {}), transform: (value) => numberAttribute(value, 0) });
479
- /**
480
- * @description Emitted when the control loses focus or a pointer commits a rating, marking the field as touched.
481
- */
482
- this.touch = output();
483
- /**
484
- * @description Marks the component as touched. When bound to a signal form field via
485
- * `[formField]`, this is written by the signal forms `Field` directive.
486
- * @default false
487
- */
488
- this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
489
- /**
490
- * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
491
- * @default ""
492
- */
493
- this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
494
- /**
495
- * @description Current rating value. `0` represents an unrated state. Values are normalized
496
- * for rendering but are not rewritten until the user interacts with the component.
497
- * @default 0
498
- */
499
- this.value = model(0, /* @ts-ignore */
500
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
501
- afterNextRender(() => {
502
- const control = this.controlElement().nativeElement;
503
- // Outside the template, so a pointer moving over the items doesn't check the view on every event.
504
- const onPointerMove = (event) => this.onPointerMove(event);
505
- this.#zone.runOutsideAngular(() => control.addEventListener("pointermove", onPointerMove));
506
- this.#destroyRef.onDestroy(() => control.removeEventListener("pointermove", onPointerMove));
507
- if (isDevMode() && !this.ariaLabel() && !this.effectiveAriaLabelledBy()) {
508
- console.warn("[Mona Rating] A rating needs an accessible name. Set aria-label, aria-labelledby or label, or " +
509
- "use a mona-label.", control);
510
- }
511
- });
512
- }
513
- /** Blurs the inner slider control if focused. */
514
- blur() {
515
- this.controlElement().nativeElement.blur();
516
- }
517
- /** Focuses the inner slider control. Does nothing while disabled. */
518
- focus(options) {
519
- if (!this.effectiveDisabled()) {
520
- this.controlElement().nativeElement.focus(options);
521
- }
522
- }
523
- /**
524
- * @internal
525
- */
526
- setLabelledBy(id) {
527
- this.#label.setLabelledBy(id);
528
- }
529
- createItemContext(item) {
530
- return {
531
- $implicit: item.index,
532
- fill: this.getItemFill(item.itemValue),
533
- hovered: this.previewActive(),
534
- index: item.index,
535
- itemValue: item.itemValue,
536
- selected: !this.previewActive()
537
- };
538
- }
539
- getItemFill(itemValue) {
540
- const displayValue = this.displayValue();
541
- if (this.selection() === "single") {
542
- return getSingleItemFill(displayValue, itemValue);
543
- }
544
- return getContinuousItemFill(displayValue, itemValue);
545
- }
546
- onBlur() {
547
- this.previewValue.set(null);
548
- this.touch.emit();
549
- }
550
- onClick(event) {
551
- if (this.interactionDisabled()) {
552
- return;
553
- }
554
- const candidate = this.getCandidateFromPointerEvent(event);
555
- if (candidate === null) {
556
- return;
557
- }
558
- const normalized = this.normalizeCandidate(candidate);
559
- if (normalized !== this.normalizedValue()) {
560
- this.value.set(normalized);
561
- }
562
- else if (this.clearable()) {
563
- this.previewValue.set(null);
564
- this.value.set(0);
565
- }
566
- this.touch.emit();
567
- }
568
- onKeydown(event) {
569
- if (this.interactionDisabled()) {
570
- return;
571
- }
572
- const action = this.getKeyAction(event.key);
573
- if (action === null) {
574
- return;
575
- }
576
- event.preventDefault();
577
- this.previewValue.set(null);
578
- const current = this.normalizedValue();
579
- let next;
580
- switch (action) {
581
- case "decrease":
582
- next = this.normalizeCandidate(current - this.interactionStep());
583
- break;
584
- case "end":
585
- next = this.itemsCount();
586
- break;
587
- case "home":
588
- next = 0;
589
- break;
590
- case "increase":
591
- next = this.normalizeCandidate(current + this.interactionStep());
592
- break;
593
- case "pageDecrease":
594
- next = this.normalizeCandidate(current - 1);
595
- break;
596
- case "pageIncrease":
597
- next = this.normalizeCandidate(current + 1);
598
- break;
599
- }
600
- if (next !== current) {
601
- this.value.set(next);
602
- }
603
- }
604
- onPointerLeave() {
605
- this.previewValue.set(null);
606
- }
607
- onPointerMove(event) {
608
- if (this.interactionDisabled()) {
609
- return;
610
- }
611
- const candidate = this.getCandidateFromPointerEvent(event);
612
- if (candidate !== null) {
613
- this.previewValue.set(candidate);
614
- }
615
- }
616
- getCandidateFromPointerEvent(event) {
617
- const controlElement = this.controlElement().nativeElement;
618
- const target = event.target;
619
- const itemElement = target?.closest("[data-rating-index]") ?? null;
620
- if (!itemElement || !controlElement.contains(itemElement)) {
621
- return null;
622
- }
623
- const itemValue = Number(itemElement.getAttribute("data-rating-value"));
624
- // A whole-item rating doesn't depend on where in the item the pointer is, so it needs no layout read.
625
- if (this.precision() === "item") {
626
- return itemValue;
627
- }
628
- const itemRect = itemElement.getBoundingClientRect();
629
- const direction = getComputedStyle(controlElement).direction === "rtl" ? "rtl" : "ltr";
630
- return getPointerRatingValue({
631
- clientX: event.clientX,
632
- direction,
633
- itemRect,
634
- itemValue,
635
- precision: this.precision()
636
- });
637
- }
638
- getKeyAction(key) {
639
- const isRtl = this.isRtl();
640
- const decreaseKey = isRtl ? "ArrowRight" : "ArrowLeft";
641
- const increaseKey = isRtl ? "ArrowLeft" : "ArrowRight";
642
- switch (key) {
643
- case increaseKey:
644
- case "ArrowUp":
645
- return "increase";
646
- case decreaseKey:
647
- case "ArrowDown":
648
- return "decrease";
649
- case "Home":
650
- return "home";
651
- case "End":
652
- return "end";
653
- case "PageDown":
654
- return "pageDecrease";
655
- case "PageUp":
656
- return "pageIncrease";
657
- default:
658
- return null;
659
- }
660
- }
661
- normalizeCandidate(value) {
662
- return normalizeRatingValue(value, this.itemsCount(), this.precision());
663
- }
664
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RatingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
665
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: RatingComponent, isStandalone: true, selector: "mona-rating", inputs: { ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", 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 }, ariaValueText: { classPropertyName: "ariaValueText", publicName: "ariaValueText", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, itemsCount: { classPropertyName: "itemsCount", publicName: "itemsCount", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, precision: { classPropertyName: "precision", publicName: "precision", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", 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" }, queries: [{ propertyName: "hoveredTemplate", first: true, predicate: RatingHoveredItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: RatingItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "selectedTemplate", first: true, predicate: RatingSelectedItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "controlElement", first: true, predicate: ["ratingControl"], descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"containerClasses()\">\n @if (label() && labelPosition() === \"before\") {\n <span [id]=\"labelId\" [class]=\"labelClasses()\">{{ label() }}</span>\n }\n\n <div\n #ratingControl\n role=\"slider\"\n [class]=\"controlClasses()\"\n [attr.tabindex]=\"effectiveTabIndex()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"itemsCount()\"\n [attr.aria-valuenow]=\"normalizedValue()\"\n [attr.aria-valuetext]=\"effectiveAriaValueText()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"effectiveAriaLabelledBy()\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"invalidState() || null\"\n [attr.data-disabled]=\"effectiveDisabled() || null\"\n [attr.data-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n [attr.data-precision]=\"precision()\"\n [attr.data-selection]=\"selection()\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n (pointerleave)=\"onPointerLeave()\"\n (click)=\"onClick($event)\">\n @for (item of items(); track item.itemValue) {\n <span\n [class]=\"itemClasses()\"\n [attr.data-rating-index]=\"item.index\"\n [attr.data-rating-value]=\"item.itemValue\"\n aria-hidden=\"true\">\n <span class=\"flex h-full w-full items-center justify-center\">\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"createItemContext(item)\">\n </ng-container>\n } @else {\n <svg lucideIcon [lucideIcon]=\"iconToRender()\" [class]=\"iconClasses()\" fill=\"none\"></svg>\n }\n </span>\n\n @let fill = getItemFill(item.itemValue);\n\n @if (fill > 0) {\n <span [class]=\"overlayClipClasses()\" [style.inline-size.%]=\"fill * 100\">\n <span\n [class]=\"overlayContentClasses()\"\n [attr.data-state]=\"activeState()\"\n [style.color]=\"effectiveDisabled() ? null : overlayColor()\">\n @if (overlayTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"overlayTemplate()!\"\n [ngTemplateOutletContext]=\"createItemContext(item)\">\n </ng-container>\n } @else {\n <svg\n lucideIcon\n [lucideIcon]=\"iconToRender()\"\n [class]=\"overlayIconClasses()\"\n fill=\"currentColor\"></svg>\n }\n </span>\n </span>\n }\n </span>\n }\n </div>\n\n @if (label() && labelPosition() === \"after\") {\n <span [id]=\"labelId\" [class]=\"labelClasses()\">{{ label() }}</span>\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }] }); }
666
- }
667
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RatingComponent, decorators: [{
668
- type: Component,
669
- args: [{ selector: "mona-rating", imports: [NgTemplateOutlet, LucideDynamicIcon], template: "<div [class]=\"containerClasses()\">\n @if (label() && labelPosition() === \"before\") {\n <span [id]=\"labelId\" [class]=\"labelClasses()\">{{ label() }}</span>\n }\n\n <div\n #ratingControl\n role=\"slider\"\n [class]=\"controlClasses()\"\n [attr.tabindex]=\"effectiveTabIndex()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"itemsCount()\"\n [attr.aria-valuenow]=\"normalizedValue()\"\n [attr.aria-valuetext]=\"effectiveAriaValueText()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"effectiveAriaLabelledBy()\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"invalidState() || null\"\n [attr.data-disabled]=\"effectiveDisabled() || null\"\n [attr.data-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n [attr.data-precision]=\"precision()\"\n [attr.data-selection]=\"selection()\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n (pointerleave)=\"onPointerLeave()\"\n (click)=\"onClick($event)\">\n @for (item of items(); track item.itemValue) {\n <span\n [class]=\"itemClasses()\"\n [attr.data-rating-index]=\"item.index\"\n [attr.data-rating-value]=\"item.itemValue\"\n aria-hidden=\"true\">\n <span class=\"flex h-full w-full items-center justify-center\">\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"createItemContext(item)\">\n </ng-container>\n } @else {\n <svg lucideIcon [lucideIcon]=\"iconToRender()\" [class]=\"iconClasses()\" fill=\"none\"></svg>\n }\n </span>\n\n @let fill = getItemFill(item.itemValue);\n\n @if (fill > 0) {\n <span [class]=\"overlayClipClasses()\" [style.inline-size.%]=\"fill * 100\">\n <span\n [class]=\"overlayContentClasses()\"\n [attr.data-state]=\"activeState()\"\n [style.color]=\"effectiveDisabled() ? null : overlayColor()\">\n @if (overlayTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"overlayTemplate()!\"\n [ngTemplateOutletContext]=\"createItemContext(item)\">\n </ng-container>\n } @else {\n <svg\n lucideIcon\n [lucideIcon]=\"iconToRender()\"\n [class]=\"overlayIconClasses()\"\n fill=\"currentColor\"></svg>\n }\n </span>\n </span>\n }\n </span>\n }\n </div>\n\n @if (label() && labelPosition() === \"after\") {\n <span [id]=\"labelId\" [class]=\"labelClasses()\">{{ label() }}</span>\n }\n</div>\n" }]
670
- }], ctorParameters: () => [], propDecorators: { controlElement: [{ type: i0.ViewChild, args: ["ratingControl", { isSignal: true }] }], hoveredTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => RatingHoveredItemTemplateDirective), { ...{
671
- read: TemplateRef
672
- }, isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => RatingItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], selectedTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => RatingSelectedItemTemplateDirective), { ...{
673
- read: TemplateRef
674
- }, isSignal: true }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", 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 }] }], ariaValueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaValueText", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], itemsCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemsCount", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], precision: [{ type: i0.Input, args: [{ isSignal: true, alias: "precision", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", 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"] }] } });
675
-
676
- /*
677
- * Public API Surface of @nanahoshi/mona-ui/rating
678
- */
679
-
680
- /**
681
- * Generated bundle index. Do not edit.
682
- */
683
-
248
+ var RatingComponent = class RatingComponent {
249
+ #destroyRef;
250
+ #direction;
251
+ #i18n;
252
+ #label;
253
+ #zone;
254
+ constructor() {
255
+ this.#destroyRef = inject(DestroyRef);
256
+ this.#direction = injectComponentDirection();
257
+ this.#i18n = inject(MonaI18nService);
258
+ this.#label = injectLabelAssociation({
259
+ activate: () => this.focus(),
260
+ ariaLabel: () => this.ariaLabel(),
261
+ ariaLabelledBy: () => this.ariaLabelledBy()
262
+ });
263
+ this.#zone = inject(NgZone);
264
+ this.activeState = computed(() => this.previewActive() ? "hovered" : "selected", ...ngDevMode ? [{ debugName: "activeState" }] : /* istanbul ignore next */ []);
265
+ this.containerClasses = computed(() => twMerge(ratingContainerThemeVariants(), this.userClass()), ...ngDevMode ? [{ debugName: "containerClasses" }] : /* istanbul ignore next */ []);
266
+ this.controlClasses = computed(() => ratingControlThemeVariants({ size: this.size() }), ...ngDevMode ? [{ debugName: "controlClasses" }] : /* istanbul ignore next */ []);
267
+ this.controlElement = viewChild.required("ratingControl", ...ngDevMode ? [{ debugName: "controlElement" }] : /* istanbul ignore next */ []);
268
+ this.displayValue = computed(() => this.previewValue() ?? this.normalizedValue(), ...ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []);
269
+ this.effectiveAriaLabelledBy = computed(() => {
270
+ const labelledBy = this.#label.labelledBy();
271
+ if (labelledBy) return labelledBy;
272
+ if (!this.ariaLabel() && this.label()) return this.labelId;
273
+ return null;
274
+ }, ...ngDevMode ? [{ debugName: "effectiveAriaLabelledBy" }] : /* istanbul ignore next */ []);
275
+ this.effectiveAriaValueText = computed(() => {
276
+ const custom = this.ariaValueText();
277
+ if (custom) return custom(this.normalizedValue(), this.itemsCount());
278
+ return this.normalizedValue() === 0 ? this.messages().notRated : this.messages().valueText(this.normalizedValue(), this.itemsCount());
279
+ }, ...ngDevMode ? [{ debugName: "effectiveAriaValueText" }] : /* istanbul ignore next */ []);
280
+ this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
281
+ this.effectiveTabIndex = computed(() => this.effectiveDisabled() ? -1 : this.tabindex(), ...ngDevMode ? [{ debugName: "effectiveTabIndex" }] : /* istanbul ignore next */ []);
282
+ this.hoveredTemplate = contentChild(RatingHoveredItemTemplateDirective, {
283
+ ...ngDevMode ? { debugName: "hoveredTemplate" } : /* istanbul ignore next */ {},
284
+ read: TemplateRef
285
+ });
286
+ this.iconClasses = computed(() => ratingIconThemeVariants({ size: this.size() }), ...ngDevMode ? [{ debugName: "iconClasses" }] : /* istanbul ignore next */ []);
287
+ this.iconToRender = computed(() => ratingIcons[this.icon()], ...ngDevMode ? [{ debugName: "iconToRender" }] : /* istanbul ignore next */ []);
288
+ this.interactionDisabled = computed(() => this.effectiveDisabled() || this.readonly(), ...ngDevMode ? [{ debugName: "interactionDisabled" }] : /* istanbul ignore next */ []);
289
+ this.interactionStep = computed(() => getRatingStep(this.precision()), ...ngDevMode ? [{ debugName: "interactionStep" }] : /* istanbul ignore next */ []);
290
+ this.invalidState = computed(() => this.touched() && (this.invalid() || this.required() && this.normalizedValue() === 0), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
291
+ this.isRtl = computed(() => this.#direction() === "rtl", ...ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []);
292
+ this.itemClasses = computed(() => ratingItemThemeVariants({ size: this.size() }), ...ngDevMode ? [{ debugName: "itemClasses" }] : /* istanbul ignore next */ []);
293
+ this.itemTemplate = contentChild(RatingItemTemplateDirective, {
294
+ ...ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {},
295
+ read: TemplateRef
296
+ });
297
+ this.items = computed(() => range(1, this.itemsCount()).select((itemValue) => ({
298
+ index: itemValue - 1,
299
+ itemValue
300
+ })).toArray(), ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
301
+ this.labelClasses = computed(() => ratingLabelThemeVariants({ size: this.size() }), ...ngDevMode ? [{ debugName: "labelClasses" }] : /* istanbul ignore next */ []);
302
+ this.labelId = createElementControlId();
303
+ this.messages = this.#i18n.componentMessages("rating", RATING_DEFAULT_MESSAGES);
304
+ this.normalizedValue = computed(() => normalizeRatingValue(this.value(), this.itemsCount(), this.precision()), ...ngDevMode ? [{ debugName: "normalizedValue" }] : /* istanbul ignore next */ []);
305
+ this.overlayClipClasses = computed(() => ratingOverlayClipThemeVariants(), ...ngDevMode ? [{ debugName: "overlayClipClasses" }] : /* istanbul ignore next */ []);
306
+ this.overlayColor = computed(() => this.color() || "var(--color-primary)", ...ngDevMode ? [{ debugName: "overlayColor" }] : /* istanbul ignore next */ []);
307
+ this.overlayContentClasses = computed(() => ratingOverlayContentThemeVariants({ size: this.size() }), ...ngDevMode ? [{ debugName: "overlayContentClasses" }] : /* istanbul ignore next */ []);
308
+ this.overlayIconClasses = computed(() => ratingOverlayIconThemeVariants({ size: this.size() }), ...ngDevMode ? [{ debugName: "overlayIconClasses" }] : /* istanbul ignore next */ []);
309
+ this.overlayTemplate = computed(() => this.activeState() === "hovered" ? this.hoveredTemplate() : this.selectedTemplate(), ...ngDevMode ? [{ debugName: "overlayTemplate" }] : /* istanbul ignore next */ []);
310
+ this.previewActive = computed(() => this.previewValue() !== null, ...ngDevMode ? [{ debugName: "previewActive" }] : /* istanbul ignore next */ []);
311
+ this.previewValue = signal(null, ...ngDevMode ? [{ debugName: "previewValue" }] : /* istanbul ignore next */ []);
312
+ this.selectedTemplate = contentChild(RatingSelectedItemTemplateDirective, {
313
+ ...ngDevMode ? { debugName: "selectedTemplate" } : /* istanbul ignore next */ {},
314
+ read: TemplateRef
315
+ });
316
+ this.ariaDescribedBy = input(null, {
317
+ ...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
318
+ alias: "aria-describedby"
319
+ });
320
+ this.ariaLabel = input(null, {
321
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
322
+ alias: "aria-label"
323
+ });
324
+ this.ariaLabelledBy = input(null, {
325
+ ...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
326
+ alias: "aria-labelledby"
327
+ });
328
+ this.ariaValueText = input(null, ...ngDevMode ? [{ debugName: "ariaValueText" }] : /* istanbul ignore next */ []);
329
+ this.clearable = input(false, {
330
+ ...ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {},
331
+ transform: booleanAttribute
332
+ });
333
+ this.color = input(...ngDevMode ? [void 0, { debugName: "color" }] : /* istanbul ignore next */ []);
334
+ this.disabled = input(false, {
335
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
336
+ transform: booleanAttribute
337
+ });
338
+ this.icon = input("star", ...ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []);
339
+ this.invalid = input(false, {
340
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
341
+ transform: booleanAttribute
342
+ });
343
+ this.itemsCount = input(5, {
344
+ ...ngDevMode ? { debugName: "itemsCount" } : /* istanbul ignore next */ {},
345
+ transform: normalizeItemsCount
346
+ });
347
+ this.label = input(null, ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
348
+ this.labelPosition = input("after", ...ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []);
349
+ this.precision = input("item", ...ngDevMode ? [{ debugName: "precision" }] : /* istanbul ignore next */ []);
350
+ this.readonly = input(false, {
351
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
352
+ transform: booleanAttribute
353
+ });
354
+ this.required = input(false, {
355
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
356
+ transform: booleanAttribute
357
+ });
358
+ this.selection = input("continuous", ...ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []);
359
+ this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
360
+ this.tabindex = input(0, {
361
+ ...ngDevMode ? { debugName: "tabindex" } : /* istanbul ignore next */ {},
362
+ transform: (value) => numberAttribute(value, 0)
363
+ });
364
+ this.touch = output();
365
+ this.touched = input(false, {
366
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
367
+ transform: booleanAttribute
368
+ });
369
+ this.userClass = input("", {
370
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
371
+ alias: "class"
372
+ });
373
+ this.value = model(0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
374
+ afterNextRender(() => {
375
+ const control = this.controlElement().nativeElement;
376
+ const onPointerMove = (event) => this.onPointerMove(event);
377
+ this.#zone.runOutsideAngular(() => control.addEventListener("pointermove", onPointerMove));
378
+ this.#destroyRef.onDestroy(() => control.removeEventListener("pointermove", onPointerMove));
379
+ if (isDevMode() && !this.ariaLabel() && !this.effectiveAriaLabelledBy()) console.warn("[Mona Rating] A rating needs an accessible name. Set aria-label, aria-labelledby or label, or use a mona-label.", control);
380
+ });
381
+ }
382
+ blur() {
383
+ this.controlElement().nativeElement.blur();
384
+ }
385
+ focus(options) {
386
+ if (!this.effectiveDisabled()) this.controlElement().nativeElement.focus(options);
387
+ }
388
+ setLabelledBy(id) {
389
+ this.#label.setLabelledBy(id);
390
+ }
391
+ createItemContext(item) {
392
+ return {
393
+ $implicit: item.index,
394
+ fill: this.getItemFill(item.itemValue),
395
+ hovered: this.previewActive(),
396
+ index: item.index,
397
+ itemValue: item.itemValue,
398
+ selected: !this.previewActive()
399
+ };
400
+ }
401
+ getItemFill(itemValue) {
402
+ const displayValue = this.displayValue();
403
+ if (this.selection() === "single") return getSingleItemFill(displayValue, itemValue);
404
+ return getContinuousItemFill(displayValue, itemValue);
405
+ }
406
+ onBlur() {
407
+ this.previewValue.set(null);
408
+ this.touch.emit();
409
+ }
410
+ onClick(event) {
411
+ if (this.interactionDisabled()) return;
412
+ const candidate = this.getCandidateFromPointerEvent(event);
413
+ if (candidate === null) return;
414
+ const normalized = this.normalizeCandidate(candidate);
415
+ if (normalized !== this.normalizedValue()) this.value.set(normalized);
416
+ else if (this.clearable()) {
417
+ this.previewValue.set(null);
418
+ this.value.set(0);
419
+ }
420
+ this.touch.emit();
421
+ }
422
+ onKeydown(event) {
423
+ if (this.interactionDisabled()) return;
424
+ const action = this.getKeyAction(event.key);
425
+ if (action === null) return;
426
+ event.preventDefault();
427
+ this.previewValue.set(null);
428
+ const current = this.normalizedValue();
429
+ let next;
430
+ switch (action) {
431
+ case "decrease":
432
+ next = this.normalizeCandidate(current - this.interactionStep());
433
+ break;
434
+ case "end":
435
+ next = this.itemsCount();
436
+ break;
437
+ case "home":
438
+ next = 0;
439
+ break;
440
+ case "increase":
441
+ next = this.normalizeCandidate(current + this.interactionStep());
442
+ break;
443
+ case "pageDecrease":
444
+ next = this.normalizeCandidate(current - 1);
445
+ break;
446
+ case "pageIncrease": next = this.normalizeCandidate(current + 1);
447
+ }
448
+ if (next !== current) this.value.set(next);
449
+ }
450
+ onPointerLeave() {
451
+ this.previewValue.set(null);
452
+ }
453
+ onPointerMove(event) {
454
+ if (this.interactionDisabled()) return;
455
+ const candidate = this.getCandidateFromPointerEvent(event);
456
+ if (candidate !== null) this.previewValue.set(candidate);
457
+ }
458
+ getCandidateFromPointerEvent(event) {
459
+ const controlElement = this.controlElement().nativeElement;
460
+ const itemElement = event.target?.closest("[data-rating-index]") ?? null;
461
+ if (!itemElement || !controlElement.contains(itemElement)) return null;
462
+ const itemValue = Number(itemElement.getAttribute("data-rating-value"));
463
+ if (this.precision() === "item") return itemValue;
464
+ const itemRect = itemElement.getBoundingClientRect();
465
+ const direction = getComputedStyle(controlElement).direction === "rtl" ? "rtl" : "ltr";
466
+ return getPointerRatingValue({
467
+ clientX: event.clientX,
468
+ direction,
469
+ itemRect,
470
+ itemValue,
471
+ precision: this.precision()
472
+ });
473
+ }
474
+ getKeyAction(key) {
475
+ const isRtl = this.isRtl();
476
+ const decreaseKey = isRtl ? "ArrowRight" : "ArrowLeft";
477
+ const increaseKey = isRtl ? "ArrowLeft" : "ArrowRight";
478
+ switch (key) {
479
+ case increaseKey:
480
+ case "ArrowUp": return "increase";
481
+ case decreaseKey:
482
+ case "ArrowDown": return "decrease";
483
+ case "Home": return "home";
484
+ case "End": return "end";
485
+ case "PageDown": return "pageDecrease";
486
+ case "PageUp": return "pageIncrease";
487
+ default: return null;
488
+ }
489
+ }
490
+ normalizeCandidate(value) {
491
+ return normalizeRatingValue(value, this.itemsCount(), this.precision());
492
+ }
493
+ static {
494
+ this.ɵfac = i0.ɵɵngDeclareFactory({
495
+ minVersion: "12.0.0",
496
+ version: "22.2.6",
497
+ ngImport: i0,
498
+ type: RatingComponent,
499
+ deps: [],
500
+ target: i0.ɵɵFactoryTarget.Component
501
+ });
502
+ }
503
+ static {
504
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
505
+ minVersion: "17.0.0",
506
+ version: "22.2.6",
507
+ type: RatingComponent,
508
+ isStandalone: true,
509
+ selector: "mona-rating",
510
+ inputs: {
511
+ ariaDescribedBy: {
512
+ classPropertyName: "ariaDescribedBy",
513
+ publicName: "aria-describedby",
514
+ isSignal: true,
515
+ isRequired: false,
516
+ transformFunction: null
517
+ },
518
+ ariaLabel: {
519
+ classPropertyName: "ariaLabel",
520
+ publicName: "aria-label",
521
+ isSignal: true,
522
+ isRequired: false,
523
+ transformFunction: null
524
+ },
525
+ ariaLabelledBy: {
526
+ classPropertyName: "ariaLabelledBy",
527
+ publicName: "aria-labelledby",
528
+ isSignal: true,
529
+ isRequired: false,
530
+ transformFunction: null
531
+ },
532
+ ariaValueText: {
533
+ classPropertyName: "ariaValueText",
534
+ publicName: "ariaValueText",
535
+ isSignal: true,
536
+ isRequired: false,
537
+ transformFunction: null
538
+ },
539
+ clearable: {
540
+ classPropertyName: "clearable",
541
+ publicName: "clearable",
542
+ isSignal: true,
543
+ isRequired: false,
544
+ transformFunction: null
545
+ },
546
+ color: {
547
+ classPropertyName: "color",
548
+ publicName: "color",
549
+ isSignal: true,
550
+ isRequired: false,
551
+ transformFunction: null
552
+ },
553
+ disabled: {
554
+ classPropertyName: "disabled",
555
+ publicName: "disabled",
556
+ isSignal: true,
557
+ isRequired: false,
558
+ transformFunction: null
559
+ },
560
+ icon: {
561
+ classPropertyName: "icon",
562
+ publicName: "icon",
563
+ isSignal: true,
564
+ isRequired: false,
565
+ transformFunction: null
566
+ },
567
+ invalid: {
568
+ classPropertyName: "invalid",
569
+ publicName: "invalid",
570
+ isSignal: true,
571
+ isRequired: false,
572
+ transformFunction: null
573
+ },
574
+ itemsCount: {
575
+ classPropertyName: "itemsCount",
576
+ publicName: "itemsCount",
577
+ isSignal: true,
578
+ isRequired: false,
579
+ transformFunction: null
580
+ },
581
+ label: {
582
+ classPropertyName: "label",
583
+ publicName: "label",
584
+ isSignal: true,
585
+ isRequired: false,
586
+ transformFunction: null
587
+ },
588
+ labelPosition: {
589
+ classPropertyName: "labelPosition",
590
+ publicName: "labelPosition",
591
+ isSignal: true,
592
+ isRequired: false,
593
+ transformFunction: null
594
+ },
595
+ precision: {
596
+ classPropertyName: "precision",
597
+ publicName: "precision",
598
+ isSignal: true,
599
+ isRequired: false,
600
+ transformFunction: null
601
+ },
602
+ readonly: {
603
+ classPropertyName: "readonly",
604
+ publicName: "readonly",
605
+ isSignal: true,
606
+ isRequired: false,
607
+ transformFunction: null
608
+ },
609
+ required: {
610
+ classPropertyName: "required",
611
+ publicName: "required",
612
+ isSignal: true,
613
+ isRequired: false,
614
+ transformFunction: null
615
+ },
616
+ selection: {
617
+ classPropertyName: "selection",
618
+ publicName: "selection",
619
+ isSignal: true,
620
+ isRequired: false,
621
+ transformFunction: null
622
+ },
623
+ size: {
624
+ classPropertyName: "size",
625
+ publicName: "size",
626
+ isSignal: true,
627
+ isRequired: false,
628
+ transformFunction: null
629
+ },
630
+ tabindex: {
631
+ classPropertyName: "tabindex",
632
+ publicName: "tabindex",
633
+ isSignal: true,
634
+ isRequired: false,
635
+ transformFunction: null
636
+ },
637
+ touched: {
638
+ classPropertyName: "touched",
639
+ publicName: "touched",
640
+ isSignal: true,
641
+ isRequired: false,
642
+ transformFunction: null
643
+ },
644
+ userClass: {
645
+ classPropertyName: "userClass",
646
+ publicName: "class",
647
+ isSignal: true,
648
+ isRequired: false,
649
+ transformFunction: null
650
+ },
651
+ value: {
652
+ classPropertyName: "value",
653
+ publicName: "value",
654
+ isSignal: true,
655
+ isRequired: false,
656
+ transformFunction: null
657
+ }
658
+ },
659
+ outputs: {
660
+ touch: "touch",
661
+ value: "valueChange"
662
+ },
663
+ queries: [
664
+ {
665
+ propertyName: "hoveredTemplate",
666
+ first: true,
667
+ predicate: RatingHoveredItemTemplateDirective,
668
+ descendants: true,
669
+ read: TemplateRef,
670
+ isSignal: true
671
+ },
672
+ {
673
+ propertyName: "itemTemplate",
674
+ first: true,
675
+ predicate: RatingItemTemplateDirective,
676
+ descendants: true,
677
+ read: TemplateRef,
678
+ isSignal: true
679
+ },
680
+ {
681
+ propertyName: "selectedTemplate",
682
+ first: true,
683
+ predicate: RatingSelectedItemTemplateDirective,
684
+ descendants: true,
685
+ read: TemplateRef,
686
+ isSignal: true
687
+ }
688
+ ],
689
+ viewQueries: [{
690
+ propertyName: "controlElement",
691
+ first: true,
692
+ predicate: ["ratingControl"],
693
+ descendants: true,
694
+ isSignal: true
695
+ }],
696
+ ngImport: i0,
697
+ template: "<div [class]=\"containerClasses()\">\n @if (label() && labelPosition() === \"before\") {\n <span [id]=\"labelId\" [class]=\"labelClasses()\">{{ label() }}</span>\n }\n\n <div\n #ratingControl\n role=\"slider\"\n [class]=\"controlClasses()\"\n [attr.tabindex]=\"effectiveTabIndex()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"itemsCount()\"\n [attr.aria-valuenow]=\"normalizedValue()\"\n [attr.aria-valuetext]=\"effectiveAriaValueText()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"effectiveAriaLabelledBy()\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"invalidState() || null\"\n [attr.data-disabled]=\"effectiveDisabled() || null\"\n [attr.data-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n [attr.data-precision]=\"precision()\"\n [attr.data-selection]=\"selection()\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n (pointerleave)=\"onPointerLeave()\"\n (click)=\"onClick($event)\">\n @for (item of items(); track item.itemValue) {\n <span\n [class]=\"itemClasses()\"\n [attr.data-rating-index]=\"item.index\"\n [attr.data-rating-value]=\"item.itemValue\"\n aria-hidden=\"true\">\n <span class=\"flex h-full w-full items-center justify-center\">\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"createItemContext(item)\">\n </ng-container>\n } @else {\n <svg lucideIcon [lucideIcon]=\"iconToRender()\" [class]=\"iconClasses()\" fill=\"none\"></svg>\n }\n </span>\n\n @let fill = getItemFill(item.itemValue);\n\n @if (fill > 0) {\n <span [class]=\"overlayClipClasses()\" [style.inline-size.%]=\"fill * 100\">\n <span\n [class]=\"overlayContentClasses()\"\n [attr.data-state]=\"activeState()\"\n [style.color]=\"effectiveDisabled() ? null : overlayColor()\">\n @if (overlayTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"overlayTemplate()!\"\n [ngTemplateOutletContext]=\"createItemContext(item)\">\n </ng-container>\n } @else {\n <svg\n lucideIcon\n [lucideIcon]=\"iconToRender()\"\n [class]=\"overlayIconClasses()\"\n fill=\"currentColor\"></svg>\n }\n </span>\n </span>\n }\n </span>\n }\n </div>\n\n @if (label() && labelPosition() === \"after\") {\n <span [id]=\"labelId\" [class]=\"labelClasses()\">{{ label() }}</span>\n }\n</div>\n",
698
+ dependencies: [{
699
+ kind: "directive",
700
+ type: NgTemplateOutlet,
701
+ selector: "[ngTemplateOutlet]",
702
+ inputs: [
703
+ "ngTemplateOutletContext",
704
+ "ngTemplateOutlet",
705
+ "ngTemplateOutletInjector"
706
+ ]
707
+ }, {
708
+ kind: "component",
709
+ type: LucideDynamicIcon,
710
+ selector: "svg[lucideIcon]",
711
+ inputs: ["lucideIcon"]
712
+ }]
713
+ });
714
+ }
715
+ };
716
+ i0.ɵɵngDeclareClassMetadata({
717
+ minVersion: "12.0.0",
718
+ version: "22.2.6",
719
+ ngImport: i0,
720
+ type: RatingComponent,
721
+ decorators: [{
722
+ type: Component,
723
+ args: [{
724
+ selector: "mona-rating",
725
+ imports: [NgTemplateOutlet, LucideDynamicIcon],
726
+ template: "<div [class]=\"containerClasses()\">\n @if (label() && labelPosition() === \"before\") {\n <span [id]=\"labelId\" [class]=\"labelClasses()\">{{ label() }}</span>\n }\n\n <div\n #ratingControl\n role=\"slider\"\n [class]=\"controlClasses()\"\n [attr.tabindex]=\"effectiveTabIndex()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"itemsCount()\"\n [attr.aria-valuenow]=\"normalizedValue()\"\n [attr.aria-valuetext]=\"effectiveAriaValueText()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"effectiveAriaLabelledBy()\"\n [attr.aria-describedby]=\"ariaDescribedBy()\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"invalidState() || null\"\n [attr.data-disabled]=\"effectiveDisabled() || null\"\n [attr.data-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n [attr.data-precision]=\"precision()\"\n [attr.data-selection]=\"selection()\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n (pointerleave)=\"onPointerLeave()\"\n (click)=\"onClick($event)\">\n @for (item of items(); track item.itemValue) {\n <span\n [class]=\"itemClasses()\"\n [attr.data-rating-index]=\"item.index\"\n [attr.data-rating-value]=\"item.itemValue\"\n aria-hidden=\"true\">\n <span class=\"flex h-full w-full items-center justify-center\">\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"createItemContext(item)\">\n </ng-container>\n } @else {\n <svg lucideIcon [lucideIcon]=\"iconToRender()\" [class]=\"iconClasses()\" fill=\"none\"></svg>\n }\n </span>\n\n @let fill = getItemFill(item.itemValue);\n\n @if (fill > 0) {\n <span [class]=\"overlayClipClasses()\" [style.inline-size.%]=\"fill * 100\">\n <span\n [class]=\"overlayContentClasses()\"\n [attr.data-state]=\"activeState()\"\n [style.color]=\"effectiveDisabled() ? null : overlayColor()\">\n @if (overlayTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"overlayTemplate()!\"\n [ngTemplateOutletContext]=\"createItemContext(item)\">\n </ng-container>\n } @else {\n <svg\n lucideIcon\n [lucideIcon]=\"iconToRender()\"\n [class]=\"overlayIconClasses()\"\n fill=\"currentColor\"></svg>\n }\n </span>\n </span>\n }\n </span>\n }\n </div>\n\n @if (label() && labelPosition() === \"after\") {\n <span [id]=\"labelId\" [class]=\"labelClasses()\">{{ label() }}</span>\n }\n</div>\n"
727
+ }]
728
+ }],
729
+ ctorParameters: () => [],
730
+ propDecorators: {
731
+ controlElement: [{
732
+ type: i0.ViewChild,
733
+ args: ["ratingControl", { isSignal: true }]
734
+ }],
735
+ hoveredTemplate: [{
736
+ type: i0.ContentChild,
737
+ args: [i0.forwardRef(() => RatingHoveredItemTemplateDirective), {
738
+ read: TemplateRef,
739
+ isSignal: true
740
+ }]
741
+ }],
742
+ itemTemplate: [{
743
+ type: i0.ContentChild,
744
+ args: [i0.forwardRef(() => RatingItemTemplateDirective), {
745
+ read: TemplateRef,
746
+ isSignal: true
747
+ }]
748
+ }],
749
+ selectedTemplate: [{
750
+ type: i0.ContentChild,
751
+ args: [i0.forwardRef(() => RatingSelectedItemTemplateDirective), {
752
+ read: TemplateRef,
753
+ isSignal: true
754
+ }]
755
+ }],
756
+ ariaDescribedBy: [{
757
+ type: i0.Input,
758
+ args: [{
759
+ isSignal: true,
760
+ alias: "aria-describedby",
761
+ required: false
762
+ }]
763
+ }],
764
+ ariaLabel: [{
765
+ type: i0.Input,
766
+ args: [{
767
+ isSignal: true,
768
+ alias: "aria-label",
769
+ required: false
770
+ }]
771
+ }],
772
+ ariaLabelledBy: [{
773
+ type: i0.Input,
774
+ args: [{
775
+ isSignal: true,
776
+ alias: "aria-labelledby",
777
+ required: false
778
+ }]
779
+ }],
780
+ ariaValueText: [{
781
+ type: i0.Input,
782
+ args: [{
783
+ isSignal: true,
784
+ alias: "ariaValueText",
785
+ required: false
786
+ }]
787
+ }],
788
+ clearable: [{
789
+ type: i0.Input,
790
+ args: [{
791
+ isSignal: true,
792
+ alias: "clearable",
793
+ required: false
794
+ }]
795
+ }],
796
+ color: [{
797
+ type: i0.Input,
798
+ args: [{
799
+ isSignal: true,
800
+ alias: "color",
801
+ required: false
802
+ }]
803
+ }],
804
+ disabled: [{
805
+ type: i0.Input,
806
+ args: [{
807
+ isSignal: true,
808
+ alias: "disabled",
809
+ required: false
810
+ }]
811
+ }],
812
+ icon: [{
813
+ type: i0.Input,
814
+ args: [{
815
+ isSignal: true,
816
+ alias: "icon",
817
+ required: false
818
+ }]
819
+ }],
820
+ invalid: [{
821
+ type: i0.Input,
822
+ args: [{
823
+ isSignal: true,
824
+ alias: "invalid",
825
+ required: false
826
+ }]
827
+ }],
828
+ itemsCount: [{
829
+ type: i0.Input,
830
+ args: [{
831
+ isSignal: true,
832
+ alias: "itemsCount",
833
+ required: false
834
+ }]
835
+ }],
836
+ label: [{
837
+ type: i0.Input,
838
+ args: [{
839
+ isSignal: true,
840
+ alias: "label",
841
+ required: false
842
+ }]
843
+ }],
844
+ labelPosition: [{
845
+ type: i0.Input,
846
+ args: [{
847
+ isSignal: true,
848
+ alias: "labelPosition",
849
+ required: false
850
+ }]
851
+ }],
852
+ precision: [{
853
+ type: i0.Input,
854
+ args: [{
855
+ isSignal: true,
856
+ alias: "precision",
857
+ required: false
858
+ }]
859
+ }],
860
+ readonly: [{
861
+ type: i0.Input,
862
+ args: [{
863
+ isSignal: true,
864
+ alias: "readonly",
865
+ required: false
866
+ }]
867
+ }],
868
+ required: [{
869
+ type: i0.Input,
870
+ args: [{
871
+ isSignal: true,
872
+ alias: "required",
873
+ required: false
874
+ }]
875
+ }],
876
+ selection: [{
877
+ type: i0.Input,
878
+ args: [{
879
+ isSignal: true,
880
+ alias: "selection",
881
+ required: false
882
+ }]
883
+ }],
884
+ size: [{
885
+ type: i0.Input,
886
+ args: [{
887
+ isSignal: true,
888
+ alias: "size",
889
+ required: false
890
+ }]
891
+ }],
892
+ tabindex: [{
893
+ type: i0.Input,
894
+ args: [{
895
+ isSignal: true,
896
+ alias: "tabindex",
897
+ required: false
898
+ }]
899
+ }],
900
+ touch: [{
901
+ type: i0.Output,
902
+ args: ["touch"]
903
+ }],
904
+ touched: [{
905
+ type: i0.Input,
906
+ args: [{
907
+ isSignal: true,
908
+ alias: "touched",
909
+ required: false
910
+ }]
911
+ }],
912
+ userClass: [{
913
+ type: i0.Input,
914
+ args: [{
915
+ isSignal: true,
916
+ alias: "class",
917
+ required: false
918
+ }]
919
+ }],
920
+ value: [{
921
+ type: i0.Input,
922
+ args: [{
923
+ isSignal: true,
924
+ alias: "value",
925
+ required: false
926
+ }]
927
+ }, {
928
+ type: i0.Output,
929
+ args: ["valueChange"]
930
+ }]
931
+ }
932
+ });
684
933
  export { RATING_DEFAULT_MESSAGES, RatingComponent, RatingHoveredItemTemplateDirective, RatingItemTemplateDirective, RatingSelectedItemTemplateDirective };
685
- //# sourceMappingURL=nanahoshi-mona-ui-rating.mjs.map
934
+
935
+ //# sourceMappingURL=nanahoshi-mona-ui-rating.mjs.map