ngx-color 8.0.3 → 10.0.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 (200) hide show
  1. package/README.md +2 -3
  2. package/alpha/alpha-picker.component.d.ts +1 -1
  3. package/alpha.component.d.ts +1 -1
  4. package/block/block-swatches.component.d.ts +1 -1
  5. package/block/block.component.d.ts +1 -1
  6. package/checkboard.component.d.ts +1 -1
  7. package/chrome/chrome-fields.component.d.ts +1 -1
  8. package/chrome/chrome.component.d.ts +1 -1
  9. package/circle/circle-swatch.component.d.ts +1 -1
  10. package/circle/circle.component.d.ts +1 -1
  11. package/color-wrap.component.d.ts +1 -1
  12. package/compact/compact-color.component.d.ts +1 -1
  13. package/compact/compact-fields.component.d.ts +1 -1
  14. package/compact/compact.component.d.ts +1 -1
  15. package/coordinates.directive.d.ts +2 -3
  16. package/editable-input.component.d.ts +1 -1
  17. package/{fesm2020 → fesm2022}/ngx-color-alpha.mjs +36 -38
  18. package/fesm2022/ngx-color-alpha.mjs.map +1 -0
  19. package/fesm2022/ngx-color-block.mjs +233 -0
  20. package/fesm2022/ngx-color-block.mjs.map +1 -0
  21. package/fesm2022/ngx-color-chrome.mjs +543 -0
  22. package/fesm2022/ngx-color-chrome.mjs.map +1 -0
  23. package/fesm2022/ngx-color-circle.mjs +223 -0
  24. package/fesm2022/ngx-color-circle.mjs.map +1 -0
  25. package/fesm2022/ngx-color-compact.mjs +403 -0
  26. package/fesm2022/ngx-color-compact.mjs.map +1 -0
  27. package/fesm2022/ngx-color-github.mjs +167 -0
  28. package/fesm2022/ngx-color-github.mjs.map +1 -0
  29. package/fesm2022/ngx-color-hue.mjs +109 -0
  30. package/fesm2022/ngx-color-hue.mjs.map +1 -0
  31. package/fesm2022/ngx-color-material.mjs +209 -0
  32. package/fesm2022/ngx-color-material.mjs.map +1 -0
  33. package/fesm2022/ngx-color-photoshop.mjs +475 -0
  34. package/fesm2022/ngx-color-photoshop.mjs.map +1 -0
  35. package/{fesm2015 → fesm2022}/ngx-color-shade.mjs +41 -35
  36. package/fesm2022/ngx-color-shade.mjs.map +1 -0
  37. package/fesm2022/ngx-color-sketch.mjs +491 -0
  38. package/fesm2022/ngx-color-sketch.mjs.map +1 -0
  39. package/fesm2022/ngx-color-slider.mjs +282 -0
  40. package/fesm2022/ngx-color-slider.mjs.map +1 -0
  41. package/fesm2022/ngx-color-swatches.mjs +293 -0
  42. package/fesm2022/ngx-color-swatches.mjs.map +1 -0
  43. package/fesm2022/ngx-color-twitter.mjs +169 -0
  44. package/fesm2022/ngx-color-twitter.mjs.map +1 -0
  45. package/{fesm2020 → fesm2022}/ngx-color.mjs +348 -264
  46. package/fesm2022/ngx-color.mjs.map +1 -0
  47. package/github/github-swatch.component.d.ts +1 -1
  48. package/github/github.component.d.ts +1 -1
  49. package/hue/hue-picker.component.d.ts +1 -1
  50. package/hue.component.d.ts +1 -1
  51. package/material/material.component.d.ts +1 -1
  52. package/package.json +29 -84
  53. package/photoshop/photoshop-button.component.d.ts +1 -1
  54. package/photoshop/photoshop-fields.component.d.ts +1 -1
  55. package/photoshop/photoshop-previews.component.d.ts +1 -1
  56. package/photoshop/photoshop.component.d.ts +1 -1
  57. package/raised.component.d.ts +2 -2
  58. package/saturation.component.d.ts +1 -1
  59. package/shade/shade-picker.component.d.ts +1 -1
  60. package/shade.component.d.ts +1 -1
  61. package/sketch/sketch-fields.component.d.ts +1 -1
  62. package/sketch/sketch-preset-colors.component.d.ts +1 -1
  63. package/sketch/sketch.component.d.ts +1 -1
  64. package/slider/slider-swatch.component.d.ts +1 -1
  65. package/slider/slider-swatches.component.d.ts +1 -1
  66. package/slider/slider.component.d.ts +1 -1
  67. package/swatch.component.d.ts +1 -1
  68. package/swatches/swatches-color.component.d.ts +1 -1
  69. package/swatches/swatches-group.component.d.ts +1 -1
  70. package/swatches/swatches.component.d.ts +1 -1
  71. package/twitter/twitter.component.d.ts +1 -1
  72. package/esm2020/alpha/alpha-picker.component.mjs +0 -100
  73. package/esm2020/alpha/ngx-color-alpha.mjs +0 -5
  74. package/esm2020/alpha/public_api.mjs +0 -2
  75. package/esm2020/alpha.component.mjs +0 -138
  76. package/esm2020/block/block-swatches.component.mjs +0 -63
  77. package/esm2020/block/block.component.mjs +0 -158
  78. package/esm2020/block/ngx-color-block.mjs +0 -5
  79. package/esm2020/block/public_api.mjs +0 -3
  80. package/esm2020/checkboard.component.mjs +0 -50
  81. package/esm2020/chrome/chrome-fields.component.mjs +0 -314
  82. package/esm2020/chrome/chrome.component.mjs +0 -184
  83. package/esm2020/chrome/ngx-color-chrome.mjs +0 -5
  84. package/esm2020/chrome/public_api.mjs +0 -3
  85. package/esm2020/circle/circle-swatch.component.mjs +0 -69
  86. package/esm2020/circle/circle.component.mjs +0 -134
  87. package/esm2020/circle/ngx-color-circle.mjs +0 -5
  88. package/esm2020/circle/public_api.mjs +0 -3
  89. package/esm2020/color-wrap.component.mjs +0 -163
  90. package/esm2020/compact/compact-color.component.mjs +0 -70
  91. package/esm2020/compact/compact-fields.component.mjs +0 -164
  92. package/esm2020/compact/compact.component.mjs +0 -154
  93. package/esm2020/compact/ngx-color-compact.mjs +0 -5
  94. package/esm2020/compact/public_api.mjs +0 -4
  95. package/esm2020/coordinates.directive.mjs +0 -104
  96. package/esm2020/editable-input.component.mjs +0 -199
  97. package/esm2020/github/github-swatch.component.mjs +0 -53
  98. package/esm2020/github/github.component.mjs +0 -112
  99. package/esm2020/github/ngx-color-github.mjs +0 -5
  100. package/esm2020/github/public_api.mjs +0 -3
  101. package/esm2020/helpers/checkboard.mjs +0 -33
  102. package/esm2020/helpers/color.interfaces.mjs +0 -2
  103. package/esm2020/helpers/color.mjs +0 -60
  104. package/esm2020/hue/hue-picker.component.mjs +0 -100
  105. package/esm2020/hue/ngx-color-hue.mjs +0 -5
  106. package/esm2020/hue/public_api.mjs +0 -2
  107. package/esm2020/hue.component.mjs +0 -124
  108. package/esm2020/material/material.component.mjs +0 -186
  109. package/esm2020/material/ngx-color-material.mjs +0 -5
  110. package/esm2020/material/public_api.mjs +0 -2
  111. package/esm2020/ngx-color.mjs +0 -5
  112. package/esm2020/photoshop/ngx-color-photoshop.mjs +0 -5
  113. package/esm2020/photoshop/photoshop-button.component.mjs +0 -34
  114. package/esm2020/photoshop/photoshop-fields.component.mjs +0 -212
  115. package/esm2020/photoshop/photoshop-previews.component.mjs +0 -40
  116. package/esm2020/photoshop/photoshop.component.mjs +0 -185
  117. package/esm2020/photoshop/public_api.mjs +0 -5
  118. package/esm2020/public_api.mjs +0 -14
  119. package/esm2020/raised.component.mjs +0 -50
  120. package/esm2020/saturation.component.mjs +0 -92
  121. package/esm2020/shade/ngx-color-shade.mjs +0 -5
  122. package/esm2020/shade/public_api.mjs +0 -2
  123. package/esm2020/shade/shade-picker.component.mjs +0 -92
  124. package/esm2020/shade.component.mjs +0 -125
  125. package/esm2020/sketch/ngx-color-sketch.mjs +0 -5
  126. package/esm2020/sketch/public_api.mjs +0 -4
  127. package/esm2020/sketch/sketch-fields.component.mjs +0 -209
  128. package/esm2020/sketch/sketch-preset-colors.component.mjs +0 -68
  129. package/esm2020/sketch/sketch.component.mjs +0 -212
  130. package/esm2020/slider/ngx-color-slider.mjs +0 -5
  131. package/esm2020/slider/public_api.mjs +0 -4
  132. package/esm2020/slider/slider-swatch.component.mjs +0 -52
  133. package/esm2020/slider/slider-swatches.component.mjs +0 -119
  134. package/esm2020/slider/slider.component.mjs +0 -102
  135. package/esm2020/swatch.component.mjs +0 -110
  136. package/esm2020/swatches/ngx-color-swatches.mjs +0 -5
  137. package/esm2020/swatches/public_api.mjs +0 -4
  138. package/esm2020/swatches/swatches-color.component.mjs +0 -104
  139. package/esm2020/swatches/swatches-group.component.mjs +0 -49
  140. package/esm2020/swatches/swatches.component.mjs +0 -242
  141. package/esm2020/twitter/ngx-color-twitter.mjs +0 -5
  142. package/esm2020/twitter/public_api.mjs +0 -2
  143. package/esm2020/twitter/twitter.component.mjs +0 -159
  144. package/fesm2015/ngx-color-alpha.mjs +0 -107
  145. package/fesm2015/ngx-color-alpha.mjs.map +0 -1
  146. package/fesm2015/ngx-color-block.mjs +0 -223
  147. package/fesm2015/ngx-color-block.mjs.map +0 -1
  148. package/fesm2015/ngx-color-chrome.mjs +0 -499
  149. package/fesm2015/ngx-color-chrome.mjs.map +0 -1
  150. package/fesm2015/ngx-color-circle.mjs +0 -207
  151. package/fesm2015/ngx-color-circle.mjs.map +0 -1
  152. package/fesm2015/ngx-color-compact.mjs +0 -385
  153. package/fesm2015/ngx-color-compact.mjs.map +0 -1
  154. package/fesm2015/ngx-color-github.mjs +0 -169
  155. package/fesm2015/ngx-color-github.mjs.map +0 -1
  156. package/fesm2015/ngx-color-hue.mjs +0 -107
  157. package/fesm2015/ngx-color-hue.mjs.map +0 -1
  158. package/fesm2015/ngx-color-material.mjs +0 -193
  159. package/fesm2015/ngx-color-material.mjs.map +0 -1
  160. package/fesm2015/ngx-color-photoshop.mjs +0 -467
  161. package/fesm2015/ngx-color-photoshop.mjs.map +0 -1
  162. package/fesm2015/ngx-color-shade.mjs.map +0 -1
  163. package/fesm2015/ngx-color-sketch.mjs +0 -485
  164. package/fesm2015/ngx-color-sketch.mjs.map +0 -1
  165. package/fesm2015/ngx-color-slider.mjs +0 -273
  166. package/fesm2015/ngx-color-slider.mjs.map +0 -1
  167. package/fesm2015/ngx-color-swatches.mjs +0 -391
  168. package/fesm2015/ngx-color-swatches.mjs.map +0 -1
  169. package/fesm2015/ngx-color-twitter.mjs +0 -166
  170. package/fesm2015/ngx-color-twitter.mjs.map +0 -1
  171. package/fesm2015/ngx-color.mjs +0 -1202
  172. package/fesm2015/ngx-color.mjs.map +0 -1
  173. package/fesm2020/ngx-color-alpha.mjs.map +0 -1
  174. package/fesm2020/ngx-color-block.mjs +0 -223
  175. package/fesm2020/ngx-color-block.mjs.map +0 -1
  176. package/fesm2020/ngx-color-chrome.mjs +0 -499
  177. package/fesm2020/ngx-color-chrome.mjs.map +0 -1
  178. package/fesm2020/ngx-color-circle.mjs +0 -207
  179. package/fesm2020/ngx-color-circle.mjs.map +0 -1
  180. package/fesm2020/ngx-color-compact.mjs +0 -385
  181. package/fesm2020/ngx-color-compact.mjs.map +0 -1
  182. package/fesm2020/ngx-color-github.mjs +0 -169
  183. package/fesm2020/ngx-color-github.mjs.map +0 -1
  184. package/fesm2020/ngx-color-hue.mjs +0 -107
  185. package/fesm2020/ngx-color-hue.mjs.map +0 -1
  186. package/fesm2020/ngx-color-material.mjs +0 -193
  187. package/fesm2020/ngx-color-material.mjs.map +0 -1
  188. package/fesm2020/ngx-color-photoshop.mjs +0 -467
  189. package/fesm2020/ngx-color-photoshop.mjs.map +0 -1
  190. package/fesm2020/ngx-color-shade.mjs +0 -99
  191. package/fesm2020/ngx-color-shade.mjs.map +0 -1
  192. package/fesm2020/ngx-color-sketch.mjs +0 -485
  193. package/fesm2020/ngx-color-sketch.mjs.map +0 -1
  194. package/fesm2020/ngx-color-slider.mjs +0 -273
  195. package/fesm2020/ngx-color-slider.mjs.map +0 -1
  196. package/fesm2020/ngx-color-swatches.mjs +0 -391
  197. package/fesm2020/ngx-color-swatches.mjs.map +0 -1
  198. package/fesm2020/ngx-color-twitter.mjs +0 -166
  199. package/fesm2020/ngx-color-twitter.mjs.map +0 -1
  200. package/fesm2020/ngx-color.mjs.map +0 -1
