@ng-matero/extensions 16.3.2 → 17.1.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 (251) hide show
  1. package/_index.scss +26 -13
  2. package/alert/_alert-theme.scss +54 -24
  3. package/alert/alert-module.d.ts +3 -3
  4. package/alert/alert.d.ts +4 -7
  5. package/alert/alert.scss +3 -3
  6. package/button/_button-theme.scss +6 -4
  7. package/button/button-loading.d.ts +5 -10
  8. package/button/button-module.d.ts +5 -5
  9. package/checkbox-group/checkbox-group-module.d.ts +6 -6
  10. package/checkbox-group/checkbox-group.d.ts +5 -10
  11. package/colorpicker/_colorpicker-theme.scss +62 -34
  12. package/colorpicker/colorpicker-input.d.ts +2 -4
  13. package/colorpicker/colorpicker-module.d.ts +10 -10
  14. package/colorpicker/colorpicker-toggle.d.ts +4 -5
  15. package/colorpicker/colorpicker.d.ts +8 -9
  16. package/column-resize/column-resize-directives/column-resize-flex.d.ts +1 -1
  17. package/column-resize/column-resize-directives/column-resize.d.ts +1 -1
  18. package/column-resize/column-resize-module.d.ts +1 -1
  19. package/core/color/_all-color.scss +7 -18
  20. package/core/datetime/datetime.module.d.ts +4 -1
  21. package/core/density/_all-density.scss +17 -25
  22. package/core/pipes/is-template-ref.pipe.d.ts +1 -1
  23. package/core/pipes/pipes.module.d.ts +4 -4
  24. package/core/pipes/to-observable.pipe.d.ts +1 -1
  25. package/core/style/_sass-utils.scss +13 -1
  26. package/core/theming/_all-theme.scss +32 -17
  27. package/core/tokens/_token-utils.scss +4 -5
  28. package/core/tokens/m2/mdc/_plain-tooltip.scss +21 -29
  29. package/core/tokens/m2/mtx/_alert.scss +14 -15
  30. package/core/tokens/m2/mtx/_colorpicker.scss +8 -11
  31. package/core/tokens/m2/mtx/_datetimepicker.scss +38 -47
  32. package/core/tokens/m2/mtx/_drawer.scss +9 -10
  33. package/core/tokens/m2/mtx/_grid.scss +23 -22
  34. package/core/tokens/m2/mtx/_loader.scss +6 -6
  35. package/core/tokens/m2/mtx/_popover.scss +10 -11
  36. package/core/tokens/m2/mtx/_progress.scss +18 -17
  37. package/core/tokens/m2/mtx/_select.scss +23 -24
  38. package/core/tokens/m2/mtx/_split.scss +8 -11
  39. package/core/typography/_all-typography.scss +40 -0
  40. package/core/typography/_typography.scss +1 -579
  41. package/datetimepicker/_datetimepicker-theme.scss +75 -48
  42. package/datetimepicker/calendar-body.d.ts +1 -1
  43. package/datetimepicker/calendar.d.ts +8 -15
  44. package/datetimepicker/calendar.scss +16 -4
  45. package/datetimepicker/clock.d.ts +2 -3
  46. package/datetimepicker/datetimepicker-content.scss +3 -3
  47. package/datetimepicker/datetimepicker-input.d.ts +2 -3
  48. package/datetimepicker/datetimepicker-module.d.ts +16 -16
  49. package/datetimepicker/datetimepicker-toggle.d.ts +4 -5
  50. package/datetimepicker/datetimepicker.d.ts +16 -27
  51. package/datetimepicker/month-view.d.ts +2 -2
  52. package/datetimepicker/multi-year-view.d.ts +2 -2
  53. package/datetimepicker/time.d.ts +6 -8
  54. package/datetimepicker/time.scss +2 -2
  55. package/datetimepicker/year-view.d.ts +2 -2
  56. package/dialog/dialog-container.d.ts +1 -1
  57. package/dialog/dialog-module.d.ts +7 -7
  58. package/drawer/_drawer-theme.scss +55 -22
  59. package/drawer/drawer-container.d.ts +1 -1
  60. package/drawer/drawer-container.scss +25 -4
  61. package/drawer/drawer-module.d.ts +5 -5
  62. package/esm2022/alert/alert-module.mjs +6 -7
  63. package/esm2022/alert/alert.mjs +11 -18
  64. package/esm2022/button/button-loading.mjs +13 -23
  65. package/esm2022/button/button-module.mjs +6 -7
  66. package/esm2022/checkbox-group/checkbox-group-module.mjs +6 -7
  67. package/esm2022/checkbox-group/checkbox-group.mjs +19 -31
  68. package/esm2022/colorpicker/colorpicker-input.mjs +14 -14
  69. package/esm2022/colorpicker/colorpicker-module.mjs +20 -19
  70. package/esm2022/colorpicker/colorpicker-toggle.mjs +19 -18
  71. package/esm2022/colorpicker/colorpicker.mjs +46 -44
  72. package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +6 -5
  73. package/esm2022/column-resize/column-resize-directives/column-resize.mjs +6 -5
  74. package/esm2022/column-resize/column-resize-module.mjs +6 -6
  75. package/esm2022/column-resize/column-resize-notifier.mjs +7 -7
  76. package/esm2022/column-resize/column-resize.mjs +4 -4
  77. package/esm2022/column-resize/column-size-store.mjs +3 -3
  78. package/esm2022/column-resize/event-dispatcher.mjs +5 -5
  79. package/esm2022/column-resize/overlay-handle.mjs +4 -4
  80. package/esm2022/column-resize/polyfill.mjs +1 -1
  81. package/esm2022/column-resize/resizable.mjs +4 -4
  82. package/esm2022/column-resize/resize-strategy.mjs +14 -14
  83. package/esm2022/core/datetime/datetime-adapter.mjs +1 -1
  84. package/esm2022/core/datetime/datetime.module.mjs +19 -23
  85. package/esm2022/core/datetime/native-datetime-adapter.mjs +6 -6
  86. package/esm2022/core/pipes/is-template-ref.pipe.mjs +5 -5
  87. package/esm2022/core/pipes/pipes.module.mjs +6 -7
  88. package/esm2022/core/pipes/to-observable.pipe.mjs +5 -5
  89. package/esm2022/datetimepicker/calendar-body.mjs +5 -6
  90. package/esm2022/datetimepicker/calendar.mjs +38 -48
  91. package/esm2022/datetimepicker/clock.mjs +11 -11
  92. package/esm2022/datetimepicker/datetimepicker-errors.mjs +4 -3
  93. package/esm2022/datetimepicker/datetimepicker-input.mjs +14 -14
  94. package/esm2022/datetimepicker/datetimepicker-intl.mjs +3 -3
  95. package/esm2022/datetimepicker/datetimepicker-module.mjs +28 -11
  96. package/esm2022/datetimepicker/datetimepicker-toggle.mjs +19 -18
  97. package/esm2022/datetimepicker/datetimepicker.mjs +70 -89
  98. package/esm2022/datetimepicker/month-view.mjs +8 -10
  99. package/esm2022/datetimepicker/multi-year-view.mjs +10 -11
  100. package/esm2022/datetimepicker/time.mjs +19 -24
  101. package/esm2022/datetimepicker/year-view.mjs +10 -11
  102. package/esm2022/dialog/dialog-container.mjs +21 -12
  103. package/esm2022/dialog/dialog-module.mjs +23 -7
  104. package/esm2022/dialog/dialog.mjs +7 -6
  105. package/esm2022/drawer/drawer-container.mjs +7 -8
  106. package/esm2022/drawer/drawer-module.mjs +6 -7
  107. package/esm2022/drawer/drawer-ref.mjs +1 -1
  108. package/esm2022/drawer/drawer.mjs +8 -7
  109. package/esm2022/grid/cell.mjs +36 -14
  110. package/esm2022/grid/column-menu.mjs +31 -15
  111. package/esm2022/grid/column-resize/column-resize-directives/column-resize-flex.mjs +6 -5
  112. package/esm2022/grid/column-resize/column-resize-directives/column-resize.mjs +6 -5
  113. package/esm2022/grid/column-resize/column-resize-module.mjs +14 -14
  114. package/esm2022/grid/column-resize/index.mjs +8 -0
  115. package/esm2022/grid/column-resize/overlay-handle.mjs +7 -6
  116. package/esm2022/grid/column-resize/resizable-directives/resizable.mjs +7 -6
  117. package/esm2022/grid/column-resize/resize-strategy.mjs +5 -5
  118. package/esm2022/grid/expansion-toggle.mjs +6 -5
  119. package/esm2022/grid/grid-module.mjs +39 -37
  120. package/esm2022/grid/grid-pipes.mjs +30 -30
  121. package/esm2022/grid/grid-utils.mjs +7 -6
  122. package/esm2022/grid/grid.mjs +175 -111
  123. package/esm2022/loader/loader-module.mjs +6 -7
  124. package/esm2022/loader/loader.mjs +17 -29
  125. package/esm2022/photoviewer/photoviewer-module.mjs +6 -7
  126. package/esm2022/photoviewer/photoviewer.mjs +8 -7
  127. package/esm2022/popover/popover-content.mjs +10 -9
  128. package/esm2022/popover/popover-module.mjs +22 -7
  129. package/esm2022/popover/popover-target.mjs +6 -5
  130. package/esm2022/popover/popover-trigger.mjs +15 -8
  131. package/esm2022/popover/popover.mjs +54 -139
  132. package/esm2022/progress/progress-module.mjs +6 -7
  133. package/esm2022/progress/progress.mjs +15 -26
  134. package/esm2022/select/option.mjs +12 -17
  135. package/esm2022/select/select-module.mjs +20 -9
  136. package/esm2022/select/select.mjs +19 -19
  137. package/esm2022/select/templates.mjs +56 -56
  138. package/esm2022/split/split-module.mjs +6 -7
  139. package/esm2022/split/split-pane.mjs +6 -5
  140. package/esm2022/split/split.mjs +8 -8
  141. package/esm2022/split/utils.mjs +1 -1
  142. package/esm2022/tooltip/tooltip-module.mjs +24 -7
  143. package/esm2022/tooltip/tooltip.mjs +104 -117
  144. package/fesm2022/mtxAlert.mjs +15 -23
  145. package/fesm2022/mtxAlert.mjs.map +1 -1
  146. package/fesm2022/mtxButton.mjs +17 -28
  147. package/fesm2022/mtxButton.mjs.map +1 -1
  148. package/fesm2022/mtxCheckboxGroup.mjs +22 -37
  149. package/fesm2022/mtxCheckboxGroup.mjs.map +1 -1
  150. package/fesm2022/mtxColorpicker.mjs +479 -474
  151. package/fesm2022/mtxColorpicker.mjs.map +1 -1
  152. package/fesm2022/mtxColumnResize.mjs +51 -49
  153. package/fesm2022/mtxColumnResize.mjs.map +1 -1
  154. package/fesm2022/mtxCore.mjs +36 -41
  155. package/fesm2022/mtxCore.mjs.map +1 -1
  156. package/fesm2022/mtxDatetimepicker.mjs +898 -905
  157. package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
  158. package/fesm2022/mtxDialog.mjs +47 -25
  159. package/fesm2022/mtxDialog.mjs.map +1 -1
  160. package/fesm2022/mtxDrawer.mjs +20 -21
  161. package/fesm2022/mtxDrawer.mjs.map +1 -1
  162. package/fesm2022/mtxGrid.mjs +330 -229
  163. package/fesm2022/mtxGrid.mjs.map +1 -1
  164. package/fesm2022/mtxLoader.mjs +21 -36
  165. package/fesm2022/mtxLoader.mjs.map +1 -1
  166. package/fesm2022/mtxPhotoviewer.mjs +12 -12
  167. package/fesm2022/mtxPhotoviewer.mjs.map +1 -1
  168. package/fesm2022/mtxPopover.mjs +103 -165
  169. package/fesm2022/mtxPopover.mjs.map +1 -1
  170. package/fesm2022/mtxProgress.mjs +19 -32
  171. package/fesm2022/mtxProgress.mjs.map +1 -1
  172. package/fesm2022/mtxSelect.mjs +99 -93
  173. package/fesm2022/mtxSelect.mjs.map +1 -1
  174. package/fesm2022/mtxSplit.mjs +17 -18
  175. package/fesm2022/mtxSplit.mjs.map +1 -1
  176. package/fesm2022/mtxTooltip.mjs +128 -125
  177. package/fesm2022/mtxTooltip.mjs.map +1 -1
  178. package/grid/_grid-theme.scss +58 -29
  179. package/grid/cell.d.ts +1 -1
  180. package/grid/column-menu.d.ts +1 -1
  181. package/grid/column-resize/column-resize-directives/column-resize-flex.d.ts +1 -1
  182. package/grid/column-resize/column-resize-directives/column-resize.d.ts +1 -1
  183. package/grid/column-resize/column-resize-module.d.ts +7 -6
  184. package/grid/column-resize/index.d.ts +7 -0
  185. package/grid/column-resize/overlay-handle.d.ts +1 -1
  186. package/grid/column-resize/resizable-directives/resizable.d.ts +1 -1
  187. package/grid/expansion-toggle.d.ts +1 -1
  188. package/grid/grid-module.d.ts +25 -25
  189. package/grid/grid-pipes.d.ts +7 -7
  190. package/grid/grid.d.ts +57 -25
  191. package/grid/grid.scss +8 -1
  192. package/loader/_loader-theme.scss +55 -22
  193. package/loader/loader-module.d.ts +5 -5
  194. package/loader/loader.d.ts +5 -10
  195. package/loader/loader.scss +1 -1
  196. package/package.json +13 -19
  197. package/photoviewer/photoviewer-module.d.ts +1 -1
  198. package/photoviewer/photoviewer.d.ts +2 -1
  199. package/popover/_popover-theme.scss +55 -22
  200. package/popover/popover-content.d.ts +1 -1
  201. package/popover/popover-module.d.ts +8 -8
  202. package/popover/popover-target.d.ts +1 -1
  203. package/popover/popover-trigger.d.ts +1 -1
  204. package/popover/popover.d.ts +24 -55
  205. package/popover/popover.scss +1 -1
  206. package/prebuilt-themes/deeppurple-amber.css +1 -1
  207. package/prebuilt-themes/indigo-pink.css +1 -1
  208. package/prebuilt-themes/pink-bluegrey.css +1 -1
  209. package/prebuilt-themes/purple-green.css +1 -1
  210. package/progress/_progress-theme.scss +60 -22
  211. package/progress/progress-module.d.ts +3 -3
  212. package/progress/progress.d.ts +5 -10
  213. package/progress/progress.scss +3 -3
  214. package/select/_select-theme.scss +66 -34
  215. package/select/option.d.ts +3 -6
  216. package/select/select-module.d.ts +7 -7
  217. package/select/select.d.ts +2 -4
  218. package/select/select.scss +109 -109
  219. package/select/templates.d.ts +11 -11
  220. package/split/_split-theme.scss +62 -32
  221. package/split/split-module.d.ts +4 -4
  222. package/split/split-pane.d.ts +1 -1
  223. package/split/split.d.ts +1 -1
  224. package/split/split.scss +2 -4
  225. package/tooltip/_tooltip-theme.scss +66 -34
  226. package/tooltip/tooltip-module.d.ts +7 -7
  227. package/tooltip/tooltip.d.ts +30 -44
  228. package/tooltip/tooltip.scss +2 -4
  229. package/_theming.scss +0 -16
  230. package/alert/_alert-theme.import.scss +0 -2
  231. package/button/_button-theme.import.scss +0 -2
  232. package/colorpicker/_colorpicker-theme.import.scss +0 -2
  233. package/core/density/_compatibility.scss +0 -74
  234. package/core/mdc-helpers/_mdc-helpers.scss +0 -242
  235. package/core/style/_elevation.scss +0 -91
  236. package/core/style/_private.scss +0 -32
  237. package/core/style/_variables.scss +0 -44
  238. package/core/style/_vendor-prefixes.scss +0 -46
  239. package/core/theming/_palette.scss +0 -746
  240. package/core/theming/_theming.scss +0 -497
  241. package/core/typography/_typography-utils.scss +0 -101
  242. package/datetimepicker/_datetimepicker-theme.import.scss +0 -4
  243. package/drawer/_drawer-theme.import.scss +0 -2
  244. package/grid/_grid-theme.import.scss +0 -2
  245. package/loader/_loader-theme.import.scss +0 -2
  246. package/popover/_popover-theme.import.scss +0 -2
  247. package/progress/_progress-theme.import.scss +0 -2
  248. package/select/_select-density.scss +0 -68
  249. package/select/_select-theme.import.scss +0 -3
  250. package/split/_split-theme.import.scss +0 -2
  251. package/tooltip/_tooltip-theme.import.scss +0 -1
