@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,17 +1,18 @@
1
+ import { LiveAnnouncer } from '@angular/cdk/a11y';
1
2
  import { Clipboard } from '@angular/cdk/clipboard';
2
3
  import { NgTemplateOutlet } from '@angular/common';
3
4
  import * as i0 from '@angular/core';
4
- import { inject, DestroyRef, Injector, signal, NgZone, computed, viewChild, output, input, model, afterNextRender, effect, untracked, Component } from '@angular/core';
5
+ import { inject, DestroyRef, DOCUMENT, ElementRef, signal, computed, viewChild, output, input, booleanAttribute, model, afterNextRender, effect, untracked, isDevMode, Component } from '@angular/core';
5
6
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
7
  import { LucideDropletOff, LucideChevronsUpDown, LucideCopy } from '@lucide/angular';
7
8
  import { ButtonDirective } from '@nanahoshi/mona-ui/button';
8
- import { rgba2hex, hsva2rgba, isValidHex, hex2rgba, rgba2hsva, rgba2hsla, isValidHsla, isValidRgb, string2rgba, string2Hsla, hsla2hsva } from '@nanahoshi/mona-ui/internal';
9
+ import { injectLabelAssociation, rgba2hex, injectEffectiveDisabled, hsva2rgba, formatAlpha, isValidHex, hex2rgba, rgba2hsva, rgba2hsla, parseColor } from '@nanahoshi/mona-ui/internal';
9
10
  import { DropdownButtonComponent, DropdownButtonItemComponent, DropdownButtonTextTemplateDirective } from '@nanahoshi/mona-ui/dropdown-button';
10
11
  import { NumericTextBoxComponent, NumericTextBoxPrefixTemplateDirective } from '@nanahoshi/mona-ui/numeric-text-box';
11
12
  import { SliderComponent } from '@nanahoshi/mona-ui/slider';
12
13
  import { TextBoxComponent, TextBoxPrefixTemplateDirective, TextBoxSuffixTemplateDirective } from '@nanahoshi/mona-ui/text-box';
13
14
  import { formatNumber, MonaI18nService } from '@nanahoshi/mona-ui/i18n';
14
- import { Subject, fromEvent, switchMap, takeUntil, distinctUntilChanged } from 'rxjs';
15
+ import { fromEvent, filter, tap, switchMap, merge, takeUntil } from 'rxjs';
15
16
  import { cva } from 'class-variance-authority';
16
17
 
17
18
  // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
@@ -20,17 +21,29 @@ function localizeNumber(value, options) {
20
21
  return formatNumber(value, "en-US", options);
21
22
  }
22
23
  const COLOR_GRADIENT_DEFAULT_MESSAGES = {
24
+ alpha: "Alpha",
25
+ alphaText: (opacity) => `Opacity ${localizeNumber(opacity)}%`,
23
26
  apply: "Apply",
27
+ blue: "Blue",
24
28
  cancel: "Cancel",
25
29
  clearColor: "Clear color",
30
+ colorCopied: "Color copied",
31
+ colorGradient: "Color gradient",
26
32
  copyAsHex: "Copy as HEX",
27
33
  copyAsRgb: "Copy as RGB",
28
34
  copyColor: "Copy color",
35
+ copyFailed: "Couldn't copy the color",
29
36
  currentColor: "Current color",
37
+ green: "Green",
38
+ hexColor: "Hex color",
39
+ hue: "Hue",
30
40
  previousColor: "Previous color",
41
+ red: "Red",
42
+ saturation: "Saturation",
31
43
  saturationAndValue: "Color saturation and value",
32
44
  saturationAndValueText: (saturation, value) => `Saturation ${localizeNumber(saturation)}%, Value ${localizeNumber(value)}%`,
33
- switchColorMode: "Switch color mode"
45
+ switchColorMode: "Switch color mode",
46
+ value: "Value"
34
47
  };
35
48
 
