@nanahoshi/mona-ui 0.24.11 → 0.25.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 (163) hide show
  1. package/README.md +9 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +11 -10
  3. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +37 -20
  4. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +239 -47
  5. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +184 -31
  6. package/fesm2022/nanahoshi-mona-ui-button.mjs +47 -11
  7. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +17 -13
  8. package/fesm2022/nanahoshi-mona-ui-card.mjs +54 -30
  9. package/fesm2022/nanahoshi-mona-ui-chart.mjs +27 -22
  10. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +112 -31
  11. package/fesm2022/nanahoshi-mona-ui-chip.mjs +131 -89
  12. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +59 -19
  13. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +118 -41
  14. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +243 -212
  15. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +155 -86
  16. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +161 -131
  17. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +12 -11
  18. package/fesm2022/nanahoshi-mona-ui-common.mjs +18 -1
  19. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +10 -9
  20. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +10 -9
  21. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +2 -2
  22. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +2 -2
  23. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +10 -9
  24. package/fesm2022/nanahoshi-mona-ui-editor.mjs +25 -24
  25. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +202 -33
  26. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +31 -10
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1 -1
  28. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs} +2 -2
  29. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs → nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs} +4 -4
  30. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs → nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs} +7 -7
  31. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs} +4 -4
  32. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs} +27 -29
  33. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  34. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +39 -4
  35. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +2 -2
  36. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +1 -1
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +5 -5
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +7 -7
  39. package/fesm2022/nanahoshi-mona-ui-internal.mjs +183 -47
  40. package/fesm2022/nanahoshi-mona-ui-label.mjs +111 -15
  41. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1 -1
  42. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1 -1
  43. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +33 -4
  44. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +33 -4
  45. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +33 -4
  46. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +33 -4
  47. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +33 -4
  48. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +33 -4
  49. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +33 -4
  50. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +33 -4
  51. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +33 -4
  52. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +33 -4
  53. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +33 -4
  54. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +33 -4
  55. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +33 -4
  56. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +2 -2
  57. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +14 -13
  58. package/fesm2022/nanahoshi-mona-ui-notification.mjs +1 -1
  59. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +13 -12
  60. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +192 -56
  61. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1 -1
  62. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +3 -1
  63. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2 -2
  64. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +60 -29
  65. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +334 -37
  66. package/fesm2022/nanahoshi-mona-ui-rating.mjs +84 -30
  67. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +274 -108
  68. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +127 -37
  69. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +2 -2
  70. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +595 -170
  71. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +3 -2
  72. package/fesm2022/nanahoshi-mona-ui-slider.mjs +323 -166
  73. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +167 -82
  74. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +3 -3
  75. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +273 -165
  76. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +219 -132
  77. package/fesm2022/nanahoshi-mona-ui-switch.mjs +84 -32
  78. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +337 -116
  79. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +10 -12
  80. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +21 -8
  81. package/fesm2022/nanahoshi-mona-ui-theme.mjs +444 -88
  82. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +10 -9
  83. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +15 -14
  84. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +17 -3
  85. package/fesm2022/nanahoshi-mona-ui-window.mjs +1 -1
  86. package/i18n/catalogs/en-US.messages.json +33 -4
  87. package/locales/ar-sa/ar-sa.messages.json +33 -4
  88. package/locales/de-de/de-de.messages.json +33 -4
  89. package/locales/es-es/es-es.messages.json +33 -4
  90. package/locales/fr-fr/fr-fr.messages.json +33 -4
  91. package/locales/id-id/id-id.messages.json +33 -4
  92. package/locales/it-it/it-it.messages.json +33 -4
  93. package/locales/ja-jp/ja-jp.messages.json +33 -4
  94. package/locales/ko-kr/ko-kr.messages.json +33 -4
  95. package/locales/pt-br/pt-br.messages.json +33 -4
  96. package/locales/ru-ru/ru-ru.messages.json +33 -4
  97. package/locales/tr-tr/tr-tr.messages.json +33 -4
  98. package/locales/zh-cn/zh-cn.messages.json +33 -4
  99. package/locales/zh-tw/zh-tw.messages.json +33 -4
  100. package/package.json +2 -1
  101. package/styles.css +156 -0
  102. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -0
  103. package/types/nanahoshi-mona-ui-avatar.d.ts +18 -11
  104. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +62 -14
  105. package/types/nanahoshi-mona-ui-button-group.d.ts +86 -16
  106. package/types/nanahoshi-mona-ui-button.d.ts +26 -3
  107. package/types/nanahoshi-mona-ui-calendar.d.ts +1 -0
  108. package/types/nanahoshi-mona-ui-card.d.ts +22 -6
  109. package/types/nanahoshi-mona-ui-check-box.d.ts +54 -13
  110. package/types/nanahoshi-mona-ui-chip.d.ts +31 -18
  111. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +21 -5
  112. package/types/nanahoshi-mona-ui-collapsible.d.ts +20 -11
  113. package/types/nanahoshi-mona-ui-color-gradient.d.ts +62 -36
  114. package/types/nanahoshi-mona-ui-color-palette.d.ts +65 -27
  115. package/types/nanahoshi-mona-ui-color-picker.d.ts +64 -23
  116. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -0
  117. package/types/nanahoshi-mona-ui-common.d.ts +28 -2
  118. package/types/nanahoshi-mona-ui-date-picker.d.ts +1 -0
  119. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +1 -0
  120. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +1 -0
  121. package/types/nanahoshi-mona-ui-editor.d.ts +1 -0
  122. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +51 -7
  123. package/types/nanahoshi-mona-ui-fieldset.d.ts +18 -4
  124. package/types/nanahoshi-mona-ui-grid.d.ts +0 -1
  125. package/types/nanahoshi-mona-ui-i18n.d.ts +38 -3
  126. package/types/nanahoshi-mona-ui-internal.d.ts +95 -14
  127. package/types/nanahoshi-mona-ui-label.d.ts +17 -2
  128. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +29 -0
  129. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +29 -0
  130. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +29 -0
  131. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +29 -0
  132. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +29 -0
  133. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +29 -0
  134. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +29 -0
  135. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +29 -0
  136. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +29 -0
  137. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +29 -0
  138. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +29 -0
  139. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +29 -0
  140. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +29 -0
  141. package/types/nanahoshi-mona-ui-multi-select.d.ts +1 -0
  142. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -0
  143. package/types/nanahoshi-mona-ui-otp-input.d.ts +49 -12
  144. package/types/nanahoshi-mona-ui-placeholder.d.ts +2 -1
  145. package/types/nanahoshi-mona-ui-progress-bar.d.ts +21 -9
  146. package/types/nanahoshi-mona-ui-radio-button.d.ts +165 -20
  147. package/types/nanahoshi-mona-ui-rating.d.ts +21 -6
  148. package/types/nanahoshi-mona-ui-scroll-view.d.ts +59 -27
  149. package/types/nanahoshi-mona-ui-segmented.d.ts +52 -24
  150. package/types/nanahoshi-mona-ui-sidebar.d.ts +104 -41
  151. package/types/nanahoshi-mona-ui-skeleton.d.ts +1 -1
  152. package/types/nanahoshi-mona-ui-slider.d.ts +99 -35
  153. package/types/nanahoshi-mona-ui-spinner.d.ts +9 -5
  154. package/types/nanahoshi-mona-ui-splitter.d.ts +31 -10
  155. package/types/nanahoshi-mona-ui-stepper.d.ts +58 -12
  156. package/types/nanahoshi-mona-ui-switch.d.ts +32 -10
  157. package/types/nanahoshi-mona-ui-tabs.d.ts +75 -20
  158. package/types/nanahoshi-mona-ui-text-area.d.ts +7 -7
  159. package/types/nanahoshi-mona-ui-text-box.d.ts +2 -0
  160. package/types/nanahoshi-mona-ui-theme.d.ts +392 -15
  161. package/types/nanahoshi-mona-ui-time-picker.d.ts +1 -0
  162. package/types/nanahoshi-mona-ui-time-selector.d.ts +1 -0
  163. package/types/nanahoshi-mona-ui-tooltip.d.ts +7 -1