@@ -1,341 +1,23 @@
1
- import * as i1$1 from '@angular/common';
2
- import { DOCUMENT, CommonModule } from '@angular/common';
3
- import * as i0 from '@angular/core';
4
- import { forwardRef, EventEmitter, 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 i2 from '@angular/material/button';
10
- import { MatButtonModule } from '@angular/material/button';
11
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
12
- import { DOWN_ARROW, ESCAPE, hasModifierKey, UP_ARROW } from '@angular/cdk/keycodes';
13
- import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
14
- import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input';
15
- import { Subscription, of, merge, Subject } from 'rxjs';
16
- import * as i1 from '@angular/material/form-field';
17
- import { mixinColor } from '@angular/material/core';
18
- import { take, filter } from 'rxjs/operators';
19
- import { trigger, transition, animate, keyframes, style } from '@angular/animations';
20
- import { TinyColor } from '@ctrl/tinycolor';
21
- import * as i2$1 from 'ngx-color/chrome';
22
- import { ColorChromeModule } from 'ngx-color/chrome';
23
- import * as i4 from '@angular/cdk/bidi';
24
-
25
- class MtxColorPickerInputEvent {
26
- constructor(
27
- /** Reference to the colorpicker input component that emitted the event. */
28
- target,
29
- /** Reference to the native input element associated with the colorpicker input. */
30
- targetElement) {
31
- this.target = target;
32
- this.targetElement = targetElement;
33
- this.value = this.target.value;
34
- }
35
- }
36
- const MTX_COLORPICKER_VALUE_ACCESSOR = {
37
- provide: NG_VALUE_ACCESSOR,
38
- useExisting: forwardRef(() => MtxColorpickerInput),
39
- multi: true,
40
- };
41
- const MTX_COLORPICKER_VALIDATORS = {
42
- provide: NG_VALIDATORS,
43
- useExisting: forwardRef(() => MtxColorpickerInput),
44
- multi: true,
45
- };
46
- class MtxColorpickerInput {
47
- set mtxColorpicker(value) {
48
- if (!value) {
49
- return;
50
- }
51
- this._picker = value;
52
- this._picker.registerInput(this);
53
- this._pickerSubscription.unsubscribe();
54
- this._pickerSubscription = this._picker._selectedChanged.subscribe((selected) => {
55
- this.value = selected;
56
- this._cvaOnChange(selected);
57
- this._onTouched();
58
- this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
59
- this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
60
- });
61
- }
62
- /** Whether the colorpicker-input is disabled. */
63
- get disabled() {
64
- return !!this._disabled;
65
- }
66
- set disabled(value) {
67
- const newValue = coerceBooleanProperty(value);
68
- const element = this._elementRef.nativeElement;
69
- if (this._disabled !== newValue) {
70
- this._disabled = newValue;
71
- this._disabledChange.emit(newValue);
72
- }
73
- // We need to null check the `blur` method, because it's undefined during SSR.
74
- // In Ivy static bindings are invoked earlier, before the element is attached to the DOM.
75
- // This can cause an error to be thrown in some browsers (IE/Edge) which assert that the
76
- // element has been inserted.
77
- if (newValue && this._isInitialized && element.blur) {
78
- // Normally, native input elements automatically blur if they turn disabled. This behavior
79
- // is problematic, because it would mean that it triggers another change detection cycle,
80
- // which then causes a changed after checked error if the input element was focused before.
81
- element.blur();
82
- }
83
- }
84
- /** The value of the input. */
85
- get value() {
86
- return this._value;
87
- }
88
- set value(value) {
89
- const oldValue = this.value;
90
- this._value = value;
91
- this._formatValue(value);
92
- this._valueChange.emit(value);
93
- }
94
- constructor(_elementRef, _formField) {
95
- this._elementRef = _elementRef;
96
- this._formField = _formField;
97
- /** The input and output color format. */
98
- this.format = 'hex';
99
- /** Emits when a `change` event is fired on this `<input>`. */
100
- this.colorChange = new EventEmitter();
101
- /** Emits when an `input` event is fired on this `<input>`. */
102
- this.colorInput = new EventEmitter();
103
- /** Emits when the disabled state has changed */
104
- this._disabledChange = new EventEmitter();
105
- /** Emits when the value changes (either due to user input or programmatic change). */
106
- this._valueChange = new EventEmitter();
107
- this._onTouched = () => { };
108
- this._validatorOnChange = () => { };
109
- this._cvaOnChange = () => { };
110
- this._pickerSubscription = Subscription.EMPTY;
111
- /** The combined form control validator for this input. */
112
- this._validator = Validators.compose([]);
113
- /** Whether the last value set on the input was valid. */
114
- this._lastValueValid = false;
115
- }
116
- ngAfterViewInit() {
117
- this._isInitialized = true;
118
- }
119
- ngOnDestroy() {
120
- this._pickerSubscription.unsubscribe();
121
- this._valueChange.complete();
122
- this._disabledChange.complete();
123
- }
124
- registerOnValidatorChange(fn) {
125
- this._validatorOnChange = fn;
126
- }
127
- /** @docs-private */
128
- validate(c) {
129
- return this._validator ? this._validator(c) : null;
130
- }
131
- /**
132
- * @deprecated
133
- * @breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
134
- */
135
- getPopupConnectionElementRef() {
136
- return this.getConnectedOverlayOrigin();
137
- }
138
- /**
139
- * Gets the element that the colorpicker popup should be connected to.
140
- * @return The element to connect the popup to.
141
- */
142
- getConnectedOverlayOrigin() {
143
- return this._formField ? this._formField.getConnectedOverlayOrigin() : this._elementRef;
144
- }
145
- /** Gets the ID of an element that should be used a description for the overlay. */
146
- getOverlayLabelId() {
147
- if (this._formField) {
148
- return this._formField.getLabelId();
149
- }
150
- return this._elementRef.nativeElement.getAttribute('aria-labelledby');
151
- }
152
- // Implemented as part of ControlValueAccessor.
153
- writeValue(value) {
154
- this.value = value;
155
- }
156
- // Implemented as part of ControlValueAccessor.
157
- registerOnChange(fn) {
158
- this._cvaOnChange = fn;
159
- }
160
- // Implemented as part of ControlValueAccessor.
161
- registerOnTouched(fn) {
162
- this._onTouched = fn;
163
- }
164
- // Implemented as part of ControlValueAccessor.
165
- setDisabledState(isDisabled) {
166
- this.disabled = isDisabled;
167
- }
168
- _onKeydown(event) {
169
- const isAltDownArrow = event.altKey && event.keyCode === DOWN_ARROW;
170
- if (this._picker && isAltDownArrow && !this._elementRef.nativeElement.readOnly) {
171
- this._picker.open();
172
- event.preventDefault();
173
- }
174
- }
175
- /** Handles blur events on the input. */
176
- _onBlur() {
177
- // Reformat the input only if we have a valid value.
178
- if (this.value) {
179
- this._formatValue(this.value);
180
- }
181
- this._onTouched();
182
- }
183
- _onInput(value) {
184
- const nextValue = value;
185
- this._value = nextValue;
186
- this._cvaOnChange(nextValue);
187
- this._valueChange.emit(nextValue);
188
- this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
189
- }
190
- _onChange() {
191
- this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
192
- }
193
- /** Returns the palette used by the input's form field, if any. */
194
- getThemePalette() {
195
- return this._formField ? this._formField.color : undefined;
196
- }
197
- /** TODO: Formats a value and sets it on the input element. */
198
- _formatValue(value) {
199
- this._elementRef.nativeElement.value = value ? value : '';
200
- }
201
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerInput, deps: [{ token: i0.ElementRef }, { token: i1.MatFormField, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
202
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.7", type: MtxColorpickerInput, selector: "input[mtxColorpicker]", inputs: { mtxColorpicker: "mtxColorpicker", disabled: "disabled", 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: [
203
- MTX_COLORPICKER_VALUE_ACCESSOR,
204
- MTX_COLORPICKER_VALIDATORS,
205
- { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
206
- ], exportAs: ["mtxColorpickerInput"], ngImport: i0 }); }
207
- }
208
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerInput, decorators: [{
209
- type: Directive,
210
- args: [{
211
- selector: 'input[mtxColorpicker]',
212
- providers: [
213
- MTX_COLORPICKER_VALUE_ACCESSOR,
214
- MTX_COLORPICKER_VALIDATORS,
215
- { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
216
- ],
217
- host: {
218
- 'class': 'mtx-colorpicker-input',
219
- '[attr.aria-haspopup]': '_picker ? "dialog" : null',
220
- '[attr.aria-owns]': '(_picker?.opened && _picker.id) || null',
221
- '[disabled]': 'disabled',
222
- '(input)': '_onInput($event.target.value)',
223
- '(change)': '_onChange()',
224
- '(blur)': '_onBlur()',
225
- '(keydown)': '_onKeydown($event)',
226
- },
227
- exportAs: 'mtxColorpickerInput',
228
- }]
229
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.MatFormField, decorators: [{
230
- type: Optional
231
- }] }]; }, propDecorators: { mtxColorpicker: [{
232
- type: Input
233
- }], disabled: [{
234
- type: Input
235
- }], value: [{
236
- type: Input
237
- }], format: [{
238
- type: Input
239
- }], colorChange: [{
240
- type: Output
241
- }], colorInput: [{
242
- type: Output
243
- }] } });
244
-
245
- /** Can be used to override the icon of a `mtxColorpickerToggle`. */
246
- class MtxColorpickerToggleIcon {
247
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerToggleIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
248
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.7", type: MtxColorpickerToggleIcon, selector: "[mtxColorpickerToggleIcon]", ngImport: i0 }); }
249
- }
250
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerToggleIcon, decorators: [{
251
- type: Directive,
252
- args: [{
253
- selector: '[mtxColorpickerToggleIcon]',
254
- }]
255
- }] });
256
- class MtxColorpickerToggle {
257
- /** Whether the toggle button is disabled. */
258
- get disabled() {
259
- if (this._disabled == null && this.picker) {
260
- return this.picker.disabled;
261
- }
262
- return !!this._disabled;
263
- }
264
- set disabled(value) {
265
- this._disabled = coerceBooleanProperty(value);
266
- }
267
- constructor(_changeDetectorRef, defaultTabIndex) {
268
- this._changeDetectorRef = _changeDetectorRef;
269
- this._stateChanges = Subscription.EMPTY;
270
- const parsedTabIndex = Number(defaultTabIndex);
271
- this.tabIndex = parsedTabIndex || parsedTabIndex === 0 ? parsedTabIndex : null;
272
- }
273
- ngOnChanges(changes) {
274
- if (changes.picker) {
275
- this._watchStateChanges();
276
- }
277
- }
278
- ngOnDestroy() {
279
- this._stateChanges.unsubscribe();
280
- }
281
- ngAfterContentInit() {
282
- this._watchStateChanges();
283
- }
284
- _open(event) {
285
- if (this.picker && !this.disabled) {
286
- this.picker.open();
287
- event.stopPropagation();
288
- }
289
- }
290
- _watchStateChanges() {
291
- const pickerDisabled = this.picker ? this.picker._disabledChange : of();
292
- const inputDisabled = this.picker && this.picker.pickerInput
293
- ? this.picker.pickerInput._disabledChange
294
- : of();
295
- const pickerToggled = this.picker
296
- ? merge(this.picker.openedStream, this.picker.closedStream)
297
- : of();
298
- this._stateChanges.unsubscribe();
299
- this._stateChanges = merge(pickerDisabled, inputDisabled, pickerToggled).subscribe(() => this._changeDetectorRef.markForCheck());
300
- }
301
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerToggle, deps: [{ token: i0.ChangeDetectorRef }, { token: 'tabindex', attribute: true }], target: i0.ɵɵFactoryTarget.Component }); }
302
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.7", type: MtxColorpickerToggle, selector: "mtx-colorpicker-toggle", inputs: { picker: ["for", "picker"], tabIndex: "tabIndex", ariaLabel: ["aria-label", "ariaLabel"], disabled: "disabled", disableRipple: "disableRipple" }, 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 <svg *ngIf=\"!_customIcon\"\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\n 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 <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: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
303
- }
304
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerToggle, decorators: [{
305
- type: Component,
306
- args: [{ selector: 'mtx-colorpicker-toggle', host: {
307
- 'class': 'mtx-colorpicker-toggle',
308
- '[attr.tabindex]': 'null',
309
- '[class.mtx-colorpicker-toggle-active]': 'picker && picker.opened',
310
- '[class.mat-accent]': 'picker && picker.color === "accent"',
311
- '[class.mat-warn]': 'picker && picker.color === "warn"',
312
- // Bind the `click` on the host, rather than the inner `button`, so that we can call
313
- // `stopPropagation` on it without affecting the user's `click` handlers. We need to stop
314
- // it so that the input doesn't get focused automatically by the form field (See #21836).
315
- '(click)': '_open($event)',
316
- }, 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 <svg *ngIf=\"!_customIcon\"\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\n 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 <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"] }]
317
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
318
- type: Attribute,
319
- args: ['tabindex']
320
- }] }]; }, propDecorators: { picker: [{
321
- type: Input,
322
- args: ['for']
323
- }], tabIndex: [{
324
- type: Input
325
- }], ariaLabel: [{
326
- type: Input,
327
- args: ['aria-label']
328
- }], disabled: [{
329
- type: Input
330
- }], disableRipple: [{
331
- type: Input
332
- }], _customIcon: [{
333
- type: ContentChild,
334
- args: [MtxColorpickerToggleIcon]
335
- }], _button: [{
336
- type: ViewChild,
337
- args: ['button']
338
- }] } });
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';
339
21
 
