@ng-matero/extensions 17.0.0 → 17.1.1

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 (197) hide show
  1. package/_index.scss +24 -12
  2. package/alert/alert-module.d.ts +3 -3
  3. package/alert/alert.d.ts +1 -1
  4. package/checkbox-group/checkbox-group-module.d.ts +6 -6
  5. package/checkbox-group/checkbox-group.d.ts +1 -1
  6. package/colorpicker/colorpicker-input.d.ts +1 -1
  7. package/colorpicker/colorpicker-module.d.ts +10 -10
  8. package/colorpicker/colorpicker-toggle.d.ts +2 -2
  9. package/colorpicker/colorpicker.d.ts +3 -3
  10. package/column-resize/column-resize-directives/column-resize-flex.d.ts +1 -1
  11. package/column-resize/column-resize-directives/column-resize.d.ts +1 -1
  12. package/column-resize/column-resize-module.d.ts +1 -1
  13. package/core/color/_all-color.scss +3 -3
  14. package/core/datetime/datetime.module.d.ts +4 -1
  15. package/core/datetime/index.d.ts +5 -5
  16. package/core/density/_all-density.scss +2 -2
  17. package/core/pipes/is-template-ref.pipe.d.ts +1 -1
  18. package/core/pipes/pipes.module.d.ts +4 -4
  19. package/core/pipes/to-observable.pipe.d.ts +1 -1
  20. package/core/tokens/m2/mdc/_plain-tooltip.scss +6 -6
  21. package/core/tokens/m2/mtx/_select.scss +1 -42
  22. package/core/typography/_all-typography.scss +2 -2
  23. package/datetimepicker/calendar-body.d.ts +1 -1
  24. package/datetimepicker/calendar.d.ts +1 -1
  25. package/datetimepicker/clock.d.ts +1 -1
  26. package/datetimepicker/datetimepicker-input.d.ts +1 -1
  27. package/datetimepicker/datetimepicker-module.d.ts +16 -16
  28. package/datetimepicker/datetimepicker-toggle.d.ts +2 -2
  29. package/datetimepicker/datetimepicker.d.ts +3 -3
  30. package/datetimepicker/month-view.d.ts +1 -1
  31. package/datetimepicker/multi-year-view.d.ts +1 -1
  32. package/datetimepicker/time.d.ts +3 -3
  33. package/datetimepicker/year-view.d.ts +1 -1
  34. package/dialog/dialog-container.d.ts +1 -1
  35. package/dialog/dialog-module.d.ts +7 -7
  36. package/drawer/drawer-container.d.ts +1 -1
  37. package/drawer/drawer-module.d.ts +5 -5
  38. package/esm2022/alert/alert-module.mjs +6 -7
  39. package/esm2022/alert/alert.mjs +5 -5
  40. package/esm2022/button/button-loading.mjs +4 -4
  41. package/esm2022/button/button-module.mjs +4 -4
  42. package/esm2022/checkbox-group/checkbox-group-module.mjs +6 -7
  43. package/esm2022/checkbox-group/checkbox-group.mjs +9 -10
  44. package/esm2022/colorpicker/colorpicker-input.mjs +5 -4
  45. package/esm2022/colorpicker/colorpicker-module.mjs +20 -19
  46. package/esm2022/colorpicker/colorpicker-toggle.mjs +10 -9
  47. package/esm2022/colorpicker/colorpicker.mjs +25 -18
  48. package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +5 -4
  49. package/esm2022/column-resize/column-resize-directives/column-resize.mjs +5 -4
  50. package/esm2022/column-resize/column-resize-module.mjs +6 -6
  51. package/esm2022/column-resize/column-resize-notifier.mjs +6 -6
  52. package/esm2022/column-resize/column-resize.mjs +4 -4
  53. package/esm2022/column-resize/column-size-store.mjs +3 -3
  54. package/esm2022/column-resize/event-dispatcher.mjs +4 -4
  55. package/esm2022/column-resize/overlay-handle.mjs +4 -4
  56. package/esm2022/column-resize/polyfill.mjs +1 -1
  57. package/esm2022/column-resize/resizable.mjs +4 -4
  58. package/esm2022/column-resize/resize-strategy.mjs +10 -10
  59. package/esm2022/core/datetime/datetime-adapter.mjs +1 -1
  60. package/esm2022/core/datetime/datetime.module.mjs +19 -23
  61. package/esm2022/core/datetime/index.mjs +6 -6
  62. package/esm2022/core/datetime/native-datetime-adapter.mjs +4 -4
  63. package/esm2022/core/pipes/is-template-ref.pipe.mjs +5 -5
  64. package/esm2022/core/pipes/pipes.module.mjs +6 -7
  65. package/esm2022/core/pipes/to-observable.pipe.mjs +5 -5
  66. package/esm2022/datetimepicker/calendar-body.mjs +5 -5
  67. package/esm2022/datetimepicker/calendar.mjs +19 -12
  68. package/esm2022/datetimepicker/clock.mjs +6 -7
  69. package/esm2022/datetimepicker/datetimepicker-errors.mjs +4 -3
  70. package/esm2022/datetimepicker/datetimepicker-input.mjs +6 -5
  71. package/esm2022/datetimepicker/datetimepicker-intl.mjs +3 -3
  72. package/esm2022/datetimepicker/datetimepicker-module.mjs +28 -11
  73. package/esm2022/datetimepicker/datetimepicker-toggle.mjs +10 -9
  74. package/esm2022/datetimepicker/datetimepicker.mjs +23 -19
  75. package/esm2022/datetimepicker/month-view.mjs +6 -7
  76. package/esm2022/datetimepicker/multi-year-view.mjs +6 -7
  77. package/esm2022/datetimepicker/time.mjs +11 -10
  78. package/esm2022/datetimepicker/year-view.mjs +6 -7
  79. package/esm2022/dialog/dialog-container.mjs +19 -10
  80. package/esm2022/dialog/dialog-module.mjs +23 -7
  81. package/esm2022/dialog/dialog.mjs +6 -5
  82. package/esm2022/drawer/drawer-container.mjs +5 -6
  83. package/esm2022/drawer/drawer-module.mjs +6 -7
  84. package/esm2022/drawer/drawer-ref.mjs +1 -1
  85. package/esm2022/drawer/drawer.mjs +6 -5
  86. package/esm2022/grid/cell.mjs +35 -13
  87. package/esm2022/grid/column-menu.mjs +31 -15
  88. package/esm2022/grid/column-resize/column-resize-directives/column-resize-flex.mjs +5 -4
  89. package/esm2022/grid/column-resize/column-resize-directives/column-resize.mjs +5 -4
  90. package/esm2022/grid/column-resize/column-resize-module.mjs +14 -14
  91. package/esm2022/grid/column-resize/index.mjs +8 -0
  92. package/esm2022/grid/column-resize/overlay-handle.mjs +5 -4
  93. package/esm2022/grid/column-resize/resizable-directives/resizable.mjs +5 -4
  94. package/esm2022/grid/column-resize/resize-strategy.mjs +3 -3
  95. package/esm2022/grid/expansion-toggle.mjs +5 -4
  96. package/esm2022/grid/grid-module.mjs +39 -37
  97. package/esm2022/grid/grid-pipes.mjs +29 -29
  98. package/esm2022/grid/grid-utils.mjs +6 -5
  99. package/esm2022/grid/grid.mjs +108 -76
  100. package/esm2022/loader/loader-module.mjs +6 -7
  101. package/esm2022/loader/loader.mjs +7 -7
  102. package/esm2022/photoviewer/photoviewer-module.mjs +6 -7
  103. package/esm2022/photoviewer/photoviewer.mjs +5 -4
  104. package/esm2022/popover/popover-content.mjs +8 -7
  105. package/esm2022/popover/popover-module.mjs +22 -7
  106. package/esm2022/popover/popover-target.mjs +5 -4
  107. package/esm2022/popover/popover-trigger.mjs +13 -6
  108. package/esm2022/popover/popover.mjs +7 -7
  109. package/esm2022/progress/progress-module.mjs +6 -7
  110. package/esm2022/progress/progress.mjs +6 -6
  111. package/esm2022/select/option.mjs +5 -4
  112. package/esm2022/select/select-module.mjs +20 -9
  113. package/esm2022/select/select.mjs +11 -11
  114. package/esm2022/select/templates.mjs +45 -45
  115. package/esm2022/split/split-module.mjs +6 -7
  116. package/esm2022/split/split-pane.mjs +5 -4
  117. package/esm2022/split/split.mjs +6 -6
  118. package/esm2022/split/utils.mjs +1 -1
  119. package/esm2022/tooltip/tooltip-module.mjs +24 -7
  120. package/esm2022/tooltip/tooltip.mjs +101 -114
  121. package/fesm2022/mtxAlert.mjs +9 -10
  122. package/fesm2022/mtxAlert.mjs.map +1 -1
  123. package/fesm2022/mtxButton.mjs +7 -7
  124. package/fesm2022/mtxButton.mjs.map +1 -1
  125. package/fesm2022/mtxCheckboxGroup.mjs +12 -16
  126. package/fesm2022/mtxCheckboxGroup.mjs.map +1 -1
  127. package/fesm2022/mtxColorpicker.mjs +462 -454
  128. package/fesm2022/mtxColorpicker.mjs.map +1 -1
  129. package/fesm2022/mtxColumnResize.mjs +43 -41
  130. package/fesm2022/mtxColumnResize.mjs.map +1 -1
  131. package/fesm2022/mtxCore.mjs +35 -40
  132. package/fesm2022/mtxCore.mjs.map +1 -1
  133. package/fesm2022/mtxDatetimepicker.mjs +814 -781
  134. package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
  135. package/fesm2022/mtxDialog.mjs +44 -22
  136. package/fesm2022/mtxDialog.mjs.map +1 -1
  137. package/fesm2022/mtxDrawer.mjs +14 -15
  138. package/fesm2022/mtxDrawer.mjs.map +1 -1
  139. package/fesm2022/mtxGrid.mjs +249 -180
  140. package/fesm2022/mtxGrid.mjs.map +1 -1
  141. package/fesm2022/mtxLoader.mjs +11 -14
  142. package/fesm2022/mtxLoader.mjs.map +1 -1
  143. package/fesm2022/mtxPhotoviewer.mjs +9 -9
  144. package/fesm2022/mtxPhotoviewer.mjs.map +1 -1
  145. package/fesm2022/mtxPopover.mjs +52 -29
  146. package/fesm2022/mtxPopover.mjs.map +1 -1
  147. package/fesm2022/mtxProgress.mjs +10 -12
  148. package/fesm2022/mtxProgress.mjs.map +1 -1
  149. package/fesm2022/mtxSelect.mjs +75 -64
  150. package/fesm2022/mtxSelect.mjs.map +1 -1
  151. package/fesm2022/mtxSplit.mjs +14 -15
  152. package/fesm2022/mtxSplit.mjs.map +1 -1
  153. package/fesm2022/mtxTooltip.mjs +124 -121
  154. package/fesm2022/mtxTooltip.mjs.map +1 -1
  155. package/grid/cell.d.ts +1 -1
  156. package/grid/column-menu.d.ts +1 -1
  157. package/grid/column-resize/column-resize-directives/column-resize-flex.d.ts +1 -1
  158. package/grid/column-resize/column-resize-directives/column-resize.d.ts +1 -1
  159. package/grid/column-resize/column-resize-module.d.ts +7 -6
  160. package/grid/column-resize/index.d.ts +7 -0
  161. package/grid/column-resize/overlay-handle.d.ts +1 -1
  162. package/grid/column-resize/resizable-directives/resizable.d.ts +1 -1
  163. package/grid/expansion-toggle.d.ts +1 -1
  164. package/grid/grid-module.d.ts +25 -25
  165. package/grid/grid-pipes.d.ts +7 -7
  166. package/grid/grid.d.ts +24 -24
  167. package/loader/loader-module.d.ts +5 -5
  168. package/loader/loader.d.ts +1 -1
  169. package/package.json +17 -17
  170. package/photoviewer/photoviewer-module.d.ts +1 -1
  171. package/photoviewer/photoviewer.d.ts +1 -1
  172. package/popover/popover-content.d.ts +1 -1
  173. package/popover/popover-module.d.ts +8 -8
  174. package/popover/popover-target.d.ts +1 -1
  175. package/popover/popover-trigger.d.ts +1 -1
  176. package/popover/popover.d.ts +1 -1
  177. package/prebuilt-themes/deeppurple-amber.css +1 -1
  178. package/prebuilt-themes/indigo-pink.css +1 -1
  179. package/prebuilt-themes/pink-bluegrey.css +1 -1
  180. package/prebuilt-themes/purple-green.css +1 -1
  181. package/progress/progress-module.d.ts +3 -3
  182. package/progress/progress.d.ts +1 -1
  183. package/select/option.d.ts +1 -1
  184. package/select/select-module.d.ts +7 -7
  185. package/select/select.d.ts +1 -1
  186. package/select/select.scss +9 -10
  187. package/select/templates.d.ts +11 -11
  188. package/split/split-module.d.ts +4 -4
  189. package/split/split-pane.d.ts +1 -1
  190. package/split/split.d.ts +1 -1
  191. package/tooltip/tooltip-module.d.ts +7 -7
  192. package/tooltip/tooltip.d.ts +30 -44
  193. package/tooltip/tooltip.scss +2 -4
  194. package/core/mdc-helpers/_mdc-helpers.scss +0 -31
  195. package/core/style/_validation.scss +0 -43
  196. package/core/theming/_inspection.scss +0 -303
  197. package/core/theming/_m2-inspection.scss +0 -266