@@ -0,0 +1,223 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, forwardRef, NgModule } from '@angular/core';
3
+ import * as i1 from 'ngx-color';
4
+ import { ColorWrap, isValidHex, SwatchModule } from 'ngx-color';
5
+ import { CommonModule } from '@angular/common';
6
+ import { red, pink, purple, deepPurple, indigo, blue, lightBlue, cyan, teal, green, lightGreen, lime, yellow, amber, orange, deepOrange, brown, blueGrey } from 'material-colors';
7
+ import { TinyColor } from '@ctrl/tinycolor';
8
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
9
+
10
+ class CircleSwatchComponent {
11
+ color;
12
+ circleSize = 28;
13
+ circleSpacing = 14;
14
+ focus = false;
15
+ onClick = new EventEmitter();
16
+ onSwatchHover = new EventEmitter();
17
+ focusStyle = {};
18
+ swatchStyle = {
19
+ borderRadius: '50%',
20
+ background: 'transparent',
21
+ transition: '100ms box-shadow ease 0s',
22
+ };
23
+ ngOnChanges() {
24
+ this.swatchStyle.boxShadow = `inset 0 0 0 ${this.circleSize / 2}px ${this.color}`;
25
+ this.focusStyle.boxShadow = `inset 0 0 0 ${this.circleSize / 2}px ${this.color}, 0 0 5px ${this.color}`;
26
+ if (this.focus) {
27
+ this.focusStyle.boxShadow = `inset 0 0 0 3px ${this.color}, 0 0 5px ${this.color}`;
28
+ }
29
+ }
30
+ handleClick({ hex, $event }) {
31
+ this.onClick.emit({ hex, $event });
32
+ }
33
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: CircleSwatchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
34
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: CircleSwatchComponent, isStandalone: false, selector: "color-circle-swatch", inputs: { color: "color", circleSize: "circleSize", circleSpacing: "circleSpacing", focus: "focus" }, outputs: { onClick: "onClick", onSwatchHover: "onSwatchHover" }, usesOnChanges: true, ngImport: i0, template: `
35
+ <div
36
+ class="circle-swatch"
37
+ [style.width.px]="circleSize"
38
+ [style.height.px]="circleSize"
39
+ [style.margin-right.px]="circleSpacing"
40
+ [style.margin-bottom.px]="circleSpacing"
41
+ >
42
+ <color-swatch
43
+ [color]="color"
44
+ [style]="swatchStyle"
45
+ [focus]="focus"
46
+ [focusStyle]="focusStyle"
47
+ (onClick)="handleClick($event)"
48
+ (onHover)="onSwatchHover.emit($event)"
49
+ >
50
+ </color-swatch>
51
+ <div class="clear"></div>
52
+ </div>
53
+ `, isInline: true, styles: [".circle-swatch{transform:scale(1);transition:transform .1s ease}.circle-swatch:hover{transform:scale(1.2)}\n"], dependencies: [{ kind: "component", type: i1.SwatchComponent, selector: "color-swatch", inputs: ["color", "style", "focusStyle", "focus"], outputs: ["onClick", "onHover"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
54
+ }
55
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: CircleSwatchComponent, decorators: [{
56
+ type: Component,
57
+ args: [{ selector: 'color-circle-swatch', template: `
58
+ <div
59
+ class="circle-swatch"
60
+ [style.width.px]="circleSize"
61
+ [style.height.px]="circleSize"
62
+ [style.margin-right.px]="circleSpacing"
63
+ [style.margin-bottom.px]="circleSpacing"
64
+ >
65
+ <color-swatch
66
+ [color]="color"
67
+ [style]="swatchStyle"
68
+ [focus]="focus"
69
+ [focusStyle]="focusStyle"
70
+ (onClick)="handleClick($event)"
71
+ (onHover)="onSwatchHover.emit($event)"
72
+ >
73
+ </color-swatch>
74
+ <div class="clear"></div>
75
+ </div>
76
+ `, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, standalone: false, styles: [".circle-swatch{transform:scale(1);transition:transform .1s ease}.circle-swatch:hover{transform:scale(1.2)}\n"] }]
77
+ }], propDecorators: { color: [{
78
+ type: Input
79
+ }], circleSize: [{
80
+ type: Input
81
+ }], circleSpacing: [{
82
+ type: Input
83
+ }], focus: [{
84
+ type: Input
85
+ }], onClick: [{
86
+ type: Output
87
+ }], onSwatchHover: [{
88
+ type: Output
89
+ }] } });
90
+
91
+ class CircleComponent extends ColorWrap {
92
+ /** Pixel value for picker width */
93
+ width = 252;
94
+ /** Color squares to display */
95
+ colors = [
96
+ red['500'],
97
+ pink['500'],
98
+ purple['500'],
99
+ deepPurple['500'],
100
+ indigo['500'],
101
+ blue['500'],
102
+ lightBlue['500'],
103
+ cyan['500'],
104
+ teal['500'],
105
+ green['500'],
106
+ lightGreen['500'],
107
+ lime['500'],
108
+ yellow['500'],
109
+ amber['500'],
110
+ orange['500'],
111
+ deepOrange['500'],
112
+ brown['500'],
113
+ blueGrey['500'],
114
+ ];
115
+ /** Value for circle size */
116
+ circleSize = 28;
117
+ /** Value for spacing between circles */
118
+ circleSpacing = 14;
119
+ constructor() {
120
+ super();
121
+ }
122
+ isActive(color) {
123
+ return new TinyColor(this.hex).equals(color);
124
+ }
125
+ handleBlockChange({ hex, $event }) {
126
+ if (isValidHex(hex)) {
127
+ this.handleChange({ hex, source: 'hex' }, $event);
128
+ }
129
+ }
130
+ handleValueChange({ data, $event }) {
131
+ this.handleChange(data, $event);
132
+ }
133
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: CircleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
134
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.3", type: CircleComponent, isStandalone: false, selector: "color-circle", inputs: { width: "width", colors: "colors", circleSize: "circleSize", circleSpacing: "circleSpacing" }, providers: [
135
+ {
136
+ provide: NG_VALUE_ACCESSOR,
137
+ useExisting: forwardRef(() => CircleComponent),
138
+ multi: true,
139
+ },
140
+ {
141
+ provide: ColorWrap,
142
+ useExisting: forwardRef(() => CircleComponent),
143
+ },
144
+ ], usesInheritance: true, ngImport: i0, template: `
145
+ <div
146
+ class="circle-picker {{ className }}"
147
+ [style.width.px]="width"
148
+ [style.margin-right.px]="-circleSpacing"
149
+ [style.margin-bottom.px]="-circleSpacing"
150
+ >
151
+ @for (color of colors; track color) {
152
+ <color-circle-swatch
153
+ [circleSize]="circleSize"
154
+ [circleSpacing]="circleSpacing"
155
+ [color]="color"
156
+ [focus]="isActive(color)"
157
+ (onClick)="handleBlockChange($event)"
158
+ (onSwatchHover)="onSwatchHover.emit($event)"
159
+ ></color-circle-swatch>
160
+ }
161
+ </div>
162
+ `, isInline: true, styles: [".circle-picker{display:flex;flex-wrap:wrap}\n"], dependencies: [{ kind: "component", type: i0.forwardRef(() => CircleSwatchComponent), selector: "color-circle-swatch", inputs: ["color", "circleSize", "circleSpacing", "focus"], outputs: ["onClick", "onSwatchHover"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
163
+ }
164
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: CircleComponent, decorators: [{
165
+ type: Component,
166
+ args: [{ selector: 'color-circle', template: `
167
+ <div
168
+ class="circle-picker {{ className }}"
169
+ [style.width.px]="width"
170
+ [style.margin-right.px]="-circleSpacing"
171
+ [style.margin-bottom.px]="-circleSpacing"
172
+ >
173
+ @for (color of colors; track color) {
174
+ <color-circle-swatch
175
+ [circleSize]="circleSize"
176
+ [circleSpacing]="circleSpacing"
177
+ [color]="color"
178
+ [focus]="isActive(color)"
179
+ (onClick)="handleBlockChange($event)"
180
+ (onSwatchHover)="onSwatchHover.emit($event)"
181
+ ></color-circle-swatch>
182
+ }
183
+ </div>
184
+ `, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, providers: [
185
+ {
186
+ provide: NG_VALUE_ACCESSOR,
187
+ useExisting: forwardRef(() => CircleComponent),
188
+ multi: true,
189
+ },
190
+ {
191
+ provide: ColorWrap,
192
+ useExisting: forwardRef(() => CircleComponent),
193
+ },
194
+ ], standalone: false, styles: [".circle-picker{display:flex;flex-wrap:wrap}\n"] }]
195
+ }], ctorParameters: () => [], propDecorators: { width: [{
196
+ type: Input
197
+ }], colors: [{
198
+ type: Input
199
+ }], circleSize: [{
200
+ type: Input
201
+ }], circleSpacing: [{
202
+ type: Input
203
+ }] } });
204
+ class ColorCircleModule {
205
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: ColorCircleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
206
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.3", ngImport: i0, type: ColorCircleModule, declarations: [CircleComponent, CircleSwatchComponent], imports: [CommonModule, SwatchModule], exports: [CircleComponent, CircleSwatchComponent] });
207
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: ColorCircleModule, imports: [CommonModule, SwatchModule] });
208
+ }
209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: ColorCircleModule, decorators: [{
210
+ type: NgModule,
211
+ args: [{
212
+ declarations: [CircleComponent, CircleSwatchComponent],
213
+ exports: [CircleComponent, CircleSwatchComponent],
214
+ imports: [CommonModule, SwatchModule],
215
+ }]
216
+ }] });
217
+
218
+ /**
219
+ * Generated bundle index. Do not edit.
220
+ */
221
+
222
+ export { CircleComponent, CircleSwatchComponent, ColorCircleModule };
223
+ //# sourceMappingURL=ngx-color-circle.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-color-circle.mjs","sources":["../../src/lib/circle/circle-swatch.component.ts","../../src/lib/circle/circle.component.ts","../../src/lib/circle/ngx-color-circle.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n OnChanges,\n Output,\n} from '@angular/core';\n\n@Component({\n selector: 'color-circle-swatch',\n template: `\n <div\n class=\"circle-swatch\"\n [style.width.px]=\"circleSize\"\n [style.height.px]=\"circleSize\"\n [style.margin-right.px]=\"circleSpacing\"\n [style.margin-bottom.px]=\"circleSpacing\"\n >\n <color-swatch\n [color]=\"color\"\n [style]=\"swatchStyle\"\n [focus]=\"focus\"\n [focusStyle]=\"focusStyle\"\n (onClick)=\"handleClick($event)\"\n (onHover)=\"onSwatchHover.emit($event)\"\n >\n </color-swatch>\n <div class=\"clear\"></div>\n </div>\n `,\n styles: [\n `\n .circle-swatch {\n transform: scale(1);\n transition: transform 100ms ease;\n }\n .circle-swatch:hover {\n transform: scale(1.2);\n }\n `,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n preserveWhitespaces: false,\n standalone: false,\n})\nexport class CircleSwatchComponent implements OnChanges {\n @Input() color!: string;\n @Input() circleSize = 28;\n @Input() circleSpacing = 14;\n @Input() focus = false;\n @Output() onClick = new EventEmitter<any>();\n @Output() onSwatchHover = new EventEmitter<any>();\n focusStyle: Record<string, string> = {};\n swatchStyle: Record<string, string> = {\n borderRadius: '50%',\n background: 'transparent',\n transition: '100ms box-shadow ease 0s',\n };\n\n ngOnChanges() {\n this.swatchStyle.boxShadow = `inset 0 0 0 ${this.circleSize / 2}px ${this.color}`;\n this.focusStyle.boxShadow = `inset 0 0 0 ${this.circleSize / 2}px ${this.color}, 0 0 5px ${this.color}`;\n if (this.focus) {\n this.focusStyle.boxShadow = `inset 0 0 0 3px ${this.color}, 0 0 5px ${this.color}`;\n }\n }\n handleClick({ hex, $event }) {\n this.onClick.emit({ hex, $event });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, forwardRef, Input, NgModule } from '@angular/core';\nimport {\n amber,\n blue,\n blueGrey,\n brown,\n cyan,\n deepOrange,\n deepPurple,\n green,\n indigo,\n lightBlue,\n lightGreen,\n lime,\n orange,\n pink,\n purple,\n red,\n teal,\n yellow,\n} from 'material-colors';\nimport { TinyColor } from '@ctrl/tinycolor';\n\nimport { ColorWrap, isValidHex, SwatchModule } from 'ngx-color';\nimport { CircleSwatchComponent } from './circle-swatch.component';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\n\n@Component({\n selector: 'color-circle',\n template: `\n <div\n class=\"circle-picker {{ className }}\"\n [style.width.px]=\"width\"\n [style.margin-right.px]=\"-circleSpacing\"\n [style.margin-bottom.px]=\"-circleSpacing\"\n >\n @for (color of colors; track color) {\n <color-circle-swatch\n [circleSize]=\"circleSize\"\n [circleSpacing]=\"circleSpacing\"\n [color]=\"color\"\n [focus]=\"isActive(color)\"\n (onClick)=\"handleBlockChange($event)\"\n (onSwatchHover)=\"onSwatchHover.emit($event)\"\n ></color-circle-swatch>\n }\n </div>\n `,\n styles: [\n `\n .circle-picker {\n display: flex;\n flex-wrap: wrap;\n }\n `,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n preserveWhitespaces: false,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => CircleComponent),\n multi: true,\n },\n {\n provide: ColorWrap,\n useExisting: forwardRef(() => CircleComponent),\n },\n ],\n standalone: false,\n})\nexport class CircleComponent extends ColorWrap {\n /** Pixel value for picker width */\n @Input() width: string | number = 252;\n /** Color squares to display */\n @Input()\n colors: string[] = [\n red['500'],\n pink['500'],\n purple['500'],\n deepPurple['500'],\n indigo['500'],\n blue['500'],\n lightBlue['500'],\n cyan['500'],\n teal['500'],\n green['500'],\n lightGreen['500'],\n lime['500'],\n yellow['500'],\n amber['500'],\n orange['500'],\n deepOrange['500'],\n brown['500'],\n blueGrey['500'],\n ];\n /** Value for circle size */\n @Input() circleSize = 28;\n /** Value for spacing between circles */\n @Input() circleSpacing = 14;\n\n constructor() {\n super();\n }\n isActive(color: string) {\n return new TinyColor(this.hex).equals(color);\n }\n handleBlockChange({ hex, $event }: { hex: string; $event: Event }) {\n if (isValidHex(hex)) {\n this.handleChange({ hex, source: 'hex' }, $event);\n }\n }\n handleValueChange({ data, $event }) {\n this.handleChange(data, $event);\n }\n}\n\n@NgModule({\n declarations: [CircleComponent, CircleSwatchComponent],\n exports: [CircleComponent, CircleSwatchComponent],\n imports: [CommonModule, SwatchModule],\n})\nexport class ColorCircleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;MA8Ca,qBAAqB,CAAA;AACvB,IAAA,KAAK;IACL,UAAU,GAAG,EAAE;IACf,aAAa,GAAG,EAAE;IAClB,KAAK,GAAG,KAAK;AACZ,IAAA,OAAO,GAAG,IAAI,YAAY,EAAO;AACjC,IAAA,aAAa,GAAG,IAAI,YAAY,EAAO;IACjD,UAAU,GAA2B,EAAE;AACvC,IAAA,WAAW,GAA2B;AACpC,QAAA,YAAY,EAAE,KAAK;AACnB,QAAA,UAAU,EAAE,aAAa;AAC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U,CAAC,qBAAqB,CAAC;AAC/C,yBAAA;AACF,qBAAA,EAAA,UAAA,EACW,KAAK,EAAA,MAAA,EAAA,CAAA,+CAAA,CAAA,EAAA;wDAIR,KAAK,EAAA,CAAA;sBAAb;gBAGD,MAAM,EAAA,CAAA;sBADL;gBAsBQ,UAAU,EAAA,CAAA;sBAAlB;gBAEQ,aAAa,EAAA,CAAA;sBAArB;;MAuBU,iBAAiB,CAAA;uGAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAAjB,iBAAiB,EAAA,YAAA,EAAA,CAnDjB,eAAe,EA+CM,qBAAqB,CAAA,EAAA,OAAA,EAAA,CAE3C,YAAY,EAAE,YAAY,CAAA,EAAA,OAAA,EAAA,CAjDzB,eAAe,EAgDC,qBAAqB,CAAA,EAAA,CAAA;wGAGrC,iBAAiB,EAAA,OAAA,EAAA,CAFlB,YAAY,EAAE,YAAY,CAAA,EAAA,CAAA;;2FAEzB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAL7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,eAAe,EAAE,qBAAqB,CAAC;AACtD,oBAAA,OAAO,EAAE,CAAC,eAAe,EAAE,qBAAqB,CAAC;AACjD,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC;AACtC,iBAAA;;;AC1HD;;AAEG;;;;"}
@@ -0,0 +1,403 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, forwardRef, NgModule } from '@angular/core';
3
+ import * as i1 from 'ngx-color';
4
+ import { getContrastingColor, isValidHex, ColorWrap, EditableInputModule, SwatchModule, RaisedModule } from 'ngx-color';
5
+ import { CommonModule } from '@angular/common';
6
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
7
+
8
+ class CompactColorComponent {
9
+ color;
10
+ active;
11
+ onClick = new EventEmitter();
12
+ onSwatchHover = new EventEmitter();
13
+ swatchStyle = {
14
+ width: '15px',
15
+ height: '15px',
16
+ float: 'left',
17
+ marginRight: '5px',
18
+ marginBottom: '5px',
19
+ position: 'relative',
20
+ cursor: 'pointer',
21
+ };
22
+ swatchFocus = {};
23
+ getContrastingColor = getContrastingColor;
24
+ ngOnChanges() {
25
+ this.swatchStyle.background = this.color;
26
+ this.swatchFocus.boxShadow = `0 0 4px ${this.color}`;
27
+ if (this.color.toLowerCase() === '#ffffff') {
28
+ this.swatchStyle.boxShadow = 'inset 0 0 0 1px #ddd';
29
+ }
30
+ }
31
+ handleClick({ hex, $event }) {
32
+ this.onClick.emit({ hex, $event });
33
+ }
34
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: CompactColorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
35
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: CompactColorComponent, isStandalone: false, selector: "color-compact-color", inputs: { color: "color", active: "active" }, outputs: { onClick: "onClick", onSwatchHover: "onSwatchHover" }, usesOnChanges: true, ngImport: i0, template: `
36
+ <div class="compact-color">
37
+ <color-swatch
38
+ class="swatch"
39
+ [color]="color"
40
+ [style]="swatchStyle"
41
+ [focusStyle]="swatchFocus"
42
+ (onClick)="handleClick($event)"
43
+ (onHover)="onSwatchHover.emit($event)"
44
+ >
45
+ <div
46
+ class="compact-dot"
47
+ [class.active]="active"
48
+ [style.background]="getContrastingColor(color)"
49
+ ></div>
50
+ </color-swatch>
51
+ </div>
52
+ `, isInline: true, styles: [".compact-dot{position:absolute;inset:5px;border-radius:50%;opacity:0}.compact-dot.active{opacity:1}\n"], dependencies: [{ kind: "component", type: i1.SwatchComponent, selector: "color-swatch", inputs: ["color", "style", "focusStyle", "focus"], outputs: ["onClick", "onHover"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
53
+ }
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: CompactColorComponent, decorators: [{
55
+ type: Component,
56
+ args: [{ selector: 'color-compact-color', template: `
57
+ <div class="compact-color">
58
+ <color-swatch
59
+ class="swatch"
60
+ [color]="color"
61
+ [style]="swatchStyle"
62
+ [focusStyle]="swatchFocus"
63
+ (onClick)="handleClick($event)"
64
+ (onHover)="onSwatchHover.emit($event)"
65
+ >
66
+ <div
67
+ class="compact-dot"
68
+ [class.active]="active"
69
+ [style.background]="getContrastingColor(color)"
70
+ ></div>
71
+ </color-swatch>
72
+ </div>
73
+ `, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, standalone: false, styles: [".compact-dot{position:absolute;inset:5px;border-radius:50%;opacity:0}.compact-dot.active{opacity:1}\n"] }]
74
+ }], propDecorators: { color: [{
75
+ type: Input
76
+ }], active: [{
77
+ type: Input
78
+ }], onClick: [{
79
+ type: Output
80
+ }], onSwatchHover: [{
81
+ type: Output
82
+ }] } });
83
+
84
+ class CompactFieldsComponent {
85
+ hex;
86
+ rgb;
87
+ onChange = new EventEmitter();
88
+ HEXWrap = {
89
+ marginTop: '-3px',
90
+ marginBottom: '-3px',
91
+ // flex: '6 1 0%',
92
+ position: 'relative',
93
+ };
94
+ HEXinput = {
95
+ width: '80%',
96
+ padding: '0px',
97
+ paddingLeft: '20%',
98
+ border: 'none',
99
+ outline: 'none',
100
+ background: 'none',
101
+ fontSize: '12px',
102
+ color: '#333',
103
+ height: '16px',
104
+ };
105
+ HEXlabel = {
106
+ display: 'none',
107
+ };
108
+ RGBwrap = {
109
+ marginTop: '-3px',
110
+ marginBottom: '-3px',
111
+ // flex: '3 1 0%',
112
+ position: 'relative',
113
+ };
114
+ RGBinput = {
115
+ width: '80%',
116
+ padding: '0px',
117
+ paddingLeft: '30%',
118
+ border: 'none',
119
+ outline: 'none',
120
+ background: 'none',
121
+ fontSize: '12px',
122
+ color: '#333',
123
+ height: '16px',
124
+ };
125
+ RGBlabel = {
126
+ position: 'absolute',
127
+ top: '6px',
128
+ left: '0px',
129
+ 'line-height': '16px',
130
+ 'text-transform': 'uppercase',
131
+ fontSize: '12px',
132
+ color: '#999',
133
+ };
134
+ handleChange({ data, $event }) {
135
+ if (data.hex) {
136
+ if (isValidHex(data.hex)) {
137
+ this.onChange.emit({
138
+ data: {
139
+ hex: data.hex,
140
+ source: 'hex',
141
+ },
142
+ $event,
143
+ });
144
+ }
145
+ }
146
+ else {
147
+ this.onChange.emit({
148
+ data: {
149
+ r: data.r || this.rgb.r,
150
+ g: data.g || this.rgb.g,
151
+ b: data.b || this.rgb.b,
152
+ source: 'rgb',
153
+ },
154
+ $event,
155
+ });
156
+ }
157
+ }
158
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: CompactFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
159
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: CompactFieldsComponent, isStandalone: false, selector: "color-compact-fields", inputs: { hex: "hex", rgb: "rgb" }, outputs: { onChange: "onChange" }, ngImport: i0, template: `
160
+ <div class="compact-fields">
161
+ <div class="compact-active" [style.background]="hex"></div>
162
+ <div style="flex: 6 1 0%;">
163
+ <color-editable-input
164
+ [style]="{ wrap: HEXWrap, input: HEXinput, label: HEXlabel }"
165
+ label="hex"
166
+ [value]="hex"
167
+ (onChange)="handleChange($event)"
168
+ ></color-editable-input>
169
+ </div>
170
+ <div style="flex: 3 1 0%">
171
+ <color-editable-input
172
+ [style]="{ wrap: RGBwrap, input: RGBinput, label: RGBlabel }"
173
+ label="r"
174
+ [value]="rgb.r"
175
+ (onChange)="handleChange($event)"
176
+ ></color-editable-input>
177
+ </div>
178
+ <div style="flex: 3 1 0%">
179
+ <color-editable-input
180
+ [style]="{ wrap: RGBwrap, input: RGBinput, label: RGBlabel }"
181
+ label="g"
182
+ [value]="rgb.g"
183
+ (onChange)="handleChange($event)"
184
+ ></color-editable-input>
185
+ </div>
186
+ <div style="flex: 3 1 0%">
187
+ <color-editable-input
188
+ [style]="{ wrap: RGBwrap, input: RGBinput, label: RGBlabel }"
189
+ label="b"
190
+ [value]="rgb.b"
191
+ (onChange)="handleChange($event)"
192
+ ></color-editable-input>
193
+ </div>
194
+ </div>
195
+ `, isInline: true, styles: [".compact-fields{display:flex;padding-bottom:6px;padding-right:5px;position:relative}.compact-active{position:absolute;top:6px;left:5px;height:9px;width:9px}\n"], dependencies: [{ kind: "component", type: i1.EditableInputComponent, selector: "color-editable-input", inputs: ["style", "label", "value", "arrowOffset", "dragLabel", "dragMax", "placeholder"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
196
+ }
197
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: CompactFieldsComponent, decorators: [{
198
+ type: Component,
199
+ args: [{ selector: 'color-compact-fields', template: `
200
+ <div class="compact-fields">
201
+ <div class="compact-active" [style.background]="hex"></div>
202
+ <div style="flex: 6 1 0%;">
203
+ <color-editable-input
204
+ [style]="{ wrap: HEXWrap, input: HEXinput, label: HEXlabel }"
205
+ label="hex"
206
+ [value]="hex"
207
+ (onChange)="handleChange($event)"
208
+ ></color-editable-input>
209
+ </div>
210
+ <div style="flex: 3 1 0%">
211
+ <color-editable-input
212
+ [style]="{ wrap: RGBwrap, input: RGBinput, label: RGBlabel }"
213
+ label="r"
214
+ [value]="rgb.r"
215
+ (onChange)="handleChange($event)"
216
+ ></color-editable-input>
217
+ </div>
218
+ <div style="flex: 3 1 0%">
219
+ <color-editable-input
220
+ [style]="{ wrap: RGBwrap, input: RGBinput, label: RGBlabel }"
221
+ label="g"
222
+ [value]="rgb.g"
223
+ (onChange)="handleChange($event)"
224
+ ></color-editable-input>
225
+ </div>
226
+ <div style="flex: 3 1 0%">
227
+ <color-editable-input
228
+ [style]="{ wrap: RGBwrap, input: RGBinput, label: RGBlabel }"
229
+ label="b"
230
+ [value]="rgb.b"
231
+ (onChange)="handleChange($event)"
232
+ ></color-editable-input>
233
+ </div>
234
+ </div>
235
+ `, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, standalone: false, styles: [".compact-fields{display:flex;padding-bottom:6px;padding-right:5px;position:relative}.compact-active{position:absolute;top:6px;left:5px;height:9px;width:9px}\n"] }]
236
+ }], propDecorators: { hex: [{
237
+ type: Input
238
+ }], rgb: [{
239
+ type: Input
240
+ }], onChange: [{
241
+ type: Output
242
+ }] } });
243
+
244
+ class CompactComponent extends ColorWrap {
245
+ /** Color squares to display */
246
+ colors = [
247
+ '#4D4D4D',
248
+ '#999999',
249
+ '#FFFFFF',
250
+ '#F44E3B',
251
+ '#FE9200',
252
+ '#FCDC00',
253
+ '#DBDF00',
254
+ '#A4DD00',
255
+ '#68CCCA',
256
+ '#73D8FF',
257
+ '#AEA1FF',
258
+ '#FDA1FF',
259
+ '#333333',
260
+ '#808080',
261
+ '#cccccc',
262
+ '#D33115',
263
+ '#E27300',
264
+ '#FCC400',
265
+ '#B0BC00',
266
+ '#68BC00',
267
+ '#16A5A5',
268
+ '#009CE0',
269
+ '#7B64FF',
270
+ '#FA28FF',
271
+ '#000000',
272
+ '#666666',
273
+ '#B3B3B3',
274
+ '#9F0500',
275
+ '#C45100',
276
+ '#FB9E00',
277
+ '#808900',
278
+ '#194D33',
279
+ '#0C797D',
280
+ '#0062B1',
281
+ '#653294',
282
+ '#AB149E',
283
+ ];
284
+ zDepth = 1;
285
+ radius = 1;
286
+ background = '#fff';
287
+ disableAlpha = true;
288
+ constructor() {
289
+ super();
290
+ }
291
+ handleBlockChange({ hex, $event }) {
292
+ if (isValidHex(hex)) {
293
+ this.handleChange({ hex, source: 'hex' }, $event);
294
+ }
295
+ }
296
+ handleValueChange({ data, $event }) {
297
+ this.handleChange(data, $event);
298
+ }
299
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: CompactComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
300
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.3", type: CompactComponent, isStandalone: false, selector: "color-compact", inputs: { colors: "colors", zDepth: "zDepth", radius: "radius", background: "background" }, providers: [
301
+ {
302
+ provide: NG_VALUE_ACCESSOR,
303
+ useExisting: forwardRef(() => CompactComponent),
304
+ multi: true,
305
+ },
306
+ {
307
+ provide: ColorWrap,
308
+ useExisting: forwardRef(() => CompactComponent),
309
+ },
310
+ ], usesInheritance: true, ngImport: i0, template: `
311
+ <color-raised
312
+ class="color-compact"
313
+ [zDepth]="zDepth"
314
+ [background]="background"
315
+ [radius]="radius"
316
+ >
317
+ <div class="compact-picker {{ className }}">
318
+ <div>
319
+ @for (color of colors; track color) {
320
+ <color-compact-color
321
+ [color]="color"
322
+ [active]="color.toLowerCase() === hex.toLowerCase()"
323
+ (onClick)="handleBlockChange($event)"
324
+ ></color-compact-color>
325
+ }
326
+ <div class="compact-clear"></div>
327
+ </div>
328
+ <color-compact-fields
329
+ [hex]="hex"
330
+ [rgb]="rgb"
331
+ (onChange)="handleValueChange($event)"
332
+ ></color-compact-fields>
333
+ </div>
334
+ </color-raised>
335
+ `, isInline: true, styles: [".color-compact{background:#f6f6f6;radius:4px}.compact-picker{padding-top:5px;padding-left:5px;box-sizing:border-box;width:245px}.compact-clear{clear:both}\n"], dependencies: [{ kind: "component", type: i0.forwardRef(() => i1.RaisedComponent), selector: "color-raised", inputs: ["zDepth", "radius", "background"] }, { kind: "component", type: i0.forwardRef(() => CompactColorComponent), selector: "color-compact-color", inputs: ["color", "active"], outputs: ["onClick", "onSwatchHover"] }, { kind: "component", type: i0.forwardRef(() => CompactFieldsComponent), selector: "color-compact-fields", inputs: ["hex", "rgb"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
336
+ }
337
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: CompactComponent, decorators: [{
338
+ type: Component,
339
+ args: [{ selector: 'color-compact', template: `
340
+ <color-raised
341
+ class="color-compact"
342
+ [zDepth]="zDepth"
343
+ [background]="background"
344
+ [radius]="radius"
345
+ >
346
+ <div class="compact-picker {{ className }}">
347
+ <div>
348
+ @for (color of colors; track color) {
349
+ <color-compact-color
350
+ [color]="color"
351
+ [active]="color.toLowerCase() === hex.toLowerCase()"
352
+ (onClick)="handleBlockChange($event)"
353
+ ></color-compact-color>
354
+ }
355
+ <div class="compact-clear"></div>
356
+ </div>
357
+ <color-compact-fields
358
+ [hex]="hex"
359
+ [rgb]="rgb"
360
+ (onChange)="handleValueChange($event)"
361
+ ></color-compact-fields>
362
+ </div>
363
+ </color-raised>
364
+ `, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, providers: [
365
+ {
366
+ provide: NG_VALUE_ACCESSOR,
367
+ useExisting: forwardRef(() => CompactComponent),
368
+ multi: true,
369
+ },
370
+ {
371
+ provide: ColorWrap,
372
+ useExisting: forwardRef(() => CompactComponent),
373
+ },
374
+ ], standalone: false, styles: [".color-compact{background:#f6f6f6;radius:4px}.compact-picker{padding-top:5px;padding-left:5px;box-sizing:border-box;width:245px}.compact-clear{clear:both}\n"] }]
375
+ }], ctorParameters: () => [], propDecorators: { colors: [{
376
+ type: Input
377
+ }], zDepth: [{
378
+ type: Input
379
+ }], radius: [{
380
+ type: Input
381
+ }], background: [{
382
+ type: Input
383
+ }] } });
384
+ class ColorCompactModule {
385
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: ColorCompactModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
386
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.3", ngImport: i0, type: ColorCompactModule, declarations: [CompactComponent, CompactColorComponent, CompactFieldsComponent], imports: [CommonModule, EditableInputModule, SwatchModule, RaisedModule], exports: [CompactComponent, CompactColorComponent, CompactFieldsComponent] });
387
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: ColorCompactModule, imports: [CommonModule, EditableInputModule, SwatchModule, RaisedModule] });
388
+ }
389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: ColorCompactModule, decorators: [{
390
+ type: NgModule,
391
+ args: [{
392
+ declarations: [CompactComponent, CompactColorComponent, CompactFieldsComponent],
393
+ exports: [CompactComponent, CompactColorComponent, CompactFieldsComponent],
394
+ imports: [CommonModule, EditableInputModule, SwatchModule, RaisedModule],
395
+ }]
396
+ }] });
397
+
398
+ /**
399
+ * Generated bundle index. Do not edit.
400
+ */
401
+
402
+ export { ColorCompactModule, CompactColorComponent, CompactComponent, CompactFieldsComponent };
403
+ //# sourceMappingURL=ngx-color-compact.mjs.map