340
22
  /**
341
23
  * Animations used by the colorpicker.
@@ -355,7 +37,13 @@ const mtxColorpickerAnimations = {
355
37
  /** Used to generate a unique ID for each colorpicker instance. */
356
38
  let colorpickerUid = 0;
357
39
  /** Injection token that determines the scroll handling while the panel is open. */
358
- 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
+ });
359
47
  function MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY(overlay) {
360
48
  return () => overlay.scrollStrategies.reposition();
361
49
  }
@@ -395,17 +83,17 @@ class MtxColorpickerContent extends _MtxColorpickerContentBase {
395
83
  hsv: new TinyColor(e.color.hsv).toHsvString(),
396
84
  }[this.picker.format];
397
85
  }
398
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerContent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
399
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.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: "<ng-template [ngIf]=\"picker.content\" [ngIfElse]=\"default\"\n [ngTemplateOutlet]=\"picker.content\">\n</ng-template>\n<ng-template #default>\n <color-chrome [color]=\"picker.selected\"\n (onChangeComplete)=\"picker.select(getColorString($event))\">\n </color-chrome>\n</ng-template>\n", styles: [".mtx-colorpicker-content{display:block;border-radius:4px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2$1.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 }); }
400
88
  }
401
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerContent, decorators: [{
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerContent, decorators: [{
402
90
  type: Component,
403
91
  args: [{ selector: 'mtx-colorpicker-content', host: {
404
92
  'class': 'mtx-colorpicker-content',
405
93
  '[@transformPanel]': '_animationState',
406
94
  '(@transformPanel.done)': '_animationDone.next()',
407
- }, animations: [mtxColorpickerAnimations.transformPanel], exportAs: 'mtxColorpickerContent', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['color'], template: "<ng-template [ngIf]=\"picker.content\" [ngIfElse]=\"default\"\n [ngTemplateOutlet]=\"picker.content\">\n</ng-template>\n<ng-template #default>\n <color-chrome [color]=\"picker.selected\"\n (onChangeComplete)=\"picker.select(getColorString($event))\">\n </color-chrome>\n</ng-template>\n", styles: [".mtx-colorpicker-content{display:block;border-radius:4px}\n"] }]
408
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; } });
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"] }]
96
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }] });
409
97
  class MtxColorpicker {
410
98
  get disabled() {
411
99
  return this._disabled === undefined && this.pickerInput
@@ -413,29 +101,17 @@ class MtxColorpicker {
413
101
  : !!this._disabled;
414
102
  }
415
103
  set disabled(value) {
416
- const newValue = coerceBooleanProperty(value);
417
- if (newValue !== this._disabled) {
418
- this._disabled = newValue;
419
- this._disabledChange.next(newValue);
104
+ if (value !== this._disabled) {
105
+ this._disabled = value;
106
+ this._disabledChange.next(value);
420
107
  }
421
108
  }
422
- /**
423
- * Whether to restore focus to the previously-focused element when the panel is closed.
424
- * Note that automatic focus restoration is an accessibility feature and it is recommended that
425
- * you provide your own equivalent, if you decide to turn it off.
426
- */
427
- get restoreFocus() {
428
- return this._restoreFocus;
429
- }
430
- set restoreFocus(value) {
431
- this._restoreFocus = coerceBooleanProperty(value);
432
- }
433
109
  /** Whether the panel is open. */
434
110
  get opened() {
435
111
  return this._opened;
436
112
  }
437
113
  set opened(value) {
438
- coerceBooleanProperty(value) ? this.open() : this.close();
114
+ value ? this.open() : this.close();
439
115
  }
440
116
  /** Color palette to use on the colorpicker's panel. */
441
117
  get color() {
@@ -473,7 +149,12 @@ class MtxColorpicker {
473
149
  this.xPosition = 'start';
474
150
  /** Preferred position of the colorpicker in the Y axis. */
475
151
  this.yPosition = 'below';
476
- this._restoreFocus = true;
152
+ /**
153
+ * Whether to restore focus to the previously-focused element when the panel is closed.
154
+ * Note that automatic focus restoration is an accessibility feature and it is recommended that
155
+ * you provide your own equivalent, if you decide to turn it off.
156
+ */
157
+ this.restoreFocus = true;
477
158
  this._opened = false;
478
159
  /** The id for the colorpicker panel. */
479
160
  this.id = `mtx-colorpicker-${colorpickerUid++}`;
@@ -547,7 +228,7 @@ class MtxColorpicker {
547
228
  this._focusedElementBeforeOpen = null;
548
229
  }
549
230
  };
550
- if (this._restoreFocus &&
231
+ if (this.restoreFocus &&
551
232
  this._focusedElementBeforeOpen &&
552
233
  typeof this._focusedElementBeforeOpen.focus === 'function') {
553
234
  // Because IE moves focus asynchronously, we can't count on it being restored before we've
@@ -585,146 +266,472 @@ class MtxColorpicker {
585
266
  if (labelId) {
586
267
  overlayElement.setAttribute('aria-labelledby', labelId);
587
268
  }
588
- this._getCloseStream(overlayRef).subscribe(event => {
589
- if (event) {
590
- event.preventDefault();
591
- }
592
- this.close();
593
- });
594
- this._componentRef = overlayRef.attach(portal);
595
- this._forwardContentValues(this._componentRef.instance);
596
- // Update the position once the panel has rendered. Only relevant in dropdown mode.
597
- 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
+ }
598
537
  }
599
- /** Destroys the current overlay. */
600
- _destroyOverlay() {
601
- if (this._overlayRef) {
602
- this._overlayRef.dispose();
603
- 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);
604
543
  }
544
+ this._onTouched();
605
545
  }
606
- /** Gets a position strategy that will open the panel as a dropdown. */
607
- _getDropdownStrategy() {
608
- const strategy = this._overlay
609
- .position()
610
- .flexibleConnectedTo(this.pickerInput.getConnectedOverlayOrigin())
611
- .withTransformOriginOn('.mtx-colorpicker-content')
612
- .withFlexibleDimensions(false)
613
- .withViewportMargin(8)
614
- .withLockedPosition();
615
- 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));
616
552
  }
617
- /** Sets the positions of the colorpicker in dropdown mode based on the current configuration. */
618
- _setConnectedPositions(strategy) {
619
- const primaryX = this.xPosition === 'end' ? 'end' : 'start';
620
- const secondaryX = primaryX === 'start' ? 'end' : 'start';
621
- const primaryY = this.yPosition === 'above' ? 'bottom' : 'top';
622
- const secondaryY = primaryY === 'top' ? 'bottom' : 'top';
623
- return strategy.withPositions([
624
- {
625
- originX: primaryX,
626
- originY: secondaryY,
627
- overlayX: primaryX,
628
- overlayY: primaryY,
629
- },
630
- {
631
- originX: primaryX,
632
- originY: primaryY,
633
- overlayX: primaryX,
634
- overlayY: secondaryY,
635
- },
636
- {
637
- originX: secondaryX,
638
- originY: secondaryY,
639
- overlayX: secondaryX,
640
- overlayY: primaryY,
641
- },
642
- {
643
- originX: secondaryX,
644
- originY: primaryY,
645
- overlayX: secondaryX,
646
- overlayY: secondaryY,
647
- },
648
- ]);
553
+ _onChange() {
554
+ this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
649
555
  }
650
- /** Gets an observable that will emit when the overlay is supposed to be closed. */
651
- _getCloseStream(overlayRef) {
652
- return merge(overlayRef.backdropClick(), overlayRef.detachments(), overlayRef.keydownEvents().pipe(filter(event => {
653
- // Closing on alt + up is only valid when there's an input associated with the colorpicker.
654
- return ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
655
- (this.pickerInput && hasModifierKey(event, 'altKey') && event.keyCode === UP_ARROW));
656
- })));
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 : '';
657
563
  }
658
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.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 }); }
659
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.7", type: MtxColorpicker, selector: "mtx-colorpicker", inputs: { content: "content", disabled: "disabled", xPosition: "xPosition", yPosition: "yPosition", restoreFocus: "restoreFocus", opened: "opened", 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 }); }
660
570
  }