@@ -1,342 +1,23 @@
1
- import * as i1$2 from '@angular/common';
2
- import { DOCUMENT, CommonModule } from '@angular/common';
3
- import * as i0 from '@angular/core';
4
- import { forwardRef, EventEmitter, booleanAttribute, Directive, Optional, Input, Output, Component, ViewEncapsulation, ChangeDetectionStrategy, Attribute, ContentChild, ViewChild, InjectionToken, Inject, NgModule } from '@angular/core';
5
- import * as i3 from '@angular/cdk/overlay';
6
- import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
7
- import { A11yModule } from '@angular/cdk/a11y';
8
- import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
9
- import * as i1$1 from '@angular/material/button';
10
- import { MatButtonModule } from '@angular/material/button';
11
- import { DOWN_ARROW, ESCAPE, hasModifierKey, UP_ARROW } from '@angular/cdk/keycodes';
12
- import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
13
- import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input';
14
- import { Subscription, of, merge, Subject } from 'rxjs';
15
- import * as i1 from '@angular/material/form-field';
16
- import { mixinColor } from '@angular/material/core';
17
- import { take, filter } from 'rxjs/operators';
18
- import { style, keyframes, animate, transition, trigger } from '@angular/animations';
19
- import { TinyColor } from '@ctrl/tinycolor';
20
- import * as i2 from 'ngx-color/chrome';
21
- import { ColorChromeModule } from 'ngx-color/chrome';
22
- import * as i4 from '@angular/cdk/bidi';
23
-
24
- class MtxColorPickerInputEvent {
25
- constructor(
26
- /** Reference to the colorpicker input component that emitted the event. */
27
- target,
28
- /** Reference to the native input element associated with the colorpicker input. */
29
- targetElement) {
30
- this.target = target;
31
- this.targetElement = targetElement;
32
- this.value = this.target.value;
33
- }
34
- }
35
- const MTX_COLORPICKER_VALUE_ACCESSOR = {
36
- provide: NG_VALUE_ACCESSOR,
37
- useExisting: forwardRef(() => MtxColorpickerInput),
38
- multi: true,
39
- };
40
- const MTX_COLORPICKER_VALIDATORS = {
41
- provide: NG_VALIDATORS,
42
- useExisting: forwardRef(() => MtxColorpickerInput),
43
- multi: true,
44
- };
45
- class MtxColorpickerInput {
46
- set mtxColorpicker(value) {
47
- if (!value) {
48
- return;
49
- }
50
- this._picker = value;
51
- this._picker.registerInput(this);
52
- this._pickerSubscription.unsubscribe();
53
- this._pickerSubscription = this._picker._selectedChanged.subscribe((selected) => {
54
- this.value = selected;
55
- this._cvaOnChange(selected);
56
- this._onTouched();
57
- this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
58
- this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
59
- });
60
- }
61
- /** Whether the colorpicker-input is disabled. */
62
- get disabled() {
63
- return !!this._disabled;
64
- }
65
- set disabled(value) {
66
- const element = this._elementRef.nativeElement;
67
- if (this._disabled !== value) {
68
- this._disabled = value;
69
- this._disabledChange.emit(value);
70
- }
71
- // We need to null check the `blur` method, because it's undefined during SSR.
72
- // In Ivy static bindings are invoked earlier, before the element is attached to the DOM.
73
- // This can cause an error to be thrown in some browsers (IE/Edge) which assert that the
74
- // element has been inserted.
75
- if (value && this._isInitialized && element.blur) {
76
- // Normally, native input elements automatically blur if they turn disabled. This behavior
77
- // is problematic, because it would mean that it triggers another change detection cycle,
78
- // which then causes a changed after checked error if the input element was focused before.
79
- element.blur();
80
- }
81
- }
82
- /** The value of the input. */
83
- get value() {
84
- return this._value;
85
- }
86
- set value(value) {
87
- const oldValue = this.value;
88
- this._value = value;
89
- this._formatValue(value);
90
- this._valueChange.emit(value);
91
- }
92
- constructor(_elementRef, _formField) {
93
- this._elementRef = _elementRef;
94
- this._formField = _formField;
95
- /** The input and output color format. */
96
- this.format = 'hex';
97
- /** Emits when a `change` event is fired on this `<input>`. */
98
- this.colorChange = new EventEmitter();
99
- /** Emits when an `input` event is fired on this `<input>`. */
100
- this.colorInput = new EventEmitter();
101
- /** Emits when the disabled state has changed */
102
- this._disabledChange = new EventEmitter();
103
- /** Emits when the value changes (either due to user input or programmatic change). */
104
- this._valueChange = new EventEmitter();
105
- this._onTouched = () => { };
106
- this._validatorOnChange = () => { };
107
- this._cvaOnChange = () => { };
108
- this._pickerSubscription = Subscription.EMPTY;
109
- /** The combined form control validator for this input. */
110
- this._validator = Validators.compose([]);
111
- /** Whether the last value set on the input was valid. */
112
- this._lastValueValid = false;
113
- }
114
- ngAfterViewInit() {
115
- this._isInitialized = true;
116
- }
117
- ngOnDestroy() {
118
- this._pickerSubscription.unsubscribe();
119
- this._valueChange.complete();
120
- this._disabledChange.complete();
121
- }
122
- registerOnValidatorChange(fn) {
123
- this._validatorOnChange = fn;
124
- }
125
- /** @docs-private */
126
- validate(c) {
127
- return this._validator ? this._validator(c) : null;
128
- }
129
- /**
130
- * @deprecated
131
- * @breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
132
- */
133
- getPopupConnectionElementRef() {
134
- return this.getConnectedOverlayOrigin();
135
- }
136
- /**
137
- * Gets the element that the colorpicker popup should be connected to.
138
- * @return The element to connect the popup to.
139
- */
140
- getConnectedOverlayOrigin() {
141
- return this._formField ? this._formField.getConnectedOverlayOrigin() : this._elementRef;
142
- }
143
- /** Gets the ID of an element that should be used a description for the overlay. */
144
- getOverlayLabelId() {
145
- if (this._formField) {
146
- return this._formField.getLabelId();
147
- }
148
- return this._elementRef.nativeElement.getAttribute('aria-labelledby');
149
- }
150
- // Implemented as part of ControlValueAccessor.
151
- writeValue(value) {
152
- this.value = value;
153
- }
154
- // Implemented as part of ControlValueAccessor.
155
- registerOnChange(fn) {
156
- this._cvaOnChange = fn;
157
- }
158
- // Implemented as part of ControlValueAccessor.
159
- registerOnTouched(fn) {
160
- this._onTouched = fn;
161
- }
162
- // Implemented as part of ControlValueAccessor.
163
- setDisabledState(isDisabled) {
164
- this.disabled = isDisabled;
165
- }
166
- _onKeydown(event) {
167
- const isAltDownArrow = event.altKey && event.keyCode === DOWN_ARROW;
168
- if (this._picker && isAltDownArrow && !this._elementRef.nativeElement.readOnly) {
169
- this._picker.open();
170
- event.preventDefault();
171
- }
172
- }
173
- /** Handles blur events on the input. */
174
- _onBlur() {
175
- // Reformat the input only if we have a valid value.
176
- if (this.value) {
177
- this._formatValue(this.value);
178
- }
179
- this._onTouched();
180
- }
181
- _onInput(value) {
182
- const nextValue = value;
183
- this._value = nextValue;
184
- this._cvaOnChange(nextValue);
185
- this._valueChange.emit(nextValue);
186
- this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
187
- }
188
- _onChange() {
189
- this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
190
- }
191
- /** Returns the palette used by the input's form field, if any. */
192
- getThemePalette() {
193
- return this._formField ? this._formField.color : undefined;
194
- }
195
- /** TODO: Formats a value and sets it on the input element. */
196
- _formatValue(value) {
197
- this._elementRef.nativeElement.value = value ? value : '';
198
- }
199
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerInput, deps: [{ token: i0.ElementRef }, { token: i1.MatFormField, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
200
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.0.7", type: MtxColorpickerInput, selector: "input[mtxColorpicker]", inputs: { mtxColorpicker: "mtxColorpicker", disabled: ["disabled", "disabled", booleanAttribute], value: "value", format: "format" }, outputs: { colorChange: "colorChange", colorInput: "colorInput" }, host: { listeners: { "input": "_onInput($event.target.value)", "change": "_onChange()", "blur": "_onBlur()", "keydown": "_onKeydown($event)" }, properties: { "attr.aria-haspopup": "_picker ? \"dialog\" : null", "attr.aria-owns": "(_picker?.opened && _picker.id) || null", "disabled": "disabled" }, classAttribute: "mtx-colorpicker-input" }, providers: [
201
- MTX_COLORPICKER_VALUE_ACCESSOR,
202
- MTX_COLORPICKER_VALIDATORS,
203
- { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
204
- ], exportAs: ["mtxColorpickerInput"], ngImport: i0 }); }
205
- }
206
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerInput, decorators: [{
207
- type: Directive,
208
- args: [{
209
- selector: 'input[mtxColorpicker]',
210
- providers: [
211
- MTX_COLORPICKER_VALUE_ACCESSOR,
212
- MTX_COLORPICKER_VALIDATORS,
213
- { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
214
- ],
215
- host: {
216
- 'class': 'mtx-colorpicker-input',
217
- '[attr.aria-haspopup]': '_picker ? "dialog" : null',
218
- '[attr.aria-owns]': '(_picker?.opened && _picker.id) || null',
219
- '[disabled]': 'disabled',
220
- '(input)': '_onInput($event.target.value)',
221
- '(change)': '_onChange()',
222
- '(blur)': '_onBlur()',
223
- '(keydown)': '_onKeydown($event)',
224
- },
225
- exportAs: 'mtxColorpickerInput',
226
- }]
227
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.MatFormField, decorators: [{
228
- type: Optional
229
- }] }], propDecorators: { mtxColorpicker: [{
230
- type: Input
231
- }], disabled: [{
232
- type: Input,
233
- args: [{ transform: booleanAttribute }]
234
- }], value: [{
235
- type: Input
236
- }], format: [{
237
- type: Input
238
- }], colorChange: [{
239
- type: Output
240
- }], colorInput: [{
241
- type: Output
242
- }] } });
243
-
244
- /** Can be used to override the icon of a `mtxColorpickerToggle`. */
245
- class MtxColorpickerToggleIcon {
246
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerToggleIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
247
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.7", type: MtxColorpickerToggleIcon, selector: "[mtxColorpickerToggleIcon]", ngImport: i0 }); }
248
- }
249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerToggleIcon, decorators: [{
250
- type: Directive,
251
- args: [{
252
- selector: '[mtxColorpickerToggleIcon]',
253
- }]
254
- }] });
255
- class MtxColorpickerToggle {
256
- /** Whether the toggle button is disabled. */
257
- get disabled() {
258
- if (this._disabled == null && this.picker) {
259
- return this.picker.disabled;
260
- }
261
- return !!this._disabled;
262
- }
263
- set disabled(value) {
264
- this._disabled = value;
265
- }
266
- constructor(_changeDetectorRef, defaultTabIndex) {
267
- this._changeDetectorRef = _changeDetectorRef;
268
- this._stateChanges = Subscription.EMPTY;
269
- const parsedTabIndex = Number(defaultTabIndex);
270
- this.tabIndex = parsedTabIndex || parsedTabIndex === 0 ? parsedTabIndex : null;
271
- }
272
- ngOnChanges(changes) {
273
- if (changes.picker) {
274
- this._watchStateChanges();
275
- }
276
- }
277
- ngOnDestroy() {
278
- this._stateChanges.unsubscribe();
279
- }
280
- ngAfterContentInit() {
281
- this._watchStateChanges();
282
- }
283
- _open(event) {
284
- if (this.picker && !this.disabled) {
285
- this.picker.open();
286
- event.stopPropagation();
287
- }
288
- }
289
- _watchStateChanges() {
290
- const pickerDisabled = this.picker ? this.picker._disabledChange : of();
291
- const inputDisabled = this.picker && this.picker.pickerInput
292
- ? this.picker.pickerInput._disabledChange
293
- : of();
294
- const pickerToggled = this.picker
295
- ? merge(this.picker.openedStream, this.picker.closedStream)
296
- : of();
297
- this._stateChanges.unsubscribe();
298
- this._stateChanges = merge(pickerDisabled, inputDisabled, pickerToggled).subscribe(() => this._changeDetectorRef.markForCheck());
299
- }
300
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerToggle, deps: [{ token: i0.ChangeDetectorRef }, { token: 'tabindex', attribute: true }], target: i0.ɵɵFactoryTarget.Component }); }
301
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.7", type: MtxColorpickerToggle, selector: "mtx-colorpicker-toggle", inputs: { picker: ["for", "picker"], tabIndex: "tabIndex", ariaLabel: ["aria-label", "ariaLabel"], disabled: ["disabled", "disabled", booleanAttribute], disableRipple: ["disableRipple", "disableRipple", booleanAttribute] }, host: { listeners: { "click": "_open($event)" }, properties: { "attr.tabindex": "null", "class.mtx-colorpicker-toggle-active": "picker && picker.opened", "class.mat-accent": "picker && picker.color === \"accent\"", "class.mat-warn": "picker && picker.color === \"warn\"" }, classAttribute: "mtx-colorpicker-toggle" }, queries: [{ propertyName: "_customIcon", first: true, predicate: MtxColorpickerToggleIcon, descendants: true }], viewQueries: [{ propertyName: "_button", first: true, predicate: ["button"], descendants: true }], exportAs: ["mtxColorpickerToggle"], usesOnChanges: true, ngImport: i0, template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"picker ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\">\n\n @if (!_customIcon) {\n <svg\n class=\"mtx-colorpicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path d=\"M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z\" />\n </svg>\n }\n\n <ng-content select=\"[mtxColorpickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mtx-colorpicker-toggle{pointer-events:auto;color:var(--mtx-colorpicker-toggle-icon-color)}.mtx-colorpicker-toggle-active{color:var(--mtx-colorpicker-toggle-active-state-icon-color)}.cdk-high-contrast-active .mtx-colorpicker-toggle-default-icon{color:CanvasText}\n"], dependencies: [{ kind: "component", type: i1$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
302
- }
303
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerToggle, decorators: [{
304
- type: Component,
305
- args: [{ selector: 'mtx-colorpicker-toggle', host: {
306
- 'class': 'mtx-colorpicker-toggle',
307
- '[attr.tabindex]': 'null',
308
- '[class.mtx-colorpicker-toggle-active]': 'picker && picker.opened',
309
- '[class.mat-accent]': 'picker && picker.color === "accent"',
310
- '[class.mat-warn]': 'picker && picker.color === "warn"',
311
- // Bind the `click` on the host, rather than the inner `button`, so that we can call
312
- // `stopPropagation` on it without affecting the user's `click` handlers. We need to stop
313
- // it so that the input doesn't get focused automatically by the form field (See #21836).
314
- '(click)': '_open($event)',
315
- }, exportAs: 'mtxColorpickerToggle', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"picker ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\">\n\n @if (!_customIcon) {\n <svg\n class=\"mtx-colorpicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path d=\"M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z\" />\n </svg>\n }\n\n <ng-content select=\"[mtxColorpickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mtx-colorpicker-toggle{pointer-events:auto;color:var(--mtx-colorpicker-toggle-icon-color)}.mtx-colorpicker-toggle-active{color:var(--mtx-colorpicker-toggle-active-state-icon-color)}.cdk-high-contrast-active .mtx-colorpicker-toggle-default-icon{color:CanvasText}\n"] }]
316
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
317
- type: Attribute,
318
- args: ['tabindex']
319
- }] }], propDecorators: { picker: [{
320
- type: Input,
321
- args: ['for']
322
- }], tabIndex: [{
323
- type: Input
324
- }], ariaLabel: [{
325
- type: Input,
326
- args: ['aria-label']
327
- }], disabled: [{
328
- type: Input,
329
- args: [{ transform: booleanAttribute }]
330
- }], disableRipple: [{
331
- type: Input,
332
- args: [{ transform: booleanAttribute }]
333
- }], _customIcon: [{
334
- type: ContentChild,
335
- args: [MtxColorpickerToggleIcon]
336
- }], _button: [{
337
- type: ViewChild,
338
- args: ['button']
339
- }] } });
1
+ import { A11yModule } from '@angular/cdk/a11y';
2
+ import * as i2 from '@angular/cdk/overlay';
3
+ import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
4
+ import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
5
+ import { NgTemplateOutlet, DOCUMENT, CommonModule } from '@angular/common';
6
+ import * as i0 from '@angular/core';
7
+ import { inject, InjectionToken, Component, ViewEncapsulation, ChangeDetectionStrategy, EventEmitter, booleanAttribute, Inject, Optional, Input, Output, forwardRef, Directive, Attribute, ContentChild, ViewChild, NgModule } from '@angular/core';
8
+ import { MatIconButton, MatButtonModule } from '@angular/material/button';
9
+ import * as i1 from 'ngx-color/chrome';
10
+ import { ColorChromeModule } from 'ngx-color/chrome';
11
+ import { ESCAPE, hasModifierKey, UP_ARROW, DOWN_ARROW } from '@angular/cdk/keycodes';
12
+ import { mixinColor } from '@angular/material/core';
13
+ import { Subject, Subscription, merge, of } from 'rxjs';
14
+ import { take, filter } from 'rxjs/operators';
15
+ import { TinyColor } from '@ctrl/tinycolor';
16
+ import { style, keyframes, animate, transition, trigger } from '@angular/animations';
17
+ import * as i3 from '@angular/cdk/bidi';
18
+ import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
19
+ import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input';
20
+ import * as i1$1 from '@angular/material/form-field';
340
21
 
