@libs-ui/components-color-picker 0.1.1-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,689 @@
1
+ import * as i0 from '@angular/core';
2
+ import { signal, inject, input, output, viewChild, effect, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { LibsUiComponentsInputsInputComponent } from '@libs-ui/components-inputs-input';
4
+ import { LibsUiComponentsInputsValidComponent } from '@libs-ui/components-inputs-valid';
5
+ import { LibsUiNotificationService } from '@libs-ui/services-notification';
6
+ import { get, isNil, set, getDragEventByElement } from '@libs-ui/utils';
7
+ import { Subject } from 'rxjs';
8
+
9
+ /* eslint-disable @typescript-eslint/no-explicit-any */
10
+ const ColorNames = {
11
+ aliceblue: '#F0F8FF',
12
+ antiquewhite: '#FAEBD7',
13
+ aqua: '#00FFFF',
14
+ aquamarine: '#7FFFD4',
15
+ azure: '#F0FFFF',
16
+ beige: '#F5F5DC',
17
+ bisque: '#FFE4C4',
18
+ black: '#000000',
19
+ blanchedalmond: '#FFEBCD',
20
+ blue: '#0000FF',
21
+ blueviolet: '#8A2BE2',
22
+ brown: '#A52A2A',
23
+ burlywood: '#DEB887',
24
+ cadetblue: '#5F9EA0',
25
+ chartreuse: '#7FFF00',
26
+ chocolate: '#D2691E',
27
+ coral: '#FF7F50',
28
+ cornflowerblue: '#6495ED',
29
+ cornsilk: '#FFF8DC',
30
+ crimson: '#DC143C',
31
+ cyan: '#00FFFF',
32
+ darkblue: '#00008B',
33
+ darkcyan: '#008B8B',
34
+ darkgoldenrod: '#B8860B',
35
+ darkgray: '#A9A9A9',
36
+ darkgrey: '#A9A9A9',
37
+ darkgreen: '#006400',
38
+ darkkhaki: '#BDB76B',
39
+ darkmagenta: '#8B008B',
40
+ darkolivegreen: '#556B2F',
41
+ darkorange: '#FF8C00',
42
+ darkorchid: '#9932CC',
43
+ darkred: '#8B0000',
44
+ darksalmon: '#E9967A',
45
+ darkseagreen: '#8FBC8F',
46
+ darkslateblue: '#483D8B',
47
+ darkslategray: '#2F4F4F',
48
+ darkslategrey: '#2F4F4F',
49
+ darkturquoise: '#00CED1',
50
+ darkviolet: '#9400D3',
51
+ deeppink: '#FF1493',
52
+ deepskyblue: '#00BFFF',
53
+ dimgray: '#696969',
54
+ dimgrey: '#696969',
55
+ dodgerblue: '#1E90FF',
56
+ firebrick: '#B22222',
57
+ floralwhite: '#FFFAF0',
58
+ forestgreen: '#228B22',
59
+ fuchsia: '#FF00FF',
60
+ gainsboro: '#DCDCDC',
61
+ ghostwhite: '#F8F8FF',
62
+ gold: '#FFD700',
63
+ goldenrod: '#DAA520',
64
+ gray: '#808080',
65
+ grey: '#808080',
66
+ green: '#008000',
67
+ greenyellow: '#ADFF2F',
68
+ honeydew: '#F0FFF0',
69
+ hotpink: '#FF69B4',
70
+ indianred: '#CD5C5C',
71
+ indigo: '#4B0082',
72
+ ivory: '#FFFFF0',
73
+ khaki: '#F0E68C',
74
+ lavender: '#E6E6FA',
75
+ lavenderblush: '#FFF0F5',
76
+ lawngreen: '#7CFC00',
77
+ lemonchiffon: '#FFFACD',
78
+ lightblue: '#ADD8E6',
79
+ lightcoral: '#F08080',
80
+ lightcyan: '#E0FFFF',
81
+ lightgoldenrodyellow: '#FAFAD2',
82
+ lightgray: '#D3D3D3',
83
+ lightgrey: '#D3D3D3',
84
+ lightgreen: '#90EE90',
85
+ lightpink: '#FFB6C1',
86
+ lightsalmon: '#FFA07A',
87
+ lightseagreen: '#20B2AA',
88
+ lightskyblue: '#87CEFA',
89
+ lightslategray: '#778899',
90
+ lightslategrey: '#778899',
91
+ lightsteelblue: '#B0C4DE',
92
+ lightyellow: '#FFFFE0',
93
+ lime: '#00FF00',
94
+ limegreen: '#32CD32',
95
+ linen: '#FAF0E6',
96
+ magenta: '#FF00FF',
97
+ maroon: '#800000',
98
+ mediumaquamarine: '#66CDAA',
99
+ mediumblue: '#0000CD',
100
+ mediumorchid: '#BA55D3',
101
+ mediumpurple: '#9370DB',
102
+ mediumseagreen: '#3CB371',
103
+ mediumslateblue: '#7B68EE',
104
+ mediumspringgreen: '#00FA9A',
105
+ mediumturquoise: '#48D1CC',
106
+ mediumvioletred: '#C71585',
107
+ midnightblue: '#191970',
108
+ mintcream: '#F5FFFA',
109
+ mistyrose: '#FFE4E1',
110
+ moccasin: '#FFE4B5',
111
+ navajowhite: '#FFDEAD',
112
+ navy: '#000080',
113
+ oldlace: '#FDF5E6',
114
+ olive: '#808000',
115
+ olivedrab: '#6B8E23',
116
+ orange: '#FFA500',
117
+ orangered: '#FF4500',
118
+ orchid: '#DA70D6',
119
+ palegoldenrod: '#EEE8AA',
120
+ palegreen: '#98FB98',
121
+ paleturquoise: '#AFEEEE',
122
+ palevioletred: '#DB7093',
123
+ papayawhip: '#FFEFD5',
124
+ peachpuff: '#FFDAB9',
125
+ peru: '#CD853F',
126
+ pink: '#FFC0CB',
127
+ plum: '#DDA0DD',
128
+ powderblue: '#B0E0E6',
129
+ purple: '#800080',
130
+ rebeccapurple: '#663399',
131
+ red: '#FF0000',
132
+ rosybrown: '#BC8F8F',
133
+ royalblue: '#4169E1',
134
+ saddlebrown: '#8B4513',
135
+ salmon: '#FA8072',
136
+ sandybrown: '#F4A460',
137
+ seagreen: '#2E8B57',
138
+ seashell: '#FFF5EE',
139
+ sienna: '#A0522D',
140
+ silver: '#C0C0C0',
141
+ skyblue: '#87CEEB',
142
+ slateblue: '#6A5ACD',
143
+ slategray: '#708090',
144
+ slategrey: '#708090',
145
+ snow: '#FFFAFA',
146
+ springgreen: '#00FF7F',
147
+ steelblue: '#4682B4',
148
+ tan: '#D2B48C',
149
+ teal: '#008080',
150
+ thistle: '#D8BFD8',
151
+ tomato: '#FF6347',
152
+ turquoise: '#40E0D0',
153
+ violet: '#EE82EE',
154
+ wheat: '#F5DEB3',
155
+ white: '#FFFFFF',
156
+ whitesmoke: '#F5F5F5',
157
+ yellow: '#FFFF00',
158
+ yellowgreen: '#9ACD32',
159
+ };
160
+ const optionsDefault = () => {
161
+ return {
162
+ showHsl: false,
163
+ showRgb: true,
164
+ showHex: true,
165
+ showAlpha: false,
166
+ color: '#ff0000',
167
+ format: 'color',
168
+ slBarSize: [420, 200],
169
+ hueBarSize: [420, 20],
170
+ alphaBarSize: [420, 20],
171
+ };
172
+ };
173
+ const limit = (value, min, max) => {
174
+ value = +value;
175
+ return isNaN(value) ? min : value < min ? min : value > max ? max : value;
176
+ };
177
+ const hslToRgb = (h, s, l) => {
178
+ let r, g, b;
179
+ [h, s, l] = [limit(h, 0, 360) / 360, limit(s, 0, 100) / 100, limit(l, 0, 100) / 100];
180
+ if (s == 0) {
181
+ r = g = b = l; // achromatic
182
+ return [r * 255, g * 255, b * 255].map(Math.round);
183
+ }
184
+ const hueToRgb = (p, q, t) => {
185
+ if (t < 0)
186
+ t += 1;
187
+ if (t > 1)
188
+ t -= 1;
189
+ if (t < 1 / 6)
190
+ return p + (q - p) * 6 * t;
191
+ if (t < 1 / 2)
192
+ return q;
193
+ if (t < 2 / 3)
194
+ return p + (q - p) * (2 / 3 - t) * 6;
195
+ return p;
196
+ };
197
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
198
+ const p = 2 * l - q;
199
+ r = hueToRgb(p, q, h + 1 / 3);
200
+ g = hueToRgb(p, q, h);
201
+ b = hueToRgb(p, q, h - 1 / 3);
202
+ return [r * 255, g * 255, b * 255].map(Math.round);
203
+ };
204
+ const cssColorToRgba = (color) => {
205
+ if (color) {
206
+ const colorByName = get(ColorNames, color.toLowerCase());
207
+ const [, , , r, g, b, a, , rr, gg, bb, aa] = /^\s*#?((([0-9A-F])([0-9A-F])([0-9A-F])([0-9A-F])?)|(([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})?))\s*$/i.exec(colorByName || color) || [];
208
+ if (!isNil(r)) {
209
+ return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), a ? +(parseInt(a + a, 16) / 255).toFixed(2) : 1];
210
+ }
211
+ if (!isNil(rr)) {
212
+ return [parseInt(rr, 16), parseInt(gg, 16), parseInt(bb, 16), aa ? +(parseInt(aa, 16) / 255).toFixed(2) : 1];
213
+ }
214
+ }
215
+ return undefined;
216
+ };
217
+ const parseColorToRgba = (color) => {
218
+ if (Array.isArray(color)) {
219
+ return [limit(color[0], 0, 255), limit(color[1], 0, 255), limit(color[2], 0, 255), limit(color[3] ?? 1, 0, 1)];
220
+ }
221
+ const parsed = cssColorToRgba(color) || cssRgbaToRgba(color);
222
+ if (parsed && parsed.length === 3) {
223
+ parsed.push(1);
224
+ }
225
+ return parsed;
226
+ };
227
+ const cssRgbaToRgba = (rgba) => {
228
+ if (rgba) {
229
+ const [m, r, g, b, , a] = /^rgba?\((\d+)\s*[\s,]\s*(\d+)\s*[\s,]\s*(\d+)(\s*[\s,]\s*(\d*(.\d+)?))?\)/i.exec(rgba) || [];
230
+ return m ? [limit(r, 0, 255), limit(g, 0, 255), limit(b, 0, 255), limit(a ?? 1, 0, 1)] : undefined;
231
+ }
232
+ return undefined;
233
+ };
234
+ const cssHslaToHsla = (hsla) => {
235
+ if (hsla) {
236
+ const [m, h, s, l, , a] = /^hsla?\((\d+)\s*[\s,]\s*(\d+)\s*[\s,]\s*(\d+)(\s*[\s,]\s*(\d*(.\d+)?))?\)/i.exec(hsla) || [];
237
+ return m ? [limit(h, 0, 255), limit(s, 0, 255), limit(l, 0, 255), limit(a ?? 1, 0, 1)] : undefined;
238
+ }
239
+ return undefined;
240
+ };
241
+ const parseColorToHsla = (color) => {
242
+ if (Array.isArray(color)) {
243
+ return [limit(color[0], 0, 360), limit(color[1], 0, 100), limit(color[2], 0, 100), limit(color[3] ?? 1, 0, 1)];
244
+ }
245
+ const parsed = cssHslaToHsla(color);
246
+ if (parsed && parsed.length === 3) {
247
+ parsed.push(1);
248
+ }
249
+ return parsed;
250
+ };
251
+ const rgbToHsl = (r, g, b) => {
252
+ [r, g, b] = [limit(r, 0, 255) / 255, limit(g, 0, 255) / 255, limit(b, 0, 255) / 255];
253
+ const max = Math.max(r, g, b);
254
+ const min = Math.min(r, g, b);
255
+ let h, s = (max + min) / 2;
256
+ const l = (max + min) / 2;
257
+ if (max == min) {
258
+ h = s = 0; // achromatic
259
+ return [h * 360, s * 100, l * 100].map(Math.round);
260
+ }
261
+ const d = max - min;
262
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
263
+ switch (max) {
264
+ case r:
265
+ h = (g - b) / d + (g < b ? 6 : 0);
266
+ break;
267
+ case g:
268
+ h = (b - r) / d + 2;
269
+ break;
270
+ case b:
271
+ h = (r - g) / d + 4;
272
+ break;
273
+ }
274
+ h = (h || 0) / 6;
275
+ return [h * 360, s * 100, l * 100].map(Math.round);
276
+ };
277
+ const rgbToHex = (r, g, b) => {
278
+ [r, g, b] = [limit(r, 0, 255), limit(g, 0, 255), limit(b, 0, 255)];
279
+ return '#' + ('000000' + ((r << 16) | (g << 8) | b).toString(16)).slice(-6);
280
+ };
281
+ const rgbToInt = (r, g, b) => {
282
+ return (r << 16) | (g << 8) | b;
283
+ };
284
+ const rgbToHsv = (r, g, b) => {
285
+ [r, g, b] = [limit(r, 0, 255) / 255, limit(g, 0, 255) / 255, limit(b, 0, 255) / 255];
286
+ const max = Math.max(r, g, b);
287
+ const min = Math.min(r, g, b);
288
+ let h, s = max;
289
+ const v = max;
290
+ const d = max - min;
291
+ s = max === 0 ? 0 : d / max;
292
+ if (max == min) {
293
+ h = 0;
294
+ return [h, s, v];
295
+ }
296
+ switch (max) {
297
+ case r:
298
+ h = (g - b) / d + (g < b ? 6 : 0);
299
+ break;
300
+ case g:
301
+ h = (b - r) / d + 2;
302
+ break;
303
+ case b:
304
+ h = (r - g) / d + 4;
305
+ break;
306
+ }
307
+ h = (h || 0) / 6;
308
+ return [h, s, v];
309
+ };
310
+ const formatColor = (data, format) => {
311
+ switch (format) {
312
+ case 'rgb':
313
+ default:
314
+ return data.slice(0, 3);
315
+ case 'rgbcss':
316
+ return `rgb(${data[0]}, ${data[1]}, ${data[2]})`;
317
+ case 'rgbcss4':
318
+ return `rgb(${data[0]}, ${data[1]}, ${data[2]}, ${data[3]})`;
319
+ case 'rgba':
320
+ return data;
321
+ case 'rgbacss':
322
+ return `rgba(${data[0]}, ${data[1]}, ${data[2]}, ${data[3]})`;
323
+ case 'hsl':
324
+ return rgbToHsl(data[0], data[1], data[2]);
325
+ case 'hslcss':
326
+ data = rgbToHsl(data[0], data[1], data[2]);
327
+ return `hsl(${data[0]}, ${data[1]}, ${data[2]})`;
328
+ case 'hslcss4': {
329
+ const hh = rgbToHsl(data[0], data[1], data[2]);
330
+ return `hsl(${hh[0]}, ${hh[1]}, ${hh[2]}, ${data[3]})`;
331
+ }
332
+ case 'hsla':
333
+ return [...rgbToHsl(data[0], data[1], data[2]), data[3]];
334
+ case 'hslacss': {
335
+ const ha = rgbToHsl(data[0], data[1], data[2]);
336
+ return `hsla(${ha[0]}, ${ha[1]}, ${ha[2]}, ${data[3]})`;
337
+ }
338
+ case 'hex':
339
+ return rgbToHex(data[0], data[1], data[2]);
340
+ case 'hexcss4':
341
+ return rgbToHex(data[0], data[1], data[2]) + ('00' + parseInt((data[3] * 255).toString()).toString(16)).slice(-2);
342
+ case 'int':
343
+ return rgbToInt(data[0], data[1], data[2]);
344
+ }
345
+ };
346
+ const parseColor = (color, format) => {
347
+ if (!isNil(color)) {
348
+ let data = [];
349
+ data = parseColorToRgba(color) || (parseColorToHsla(color) && [...hslToRgb(data[0], data[1], data[2]), data[3]]);
350
+ if (data) {
351
+ if (typeof format === 'object') {
352
+ return ['rgb', 'rgbcss', 'rgbcss4', 'rgba', 'rgbacss', 'hsl', 'hslcss', 'hslcss4', 'hsla', 'hslacss', 'hex', 'hexcss4', 'int'].reduce((m, f) => {
353
+ set(m, f, formatColor(data, f));
354
+ return m;
355
+ }, format);
356
+ }
357
+ return formatColor(data, format);
358
+ }
359
+ }
360
+ return undefined;
361
+ };
362
+ const defaultHelper = () => {
363
+ return {
364
+ setHue: () => {
365
+ return;
366
+ },
367
+ grabColor: () => [],
368
+ findColor: () => [],
369
+ };
370
+ };
371
+
372
+ class LibsUiComponentsColorPickerComponent {
373
+ // #region PROPERTY
374
+ options = signal(optionsDefault());
375
+ focus = signal(undefined);
376
+ hex = signal('');
377
+ s = signal(0);
378
+ h = signal(0);
379
+ l = signal(0);
380
+ r = signal(0);
381
+ g = signal(0);
382
+ b = signal(0);
383
+ a = signal(1);
384
+ slBarHelper = signal(defaultHelper());
385
+ notificationService = inject(LibsUiNotificationService);
386
+ onDestroy = new Subject();
387
+ // #region INPUT
388
+ customOptions = input();
389
+ noEmitEventColorWhenInitComponent = input(true, { transform: (value) => value ?? true });
390
+ // #region OUTPUT
391
+ outColorChange = output();
392
+ outColorChangeMultipleType = output();
393
+ /* VIEW CHILD */
394
+ hueEl = viewChild('hueEl');
395
+ huePointerEl = viewChild('huePointerEl');
396
+ slEl = viewChild('slEl');
397
+ slPointerEl = viewChild('slPointerEl');
398
+ alphaEl = viewChild('alphaEl');
399
+ alphaPointerEl = viewChild('alphaPointerEl');
400
+ previewEl = viewChild('previewEl');
401
+ constructor() {
402
+ effect(() => {
403
+ const ctx = this.alphaEl()?.nativeElement.getContext('2d');
404
+ if (!ctx) {
405
+ return;
406
+ }
407
+ ctx.clearRect(0, 0, this.options().alphaBarSize[0], this.options().alphaBarSize[1]);
408
+ const gradient = ctx.createLinearGradient(0, 0, this.alphaEl()?.nativeElement.width - 1, 0);
409
+ gradient.addColorStop(0, `hsla(${this.h()},${this.s()}%,${this.l()}%, 0)`);
410
+ gradient.addColorStop(1, `hsla(${this.h()},${this.s()}%,${this.l()}%, 1)`);
411
+ ctx.fillStyle = gradient;
412
+ ctx.fillRect(0, 0, this.options().alphaBarSize[0], this.options().alphaBarSize[1]);
413
+ });
414
+ }
415
+ /* FUNCTIONS */
416
+ ngOnInit() {
417
+ if (this.customOptions()) {
418
+ this.options.update((options) => ({ ...options, ...this.customOptions() }));
419
+ }
420
+ }
421
+ ngAfterViewInit() {
422
+ this.setupHueCanvas();
423
+ this.setupSlCanvas();
424
+ this.setupSlBarHelper();
425
+ if (this.options().showAlpha) {
426
+ this.setupAlphaCanvas();
427
+ }
428
+ this.handlerColorChange(this.options().format, this.options().color, this.noEmitEventColorWhenInitComponent());
429
+ }
430
+ setupHueCanvas() {
431
+ const canvas = this.hueEl()?.nativeElement;
432
+ canvas.width = this.options().hueBarSize[0];
433
+ canvas.height = this.options().hueBarSize[1];
434
+ const ctx = canvas.getContext('2d');
435
+ const gradient = ctx.createLinearGradient(0, 0, this.options().hueBarSize[0], 0);
436
+ const step = 1 / 360;
437
+ for (let ii = 0; ii <= 1; ii += step) {
438
+ gradient.addColorStop(ii, `hsl(${360 * ii}, 100%, 50%)`);
439
+ }
440
+ ctx.fillStyle = gradient;
441
+ ctx.fillRect(0, 0, this.options().hueBarSize[0], this.options().hueBarSize[1]);
442
+ getDragEventByElement({ elementMouseDown: canvas, isStartWithMouseDownEvent: true, onDestroy: this.onDestroy }).subscribe((event) => {
443
+ const x = limit(event.clientX - canvas.getBoundingClientRect().left, 0, this.options().hueBarSize[0]);
444
+ const hue = Math.round((x * 360) / this.options().hueBarSize[0]);
445
+ set(this.huePointerEl()?.nativeElement.style, 'left', `${x - 7}px`);
446
+ this.h.set(hue);
447
+ this.handlerColorChange('h', hue);
448
+ });
449
+ }
450
+ setupSlCanvas() {
451
+ const canvas = this.slEl()?.nativeElement;
452
+ canvas.width = this.options().slBarSize[0];
453
+ canvas.height = this.options().slBarSize[1];
454
+ getDragEventByElement({ elementMouseDown: canvas, isStartWithMouseDownEvent: true, onDestroy: this.onDestroy }).subscribe((event) => {
455
+ const x = limit(event.clientX - canvas.getBoundingClientRect().left, 0, this.options().slBarSize[0] - 1);
456
+ const y = limit(event.clientY - canvas.getBoundingClientRect().top, 0, this.options().slBarSize[1] - 1);
457
+ const c = this.slBarHelper().grabColor(x, y);
458
+ set(this.slPointerEl()?.nativeElement.style, 'left', `${x - 7}px`);
459
+ set(this.slPointerEl()?.nativeElement.style, 'top', `${y - 7}px`);
460
+ this.handlerColorChange('rgb', c);
461
+ });
462
+ }
463
+ setupSlBarHelper() {
464
+ const canvas = this.slEl()?.nativeElement;
465
+ const ctx = canvas.getContext('2d');
466
+ const width = +canvas.width;
467
+ const height = +canvas.height;
468
+ const whiteBlackGradient = ctx.createLinearGradient(1, 1, 1, height - 1);
469
+ whiteBlackGradient.addColorStop(0, 'white');
470
+ whiteBlackGradient.addColorStop(1, 'black');
471
+ this.slBarHelper.set({
472
+ setHue: (hue) => {
473
+ const colorGradient = ctx.createLinearGradient(1, 0, width - 1, 0);
474
+ colorGradient.addColorStop(0, `hsla(${hue}, 100%, 50%, 0)`);
475
+ colorGradient.addColorStop(1, `hsla(${hue}, 100%, 50%, 1)`);
476
+ ctx.fillStyle = whiteBlackGradient;
477
+ ctx.fillRect(0, 0, width, height);
478
+ ctx.fillStyle = colorGradient;
479
+ ctx.globalCompositeOperation = 'multiply';
480
+ ctx.fillRect(0, 0, width, height);
481
+ ctx.globalCompositeOperation = 'source-over';
482
+ },
483
+ grabColor: (x, y) => ctx.getImageData(x, y, 1, 1).data,
484
+ findColor: (r, g, b) => {
485
+ const [, s, v] = rgbToHsv(r, g, b);
486
+ const x = s * width;
487
+ const y = height - v * height;
488
+ return [x, y];
489
+ },
490
+ });
491
+ }
492
+ setupAlphaCanvas() {
493
+ const canvas = this.alphaEl()?.nativeElement;
494
+ canvas.width = this.options().alphaBarSize[0];
495
+ canvas.height = this.options().alphaBarSize[1];
496
+ const ctx = canvas.getContext('2d');
497
+ const gradient = ctx.createLinearGradient(0, 0, canvas.width - 1, 0);
498
+ gradient.addColorStop(0, `hsla(${this.h()},${this.s()}%,${this.l()}%, 0)`);
499
+ gradient.addColorStop(1, `hsla(${this.h()},${this.s()}%,${this.l()}%, 1)`);
500
+ ctx.fillStyle = gradient;
501
+ ctx.fillRect(0, 0, this.options().alphaBarSize[0], this.options().alphaBarSize[1]);
502
+ getDragEventByElement({ elementMouseDown: canvas, isStartWithMouseDownEvent: true, onDestroy: this.onDestroy }).subscribe((event) => {
503
+ const x = limit(event.clientX - canvas.getBoundingClientRect().left, 0, this.options().alphaBarSize[0]);
504
+ const alpha = +(x / this.options().alphaBarSize[0]).toFixed(2);
505
+ set(this.alphaPointerEl()?.nativeElement.style, 'left', `${x - 7}px`);
506
+ this.handlerColorChange('alpha', alpha);
507
+ });
508
+ }
509
+ handlerCopyColor(event) {
510
+ event.stopPropagation();
511
+ window.navigator.clipboard.writeText(this.hex());
512
+ // this.notificationService.showCompTypeTextSuccess('i18n_copy_successfully');
513
+ }
514
+ updatePointerH(h) {
515
+ const x = (this.options().hueBarSize[0] * h) / 360;
516
+ set(this.huePointerEl()?.nativeElement.style, 'left', `${x - 7}px`);
517
+ }
518
+ updatePointerSl(h, s, l) {
519
+ const [r, g, b] = hslToRgb(h, s, l);
520
+ const [x, y] = this.slBarHelper().findColor(r, g, b);
521
+ if (x >= 0) {
522
+ set(this.slPointerEl()?.nativeElement.style, 'left', `${x - 7}px`);
523
+ set(this.slPointerEl()?.nativeElement.style, 'top', `${y - 7}px`);
524
+ }
525
+ }
526
+ updatePointerA(a) {
527
+ if (!this.options().showAlpha) {
528
+ return;
529
+ }
530
+ const x = this.options().alphaBarSize[0] * a;
531
+ set(this.alphaPointerEl()?.nativeElement.style, 'left', `${x - 7}px`);
532
+ }
533
+ updateHex(r, g, b, a) {
534
+ if (this.options().showAlpha) {
535
+ this.hex.set(parseColor([r, g, b, a], 'hexcss4'));
536
+ return;
537
+ }
538
+ this.hex.set(rgbToHex(r, g, b));
539
+ }
540
+ updateRgb() {
541
+ const rgb = hslToRgb(this.h(), this.s(), this.l());
542
+ this.r.set(rgb[0]);
543
+ this.g.set(rgb[1]);
544
+ this.b.set(rgb[2]);
545
+ }
546
+ updateHsl() {
547
+ const hsl = rgbToHsl(this.r(), this.g(), this.b());
548
+ this.h.set(hsl[0]);
549
+ this.s.set(hsl[1]);
550
+ this.l.set(hsl[2]);
551
+ }
552
+ updateValuesAndPointer(config) {
553
+ if (config.rgb) {
554
+ this.updateRgb();
555
+ }
556
+ if (config.hsl) {
557
+ this.updateHsl();
558
+ }
559
+ if (config.hue) {
560
+ this.slBarHelper().setHue(this.h());
561
+ }
562
+ if (config.hPoint) {
563
+ this.updatePointerH(this.h());
564
+ }
565
+ if (config.slPoint) {
566
+ this.updatePointerSl(this.h(), this.s(), this.l());
567
+ }
568
+ if (config.hex) {
569
+ this.updateHex(this.r(), this.g(), this.b(), this.a());
570
+ }
571
+ if (config.aPoint) {
572
+ this.updatePointerA(this.a());
573
+ }
574
+ }
575
+ handlerColorChange(key, value, isCallInitComponent = false) {
576
+ let config = {};
577
+ switch (key) {
578
+ case 'h':
579
+ config = { hPoint: true, hex: true, rgb: true, hue: true };
580
+ break;
581
+ case 's':
582
+ config = { slPoint: true, hex: true, rgb: true };
583
+ break;
584
+ case 'l':
585
+ config = { slPoint: true, hex: true, rgb: true };
586
+ break;
587
+ case 'r':
588
+ config = { hPoint: true, slPoint: true, hex: true, hsl: true, hue: true };
589
+ break;
590
+ case 'g':
591
+ config = { hPoint: true, slPoint: true, hex: true, hsl: true, hue: true };
592
+ break;
593
+ case 'b':
594
+ config = { hPoint: true, slPoint: true, hex: true, hsl: true, hue: true };
595
+ break;
596
+ case 'rgb':
597
+ this.r.set(value[0]);
598
+ this.g.set(value[1]);
599
+ this.b.set(value[2]);
600
+ config = { hex: true, hsl: true };
601
+ break;
602
+ case 'rgba':
603
+ this.r.set(value[0]);
604
+ this.g.set(value[1]);
605
+ this.b.set(value[2]);
606
+ this.a.set(value[3]);
607
+ config = { hPoint: true, slPoint: true, hex: true, aPoint: true, hsl: true, hue: true };
608
+ break;
609
+ case 'hsl':
610
+ this.h.set(value[0]);
611
+ this.s.set(value[1]);
612
+ this.l.set(value[2]);
613
+ config = { hPoint: true, slPoint: true, hex: true, aPoint: true, rgb: true, hue: true };
614
+ break;
615
+ case 'hsla':
616
+ this.h.set(value[0]);
617
+ this.s.set(value[1]);
618
+ this.l.set(value[2]);
619
+ this.a.set(value[3]);
620
+ config = { hPoint: true, slPoint: true, hex: true, aPoint: true, rgb: true, hue: true };
621
+ break;
622
+ case 'hex': {
623
+ const rgba = cssColorToRgba(value) || [this.r(), this.g(), this.b(), this.a()];
624
+ this.r.set(rgba[0]);
625
+ this.g.set(rgba[1]);
626
+ this.b.set(rgba[2]);
627
+ this.a.set(rgba[3]);
628
+ config = { hPoint: true, slPoint: true, aPoint: true, hsl: true, hue: true };
629
+ break;
630
+ }
631
+ case 'color': {
632
+ const rgba = (parseColor(value, 'rgba') || [0, 0, 0, 1]);
633
+ this.r.set(rgba[0]);
634
+ this.g.set(rgba[1]);
635
+ this.b.set(rgba[2]);
636
+ this.a.set(rgba[3]);
637
+ config = { hPoint: true, slPoint: true, hex: true, aPoint: true, hsl: true, hue: true };
638
+ break;
639
+ }
640
+ case 'alpha':
641
+ this.a.set(value);
642
+ this.updateHex(this.r(), this.g(), this.b(), this.a());
643
+ break;
644
+ }
645
+ this.updateValuesAndPointer(config);
646
+ set(this.previewEl()?.nativeElement.style, 'backgroundColor', this.a() === 1 ? `rgb(${this.r()},${this.g()},${this.b()})` : `rgba(${this.r()},${this.g()},${this.b()},${this.a()})`);
647
+ if (!isCallInitComponent) {
648
+ this.outColorChange.emit(this.hex());
649
+ this.outColorChangeMultipleType.emit({
650
+ hex: this.hex(),
651
+ rgba: `rgba(${this.r()},${this.g()},${this.b()},${this.a()})`,
652
+ rgb: `rgb(${this.r()},${this.g()},${this.b()})`,
653
+ hsl: `hsl(${this.h()},${this.s()},${this.l()})`,
654
+ hsla: `hsla(${this.h()},${this.s()},${this.l()},${this.a()})`,
655
+ });
656
+ }
657
+ }
658
+ handlerFocusAndBlur(event, key) {
659
+ this.focus.set(event.name === 'blur' ? undefined : key);
660
+ }
661
+ handlerValueChange(event, key) {
662
+ this.handlerColorChange(key, event);
663
+ }
664
+ handlerValueChangeAlphaInput(event) {
665
+ this.handlerColorChange('alpha', (event || 0) / 100);
666
+ this.updatePointerA(this.a());
667
+ }
668
+ handlerResetColor() {
669
+ this.handlerColorChange('alpha', 0);
670
+ this.updatePointerA(this.a());
671
+ }
672
+ ngOnDestroy() {
673
+ this.onDestroy.next();
674
+ this.onDestroy.complete();
675
+ }
676
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
677
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsColorPickerComponent, isStandalone: true, selector: "libs_ui-components-color_picker", inputs: { customOptions: { classPropertyName: "customOptions", publicName: "customOptions", isSignal: true, isRequired: false, transformFunction: null }, noEmitEventColorWhenInitComponent: { classPropertyName: "noEmitEventColorWhenInitComponent", publicName: "noEmitEventColorWhenInitComponent", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { outColorChange: "outColorChange", outColorChangeMultipleType: "outColorChangeMultipleType" }, viewQueries: [{ propertyName: "hueEl", first: true, predicate: ["hueEl"], descendants: true, isSignal: true }, { propertyName: "huePointerEl", first: true, predicate: ["huePointerEl"], descendants: true, isSignal: true }, { propertyName: "slEl", first: true, predicate: ["slEl"], descendants: true, isSignal: true }, { propertyName: "slPointerEl", first: true, predicate: ["slPointerEl"], descendants: true, isSignal: true }, { propertyName: "alphaEl", first: true, predicate: ["alphaEl"], descendants: true, isSignal: true }, { propertyName: "alphaPointerEl", first: true, predicate: ["alphaPointerEl"], descendants: true, isSignal: true }, { propertyName: "previewEl", first: true, predicate: ["previewEl"], descendants: true, isSignal: true }], ngImport: i0, template: "<div>\n <div\n class=\"relative\"\n [style.width.px]=\"options().slBarSize[0]\">\n <div>\n <canvas\n #slEl\n class=\"rounded-tl-[4px] rounded-tr-[4px] libs-ui-color-picker-background-transparent\"></canvas>\n <div\n #slPointerEl\n class=\"libs-ui-color-picker-dot\"></div>\n </div>\n <div class=\"relative\">\n <canvas\n #hueEl\n class=\"libs-ui-color-picker-background-transparent\"\n [class.rounded-bl-[4px]]=\"!options().showAlpha\"\n [class.rounded-br-[4px]]=\"!options().showAlpha\"></canvas>\n <div\n #huePointerEl\n class=\"libs-ui-color-picker-dot\"></div>\n </div>\n @if (options().showAlpha) {\n <div class=\"relative\">\n <canvas\n #alphaEl\n class=\"rounded-bl-[4px] rounded-br-[4px] libs-ui-color-picker-background-transparent\"></canvas>\n <div\n #alphaPointerEl\n class=\"libs-ui-color-picker-dot\"></div>\n </div>\n }\n <div class=\"flex items-end\">\n <div class=\"text-center mr-[16px]\">\n <div class=\"libs-ui-color-picker-background-transparent rounded-[4px]\">\n <div\n #previewEl\n class=\"w-[32px] h-[32px] rounded-[4px] cursor-pointer\"\n (click)=\"handlerCopyColor($event)\"></div>\n </div>\n </div>\n @if (options().showHex) {\n <div class=\"text-center mr-[12px]\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">HEX</span>\n <div class=\"w-[88px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"hex\"\n [classInclude]=\"'text-center !p-0'\"\n (outChange)=\"handlerValueChange($event, 'hex')\" />\n </div>\n </div>\n }\n <div>\n @if (options().showHsl) {\n <div class=\"flex\">\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">H</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"h\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"360\"\n [classInclude]=\"'text-center !p-0 !rounded-tr-none !rounded-br-none ' + (focus() === 's' ? '!border-r-transparent' : '')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 'h')\"\n (outChange)=\"handlerValueChange($event, 'h')\" />\n </div>\n </div>\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">S</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"s\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"100\"\n [classInclude]=\"'text-center !p-0 !rounded-none ' + (focus() === 's' ? '' : '!border-x-transparent')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 's')\"\n (outChange)=\"handlerValueChange($event, 's')\" />\n </div>\n </div>\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">L</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"l\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"100\"\n [classInclude]=\"'text-center !p-0 !rounded-tl-none !rounded-bl-none ' + (focus() === 's' ? '!border-l-transparent' : '')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 'l')\"\n (outChange)=\"handlerValueChange($event, 'l')\" />\n </div>\n </div>\n </div>\n }\n @if (options().showRgb) {\n <div class=\"flex\">\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">R</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"r\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"255\"\n [classInclude]=\"'text-center !p-0 !rounded-tr-none !rounded-br-none ' + (focus() === 'g' ? '!border-r-transparent' : '')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 'r')\"\n (outChange)=\"handlerValueChange($event, 'r')\" />\n </div>\n </div>\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">G</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"g\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"255\"\n [classInclude]=\"'text-center !p-0 !rounded-none ' + (focus() === 'g' ? '' : '!border-x-transparent')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 'g')\"\n (outChange)=\"handlerValueChange($event, 'g')\" />\n </div>\n </div>\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">B</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"b\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"255\"\n [classInclude]=\"'text-center !p-0 !rounded-tl-none !rounded-bl-none ' + (focus() === 'g' ? '!border-l-transparent' : '')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 'b')\"\n (outChange)=\"handlerValueChange($event, 'b')\" />\n </div>\n </div>\n <div class=\"text-center ml-[8px]\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">A</span>\n <div class=\"w-[78px]\">\n <libs_ui-components-inputs-valid\n [item]=\"{ aValue: a() * 100 }\"\n [fieldNameBind]=\"'aValue'\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"100\"\n [unitsRight]=\"[{ label: '%' }]\"\n [emitEmptyInDataTypeNumber]=\"true\"\n (outValueChange)=\"handlerValueChangeAlphaInput($event)\" />\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n</div>\n", styles: [".libs-ui-color-picker-background-transparent{background-image:conic-gradient(rgba(0,0,0,.06) 0 25%,transparent 0 50%,rgba(0,0,0,.06) 0 75%,transparent 0);background-size:11px 11px}.libs-ui-color-picker-dot{position:absolute;width:14px;height:14px;top:3px;left:0;background:transparent;border:1px solid #ffffff;pointer-events:none;border-radius:50px;z-index:1;box-shadow:0 1px 2px #000000bf}\n"], dependencies: [{ kind: "component", type: LibsUiComponentsInputsInputComponent, selector: "libs_ui-components-inputs-input", inputs: ["tagInput", "dataType", "typeInput", "modeInput", "tabInsertContentTagInput", "textAreaEnterNotNewLine", "emitEmptyInDataTypeNumber", "keepZeroInTypeInt", "autoAddZeroLessThan10InTypeInt", "ignoreBlockInputMaxValue", "maxValueNumber", "minValueNumber", "fixedFloat", "acceptNegativeValue", "valueUpDownNumber", "classInclude", "maxLength", "readonly", "disable", "noBorder", "backgroundNone", "borderError", "useColorModeExist", "placeholder", "keepPlaceholderOnly", "value", "autoRemoveEmoji", "defaultHeight", "minHeightTextArea", "maxHeightTextArea", "focusTimeOut", "selectAllTimeOut", "blurTimeOut", "zIndexPopoverContent", "classContainerInput", "showCount", "ignoreStopPropagationEvent", "resize", "templateLeftBottomInput", "templateRightBottomInput", "classContainerBottomInput", "ignoreWidthInput100", "iframeTextareaCustomStyle", "iconLeftClass", "popoverContentIconLeft", "iconRightClass", "popoverContentIconRight", "resetAutoCompletePassword", "acceptOnlyClickIcon", "setIconRightColorSameColorDisableReadOnly", "onlyAcceptNegativeValue", "maxLengthNumberCount", "focusInput"], outputs: ["maxValueNumberChange", "minValueNumberChange", "fixedFloatChange", "acceptNegativeValueChange", "maxLengthChange", "valueChange", "maxLengthNumberCountChange", "outHeightAreaChange", "outChange", "outFocusAndBlurEvent", "outEnterEvent", "outInputEvent", "outIconLeft", "outIconRight", "outFunctionsControl", "outFilesDrop", "outFileDrop", "outChangeValueByButtonUpDown"] }, { kind: "component", type: LibsUiComponentsInputsValidComponent, selector: "libs_ui-components-inputs-valid", inputs: ["item", "labelConfig", "emitEmptyInDataTypeNumber", "ignoreBlockInputMaxValue", "fieldNameBind", "showCount", "typeComponentSelectItem", "valueComponentSelectItem", "disableComponentSelectItem", "tagInput", "dataType", "typeInput", "modeInput", "resetAutoCompletePassword", "textAreaEnterNotNewLine", "fixedFloat", "acceptNegativeValue", "valueUpDownNumber", "ignoreWidthInput100", "classIncludeInput", "classContainerInput", "readonly", "disable", "noBorder", "backgroundNone", "useColorModeExist", "placeholder", "keepPlaceholderOnly", "classContainerBottomInput", "autoRemoveEmoji", "defaultHeight", "maxHeightTextArea", "minHeightTextArea", "ignoreShowError", "borderError", "iconLeftClass", "popoverContentIconLeft", "iconRightClass", "popoverContentIconRight", "zIndexPopoverContent", "unitsLeft", "configUnitLeft", "keySelectedUnitLeft", "unitsRight", "configUnitRight", "keySelectedUnitRight", "maxValueNumber", "minValueNumber", "ignoreContentLeft", "ignoreContentRight", "isBaselineStyle", "valuePatternShowError", "validPattern", "validRequired", "validMinLength", "validMinValue", "validMaxValue", "validMaxLength", "functionValid", "maxLength", "positionMessageErrorStartInput", "classInclude", "resize", "templateLeftBottomInput", "templateRightBottomInput", "onlyAcceptNegativeValue", "autoAddZeroLessThan10InTypeInt", "maxLengthNumberCount", "classMessageErrorInclude", "ignoreStopPropagationEvent", "ignoreUnitRightClassReadOnly", "paddingRightCustomSpecific", "focusTimeOut", "debounceTimeValidate"], outputs: ["itemChange", "outValueChange", "outSelect", "outIconLeft", "outIconRight", "outClickButtonLabel", "outSwitchEventLabel", "outLabelRightClick", "outEnterInputEvent", "outHeightAreaChange", "outFunctionsControl", "outFocusAndBlur", "outChangeValueByButtonUpDown"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
678
+ }
679
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsColorPickerComponent, decorators: [{
680
+ type: Component,
681
+ args: [{ selector: 'libs_ui-components-color_picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [LibsUiComponentsInputsInputComponent, LibsUiComponentsInputsValidComponent], template: "<div>\n <div\n class=\"relative\"\n [style.width.px]=\"options().slBarSize[0]\">\n <div>\n <canvas\n #slEl\n class=\"rounded-tl-[4px] rounded-tr-[4px] libs-ui-color-picker-background-transparent\"></canvas>\n <div\n #slPointerEl\n class=\"libs-ui-color-picker-dot\"></div>\n </div>\n <div class=\"relative\">\n <canvas\n #hueEl\n class=\"libs-ui-color-picker-background-transparent\"\n [class.rounded-bl-[4px]]=\"!options().showAlpha\"\n [class.rounded-br-[4px]]=\"!options().showAlpha\"></canvas>\n <div\n #huePointerEl\n class=\"libs-ui-color-picker-dot\"></div>\n </div>\n @if (options().showAlpha) {\n <div class=\"relative\">\n <canvas\n #alphaEl\n class=\"rounded-bl-[4px] rounded-br-[4px] libs-ui-color-picker-background-transparent\"></canvas>\n <div\n #alphaPointerEl\n class=\"libs-ui-color-picker-dot\"></div>\n </div>\n }\n <div class=\"flex items-end\">\n <div class=\"text-center mr-[16px]\">\n <div class=\"libs-ui-color-picker-background-transparent rounded-[4px]\">\n <div\n #previewEl\n class=\"w-[32px] h-[32px] rounded-[4px] cursor-pointer\"\n (click)=\"handlerCopyColor($event)\"></div>\n </div>\n </div>\n @if (options().showHex) {\n <div class=\"text-center mr-[12px]\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">HEX</span>\n <div class=\"w-[88px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"hex\"\n [classInclude]=\"'text-center !p-0'\"\n (outChange)=\"handlerValueChange($event, 'hex')\" />\n </div>\n </div>\n }\n <div>\n @if (options().showHsl) {\n <div class=\"flex\">\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">H</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"h\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"360\"\n [classInclude]=\"'text-center !p-0 !rounded-tr-none !rounded-br-none ' + (focus() === 's' ? '!border-r-transparent' : '')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 'h')\"\n (outChange)=\"handlerValueChange($event, 'h')\" />\n </div>\n </div>\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">S</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"s\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"100\"\n [classInclude]=\"'text-center !p-0 !rounded-none ' + (focus() === 's' ? '' : '!border-x-transparent')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 's')\"\n (outChange)=\"handlerValueChange($event, 's')\" />\n </div>\n </div>\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">L</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"l\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"100\"\n [classInclude]=\"'text-center !p-0 !rounded-tl-none !rounded-bl-none ' + (focus() === 's' ? '!border-l-transparent' : '')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 'l')\"\n (outChange)=\"handlerValueChange($event, 'l')\" />\n </div>\n </div>\n </div>\n }\n @if (options().showRgb) {\n <div class=\"flex\">\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">R</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"r\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"255\"\n [classInclude]=\"'text-center !p-0 !rounded-tr-none !rounded-br-none ' + (focus() === 'g' ? '!border-r-transparent' : '')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 'r')\"\n (outChange)=\"handlerValueChange($event, 'r')\" />\n </div>\n </div>\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">G</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"g\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"255\"\n [classInclude]=\"'text-center !p-0 !rounded-none ' + (focus() === 'g' ? '' : '!border-x-transparent')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 'g')\"\n (outChange)=\"handlerValueChange($event, 'g')\" />\n </div>\n </div>\n <div class=\"text-center\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">B</span>\n <div class=\"w-[56px]\">\n <libs_ui-components-inputs-input\n [(value)]=\"b\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"255\"\n [classInclude]=\"'text-center !p-0 !rounded-tl-none !rounded-bl-none ' + (focus() === 'g' ? '!border-l-transparent' : '')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlur($event, 'b')\"\n (outChange)=\"handlerValueChange($event, 'b')\" />\n </div>\n </div>\n <div class=\"text-center ml-[8px]\">\n <span class=\"libs-ui-font-h7r text-[#6a7383]\">A</span>\n <div class=\"w-[78px]\">\n <libs_ui-components-inputs-valid\n [item]=\"{ aValue: a() * 100 }\"\n [fieldNameBind]=\"'aValue'\"\n [dataType]=\"'int'\"\n [minValueNumber]=\"0\"\n [maxValueNumber]=\"100\"\n [unitsRight]=\"[{ label: '%' }]\"\n [emitEmptyInDataTypeNumber]=\"true\"\n (outValueChange)=\"handlerValueChangeAlphaInput($event)\" />\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n</div>\n", styles: [".libs-ui-color-picker-background-transparent{background-image:conic-gradient(rgba(0,0,0,.06) 0 25%,transparent 0 50%,rgba(0,0,0,.06) 0 75%,transparent 0);background-size:11px 11px}.libs-ui-color-picker-dot{position:absolute;width:14px;height:14px;top:3px;left:0;background:transparent;border:1px solid #ffffff;pointer-events:none;border-radius:50px;z-index:1;box-shadow:0 1px 2px #000000bf}\n"] }]
682
+ }], ctorParameters: () => [] });
683
+
684
+ /**
685
+ * Generated bundle index. Do not edit.
686
+ */
687
+
688
+ export { LibsUiComponentsColorPickerComponent };
689
+ //# sourceMappingURL=libs-ui-components-color-picker.mjs.map