@@ -1,12 +1,12 @@
1
1
  import { NgTemplateOutlet } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { Directive, inject, DestroyRef, ElementRef, signal, computed, viewChild, contentChild, TemplateRef, input, output, model, Component } 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
4
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
5
  import { LucideDropletOff, LucideCircleX } from '@lucide/angular';
6
6
  import { ButtonDirective } from '@nanahoshi/mona-ui/button';
7
7
  import { ColorGradientComponent } from '@nanahoshi/mona-ui/color-gradient';
8
8
  import { ColorPaletteComponent } from '@nanahoshi/mona-ui/color-palette';
9
- import { themeControlSurfaceClasses, themeOverlaySurfaceClasses, createElementControlId } from '@nanahoshi/mona-ui/internal';
9
+ import { themeControlSurfaceClasses, injectLabelAssociation, injectEffectiveDisabled, themeOverlaySurfaceClasses, createElementControlId, colorKey } from '@nanahoshi/mona-ui/internal';
10
10
  import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
11
11
  import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
12
12
  import { PopupService, dropdownPopupAnimation } from '@nanahoshi/mona-ui/popup';
@@ -15,6 +15,9 @@ import { twMerge } from 'tailwind-merge';
15
15
  import { cva } from 'class-variance-authority';
16
16
 