341
22
  /**
342
23
  * Animations used by the colorpicker.
@@ -356,7 +37,13 @@ const mtxColorpickerAnimations = {
356
37
  /** Used to generate a unique ID for each colorpicker instance. */
357
38
  let colorpickerUid = 0;
358
39
  /** Injection token that determines the scroll handling while the panel is open. */
359
- const MTX_COLORPICKER_SCROLL_STRATEGY = new InjectionToken('mtx-colorpicker-scroll-strategy');
40
+ const MTX_COLORPICKER_SCROLL_STRATEGY = new InjectionToken('mtx-colorpicker-scroll-strategy', {
41
+ providedIn: 'root',
42
+ factory: () => {
43
+ const overlay = inject(Overlay);
44
+ return () => overlay.scrollStrategies.reposition();
45
+ },
46
+ });
360
47
  function MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY(overlay) {
361
48
  return () => overlay.scrollStrategies.reposition();
362
49
  }
@@ -396,16 +83,16 @@ class MtxColorpickerContent extends _MtxColorpickerContentBase {
396
83
  hsv: new TinyColor(e.color.hsv).toHsvString(),
397
84
  }[this.picker.format];
398
85
  }
399
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerContent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
400
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.7", type: MtxColorpickerContent, selector: "mtx-colorpicker-content", inputs: { color: "color" }, host: { listeners: { "@transformPanel.done": "_animationDone.next()" }, properties: { "@transformPanel": "_animationState" }, classAttribute: "mtx-colorpicker-content" }, exportAs: ["mtxColorpickerContent"], usesInheritance: true, ngImport: i0, template: "@if (picker.content) {\n <ng-template [ngTemplateOutlet]=\"picker.content\"></ng-template>\n} @else {\n <color-chrome [color]=\"picker.selected\" (onChangeComplete)=\"picker.select(getColorString($event))\" />\n}\n", styles: [".mtx-colorpicker-content{display:block;border-radius:4px}\n"], dependencies: [{ kind: "directive", type: i1$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.ChromeComponent, selector: "color-chrome", inputs: ["disableAlpha"] }], animations: [mtxColorpickerAnimations.transformPanel], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
86
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerContent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
87
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.0", type: MtxColorpickerContent, isStandalone: true, selector: "mtx-colorpicker-content", inputs: { color: "color" }, host: { listeners: { "@transformPanel.done": "_animationDone.next()" }, properties: { "@transformPanel": "_animationState" }, classAttribute: "mtx-colorpicker-content" }, exportAs: ["mtxColorpickerContent"], usesInheritance: true, ngImport: i0, template: "@if (picker.content) {\n <ng-template [ngTemplateOutlet]=\"picker.content\"></ng-template>\n} @else {\n <color-chrome [color]=\"picker.selected\" (onChangeComplete)=\"picker.select(getColorString($event))\" />\n}\n", styles: [".mtx-colorpicker-content{display:block;border-radius:4px}\n"], dependencies: [{ kind: "ngmodule", type: ColorChromeModule }, { kind: "component", type: i1.ChromeComponent, selector: "color-chrome", inputs: ["disableAlpha"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], animations: [mtxColorpickerAnimations.transformPanel], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
401
88
  }
402
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerContent, decorators: [{
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerContent, decorators: [{
403
90
  type: Component,
404
91
  args: [{ selector: 'mtx-colorpicker-content', host: {
405
92
  'class': 'mtx-colorpicker-content',
406
93
  '[@transformPanel]': '_animationState',
407
94
  '(@transformPanel.done)': '_animationDone.next()',
408
- }, animations: [mtxColorpickerAnimations.transformPanel], exportAs: 'mtxColorpickerContent', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['color'], template: "@if (picker.content) {\n <ng-template [ngTemplateOutlet]=\"picker.content\"></ng-template>\n} @else {\n <color-chrome [color]=\"picker.selected\" (onChangeComplete)=\"picker.select(getColorString($event))\" />\n}\n", styles: [".mtx-colorpicker-content{display:block;border-radius:4px}\n"] }]
95
+ }, animations: [mtxColorpickerAnimations.transformPanel], exportAs: 'mtxColorpickerContent', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['color'], standalone: true, imports: [ColorChromeModule, NgTemplateOutlet], template: "@if (picker.content) {\n <ng-template [ngTemplateOutlet]=\"picker.content\"></ng-template>\n} @else {\n <color-chrome [color]=\"picker.selected\" (onChangeComplete)=\"picker.select(getColorString($event))\" />\n}\n", styles: [".mtx-colorpicker-content{display:block;border-radius:4px}\n"] }]
409
96
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }] });
410
97
  class MtxColorpicker {
411
98
  get disabled() {
@@ -579,149 +266,472 @@ class MtxColorpicker {
579
266
  if (labelId) {
580
267
  overlayElement.setAttribute('aria-labelledby', labelId);
581
268
  }
582
- this._getCloseStream(overlayRef).subscribe(event => {
583
- if (event) {
584
- event.preventDefault();
585
- }
586
- this.close();
587
- });
588
- this._componentRef = overlayRef.attach(portal);
589
- this._forwardContentValues(this._componentRef.instance);
590
- // Update the position once the panel has rendered. Only relevant in dropdown mode.
591
- this._ngZone.onStable.pipe(take(1)).subscribe(() => overlayRef.updatePosition());
269
+ this._getCloseStream(overlayRef).subscribe(event => {
270
+ if (event) {
271
+ event.preventDefault();
272
+ }
273
+ this.close();
274
+ });
275
+ this._componentRef = overlayRef.attach(portal);
276
+ this._forwardContentValues(this._componentRef.instance);
277
+ // Update the position once the panel has rendered. Only relevant in dropdown mode.
278
+ this._ngZone.onStable.pipe(take(1)).subscribe(() => overlayRef.updatePosition());
279
+ }
280
+ /** Destroys the current overlay. */
281
+ _destroyOverlay() {
282
+ if (this._overlayRef) {
283
+ this._overlayRef.dispose();
284
+ this._overlayRef = this._componentRef = null;
285
+ }
286
+ }
287
+ /** Gets a position strategy that will open the panel as a dropdown. */
288
+ _getDropdownStrategy() {
289
+ const strategy = this._overlay
290
+ .position()
291
+ .flexibleConnectedTo(this.pickerInput.getConnectedOverlayOrigin())
292
+ .withTransformOriginOn('.mtx-colorpicker-content')
293
+ .withFlexibleDimensions(false)
294
+ .withViewportMargin(8)
295
+ .withLockedPosition();
296
+ return this._setConnectedPositions(strategy);
297
+ }
298
+ /** Sets the positions of the colorpicker in dropdown mode based on the current configuration. */
299
+ _setConnectedPositions(strategy) {
300
+ const primaryX = this.xPosition === 'end' ? 'end' : 'start';
301
+ const secondaryX = primaryX === 'start' ? 'end' : 'start';
302
+ const primaryY = this.yPosition === 'above' ? 'bottom' : 'top';
303
+ const secondaryY = primaryY === 'top' ? 'bottom' : 'top';
304
+ return strategy.withPositions([
305
+ {
306
+ originX: primaryX,
307
+ originY: secondaryY,
308
+ overlayX: primaryX,
309
+ overlayY: primaryY,
310
+ },
311
+ {
312
+ originX: primaryX,
313
+ originY: primaryY,
314
+ overlayX: primaryX,
315
+ overlayY: secondaryY,
316
+ },
317
+ {
318
+ originX: secondaryX,
319
+ originY: secondaryY,
320
+ overlayX: secondaryX,
321
+ overlayY: primaryY,
322
+ },
323
+ {
324
+ originX: secondaryX,
325
+ originY: primaryY,
326
+ overlayX: secondaryX,
327
+ overlayY: secondaryY,
328
+ },
329
+ ]);
330
+ }
331
+ /** Gets an observable that will emit when the overlay is supposed to be closed. */
332
+ _getCloseStream(overlayRef) {
333
+ return merge(overlayRef.backdropClick(), overlayRef.detachments(), overlayRef.keydownEvents().pipe(filter(event => {
334
+ // Closing on alt + up is only valid when there's an input associated with the colorpicker.
335
+ return ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
336
+ (this.pickerInput && hasModifierKey(event, 'altKey') && event.keyCode === UP_ARROW));
337
+ })));
338
+ }
339
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpicker, deps: [{ token: i2.Overlay }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: MTX_COLORPICKER_SCROLL_STRATEGY }, { token: i3.Directionality, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
340
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.1.0", type: MtxColorpicker, isStandalone: true, selector: "mtx-colorpicker", inputs: { content: "content", disabled: ["disabled", "disabled", booleanAttribute], xPosition: "xPosition", yPosition: "yPosition", restoreFocus: ["restoreFocus", "restoreFocus", booleanAttribute], opened: ["opened", "opened", booleanAttribute], color: "color", format: "format" }, outputs: { openedStream: "opened", closedStream: "closed" }, exportAs: ["mtxColorpicker"], usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
341
+ }
342
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpicker, decorators: [{
343
+ type: Component,
344
+ args: [{
345
+ selector: 'mtx-colorpicker',
346
+ template: '',
347
+ exportAs: 'mtxColorpicker',
348
+ changeDetection: ChangeDetectionStrategy.OnPush,
349
+ encapsulation: ViewEncapsulation.None,
350
+ standalone: true,
351
+ }]
352
+ }], ctorParameters: () => [{ type: i2.Overlay }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
353
+ type: Inject,
354
+ args: [MTX_COLORPICKER_SCROLL_STRATEGY]
355
+ }] }, { type: i3.Directionality, decorators: [{
356
+ type: Optional
357
+ }] }, { type: undefined, decorators: [{
358
+ type: Optional
359
+ }, {
360
+ type: Inject,
361
+ args: [DOCUMENT]
362
+ }] }], propDecorators: { content: [{
363
+ type: Input
364
+ }], openedStream: [{
365
+ type: Output,
366
+ args: ['opened']
367
+ }], closedStream: [{
368
+ type: Output,
369
+ args: ['closed']
370
+ }], disabled: [{
371
+ type: Input,
372
+ args: [{ transform: booleanAttribute }]
373
+ }], xPosition: [{
374
+ type: Input
375
+ }], yPosition: [{
376
+ type: Input
377
+ }], restoreFocus: [{
378
+ type: Input,
379
+ args: [{ transform: booleanAttribute }]
380
+ }], opened: [{
381
+ type: Input,
382
+ args: [{ transform: booleanAttribute }]
383
+ }], color: [{
384
+ type: Input
385
+ }], format: [{
386
+ type: Input
387
+ }] } });
388
+
389
+ class MtxColorPickerInputEvent {
390
+ constructor(
391
+ /** Reference to the colorpicker input component that emitted the event. */
392
+ target,
393
+ /** Reference to the native input element associated with the colorpicker input. */
394
+ targetElement) {
395
+ this.target = target;
396
+ this.targetElement = targetElement;
397
+ this.value = this.target.value;
398
+ }
399
+ }
400
+ const MTX_COLORPICKER_VALUE_ACCESSOR = {
401
+ provide: NG_VALUE_ACCESSOR,
402
+ useExisting: forwardRef(() => MtxColorpickerInput),
403
+ multi: true,
404
+ };
405
+ const MTX_COLORPICKER_VALIDATORS = {
406
+ provide: NG_VALIDATORS,
407
+ useExisting: forwardRef(() => MtxColorpickerInput),
408
+ multi: true,
409
+ };
410
+ class MtxColorpickerInput {
411
+ set mtxColorpicker(value) {
412
+ if (!value) {
413
+ return;
414
+ }
415
+ this._picker = value;
416
+ this._picker.registerInput(this);
417
+ this._pickerSubscription.unsubscribe();
418
+ this._pickerSubscription = this._picker._selectedChanged.subscribe((selected) => {
419
+ this.value = selected;
420
+ this._cvaOnChange(selected);
421
+ this._onTouched();
422
+ this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
423
+ this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
424
+ });
425
+ }
426
+ /** Whether the colorpicker-input is disabled. */
427
+ get disabled() {
428
+ return !!this._disabled;
429
+ }
430
+ set disabled(value) {
431
+ const element = this._elementRef.nativeElement;
432
+ if (this._disabled !== value) {
433
+ this._disabled = value;
434
+ this._disabledChange.emit(value);
435
+ }
436
+ // We need to null check the `blur` method, because it's undefined during SSR.
437
+ // In Ivy static bindings are invoked earlier, before the element is attached to the DOM.
438
+ // This can cause an error to be thrown in some browsers (IE/Edge) which assert that the
439
+ // element has been inserted.
440
+ if (value && this._isInitialized && element.blur) {
441
+ // Normally, native input elements automatically blur if they turn disabled. This behavior
442
+ // is problematic, because it would mean that it triggers another change detection cycle,
443
+ // which then causes a changed after checked error if the input element was focused before.
444
+ element.blur();
445
+ }
446
+ }
447
+ /** The value of the input. */
448
+ get value() {
449
+ return this._value;
450
+ }
451
+ set value(value) {
452
+ const oldValue = this.value;
453
+ this._value = value;
454
+ this._formatValue(value);
455
+ this._valueChange.emit(value);
456
+ }
457
+ constructor(_elementRef, _formField) {
458
+ this._elementRef = _elementRef;
459
+ this._formField = _formField;
460
+ /** The input and output color format. */
461
+ this.format = 'hex';
462
+ /** Emits when a `change` event is fired on this `<input>`. */
463
+ this.colorChange = new EventEmitter();
464
+ /** Emits when an `input` event is fired on this `<input>`. */
465
+ this.colorInput = new EventEmitter();
466
+ /** Emits when the disabled state has changed */
467
+ this._disabledChange = new EventEmitter();
468
+ /** Emits when the value changes (either due to user input or programmatic change). */
469
+ this._valueChange = new EventEmitter();
470
+ this._onTouched = () => { };
471
+ this._validatorOnChange = () => { };
472
+ this._cvaOnChange = () => { };
473
+ this._pickerSubscription = Subscription.EMPTY;
474
+ /** The combined form control validator for this input. */
475
+ this._validator = Validators.compose([]);
476
+ /** Whether the last value set on the input was valid. */
477
+ this._lastValueValid = false;
478
+ }
479
+ ngAfterViewInit() {
480
+ this._isInitialized = true;
481
+ }
482
+ ngOnDestroy() {
483
+ this._pickerSubscription.unsubscribe();
484
+ this._valueChange.complete();
485
+ this._disabledChange.complete();
486
+ }
487
+ registerOnValidatorChange(fn) {
488
+ this._validatorOnChange = fn;
489
+ }
490
+ /** @docs-private */
491
+ validate(c) {
492
+ return this._validator ? this._validator(c) : null;
493
+ }
494
+ /**
495
+ * @deprecated
496
+ * @breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
497
+ */
498
+ getPopupConnectionElementRef() {
499
+ return this.getConnectedOverlayOrigin();
500
+ }
501
+ /**
502
+ * Gets the element that the colorpicker popup should be connected to.
503
+ * @return The element to connect the popup to.
504
+ */
505
+ getConnectedOverlayOrigin() {
506
+ return this._formField ? this._formField.getConnectedOverlayOrigin() : this._elementRef;
507
+ }
508
+ /** Gets the ID of an element that should be used a description for the overlay. */
509
+ getOverlayLabelId() {
510
+ if (this._formField) {
511
+ return this._formField.getLabelId();
512
+ }
513
+ return this._elementRef.nativeElement.getAttribute('aria-labelledby');
514
+ }
515
+ // Implemented as part of ControlValueAccessor.
516
+ writeValue(value) {
517
+ this.value = value;
518
+ }
519
+ // Implemented as part of ControlValueAccessor.
520
+ registerOnChange(fn) {
521
+ this._cvaOnChange = fn;
522
+ }
523
+ // Implemented as part of ControlValueAccessor.
524
+ registerOnTouched(fn) {
525
+ this._onTouched = fn;
526
+ }
527
+ // Implemented as part of ControlValueAccessor.
528
+ setDisabledState(isDisabled) {
529
+ this.disabled = isDisabled;
530
+ }
531
+ _onKeydown(event) {
532
+ const isAltDownArrow = event.altKey && event.keyCode === DOWN_ARROW;
533
+ if (this._picker && isAltDownArrow && !this._elementRef.nativeElement.readOnly) {
534
+ this._picker.open();
535
+ event.preventDefault();
536
+ }
592
537
  }
593
- /** Destroys the current overlay. */
594
- _destroyOverlay() {
595
- if (this._overlayRef) {
596
- this._overlayRef.dispose();
597
- this._overlayRef = this._componentRef = null;
538
+ /** Handles blur events on the input. */
539
+ _onBlur() {
540
+ // Reformat the input only if we have a valid value.
541
+ if (this.value) {
542
+ this._formatValue(this.value);
598
543
  }
544
+ this._onTouched();
599
545
  }
600
- /** Gets a position strategy that will open the panel as a dropdown. */
601
- _getDropdownStrategy() {
602
- const strategy = this._overlay
603
- .position()
604
- .flexibleConnectedTo(this.pickerInput.getConnectedOverlayOrigin())
605
- .withTransformOriginOn('.mtx-colorpicker-content')
606
- .withFlexibleDimensions(false)
607
- .withViewportMargin(8)
608
- .withLockedPosition();
609
- return this._setConnectedPositions(strategy);
546
+ _onInput(value) {
547
+ const nextValue = value;
548
+ this._value = nextValue;
549
+ this._cvaOnChange(nextValue);
550
+ this._valueChange.emit(nextValue);
551
+ this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
610
552
  }
611
- /** Sets the positions of the colorpicker in dropdown mode based on the current configuration. */
612
- _setConnectedPositions(strategy) {
613
- const primaryX = this.xPosition === 'end' ? 'end' : 'start';
614
- const secondaryX = primaryX === 'start' ? 'end' : 'start';
615
- const primaryY = this.yPosition === 'above' ? 'bottom' : 'top';
616
- const secondaryY = primaryY === 'top' ? 'bottom' : 'top';
617
- return strategy.withPositions([
618
- {
619
- originX: primaryX,
620
- originY: secondaryY,
621
- overlayX: primaryX,
622
- overlayY: primaryY,
623
- },
624
- {
625
- originX: primaryX,
626
- originY: primaryY,
627
- overlayX: primaryX,
628
- overlayY: secondaryY,
629
- },
630
- {
631
- originX: secondaryX,
632
- originY: secondaryY,
633
- overlayX: secondaryX,
634
- overlayY: primaryY,
635
- },
636
- {
637
- originX: secondaryX,
638
- originY: primaryY,
639
- overlayX: secondaryX,
640
- overlayY: secondaryY,
641
- },
642
- ]);
553
+ _onChange() {
554
+ this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
643
555
  }
644
- /** Gets an observable that will emit when the overlay is supposed to be closed. */
645
- _getCloseStream(overlayRef) {
646
- return merge(overlayRef.backdropClick(), overlayRef.detachments(), overlayRef.keydownEvents().pipe(filter(event => {
647
- // Closing on alt + up is only valid when there's an input associated with the colorpicker.
648
- return ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
649
- (this.pickerInput && hasModifierKey(event, 'altKey') && event.keyCode === UP_ARROW));
650
- })));
556
+ /** Returns the palette used by the input's form field, if any. */
557
+ getThemePalette() {
558
+ return this._formField ? this._formField.color : undefined;
559
+ }
560
+ /** TODO: Formats a value and sets it on the input element. */
561
+ _formatValue(value) {
562
+ this._elementRef.nativeElement.value = value ? value : '';
651
563
  }
652
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpicker, deps: [{ token: i3.Overlay }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: MTX_COLORPICKER_SCROLL_STRATEGY }, { token: i4.Directionality, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
653
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.0.7", type: MtxColorpicker, selector: "mtx-colorpicker", inputs: { content: "content", disabled: ["disabled", "disabled", booleanAttribute], xPosition: "xPosition", yPosition: "yPosition", restoreFocus: ["restoreFocus", "restoreFocus", booleanAttribute], opened: ["opened", "opened", booleanAttribute], color: "color", format: "format" }, outputs: { openedStream: "opened", closedStream: "closed" }, exportAs: ["mtxColorpicker"], usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
564
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerInput, deps: [{ token: i0.ElementRef }, { token: i1$1.MatFormField, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
565
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.1.0", type: MtxColorpickerInput, isStandalone: true, selector: "input[mtxColorpicker]", inputs: { mtxColorpicker: "mtxColorpicker", disabled: ["disabled", "disabled", booleanAttribute], value: "value", format: "format" }, outputs: { colorChange: "colorChange", colorInput: "colorInput" }, host: { listeners: { "input": "_onInput($event.target.value)", "change": "_onChange()", "blur": "_onBlur()", "keydown": "_onKeydown($event)" }, properties: { "attr.aria-haspopup": "_picker ? \"dialog\" : null", "attr.aria-owns": "(_picker?.opened && _picker.id) || null", "disabled": "disabled" }, classAttribute: "mtx-colorpicker-input" }, providers: [
566
+ MTX_COLORPICKER_VALUE_ACCESSOR,
567
+ MTX_COLORPICKER_VALIDATORS,
568
+ { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
569
+ ], exportAs: ["mtxColorpickerInput"], ngImport: i0 }); }
654
570
  }
655
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpicker, decorators: [{
656
- type: Component,
571
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerInput, decorators: [{
572
+ type: Directive,
657
573
  args: [{
658
- selector: 'mtx-colorpicker',
659
- template: '',
660
- exportAs: 'mtxColorpicker',
661
- changeDetection: ChangeDetectionStrategy.OnPush,
662
- encapsulation: ViewEncapsulation.None,
574
+ selector: 'input[mtxColorpicker]',
575
+ providers: [
576
+ MTX_COLORPICKER_VALUE_ACCESSOR,
577
+ MTX_COLORPICKER_VALIDATORS,
578
+ { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
579
+ ],
580
+ host: {
581
+ 'class': 'mtx-colorpicker-input',
582
+ '[attr.aria-haspopup]': '_picker ? "dialog" : null',
583
+ '[attr.aria-owns]': '(_picker?.opened && _picker.id) || null',
584
+ '[disabled]': 'disabled',
585
+ '(input)': '_onInput($event.target.value)',
586
+ '(change)': '_onChange()',
587
+ '(blur)': '_onBlur()',
588
+ '(keydown)': '_onKeydown($event)',
589
+ },
590
+ exportAs: 'mtxColorpickerInput',
591
+ standalone: true,
663
592
  }]
664
- }], ctorParameters: () => [{ type: i3.Overlay }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
665
- type: Inject,
666
- args: [MTX_COLORPICKER_SCROLL_STRATEGY]
667
- }] }, { type: i4.Directionality, decorators: [{
668
- type: Optional
669
- }] }, { type: undefined, decorators: [{
593
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.MatFormField, decorators: [{
670
594
  type: Optional
671
- }, {
672
- type: Inject,
673
- args: [DOCUMENT]
674
- }] }], propDecorators: { content: [{
595
+ }] }], propDecorators: { mtxColorpicker: [{
675
596
  type: Input
676
- }], openedStream: [{
677
- type: Output,
678
- args: ['opened']
679
- }], closedStream: [{
680
- type: Output,
681
- args: ['closed']
682
597
  }], disabled: [{
683
598
  type: Input,
684
599
  args: [{ transform: booleanAttribute }]
685
- }], xPosition: [{
600
+ }], value: [{
686
601
  type: Input
687
- }], yPosition: [{
602
+ }], format: [{
688
603
  type: Input
689
- }], restoreFocus: [{
604
+ }], colorChange: [{
605
+ type: Output
606
+ }], colorInput: [{
607
+ type: Output
608
+ }] } });
609
+
610
+ /** Can be used to override the icon of a `mtxColorpickerToggle`. */
611
+ class MtxColorpickerToggleIcon {
612
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerToggleIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
613
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.0", type: MtxColorpickerToggleIcon, isStandalone: true, selector: "[mtxColorpickerToggleIcon]", ngImport: i0 }); }
614
+ }
615
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerToggleIcon, decorators: [{
616
+ type: Directive,
617
+ args: [{
618
+ selector: '[mtxColorpickerToggleIcon]',
619
+ standalone: true,
620
+ }]
621
+ }] });
622
+ class MtxColorpickerToggle {
623
+ /** Whether the toggle button is disabled. */
624
+ get disabled() {
625
+ if (this._disabled == null && this.picker) {
626
+ return this.picker.disabled;
627
+ }
628
+ return !!this._disabled;
629
+ }
630
+ set disabled(value) {
631
+ this._disabled = value;
632
+ }
633
+ constructor(_changeDetectorRef, defaultTabIndex) {
634
+ this._changeDetectorRef = _changeDetectorRef;
635
+ this._stateChanges = Subscription.EMPTY;
636
+ const parsedTabIndex = Number(defaultTabIndex);
637
+ this.tabIndex = parsedTabIndex || parsedTabIndex === 0 ? parsedTabIndex : null;
638
+ }
639
+ ngOnChanges(changes) {
640
+ if (changes.picker) {
641
+ this._watchStateChanges();
642
+ }
643
+ }
644
+ ngOnDestroy() {
645
+ this._stateChanges.unsubscribe();
646
+ }
647
+ ngAfterContentInit() {
648
+ this._watchStateChanges();
649
+ }
650
+ _open(event) {
651
+ if (this.picker && !this.disabled) {
652
+ this.picker.open();
653
+ event.stopPropagation();
654
+ }
655
+ }
656
+ _watchStateChanges() {
657
+ const pickerDisabled = this.picker ? this.picker._disabledChange : of();
658
+ const inputDisabled = this.picker && this.picker.pickerInput
659
+ ? this.picker.pickerInput._disabledChange
660
+ : of();
661
+ const pickerToggled = this.picker
662
+ ? merge(this.picker.openedStream, this.picker.closedStream)
663
+ : of();
664
+ this._stateChanges.unsubscribe();
665
+ this._stateChanges = merge(pickerDisabled, inputDisabled, pickerToggled).subscribe(() => this._changeDetectorRef.markForCheck());
666
+ }
667
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerToggle, deps: [{ token: i0.ChangeDetectorRef }, { token: 'tabindex', attribute: true }], target: i0.ɵɵFactoryTarget.Component }); }
668
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.0", type: MtxColorpickerToggle, isStandalone: true, selector: "mtx-colorpicker-toggle", inputs: { picker: ["for", "picker"], tabIndex: "tabIndex", ariaLabel: ["aria-label", "ariaLabel"], disabled: ["disabled", "disabled", booleanAttribute], disableRipple: ["disableRipple", "disableRipple", booleanAttribute] }, host: { listeners: { "click": "_open($event)" }, properties: { "attr.tabindex": "null", "class.mtx-colorpicker-toggle-active": "picker && picker.opened", "class.mat-accent": "picker && picker.color === \"accent\"", "class.mat-warn": "picker && picker.color === \"warn\"" }, classAttribute: "mtx-colorpicker-toggle" }, queries: [{ propertyName: "_customIcon", first: true, predicate: MtxColorpickerToggleIcon, descendants: true }], viewQueries: [{ propertyName: "_button", first: true, predicate: ["button"], descendants: true }], exportAs: ["mtxColorpickerToggle"], usesOnChanges: true, ngImport: i0, template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"picker ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\">\n\n @if (!_customIcon) {\n <svg\n class=\"mtx-colorpicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path d=\"M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z\" />\n </svg>\n }\n\n <ng-content select=\"[mtxColorpickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mtx-colorpicker-toggle{pointer-events:auto;color:var(--mtx-colorpicker-toggle-icon-color)}.mtx-colorpicker-toggle-active{color:var(--mtx-colorpicker-toggle-active-state-icon-color)}.cdk-high-contrast-active .mtx-colorpicker-toggle-default-icon{color:CanvasText}\n"], dependencies: [{ kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
669
+ }
670
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerToggle, decorators: [{
671
+ type: Component,
672
+ args: [{ selector: 'mtx-colorpicker-toggle', host: {
673
+ 'class': 'mtx-colorpicker-toggle',
674
+ '[attr.tabindex]': 'null',
675
+ '[class.mtx-colorpicker-toggle-active]': 'picker && picker.opened',
676
+ '[class.mat-accent]': 'picker && picker.color === "accent"',
677
+ '[class.mat-warn]': 'picker && picker.color === "warn"',
678
+ // Bind the `click` on the host, rather than the inner `button`, so that we can call
679
+ // `stopPropagation` on it without affecting the user's `click` handlers. We need to stop
680
+ // it so that the input doesn't get focused automatically by the form field (See #21836).
681
+ '(click)': '_open($event)',
682
+ }, exportAs: 'mtxColorpickerToggle', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [MatIconButton], template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"picker ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\">\n\n @if (!_customIcon) {\n <svg\n class=\"mtx-colorpicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path d=\"M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z\" />\n </svg>\n }\n\n <ng-content select=\"[mtxColorpickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mtx-colorpicker-toggle{pointer-events:auto;color:var(--mtx-colorpicker-toggle-icon-color)}.mtx-colorpicker-toggle-active{color:var(--mtx-colorpicker-toggle-active-state-icon-color)}.cdk-high-contrast-active .mtx-colorpicker-toggle-default-icon{color:CanvasText}\n"] }]
683
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
684
+ type: Attribute,
685
+ args: ['tabindex']
686
+ }] }], propDecorators: { picker: [{
687
+ type: Input,
688
+ args: ['for']
689
+ }], tabIndex: [{
690
+ type: Input
691
+ }], ariaLabel: [{
692
+ type: Input,
693
+ args: ['aria-label']
694
+ }], disabled: [{
690
695
  type: Input,
691
696
  args: [{ transform: booleanAttribute }]
692
- }], opened: [{
697
+ }], disableRipple: [{
693
698
  type: Input,
694
699
  args: [{ transform: booleanAttribute }]
695
- }], color: [{
696
- type: Input
697
- }], format: [{
698
- type: Input
700
+ }], _customIcon: [{
701
+ type: ContentChild,
702
+ args: [MtxColorpickerToggleIcon]
703
+ }], _button: [{
704
+ type: ViewChild,
705
+ args: ['button']
699
706
  }] } });