36
49
  const colorGradientBaseThemeVariants = cva(`
@@ -49,6 +62,7 @@ const colorGradientBaseThemeVariants = cva(`
49
62
  `);
50
63
  const colorGradientHsvRectangleThemeVariants = cva(`
51
64
  relative h-40 w-full
65
+ cursor-crosshair touch-none forced-color-adjust-none
52
66
  bg-[linear-gradient(to_bottom,rgba(0,0,0,0),black),linear-gradient(to_right,white,rgba(255,255,255,0))]
53
67
  border border-border-subtle
54
68
  `, {
@@ -65,12 +79,13 @@ const colorGradientHsvRectangleThemeVariants = cva(`
65
79
  const colorGradientHsvRectangleHandleThemeVariants = cva(`
66
80
  absolute
67
81
  h-3 w-3
82
+ -translate-x-1/2 -translate-y-1/2
68
83
  cursor-pointer
69
84
  bg-transparent
70
85
  border-2 border-black/90 outline outline-white/90 shadow-sm
71
86
 
72
- focus-visible:ring-2 focus-visible:ring-focus-indicator/35
73
- focus-visible:ring-offset-2 focus-visible:ring-offset-surface
87
+ focus-visible:outline-2 focus-visible:outline-white/90!
88
+ focus-visible:shadow-[0_0_0_4px_rgb(0_0_0/0.9)]
74
89
  `, {
75
90
  variants: {
76
91
  rounded: {
@@ -85,6 +100,8 @@ const colorGradientHsvRectangleHandleThemeVariants = cva(`
85
100
  const colorGradientPreviewThemeVariants = cva(`
86
101
  flex h-10 w-10
87
102
  border border-border-subtle
103
+ forced-color-adjust-none
104
+ focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-indicator
88
105
  `, {
89
106
  variants: {
90
107
  rounded: {
@@ -103,32 +120,45 @@ const colorGradientSliderHandleThemeVariants = cva(`
103
120
  outline outline-solid outline-black/90
104
121
  `);
105
122
 
123
+ const DEFAULT_HSV = { h: 0, s: 0, v: 100 };
124
+ const DEFAULT_RGB = { r: 255, g: 255, b: 255 };
106
125
  class ColorGradientComponent {
126
+ #announcer;
107
127
  #clipboard;
108
128
  #destroyRef;
129
+ #document;
130
+ #hostElementRef;
109
131
  #i18n;
110
- #injector;
111
- #valueChange$;
132
+ #label;
112
133
  #viewReady;
113
- #zone;
134
+ /** Whether the color on screen differs from the value because of something the user did. */
135
+ #edited;
114
136
  #internalValueUpdatePending;
115
137
  #lastInternalValue;
116
138
  constructor() {
139
+ this.#announcer = inject(LiveAnnouncer);
117
140
  this.#clipboard = inject(Clipboard);
118
141
  this.#destroyRef = inject(DestroyRef);
142
+ this.#document = inject(DOCUMENT);
143
+ this.#hostElementRef = inject(ElementRef);
119
144
  this.#i18n = inject(MonaI18nService);
120
- this.#injector = inject(Injector);
121
- this.#valueChange$ = new Subject();
145
+ this.#label = injectLabelAssociation({
146
+ activate: () => this.focus(),
147
+ ariaLabel: () => this.ariaLabel(),
148
+ ariaLabelledBy: () => this.ariaLabelledBy()
149
+ });
122
150
  this.#viewReady = signal(false, /* @ts-ignore */
123
151
  ...(ngDevMode ? [{ debugName: "#viewReady" }] : /* istanbul ignore next */ []));
124
- this.#zone = inject(NgZone);
152
+ /** Whether the color on screen differs from the value because of something the user did. */
153
+ this.#edited = false;
125
154
  this.#internalValueUpdatePending = false;
126
155
  this.#lastInternalValue = undefined;
127
156
  this.alpha = signal(255, /* @ts-ignore */
128
157
  ...(ngDevMode ? [{ debugName: "alpha" }] : /* istanbul ignore next */ []));
129
158
  this.alphaInputColor = computed(() => {
159
+ // With no color there is still a track to show.
130
160
  const rgb = this.rgb();
131
- return rgba2hex(rgb.r, rgb.g, rgb.b, 255);
161
+ return rgba2hex(rgb.r ?? 0, rgb.g ?? 0, rgb.b ?? 0, 255);
132
162
  }, /* @ts-ignore */
133
163
  ...(ngDevMode ? [{ debugName: "alphaInputColor" }] : /* istanbul ignore next */ []));
134
164
  this.alphaSliderBackground = computed(() => {
@@ -136,6 +166,11 @@ class ColorGradientComponent {
136
166
  return `linear-gradient(to right, transparent, ${color})`;
137
167
  }, /* @ts-ignore */
138
168
  ...(ngDevMode ? [{ debugName: "alphaSliderBackground" }] : /* istanbul ignore next */ []));
169
+ this.alphaValueText = computed(() => {
170
+ const { alphaText } = this.messages();
171
+ return (alpha) => alphaText(Math.round((alpha / 255) * 100));
172
+ }, /* @ts-ignore */
173
+ ...(ngDevMode ? [{ debugName: "alphaValueText" }] : /* istanbul ignore next */ []));
139
174
  this.baseClasses = computed(() => {
140
175
  return colorGradientBaseThemeVariants();
141
176
  }, /* @ts-ignore */
@@ -145,6 +180,7 @@ class ColorGradientComponent {
145
180
  const baseInputs = mode === "rgb" ? this.createRgbInputList() : this.createHsvInputList();
146
181
  if (this.opacity()) {
147
182
  baseInputs.push({
183
+ ariaLabel: this.messages().alpha,
148
184
  key: "a",
149
185
  label: "A",
150
186
  value: this.alpha(),
@@ -177,6 +213,7 @@ class ColorGradientComponent {
177
213
  }
178
214
  ], /* @ts-ignore */
179
215
  ...(ngDevMode ? [{ debugName: "colorPreviews" }] : /* istanbul ignore next */ []));
216
+ this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
180
217
  this.hex = computed(() => {
181
218
  const rgb = this.rgb();
182
219
  const alpha = this.alpha();
@@ -189,21 +226,16 @@ class ColorGradientComponent {
189
226
  ...(ngDevMode ? [{ debugName: "hex" }] : /* istanbul ignore next */ []));
190
227
  this.hexFocused = signal(false, /* @ts-ignore */
191
228
  ...(ngDevMode ? [{ debugName: "hexFocused" }] : /* istanbul ignore next */ []));
192
- this.hsvHandle = viewChild.required("hsvPointer", /* @ts-ignore */
193
- ...(ngDevMode ? [{ debugName: "hsvHandle" }] : /* istanbul ignore next */ []));
194
- this.hsvHandleLeft = signal(0, /* @ts-ignore */
195
- ...(ngDevMode ? [{ debugName: "hsvHandleLeft" }] : /* istanbul ignore next */ []));
196
- this.hsvHandleTop = signal(0, /* @ts-ignore */
197
- ...(ngDevMode ? [{ debugName: "hsvHandleTop" }] : /* istanbul ignore next */ []));
198
229
  this.hexInputValue = signal("", /* @ts-ignore */
199
230
  ...(ngDevMode ? [{ debugName: "hexInputValue" }] : /* istanbul ignore next */ []));
200
- this.hsv = signal({ h: 360, s: 100, v: 100 }, /* @ts-ignore */
231
+ this.hsv = signal({ ...DEFAULT_HSV }, /* @ts-ignore */
201
232
  ...(ngDevMode ? [{ debugName: "hsv" }] : /* istanbul ignore next */ []));
233
+ this.hsvHandle = viewChild.required("hsvPointer", /* @ts-ignore */
234
+ ...(ngDevMode ? [{ debugName: "hsvHandle" }] : /* istanbul ignore next */ []));
202
235
  this.hsvRectangle = viewChild.required("hsvRectangle", /* @ts-ignore */
203
236
  ...(ngDevMode ? [{ debugName: "hsvRectangle" }] : /* istanbul ignore next */ []));
204
237
  this.hsvRectangleBackground = computed(() => {
205
- const hsv = this.hsv();
206
- const rgb = hsva2rgba(hsv.h, 100, 100, 255);
238
+ const rgb = hsva2rgba(this.hsv().h ?? 0, 100, 100, 255);
207
239
  return `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`;
208
240
  }, /* @ts-ignore */
209
241
  ...(ngDevMode ? [{ debugName: "hsvRectangleBackground" }] : /* istanbul ignore next */ []));
@@ -217,14 +249,22 @@ class ColorGradientComponent {
217
249
  return colorGradientHsvRectangleHandleThemeVariants({ rounded });
218
250
  }, /* @ts-ignore */
219
251
  ...(ngDevMode ? [{ debugName: "hsvRectangleHandleClasses" }] : /* istanbul ignore next */ []));
220
- this.hueValue$ = new Subject();
252
+ this.interactionDisabled = computed(() => this.effectiveDisabled() || this.readonly(), /* @ts-ignore */
253
+ ...(ngDevMode ? [{ debugName: "interactionDisabled" }] : /* istanbul ignore next */ []));
221
254
  this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && !this.value())), /* @ts-ignore */
222
255
  ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
256
+ this.labelledBy = this.#label.labelledBy;
223
257
  this.lastSelectedColor = signal("", /* @ts-ignore */
224
258
  ...(ngDevMode ? [{ debugName: "lastSelectedColor" }] : /* istanbul ignore next */ []));
225
259
  this.messages = this.#i18n.componentMessages("colorGradient", COLOR_GRADIENT_DEFAULT_MESSAGES);
226
- this.rgb = signal({ r: 255, g: 255, b: 255 }, /* @ts-ignore */
260
+ this.rgb = signal({ ...DEFAULT_RGB }, /* @ts-ignore */
227
261
  ...(ngDevMode ? [{ debugName: "rgb" }] : /* istanbul ignore next */ []));
262
+ this.roundedHue = computed(() => Math.round(this.hsv().h ?? 0), /* @ts-ignore */
263
+ ...(ngDevMode ? [{ debugName: "roundedHue" }] : /* istanbul ignore next */ []));
264
+ this.roundedSaturation = computed(() => Math.round(this.hsv().s ?? 0), /* @ts-ignore */
265
+ ...(ngDevMode ? [{ debugName: "roundedSaturation" }] : /* istanbul ignore next */ []));
266
+ this.roundedValue = computed(() => Math.round(this.hsv().v ?? 0), /* @ts-ignore */
267
+ ...(ngDevMode ? [{ debugName: "roundedValue" }] : /* istanbul ignore next */ []));
228
268
  this.selectedColor = computed(() => {
229
269
  const rgb = this.rgb();
230
270
  if (rgb.r == null || rgb.g == null || rgb.b == null) {
@@ -244,16 +284,26 @@ class ColorGradientComponent {
244
284
  */
245
285
  this.apply = output();
246
286
  /**
247
- * @description Emits when the Cancel button is clicked.
287
+ * @description Accessible name of the group of controls.
288
+ * @default ""
289
+ */
290
+ this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
291
+ /**
292
+ * @description Id of the element that names the group of controls.
293
+ * @default ""
294
+ */
295
+ this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
296
+ /**
297
+ * @description Emits when the Cancel button is clicked, after the controls go back to the current value.
248
298
  * The `Cancel` button is only displayed when `showButtons` is set to true.
249
299
  */
300
+ // eslint-disable-next-line @angular-eslint/no-output-native -- renaming the output would break existing (cancel) bindings
250
301
  this.cancel = output();
251
302
  /**
252
303
  * @description Sets the disabled state of the color gradient.
253
304
  * @default false
254
305
  */
255
- this.disabled = input(false, /* @ts-ignore */
256
- ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
306
+ this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
257
307
  /**
258
308
  * @description Specifies the format of the color output.
259
309
  * @default "hex"
@@ -261,24 +311,27 @@ class ColorGradientComponent {
261
311
  this.format = input("hex", /* @ts-ignore */
262
312
  ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
263
313
  /**
264
- * @description Marks the color gradient as invalid. When bound to a signal form field via `[field]`,
265
- * this is written by the signal forms `Field` directive.
314
+ * @description Marks the color gradient as invalid. When bound to a signal form field via `[formField]`,
315
+ * this is written by the `FormField` directive.
266
316
  * @default false
267
317
  */
268
- this.invalid = input(false, /* @ts-ignore */
269
- ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
318
+ this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
270
319
  /**
271
320
  * @description Specifies whether the color picker should display the alpha slider.
272
321
  * @default true
273
322
  */
274
- this.opacity = input(true, /* @ts-ignore */
275
- ...(ngDevMode ? [{ debugName: "opacity" }] : /* istanbul ignore next */ []));
323
+ this.opacity = input(true, { ...(ngDevMode ? { debugName: "opacity" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
324
+ /**
325
+ * @description Prevents value changes while the control stays focusable and readable. When bound to a signal form
326
+ * field via `[formField]`, this is written by the `FormField` directive.
327
+ * @default false
328
+ */
329
+ this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
276
330
  /**
277
331
  * @description Marks the color gradient as required for form validation.
278
332
  * @default false
279
333
  */
280
- this.required = input(false, /* @ts-ignore */
281
- ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
334
+ this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
282
335
  /**
283
336
  * @description Specifies the rounded variant of the color picker.
284
337
  * @default "medium"
@@ -291,32 +344,28 @@ class ColorGradientComponent {
291
344
  * When set to false, the color picker will not display the buttons and will emit the color value on change.
292
345
  * @default true
293
346
  */
294
- this.showButtons = input(true, /* @ts-ignore */
295
- ...(ngDevMode ? [{ debugName: "showButtons" }] : /* istanbul ignore next */ []));
347
+ this.showButtons = input(true, { ...(ngDevMode ? { debugName: "showButtons" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
296
348
  /**
297
- * @description Specifies whether the color picker should display the hex input.
349
+ * @description Specifies whether the color picker should display the channel inputs (RGB or HSV).
298
350
  * @default true
299
351
  */
300
- this.showHexInput = input(true, /* @ts-ignore */
301
- ...(ngDevMode ? [{ debugName: "showHexInput" }] : /* istanbul ignore next */ []));
352
+ this.showColorInputs = input(true, { ...(ngDevMode ? { debugName: "showColorInputs" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
302
353
  /**
303
- * @description Specifies whether the color picker should display the channel inputs (RGB or HSV).
354
+ * @description Specifies whether the color picker should display the hex input.
304
355
  * @default true
305
356
  */
306
- this.showColorInputs = input(true, /* @ts-ignore */
307
- ...(ngDevMode ? [{ debugName: "showColorInputs" }] : /* istanbul ignore next */ []));
357
+ this.showHexInput = input(true, { ...(ngDevMode ? { debugName: "showHexInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
308
358
  /**
309
- * @description Emitted when the color gradient is interacted with on blur or value adjustment.
359
+ * @description Emitted when focus leaves the color gradient. Moving between its own parts doesn't count.
310
360
  * The `FormField` directive listens to this to mark the field as touched.
311
361
  */
312
362
  this.touch = output();
313
363
  /**
314
- * @description Marks the color gradient as touched. When bound to a signal form field via `[field]`,
315
- * this is written by the signal forms `Field` directive.
364
+ * @description Marks the color gradient as touched. When bound to a signal form field via `[formField]`,
365
+ * this is written by the `FormField` directive.
316
366
  * @default false
317
367
  */
318
- this.touched = input(false, /* @ts-ignore */
319
- ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
368
+ this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
320
369
  /**
321
370
  * @description Two-way bindable current color value.
322
371
  * When undefined, the component keeps its default internal color state (white, #ffffffff).
@@ -327,7 +376,7 @@ class ColorGradientComponent {
327
376
  afterNextRender({
328
377
  read: () => {
329
378
  this.lastSelectedColor.set(this.hex());
330
- this.setSubscriptions();
379
+ this.setHsvRectPointerEvents();
331
380
  this.#viewReady.set(true);
332
381
  }
333
382
  });
@@ -339,10 +388,24 @@ class ColorGradientComponent {
339
388
  untracked(() => this.syncValue(value));
340
389
  });
341
390
  }
391
+ /**
392
+ * @description Moves focus to the saturation and value handle.
393
+ * @param options Options passed to the native `focus()` call, such as `preventScroll`.
394
+ */
395
+ focus(options) {
396
+ this.hsvHandle().nativeElement.focus(options);
397
+ }
398
+ /**
399
+ * @internal
400
+ */
401
+ setLabelledBy(id) {
402
+ this.#label.setLabelledBy(id);
403
+ }
342
404
  onAlphaChange(value) {
343
405
  if (value == null) {
344
406
  return;
345
407
  }
408
+ this.#edited = true;
346
409
  const alpha = this.getValidChannelValue(value, "a");
347
410
  this.alpha.set(alpha);
348
411
  this.updateHexInputValue();
@@ -351,42 +414,57 @@ class ColorGradientComponent {
351
414
  }
352
415
  }
353
416
  onApply() {
354
- this.lastSelectedColor.set(this.hex());
355
- this.emitValue();
417
+ if (this.interactionDisabled()) {
418
+ return;
419
+ }
420
+ // Applying what was never edited keeps the value as written, whatever its format, even one this can't read.
421
+ if (this.#edited || this.value() === undefined) {
422
+ this.lastSelectedColor.set(this.hex());
423
+ this.emitValue();
424
+ }
425
+ this.#edited = false;
356
426
  this.apply.emit();
357
427
  }
358
428
  onCancel() {
359
- this.hexInputValue.set(this.lastSelectedColor());
429
+ this.loadValue(this.value());
360
430
  this.cancel.emit();
361
431
  }
362
432
  onClearClick() {
433
+ if (this.interactionDisabled()) {
434
+ return;
435
+ }
436
+ this.#edited = true;
363
437
  this.clear();
364
438
  if (!this.showButtons()) {
365
- this.emitValue(null);
439
+ this.commitValue(null);
366
440
  }
367
441
  }
368
442
  onCopyColorSelect(mode) {
369
- if (mode === "hex") {
370
- this.#clipboard.copy(this.hex());
371
- }
372
- else if (mode === "rgb") {
373
- const rgb = this.rgb();
374
- const alpha = Math.round((this.alpha() / 255) * 100) / 100;
375
- this.#clipboard.copy(`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha})`);
443
+ const rgb = this.rgb();
444
+ const text = mode === "hex"
445
+ ? rgba2hex(rgb.r, rgb.g, rgb.b, this.alpha())
446
+ : `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${formatAlpha(this.alpha())})`;
447
+ const copied = this.#clipboard.copy(text);
448
+ void this.#announcer.announce(copied ? this.messages().colorCopied : this.messages().copyFailed);
449
+ }
450
+ onFocusOut(event) {
451
+ const nextTarget = event.relatedTarget;
452
+ if (nextTarget instanceof Node && this.#hostElementRef.nativeElement.contains(nextTarget)) {
453
+ return;
376
454
  }
455
+ this.touch.emit();
377
456
  }
378
457
  onHexChange(value) {
379
458
  this.hexInputValue.set(value);
380
459
  if (!isValidHex(value)) {
381
460
  return;
382
461
  }
462
+ this.#edited = true;
383
463
  const rgb = hex2rgba(value);
384
464
  const hsv = rgba2hsva(rgb.r, rgb.g, rgb.b, rgb.a);
385
465
  this.hsv.update(c => ({ ...c, h: hsv.h, s: hsv.s, v: hsv.v }));
386
466
  this.rgb.update(c => ({ ...c, r: rgb.r, g: rgb.g, b: rgb.b }));
387
467
  this.alpha.set(rgb.a ?? 255);
388
- this.hsvHandleLeft.set(this.getPositionFromSaturation(hsv.s));
389
- this.hsvHandleTop.set(this.getPositionFromValue(hsv.v));
390
468
  if (!this.showButtons()) {
391
469
  this.emitValue();
392
470
  }
@@ -394,15 +472,16 @@ class ColorGradientComponent {
394
472
  onHexInputBlur() {
395
473
  this.hexFocused.set(false);
396
474
  this.updateHexInputValue();
397
- this.touch.emit();
398
475
  }
399
476
  onHexInputFocus() {
477
+ this.updateHexInputValue();
400
478
  this.hexFocused.set(true);
401
479
  }
402
480
  onHsvChange(value, channel) {
403
481
  if (value == null) {
404
482
  return;
405
483
  }
484
+ this.#edited = true;
406
485
  value = this.getValidChannelValue(value, channel);
407
486
  this.hsv.update(c => ({ ...c, [channel]: value }));
408
487
  this.updateOtherNullChannels(channel);
@@ -410,17 +489,12 @@ class ColorGradientComponent {
410
489
  const rgb = hsva2rgba(hsv.h, hsv.s, hsv.v, this.alpha());
411
490
  this.rgb.update(c => ({ ...c, r: rgb.r, g: rgb.g, b: rgb.b }));
412
491
  this.updateHexInputValue();
413
- this.hsvHandleLeft.set(this.getPositionFromSaturation(hsv.s));
414
- this.hsvHandleTop.set(this.getPositionFromValue(hsv.v));
415
492
  if (!this.showButtons()) {
416
493
  this.emitValue();
417
494
  }
418
495
  }
419
- onHsvHandleBlur() {
420
- this.touch.emit();
421
- }
422
496
  onHsvHandleKeyDown(event) {
423
- if (this.disabled()) {
497
+ if (this.interactionDisabled()) {
424
498
  return;
425
499
  }
426
500
  const step = event.shiftKey ? 10 : 1;
@@ -471,13 +545,15 @@ class ColorGradientComponent {
471
545
  event.preventDefault();
472
546
  event.stopPropagation();
473
547
  this.updateHsvValues(newSaturation, newValue);
474
- this.hsvHandleLeft.set(this.getPositionFromSaturation(newSaturation));
475
- this.hsvHandleTop.set(this.getPositionFromValue(newValue));
476
548
  this.updateHexInputValue();
477
549
  }
478
550
  }
479
- onNumericInputBlur() {
480
- this.touch.emit();
551
+ onHueChange(value) {
552
+ this.#edited = true;
553
+ this.hsv.update(c => ({ ...c, h: Math.round(value) }));
554
+ this.updateOtherNullChannels("h");
555
+ this.updateRgbFromHsv();
556
+ this.updateHexInputValue();
481
557
  }
482
558
  onPreviousColorKeyDown(event, handler) {
483
559
  if (event.key === "Enter" || event.key === " ") {
@@ -486,12 +562,16 @@ class ColorGradientComponent {
486
562
  }
487
563
  }
488
564
  onResetColorClick() {
565
+ if (this.interactionDisabled()) {
566
+ return;
567
+ }
489
568
  this.onHexChange(this.lastSelectedColor());
490
569
  }
491
570
  onRgbChange(value, channel) {
492
571
  if (value == null) {
493
572
  return;
494
573
  }
574
+ this.#edited = true;
495
575
  value = this.getValidChannelValue(value, channel);
496
576
  this.rgb.update(c => ({ ...c, [channel]: value }));
497
577
  this.updateOtherNullChannels(channel);
@@ -499,49 +579,52 @@ class ColorGradientComponent {
499
579
  const hsv = rgba2hsva(rgb.r, rgb.g, rgb.b, this.alpha());
500
580
  this.hsv.update(c => ({ ...c, h: hsv.h, s: hsv.s, v: hsv.v }));
501
581
  this.updateHexInputValue();
502
- this.hsvHandleLeft.set(this.getPositionFromSaturation(hsv.s));
503
- this.hsvHandleTop.set(this.getPositionFromValue(hsv.v));
504
582
  if (!this.showButtons()) {
505
583
  this.emitValue();
506
584
  }
507
585
  }
508
- onSliderBlur() {
509
- this.touch.emit();
510
- }
511
586
  onSwitchColorModeClick() {
512
587
  this.colorMode.set(this.colorMode() === "rgb" ? "hsv" : "rgb");
513
588
  }
514
- afterNextRender(callback) {
515
- afterNextRender(callback, { injector: this.#injector });
516
- }
517
589
  clear() {
518
590
  this.hexInputValue.set("");
519
- this.lastSelectedColor.set("");
520
591
  this.rgb.update(c => ({ ...c, r: null, g: null, b: null }));
521
592
  this.alpha.set(255);
522
593
  this.hsv.update(c => ({ ...c, h: null, s: null, v: null }));
523
594
  }
595
+ commitValue(value) {
596
+ if (value === this.value()) {
597
+ return;
598
+ }
599
+ this.#internalValueUpdatePending = true;
600
+ this.#lastInternalValue = value;
601
+ this.value.set(value);
602
+ }
524
603
  createHsvInputList() {
604
+ const messages = this.messages();
525
605
  const hue = {
606
+ ariaLabel: messages.hue,
526
607
  key: "h",
527
608
  label: "H",
528
- value: this.hsv().h,
609
+ value: this.roundedHue(),
529
610
  min: 0,
530
611
  max: 360,
531
612
  change: (value) => this.onHsvChange(value, "h")
532
613
  };
533
614
  const saturation = {
615
+ ariaLabel: messages.saturation,
534
616
  key: "s",
535
617
  label: "S",
536
- value: this.hsv().s,
618
+ value: this.roundedSaturation(),
537
619
  min: 0,
538
620
  max: 100,
539
621
  change: (value) => this.onHsvChange(value, "s")
540
622
  };
541
623
  const value = {
624
+ ariaLabel: messages.value,
542
625
  key: "v",
543
626
  label: "V",
544
- value: this.hsv().v,
627
+ value: this.roundedValue(),
545
628
  min: 0,
546
629
  max: 100,
547
630
  change: (value) => this.onHsvChange(value, "v")
@@ -549,7 +632,9 @@ class ColorGradientComponent {
549
632
  return [hue, saturation, value];
550
633
  }
551
634
  createRgbInputList() {
635
+ const messages = this.messages();
552
636
  const red = {
637
+ ariaLabel: messages.red,
553
638
  key: "r",
554
639
  label: "R",
555
640
  value: this.rgb().r,
@@ -558,6 +643,7 @@ class ColorGradientComponent {
558
643
  change: (value) => this.onRgbChange(value, "r")
559
644
  };
560
645
  const green = {
646
+ ariaLabel: messages.green,
561
647
  key: "g",
562
648
  label: "G",
563
649
  value: this.rgb().g,
@@ -566,6 +652,7 @@ class ColorGradientComponent {
566
652
  change: (value) => this.onRgbChange(value, "g")
567
653
  };
568
654
  const blue = {
655
+ ariaLabel: messages.blue,
569
656
  key: "b",
570
657
  label: "B",
571
658
  value: this.rgb().b,
@@ -575,49 +662,24 @@ class ColorGradientComponent {
575
662
  };
576
663
  return [red, green, blue];
577
664
  }
578
- emitValue(value) {
579
- if (value !== undefined) {
580
- this.#valueChange$.next(value);
581
- return;
582
- }
583
- const format = this.format();
665
+ emitValue() {
584
666
  const rgb = this.rgb();
585
667
  const alpha = this.alpha();
586
668
  if (rgb.r == null || rgb.g == null || rgb.b == null || alpha == null) {
587
- this.#valueChange$.next(null);
669
+ this.commitValue(null);
588
670
  return;
589
671
  }
672
+ const format = this.format();
590
673
  if (format === "hex") {
591
- this.#valueChange$.next(rgba2hex(rgb.r, rgb.g, rgb.b, alpha));
674
+ this.commitValue(rgba2hex(rgb.r, rgb.g, rgb.b, alpha));
592
675
  }
593
676
  else if (format === "rgb") {
594
- this.#valueChange$.next(`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha / 255})`);
677
+ this.commitValue(`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${formatAlpha(alpha)})`);
595
678
  }
596
679
  else if (format === "hsl") {
597
680
  const hsl = rgba2hsla(rgb.r, rgb.g, rgb.b, alpha);
598
- this.#valueChange$.next(`hsla(${hsl.h}, ${hsl.s}%, ${hsl.l}%, ${alpha / 255})`);
599
- }
600
- }
601
- getPositionFromSaturation(saturation) {
602
- if (saturation == null) {
603
- return 0;
604
- }
605
- const maxVal = this.hsvRectangle().nativeElement.offsetWidth;
606
- const minVal = (saturation / 100) * maxVal;
607
- return minVal - this.hsvHandle().nativeElement.offsetWidth / 2;
608
- }
609
- getPositionFromValue(value) {
610
- if (value == null) {
611
- return 0;
681
+ this.commitValue(`hsla(${hsl.h}, ${hsl.s}%, ${hsl.l}%, ${formatAlpha(alpha)})`);
612
682
  }
613
- const maxVal = this.hsvRectangle().nativeElement.offsetHeight;
614
- const minVal = ((100 - value) / 100) * maxVal;
615
- return minVal - this.hsvHandle().nativeElement.offsetHeight / 2;
616
- }
617
- getSaturationFromPosition(left) {
618
- const minVal = left + this.hsvHandle().nativeElement.offsetWidth / 2;
619
- const maxVal = this.hsvRectangle().nativeElement.offsetWidth;
620
- return this.getValidChannelValue(Math.ceil((minVal / maxVal) * 100), "s");
621
683
  }
622
684
  getValidChannelValue(value, channel) {
623
685
  if (channel === "r" || channel === "g" || channel === "b" || channel === "a") {
@@ -631,88 +693,70 @@ class ColorGradientComponent {
631
693
  }
632
694
  return value;
633
695
  }
634
- getValueFromPosition(top) {
635
- const minVal = top + this.hsvHandle().nativeElement.offsetHeight / 2;
636
- const maxVal = this.hsvRectangle().nativeElement.offsetHeight;
637
- return this.getValidChannelValue(Math.round(100 - (minVal / maxVal) * 100), "v");
638
- }
639
696
  loadColorFromString(color) {
640
- if (color == null || !this.hsvRectangle() || !this.hsvHandle()) {
697
+ const rgba = parseColor(color, this.#document);
698
+ if (!rgba && color.trim() && isDevMode()) {
699
+ console.warn(`[Mona Color Gradient] Can't read the color "${color}", so the controls show no color. The value stays ` +
700
+ "as it is until a user changes it.", this.#hostElementRef.nativeElement);
701
+ }
702
+ if (!rgba) {
703
+ this.clear();
641
704
  return;
642
705
  }