661
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpicker, decorators: [{
662
- type: Component,
571
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerInput, decorators: [{
572
+ type: Directive,
663
573
  args: [{
664
- selector: 'mtx-colorpicker',
665
- template: '',
666
- exportAs: 'mtxColorpicker',
667
- changeDetection: ChangeDetectionStrategy.OnPush,
668
- 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,
669
592
  }]
670
- }], ctorParameters: function () { return [{ type: i3.Overlay }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
671
- type: Inject,
672
- args: [MTX_COLORPICKER_SCROLL_STRATEGY]
673
- }] }, { type: i4.Directionality, decorators: [{
674
- type: Optional
675
- }] }, { type: undefined, decorators: [{
593
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.MatFormField, decorators: [{
676
594
  type: Optional
677
- }, {
678
- type: Inject,
679
- args: [DOCUMENT]
680
- }] }]; }, propDecorators: { content: [{
595
+ }] }], propDecorators: { mtxColorpicker: [{
681
596
  type: Input
682
- }], openedStream: [{
683
- type: Output,
684
- args: ['opened']
685
- }], closedStream: [{
686
- type: Output,
687
- args: ['closed']
688
597
  }], disabled: [{
689
- type: Input
690
- }], xPosition: [{
691
- type: Input
692
- }], yPosition: [{
693
- type: Input
694
- }], restoreFocus: [{
695
- type: Input
696
- }], opened: [{
697
- type: Input
698
- }], color: [{
598
+ type: Input,
599
+ args: [{ transform: booleanAttribute }]
600
+ }], value: [{
699
601
  type: Input
700
602
  }], format: [{
701
603
  type: Input
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: [{
695
+ type: Input,
696
+ args: [{ transform: booleanAttribute }]
697
+ }], disableRipple: [{
698
+ type: Input,
699
+ args: [{ transform: booleanAttribute }]
700
+ }], _customIcon: [{
701
+ type: ContentChild,
702
+ args: [MtxColorpickerToggleIcon]
703
+ }], _button: [{
704
+ type: ViewChild,
705
+ args: ['button']
702
706
  }] } });
