@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,43 +1,60 @@
1
- import { NgTemplateOutlet } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { Directive, inject, DestroyRef, DOCUMENT, ElementRef, computed, signal, viewChild, contentChild, TemplateRef, input, booleanAttribute, output, model, effect, untracked, Component } from '@angular/core';
4
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
- import { LucideDropletOff, LucideCircleX } from '@lucide/angular';
6
- import { ButtonDirective } from '@nanahoshi/mona-ui/button';
7
- import { ColorGradientComponent } from '@nanahoshi/mona-ui/color-gradient';
8
- import { ColorPaletteComponent } from '@nanahoshi/mona-ui/color-palette';
9
- import { themeControlSurfaceClasses, injectLabelAssociation, injectEffectiveDisabled, themeOverlaySurfaceClasses, createElementControlId, colorKey } from '@nanahoshi/mona-ui/internal';
10
- import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
11
- import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
12
- import { PopupService, dropdownPopupAnimation } from '@nanahoshi/mona-ui/popup';
13
- import { take, fromEvent, takeUntil } from 'rxjs';
14
- import { twMerge } from 'tailwind-merge';
15
- import { cva } from 'class-variance-authority';
16
-
17
- class ColorPickerValueTemplateDirective {
18
- static ngTemplateContextGuard(_directive, _context) {
19
- return true;
20
- }
21
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPickerValueTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
22
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ColorPickerValueTemplateDirective, isStandalone: true, selector: "ng-template[monaColorPickerValueTemplate]", ngImport: i0 }); }
23
- }
24
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPickerValueTemplateDirective, decorators: [{
25
- type: Directive,
26
- args: [{
27
- selector: "ng-template[monaColorPickerValueTemplate]"
28
- }]
29
- }] });
30
-
31
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
32
- // 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, DOCUMENT, DestroyRef, Directive, ElementRef, TemplateRef, booleanAttribute, computed, contentChild, effect, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
4
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
5
+ import { LucideCircleX, LucideDropletOff } from "@lucide/angular";
6
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
7
+ import { ColorGradientComponent } from "@nanahoshi/mona-ui/color-gradient";
8
+ import { ColorPaletteComponent } from "@nanahoshi/mona-ui/color-palette";
9
+ import { colorKey, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
10
+ import { IndicatorIconComponent } from "@nanahoshi/mona-ui/internal/indicator-icon";
11
+ import { MonaI18nService } from "@nanahoshi/mona-ui/i18n";
12
+ import { PopupService, dropdownPopupAnimation } from "@nanahoshi/mona-ui/popup";
13
+ import { fromEvent, take, takeUntil } from "rxjs";
14
+ import { twMerge } from "tailwind-merge";
15
+ import { cva } from "class-variance-authority";
16
+ var ColorPickerValueTemplateDirective = class ColorPickerValueTemplateDirective {
17
+ static ngTemplateContextGuard(_directive, _context) {
18
+ return true;
19
+ }
20
+ static {
21
+ this.ɵfac = i0.ɵɵngDeclareFactory({
22
+ minVersion: "12.0.0",
23
+ version: "22.2.6",
24
+ ngImport: i0,
25
+ type: ColorPickerValueTemplateDirective,
26
+ deps: [],
27
+ target: i0.ɵɵFactoryTarget.Directive
28
+ });
29
+ }
30
+ static {
31
+ this.ɵdir = i0.ɵɵngDeclareDirective({
32
+ minVersion: "14.0.0",
33
+ version: "22.2.6",
34
+ type: ColorPickerValueTemplateDirective,
35
+ isStandalone: true,
36
+ selector: "ng-template[monaColorPickerValueTemplate]",
37
+ ngImport: i0
38
+ });
39
+ }
40
+ };
41
+ i0.ɵɵngDeclareClassMetadata({
42
+ minVersion: "12.0.0",
43
+ version: "22.2.6",
44
+ ngImport: i0,
45
+ type: ColorPickerValueTemplateDirective,
46
+ decorators: [{
47
+ type: Directive,
48
+ args: [{ selector: "ng-template[monaColorPickerValueTemplate]" }]
49
+ }]
50
+ });
33
51
  const COLOR_PICKER_DEFAULT_MESSAGES = {
34
- clearColor: "Clear color",
35
- colorGradientPicker: "Color gradient picker",
36
- colorPalettePicker: "Color palette picker",
37
- colorPicker: "Color picker",
38
- noColor: "No color"
52
+ clearColor: "Clear color",
53
+ colorGradientPicker: "Color gradient picker",
54
+ colorPalettePicker: "Color palette picker",
55
+ colorPicker: "Color picker",
56
+ noColor: "No color"
39
57
  };
40
-
41
58
  const colorPickerBaseThemeVariants = cva(`
42
59
  flex items-center
43
60
  cursor-pointer
@@ -64,476 +81,813 @@ const colorPickerBaseThemeVariants = cva(`
64
81
  data-[invalid='true']:focus-within:border-error
65
82
  data-[invalid='true']:focus-within:ring-error/35
66
83
  `, {
67
- variants: {
68
- expanded: {
69
- true: "border-focus-indicator ring-2 ring-focus-indicator/35",
70
- false: ""
71
- },
72
- rounded: {
73
- none: "rounded-none",
74
- small: "rounded-sm",
75
- medium: "rounded-md",
76
- large: "rounded-lg",
77
- full: "rounded-full"
78
- },
79
- size: {
80
- large: "h-10 text-base",
81
- medium: "h-9 text-sm",
82
- small: "h-8 text-xs"
83
- }
84
- },
85
- compoundVariants: [
86
- {
87
- expanded: true,
88
- class: "data-[invalid='true']:border-error data-[invalid='true']:ring-error/35"
89
- }
90
- ]
84
+ variants: {
85
+ expanded: {
86
+ true: "border-focus-indicator ring-2 ring-focus-indicator/35",
87
+ false: ""
88
+ },
89
+ rounded: {
90
+ none: "rounded-none",
91
+ small: "rounded-sm",
92
+ medium: "rounded-md",
93
+ large: "rounded-lg",
94
+ full: "rounded-full"
95
+ },
96
+ size: {
97
+ large: "h-10 text-base",
98
+ medium: "h-9 text-sm",
99
+ small: "h-8 text-xs"
100
+ }
101
+ },
102
+ compoundVariants: [{
103
+ expanded: true,
104
+ class: "data-[invalid='true']:border-error data-[invalid='true']:ring-error/35"
105
+ }]
91
106
  });
92
107
  const colorPickerColorThemeVariants = cva(`
93
108
  flex items-center justify-center
94
109
  mx-1
95
110
  forced-color-adjust-none
96
- `, {
97
- variants: {
98
- rounded: {
99
- none: "rounded-none",
100
- small: "rounded-sm",
101
- medium: "rounded-md",
102
- large: "rounded-lg",
103
- full: "rounded-full"
104
- },
105
- size: {
106
- large: "mx-2 h-6 w-6",
107
- medium: "mx-2 h-5 w-5",
108
- small: "mx-1 h-4 w-4"
109
- }
110
- }
111
- });
112
-
111
+ `, { variants: {
112
+ rounded: {
113
+ none: "rounded-none",
114
+ small: "rounded-sm",
115
+ medium: "rounded-md",
116
+ large: "rounded-lg",
117
+ full: "rounded-full"
118
+ },
119
+ size: {
120
+ large: "mx-2 h-6 w-6",
121
+ medium: "mx-2 h-5 w-5",
122
+ small: "mx-1 h-4 w-4"
123
+ }
124
+ } });
113
125
  const TABBABLE_SELECTOR = "a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]";
114
- class ColorPickerComponent {
115
- #destroyRef;
116
- #document;
117
- #hostElementRef;
118
- #i18n;
119
- #label;
120
- /** Read once, so a generator can be used as the palette. */
121
- #paletteItems;
122
- #popupRef;
123
- #popupService;
124
- #destroyed;
125
- constructor() {
126
- this.#destroyRef = inject(DestroyRef);
127
- this.#document = inject(DOCUMENT);
128
- this.#hostElementRef = inject(ElementRef);
129
- this.#i18n = inject(MonaI18nService);
130
- this.#label = injectLabelAssociation({
131
- activate: () => this.focus(),
132
- ariaLabel: () => this.ariaLabel(),
133
- ariaLabelledBy: () => this.ariaLabelledBy()
134
- });
135
- /** Read once, so a generator can be used as the palette. */
136
- this.#paletteItems = computed(() => {
137
- const palette = this.palette();
138
- return typeof palette === "string" ? [] : Array.from(palette);
139
- }, /* @ts-ignore */
140
- ...(ngDevMode ? [{ debugName: "#paletteItems" }] : /* istanbul ignore next */ []));
141
- this.#popupRef = signal(null, /* @ts-ignore */
142
- ...(ngDevMode ? [{ debugName: "#popupRef" }] : /* istanbul ignore next */ []));
143
- this.#popupService = inject(PopupService);
144
- this.#destroyed = false;
145
- this.baseClasses = computed(() => {
146
- const expanded = this.expanded();
147
- const rounded = this.rounded();
148
- const size = this.size();
149
- return twMerge(colorPickerBaseThemeVariants({ expanded, rounded, size }));
150
- }, /* @ts-ignore */
151
- ...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
152
- this.colorClasses = computed(() => {
153
- const rounded = this.rounded();
154
- const size = this.size();
155
- return colorPickerColorThemeVariants({ rounded, size });
156
- }, /* @ts-ignore */
157
- ...(ngDevMode ? [{ debugName: "colorClasses" }] : /* istanbul ignore next */ []));
158
- this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
159
- this.expanded = computed(() => this.#popupRef() !== null, /* @ts-ignore */
160
- ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
161
- this.gradientPopupClasses = `${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay) outline-none focus-visible:outline-hidden`;
162
- this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && !this.value())), /* @ts-ignore */
163
- ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
164
- this.labelledBy = this.#label.labelledBy;
165
- this.messages = this.#i18n.componentMessages("colorPicker", COLOR_PICKER_DEFAULT_MESSAGES);
166
- this.paletteOption = computed(() => {
167
- const palette = this.palette();
168
- return typeof palette === "string" ? palette : this.#paletteItems();
169
- }, /* @ts-ignore */
170
- ...(ngDevMode ? [{ debugName: "paletteOption" }] : /* istanbul ignore next */ []));
171
- this.palettePopupClasses = `flex flex-col p-0.5 max-w-[calc(100vw-1rem)] overflow-auto ${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay) outline-none focus-visible:outline-hidden`;
172
- this.popupId = createElementControlId();
173
- this.popupTemplate = viewChild.required("popupTemplate", /* @ts-ignore */
174
- ...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
175
- this.valueTemplate = contentChild(ColorPickerValueTemplateDirective, { ...(ngDevMode ? { debugName: "valueTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
176
- /** What assistive technology reads as the current color: its name when the palette has one, or the value itself. */
177
- this.valueText = computed(() => {
178
- const value = this.value();
179
- if (!value) {
180
- return this.messages().noColor;
181
- }
182
- const key = colorKey(value, this.#document);
183
- for (const item of this.#paletteItems()) {
184
- if (typeof item !== "string" && item.name && colorKey(item.color, this.#document) === key) {
185
- return item.name;
186
- }
187
- }
188
- return value;
189
- }, /* @ts-ignore */
190
- ...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
191
- /**
192
- * @description Accessible label for the color picker combobox.
193
- * @default ""
194
- */
195
- this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
196
- /**
197
- * @description Id of the element that names the color picker.
198
- * @default ""
199
- */
200
- this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
201
- /**
202
- * @description Whether to close the color picker when a color is selected.
203
- * Only applies when the view is set to "palette".
204
- * @default true
205
- */
206
- this.closeOnSelect = input(true, { ...(ngDevMode ? { debugName: "closeOnSelect" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
207
- /**
208
- * @description The number of columns to display in the color palette.
209
- * Only applies when the view is set to "palette" and the palette is a custom array of colors.
210
- * @default 10
211
- */
212
- this.columns = input(10, /* @ts-ignore */
213
- ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
214
- /**
215
- * @description Renders the component with reduced visual emphasis and removes pointer interaction.
216
- * @default false
217
- */
218
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
219
- /**
220
- * @description The format of the value the gradient view writes. Only applies when the view is set to "gradient".
221
- * @default "hex"
222
- */
223
- this.format = input("hex", /* @ts-ignore */
224
- ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
225
- /**
226
- * @description Marks the color picker as invalid. When bound to a signal form field via `[formField]`,
227
- * this is written by the `FormField` directive.
228
- * @default false
229
- */
230
- this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
231
- /**
232
- * @description Whether to display the opacity slider.
233
- * Only applies when the view is set to "gradient".
234
- * @default true
235
- */
236
- this.opacity = input(true, { ...(ngDevMode ? { debugName: "opacity" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
237
- /**
238
- * @description The type of color palette to use.
239
- * This can be a predefined palette type like "flat", "material", or "websafe",
240
- * or a custom iterable of CSS color strings or `{ color, name }` items.
241
- * @default "flat"
242
- */
243
- this.palette = input("flat", /* @ts-ignore */
244
- ...(ngDevMode ? [{ debugName: "palette" }] : /* istanbul ignore next */ []));
245
- /**
246
- * @description Prevents value changes while preserving the component's visual state. When bound to a signal
247
- * form field via `[formField]`, this is written by the `FormField` directive.
248
- * @default false
249
- */
250
- this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
251
- /**
252
- * @description Sets whether the color picker is required. When bound to a signal form field via `[formField]`,
253
- * this is written by the `FormField` directive.
254
- * @default false
255
- */
256
- this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
257
- /**
258
- * @description Border-radius preset applied to the color picker.
259
- * @default "medium"
260
- */
261
- this.rounded = input("medium", /* @ts-ignore */
262
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
263
- /**
264
- * @description Whether the gradient view has Apply and Cancel buttons. Without them, each change writes the value
265
- * at once. Only applies when the view is set to "gradient".
266
- * @default true
267
- */
268
- this.showButtons = input(true, { ...(ngDevMode ? { debugName: "showButtons" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
269
- /**
270
- * @description Whether to show the clear button to reset the color.
271
- * This is only applicable when the view is set to "palette".
272
- * @default false
273
- */
274
- this.showClearButton = input(false, { ...(ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
275
- /**
276
- * @description Size preset controlling the color picker's dimensions.
277
- * @default "medium"
278
- */
279
- this.size = input("medium", /* @ts-ignore */
280
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
281
- /**
282
- * @description The size of each palette tile, in pixels. Only applies when the view is set to "palette". Below 24,
283
- * tiles miss the minimum target size of WCAG 2.5.8.
284
- * @default 24
285
- */
286
- this.tileSize = input(24, /* @ts-ignore */
287
- ...(ngDevMode ? [{ debugName: "tileSize" }] : /* istanbul ignore next */ []));
288
- /**
289
- * @description Emitted when focus leaves the color picker or its popup closes. A color selected with
290
- * `closeOnSelect` off doesn't emit it until then.
291
- * The `FormField` directive listens to this to mark the field as touched.
292
- */
293
- this.touch = output();
294
- /**
295
- * @description Sets the touched state of the color picker. When bound to a signal form field via `[formField]`,
296
- * this is written by the `FormField` directive.
297
- * @default false
298
- */
299
- this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
300
- /**
301
- * @description Two-way bindable current color value.
302
- * @default null
303
- */
304
- this.value = model(null, /* @ts-ignore */
305
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
306
- /**
307
- * @description The view mode of the color picker.
308
- * This can be either "palette" or "gradient".
309
- * @default "gradient"
310
- */
311
- this.view = input("gradient", /* @ts-ignore */
312
- ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
313
- this.#destroyRef.onDestroy(() => {
314
- this.#destroyed = true;
315
- this.close();
316
- });
317
- effect(() => {
318
- if (this.effectiveDisabled() || this.readonly()) {
319
- untracked(() => this.close());
320
- }
321
- });
322
- }
323
- /**
324
- * @description Moves focus to the color picker.
325
- * @param options Options passed to the native `focus()` call, such as `preventScroll`.
326
- */
327
- focus(options) {
328
- this.#hostElementRef.nativeElement.focus(options);
329
- }
330
- ngOnInit() {
331
- this.setEventListeners();
332
- this.setKeyboardEventListeners();
333
- }
334
- /**
335
- * @internal
336
- */
337
- setLabelledBy(id) {
338
- this.#label.setLabelledBy(id);
339
- }
340
- onClearClick() {
341
- if (this.effectiveDisabled() || this.readonly()) {
342
- return;
343
- }
344
- this.value.set(null);
345
- this.touch.emit();
346
- if (this.#popupRef() && this.closeOnSelect()) {
347
- this.close();
348
- }
349
- }
350
- onColorGradientApply() {
351
- this.close();
352
- }
353
- onColorGradientCancel() {
354
- this.close();
355
- }
356
- onColorGradientValueChange(value) {
357
- if (value === undefined) {
358
- return;
359
- }
360
- if (this.effectiveDisabled() || this.readonly()) {
361
- return;
362
- }
363
- this.value.set(value);
364
- }
365
- onColorPaletteValueChange(value) {
366
- if (this.effectiveDisabled() || this.readonly()) {
367
- return;
368
- }
369
- this.value.set(value);
370
- }
371
- onPaletteColorSelect() {
372
- if (this.closeOnSelect()) {
373
- this.close();
374
- }
375
- }
376
- open() {
377
- if (this.effectiveDisabled() || this.readonly()) {
378
- return;
379
- }
380
- const popupRef = this.#popupService.create({
381
- anchor: this.#hostElementRef.nativeElement,
382
- anchorConnectionPoint: "bottomleft",
383
- animation: dropdownPopupAnimation,
384
- closeOnOutsideClick: true,
385
- content: this.popupTemplate(),
386
- hasBackdrop: false,
387
- offset: { horizontal: -1, vertical: 2 },
388
- popupConnectionPoint: "topleft",
389
- // Returns to the picker, unless the user moved focus elsewhere, such as by clicking another field.
390
- restoreFocus: true,
391
- withPush: false
392
- });
393
- popupRef.opened.pipe(take(1), takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
394
- // Deferred so this runs after the browser's default focus-on-click behavior for the
395
- // (focusable) host element, otherwise that default action steals focus back from the popup.
396
- setTimeout(() => {
397
- this.focusPopupContent();
398
- this.setupPopupKeyboardHandling();
399
- });
400
- });
401
- this.#popupRef.set(popupRef);
402
- popupRef.closed.pipe(take(1)).subscribe(() => {
403
- this.#popupRef.set(null);
404
- if (!this.#destroyed) {
405
- this.touch.emit();
406
- }
407
- });
408
- }
409
- close() {
410
- this.#popupRef()?.close();
411
- }
412
- /**
413
- * Opens on the selected swatch, or the first one, in the palette view, and on the saturation and value handle in the
414
- * gradient view.
415
- */
416
- focusPopupContent() {
417
- const overlayElement = this.#popupRef()?.overlayRef.overlayElement;
418
- const selector = this.view() === "palette" ? '[data-color-index][tabindex="0"]' : '[role="slider"]';
419
- overlayElement?.querySelector(selector)?.focus();
420
- }
421
- setEventListeners() {
422
- fromEvent(this.#hostElementRef.nativeElement, "click")
423
- .pipe(takeUntilDestroyed(this.#destroyRef))
424
- .subscribe(() => {
425
- if (this.effectiveDisabled() || this.readonly()) {
426
- return;
427
- }
428
- if (this.#popupRef()) {
429
- this.close();
430
- return;
431
- }
432
- this.open();
433
- });
434
- }
435
- setKeyboardEventListeners() {
436
- fromEvent(this.#hostElementRef.nativeElement, "keydown")
437
- .pipe(takeUntilDestroyed(this.#destroyRef))
438
- .subscribe((event) => {
439
- if (this.effectiveDisabled() || this.readonly()) {
440
- return;
441
- }
442
- switch (event.key) {
443
- case "Enter":
444
- case " ":
445
- case "ArrowDown":
446
- case "ArrowUp":
447
- event.preventDefault();
448
- event.stopPropagation();
449
- if (!this.#popupRef()) {
450
- this.open();
451
- }
452
- break;
453
- case "Tab":
454
- if (this.#popupRef()) {
455
- this.close();
456
- }
457
- break;
458
- }
459
- });
460
- // Focus moving into the popup isn't the end of the interaction: closing the popup marks the field as touched.
461
- fromEvent(this.#hostElementRef.nativeElement, "blur")
462
- .pipe(takeUntilDestroyed(this.#destroyRef))
463
- .subscribe(() => {
464
- if (!this.#popupRef()) {
465
- this.touch.emit();
466
- }
467
- });
468
- }
469
- setupPopupKeyboardHandling() {
470
- const popupRef = this.#popupRef();
471
- if (!popupRef) {
472
- return;
473
- }
474
- const overlayElement = popupRef.overlayRef.overlayElement;
475
- if (!overlayElement) {
476
- return;
477
- }
478
- fromEvent(overlayElement, "keydown")
479
- .pipe(takeUntil(popupRef.closed), takeUntilDestroyed(this.#destroyRef))
480
- .subscribe(event => {
481
- if (event.key === "Tab" && this.tabLeavesPopup(event, overlayElement)) {
482
- event.preventDefault();
483
- this.close();
484
- }
485
- });
486
- }
487
- /**
488
- * The popup isn't modal, so Tab walks through its controls, and going past either end closes it. Focus then returns
489
- * to the picker, and the next Tab continues down the page.
490
- */
491
- tabLeavesPopup(event, overlayElement) {
492
- const tabbable = Array.from(overlayElement.querySelectorAll(TABBABLE_SELECTOR)).filter(element => element.tabIndex >= 0);
493
- const index = tabbable.indexOf(this.#document.activeElement);
494
- return event.shiftKey ? index <= 0 : index === tabbable.length - 1;
495
- }
496
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
497
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorPickerComponent, isStandalone: true, selector: "mona-color-picker", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, palette: { classPropertyName: "palette", publicName: "palette", 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 }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showButtons: { classPropertyName: "showButtons", publicName: "showButtons", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, tileSize: { classPropertyName: "tileSize", publicName: "tileSize", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touch: "touch", value: "valueChange" }, host: { properties: { "class": "baseClasses()", "attr.tabindex": "effectiveDisabled() ? -1 : 0", "attr.data-disabled": "effectiveDisabled()", "attr.data-invalid": "invalidState() || null", "attr.data-open": "expanded() || null", "attr.data-readonly": "readonly()", "attr.data-required": "required() || null", "attr.role": "'combobox'", "attr.aria-controls": "expanded() ? popupId : null", "attr.aria-expanded": "expanded() ? 'true' : 'false'", "attr.aria-haspopup": "'dialog'", "attr.aria-label": "labelledBy() ? null : ariaLabel() || messages().colorPicker", "attr.aria-labelledby": "labelledBy()", "attr.aria-disabled": "effectiveDisabled()", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.aria-readonly": "readonly()", "attr.aria-required": "required()" } }, queries: [{ propertyName: "valueTemplate", first: true, predicate: ColorPickerValueTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "<span class=\"sr-only\">{{ valueText() }}</span>\n@if (valueTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: value() }\"></ng-container>\n} @else {\n <div [style.background]=\"value()\" [class]=\"colorClasses()\">\n @if (!value()) {\n <svg lucideXCircle [size]=\"16\" aria-hidden=\"true\"></svg>\n }\n </div>\n}\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (view() === \"palette\") {\n <div\n [id]=\"popupId\"\n [class]=\"palettePopupClasses\"\n tabindex=\"-1\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorPalettePicker\"\n data-palette-container>\n @if (showClearButton()) {\n <div class=\"flex items-center justify-end p-1\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [attr.aria-label]=\"messages().clearColor\"\n (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n }\n <mona-color-palette\n [clearable]=\"false\"\n [palette]=\"paletteOption()\"\n [columns]=\"columns()\"\n [readonly]=\"readonly()\"\n [tileSize]=\"tileSize()\"\n [value]=\"value()\"\n (valueChange)=\"onColorPaletteValueChange($event)\"\n (colorSelect)=\"onPaletteColorSelect()\"></mona-color-palette>\n </div>\n } @else if (view() === \"gradient\") {\n <div\n [id]=\"popupId\"\n [class]=\"gradientPopupClasses\"\n tabindex=\"-1\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorGradientPicker\">\n <mona-color-gradient\n [format]=\"format()\"\n [opacity]=\"opacity()\"\n [rounded]=\"rounded()\"\n [showButtons]=\"showButtons()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorGradientValueChange($event)\"\n (apply)=\"onColorGradientApply()\"\n (cancel)=\"onColorGradientCancel()\"></mona-color-gradient>\n </div>\n }\n</ng-template>\n", dependencies: [{ kind: "component", type: LucideDropletOff, selector: "svg[lucideDropletOff]" }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class", "value"], outputs: ["lookChange", "selectedChange"] }, { kind: "component", type: ColorPaletteComponent, selector: "mona-color-palette", inputs: ["aria-label", "aria-labelledby", "clearable", "columns", "disabled", "invalid", "palette", "readonly", "required", "rounded", "tileSize", "touched", "value"], outputs: ["colorSelect", "touch", "valueChange"] }, { kind: "component", type: ColorGradientComponent, selector: "mona-color-gradient", inputs: ["aria-label", "aria-labelledby", "disabled", "format", "invalid", "opacity", "readonly", "required", "rounded", "showButtons", "showColorInputs", "showHexInput", "touched", "value"], outputs: ["apply", "cancel", "touch", "valueChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideCircleX, selector: "svg[lucideCircleX], svg[lucideXCircle]" }, { kind: "component", type: IndicatorIconComponent, selector: "mona-indicator-icon", inputs: ["icon", "interactive", "label", "preset", "size", "class"], outputs: ["activate"] }] }); }
498
- }
499
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPickerComponent, decorators: [{
500
- type: Component,
501
- args: [{ selector: "mona-color-picker", imports: [
502
- LucideDropletOff,
503
- ButtonDirective,
504
- ColorPaletteComponent,
505
- ColorGradientComponent,
506
- NgTemplateOutlet,
507
- LucideCircleX,
508
- IndicatorIconComponent
509
- ], host: {
510
- "[class]": "baseClasses()",
511
- "[attr.tabindex]": "effectiveDisabled() ? -1 : 0",
512
- "[attr.data-disabled]": "effectiveDisabled()",
513
- "[attr.data-invalid]": "invalidState() || null",
514
- "[attr.data-open]": "expanded() || null",
515
- "[attr.data-readonly]": "readonly()",
516
- "[attr.data-required]": "required() || null",
517
- "[attr.role]": "'combobox'",
518
- "[attr.aria-controls]": "expanded() ? popupId : null",
519
- "[attr.aria-expanded]": "expanded() ? 'true' : 'false'",
520
- "[attr.aria-haspopup]": "'dialog'",
521
- "[attr.aria-label]": "labelledBy() ? null : ariaLabel() || messages().colorPicker",
522
- "[attr.aria-labelledby]": "labelledBy()",
523
- "[attr.aria-disabled]": "effectiveDisabled()",
524
- "[attr.aria-invalid]": "invalidState() ? 'true' : null",
525
- "[attr.aria-readonly]": "readonly()",
526
- "[attr.aria-required]": "required()"
527
- }, template: "<span class=\"sr-only\">{{ valueText() }}</span>\n@if (valueTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: value() }\"></ng-container>\n} @else {\n <div [style.background]=\"value()\" [class]=\"colorClasses()\">\n @if (!value()) {\n <svg lucideXCircle [size]=\"16\" aria-hidden=\"true\"></svg>\n }\n </div>\n}\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (view() === \"palette\") {\n <div\n [id]=\"popupId\"\n [class]=\"palettePopupClasses\"\n tabindex=\"-1\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorPalettePicker\"\n data-palette-container>\n @if (showClearButton()) {\n <div class=\"flex items-center justify-end p-1\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [attr.aria-label]=\"messages().clearColor\"\n (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n }\n <mona-color-palette\n [clearable]=\"false\"\n [palette]=\"paletteOption()\"\n [columns]=\"columns()\"\n [readonly]=\"readonly()\"\n [tileSize]=\"tileSize()\"\n [value]=\"value()\"\n (valueChange)=\"onColorPaletteValueChange($event)\"\n (colorSelect)=\"onPaletteColorSelect()\"></mona-color-palette>\n </div>\n } @else if (view() === \"gradient\") {\n <div\n [id]=\"popupId\"\n [class]=\"gradientPopupClasses\"\n tabindex=\"-1\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorGradientPicker\">\n <mona-color-gradient\n [format]=\"format()\"\n [opacity]=\"opacity()\"\n [rounded]=\"rounded()\"\n [showButtons]=\"showButtons()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorGradientValueChange($event)\"\n (apply)=\"onColorGradientApply()\"\n (cancel)=\"onColorGradientCancel()\"></mona-color-gradient>\n </div>\n }\n</ng-template>\n" }]
528
- }], ctorParameters: () => [], propDecorators: { popupTemplate: [{ type: i0.ViewChild, args: ["popupTemplate", { isSignal: true }] }], valueTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ColorPickerValueTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], palette: [{ type: i0.Input, args: [{ isSignal: true, alias: "palette", required: false }] }], 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 }] }], showButtons: [{ type: i0.Input, args: [{ isSignal: true, alias: "showButtons", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], tileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "tileSize", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }] } });
529
-
530
- /*
531
- * Public API Surface of @nanahoshi/mona-ui/color-picker
532
- */
533
-
534
- /**
535
- * Generated bundle index. Do not edit.
536
- */
537
-
126
+ var ColorPickerComponent = class ColorPickerComponent {
127
+ #destroyRef;
128
+ #document;
129
+ #hostElementRef;
130
+ #i18n;
131
+ #label;
132
+ #paletteItems;
133
+ #popupRef;
134
+ #popupService;
135
+ #destroyed;
136
+ constructor() {
137
+ this.#destroyRef = inject(DestroyRef);
138
+ this.#document = inject(DOCUMENT);
139
+ this.#hostElementRef = inject(ElementRef);
140
+ this.#i18n = inject(MonaI18nService);
141
+ this.#label = injectLabelAssociation({
142
+ activate: () => this.focus(),
143
+ ariaLabel: () => this.ariaLabel(),
144
+ ariaLabelledBy: () => this.ariaLabelledBy()
145
+ });
146
+ this.#paletteItems = computed(() => {
147
+ const palette = this.palette();
148
+ return typeof palette === "string" ? [] : Array.from(palette);
149
+ }, ...ngDevMode ? [{ debugName: "#paletteItems" }] : /* istanbul ignore next */ []);
150
+ this.#popupRef = signal(null, ...ngDevMode ? [{ debugName: "#popupRef" }] : /* istanbul ignore next */ []);
151
+ this.#popupService = inject(PopupService);
152
+ this.#destroyed = false;
153
+ this.baseClasses = computed(() => {
154
+ const expanded = this.expanded();
155
+ const rounded = this.rounded();
156
+ const size = this.size();
157
+ return twMerge(colorPickerBaseThemeVariants({
158
+ expanded,
159
+ rounded,
160
+ size
161
+ }));
162
+ }, ...ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []);
163
+ this.colorClasses = computed(() => {
164
+ const rounded = this.rounded();
165
+ const size = this.size();
166
+ return colorPickerColorThemeVariants({
167
+ rounded,
168
+ size
169
+ });
170
+ }, ...ngDevMode ? [{ debugName: "colorClasses" }] : /* istanbul ignore next */ []);
171
+ this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
172
+ this.expanded = computed(() => this.#popupRef() !== null, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
173
+ this.gradientPopupClasses = `${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay) outline-none focus-visible:outline-hidden`;
174
+ this.invalidState = computed(() => this.touched() && (this.invalid() || this.required() && !this.value()), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
175
+ this.labelledBy = this.#label.labelledBy;
176
+ this.messages = this.#i18n.componentMessages("colorPicker", COLOR_PICKER_DEFAULT_MESSAGES);
177
+ this.paletteOption = computed(() => {
178
+ const palette = this.palette();
179
+ return typeof palette === "string" ? palette : this.#paletteItems();
180
+ }, ...ngDevMode ? [{ debugName: "paletteOption" }] : /* istanbul ignore next */ []);
181
+ this.palettePopupClasses = `flex flex-col p-0.5 max-w-[calc(100vw-1rem)] overflow-auto ${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay) outline-none focus-visible:outline-hidden`;
182
+ this.popupId = createElementControlId();
183
+ this.popupTemplate = viewChild.required("popupTemplate", ...ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []);
184
+ this.valueTemplate = contentChild(ColorPickerValueTemplateDirective, {
185
+ ...ngDevMode ? { debugName: "valueTemplate" } : /* istanbul ignore next */ {},
186
+ read: TemplateRef
187
+ });
188
+ this.valueText = computed(() => {
189
+ const value = this.value();
190
+ if (!value) return this.messages().noColor;
191
+ const key = colorKey(value, this.#document);
192
+ for (const item of this.#paletteItems()) if (typeof item !== "string" && item.name && colorKey(item.color, this.#document) === key) return item.name;
193
+ return value;
194
+ }, ...ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []);
195
+ this.ariaLabel = input("", {
196
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
197
+ alias: "aria-label"
198
+ });
199
+ this.ariaLabelledBy = input("", {
200
+ ...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
201
+ alias: "aria-labelledby"
202
+ });
203
+ this.closeOnSelect = input(true, {
204
+ ...ngDevMode ? { debugName: "closeOnSelect" } : /* istanbul ignore next */ {},
205
+ transform: booleanAttribute
206
+ });
207
+ this.columns = input(10, ...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
208
+ this.disabled = input(false, {
209
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
210
+ transform: booleanAttribute
211
+ });
212
+ this.format = input("hex", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
213
+ this.invalid = input(false, {
214
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
215
+ transform: booleanAttribute
216
+ });
217
+ this.opacity = input(true, {
218
+ ...ngDevMode ? { debugName: "opacity" } : /* istanbul ignore next */ {},
219
+ transform: booleanAttribute
220
+ });
221
+ this.palette = input("flat", ...ngDevMode ? [{ debugName: "palette" }] : /* istanbul ignore next */ []);
222
+ this.readonly = input(false, {
223
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
224
+ transform: booleanAttribute
225
+ });
226
+ this.required = input(false, {
227
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
228
+ transform: booleanAttribute
229
+ });
230
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
231
+ this.showButtons = input(true, {
232
+ ...ngDevMode ? { debugName: "showButtons" } : /* istanbul ignore next */ {},
233
+ transform: booleanAttribute
234
+ });
235
+ this.showClearButton = input(false, {
236
+ ...ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {},
237
+ transform: booleanAttribute
238
+ });
239
+ this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
240
+ this.tileSize = input(24, ...ngDevMode ? [{ debugName: "tileSize" }] : /* istanbul ignore next */ []);
241
+ this.touch = output();
242
+ this.touched = input(false, {
243
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
244
+ transform: booleanAttribute
245
+ });
246
+ this.value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
247
+ this.view = input("gradient", ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
248
+ this.#destroyRef.onDestroy(() => {
249
+ this.#destroyed = true;
250
+ this.close();
251
+ });
252
+ effect(() => {
253
+ if (this.effectiveDisabled() || this.readonly()) untracked(() => this.close());
254
+ });
255
+ }
256
+ focus(options) {
257
+ this.#hostElementRef.nativeElement.focus(options);
258
+ }
259
+ ngOnInit() {
260
+ this.setEventListeners();
261
+ this.setKeyboardEventListeners();
262
+ }
263
+ setLabelledBy(id) {
264
+ this.#label.setLabelledBy(id);
265
+ }
266
+ onClearClick() {
267
+ if (this.effectiveDisabled() || this.readonly()) return;
268
+ this.value.set(null);
269
+ this.touch.emit();
270
+ if (this.#popupRef() && this.closeOnSelect()) this.close();
271
+ }
272
+ onColorGradientApply() {
273
+ this.close();
274
+ }
275
+ onColorGradientCancel() {
276
+ this.close();
277
+ }
278
+ onColorGradientValueChange(value) {
279
+ if (value === void 0) return;
280
+ if (this.effectiveDisabled() || this.readonly()) return;
281
+ this.value.set(value);
282
+ }
283
+ onColorPaletteValueChange(value) {
284
+ if (this.effectiveDisabled() || this.readonly()) return;
285
+ this.value.set(value);
286
+ }
287
+ onPaletteColorSelect() {
288
+ if (this.closeOnSelect()) this.close();
289
+ }
290
+ open() {
291
+ if (this.effectiveDisabled() || this.readonly()) return;
292
+ const popupRef = this.#popupService.create({
293
+ anchor: this.#hostElementRef.nativeElement,
294
+ anchorConnectionPoint: "bottomleft",
295
+ animation: dropdownPopupAnimation,
296
+ closeOnOutsideClick: true,
297
+ content: this.popupTemplate(),
298
+ hasBackdrop: false,
299
+ offset: {
300
+ horizontal: -1,
301
+ vertical: 2
302
+ },
303
+ popupConnectionPoint: "topleft",
304
+ restoreFocus: true,
305
+ withPush: false
306
+ });
307
+ popupRef.opened.pipe(take(1), takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
308
+ setTimeout(() => {
309
+ this.focusPopupContent();
310
+ this.setupPopupKeyboardHandling();
311
+ });
312
+ });
313
+ this.#popupRef.set(popupRef);
314
+ popupRef.closed.pipe(take(1)).subscribe(() => {
315
+ this.#popupRef.set(null);
316
+ if (!this.#destroyed) this.touch.emit();
317
+ });
318
+ }
319
+ close() {
320
+ this.#popupRef()?.close();
321
+ }
322
+ focusPopupContent() {
323
+ const overlayElement = this.#popupRef()?.overlayRef.overlayElement;
324
+ const selector = this.view() === "palette" ? "[data-color-index][tabindex=\"0\"]" : "[role=\"slider\"]";
325
+ overlayElement?.querySelector(selector)?.focus();
326
+ }
327
+ setEventListeners() {
328
+ fromEvent(this.#hostElementRef.nativeElement, "click").pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
329
+ if (this.effectiveDisabled() || this.readonly()) return;
330
+ if (this.#popupRef()) {
331
+ this.close();
332
+ return;
333
+ }
334
+ this.open();
335
+ });
336
+ }
337
+ setKeyboardEventListeners() {
338
+ fromEvent(this.#hostElementRef.nativeElement, "keydown").pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((event) => {
339
+ if (this.effectiveDisabled() || this.readonly()) return;
340
+ switch (event.key) {
341
+ case "Enter":
342
+ case " ":
343
+ case "ArrowDown":
344
+ case "ArrowUp":
345
+ event.preventDefault();
346
+ event.stopPropagation();
347
+ if (!this.#popupRef()) this.open();
348
+ break;
349
+ case "Tab": if (this.#popupRef()) this.close();
350
+ }
351
+ });
352
+ fromEvent(this.#hostElementRef.nativeElement, "blur").pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
353
+ if (!this.#popupRef()) this.touch.emit();
354
+ });
355
+ }
356
+ setupPopupKeyboardHandling() {
357
+ const popupRef = this.#popupRef();
358
+ if (!popupRef) return;
359
+ const overlayElement = popupRef.overlayRef.overlayElement;
360
+ if (!overlayElement) return;
361
+ fromEvent(overlayElement, "keydown").pipe(takeUntil(popupRef.closed), takeUntilDestroyed(this.#destroyRef)).subscribe((event) => {
362
+ if (event.key === "Tab" && this.tabLeavesPopup(event, overlayElement)) {
363
+ event.preventDefault();
364
+ this.close();
365
+ }
366
+ });
367
+ }
368
+ tabLeavesPopup(event, overlayElement) {
369
+ const tabbable = Array.from(overlayElement.querySelectorAll(TABBABLE_SELECTOR)).filter((element) => element.tabIndex >= 0);
370
+ const index = tabbable.indexOf(this.#document.activeElement);
371
+ return event.shiftKey ? index <= 0 : index === tabbable.length - 1;
372
+ }
373
+ static {
374
+ this.ɵfac = i0.ɵɵngDeclareFactory({
375
+ minVersion: "12.0.0",
376
+ version: "22.2.6",
377
+ ngImport: i0,
378
+ type: ColorPickerComponent,
379
+ deps: [],
380
+ target: i0.ɵɵFactoryTarget.Component
381
+ });
382
+ }
383
+ static {
384
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
385
+ minVersion: "17.0.0",
386
+ version: "22.2.6",
387
+ type: ColorPickerComponent,
388
+ isStandalone: true,
389
+ selector: "mona-color-picker",
390
+ inputs: {
391
+ ariaLabel: {
392
+ classPropertyName: "ariaLabel",
393
+ publicName: "aria-label",
394
+ isSignal: true,
395
+ isRequired: false,
396
+ transformFunction: null
397
+ },
398
+ ariaLabelledBy: {
399
+ classPropertyName: "ariaLabelledBy",
400
+ publicName: "aria-labelledby",
401
+ isSignal: true,
402
+ isRequired: false,
403
+ transformFunction: null
404
+ },
405
+ closeOnSelect: {
406
+ classPropertyName: "closeOnSelect",
407
+ publicName: "closeOnSelect",
408
+ isSignal: true,
409
+ isRequired: false,
410
+ transformFunction: null
411
+ },
412
+ columns: {
413
+ classPropertyName: "columns",
414
+ publicName: "columns",
415
+ isSignal: true,
416
+ isRequired: false,
417
+ transformFunction: null
418
+ },
419
+ disabled: {
420
+ classPropertyName: "disabled",
421
+ publicName: "disabled",
422
+ isSignal: true,
423
+ isRequired: false,
424
+ transformFunction: null
425
+ },
426
+ format: {
427
+ classPropertyName: "format",
428
+ publicName: "format",
429
+ isSignal: true,
430
+ isRequired: false,
431
+ transformFunction: null
432
+ },
433
+ invalid: {
434
+ classPropertyName: "invalid",
435
+ publicName: "invalid",
436
+ isSignal: true,
437
+ isRequired: false,
438
+ transformFunction: null
439
+ },
440
+ opacity: {
441
+ classPropertyName: "opacity",
442
+ publicName: "opacity",
443
+ isSignal: true,
444
+ isRequired: false,
445
+ transformFunction: null
446
+ },
447
+ palette: {
448
+ classPropertyName: "palette",
449
+ publicName: "palette",
450
+ isSignal: true,
451
+ isRequired: false,
452
+ transformFunction: null
453
+ },
454
+ readonly: {
455
+ classPropertyName: "readonly",
456
+ publicName: "readonly",
457
+ isSignal: true,
458
+ isRequired: false,
459
+ transformFunction: null
460
+ },
461
+ required: {
462
+ classPropertyName: "required",
463
+ publicName: "required",
464
+ isSignal: true,
465
+ isRequired: false,
466
+ transformFunction: null
467
+ },
468
+ rounded: {
469
+ classPropertyName: "rounded",
470
+ publicName: "rounded",
471
+ isSignal: true,
472
+ isRequired: false,
473
+ transformFunction: null
474
+ },
475
+ showButtons: {
476
+ classPropertyName: "showButtons",
477
+ publicName: "showButtons",
478
+ isSignal: true,
479
+ isRequired: false,
480
+ transformFunction: null
481
+ },
482
+ showClearButton: {
483
+ classPropertyName: "showClearButton",
484
+ publicName: "showClearButton",
485
+ isSignal: true,
486
+ isRequired: false,
487
+ transformFunction: null
488
+ },
489
+ size: {
490
+ classPropertyName: "size",
491
+ publicName: "size",
492
+ isSignal: true,
493
+ isRequired: false,
494
+ transformFunction: null
495
+ },
496
+ tileSize: {
497
+ classPropertyName: "tileSize",
498
+ publicName: "tileSize",
499
+ isSignal: true,
500
+ isRequired: false,
501
+ transformFunction: null
502
+ },
503
+ touched: {
504
+ classPropertyName: "touched",
505
+ publicName: "touched",
506
+ isSignal: true,
507
+ isRequired: false,
508
+ transformFunction: null
509
+ },
510
+ value: {
511
+ classPropertyName: "value",
512
+ publicName: "value",
513
+ isSignal: true,
514
+ isRequired: false,
515
+ transformFunction: null
516
+ },
517
+ view: {
518
+ classPropertyName: "view",
519
+ publicName: "view",
520
+ isSignal: true,
521
+ isRequired: false,
522
+ transformFunction: null
523
+ }
524
+ },
525
+ outputs: {
526
+ touch: "touch",
527
+ value: "valueChange"
528
+ },
529
+ host: { properties: {
530
+ "class": "baseClasses()",
531
+ "attr.tabindex": "effectiveDisabled() ? -1 : 0",
532
+ "attr.data-disabled": "effectiveDisabled()",
533
+ "attr.data-invalid": "invalidState() || null",
534
+ "attr.data-open": "expanded() || null",
535
+ "attr.data-readonly": "readonly()",
536
+ "attr.data-required": "required() || null",
537
+ "attr.role": "'combobox'",
538
+ "attr.aria-controls": "expanded() ? popupId : null",
539
+ "attr.aria-expanded": "expanded() ? 'true' : 'false'",
540
+ "attr.aria-haspopup": "'dialog'",
541
+ "attr.aria-label": "labelledBy() ? null : ariaLabel() || messages().colorPicker",
542
+ "attr.aria-labelledby": "labelledBy()",
543
+ "attr.aria-disabled": "effectiveDisabled()",
544
+ "attr.aria-invalid": "invalidState() ? 'true' : null",
545
+ "attr.aria-readonly": "readonly()",
546
+ "attr.aria-required": "required()"
547
+ } },
548
+ queries: [{
549
+ propertyName: "valueTemplate",
550
+ first: true,
551
+ predicate: ColorPickerValueTemplateDirective,
552
+ descendants: true,
553
+ read: TemplateRef,
554
+ isSignal: true
555
+ }],
556
+ viewQueries: [{
557
+ propertyName: "popupTemplate",
558
+ first: true,
559
+ predicate: ["popupTemplate"],
560
+ descendants: true,
561
+ isSignal: true
562
+ }],
563
+ ngImport: i0,
564
+ template: "<span class=\"sr-only\">{{ valueText() }}</span>\n@if (valueTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: value() }\"></ng-container>\n} @else {\n <div [style.background]=\"value()\" [class]=\"colorClasses()\">\n @if (!value()) {\n <svg lucideXCircle [size]=\"16\" aria-hidden=\"true\"></svg>\n }\n </div>\n}\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (view() === \"palette\") {\n <div\n [id]=\"popupId\"\n [class]=\"palettePopupClasses\"\n tabindex=\"-1\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorPalettePicker\"\n data-palette-container>\n @if (showClearButton()) {\n <div class=\"flex items-center justify-end p-1\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [attr.aria-label]=\"messages().clearColor\"\n (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n }\n <mona-color-palette\n [clearable]=\"false\"\n [palette]=\"paletteOption()\"\n [columns]=\"columns()\"\n [readonly]=\"readonly()\"\n [tileSize]=\"tileSize()\"\n [value]=\"value()\"\n (valueChange)=\"onColorPaletteValueChange($event)\"\n (colorSelect)=\"onPaletteColorSelect()\"></mona-color-palette>\n </div>\n } @else if (view() === \"gradient\") {\n <div\n [id]=\"popupId\"\n [class]=\"gradientPopupClasses\"\n tabindex=\"-1\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorGradientPicker\">\n <mona-color-gradient\n [format]=\"format()\"\n [opacity]=\"opacity()\"\n [rounded]=\"rounded()\"\n [showButtons]=\"showButtons()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorGradientValueChange($event)\"\n (apply)=\"onColorGradientApply()\"\n (cancel)=\"onColorGradientCancel()\"></mona-color-gradient>\n </div>\n }\n</ng-template>\n",
565
+ dependencies: [
566
+ {
567
+ kind: "component",
568
+ type: LucideDropletOff,
569
+ selector: "svg[lucideDropletOff]"
570
+ },
571
+ {
572
+ kind: "directive",
573
+ type: ButtonDirective,
574
+ selector: "button[monaButton]",
575
+ inputs: [
576
+ "aria-haspopup",
577
+ "disabled",
578
+ "iconOnly",
579
+ "loading",
580
+ "look",
581
+ "rounded",
582
+ "selected",
583
+ "size",
584
+ "tabindex",
585
+ "toggleable",
586
+ "type",
587
+ "class",
588
+ "value"
589
+ ],
590
+ outputs: ["lookChange", "selectedChange"]
591
+ },
592
+ {
593
+ kind: "component",
594
+ type: ColorPaletteComponent,
595
+ selector: "mona-color-palette",
596
+ inputs: [
597
+ "aria-label",
598
+ "aria-labelledby",
599
+ "clearable",
600
+ "columns",
601
+ "disabled",
602
+ "invalid",
603
+ "palette",
604
+ "readonly",
605
+ "required",
606
+ "rounded",
607
+ "tileSize",
608
+ "touched",
609
+ "value"
610
+ ],
611
+ outputs: [
612
+ "colorSelect",
613
+ "touch",
614
+ "valueChange"
615
+ ]
616
+ },
617
+ {
618
+ kind: "component",
619
+ type: ColorGradientComponent,
620
+ selector: "mona-color-gradient",
621
+ inputs: [
622
+ "aria-label",
623
+ "aria-labelledby",
624
+ "disabled",
625
+ "format",
626
+ "invalid",
627
+ "opacity",
628
+ "readonly",
629
+ "required",
630
+ "rounded",
631
+ "showButtons",
632
+ "showColorInputs",
633
+ "showHexInput",
634
+ "touched",
635
+ "value"
636
+ ],
637
+ outputs: [
638
+ "apply",
639
+ "cancel",
640
+ "touch",
641
+ "valueChange"
642
+ ]
643
+ },
644
+ {
645
+ kind: "directive",
646
+ type: NgTemplateOutlet,
647
+ selector: "[ngTemplateOutlet]",
648
+ inputs: [
649
+ "ngTemplateOutletContext",
650
+ "ngTemplateOutlet",
651
+ "ngTemplateOutletInjector"
652
+ ]
653
+ },
654
+ {
655
+ kind: "component",
656
+ type: LucideCircleX,
657
+ selector: "svg[lucideCircleX], svg[lucideXCircle]"
658
+ },
659
+ {
660
+ kind: "component",
661
+ type: IndicatorIconComponent,
662
+ selector: "mona-indicator-icon",
663
+ inputs: [
664
+ "icon",
665
+ "interactive",
666
+ "label",
667
+ "preset",
668
+ "size",
669
+ "class"
670
+ ],
671
+ outputs: ["activate"]
672
+ }
673
+ ]
674
+ });
675
+ }
676
+ };
677
+ i0.ɵɵngDeclareClassMetadata({
678
+ minVersion: "12.0.0",
679
+ version: "22.2.6",
680
+ ngImport: i0,
681
+ type: ColorPickerComponent,
682
+ decorators: [{
683
+ type: Component,
684
+ args: [{
685
+ selector: "mona-color-picker",
686
+ imports: [
687
+ LucideDropletOff,
688
+ ButtonDirective,
689
+ ColorPaletteComponent,
690
+ ColorGradientComponent,
691
+ NgTemplateOutlet,
692
+ LucideCircleX,
693
+ IndicatorIconComponent
694
+ ],
695
+ host: {
696
+ "[class]": "baseClasses()",
697
+ "[attr.tabindex]": "effectiveDisabled() ? -1 : 0",
698
+ "[attr.data-disabled]": "effectiveDisabled()",
699
+ "[attr.data-invalid]": "invalidState() || null",
700
+ "[attr.data-open]": "expanded() || null",
701
+ "[attr.data-readonly]": "readonly()",
702
+ "[attr.data-required]": "required() || null",
703
+ "[attr.role]": "'combobox'",
704
+ "[attr.aria-controls]": "expanded() ? popupId : null",
705
+ "[attr.aria-expanded]": "expanded() ? 'true' : 'false'",
706
+ "[attr.aria-haspopup]": "'dialog'",
707
+ "[attr.aria-label]": "labelledBy() ? null : ariaLabel() || messages().colorPicker",
708
+ "[attr.aria-labelledby]": "labelledBy()",
709
+ "[attr.aria-disabled]": "effectiveDisabled()",
710
+ "[attr.aria-invalid]": "invalidState() ? 'true' : null",
711
+ "[attr.aria-readonly]": "readonly()",
712
+ "[attr.aria-required]": "required()"
713
+ },
714
+ template: "<span class=\"sr-only\">{{ valueText() }}</span>\n@if (valueTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: value() }\"></ng-container>\n} @else {\n <div [style.background]=\"value()\" [class]=\"colorClasses()\">\n @if (!value()) {\n <svg lucideXCircle [size]=\"16\" aria-hidden=\"true\"></svg>\n }\n </div>\n}\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (view() === \"palette\") {\n <div\n [id]=\"popupId\"\n [class]=\"palettePopupClasses\"\n tabindex=\"-1\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorPalettePicker\"\n data-palette-container>\n @if (showClearButton()) {\n <div class=\"flex items-center justify-end p-1\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [attr.aria-label]=\"messages().clearColor\"\n (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n }\n <mona-color-palette\n [clearable]=\"false\"\n [palette]=\"paletteOption()\"\n [columns]=\"columns()\"\n [readonly]=\"readonly()\"\n [tileSize]=\"tileSize()\"\n [value]=\"value()\"\n (valueChange)=\"onColorPaletteValueChange($event)\"\n (colorSelect)=\"onPaletteColorSelect()\"></mona-color-palette>\n </div>\n } @else if (view() === \"gradient\") {\n <div\n [id]=\"popupId\"\n [class]=\"gradientPopupClasses\"\n tabindex=\"-1\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorGradientPicker\">\n <mona-color-gradient\n [format]=\"format()\"\n [opacity]=\"opacity()\"\n [rounded]=\"rounded()\"\n [showButtons]=\"showButtons()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorGradientValueChange($event)\"\n (apply)=\"onColorGradientApply()\"\n (cancel)=\"onColorGradientCancel()\"></mona-color-gradient>\n </div>\n }\n</ng-template>\n"
715
+ }]
716
+ }],
717
+ ctorParameters: () => [],
718
+ propDecorators: {
719
+ popupTemplate: [{
720
+ type: i0.ViewChild,
721
+ args: ["popupTemplate", { isSignal: true }]
722
+ }],
723
+ valueTemplate: [{
724
+ type: i0.ContentChild,
725
+ args: [i0.forwardRef(() => ColorPickerValueTemplateDirective), {
726
+ read: TemplateRef,
727
+ isSignal: true
728
+ }]
729
+ }],
730
+ ariaLabel: [{
731
+ type: i0.Input,
732
+ args: [{
733
+ isSignal: true,
734
+ alias: "aria-label",
735
+ required: false
736
+ }]
737
+ }],
738
+ ariaLabelledBy: [{
739
+ type: i0.Input,
740
+ args: [{
741
+ isSignal: true,
742
+ alias: "aria-labelledby",
743
+ required: false
744
+ }]
745
+ }],
746
+ closeOnSelect: [{
747
+ type: i0.Input,
748
+ args: [{
749
+ isSignal: true,
750
+ alias: "closeOnSelect",
751
+ required: false
752
+ }]
753
+ }],
754
+ columns: [{
755
+ type: i0.Input,
756
+ args: [{
757
+ isSignal: true,
758
+ alias: "columns",
759
+ required: false
760
+ }]
761
+ }],
762
+ disabled: [{
763
+ type: i0.Input,
764
+ args: [{
765
+ isSignal: true,
766
+ alias: "disabled",
767
+ required: false
768
+ }]
769
+ }],
770
+ format: [{
771
+ type: i0.Input,
772
+ args: [{
773
+ isSignal: true,
774
+ alias: "format",
775
+ required: false
776
+ }]
777
+ }],
778
+ invalid: [{
779
+ type: i0.Input,
780
+ args: [{
781
+ isSignal: true,
782
+ alias: "invalid",
783
+ required: false
784
+ }]
785
+ }],
786
+ opacity: [{
787
+ type: i0.Input,
788
+ args: [{
789
+ isSignal: true,
790
+ alias: "opacity",
791
+ required: false
792
+ }]
793
+ }],
794
+ palette: [{
795
+ type: i0.Input,
796
+ args: [{
797
+ isSignal: true,
798
+ alias: "palette",
799
+ required: false
800
+ }]
801
+ }],
802
+ readonly: [{
803
+ type: i0.Input,
804
+ args: [{
805
+ isSignal: true,
806
+ alias: "readonly",
807
+ required: false
808
+ }]
809
+ }],
810
+ required: [{
811
+ type: i0.Input,
812
+ args: [{
813
+ isSignal: true,
814
+ alias: "required",
815
+ required: false
816
+ }]
817
+ }],
818
+ rounded: [{
819
+ type: i0.Input,
820
+ args: [{
821
+ isSignal: true,
822
+ alias: "rounded",
823
+ required: false
824
+ }]
825
+ }],
826
+ showButtons: [{
827
+ type: i0.Input,
828
+ args: [{
829
+ isSignal: true,
830
+ alias: "showButtons",
831
+ required: false
832
+ }]
833
+ }],
834
+ showClearButton: [{
835
+ type: i0.Input,
836
+ args: [{
837
+ isSignal: true,
838
+ alias: "showClearButton",
839
+ required: false
840
+ }]
841
+ }],
842
+ size: [{
843
+ type: i0.Input,
844
+ args: [{
845
+ isSignal: true,
846
+ alias: "size",
847
+ required: false
848
+ }]
849
+ }],
850
+ tileSize: [{
851
+ type: i0.Input,
852
+ args: [{
853
+ isSignal: true,
854
+ alias: "tileSize",
855
+ required: false
856
+ }]
857
+ }],
858
+ touch: [{
859
+ type: i0.Output,
860
+ args: ["touch"]
861
+ }],
862
+ touched: [{
863
+ type: i0.Input,
864
+ args: [{
865
+ isSignal: true,
866
+ alias: "touched",
867
+ required: false
868
+ }]
869
+ }],
870
+ value: [{
871
+ type: i0.Input,
872
+ args: [{
873
+ isSignal: true,
874
+ alias: "value",
875
+ required: false
876
+ }]
877
+ }, {
878
+ type: i0.Output,
879
+ args: ["valueChange"]
880
+ }],
881
+ view: [{
882
+ type: i0.Input,
883
+ args: [{
884
+ isSignal: true,
885
+ alias: "view",
886
+ required: false
887
+ }]
888
+ }]
889
+ }
890
+ });
538
891
  export { COLOR_PICKER_DEFAULT_MESSAGES, ColorPickerComponent, ColorPickerValueTemplateDirective };
539
- //# sourceMappingURL=nanahoshi-mona-ui-color-picker.mjs.map
892
+
893
+ //# sourceMappingURL=nanahoshi-mona-ui-color-picker.mjs.map