643
- const hexValid = isValidHex(color);
644
- const hsvValid = isValidHsla(color);
645
- const rgbValid = isValidRgb(color);
646
- let rgba;
647
- let hsla;
648
- let hsva;
649
- if (hexValid) {
650
- rgba = hex2rgba(color);
651
- }
652
- else if (rgbValid) {
653
- rgba = string2rgba(color);
654
- }
655
- else if (hsvValid) {
656
- hsla = string2Hsla(color);
657
- hsva = hsla2hsva(hsla.h, hsla.s, hsla.l, hsla.a);
658
- rgba = hsva2rgba(hsva.h, hsva.s, hsva.v, hsva.a);
659
- hsva = {
660
- h: Math.round(hsva.h),
661
- s: Math.round(hsva.s),
662
- v: Math.round(hsva.v),
663
- a: hsva.a
664
- };
706
+ const hsv = rgba2hsva(rgba.r, rgba.g, rgba.b, rgba.a);
707
+ this.hsv.set({ h: hsv.h, s: hsv.s, v: hsv.v });
708
+ this.updateRgb(rgba);
709
+ this.alpha.set(rgba.a ?? 255);
710
+ this.updateHexInputValue();
711
+ }
712
+ /**
713
+ * Shows a value in the controls, dropping any edit that wasn't applied.
714
+ */
715
+ loadValue(value) {
716
+ this.#edited = false;
717
+ if (value === undefined) {
718
+ this.hsv.set({ ...DEFAULT_HSV });
719
+ this.rgb.set({ ...DEFAULT_RGB });
720
+ this.alpha.set(255);
721
+ this.updateHexInputValue();
722
+ }
723
+ else if (value === null) {
724
+ this.clear();
665
725
  }
666
726
  else {
667
- rgba = { r: null, g: null, b: null, a: null };
727
+ this.loadColorFromString(value);
668
728
  }
669
- if (!hsva) {
670
- hsva = rgba2hsva(rgba.r, rgba.g, rgba.b, rgba.a);
729
+ this.lastSelectedColor.set(this.hex());
730
+ }
731
+ moveHandleToPointer(event) {
732
+ const { height, left, top, width } = this.hsvRectangle().nativeElement.getBoundingClientRect();
733
+ if (width <= 0 || height <= 0) {
734
+ return;
671
735
  }
672
- this.updateHsv(hsva);
673
- this.updateRgb(rgba);
674
- this.alpha.set(rgba.a ?? 255);
736
+ this.updateHsvValues(((event.clientX - left) / width) * 100, 100 - ((event.clientY - top) / height) * 100);
675
737
  this.updateHexInputValue();
676
- this.afterNextRender(() => {
677
- this.hsvHandleLeft.set(this.getPositionFromSaturation(hsva.s));
678
- this.hsvHandleTop.set(this.getPositionFromValue(hsva.v));
679
- });
680
738
  }
739
+ /**
740
+ * Pressing anywhere in the area starts a drag. Capturing the pointer keeps the moves coming when it leaves the area,
741
+ * and the press itself mustn't take focus away from the handle.
742
+ */
681
743
  setHsvRectPointerEvents() {
682
- const pointerDown$ = fromEvent(this.hsvHandle().nativeElement, "pointerdown").pipe(takeUntilDestroyed(this.#destroyRef));
683
- const pointerMove$ = fromEvent(document, "pointermove").pipe(takeUntilDestroyed(this.#destroyRef));
684
- const pointerUp$ = fromEvent(document, "pointerup").pipe(takeUntilDestroyed(this.#destroyRef));
685
- pointerDown$
686
- .pipe(switchMap(() => pointerMove$.pipe(takeUntil(pointerUp$))))
687
- .subscribe((event) => {
688
- this.#zone.run(() => {
689
- const position = this.updateHsvRectPointerPosition(event);
690
- this.updateHsvValues(this.getSaturationFromPosition(position.left), this.getValueFromPosition(position.top));
691
- this.updateHexInputValue();
692
- });
693
- });
694
- fromEvent(this.hsvRectangle().nativeElement, "click")
695
- .pipe(takeUntilDestroyed(this.#destroyRef))
696
- .subscribe((event) => {
697
- const position = this.updateHsvRectPointerPosition(event);
698
- this.updateHsvValues(this.getSaturationFromPosition(position.left), this.getValueFromPosition(position.top));
699
- this.updateHexInputValue();
700
- });
701
- }
702
- setSubscriptions() {
703
- this.hueValue$.pipe(distinctUntilChanged(), takeUntilDestroyed(this.#destroyRef)).subscribe((value) => {
704
- this.hsv.update(c => ({ ...c, h: Math.round(value) }));
705
- this.updateRgbFromHsv();
706
- this.updateHexInputValue();
707
- });
708
- this.setHsvRectPointerEvents();
709
- this.#valueChange$
710
- .pipe(takeUntilDestroyed(this.#destroyRef), distinctUntilChanged())
711
- .subscribe((value) => {
712
- this.#internalValueUpdatePending = true;
713
- this.#lastInternalValue = value;
714
- this.value.set(value);
715
- });
744
+ const area = this.hsvRectangle().nativeElement;
745
+ const isPrimaryPress = (event) => event.button === 0 && !event.ctrlKey && !this.interactionDisabled();
746
+ fromEvent(area, "mousedown")
747
+ .pipe(filter(isPrimaryPress), takeUntilDestroyed(this.#destroyRef))
748
+ .subscribe(event => event.preventDefault());
749
+ fromEvent(area, "pointerdown")
750
+ .pipe(filter(event => isPrimaryPress(event) && event.isPrimary), tap(event => {
751
+ area.setPointerCapture?.(event.pointerId);
752
+ this.hsvHandle().nativeElement.focus({ preventScroll: true });
753
+ this.moveHandleToPointer(event);
754
+ }), switchMap(({ pointerId }) => {
755
+ const isSamePointer = (event) => event.pointerId === pointerId;
756
+ const end$ = merge(fromEvent(area, "pointerup"), fromEvent(area, "pointercancel"), fromEvent(area, "lostpointercapture")).pipe(filter(isSamePointer));
757
+ return fromEvent(area, "pointermove").pipe(filter(isSamePointer), takeUntil(end$));
758
+ }), takeUntilDestroyed(this.#destroyRef))
759
+ .subscribe(event => this.moveHandleToPointer(event));
716
760
  }
717
761
  syncValue(value) {
718
762
  if (value === undefined) {
@@ -725,33 +769,15 @@ class ColorGradientComponent {
725
769
  }
726
770
  this.#internalValueUpdatePending = false;
727
771
  this.#lastInternalValue = undefined;
728
- if (value === null) {
729
- this.clear();
730
- return;
731
- }
732
- this.loadColorFromString(value);
733
- this.lastSelectedColor.set(this.hex());
772
+ this.loadValue(value);
734
773
  }
735
774
  updateHexInputValue() {
736
775
  const rgb = this.rgb();
737
776
  const hex = rgba2hex(rgb.r, rgb.g, rgb.b, this.alpha());
738
777
  this.hexInputValue.set(hex);
739
778
  }
740
- updateHsv(hsv) {
741
- this.hsv.update(c => ({ ...c, h: hsv.h, s: hsv.s, v: hsv.v }));
742
- }
743
- updateHsvRectPointerPosition(event) {
744
- const containerRect = this.hsvRectangle().nativeElement.getBoundingClientRect();
745
- const pointerRect = this.hsvHandle().nativeElement.getBoundingClientRect();
746
- const left = event.clientX - containerRect.left - pointerRect.width / 2;
747
- const top = event.clientY - containerRect.top - pointerRect.height / 2;
748
- const newLeft = Math.min(Math.max(left, -pointerRect.width / 2), containerRect.width - pointerRect.width / 2);
749
- const newTop = Math.min(Math.max(top, -pointerRect.height / 2), containerRect.height - pointerRect.height / 2);
750
- this.hsvHandleLeft.set(newLeft);
751
- this.hsvHandleTop.set(newTop);
752
- return { left: newLeft, top: newTop };
753
- }
754
779
  updateHsvValues(saturation, value) {
780
+ this.#edited = true;
755
781
  this.hsv.update(c => ({
756
782
  ...c,
757
783
  h: c.h ?? 0,
@@ -789,7 +815,7 @@ class ColorGradientComponent {
789
815
  }
790
816
  }
791
817
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorGradientComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
792
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorGradientComponent, isStandalone: true, selector: "mona-color-gradient", inputs: { 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 }, 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 }, showHexInput: { classPropertyName: "showHexInput", publicName: "showHexInput", isSignal: true, isRequired: false, transformFunction: null }, showColorInputs: { classPropertyName: "showColorInputs", publicName: "showColorInputs", 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 } }, outputs: { apply: "apply", cancel: "cancel", touch: "touch", value: "valueChange" }, host: { properties: { "class": "baseClasses()", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.aria-invalid": "invalidState() ? 'true' : null" } }, viewQueries: [{ propertyName: "hsvHandle", first: true, predicate: ["hsvPointer"], descendants: true, isSignal: true }, { propertyName: "hsvRectangle", first: true, predicate: ["hsvRectangle"], descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.px]=\"hsvHandleLeft()\"\n [style.top.px]=\"hsvHandleTop()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"messages().saturationAndValue\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-valuenow]=\"hsv().s\"\n [attr.aria-valuetext]=\"messages().saturationAndValueText(hsv().s ?? 0, hsv().v ?? 0)\"\n [attr.aria-disabled]=\"disabled() || null\"\n (keydown)=\"onHsvHandleKeyDown($event)\"\n (blur)=\"onHsvHandleBlur()\"\n #hsvPointer></div>\n</div>\n<div class=\"flex items-center gap-2\">\n <div class=\"flex flex-1 flex-col gap-1 me-2\">\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"360\"\n [trackBackground]=\"'linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)'\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"hsv().h ?? 0\"\n (valueChange)=\"hueValue$.next($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n @if (opacity()) {\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"255\"\n [trackBackground]=\"alphaSliderBackground()\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"alpha()\"\n (valueChange)=\"onAlphaChange($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n }\n </div>\n @for (preview of colorPreviews(); track preview.type) {\n <div\n [class]=\"colorPreviewClasses()\"\n [class.cursor-pointer]=\"$index === 1\"\n [style.background-color]=\"preview.color\"\n [attr.title]=\"$index === 1 ? preview.title : null\"\n [attr.aria-label]=\"$index === 1 ? preview.title : null\"\n [attr.aria-hidden]=\"$index === 0 ? 'true' : null\"\n [attr.role]=\"$index === 1 ? 'button' : null\"\n [attr.tabindex]=\"$index === 1 ? 0 : null\"\n (click)=\"preview.onClick?.()\"\n (keydown)=\"onPreviousColorKeyDown($event, preview.onClick)\"></div>\n }\n <button monaButton look=\"ghost\" size=\"small\" [attr.aria-label]=\"messages().clearColor\" (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n</div>\n<div class=\"flex flex-col gap-2\">\n @if (showColorInputs()) {\n <div class=\"flex gap-2\">\n <div class=\"flex gap-1\">\n @for (input of colorInputs(); track input.key) {\n <mona-numeric-text-box\n [value]=\"input.value\"\n [minValue]=\"input.min\"\n [maxValue]=\"input.max\"\n [decimals]=\"0\"\n [spinners]=\"false\"\n [nullable]=\"false\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n class=\"w-18\"\n (valueChange)=\"input.change($event)\"\n (inputBlur)=\"onNumericInputBlur()\">\n <ng-template monaNumericTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: input.label }\"></ng-container>\n </ng-template>\n </mona-numeric-text-box>\n }\n </div>\n <div class=\"flex flex-1 items-center justify-end\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n size=\"small\"\n [attr.aria-label]=\"messages().switchColorMode\"\n (click)=\"onSwitchColorModeClick()\">\n <svg lucideChevronsUpDown [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n </div>\n }\n @if (showHexInput()) {\n <mona-text-box\n [rounded]=\"rounded()\"\n [value]=\"hex()\"\n (valueChange)=\"onHexChange($event)\"\n (inputBlur)=\"onHexInputBlur()\"\n (inputFocus)=\"onHexInputFocus()\"\n class=\"w-full\">\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: 'HEX', classes: 'w-auto px-2' }\"></ng-container>\n </ng-template>\n <ng-template monaTextBoxSuffixTemplate>\n <mona-dropdown-button look=\"ghost\" [iconOnly]=\"true\" [aria-label]=\"messages().copyColor\" class=\"h-full\">\n <ng-template monaDropdownButtonTextTemplate>\n <svg lucideCopy [size]=\"12\"></svg>\n </ng-template>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsHex\"\n (menuClick)=\"onCopyColorSelect('hex')\"></mona-dropdown-button-item>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsRgb\"\n (menuClick)=\"onCopyColorSelect('rgb')\"></mona-dropdown-button-item>\n </mona-dropdown-button>\n </ng-template>\n </mona-text-box>\n }\n @if (showButtons()) {\n <div class=\"flex items-center justify-end gap-2\">\n <button monaButton [rounded]=\"rounded()\" look=\"primary\" (click)=\"onApply()\">{{ messages().apply }}</button>\n <button monaButton [rounded]=\"rounded()\" (click)=\"onCancel()\">{{ messages().cancel }}</button>\n </div>\n }\n</div>\n\n<ng-template #numericInputPrefixTemplate let-text let-classes=\"classes\">\n <span\n [class]=\"classes\"\n class=\"inline-flex items-center justify-center select-none w-7.5 [background-color:var(--mona-input-addon-background,var(--color-secondary))] h-full text-foreground text-xs font-semibold border-e border-e-input-border\"\n >{{ text }}</span\n >\n</ng-template>\n", dependencies: [{ kind: "component", type: LucideDropletOff, selector: "svg[lucideDropletOff]" }, { kind: "component", type: LucideChevronsUpDown, selector: "svg[lucideChevronsUpDown]" }, { kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["formatter", "maxValue", "minValue", "step", "value"], outputs: ["valueChange"] }, { kind: "directive", type: NumericTextBoxPrefixTemplateDirective, selector: "ng-template[monaNumericTextBoxPrefixTemplate]" }, { 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: TextBoxComponent, selector: "mona-text-box", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "clearButton", "disabled", "inputAttributes", "inputClass", "inputId", "inputStyle", "invalid", "maxLength", "minLength", "name", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "directive", type: TextBoxPrefixTemplateDirective, selector: "ng-template[monaTextBoxPrefixTemplate]" }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "ng-template[monaTextBoxSuffixTemplate]" }, { kind: "component", type: SliderComponent, selector: "mona-slider", inputs: ["aria-label", "aria-labelledby", "value"], outputs: ["valueChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: DropdownButtonComponent, selector: "mona-dropdown-button", inputs: ["aria-label", "aria-labelledby", "disabled", "iconOnly", "loading", "look", "popupWidth", "rounded", "showArrow", "size", "text", "class"], outputs: ["menuItemClick"] }, { kind: "component", type: DropdownButtonItemComponent, selector: "mona-dropdown-button-item" }, { kind: "directive", type: DropdownButtonTextTemplateDirective, selector: "ng-template[monaDropdownButtonTextTemplate]" }, { kind: "component", type: LucideCopy, selector: "svg[lucideCopy]" }] }); }
818
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorGradientComponent, isStandalone: true, selector: "mona-color-gradient", 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 }, 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 }, 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 }, showColorInputs: { classPropertyName: "showColorInputs", publicName: "showColorInputs", isSignal: true, isRequired: false, transformFunction: null }, showHexInput: { classPropertyName: "showHexInput", publicName: "showHexInput", 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 } }, outputs: { apply: "apply", cancel: "cancel", touch: "touch", value: "valueChange" }, host: { listeners: { "focusout": "onFocusOut($event)" }, properties: { "class": "baseClasses()", "attr.data-disabled": "effectiveDisabled()", "attr.data-readonly": "readonly() || null", "attr.data-invalid": "invalidState() || null", "attr.role": "'group'", "attr.aria-label": "labelledBy() ? null : ariaLabel() || messages().colorGradient", "attr.aria-labelledby": "labelledBy()", "attr.aria-invalid": "invalidState() ? 'true' : null" } }, viewQueries: [{ propertyName: "hsvHandle", first: true, predicate: ["hsvPointer"], descendants: true, isSignal: true }, { propertyName: "hsvRectangle", first: true, predicate: ["hsvRectangle"], descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.%]=\"hsv().s ?? 0\"\n [style.top.%]=\"100 - (hsv().v ?? 100)\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"messages().saturationAndValue\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-valuenow]=\"roundedSaturation()\"\n [attr.aria-valuetext]=\"messages().saturationAndValueText(roundedSaturation(), roundedValue())\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n (keydown)=\"onHsvHandleKeyDown($event)\"\n #hsvPointer></div>\n</div>\n<div class=\"flex items-center gap-2\">\n <div class=\"flex flex-1 flex-col gap-1 me-2 forced-color-adjust-none\">\n <mona-slider\n dir=\"ltr\"\n [aria-label]=\"messages().hue\"\n [minValue]=\"0\"\n [maxValue]=\"360\"\n [trackBackground]=\"'linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)'\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"roundedHue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (valueChange)=\"onHueChange($event)\"></mona-slider>\n @if (opacity()) {\n <mona-slider\n dir=\"ltr\"\n [aria-label]=\"messages().alpha\"\n [ariaValueText]=\"alphaValueText()\"\n [minValue]=\"0\"\n [maxValue]=\"255\"\n [trackBackground]=\"alphaSliderBackground()\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"alpha()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (valueChange)=\"onAlphaChange($event)\"></mona-slider>\n }\n </div>\n @for (preview of colorPreviews(); track preview.type) {\n <div\n [class]=\"colorPreviewClasses()\"\n [class.cursor-pointer]=\"$index === 1\"\n [style.background-color]=\"preview.color\"\n [attr.title]=\"$index === 1 ? preview.title : null\"\n [attr.aria-label]=\"$index === 1 ? preview.title : null\"\n [attr.aria-hidden]=\"$index === 0 ? 'true' : null\"\n [attr.aria-disabled]=\"$index === 1 && interactionDisabled() ? 'true' : null\"\n [attr.role]=\"$index === 1 ? 'button' : null\"\n [attr.tabindex]=\"$index === 1 && !interactionDisabled() ? 0 : null\"\n (click)=\"preview.onClick?.()\"\n (keydown)=\"onPreviousColorKeyDown($event, preview.onClick)\"></div>\n }\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [disabled]=\"interactionDisabled()\"\n [attr.aria-label]=\"messages().clearColor\"\n (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n</div>\n<div class=\"flex flex-col gap-2\">\n @if (showColorInputs()) {\n <div class=\"flex gap-2\">\n <div class=\"flex gap-1\">\n @for (input of colorInputs(); track input.key) {\n <mona-numeric-text-box\n [aria-label]=\"input.ariaLabel\"\n [value]=\"input.value\"\n [minValue]=\"input.min\"\n [maxValue]=\"input.max\"\n [decimals]=\"0\"\n [spinners]=\"false\"\n [nullable]=\"false\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n class=\"w-18\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (valueChange)=\"input.change($event)\">\n <ng-template monaNumericTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: input.label }\"></ng-container>\n </ng-template>\n </mona-numeric-text-box>\n }\n </div>\n <div class=\"flex flex-1 items-center justify-end\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n size=\"small\"\n [disabled]=\"effectiveDisabled()\"\n [attr.aria-label]=\"messages().switchColorMode\"\n (click)=\"onSwitchColorModeClick()\">\n <svg lucideChevronsUpDown [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n </div>\n }\n @if (showHexInput()) {\n <mona-text-box\n [aria-label]=\"messages().hexColor\"\n [rounded]=\"rounded()\"\n [value]=\"hex()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (valueChange)=\"onHexChange($event)\"\n (inputBlur)=\"onHexInputBlur()\"\n (inputFocus)=\"onHexInputFocus()\"\n class=\"w-full\">\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: 'HEX', classes: 'w-auto px-2' }\"></ng-container>\n </ng-template>\n <ng-template monaTextBoxSuffixTemplate>\n <mona-dropdown-button\n look=\"ghost\"\n [disabled]=\"effectiveDisabled() || !selectedColor()\"\n [iconOnly]=\"true\"\n [aria-label]=\"messages().copyColor\"\n class=\"h-full\">\n <ng-template monaDropdownButtonTextTemplate>\n <svg lucideCopy [size]=\"12\" aria-hidden=\"true\"></svg>\n </ng-template>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsHex\"\n (menuClick)=\"onCopyColorSelect('hex')\"></mona-dropdown-button-item>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsRgb\"\n (menuClick)=\"onCopyColorSelect('rgb')\"></mona-dropdown-button-item>\n </mona-dropdown-button>\n </ng-template>\n </mona-text-box>\n }\n @if (showButtons()) {\n <div class=\"flex items-center justify-end gap-2\">\n <button\n monaButton\n [rounded]=\"rounded()\"\n look=\"primary\"\n [disabled]=\"interactionDisabled()\"\n (click)=\"onApply()\">\n {{ messages().apply }}\n </button>\n <button monaButton [rounded]=\"rounded()\" [disabled]=\"effectiveDisabled()\" (click)=\"onCancel()\">\n {{ messages().cancel }}\n </button>\n </div>\n }\n</div>\n\n<ng-template #numericInputPrefixTemplate let-text let-classes=\"classes\">\n <span\n [class]=\"classes\"\n class=\"inline-flex items-center justify-center select-none w-7.5 [background-color:var(--mona-input-addon-background,var(--color-secondary))] h-full text-foreground text-xs font-semibold border-e border-e-input-border\"\n aria-hidden=\"true\"\n >{{ text }}</span\n >\n</ng-template>\n", dependencies: [{ kind: "component", type: LucideDropletOff, selector: "svg[lucideDropletOff]" }, { kind: "component", type: LucideChevronsUpDown, selector: "svg[lucideChevronsUpDown]" }, { kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["formatter", "maxValue", "minValue", "step", "value"], outputs: ["valueChange"] }, { kind: "directive", type: NumericTextBoxPrefixTemplateDirective, selector: "ng-template[monaNumericTextBoxPrefixTemplate]" }, { 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: TextBoxComponent, selector: "mona-text-box", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "clearButton", "disabled", "inputAttributes", "inputClass", "inputId", "inputStyle", "invalid", "maxLength", "minLength", "name", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "directive", type: TextBoxPrefixTemplateDirective, selector: "ng-template[monaTextBoxPrefixTemplate]" }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "ng-template[monaTextBoxSuffixTemplate]" }, { kind: "component", type: SliderComponent, selector: "mona-slider", inputs: ["max", "min", "value"], outputs: ["valueChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: DropdownButtonComponent, selector: "mona-dropdown-button", inputs: ["aria-label", "aria-labelledby", "disabled", "iconOnly", "loading", "look", "popupWidth", "rounded", "showArrow", "size", "text", "class"], outputs: ["menuItemClick"] }, { kind: "component", type: DropdownButtonItemComponent, selector: "mona-dropdown-button-item" }, { kind: "directive", type: DropdownButtonTextTemplateDirective, selector: "ng-template[monaDropdownButtonTextTemplate]" }, { kind: "component", type: LucideCopy, selector: "svg[lucideCopy]" }] }); }
793
819
  }
794
820
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorGradientComponent, decorators: [{
795
821
  type: Component,
@@ -810,11 +836,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
810
836
  LucideCopy
811
837
  ], host: {
812
838
  "[class]": "baseClasses()",
813
- "[attr.data-disabled]": "disabled()",
839
+ "[attr.data-disabled]": "effectiveDisabled()",
840
+ "[attr.data-readonly]": "readonly() || null",
841
+ "(focusout)": "onFocusOut($event)",
814
842
  "[attr.data-invalid]": "invalidState() || null",
843
+ "[attr.role]": "'group'",
844
+ "[attr.aria-label]": "labelledBy() ? null : ariaLabel() || messages().colorGradient",
845
+ "[attr.aria-labelledby]": "labelledBy()",
815
846
  "[attr.aria-invalid]": "invalidState() ? 'true' : null"
816
- }, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.px]=\"hsvHandleLeft()\"\n [style.top.px]=\"hsvHandleTop()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"messages().saturationAndValue\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-valuenow]=\"hsv().s\"\n [attr.aria-valuetext]=\"messages().saturationAndValueText(hsv().s ?? 0, hsv().v ?? 0)\"\n [attr.aria-disabled]=\"disabled() || null\"\n (keydown)=\"onHsvHandleKeyDown($event)\"\n (blur)=\"onHsvHandleBlur()\"\n #hsvPointer></div>\n</div>\n<div class=\"flex items-center gap-2\">\n <div class=\"flex flex-1 flex-col gap-1 me-2\">\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"360\"\n [trackBackground]=\"'linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)'\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"hsv().h ?? 0\"\n (valueChange)=\"hueValue$.next($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n @if (opacity()) {\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"255\"\n [trackBackground]=\"alphaSliderBackground()\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"alpha()\"\n (valueChange)=\"onAlphaChange($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n }\n </div>\n @for (preview of colorPreviews(); track preview.type) {\n <div\n [class]=\"colorPreviewClasses()\"\n [class.cursor-pointer]=\"$index === 1\"\n [style.background-color]=\"preview.color\"\n [attr.title]=\"$index === 1 ? preview.title : null\"\n [attr.aria-label]=\"$index === 1 ? preview.title : null\"\n [attr.aria-hidden]=\"$index === 0 ? 'true' : null\"\n [attr.role]=\"$index === 1 ? 'button' : null\"\n [attr.tabindex]=\"$index === 1 ? 0 : null\"\n (click)=\"preview.onClick?.()\"\n (keydown)=\"onPreviousColorKeyDown($event, preview.onClick)\"></div>\n }\n <button monaButton look=\"ghost\" size=\"small\" [attr.aria-label]=\"messages().clearColor\" (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n</div>\n<div class=\"flex flex-col gap-2\">\n @if (showColorInputs()) {\n <div class=\"flex gap-2\">\n <div class=\"flex gap-1\">\n @for (input of colorInputs(); track input.key) {\n <mona-numeric-text-box\n [value]=\"input.value\"\n [minValue]=\"input.min\"\n [maxValue]=\"input.max\"\n [decimals]=\"0\"\n [spinners]=\"false\"\n [nullable]=\"false\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n class=\"w-18\"\n (valueChange)=\"input.change($event)\"\n (inputBlur)=\"onNumericInputBlur()\">\n <ng-template monaNumericTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: input.label }\"></ng-container>\n </ng-template>\n </mona-numeric-text-box>\n }\n </div>\n <div class=\"flex flex-1 items-center justify-end\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n size=\"small\"\n [attr.aria-label]=\"messages().switchColorMode\"\n (click)=\"onSwitchColorModeClick()\">\n <svg lucideChevronsUpDown [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n </div>\n }\n @if (showHexInput()) {\n <mona-text-box\n [rounded]=\"rounded()\"\n [value]=\"hex()\"\n (valueChange)=\"onHexChange($event)\"\n (inputBlur)=\"onHexInputBlur()\"\n (inputFocus)=\"onHexInputFocus()\"\n class=\"w-full\">\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: 'HEX', classes: 'w-auto px-2' }\"></ng-container>\n </ng-template>\n <ng-template monaTextBoxSuffixTemplate>\n <mona-dropdown-button look=\"ghost\" [iconOnly]=\"true\" [aria-label]=\"messages().copyColor\" class=\"h-full\">\n <ng-template monaDropdownButtonTextTemplate>\n <svg lucideCopy [size]=\"12\"></svg>\n </ng-template>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsHex\"\n (menuClick)=\"onCopyColorSelect('hex')\"></mona-dropdown-button-item>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsRgb\"\n (menuClick)=\"onCopyColorSelect('rgb')\"></mona-dropdown-button-item>\n </mona-dropdown-button>\n </ng-template>\n </mona-text-box>\n }\n @if (showButtons()) {\n <div class=\"flex items-center justify-end gap-2\">\n <button monaButton [rounded]=\"rounded()\" look=\"primary\" (click)=\"onApply()\">{{ messages().apply }}</button>\n <button monaButton [rounded]=\"rounded()\" (click)=\"onCancel()\">{{ messages().cancel }}</button>\n </div>\n }\n</div>\n\n<ng-template #numericInputPrefixTemplate let-text let-classes=\"classes\">\n <span\n [class]=\"classes\"\n class=\"inline-flex items-center justify-center select-none w-7.5 [background-color:var(--mona-input-addon-background,var(--color-secondary))] h-full text-foreground text-xs font-semibold border-e border-e-input-border\"\n >{{ text }}</span\n >\n</ng-template>\n" }]
817
- }], ctorParameters: () => [], propDecorators: { hsvHandle: [{ type: i0.ViewChild, args: ["hsvPointer", { isSignal: true }] }], hsvRectangle: [{ type: i0.ViewChild, args: ["hsvRectangle", { isSignal: true }] }], apply: [{ type: i0.Output, args: ["apply"] }], cancel: [{ type: i0.Output, args: ["cancel"] }], 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 }] }], 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 }] }], showHexInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHexInput", required: false }] }], showColorInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "showColorInputs", 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"] }] } });
847
+ }, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.%]=\"hsv().s ?? 0\"\n [style.top.%]=\"100 - (hsv().v ?? 100)\"\n [attr.tabindex]=\"effectiveDisabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"messages().saturationAndValue\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-valuenow]=\"roundedSaturation()\"\n [attr.aria-valuetext]=\"messages().saturationAndValueText(roundedSaturation(), roundedValue())\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-readonly]=\"readonly() || null\"\n (keydown)=\"onHsvHandleKeyDown($event)\"\n #hsvPointer></div>\n</div>\n<div class=\"flex items-center gap-2\">\n <div class=\"flex flex-1 flex-col gap-1 me-2 forced-color-adjust-none\">\n <mona-slider\n dir=\"ltr\"\n [aria-label]=\"messages().hue\"\n [minValue]=\"0\"\n [maxValue]=\"360\"\n [trackBackground]=\"'linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)'\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"roundedHue()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (valueChange)=\"onHueChange($event)\"></mona-slider>\n @if (opacity()) {\n <mona-slider\n dir=\"ltr\"\n [aria-label]=\"messages().alpha\"\n [ariaValueText]=\"alphaValueText()\"\n [minValue]=\"0\"\n [maxValue]=\"255\"\n [trackBackground]=\"alphaSliderBackground()\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"alpha()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (valueChange)=\"onAlphaChange($event)\"></mona-slider>\n }\n </div>\n @for (preview of colorPreviews(); track preview.type) {\n <div\n [class]=\"colorPreviewClasses()\"\n [class.cursor-pointer]=\"$index === 1\"\n [style.background-color]=\"preview.color\"\n [attr.title]=\"$index === 1 ? preview.title : null\"\n [attr.aria-label]=\"$index === 1 ? preview.title : null\"\n [attr.aria-hidden]=\"$index === 0 ? 'true' : null\"\n [attr.aria-disabled]=\"$index === 1 && interactionDisabled() ? 'true' : null\"\n [attr.role]=\"$index === 1 ? 'button' : null\"\n [attr.tabindex]=\"$index === 1 && !interactionDisabled() ? 0 : null\"\n (click)=\"preview.onClick?.()\"\n (keydown)=\"onPreviousColorKeyDown($event, preview.onClick)\"></div>\n }\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [disabled]=\"interactionDisabled()\"\n [attr.aria-label]=\"messages().clearColor\"\n (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n</div>\n<div class=\"flex flex-col gap-2\">\n @if (showColorInputs()) {\n <div class=\"flex gap-2\">\n <div class=\"flex gap-1\">\n @for (input of colorInputs(); track input.key) {\n <mona-numeric-text-box\n [aria-label]=\"input.ariaLabel\"\n [value]=\"input.value\"\n [minValue]=\"input.min\"\n [maxValue]=\"input.max\"\n [decimals]=\"0\"\n [spinners]=\"false\"\n [nullable]=\"false\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n class=\"w-18\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (valueChange)=\"input.change($event)\">\n <ng-template monaNumericTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: input.label }\"></ng-container>\n </ng-template>\n </mona-numeric-text-box>\n }\n </div>\n <div class=\"flex flex-1 items-center justify-end\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n size=\"small\"\n [disabled]=\"effectiveDisabled()\"\n [attr.aria-label]=\"messages().switchColorMode\"\n (click)=\"onSwitchColorModeClick()\">\n <svg lucideChevronsUpDown [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n </div>\n }\n @if (showHexInput()) {\n <mona-text-box\n [aria-label]=\"messages().hexColor\"\n [rounded]=\"rounded()\"\n [value]=\"hex()\"\n [disabled]=\"effectiveDisabled()\"\n [readonly]=\"readonly()\"\n (valueChange)=\"onHexChange($event)\"\n (inputBlur)=\"onHexInputBlur()\"\n (inputFocus)=\"onHexInputFocus()\"\n class=\"w-full\">\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: 'HEX', classes: 'w-auto px-2' }\"></ng-container>\n </ng-template>\n <ng-template monaTextBoxSuffixTemplate>\n <mona-dropdown-button\n look=\"ghost\"\n [disabled]=\"effectiveDisabled() || !selectedColor()\"\n [iconOnly]=\"true\"\n [aria-label]=\"messages().copyColor\"\n class=\"h-full\">\n <ng-template monaDropdownButtonTextTemplate>\n <svg lucideCopy [size]=\"12\" aria-hidden=\"true\"></svg>\n </ng-template>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsHex\"\n (menuClick)=\"onCopyColorSelect('hex')\"></mona-dropdown-button-item>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsRgb\"\n (menuClick)=\"onCopyColorSelect('rgb')\"></mona-dropdown-button-item>\n </mona-dropdown-button>\n </ng-template>\n </mona-text-box>\n }\n @if (showButtons()) {\n <div class=\"flex items-center justify-end gap-2\">\n <button\n monaButton\n [rounded]=\"rounded()\"\n look=\"primary\"\n [disabled]=\"interactionDisabled()\"\n (click)=\"onApply()\">\n {{ messages().apply }}\n </button>\n <button monaButton [rounded]=\"rounded()\" [disabled]=\"effectiveDisabled()\" (click)=\"onCancel()\">\n {{ messages().cancel }}\n </button>\n </div>\n }\n</div>\n\n<ng-template #numericInputPrefixTemplate let-text let-classes=\"classes\">\n <span\n [class]=\"classes\"\n class=\"inline-flex items-center justify-center select-none w-7.5 [background-color:var(--mona-input-addon-background,var(--color-secondary))] h-full text-foreground text-xs font-semibold border-e border-e-input-border\"\n aria-hidden=\"true\"\n >{{ text }}</span\n >\n</ng-template>\n" }]
848
+ }], ctorParameters: () => [], propDecorators: { hsvHandle: [{ type: i0.ViewChild, args: ["hsvPointer", { isSignal: true }] }], hsvRectangle: [{ type: i0.ViewChild, args: ["hsvRectangle", { isSignal: true }] }], apply: [{ type: i0.Output, args: ["apply"] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], cancel: [{ type: i0.Output, args: ["cancel"] }], 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 }] }], 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 }] }], showColorInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "showColorInputs", required: false }] }], showHexInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHexInput", 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"] }] } });
818
849
 
819
850
  /*
820
851
  * Public API Surface of @nanahoshi/mona-ui/color-gradient