703
707
 
704
708
  class MtxColorpickerModule {
705
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
706
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerModule, declarations: [MtxColorpicker,
707
- MtxColorpickerContent,
708
- MtxColorpickerInput,
709
- MtxColorpickerToggle,
710
- 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,
711
711
  OverlayModule,
712
712
  A11yModule,
713
713
  PortalModule,
714
714
  MatButtonModule,
715
- ColorChromeModule], exports: [MtxColorpicker,
715
+ ColorChromeModule,
716
+ MtxColorpicker,
717
+ MtxColorpickerContent,
718
+ MtxColorpickerInput,
719
+ MtxColorpickerToggle,
720
+ MtxColorpickerToggleIcon], exports: [MtxColorpicker,
716
721
  MtxColorpickerContent,
717
722
  MtxColorpickerInput,
718
723
  MtxColorpickerToggle,
719
724
  MtxColorpickerToggleIcon] }); }
720
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.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,
721
726
  OverlayModule,
722
727
  A11yModule,
723
728
  PortalModule,
724
729
  MatButtonModule,
725
- ColorChromeModule] }); }
730
+ ColorChromeModule,
731
+ MtxColorpickerContent,
732
+ MtxColorpickerToggle] }); }
726
733
  }
727
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerModule, decorators: [{
734
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerModule, decorators: [{
728
735
  type: NgModule,
729
736
  args: [{
730
737
  imports: [
@@ -734,15 +741,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImpor
734
741
  PortalModule,
735
742
  MatButtonModule,
736
743
  ColorChromeModule,
737
- ],
738
- exports: [
739
744
  MtxColorpicker,
740
745
  MtxColorpickerContent,
741
746
  MtxColorpickerInput,
742
747
  MtxColorpickerToggle,
743
748
  MtxColorpickerToggleIcon,
744
749
  ],
745
- declarations: [
750
+ exports: [
746
751
  MtxColorpicker,
747
752
  MtxColorpickerContent,
748
753
  MtxColorpickerInput,