17
17
  class ColorPickerValueTemplateDirective {
18
+ static ngTemplateContextGuard(_directive, _context) {
19
+ return true;
20
+ }
18
21
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPickerValueTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
19
22
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ColorPickerValueTemplateDirective, isStandalone: true, selector: "ng-template[monaColorPickerValueTemplate]", ngImport: i0 }); }
20
23
  }
@@ -31,7 +34,8 @@ const COLOR_PICKER_DEFAULT_MESSAGES = {
31
34
  clearColor: "Clear color",
32
35
  colorGradientPicker: "Color gradient picker",
33
36
  colorPalettePicker: "Color palette picker",
34
- colorPicker: "Color picker"
37
+ colorPicker: "Color picker",
38
+ noColor: "No color"
35
39
  };
36
40
 
37
41
  const colorPickerBaseThemeVariants = cva(`
@@ -39,7 +43,7 @@ const colorPickerBaseThemeVariants = cva(`
39
43
  cursor-pointer
40
44
  ${themeControlSurfaceClasses} text-foreground
41
45
  border border-input-border
42
- shadow-(--shadow-control) outline-none
46
+ shadow-(--shadow-control) outline-none focus-visible:outline-hidden
43
47
  transition-[color,box-shadow,border] duration-(--mona-motion-standard) ease-in-out
44
48
 
45
49
  data-[disabled='true']:pointer-events-none
@@ -88,6 +92,7 @@ const colorPickerBaseThemeVariants = cva(`
88
92
  const colorPickerColorThemeVariants = cva(`
89
93
  flex items-center justify-center
90
94
  mx-1
95
+ forced-color-adjust-none
91
96
  `, {
92
97
  variants: {
93
98
  rounded: {
@@ -105,14 +110,38 @@ const colorPickerColorThemeVariants = cva(`
105
110
  }
106
111
  });
107
112
 
113
+ const TABBABLE_SELECTOR = "a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]";
108
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;
109
125
  constructor() {
110
126
  this.#destroyRef = inject(DestroyRef);
127
+ this.#document = inject(DOCUMENT);
111
128
  this.#hostElementRef = inject(ElementRef);
112
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 */ []));
113
141
  this.#popupRef = signal(null, /* @ts-ignore */
114
142
  ...(ngDevMode ? [{ debugName: "#popupRef" }] : /* istanbul ignore next */ []));
115
143
  this.#popupService = inject(PopupService);
144
+ this.#destroyed = false;
116
145
  this.baseClasses = computed(() => {
117
146
  const expanded = this.expanded();
118
147
  const rounded = this.rounded();
@@ -126,29 +155,55 @@ class ColorPickerComponent {
126
155
  return colorPickerColorThemeVariants({ rounded, size });
127
156
  }, /* @ts-ignore */
128
157
  ...(ngDevMode ? [{ debugName: "colorClasses" }] : /* istanbul ignore next */ []));
158
+ this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
129
159
  this.expanded = computed(() => this.#popupRef() !== null, /* @ts-ignore */
130
160
  ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
131
- this.gradientPopupClasses = `${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay)`;
161
+ this.gradientPopupClasses = `${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay) outline-none focus-visible:outline-hidden`;
132
162
  this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && !this.value())), /* @ts-ignore */
133
163
  ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
164
+ this.labelledBy = this.#label.labelledBy;
134
165
  this.messages = this.#i18n.componentMessages("colorPicker", COLOR_PICKER_DEFAULT_MESSAGES);