700
707
 
701
708
  class MtxColorpickerModule {
702
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
703
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerModule, declarations: [MtxColorpicker,
704
- MtxColorpickerContent,
705
- MtxColorpickerInput,
706
- MtxColorpickerToggle,
707
- MtxColorpickerToggleIcon], imports: [CommonModule,
709
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
710
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerModule, imports: [CommonModule,
708
711
  OverlayModule,
709
712
  A11yModule,
710
713
  PortalModule,
711
714
  MatButtonModule,
712
- ColorChromeModule], exports: [MtxColorpicker,
715
+ ColorChromeModule,
716
+ MtxColorpicker,
717
+ MtxColorpickerContent,
718
+ MtxColorpickerInput,
719
+ MtxColorpickerToggle,
720
+ MtxColorpickerToggleIcon], exports: [MtxColorpicker,
713
721
  MtxColorpickerContent,
714
722
  MtxColorpickerInput,
715
723
  MtxColorpickerToggle,
716
724
  MtxColorpickerToggleIcon] }); }
717
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerModule, providers: [MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [CommonModule,
725
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerModule, providers: [MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [CommonModule,
718
726
  OverlayModule,
719
727
  A11yModule,
720
728
  PortalModule,
721
729
  MatButtonModule,
722
- ColorChromeModule] }); }
730
+ ColorChromeModule,
731
+ MtxColorpickerContent,
732
+ MtxColorpickerToggle] }); }
723
733
  }
724
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerModule, decorators: [{
734
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerModule, decorators: [{
725
735
  type: NgModule,
726
736
  args: [{
727
737
  imports: [
@@ -731,15 +741,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImpor
731
741
  PortalModule,
732
742
  MatButtonModule,
733
743
  ColorChromeModule,
734
- ],
735
- exports: [
736
744
  MtxColorpicker,
737
745
  MtxColorpickerContent,
738
746
  MtxColorpickerInput,
739
747
  MtxColorpickerToggle,
740
748
  MtxColorpickerToggleIcon,
741
749
  ],
742
- declarations: [
750
+ exports: [
743
751
  MtxColorpicker,
744
752
  MtxColorpickerContent,
745
753
  MtxColorpickerInput,