135
- this.palettePopupClasses = `flex flex-col p-0.5 ${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay) outline-none`;
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`;
136
172
  this.popupId = createElementControlId();
137
173
  this.popupTemplate = viewChild.required("popupTemplate", /* @ts-ignore */
138
174
  ...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
139
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 */ []));
140
191
  /**
141
192
  * @description Accessible label for the color picker combobox.
142
193
  * @default ""
143
194
  */
144
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" });
145
201
  /**
146
202
  * @description Whether to close the color picker when a color is selected.
147
203
  * Only applies when the view is set to "palette".
148
204
  * @default true
149
205
  */
150
- this.closeOnSelect = input(true, /* @ts-ignore */
151
- ...(ngDevMode ? [{ debugName: "closeOnSelect" }] : /* istanbul ignore next */ []));
206
+ this.closeOnSelect = input(true, { ...(ngDevMode ? { debugName: "closeOnSelect" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
152
207
  /**
153
208
  * @description The number of columns to display in the color palette.
154
209
  * Only applies when the view is set to "palette" and the palette is a custom array of colors.
@@ -160,26 +215,29 @@ class ColorPickerComponent {
160
215
  * @description Renders the component with reduced visual emphasis and removes pointer interaction.
161
216
  * @default false
162
217
  */
163
- this.disabled = input(false, /* @ts-ignore */
164
- ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
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 */ []));
165
225
  /**
166
226
  * @description Marks the color picker as invalid. When bound to a signal form field via `[formField]`,
167
227
  * this is written by the `FormField` directive.
168
228
  * @default false
169
229
  */
170
- this.invalid = input(false, /* @ts-ignore */
171
- ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
230
+ this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
172
231
  /**
173
232
  * @description Whether to display the opacity slider.
174
233
  * Only applies when the view is set to "gradient".
175
234
  * @default true
176
235
  */
177
- this.opacity = input(true, /* @ts-ignore */
178
- ...(ngDevMode ? [{ debugName: "opacity" }] : /* istanbul ignore next */ []));
236
+ this.opacity = input(true, { ...(ngDevMode ? { debugName: "opacity" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
179
237
  /**
180
238
  * @description The type of color palette to use.
181
239
  * This can be a predefined palette type like "flat", "material", or "websafe",
182
- * or a custom iterable of colors.
240
+ * or a custom iterable of CSS color strings or `{ color, name }` items.
183
241
  * @default "flat"
184
242
  */
185
243
  this.palette = input("flat", /* @ts-ignore */
@@ -189,28 +247,31 @@ class ColorPickerComponent {
189
247
  * form field via `[formField]`, this is written by the `FormField` directive.
190
248
  * @default false
191
249
  */
192
- this.readonly = input(false, /* @ts-ignore */
193
- ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
250
+ this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
194
251
  /**
195
252
  * @description Sets whether the color picker is required. When bound to a signal form field via `[formField]`,
196
253
  * this is written by the `FormField` directive.
197
254
  * @default false
198
255
  */
199
- this.required = input(false, /* @ts-ignore */
200
- ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
256
+ this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
201
257
  /**
202
258
  * @description Border-radius preset applied to the color picker.
203
259
  * @default "medium"
204
260
  */
205
261
  this.rounded = input("medium", /* @ts-ignore */
206
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 });
207
269
  /**
208
270
  * @description Whether to show the clear button to reset the color.
209
271
  * This is only applicable when the view is set to "palette".
210
272
  * @default false
211
273
  */
212
- this.showClearButton = input(false, /* @ts-ignore */
213
- ...(ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []));
274
+ this.showClearButton = input(false, { ...(ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
214
275
  /**
215
276
  * @description Size preset controlling the color picker's dimensions.
216
277
  * @default "medium"
@@ -218,7 +279,15 @@ class ColorPickerComponent {
218
279
  this.size = input("medium", /* @ts-ignore */
219
280
  ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
220
281
  /**
221
- * @description Emitted when the color picker is interacted with on blur or color selection.
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.
222
291
  * The `FormField` directive listens to this to mark the field as touched.
223
292
  */
224
293
  this.touch = output();
@@ -227,8 +296,7 @@ class ColorPickerComponent {
227
296
  * this is written by the `FormField` directive.
228
297
  * @default false
229
298
  */
230
- this.touched = input(false, /* @ts-ignore */
231
- ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
299
+ this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
232
300
  /**
233
301
  * @description Two-way bindable current color value.
234
302
  * @default null
@@ -242,18 +310,35 @@ class ColorPickerComponent {
242
310
  */
243
311
  this.view = input("gradient", /* @ts-ignore */
244
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);
245
329
  }
246
- #destroyRef;
247
- #hostElementRef;
248
- #i18n;
249
- #popupRef;
250
- #popupService;
251
330
  ngOnInit() {
252
331
  this.setEventListeners();
253
332
  this.setKeyboardEventListeners();
254
333
  }
334
+ /**
335
+ * @internal
336
+ */
337
+ setLabelledBy(id) {
338
+ this.#label.setLabelledBy(id);
339
+ }
255
340
  onClearClick() {
256
- if (this.disabled() || this.readonly()) {
341
+ if (this.effectiveDisabled() || this.readonly()) {
257
342
  return;
258
343
  }
259
344
  this.value.set(null);
@@ -263,63 +348,33 @@ class ColorPickerComponent {
263
348
  }
264
349
  }
265
350
  onColorGradientApply() {
266
- this.#popupRef()?.close();
351
+ this.close();
267
352
  }
268
353
  onColorGradientCancel() {
269
- this.#popupRef()?.close();
270
- }
271
- onColorGradientTouch() {
272
- this.touch.emit();
354
+ this.close();
273
355
  }
274
356
  onColorGradientValueChange(value) {
275
357
  if (value === undefined) {
276
358
  return;
277
359
  }
278
- if (this.disabled() || this.readonly()) {
360
+ if (this.effectiveDisabled() || this.readonly()) {
279
361
  return;
280
362
  }
281
363
  this.value.set(value);
282
364
  }
283
- onColorPaletteTouch() {
284
- this.touch.emit();
285
- }
286
365
  onColorPaletteValueChange(value) {
287
- if (this.disabled() || this.readonly()) {
366
+ if (this.effectiveDisabled() || this.readonly()) {
288
367
  return;
289
368
  }
290
369
  this.value.set(value);
291
- if (this.closeOnSelect()) {
292
- this.#popupRef()?.close();
293
- }
294
370
  }
295
- onPaletteContainerKeyDown(event) {
296
- switch (event.key) {
297
- case "ArrowDown":
298
- case "ArrowRight":
299
- case "ArrowUp":
300
- case "ArrowLeft":
301
- case "Enter":
302
- case " ":
303
- case "Home":
304
- case "End":
305
- // Focus on the first color tile when the user starts navigating
306
- event.preventDefault();
307
- event.stopPropagation();
308
- this.focusFirstColorTile();
309
- break;
310
- case "Escape":
311
- event.preventDefault();
312
- event.stopPropagation();
313
- this.close();
314
- break;
315
- case "Tab":
316
- // Close popup when tabbing out
317
- this.close();
318
- break;
371
+ onPaletteColorSelect() {
372
+ if (this.closeOnSelect()) {
373
+ this.close();
319
374
  }
320
375
  }
321
376
  open() {
322
- if (this.disabled() || this.readonly()) {
377
+ if (this.effectiveDisabled() || this.readonly()) {
323
378
  return;
324
379
  }
325
380
  const popupRef = this.#popupService.create({
@@ -331,6 +386,8 @@ class ColorPickerComponent {
331
386
  hasBackdrop: false,
332
387
  offset: { horizontal: -1, vertical: 2 },
333
388
  popupConnectionPoint: "topleft",
389
+ // Returns to the picker, unless the user moved focus elsewhere, such as by clicking another field.
390
+ restoreFocus: true,
334
391
  withPush: false
335
392
  });
336
393
  popupRef.opened.pipe(take(1), takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
@@ -344,55 +401,28 @@ class ColorPickerComponent {
344
401
  this.#popupRef.set(popupRef);
345
402
  popupRef.closed.pipe(take(1)).subscribe(() => {
346
403
  this.#popupRef.set(null);
347
- this.#hostElementRef.nativeElement.focus();
404
+ if (!this.#destroyed) {
405
+ this.touch.emit();
406
+ }
348
407
  });
349
408
  }
350
409
  close() {
351
- if (this.#popupRef()) {
352
- this.#popupRef()?.close();
353
- }
354
- }
355
- focusFirstColorTile() {
356
- if (!this.#popupRef()) {
357
- return;
358
- }
359
- const overlayElement = this.#popupRef()?.overlayRef.overlayElement;
360
- if (!overlayElement) {
361
- return;
362
- }
363
- const firstColorTile = overlayElement.querySelector('[data-color-index="0"]');
364
- if (firstColorTile) {
365
- firstColorTile.focus();
366
- }
410
+ this.#popupRef()?.close();
367
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
+ */
368
416
  focusPopupContent() {
369
- if (!this.#popupRef()) {
370
- return;
371
- }
372
417
  const overlayElement = this.#popupRef()?.overlayRef.overlayElement;
373
- if (!overlayElement) {
374
- return;
375
- }
376
- if (this.view() === "palette") {
377
- // Focus the palette container, not individual colors
378
- const paletteContainer = overlayElement.querySelector("[data-palette-container]");
379
- if (paletteContainer) {
380
- paletteContainer.focus();
381
- }
382
- }
383
- else if (this.view() === "gradient") {
384
- // Focus the HSV handle in the gradient picker
385
- const hsvHandle = overlayElement.querySelector('[role="slider"]');
386
- if (hsvHandle) {
387
- hsvHandle.focus();
388
- }
389
- }
418
+ const selector = this.view() === "palette" ? '[data-color-index][tabindex="0"]' : '[role="slider"]';
419
+ overlayElement?.querySelector(selector)?.focus();
390
420
  }
391
421
  setEventListeners() {
392
422
  fromEvent(this.#hostElementRef.nativeElement, "click")
393
423
  .pipe(takeUntilDestroyed(this.#destroyRef))
394
424
  .subscribe(() => {
395
- if (this.disabled() || this.readonly()) {
425
+ if (this.effectiveDisabled() || this.readonly()) {
396
426
  return;
397
427
  }
398
428
  if (this.#popupRef()) {
@@ -406,7 +436,7 @@ class ColorPickerComponent {
406
436
  fromEvent(this.#hostElementRef.nativeElement, "keydown")
407
437
  .pipe(takeUntilDestroyed(this.#destroyRef))
408
438
  .subscribe((event) => {
409
- if (this.disabled() || this.readonly()) {
439
+ if (this.effectiveDisabled() || this.readonly()) {
410
440
  return;
411
441
  }
412
442
  switch (event.key) {
@@ -420,13 +450,6 @@ class ColorPickerComponent {
420
450
  this.open();
421
451
  }
422
452
  break;
423
- case "Escape":
424
- event.preventDefault();
425
- event.stopPropagation();
426
- if (this.#popupRef()) {
427
- this.close();
428
- }
429
- break;
430
453
  case "Tab":
431
454
  if (this.#popupRef()) {
432
455
  this.close();
@@ -434,11 +457,13 @@ class ColorPickerComponent {
434
457
  break;
435
458
  }
436
459
  });
437
- // Handle blur events for touched callback
460
+ // Focus moving into the popup isn't the end of the interaction: closing the popup marks the field as touched.
438
461
  fromEvent(this.#hostElementRef.nativeElement, "blur")
439
462
  .pipe(takeUntilDestroyed(this.#destroyRef))
440
463
  .subscribe(() => {
441
- this.touch.emit();
464
+ if (!this.#popupRef()) {
465
+ this.touch.emit();
466
+ }
442
467
  });
443
468
  }
444
469
  setupPopupKeyboardHandling() {
@@ -453,19 +478,23 @@ class ColorPickerComponent {
453
478
  fromEvent(overlayElement, "keydown")
454
479
  .pipe(takeUntil(popupRef.closed), takeUntilDestroyed(this.#destroyRef))
455
480
  .subscribe(event => {
456
- const keyEvent = event;
457
- if (keyEvent.key === "Tab") {
458
- this.close();
459
- }
460
- else if (keyEvent.key === "Escape") {
461
- keyEvent.preventDefault();
462
- keyEvent.stopPropagation();
481
+ if (event.key === "Tab" && this.tabLeavesPopup(event, overlayElement)) {
482
+ event.preventDefault();
463
483
  this.close();
464
484
  }
465
485
  });
466
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
+ }
467
496
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
468
- 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 }, 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 }, 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 }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, 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": "disabled() ? -1 : 0", "attr.data-disabled": "disabled()", "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": "popupId", "attr.aria-expanded": "expanded() ? 'true' : 'false'", "attr.aria-haspopup": "'dialog'", "attr.aria-label": "ariaLabel() || messages().colorPicker", "attr.aria-disabled": "disabled()", "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: "@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\"></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=\"0\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorPalettePicker\"\n data-palette-container\n (keydown)=\"onPaletteContainerKeyDown($event)\">\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 [palette]=\"palette()\"\n [columns]=\"columns()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorPaletteValueChange($event)\"\n (touch)=\"onColorPaletteTouch()\"></mona-color-palette>\n </div>\n } @else if (view() === \"gradient\") {\n <div\n [id]=\"popupId\"\n [class]=\"gradientPopupClasses\"\n tabindex=\"0\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorGradientPicker\">\n <mona-color-gradient\n [opacity]=\"opacity()\"\n [rounded]=\"rounded()\"\n [disabled]=\"disabled() || readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorGradientValueChange($event)\"\n (touch)=\"onColorGradientTouch()\"\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"], outputs: ["lookChange", "selectedChange"] }, { kind: "component", type: ColorPaletteComponent, selector: "mona-color-palette", inputs: ["aria-label", "columns", "disabled", "invalid", "palette", "readonly", "required", "rounded", "tileSize", "touched", "value"], outputs: ["touch", "valueChange"] }, { kind: "component", type: ColorGradientComponent, selector: "mona-color-gradient", inputs: ["disabled", "format", "invalid", "opacity", "required", "rounded", "showButtons", "showHexInput", "showColorInputs", "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"] }] }); }
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"] }] }); }
469
498
  }
470
499
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPickerComponent, decorators: [{
471
500
  type: Component,
@@ -479,23 +508,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
479
508
  IndicatorIconComponent
480
509
  ], host: {
481
510
  "[class]": "baseClasses()",
482
- "[attr.tabindex]": "disabled() ? -1 : 0",
483
- "[attr.data-disabled]": "disabled()",
511
+ "[attr.tabindex]": "effectiveDisabled() ? -1 : 0",
512
+ "[attr.data-disabled]": "effectiveDisabled()",
484
513
  "[attr.data-invalid]": "invalidState() || null",
485
514
  "[attr.data-open]": "expanded() || null",
486
515
  "[attr.data-readonly]": "readonly()",
487
516
  "[attr.data-required]": "required() || null",
488
517
  "[attr.role]": "'combobox'",
489
- "[attr.aria-controls]": "popupId",
518
+ "[attr.aria-controls]": "expanded() ? popupId : null",
490
519
  "[attr.aria-expanded]": "expanded() ? 'true' : 'false'",
491
520
  "[attr.aria-haspopup]": "'dialog'",
492
- "[attr.aria-label]": "ariaLabel() || messages().colorPicker",
493
- "[attr.aria-disabled]": "disabled()",
521
+ "[attr.aria-label]": "labelledBy() ? null : ariaLabel() || messages().colorPicker",
522
+ "[attr.aria-labelledby]": "labelledBy()",
523
+ "[attr.aria-disabled]": "effectiveDisabled()",
494
524
  "[attr.aria-invalid]": "invalidState() ? 'true' : null",
495
525
  "[attr.aria-readonly]": "readonly()",
496
526
  "[attr.aria-required]": "required()"
497
- }, template: "@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\"></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=\"0\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorPalettePicker\"\n data-palette-container\n (keydown)=\"onPaletteContainerKeyDown($event)\">\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 [palette]=\"palette()\"\n [columns]=\"columns()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorPaletteValueChange($event)\"\n (touch)=\"onColorPaletteTouch()\"></mona-color-palette>\n </div>\n } @else if (view() === \"gradient\") {\n <div\n [id]=\"popupId\"\n [class]=\"gradientPopupClasses\"\n tabindex=\"0\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorGradientPicker\">\n <mona-color-gradient\n [opacity]=\"opacity()\"\n [rounded]=\"rounded()\"\n [disabled]=\"disabled() || readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorGradientValueChange($event)\"\n (touch)=\"onColorGradientTouch()\"\n (apply)=\"onColorGradientApply()\"\n (cancel)=\"onColorGradientCancel()\"></mona-color-gradient>\n </div>\n }\n</ng-template>\n" }]
498
- }], 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 }] }], 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 }] }], 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 }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], 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 }] }] } });
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 }] }] } });
499
529
 
500
530
  /*
501
531
  * Public API Surface of @nanahoshi/mona-ui/color-picker