@tekus/design-system 5.36.0 → 5.37.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.
- package/fesm2022/tekus-design-system-components-color-picker.mjs +203 -29
- package/fesm2022/tekus-design-system-components-color-picker.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-grid-container.mjs +181 -0
- package/fesm2022/tekus-design-system-components-grid-container.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-section.mjs +63 -0
- package/fesm2022/tekus-design-system-components-section.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-tree-table.mjs +94 -0
- package/fesm2022/tekus-design-system-components-tree-table.mjs.map +1 -0
- package/fesm2022/tekus-design-system-core-types.mjs +22 -7
- package/fesm2022/tekus-design-system-core-types.mjs.map +1 -1
- package/fesm2022/tekus-design-system-core.mjs +22 -7
- package/fesm2022/tekus-design-system-core.mjs.map +1 -1
- package/fesm2022/tekus-design-system-directives-gird-item.mjs +1 -1
- package/fesm2022/tekus-design-system-directives-gird-item.mjs.map +1 -1
- package/package.json +13 -1
- package/types/tekus-design-system-components-color-picker.d.ts +75 -12
- package/types/tekus-design-system-components-grid-container.d.ts +123 -0
- package/types/tekus-design-system-components-section.d.ts +45 -0
- package/types/tekus-design-system-components-tree-table.d.ts +62 -0
- package/types/tekus-design-system-core-types.d.ts +7 -7
- package/types/tekus-design-system-core.d.ts +7 -7
- package/types/tekus-design-system-directives-gird-item.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, computed, inject, ElementRef, DestroyRef, ChangeDetectionStrategy, Component, model, viewChild, signal, effect, untracked } from '@angular/core';
|
|
2
|
+
import { Injectable, input, output, computed, inject, ElementRef, DestroyRef, ChangeDetectionStrategy, Component, model, viewChild, signal, effect, untracked } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { NgControl, FormControl } from '@angular/forms';
|
|
5
5
|
import { ButtonModule } from 'primeng/button';
|
|
@@ -15,6 +15,45 @@ import { IconComponent } from '@tekus/design-system/components/icon';
|
|
|
15
15
|
import { InputTextComponent } from '@tekus/design-system/components/input-text';
|
|
16
16
|
import { getContrastTextColor, getContrastResult } from '@tekus/design-system/utils/wcag-contrast';
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @service ColorPickerRegistryService
|
|
20
|
+
* @description
|
|
21
|
+
* Coordinates mutual exclusivity between `tk-color-picker` instances mounted
|
|
22
|
+
* in the same view: opening one instance requests the previously open one to
|
|
23
|
+
* close (as a cancellation — no value is emitted). Transparent to consumers,
|
|
24
|
+
* no public API on `ColorPickerComponent` changes because of it.
|
|
25
|
+
*/
|
|
26
|
+
class ColorPickerRegistryService {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.active = null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Called from `onPopoverShow()`. If another instance is currently open,
|
|
32
|
+
* asks it to close (cancel) before registering the new one as active.
|
|
33
|
+
*/
|
|
34
|
+
requestOpen(id, requestClose) {
|
|
35
|
+
if (this.active && this.active.id !== id) {
|
|
36
|
+
this.active.requestClose();
|
|
37
|
+
}
|
|
38
|
+
this.active = { id, requestClose };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Called from `onPopoverHide()` and on component destroy, so a destroyed
|
|
42
|
+
* or already-closed instance never lingers as the registered active one.
|
|
43
|
+
*/
|
|
44
|
+
notifyClosed(id) {
|
|
45
|
+
if (this.active?.id === id) {
|
|
46
|
+
this.active = null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ColorPickerRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
50
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ColorPickerRegistryService, providedIn: 'root' }); }
|
|
51
|
+
}
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ColorPickerRegistryService, decorators: [{
|
|
53
|
+
type: Injectable,
|
|
54
|
+
args: [{ providedIn: 'root' }]
|
|
55
|
+
}] });
|
|
56
|
+
|
|
18
57
|
/**
|
|
19
58
|
* @component ColorPickerSpectrumComponent
|
|
20
59
|
* @description
|
|
@@ -279,6 +318,7 @@ class ColorPickerComponent {
|
|
|
279
318
|
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
280
319
|
this.destroyRef = inject(DestroyRef);
|
|
281
320
|
this.el = inject(ElementRef);
|
|
321
|
+
this.registry = inject(ColorPickerRegistryService);
|
|
282
322
|
this.init = (() => {
|
|
283
323
|
if (this.ngControl) {
|
|
284
324
|
this.ngControl.valueAccessor = this;
|
|
@@ -370,6 +410,25 @@ class ColorPickerComponent {
|
|
|
370
410
|
* @default `''`
|
|
371
411
|
*/
|
|
372
412
|
this.errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
413
|
+
/**
|
|
414
|
+
* @property {ColorPickerEmitMode} emitMode
|
|
415
|
+
* @description
|
|
416
|
+
* Emission strategy for `colorChange`/`textColorChange`/`value`:
|
|
417
|
+
* `'live'` emits on every valid draft change (default, unchanged behavior).
|
|
418
|
+
* `'onClose'` emits once, with the final value, only when the popover
|
|
419
|
+
* closes by confirmation (Enter / click-outside) — Escape, or being closed
|
|
420
|
+
* by another `tk-color-picker` instance opening in the same view, never
|
|
421
|
+
* emits.
|
|
422
|
+
*
|
|
423
|
+
* Exception: editing the trigger HEX field directly while the popover is
|
|
424
|
+
* closed (`variant="input"`) has no popover session to defer to, so under
|
|
425
|
+
* `'onClose'` it commits on its own equivalent of "close" — Enter, or
|
|
426
|
+
* losing focus (blur) — not on every debounce tick while still typing.
|
|
427
|
+
* This avoids firing on each momentarily-complete-looking HEX mid-edit,
|
|
428
|
+
* which matters when `colorChange` is wired straight to an API call.
|
|
429
|
+
* @default `'live'`
|
|
430
|
+
*/
|
|
431
|
+
this.emitMode = input('live', ...(ngDevMode ? [{ debugName: "emitMode" }] : /* istanbul ignore next */ []));
|
|
373
432
|
/**
|
|
374
433
|
* @property {ColorPickerTexts} texts
|
|
375
434
|
* @description
|
|
@@ -397,17 +456,22 @@ class ColorPickerComponent {
|
|
|
397
456
|
/**
|
|
398
457
|
* @event colorChange
|
|
399
458
|
* @description
|
|
400
|
-
* Emits the confirmed background hex color
|
|
401
|
-
* on every valid change (
|
|
402
|
-
*
|
|
459
|
+
* Emits the confirmed background hex color. Timing depends on `emitMode()`:
|
|
460
|
+
* `'live'` emits on every valid change (drag, keystroke, swatch pick, or
|
|
461
|
+
* trigger HEX edit while closed); `'onClose'` emits once, with the final
|
|
462
|
+
* value, only when the popover closes by confirmation (Enter /
|
|
463
|
+
* click-outside). Never emits on Escape, when another instance forces this
|
|
464
|
+
* one to close, on invalid values, on hydration, or while disabled. Always
|
|
465
|
+
* emitted together with `textColorChange` in the same synchronous call, so
|
|
466
|
+
* both values belong to the same commit.
|
|
403
467
|
*/
|
|
404
468
|
this.colorChange = output();
|
|
405
469
|
/**
|
|
406
470
|
* @event textColorChange
|
|
407
471
|
* @description
|
|
408
|
-
* Emits together with `colorChange
|
|
409
|
-
* confirmed background (`#000000` on light colors,
|
|
410
|
-
* or the `contrastColor` override when provided).
|
|
472
|
+
* Emits together with `colorChange`, same timing, same commit: the ideal
|
|
473
|
+
* text color over the confirmed background (`#000000` on light colors,
|
|
474
|
+
* `#ffffff` on dark ones, or the `contrastColor` override when provided).
|
|
411
475
|
*/
|
|
412
476
|
this.textColorChange = output();
|
|
413
477
|
/**
|
|
@@ -457,8 +521,16 @@ class ColorPickerComponent {
|
|
|
457
521
|
...this.texts(),
|
|
458
522
|
}), ...(ngDevMode ? [{ debugName: "t" }] : /* istanbul ignore next */ []));
|
|
459
523
|
/** Valid draft hex to paint swatches, or null → neutral fallback via CSS. */
|
|
524
|
+
/**
|
|
525
|
+
* Always reflects `draftHex()`, not `value()` — independent of `emitMode`
|
|
526
|
+
* and of whether the popover is open. `draftHex` tracks every keystroke
|
|
527
|
+
* (trigger or panel HEX field, spectrum/hue/swatch picks) in real time, so
|
|
528
|
+
* the swatch gives immediate visual feedback while the user is still
|
|
529
|
+
* typing, even under `emitMode="onClose"` where the actual commit/emit is
|
|
530
|
+
* deferred to Enter/blur/click-outside.
|
|
531
|
+
*/
|
|
460
532
|
this.swatchColor = computed(() => {
|
|
461
|
-
const color = this.
|
|
533
|
+
const color = this.draftHex();
|
|
462
534
|
return this.isValidHex(color) ? color : null;
|
|
463
535
|
}, ...(ngDevMode ? [{ debugName: "swatchColor" }] : /* istanbul ignore next */ []));
|
|
464
536
|
/**
|
|
@@ -498,6 +570,14 @@ class ColorPickerComponent {
|
|
|
498
570
|
: this.t().invalidHexError;
|
|
499
571
|
}, ...(ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []));
|
|
500
572
|
this.originalValue = '';
|
|
573
|
+
this.closeReason = 'accept';
|
|
574
|
+
// Set right before popover().hide() when Enter already committed
|
|
575
|
+
// synchronously, so onPopoverHide()'s own accept-commit doesn't fire a
|
|
576
|
+
// duplicate colorChange/textColorChange for the same still-unchanged
|
|
577
|
+
// draft. Reset on every open (so it can never leak into a later session)
|
|
578
|
+
// and explicitly in every branch of onPopoverHide() (not just the one
|
|
579
|
+
// that consumes it) so the flag never depends on which branch runs.
|
|
580
|
+
this.suppressNextHideCommit = false;
|
|
501
581
|
// Circular buffer pointer: tracks the oldest slot index to replace when customColors is at capacity.
|
|
502
582
|
// Starts at 0 (correct for both empty lists and backend-loaded full arrays, assuming oldest-first order).
|
|
503
583
|
// Limitation: not reset when customColors is rebound externally at runtime without destroying the component.
|
|
@@ -541,6 +621,10 @@ class ColorPickerComponent {
|
|
|
541
621
|
this.hexInput$
|
|
542
622
|
.pipe(debounceTime(200), takeUntilDestroyed(this.destroyRef))
|
|
543
623
|
.subscribe((v) => this.processHexInput(v, false));
|
|
624
|
+
// Prevents the registry from holding a stale reference to this instance
|
|
625
|
+
// if it's destroyed while its popover is still open (e.g. route change
|
|
626
|
+
// without closing the picker first) — not just on normal onPopoverHide.
|
|
627
|
+
this.destroyRef.onDestroy(() => this.registry.notifyClosed(this.fieldId));
|
|
544
628
|
}
|
|
545
629
|
// ── ControlValueAccessor ────────────────────────────────────────────────
|
|
546
630
|
/**
|
|
@@ -597,6 +681,8 @@ class ColorPickerComponent {
|
|
|
597
681
|
onPopoverShow() {
|
|
598
682
|
this.isOpen.set(true);
|
|
599
683
|
this.originalValue = this.value();
|
|
684
|
+
this.suppressNextHideCommit = false;
|
|
685
|
+
this.registry.requestOpen(this.fieldId, () => this.cancelAndClose());
|
|
600
686
|
// Sync draft from current value
|
|
601
687
|
this.syncFromValue(this.value());
|
|
602
688
|
this.opened.emit();
|
|
@@ -654,20 +740,79 @@ class ColorPickerComponent {
|
|
|
654
740
|
this.isOpen.set(false);
|
|
655
741
|
this.onTouched();
|
|
656
742
|
this.triggerControl.markAsTouched();
|
|
657
|
-
this.
|
|
743
|
+
const reason = this.closeReason;
|
|
744
|
+
this.closeReason = 'accept';
|
|
745
|
+
if (reason === 'cancel') {
|
|
746
|
+
this.suppressNextHideCommit = false;
|
|
747
|
+
this.restoreOriginalValue();
|
|
748
|
+
}
|
|
749
|
+
else if (this.suppressNextHideCommit) {
|
|
750
|
+
// Enter already committed synchronously right before calling hide() —
|
|
751
|
+
// skip this redundant re-commit for the same still-unchanged draft.
|
|
752
|
+
this.suppressNextHideCommit = false;
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
// Flush the debounced hex pipeline synchronously first: click-outside
|
|
756
|
+
// can land within the 200ms debounce window of the last keystroke,
|
|
757
|
+
// which would otherwise commit a stale draftHex(). commit=false: the
|
|
758
|
+
// explicit commitDraft() below is the single source of truth for the
|
|
759
|
+
// emit, same reasoning as onHexKeydown's Enter flush.
|
|
760
|
+
this.processHexInput('#' + this.displayHexNoHash(), true, false);
|
|
761
|
+
// Always commit on accept: in 'onClose' mode this is the first and
|
|
762
|
+
// only commit; in 'live' mode the draft is already committed, this
|
|
763
|
+
// just guarantees the final state is flushed (e.g. Enter pressed
|
|
764
|
+
// right after a programmatic value change, with no draft edits yet).
|
|
765
|
+
this.commitDraft();
|
|
766
|
+
}
|
|
767
|
+
this.registry.notifyClosed(this.fieldId);
|
|
768
|
+
this.closed.emit(reason);
|
|
658
769
|
}
|
|
659
770
|
onPanelEnter(event) {
|
|
660
771
|
this.confirmAndClose();
|
|
661
772
|
event.preventDefault();
|
|
662
773
|
event.stopPropagation();
|
|
663
774
|
}
|
|
775
|
+
/** Bound to `(keydown.escape)` on the popover panel: intercepts Escape
|
|
776
|
+
* before it can bubble to PrimeNG's own document-level close handler, so
|
|
777
|
+
* the close reason is already recorded as `cancel` by the time `onHide`
|
|
778
|
+
* fires. */
|
|
779
|
+
onPanelEscape(event) {
|
|
780
|
+
event.preventDefault();
|
|
781
|
+
event.stopPropagation();
|
|
782
|
+
this.cancelAndClose();
|
|
783
|
+
}
|
|
664
784
|
confirmAndClose() {
|
|
665
785
|
if (!this.isValidHex(this.draftHex())) {
|
|
666
786
|
return;
|
|
667
787
|
}
|
|
668
|
-
this.commitDraft();
|
|
669
788
|
this.popover()?.hide();
|
|
670
789
|
}
|
|
790
|
+
/** Closes the popover as a cancellation: `onPopoverHide()` will restore
|
|
791
|
+
* `originalValue` and emit nothing. Shared by Escape and by the registry
|
|
792
|
+
* when another `tk-color-picker` instance opens in the same view. */
|
|
793
|
+
cancelAndClose() {
|
|
794
|
+
this.closeReason = 'cancel';
|
|
795
|
+
this.popover()?.hide();
|
|
796
|
+
}
|
|
797
|
+
restoreOriginalValue() {
|
|
798
|
+
const normalized = this.normalizeHex(this.originalValue);
|
|
799
|
+
const restored = this.isValidHex(normalized) ? normalized : '';
|
|
800
|
+
if (restored) {
|
|
801
|
+
this.setFromHex(restored, false);
|
|
802
|
+
}
|
|
803
|
+
else {
|
|
804
|
+
this.draftHex.set('');
|
|
805
|
+
this.displayHexNoHash.set('');
|
|
806
|
+
this.setValid(true);
|
|
807
|
+
}
|
|
808
|
+
// In 'live' mode the value model may already have moved past
|
|
809
|
+
// originalValue (committed mid-drag) — undo that too, without emitting
|
|
810
|
+
// colorChange/textColorChange.
|
|
811
|
+
if (this.value() !== restored) {
|
|
812
|
+
this.value.set(restored);
|
|
813
|
+
this.onChange(restored);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
671
816
|
// ── Draft state updates ─────────────────────────────────────────────────
|
|
672
817
|
onSpectrumChange(change) {
|
|
673
818
|
this.saturation.set(change.saturation);
|
|
@@ -768,15 +913,23 @@ class ColorPickerComponent {
|
|
|
768
913
|
if (event.key === 'Enter') {
|
|
769
914
|
event.preventDefault();
|
|
770
915
|
event.stopPropagation();
|
|
771
|
-
|
|
772
|
-
if
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
//
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
916
|
+
// Flush synchronously first: hexInput$ debounces 200ms, so draftHex()
|
|
917
|
+
// can still be stale if Enter is pressed right after the last
|
|
918
|
+
// keystroke (fast typing). Mirrors onHexBlur()'s own flush.
|
|
919
|
+
// commit=false: the explicit commitDraft() right below is the single
|
|
920
|
+
// source of truth for the emit — the flush must not also auto-commit
|
|
921
|
+
// via maybeCommit() (that would double-emit in 'live' mode).
|
|
922
|
+
this.processHexInput('#' + this.displayHexNoHash(), true, false);
|
|
923
|
+
// Commit directly — covers both the trigger HEX field edited while the
|
|
924
|
+
// popover is closed (no onPopoverHide to fall back on) and the panel
|
|
925
|
+
// HEX field, without depending on the popover's close animation timing.
|
|
926
|
+
this.commitDraft();
|
|
927
|
+
// If a real popover is actually open, hide() will trigger
|
|
928
|
+
// onPopoverHide()'s own accept-commit right after — flag it so that
|
|
929
|
+
// one is skipped instead of re-emitting the same already-committed
|
|
930
|
+
// value a second time.
|
|
931
|
+
this.suppressNextHideCommit = true;
|
|
932
|
+
this.popover()?.hide();
|
|
780
933
|
return;
|
|
781
934
|
}
|
|
782
935
|
if (event.ctrlKey || event.metaKey || event.altKey) {
|
|
@@ -819,16 +972,27 @@ class ColorPickerComponent {
|
|
|
819
972
|
this.onHexInput(merged);
|
|
820
973
|
}
|
|
821
974
|
onHexBlur() {
|
|
822
|
-
this
|
|
975
|
+
// commit=false: this flush only syncs draftHex/displayHexNoHash — the
|
|
976
|
+
// explicit commitDraft() below is the single source of truth for the
|
|
977
|
+
// emit, so the flush itself must not also auto-commit via maybeCommit()
|
|
978
|
+
// (that would double-emit in 'live' mode for a change not yet synced).
|
|
979
|
+
this.processHexInput('#' + this.displayHexNoHash(), true, false);
|
|
823
980
|
this.onTouched();
|
|
981
|
+
if (!this.isOpen()) {
|
|
982
|
+
// Losing focus on the closed trigger's HEX field (variant="input")
|
|
983
|
+
// is the "I'm done editing" signal for that path — there's no
|
|
984
|
+
// popover session for onPopoverHide() to eventually flush, so this
|
|
985
|
+
// commits unconditionally, the same way Enter already does.
|
|
986
|
+
this.commitDraft();
|
|
987
|
+
}
|
|
824
988
|
}
|
|
825
|
-
processHexInput(raw, forceNormalize) {
|
|
989
|
+
processHexInput(raw, forceNormalize, commit = true) {
|
|
826
990
|
const hex = this.parseHex(raw);
|
|
827
991
|
if (hex === null) {
|
|
828
992
|
return;
|
|
829
993
|
}
|
|
830
994
|
if (this.isValidHex(hex)) {
|
|
831
|
-
this.applyValidHex(hex, forceNormalize);
|
|
995
|
+
this.applyValidHex(hex, forceNormalize, commit);
|
|
832
996
|
}
|
|
833
997
|
else {
|
|
834
998
|
this.applyInvalidHex(hex.slice(1), forceNormalize);
|
|
@@ -849,7 +1013,7 @@ class ColorPickerComponent {
|
|
|
849
1013
|
}
|
|
850
1014
|
return ('#' + body).toLowerCase();
|
|
851
1015
|
}
|
|
852
|
-
applyValidHex(hex, forceNormalize) {
|
|
1016
|
+
applyValidHex(hex, forceNormalize, commit) {
|
|
853
1017
|
if (hex.length === 4 && !forceNormalize) {
|
|
854
1018
|
this.setValid(true);
|
|
855
1019
|
return;
|
|
@@ -857,7 +1021,7 @@ class ColorPickerComponent {
|
|
|
857
1021
|
const norm = this.normalizeHex(hex);
|
|
858
1022
|
this.setValid(true);
|
|
859
1023
|
if (norm !== this.draftHex()) {
|
|
860
|
-
this.setFromHex(norm,
|
|
1024
|
+
this.setFromHex(norm, commit);
|
|
861
1025
|
}
|
|
862
1026
|
else {
|
|
863
1027
|
this.displayHexNoHash.set(norm.slice(1).toUpperCase());
|
|
@@ -911,10 +1075,20 @@ class ColorPickerComponent {
|
|
|
911
1075
|
this.maybeCommit();
|
|
912
1076
|
}
|
|
913
1077
|
/**
|
|
914
|
-
* Commits the draft color immediately
|
|
1078
|
+
* Commits the draft color immediately, but only in `'live'` emitMode.
|
|
1079
|
+
* In `'onClose'` mode, mid-edit draft changes never commit here — not even
|
|
1080
|
+
* for the trigger HEX field edited while the popover is closed. That path
|
|
1081
|
+
* still needs an explicit "I'm done" signal, just like a popover session
|
|
1082
|
+
* does: Enter (`onHexKeydown`) or losing focus (`onHexBlur`), both of which
|
|
1083
|
+
* commit unconditionally regardless of `emitMode()`. Committing on every
|
|
1084
|
+
* debounce tick while the field still has focus would fire on each
|
|
1085
|
+
* completed-looking HEX mid-typing — exactly the noise `'onClose'` exists
|
|
1086
|
+
* to avoid (e.g. a consumer wiring this straight to an API call).
|
|
915
1087
|
*/
|
|
916
1088
|
maybeCommit() {
|
|
917
|
-
this.
|
|
1089
|
+
if (this.emitMode() === 'live') {
|
|
1090
|
+
this.commitDraft();
|
|
1091
|
+
}
|
|
918
1092
|
}
|
|
919
1093
|
commitDraft() {
|
|
920
1094
|
const hex = this.draftHex();
|
|
@@ -1003,7 +1177,7 @@ class ColorPickerComponent {
|
|
|
1003
1177
|
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
1004
1178
|
}
|
|
1005
1179
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1006
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: ColorPickerComponent, isStandalone: true, selector: "tk-color-picker", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, sections: { classPropertyName: "sections", publicName: "sections", isSignal: true, isRequired: false, transformFunction: null }, presetColors: { classPropertyName: "presetColors", publicName: "presetColors", isSignal: true, isRequired: false, transformFunction: null }, contrastColor: { classPropertyName: "contrastColor", publicName: "contrastColor", isSignal: true, isRequired: false, transformFunction: null }, maxCustomColors: { classPropertyName: "maxCustomColors", publicName: "maxCustomColors", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, customColors: { classPropertyName: "customColors", publicName: "customColors", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", customColors: "customColorsChange", colorChange: "colorChange", textColorChange: "textColorChange", validChange: "validChange", opened: "opened", closed: "closed" }, viewQueries: [{ propertyName: "popover", first: true, predicate: ["op"], descendants: true, isSignal: true }, { propertyName: "swatchBtnRef", first: true, predicate: ["swatchBtn"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "inputTriggerRef", first: true, predicate: ["inputTrigger"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "panelHexInput", first: true, predicate: ["panelHexInput"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<div\n class=\"tk-color-picker\"\n [class.tk-color-picker--disabled]=\"isDisabled()\"\n [class.tk-color-picker--open]=\"isOpen()\"\n [class.tk-color-picker--invalid]=\"!isValid()\">\n @if (variant() === 'swatch') {\n @if (label()) {\n <span class=\"tk-color-picker__label\">{{ label() }}</span>\n }\n <button\n #swatchBtn\n type=\"button\"\n class=\"tk-color-picker__trigger tk-color-picker__trigger--swatch\"\n [disabled]=\"isDisabled()\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-label]=\"t().openPickerLabel + (label() ? ': ' + label() : '')\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onTriggerClick($event)\">\n <span\n class=\"tk-color-picker__swatch\"\n [class.tk-color-picker__swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor()\"\n aria-hidden=\"true\"></span>\n <tk-icon\n class=\"tk-color-picker__chevron\"\n [class.tk-color-picker__chevron--open]=\"isOpen()\"\n icon=\"chevron-down\"\n styleIcon=\"regular\"\n size=\"xs\"></tk-icon>\n </button>\n } @else {\n <div\n #inputTrigger\n class=\"tk-color-picker__trigger-input\"\n [class.tk-color-picker__trigger-input--invalid]=\"!isValid()\">\n @if (label()) {\n <label\n class=\"tk-color-picker__input-label\"\n [for]=\"fieldId\"\n [title]=\"label()\"\n >{{ label() }}</label\n >\n }\n <div class=\"tk-color-picker__input-wrap\">\n <button\n type=\"button\"\n class=\"tk-color-picker__input-swatch\"\n [class.tk-color-picker__input-swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor() ?? null\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"t().openPickerLabel\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onTriggerClick($event)\"></button>\n <span class=\"tk-color-picker__input-prefix\" aria-hidden=\"true\">#</span>\n <input\n pInputText\n [id]=\"fieldId\"\n [value]=\"displayHexNoHash()\"\n [disabled]=\"isDisabled()\"\n [class.ng-invalid]=\"triggerControl.invalid\"\n [class.ng-dirty]=\"triggerControl.dirty\"\n [class.ng-touched]=\"triggerControl.touched\"\n [attr.aria-describedby]=\"!isValid() ? errorId : null\"\n [attr.aria-invalid]=\"!isValid()\"\n autocomplete=\"off\"\n (input)=\"onHexNativeInput($event)\"\n (keydown)=\"onHexKeydown($event)\"\n (paste)=\"onHexPaste($event)\"\n (blur)=\"onHexBlur()\" />\n </div>\n <div class=\"tk-color-picker__input-bottom\">\n @if (!isValid()) {\n <p-message\n severity=\"error\"\n size=\"small\"\n variant=\"simple\"\n [id]=\"errorId\"\n >{{ errorText() }}</p-message\n >\n } @else if (hint()) {\n <p-message severity=\"secondary\" size=\"small\" variant=\"simple\">{{\n hint()\n }}</p-message>\n }\n </div>\n </div>\n }\n\n @if (variant() === 'swatch') {\n @if (!isValid()) {\n <span\n [id]=\"errorId\"\n class=\"tk-color-picker__error\"\n role=\"alert\"\n aria-live=\"polite\">\n {{ errorText() }}\n </span>\n } @else if (hint()) {\n <span class=\"tk-color-picker__hint\">{{ hint() }}</span>\n }\n }\n</div>\n\n<p-popover\n #op\n [styleClass]=\"\n 'tk-color-picker-popover' +\n (variant() === 'input' ? ' tk-color-picker-popover--input' : '')\n \"\n position=\"bottom\"\n appendTo=\"body\"\n (onShow)=\"onPopoverShow()\"\n (onHide)=\"onPopoverHide()\">\n <div\n class=\"tk-color-picker__panel\"\n role=\"group\"\n [attr.aria-label]=\"t().dialogLabel\"\n tabindex=\"-1\"\n autofocus\n (keydown.enter)=\"onPanelEnter($event)\">\n @if (resolvedSections().swatches && presetColors().length) {\n <section class=\"tk-color-picker__section\">\n <span class=\"tk-color-picker__section-label\">{{\n t().swatchesLabel\n }}</span>\n <tk-color-picker-swatch-grid\n [colors]=\"presetColors()\"\n [selected]=\"draftHex()\"\n [ariaLabel]=\"t().swatchesLabel\"\n (picked)=\"onSwatchPick($event)\" />\n </section>\n }\n\n @if (resolvedSections().customColors) {\n <section class=\"tk-color-picker__section\">\n <span class=\"tk-color-picker__section-label\">{{\n t().customColorsLabel\n }}</span>\n <tk-color-picker-swatch-grid\n [colors]=\"customColors()\"\n [selected]=\"draftHex()\"\n [ariaLabel]=\"t().customColorsLabel\"\n (picked)=\"onSwatchPick($event)\">\n @if (canAddCustom()) {\n <button\n type=\"button\"\n class=\"tk-color-picker__add-custom\"\n [attr.aria-label]=\"t().addCustomColorLabel\"\n (click)=\"addCustomColor()\">\n <tk-icon icon=\"plus\" styleIcon=\"regular\" size=\"xs\"></tk-icon>\n </button>\n }\n @if (isCustomColorSelected()) {\n <button\n type=\"button\"\n class=\"tk-color-picker__remove-custom\"\n [attr.aria-label]=\"t().removeCustomColorLabel\"\n (click)=\"removeCustomColor()\">\n \u2212\n </button>\n }\n </tk-color-picker-swatch-grid>\n </section>\n }\n\n @if (\n resolvedSections().customColors &&\n (resolvedSections().spectrum ||\n resolvedSections().hue ||\n resolvedSections().hex)\n ) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (resolvedSections().spectrum) {\n <tk-color-picker-spectrum\n [hue]=\"hue()\"\n [saturation]=\"saturation()\"\n [brightness]=\"brightness()\"\n [color]=\"swatchColor() ?? ''\"\n [ariaLabel]=\"t().spectrumLabel\"\n (changed)=\"onSpectrumChange($event)\" />\n }\n\n @if (resolvedSections().hue) {\n <input\n class=\"tk-color-picker__hue\"\n type=\"range\"\n min=\"0\"\n max=\"360\"\n [value]=\"hue()\"\n [attr.aria-label]=\"t().hueLabel\"\n (input)=\"onHueChange($event)\" />\n }\n\n @if (\n (resolvedSections().spectrum || resolvedSections().hue) &&\n resolvedSections().hex\n ) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (resolvedSections().hex) {\n <section class=\"tk-color-picker__section tk-color-picker__hex-row\">\n <span\n class=\"tk-color-picker__swatch tk-color-picker__swatch--large\"\n [class.tk-color-picker__swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor()\"\n aria-hidden=\"true\"></span>\n <tk-input-text\n #panelHexInput\n class=\"tk-color-picker__panel-hex\"\n [class.tk-color-picker__trigger-input--invalid]=\"!isValid()\"\n [label]=\"t().hexLabel\"\n [id]=\"panelFieldId\"\n [value]=\"displayHexNoHash()\"\n prefixText=\"#\"\n (input)=\"onHexNativeInput($event)\"\n (keydown)=\"onHexKeydown($event)\"\n (paste)=\"onHexPaste($event)\"\n (focusout)=\"onHexBlur()\" />\n @if (showEyedropper()) {\n <tk-button\n class=\"tk-color-picker__eyedropper\"\n tabindex=\"-1\"\n severity=\"secondary\"\n variant=\"outlined\"\n icon=\"eye-dropper\"\n styleIcon=\"regular\"\n [attr.aria-label]=\"t().eyedropperLabel\"\n (clicked)=\"openEyeDropper()\">\n </tk-button>\n }\n </section>\n }\n\n @if (resolvedSections().hex && showContrast()) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (showContrast()) {\n <section class=\"tk-color-picker__section tk-color-picker__contrast\">\n <span class=\"tk-color-picker__section-label\">{{\n t().contrastLabel\n }}</span>\n <div class=\"tk-color-picker__contrast-row\">\n <span\n class=\"tk-color-picker__contrast-pill\"\n [style.background-color]=\"draftHex()\"\n [attr.aria-label]=\"t().contrastSampleLabel\">\n <span\n class=\"tk-color-picker__contrast-sample\"\n [style.color]=\"contrastTextColor()\">\n {{ t().contrastSampleText }}\n </span>\n </span>\n <div class=\"tk-color-picker__contrast-info\">\n <span class=\"tk-color-picker__contrast-label\">{{\n t().contrastSampleLabel\n }}</span>\n <span class=\"tk-color-picker__contrast-ratio\"\n >{{ contrastResult()!.ratio }}:1</span\n >\n </div>\n @switch (contrastResult()!.level) {\n @case ('AAA') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--aaa\"\n >AAA</span\n >\n }\n @case ('AA') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--aa\"\n >AA</span\n >\n }\n @case ('fail') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--fail\">\n {{ t().contrastLowLabel }}\n </span>\n }\n }\n </div>\n </section>\n }\n </div>\n</p-popover>\n", styles: [":host{display:inline-block;font-family:var(--tk-font-family, sans-serif)}.tk-color-picker{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-xs, .25rem)}.tk-color-picker__label{font-size:var(--tk-font-size-paragraph-m, 1rem);font-weight:var(--tk-font-weight-400, 400);color:var(--tk-color-base-surface-950, #191a1b);margin-bottom:.25rem}.tk-color-picker__trigger{display:flex;align-items:center;gap:var(--tk-spacing-gap-s, .5rem);padding:var(--tk-spacing-padding-xs, .25rem) var(--tk-spacing-padding-s, .5rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);border-radius:var(--tk-borderRadius-s, .25rem);background:var(--tk-color-background-default, #ffffff);cursor:pointer;transition:border-color .14s ease,background .14s ease}.tk-color-picker__trigger:hover{border-color:var(--tk-color-border-default, #cecdcd)}.tk-color-picker__trigger:focus-within{border-color:var(--tk-color-border-focus, #16006f)}.tk-color-picker__trigger--swatch{appearance:none;width:fit-content;font:inherit;-webkit-user-select:none;user-select:none}.tk-color-picker__trigger--swatch>*{pointer-events:none}.tk-color-picker__trigger--swatch:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__trigger--swatch:disabled{cursor:not-allowed}.tk-color-picker__trigger-input{display:flex;flex-direction:column;position:relative}.tk-color-picker__input-label{position:absolute;left:var(--tk-spacing-base-300, 3rem);top:.75rem;font-size:var(--tk-font-size-paragraph-m, 1rem);font-weight:var(--tk-font-weight-400, 400);color:var(--tk-color-base-surface-500, #8a8a8b);background:var(--tk-color-background-default, #ffffff);padding:0 .25rem;transition:top .2s ease,left .2s ease,color .2s ease;pointer-events:none;z-index:1;max-width:calc(100% - 4rem);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tk-color-picker--disabled .tk-color-picker__input-label{display:none}.tk-color-picker--invalid .tk-color-picker__input-label{color:var(--tk-color-base-red-700, #cf2604)}.tk-color-picker__input-wrap{position:relative;display:flex;align-items:center;width:100%}.tk-color-picker__input-wrap input.p-inputtext{width:100%;flex:1;border:none;border-bottom:.0625rem solid var(--tk-color-base-surface-300, #d2d2d2);border-radius:0;padding:var(--tk-spacing-base-75, .75rem);padding-left:var(--tk-spacing-base-300, 3rem);color:var(--tk-color-base-surface-950, #191a1b);background-color:transparent;outline:none}.tk-color-picker__input-wrap input.p-inputtext:focus{border-color:var(--tk-color-base-primary-600, #140065);box-shadow:none}.tk-color-picker__input-wrap input.p-inputtext.ng-invalid.ng-dirty,.tk-color-picker__input-wrap input.p-inputtext.ng-invalid.ng-touched{border-color:var(--tk-color-base-red-700, #cf2604)}.tk-color-picker__input-wrap input.p-inputtext:disabled{background-color:var(--tk-color-base-surface-200, #e4e4e4);color:var(--tk-color-base-surface-500, #8a8a8b);opacity:1}.tk-color-picker__input-swatch{appearance:none;padding:0;position:absolute;left:var(--tk-spacing-base-25, .25rem);top:50%;transform:translateY(-50%);width:1.25rem;height:1.25rem;border-radius:var(--tk-borderRadius-xs, .125rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);flex-shrink:0;cursor:pointer;z-index:1;-webkit-user-select:none;user-select:none;background:transparent}.tk-color-picker__input-swatch--fallback{background:var(--tk-color-base-surface-400, #cecdcd)}.tk-color-picker__input-swatch:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__input-swatch:disabled{cursor:not-allowed;opacity:.5}.tk-color-picker__input-prefix{position:absolute;left:calc(var(--tk-spacing-base-25, .25rem) + 1.25rem + .25rem);top:50%;transform:translateY(-50%);color:var(--tk-color-text-muted, #8a8a8b);font-size:var(--tk-font-size-paragraph-s, .875rem);line-height:1;pointer-events:none;z-index:1}.tk-color-picker__input-bottom{display:flex;margin-top:.25rem;min-height:1.25rem}.tk-color-picker--open .tk-color-picker__trigger{border-color:var(--tk-color-border-strong, #424243)}.tk-color-picker--invalid .tk-color-picker__trigger{border-color:var(--tk-color-feedback-danger-default, #ff6640)}.tk-color-picker--disabled .tk-color-picker__trigger{opacity:.55;cursor:not-allowed;pointer-events:none;background:var(--tk-color-background-soft, #f2f1f1)}.tk-color-picker__swatch{flex-shrink:0;width:1.25rem;height:1.25rem;border-radius:var(--tk-borderRadius-xs, .125rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4)}.tk-color-picker__swatch--fallback{background:var(--tk-color-base-surface-400, #cecdcd)}.tk-color-picker__swatch--large{width:2rem;height:2rem;border-radius:var(--tk-borderRadius-s, .25rem)}.tk-color-picker__chevron{transition:transform .2s ease}.tk-color-picker__chevron--open{transform:rotate(180deg)}.tk-color-picker__error{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-feedback-danger-default, #ff6640)}.tk-color-picker__hint{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-text-muted, #8a8a8b)}.tk-color-picker__panel{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-m, .75rem);width:16rem;padding:var(--tk-spacing-padding-m, 1rem);box-sizing:border-box}.tk-color-picker__panel:focus,.tk-color-picker__panel:focus-visible{outline:none}.tk-color-picker__section{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-xs, .25rem)}.tk-color-picker__section-label{font-size:var(--tk-font-size-legal-m, .75rem);font-weight:var(--tk-font-weight-600, 600);color:var(--tk-color-text-subtle, #5d5d5e)}.tk-color-picker__add-custom{appearance:none;padding:0;width:100%;aspect-ratio:1;border:1px dashed var(--tk-color-border-default, #cecdcd);border-radius:var(--tk-borderRadius-xs, .125rem);background:var(--tk-color-background-default, #ffffff);color:var(--tk-color-text-muted, #8a8a8b);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:border-color .12s ease,color .12s ease}.tk-color-picker__add-custom:hover{border-color:var(--tk-color-accent-default, #6ad0bc);color:var(--tk-color-accent-default, #6ad0bc)}.tk-color-picker__add-custom:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__remove-custom{appearance:none;padding:0;width:100%;aspect-ratio:1;border:1px dashed var(--tk-color-border-default, #cecdcd);border-radius:var(--tk-borderRadius-xs, .125rem);background:var(--tk-color-background-default, #ffffff);color:var(--tk-color-text-muted, #8a8a8b);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:border-color .12s ease,color .12s ease}.tk-color-picker__remove-custom:hover{border-color:var(--tk-color-accent-default, #6ad0bc);color:var(--tk-color-accent-default, #6ad0bc)}.tk-color-picker__remove-custom:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__hue{appearance:none;width:100%;height:.625rem;border-radius:var(--tk-borderRadius-full, 9999px);outline:none;cursor:pointer;background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.tk-color-picker__hue::-webkit-slider-thumb{appearance:none;width:1.125rem;height:1.125rem;border-radius:var(--tk-borderRadius-full, 50%);background:var(--tk-color-background-default, #ffffff);border:1px solid var(--tk-color-border-default, #cecdcd);cursor:grab}.tk-color-picker__hue::-moz-range-thumb{width:1.125rem;height:1.125rem;border-radius:var(--tk-borderRadius-full, 50%);background:var(--tk-color-background-default, #ffffff);border:1px solid var(--tk-color-border-default, #cecdcd);cursor:grab}.tk-color-picker__hue:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:2px}.tk-color-picker__divider{width:100%;height:1px;background:var(--tk-color-border-subtle, #e4e4e4);flex-shrink:0}.tk-color-picker__hex-row{display:flex;flex-direction:row;align-items:center;gap:var(--tk-spacing-gap-s, .5rem);margin-top:var(--tk-spacing-gap-s, .5rem)}.tk-color-picker__hex-row>span{flex-shrink:0}.tk-color-picker__hex-row tk-button{flex-shrink:0;min-width:2.5rem;min-height:2.5rem}.tk-color-picker__eyedropper{margin-top:-12px}.tk-color-picker__eyedropper:focus,.tk-color-picker__eyedropper:focus-visible{outline:none;box-shadow:none}.tk-color-picker__panel-hex{flex:1;min-width:0}.tk-color-picker__contrast-row{display:flex;align-items:center;gap:var(--tk-spacing-gap-s, .5rem)}.tk-color-picker__contrast-pill{flex-shrink:0;width:2.5rem;height:2rem;border-radius:var(--tk-borderRadius-s, .25rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);display:inline-flex;align-items:center;justify-content:center}.tk-color-picker__contrast-sample{font-size:var(--tk-font-size-paragraph-s, .875rem);font-weight:var(--tk-font-weight-600, 600);line-height:1}.tk-color-picker__contrast-info{flex:1;min-width:0;display:flex;flex-direction:column}.tk-color-picker__contrast-label{font-size:var(--tk-font-size-legal-m, .75rem);font-weight:var(--tk-font-weight-600, 600);color:var(--tk-color-text-default, #222324)}.tk-color-picker__contrast-ratio{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-text-muted, #8a8a8b)}.tk-color-picker__contrast-badge{flex-shrink:0;font-size:var(--tk-font-size-legal-s, .625rem);font-weight:var(--tk-font-weight-600, 600);padding:var(--tk-spacing-padding-xs, .25rem) var(--tk-spacing-padding-s, .5rem);border-radius:var(--tk-borderRadius-full, 9999px)}.tk-color-picker__contrast-badge--aaa,.tk-color-picker__contrast-badge--aa{background:var(--tk-color-feedback-success-muted, #d1fadf);color:var(--tk-color-feedback-success-strong, #114a3f)}.tk-color-picker__contrast-badge--fail{background:var(--tk-color-feedback-danger-muted, #feede8);color:var(--tk-color-feedback-danger-strong, #7f1d1d)}::ng-deep .tk-color-picker-popover{margin:0!important}::ng-deep .tk-color-picker-popover:before,::ng-deep .tk-color-picker-popover:after{display:none!important}::ng-deep .tk-color-picker-popover--input{margin-top:-22px!important}:host ::ng-deep .tk-color-picker__trigger-input--invalid input.p-inputtext{border-color:var(--tk-color-feedback-danger-default, #ff6640)}:host ::ng-deep .tk-color-picker__trigger-input:has(input:focus) .tk-color-picker__input-label{top:-.75rem;left:0;font-size:var(--tk-font-size-legal-m, .75rem);color:var(--tk-color-base-primary-600, #140065);max-width:none;overflow:visible;text-overflow:clip}:host ::ng-deep .tk-color-picker__trigger-input:has(input.p-filled) .tk-color-picker__input-label{top:-.75rem;left:0;font-size:var(--tk-font-size-legal-m, .75rem);color:var(--tk-color-base-surface-950, #191a1b);max-width:none;overflow:visible;text-overflow:clip}:host ::ng-deep .tk-color-picker__trigger-input:has(input.ng-invalid.ng-dirty) .tk-color-picker__input-label,:host ::ng-deep .tk-color-picker__trigger-input:has(input.ng-invalid.ng-touched) .tk-color-picker__input-label{color:var(--tk-color-base-red-700, #cf2604)}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i2.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "ngmodule", type: PopoverModule }, { kind: "component", type: i3.Popover, selector: "p-popover", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions", "motionOptions"], outputs: ["onShow", "onHide"] }, { kind: "component", type: ButtonComponent, selector: "tk-button", inputs: ["label", "disabled", "type", "severity", "variant", "link", "icon", "iconPosition", "tooltipText", "full", "ariaLabel", "size"], outputs: ["clicked"] }, { kind: "component", type: IconComponent, selector: "tk-icon", inputs: ["icon", "styleIcon", "color", "size", "disabled"] }, { kind: "component", type: InputTextComponent, selector: "tk-input-text", inputs: ["value", "control", "label", "type", "id", "icon", "clearable", "errorMessage", "hint", "maxLength"], outputs: ["valueChange"] }, { kind: "component", type: ColorPickerSpectrumComponent, selector: "tk-color-picker-spectrum", inputs: ["hue", "saturation", "brightness", "color", "ariaLabel"], outputs: ["changed"] }, { kind: "component", type: ColorPickerSwatchGridComponent, selector: "tk-color-picker-swatch-grid", inputs: ["colors", "selected", "ariaLabel"], outputs: ["picked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1180
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: ColorPickerComponent, isStandalone: true, selector: "tk-color-picker", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, sections: { classPropertyName: "sections", publicName: "sections", isSignal: true, isRequired: false, transformFunction: null }, presetColors: { classPropertyName: "presetColors", publicName: "presetColors", isSignal: true, isRequired: false, transformFunction: null }, contrastColor: { classPropertyName: "contrastColor", publicName: "contrastColor", isSignal: true, isRequired: false, transformFunction: null }, maxCustomColors: { classPropertyName: "maxCustomColors", publicName: "maxCustomColors", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, emitMode: { classPropertyName: "emitMode", publicName: "emitMode", isSignal: true, isRequired: false, transformFunction: null }, texts: { classPropertyName: "texts", publicName: "texts", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, customColors: { classPropertyName: "customColors", publicName: "customColors", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", customColors: "customColorsChange", colorChange: "colorChange", textColorChange: "textColorChange", validChange: "validChange", opened: "opened", closed: "closed" }, viewQueries: [{ propertyName: "popover", first: true, predicate: ["op"], descendants: true, isSignal: true }, { propertyName: "swatchBtnRef", first: true, predicate: ["swatchBtn"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "inputTriggerRef", first: true, predicate: ["inputTrigger"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "panelHexInput", first: true, predicate: ["panelHexInput"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<div\n class=\"tk-color-picker\"\n [class.tk-color-picker--disabled]=\"isDisabled()\"\n [class.tk-color-picker--open]=\"isOpen()\"\n [class.tk-color-picker--invalid]=\"!isValid()\">\n @if (variant() === 'swatch') {\n @if (label()) {\n <span class=\"tk-color-picker__label\">{{ label() }}</span>\n }\n <button\n #swatchBtn\n type=\"button\"\n class=\"tk-color-picker__trigger tk-color-picker__trigger--swatch\"\n [disabled]=\"isDisabled()\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-label]=\"t().openPickerLabel + (label() ? ': ' + label() : '')\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onTriggerClick($event)\">\n <span\n class=\"tk-color-picker__swatch\"\n [class.tk-color-picker__swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor()\"\n aria-hidden=\"true\"></span>\n <tk-icon\n class=\"tk-color-picker__chevron\"\n [class.tk-color-picker__chevron--open]=\"isOpen()\"\n icon=\"chevron-down\"\n styleIcon=\"regular\"\n size=\"xs\"></tk-icon>\n </button>\n } @else {\n <div\n #inputTrigger\n class=\"tk-color-picker__trigger-input\"\n [class.tk-color-picker__trigger-input--invalid]=\"!isValid()\">\n @if (label()) {\n <label\n class=\"tk-color-picker__input-label\"\n [for]=\"fieldId\"\n [title]=\"label()\"\n >{{ label() }}</label\n >\n }\n <div class=\"tk-color-picker__input-wrap\">\n <button\n type=\"button\"\n class=\"tk-color-picker__input-swatch\"\n [class.tk-color-picker__input-swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor() ?? null\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"t().openPickerLabel\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onTriggerClick($event)\"></button>\n <span class=\"tk-color-picker__input-prefix\" aria-hidden=\"true\">#</span>\n <input\n pInputText\n [id]=\"fieldId\"\n [value]=\"displayHexNoHash()\"\n [disabled]=\"isDisabled()\"\n [class.ng-invalid]=\"triggerControl.invalid\"\n [class.ng-dirty]=\"triggerControl.dirty\"\n [class.ng-touched]=\"triggerControl.touched\"\n [attr.aria-describedby]=\"!isValid() ? errorId : null\"\n [attr.aria-invalid]=\"!isValid()\"\n autocomplete=\"off\"\n (input)=\"onHexNativeInput($event)\"\n (keydown)=\"onHexKeydown($event)\"\n (paste)=\"onHexPaste($event)\"\n (blur)=\"onHexBlur()\" />\n </div>\n <div class=\"tk-color-picker__input-bottom\">\n @if (!isValid()) {\n <p-message\n severity=\"error\"\n size=\"small\"\n variant=\"simple\"\n [id]=\"errorId\"\n >{{ errorText() }}</p-message\n >\n } @else if (hint()) {\n <p-message severity=\"secondary\" size=\"small\" variant=\"simple\">{{\n hint()\n }}</p-message>\n }\n </div>\n </div>\n }\n\n @if (variant() === 'swatch') {\n @if (!isValid()) {\n <span\n [id]=\"errorId\"\n class=\"tk-color-picker__error\"\n role=\"alert\"\n aria-live=\"polite\">\n {{ errorText() }}\n </span>\n } @else if (hint()) {\n <span class=\"tk-color-picker__hint\">{{ hint() }}</span>\n }\n }\n</div>\n\n<p-popover\n #op\n [styleClass]=\"\n 'tk-color-picker-popover' +\n (variant() === 'input' ? ' tk-color-picker-popover--input' : '')\n \"\n position=\"bottom\"\n appendTo=\"body\"\n (onShow)=\"onPopoverShow()\"\n (onHide)=\"onPopoverHide()\">\n <div\n class=\"tk-color-picker__panel\"\n role=\"group\"\n [attr.aria-label]=\"t().dialogLabel\"\n tabindex=\"-1\"\n autofocus\n (keydown.enter)=\"onPanelEnter($event)\"\n (keydown.escape)=\"onPanelEscape($event)\">\n @if (resolvedSections().swatches && presetColors().length) {\n <section class=\"tk-color-picker__section\">\n <span class=\"tk-color-picker__section-label\">{{\n t().swatchesLabel\n }}</span>\n <tk-color-picker-swatch-grid\n [colors]=\"presetColors()\"\n [selected]=\"draftHex()\"\n [ariaLabel]=\"t().swatchesLabel\"\n (picked)=\"onSwatchPick($event)\" />\n </section>\n }\n\n @if (resolvedSections().customColors) {\n <section class=\"tk-color-picker__section\">\n <span class=\"tk-color-picker__section-label\">{{\n t().customColorsLabel\n }}</span>\n <tk-color-picker-swatch-grid\n [colors]=\"customColors()\"\n [selected]=\"draftHex()\"\n [ariaLabel]=\"t().customColorsLabel\"\n (picked)=\"onSwatchPick($event)\">\n @if (canAddCustom()) {\n <button\n type=\"button\"\n class=\"tk-color-picker__add-custom\"\n [attr.aria-label]=\"t().addCustomColorLabel\"\n (click)=\"addCustomColor()\">\n <tk-icon icon=\"plus\" styleIcon=\"regular\" size=\"xs\"></tk-icon>\n </button>\n }\n @if (isCustomColorSelected()) {\n <button\n type=\"button\"\n class=\"tk-color-picker__remove-custom\"\n [attr.aria-label]=\"t().removeCustomColorLabel\"\n (click)=\"removeCustomColor()\">\n \u2212\n </button>\n }\n </tk-color-picker-swatch-grid>\n </section>\n }\n\n @if (\n resolvedSections().customColors &&\n (resolvedSections().spectrum ||\n resolvedSections().hue ||\n resolvedSections().hex)\n ) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (resolvedSections().spectrum) {\n <tk-color-picker-spectrum\n [hue]=\"hue()\"\n [saturation]=\"saturation()\"\n [brightness]=\"brightness()\"\n [color]=\"swatchColor() ?? ''\"\n [ariaLabel]=\"t().spectrumLabel\"\n (changed)=\"onSpectrumChange($event)\" />\n }\n\n @if (resolvedSections().hue) {\n <input\n class=\"tk-color-picker__hue\"\n type=\"range\"\n min=\"0\"\n max=\"360\"\n [value]=\"hue()\"\n [attr.aria-label]=\"t().hueLabel\"\n (input)=\"onHueChange($event)\" />\n }\n\n @if (\n (resolvedSections().spectrum || resolvedSections().hue) &&\n resolvedSections().hex\n ) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (resolvedSections().hex) {\n <section class=\"tk-color-picker__section tk-color-picker__hex-row\">\n <span\n class=\"tk-color-picker__swatch tk-color-picker__swatch--large\"\n [class.tk-color-picker__swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor()\"\n aria-hidden=\"true\"></span>\n <tk-input-text\n #panelHexInput\n class=\"tk-color-picker__panel-hex\"\n [class.tk-color-picker__trigger-input--invalid]=\"!isValid()\"\n [label]=\"t().hexLabel\"\n [id]=\"panelFieldId\"\n [value]=\"displayHexNoHash()\"\n prefixText=\"#\"\n (input)=\"onHexNativeInput($event)\"\n (keydown)=\"onHexKeydown($event)\"\n (paste)=\"onHexPaste($event)\"\n (focusout)=\"onHexBlur()\" />\n @if (showEyedropper()) {\n <tk-button\n class=\"tk-color-picker__eyedropper\"\n tabindex=\"-1\"\n severity=\"secondary\"\n variant=\"outlined\"\n icon=\"eye-dropper\"\n styleIcon=\"regular\"\n [attr.aria-label]=\"t().eyedropperLabel\"\n (clicked)=\"openEyeDropper()\">\n </tk-button>\n }\n </section>\n }\n\n @if (resolvedSections().hex && showContrast()) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (showContrast()) {\n <section class=\"tk-color-picker__section tk-color-picker__contrast\">\n <span class=\"tk-color-picker__section-label\">{{\n t().contrastLabel\n }}</span>\n <div class=\"tk-color-picker__contrast-row\">\n <span\n class=\"tk-color-picker__contrast-pill\"\n [style.background-color]=\"draftHex()\"\n [attr.aria-label]=\"t().contrastSampleLabel\">\n <span\n class=\"tk-color-picker__contrast-sample\"\n [style.color]=\"contrastTextColor()\">\n {{ t().contrastSampleText }}\n </span>\n </span>\n <div class=\"tk-color-picker__contrast-info\">\n <span class=\"tk-color-picker__contrast-label\">{{\n t().contrastSampleLabel\n }}</span>\n <span class=\"tk-color-picker__contrast-ratio\"\n >{{ contrastResult()!.ratio }}:1</span\n >\n </div>\n @switch (contrastResult()!.level) {\n @case ('AAA') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--aaa\"\n >AAA</span\n >\n }\n @case ('AA') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--aa\"\n >AA</span\n >\n }\n @case ('fail') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--fail\">\n {{ t().contrastLowLabel }}\n </span>\n }\n }\n </div>\n </section>\n }\n </div>\n</p-popover>\n", styles: [":host{display:inline-block;font-family:var(--tk-font-family, sans-serif)}.tk-color-picker{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-xs, .25rem)}.tk-color-picker__label{font-size:var(--tk-font-size-paragraph-m, 1rem);font-weight:var(--tk-font-weight-400, 400);color:var(--tk-color-base-surface-950, #191a1b);margin-bottom:.25rem}.tk-color-picker__trigger{display:flex;align-items:center;gap:var(--tk-spacing-gap-s, .5rem);padding:var(--tk-spacing-padding-xs, .25rem) var(--tk-spacing-padding-s, .5rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);border-radius:var(--tk-borderRadius-s, .25rem);background:var(--tk-color-background-default, #ffffff);cursor:pointer;transition:border-color .14s ease,background .14s ease}.tk-color-picker__trigger:hover{border-color:var(--tk-color-border-default, #cecdcd)}.tk-color-picker__trigger:focus-within{border-color:var(--tk-color-border-focus, #16006f)}.tk-color-picker__trigger--swatch{appearance:none;width:fit-content;font:inherit;-webkit-user-select:none;user-select:none}.tk-color-picker__trigger--swatch>*{pointer-events:none}.tk-color-picker__trigger--swatch:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__trigger--swatch:disabled{cursor:not-allowed}.tk-color-picker__trigger-input{display:flex;flex-direction:column;position:relative}.tk-color-picker__input-label{position:absolute;left:var(--tk-spacing-base-300, 3rem);top:.75rem;font-size:var(--tk-font-size-paragraph-m, 1rem);font-weight:var(--tk-font-weight-400, 400);color:var(--tk-color-base-surface-500, #8a8a8b);background:var(--tk-color-background-default, #ffffff);padding:0 .25rem;transition:top .2s ease,left .2s ease,color .2s ease;pointer-events:none;z-index:1;max-width:calc(100% - 4rem);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tk-color-picker--disabled .tk-color-picker__input-label{display:none}.tk-color-picker--invalid .tk-color-picker__input-label{color:var(--tk-color-base-red-700, #cf2604)}.tk-color-picker__input-wrap{position:relative;display:flex;align-items:center;width:100%}.tk-color-picker__input-wrap input.p-inputtext{width:100%;flex:1;border:none;border-bottom:.0625rem solid var(--tk-color-base-surface-300, #d2d2d2);border-radius:0;padding:var(--tk-spacing-base-75, .75rem);padding-left:var(--tk-spacing-base-300, 3rem);color:var(--tk-color-base-surface-950, #191a1b);background-color:transparent;outline:none}.tk-color-picker__input-wrap input.p-inputtext:focus{border-color:var(--tk-color-base-primary-600, #140065);box-shadow:none}.tk-color-picker__input-wrap input.p-inputtext.ng-invalid.ng-dirty,.tk-color-picker__input-wrap input.p-inputtext.ng-invalid.ng-touched{border-color:var(--tk-color-base-red-700, #cf2604)}.tk-color-picker__input-wrap input.p-inputtext:disabled{background-color:var(--tk-color-base-surface-200, #e4e4e4);color:var(--tk-color-base-surface-500, #8a8a8b);opacity:1}.tk-color-picker__input-swatch{appearance:none;padding:0;position:absolute;left:var(--tk-spacing-base-25, .25rem);top:50%;transform:translateY(-50%);width:1.25rem;height:1.25rem;border-radius:var(--tk-borderRadius-xs, .125rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);flex-shrink:0;cursor:pointer;z-index:1;-webkit-user-select:none;user-select:none;background:transparent}.tk-color-picker__input-swatch--fallback{background:var(--tk-color-base-surface-400, #cecdcd)}.tk-color-picker__input-swatch:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__input-swatch:disabled{cursor:not-allowed;opacity:.5}.tk-color-picker__input-prefix{position:absolute;left:calc(var(--tk-spacing-base-25, .25rem) + 1.25rem + .25rem);top:50%;transform:translateY(-50%);color:var(--tk-color-text-muted, #8a8a8b);font-size:var(--tk-font-size-paragraph-s, .875rem);line-height:1;pointer-events:none;z-index:1}.tk-color-picker__input-bottom{display:flex;margin-top:.25rem;min-height:1.25rem}.tk-color-picker--open .tk-color-picker__trigger{border-color:var(--tk-color-border-strong, #424243)}.tk-color-picker--invalid .tk-color-picker__trigger{border-color:var(--tk-color-feedback-danger-default, #ff6640)}.tk-color-picker--disabled .tk-color-picker__trigger{opacity:.55;cursor:not-allowed;pointer-events:none;background:var(--tk-color-background-soft, #f2f1f1)}.tk-color-picker__swatch{flex-shrink:0;width:1.25rem;height:1.25rem;border-radius:var(--tk-borderRadius-xs, .125rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4)}.tk-color-picker__swatch--fallback{background:var(--tk-color-base-surface-400, #cecdcd)}.tk-color-picker__swatch--large{width:2rem;height:2rem;border-radius:var(--tk-borderRadius-s, .25rem)}.tk-color-picker__chevron{transition:transform .2s ease}.tk-color-picker__chevron--open{transform:rotate(180deg)}.tk-color-picker__error{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-feedback-danger-default, #ff6640)}.tk-color-picker__hint{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-text-muted, #8a8a8b)}.tk-color-picker__panel{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-m, .75rem);width:16rem;padding:var(--tk-spacing-padding-m, 1rem);box-sizing:border-box}.tk-color-picker__panel:focus,.tk-color-picker__panel:focus-visible{outline:none}.tk-color-picker__section{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-xs, .25rem)}.tk-color-picker__section-label{font-size:var(--tk-font-size-legal-m, .75rem);font-weight:var(--tk-font-weight-600, 600);color:var(--tk-color-text-subtle, #5d5d5e)}.tk-color-picker__add-custom{appearance:none;padding:0;width:100%;aspect-ratio:1;border:1px dashed var(--tk-color-border-default, #cecdcd);border-radius:var(--tk-borderRadius-xs, .125rem);background:var(--tk-color-background-default, #ffffff);color:var(--tk-color-text-muted, #8a8a8b);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:border-color .12s ease,color .12s ease}.tk-color-picker__add-custom:hover{border-color:var(--tk-color-accent-default, #6ad0bc);color:var(--tk-color-accent-default, #6ad0bc)}.tk-color-picker__add-custom:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__remove-custom{appearance:none;padding:0;width:100%;aspect-ratio:1;border:1px dashed var(--tk-color-border-default, #cecdcd);border-radius:var(--tk-borderRadius-xs, .125rem);background:var(--tk-color-background-default, #ffffff);color:var(--tk-color-text-muted, #8a8a8b);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:border-color .12s ease,color .12s ease}.tk-color-picker__remove-custom:hover{border-color:var(--tk-color-accent-default, #6ad0bc);color:var(--tk-color-accent-default, #6ad0bc)}.tk-color-picker__remove-custom:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__hue{appearance:none;width:100%;height:.625rem;border-radius:var(--tk-borderRadius-full, 9999px);outline:none;cursor:pointer;background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.tk-color-picker__hue::-webkit-slider-thumb{appearance:none;width:1.125rem;height:1.125rem;border-radius:var(--tk-borderRadius-full, 50%);background:var(--tk-color-background-default, #ffffff);border:1px solid var(--tk-color-border-default, #cecdcd);cursor:grab}.tk-color-picker__hue::-moz-range-thumb{width:1.125rem;height:1.125rem;border-radius:var(--tk-borderRadius-full, 50%);background:var(--tk-color-background-default, #ffffff);border:1px solid var(--tk-color-border-default, #cecdcd);cursor:grab}.tk-color-picker__hue:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:2px}.tk-color-picker__divider{width:100%;height:1px;background:var(--tk-color-border-subtle, #e4e4e4);flex-shrink:0}.tk-color-picker__hex-row{display:flex;flex-direction:row;align-items:center;gap:var(--tk-spacing-gap-s, .5rem);margin-top:var(--tk-spacing-gap-s, .5rem)}.tk-color-picker__hex-row>span{flex-shrink:0}.tk-color-picker__hex-row tk-button{flex-shrink:0;min-width:2.5rem;min-height:2.5rem}.tk-color-picker__eyedropper{margin-top:-12px}.tk-color-picker__eyedropper:focus,.tk-color-picker__eyedropper:focus-visible{outline:none;box-shadow:none}.tk-color-picker__panel-hex{flex:1;min-width:0}.tk-color-picker__contrast-row{display:flex;align-items:center;gap:var(--tk-spacing-gap-s, .5rem)}.tk-color-picker__contrast-pill{flex-shrink:0;width:2.5rem;height:2rem;border-radius:var(--tk-borderRadius-s, .25rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);display:inline-flex;align-items:center;justify-content:center}.tk-color-picker__contrast-sample{font-size:var(--tk-font-size-paragraph-s, .875rem);font-weight:var(--tk-font-weight-600, 600);line-height:1}.tk-color-picker__contrast-info{flex:1;min-width:0;display:flex;flex-direction:column}.tk-color-picker__contrast-label{font-size:var(--tk-font-size-legal-m, .75rem);font-weight:var(--tk-font-weight-600, 600);color:var(--tk-color-text-default, #222324)}.tk-color-picker__contrast-ratio{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-text-muted, #8a8a8b)}.tk-color-picker__contrast-badge{flex-shrink:0;font-size:var(--tk-font-size-legal-s, .625rem);font-weight:var(--tk-font-weight-600, 600);padding:var(--tk-spacing-padding-xs, .25rem) var(--tk-spacing-padding-s, .5rem);border-radius:var(--tk-borderRadius-full, 9999px)}.tk-color-picker__contrast-badge--aaa,.tk-color-picker__contrast-badge--aa{background:var(--tk-color-feedback-success-muted, #d1fadf);color:var(--tk-color-feedback-success-strong, #114a3f)}.tk-color-picker__contrast-badge--fail{background:var(--tk-color-feedback-danger-muted, #feede8);color:var(--tk-color-feedback-danger-strong, #7f1d1d)}::ng-deep .tk-color-picker-popover{margin:0!important}::ng-deep .tk-color-picker-popover:before,::ng-deep .tk-color-picker-popover:after{display:none!important}::ng-deep .tk-color-picker-popover--input{margin-top:-22px!important}:host ::ng-deep .tk-color-picker__trigger-input--invalid input.p-inputtext{border-color:var(--tk-color-feedback-danger-default, #ff6640)}:host ::ng-deep .tk-color-picker__trigger-input:has(input:focus) .tk-color-picker__input-label{top:-.75rem;left:0;font-size:var(--tk-font-size-legal-m, .75rem);color:var(--tk-color-base-primary-600, #140065);max-width:none;overflow:visible;text-overflow:clip}:host ::ng-deep .tk-color-picker__trigger-input:has(input.p-filled) .tk-color-picker__input-label{top:-.75rem;left:0;font-size:var(--tk-font-size-legal-m, .75rem);color:var(--tk-color-base-surface-950, #191a1b);max-width:none;overflow:visible;text-overflow:clip}:host ::ng-deep .tk-color-picker__trigger-input:has(input.ng-invalid.ng-dirty) .tk-color-picker__input-label,:host ::ng-deep .tk-color-picker__trigger-input:has(input.ng-invalid.ng-touched) .tk-color-picker__input-label{color:var(--tk-color-base-red-700, #cf2604)}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i2.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "ngmodule", type: PopoverModule }, { kind: "component", type: i3.Popover, selector: "p-popover", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions", "motionOptions"], outputs: ["onShow", "onHide"] }, { kind: "component", type: ButtonComponent, selector: "tk-button", inputs: ["label", "disabled", "type", "severity", "variant", "link", "icon", "iconPosition", "tooltipText", "full", "ariaLabel", "size"], outputs: ["clicked"] }, { kind: "component", type: IconComponent, selector: "tk-icon", inputs: ["icon", "styleIcon", "color", "size", "disabled"] }, { kind: "component", type: InputTextComponent, selector: "tk-input-text", inputs: ["value", "control", "label", "type", "id", "icon", "clearable", "errorMessage", "hint", "maxLength"], outputs: ["valueChange"] }, { kind: "component", type: ColorPickerSpectrumComponent, selector: "tk-color-picker-spectrum", inputs: ["hue", "saturation", "brightness", "color", "ariaLabel"], outputs: ["changed"] }, { kind: "component", type: ColorPickerSwatchGridComponent, selector: "tk-color-picker-swatch-grid", inputs: ["colors", "selected", "ariaLabel"], outputs: ["picked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1007
1181
|
}
|
|
1008
1182
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ColorPickerComponent, decorators: [{
|
|
1009
1183
|
type: Component,
|
|
@@ -1017,8 +1191,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1017
1191
|
InputTextComponent,
|
|
1018
1192
|
ColorPickerSpectrumComponent,
|
|
1019
1193
|
ColorPickerSwatchGridComponent,
|
|
1020
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"tk-color-picker\"\n [class.tk-color-picker--disabled]=\"isDisabled()\"\n [class.tk-color-picker--open]=\"isOpen()\"\n [class.tk-color-picker--invalid]=\"!isValid()\">\n @if (variant() === 'swatch') {\n @if (label()) {\n <span class=\"tk-color-picker__label\">{{ label() }}</span>\n }\n <button\n #swatchBtn\n type=\"button\"\n class=\"tk-color-picker__trigger tk-color-picker__trigger--swatch\"\n [disabled]=\"isDisabled()\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-label]=\"t().openPickerLabel + (label() ? ': ' + label() : '')\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onTriggerClick($event)\">\n <span\n class=\"tk-color-picker__swatch\"\n [class.tk-color-picker__swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor()\"\n aria-hidden=\"true\"></span>\n <tk-icon\n class=\"tk-color-picker__chevron\"\n [class.tk-color-picker__chevron--open]=\"isOpen()\"\n icon=\"chevron-down\"\n styleIcon=\"regular\"\n size=\"xs\"></tk-icon>\n </button>\n } @else {\n <div\n #inputTrigger\n class=\"tk-color-picker__trigger-input\"\n [class.tk-color-picker__trigger-input--invalid]=\"!isValid()\">\n @if (label()) {\n <label\n class=\"tk-color-picker__input-label\"\n [for]=\"fieldId\"\n [title]=\"label()\"\n >{{ label() }}</label\n >\n }\n <div class=\"tk-color-picker__input-wrap\">\n <button\n type=\"button\"\n class=\"tk-color-picker__input-swatch\"\n [class.tk-color-picker__input-swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor() ?? null\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"t().openPickerLabel\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onTriggerClick($event)\"></button>\n <span class=\"tk-color-picker__input-prefix\" aria-hidden=\"true\">#</span>\n <input\n pInputText\n [id]=\"fieldId\"\n [value]=\"displayHexNoHash()\"\n [disabled]=\"isDisabled()\"\n [class.ng-invalid]=\"triggerControl.invalid\"\n [class.ng-dirty]=\"triggerControl.dirty\"\n [class.ng-touched]=\"triggerControl.touched\"\n [attr.aria-describedby]=\"!isValid() ? errorId : null\"\n [attr.aria-invalid]=\"!isValid()\"\n autocomplete=\"off\"\n (input)=\"onHexNativeInput($event)\"\n (keydown)=\"onHexKeydown($event)\"\n (paste)=\"onHexPaste($event)\"\n (blur)=\"onHexBlur()\" />\n </div>\n <div class=\"tk-color-picker__input-bottom\">\n @if (!isValid()) {\n <p-message\n severity=\"error\"\n size=\"small\"\n variant=\"simple\"\n [id]=\"errorId\"\n >{{ errorText() }}</p-message\n >\n } @else if (hint()) {\n <p-message severity=\"secondary\" size=\"small\" variant=\"simple\">{{\n hint()\n }}</p-message>\n }\n </div>\n </div>\n }\n\n @if (variant() === 'swatch') {\n @if (!isValid()) {\n <span\n [id]=\"errorId\"\n class=\"tk-color-picker__error\"\n role=\"alert\"\n aria-live=\"polite\">\n {{ errorText() }}\n </span>\n } @else if (hint()) {\n <span class=\"tk-color-picker__hint\">{{ hint() }}</span>\n }\n }\n</div>\n\n<p-popover\n #op\n [styleClass]=\"\n 'tk-color-picker-popover' +\n (variant() === 'input' ? ' tk-color-picker-popover--input' : '')\n \"\n position=\"bottom\"\n appendTo=\"body\"\n (onShow)=\"onPopoverShow()\"\n (onHide)=\"onPopoverHide()\">\n <div\n class=\"tk-color-picker__panel\"\n role=\"group\"\n [attr.aria-label]=\"t().dialogLabel\"\n tabindex=\"-1\"\n autofocus\n (keydown.enter)=\"onPanelEnter($event)\">\n @if (resolvedSections().swatches && presetColors().length) {\n <section class=\"tk-color-picker__section\">\n <span class=\"tk-color-picker__section-label\">{{\n t().swatchesLabel\n }}</span>\n <tk-color-picker-swatch-grid\n [colors]=\"presetColors()\"\n [selected]=\"draftHex()\"\n [ariaLabel]=\"t().swatchesLabel\"\n (picked)=\"onSwatchPick($event)\" />\n </section>\n }\n\n @if (resolvedSections().customColors) {\n <section class=\"tk-color-picker__section\">\n <span class=\"tk-color-picker__section-label\">{{\n t().customColorsLabel\n }}</span>\n <tk-color-picker-swatch-grid\n [colors]=\"customColors()\"\n [selected]=\"draftHex()\"\n [ariaLabel]=\"t().customColorsLabel\"\n (picked)=\"onSwatchPick($event)\">\n @if (canAddCustom()) {\n <button\n type=\"button\"\n class=\"tk-color-picker__add-custom\"\n [attr.aria-label]=\"t().addCustomColorLabel\"\n (click)=\"addCustomColor()\">\n <tk-icon icon=\"plus\" styleIcon=\"regular\" size=\"xs\"></tk-icon>\n </button>\n }\n @if (isCustomColorSelected()) {\n <button\n type=\"button\"\n class=\"tk-color-picker__remove-custom\"\n [attr.aria-label]=\"t().removeCustomColorLabel\"\n (click)=\"removeCustomColor()\">\n \u2212\n </button>\n }\n </tk-color-picker-swatch-grid>\n </section>\n }\n\n @if (\n resolvedSections().customColors &&\n (resolvedSections().spectrum ||\n resolvedSections().hue ||\n resolvedSections().hex)\n ) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (resolvedSections().spectrum) {\n <tk-color-picker-spectrum\n [hue]=\"hue()\"\n [saturation]=\"saturation()\"\n [brightness]=\"brightness()\"\n [color]=\"swatchColor() ?? ''\"\n [ariaLabel]=\"t().spectrumLabel\"\n (changed)=\"onSpectrumChange($event)\" />\n }\n\n @if (resolvedSections().hue) {\n <input\n class=\"tk-color-picker__hue\"\n type=\"range\"\n min=\"0\"\n max=\"360\"\n [value]=\"hue()\"\n [attr.aria-label]=\"t().hueLabel\"\n (input)=\"onHueChange($event)\" />\n }\n\n @if (\n (resolvedSections().spectrum || resolvedSections().hue) &&\n resolvedSections().hex\n ) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (resolvedSections().hex) {\n <section class=\"tk-color-picker__section tk-color-picker__hex-row\">\n <span\n class=\"tk-color-picker__swatch tk-color-picker__swatch--large\"\n [class.tk-color-picker__swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor()\"\n aria-hidden=\"true\"></span>\n <tk-input-text\n #panelHexInput\n class=\"tk-color-picker__panel-hex\"\n [class.tk-color-picker__trigger-input--invalid]=\"!isValid()\"\n [label]=\"t().hexLabel\"\n [id]=\"panelFieldId\"\n [value]=\"displayHexNoHash()\"\n prefixText=\"#\"\n (input)=\"onHexNativeInput($event)\"\n (keydown)=\"onHexKeydown($event)\"\n (paste)=\"onHexPaste($event)\"\n (focusout)=\"onHexBlur()\" />\n @if (showEyedropper()) {\n <tk-button\n class=\"tk-color-picker__eyedropper\"\n tabindex=\"-1\"\n severity=\"secondary\"\n variant=\"outlined\"\n icon=\"eye-dropper\"\n styleIcon=\"regular\"\n [attr.aria-label]=\"t().eyedropperLabel\"\n (clicked)=\"openEyeDropper()\">\n </tk-button>\n }\n </section>\n }\n\n @if (resolvedSections().hex && showContrast()) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (showContrast()) {\n <section class=\"tk-color-picker__section tk-color-picker__contrast\">\n <span class=\"tk-color-picker__section-label\">{{\n t().contrastLabel\n }}</span>\n <div class=\"tk-color-picker__contrast-row\">\n <span\n class=\"tk-color-picker__contrast-pill\"\n [style.background-color]=\"draftHex()\"\n [attr.aria-label]=\"t().contrastSampleLabel\">\n <span\n class=\"tk-color-picker__contrast-sample\"\n [style.color]=\"contrastTextColor()\">\n {{ t().contrastSampleText }}\n </span>\n </span>\n <div class=\"tk-color-picker__contrast-info\">\n <span class=\"tk-color-picker__contrast-label\">{{\n t().contrastSampleLabel\n }}</span>\n <span class=\"tk-color-picker__contrast-ratio\"\n >{{ contrastResult()!.ratio }}:1</span\n >\n </div>\n @switch (contrastResult()!.level) {\n @case ('AAA') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--aaa\"\n >AAA</span\n >\n }\n @case ('AA') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--aa\"\n >AA</span\n >\n }\n @case ('fail') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--fail\">\n {{ t().contrastLowLabel }}\n </span>\n }\n }\n </div>\n </section>\n }\n </div>\n</p-popover>\n", styles: [":host{display:inline-block;font-family:var(--tk-font-family, sans-serif)}.tk-color-picker{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-xs, .25rem)}.tk-color-picker__label{font-size:var(--tk-font-size-paragraph-m, 1rem);font-weight:var(--tk-font-weight-400, 400);color:var(--tk-color-base-surface-950, #191a1b);margin-bottom:.25rem}.tk-color-picker__trigger{display:flex;align-items:center;gap:var(--tk-spacing-gap-s, .5rem);padding:var(--tk-spacing-padding-xs, .25rem) var(--tk-spacing-padding-s, .5rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);border-radius:var(--tk-borderRadius-s, .25rem);background:var(--tk-color-background-default, #ffffff);cursor:pointer;transition:border-color .14s ease,background .14s ease}.tk-color-picker__trigger:hover{border-color:var(--tk-color-border-default, #cecdcd)}.tk-color-picker__trigger:focus-within{border-color:var(--tk-color-border-focus, #16006f)}.tk-color-picker__trigger--swatch{appearance:none;width:fit-content;font:inherit;-webkit-user-select:none;user-select:none}.tk-color-picker__trigger--swatch>*{pointer-events:none}.tk-color-picker__trigger--swatch:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__trigger--swatch:disabled{cursor:not-allowed}.tk-color-picker__trigger-input{display:flex;flex-direction:column;position:relative}.tk-color-picker__input-label{position:absolute;left:var(--tk-spacing-base-300, 3rem);top:.75rem;font-size:var(--tk-font-size-paragraph-m, 1rem);font-weight:var(--tk-font-weight-400, 400);color:var(--tk-color-base-surface-500, #8a8a8b);background:var(--tk-color-background-default, #ffffff);padding:0 .25rem;transition:top .2s ease,left .2s ease,color .2s ease;pointer-events:none;z-index:1;max-width:calc(100% - 4rem);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tk-color-picker--disabled .tk-color-picker__input-label{display:none}.tk-color-picker--invalid .tk-color-picker__input-label{color:var(--tk-color-base-red-700, #cf2604)}.tk-color-picker__input-wrap{position:relative;display:flex;align-items:center;width:100%}.tk-color-picker__input-wrap input.p-inputtext{width:100%;flex:1;border:none;border-bottom:.0625rem solid var(--tk-color-base-surface-300, #d2d2d2);border-radius:0;padding:var(--tk-spacing-base-75, .75rem);padding-left:var(--tk-spacing-base-300, 3rem);color:var(--tk-color-base-surface-950, #191a1b);background-color:transparent;outline:none}.tk-color-picker__input-wrap input.p-inputtext:focus{border-color:var(--tk-color-base-primary-600, #140065);box-shadow:none}.tk-color-picker__input-wrap input.p-inputtext.ng-invalid.ng-dirty,.tk-color-picker__input-wrap input.p-inputtext.ng-invalid.ng-touched{border-color:var(--tk-color-base-red-700, #cf2604)}.tk-color-picker__input-wrap input.p-inputtext:disabled{background-color:var(--tk-color-base-surface-200, #e4e4e4);color:var(--tk-color-base-surface-500, #8a8a8b);opacity:1}.tk-color-picker__input-swatch{appearance:none;padding:0;position:absolute;left:var(--tk-spacing-base-25, .25rem);top:50%;transform:translateY(-50%);width:1.25rem;height:1.25rem;border-radius:var(--tk-borderRadius-xs, .125rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);flex-shrink:0;cursor:pointer;z-index:1;-webkit-user-select:none;user-select:none;background:transparent}.tk-color-picker__input-swatch--fallback{background:var(--tk-color-base-surface-400, #cecdcd)}.tk-color-picker__input-swatch:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__input-swatch:disabled{cursor:not-allowed;opacity:.5}.tk-color-picker__input-prefix{position:absolute;left:calc(var(--tk-spacing-base-25, .25rem) + 1.25rem + .25rem);top:50%;transform:translateY(-50%);color:var(--tk-color-text-muted, #8a8a8b);font-size:var(--tk-font-size-paragraph-s, .875rem);line-height:1;pointer-events:none;z-index:1}.tk-color-picker__input-bottom{display:flex;margin-top:.25rem;min-height:1.25rem}.tk-color-picker--open .tk-color-picker__trigger{border-color:var(--tk-color-border-strong, #424243)}.tk-color-picker--invalid .tk-color-picker__trigger{border-color:var(--tk-color-feedback-danger-default, #ff6640)}.tk-color-picker--disabled .tk-color-picker__trigger{opacity:.55;cursor:not-allowed;pointer-events:none;background:var(--tk-color-background-soft, #f2f1f1)}.tk-color-picker__swatch{flex-shrink:0;width:1.25rem;height:1.25rem;border-radius:var(--tk-borderRadius-xs, .125rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4)}.tk-color-picker__swatch--fallback{background:var(--tk-color-base-surface-400, #cecdcd)}.tk-color-picker__swatch--large{width:2rem;height:2rem;border-radius:var(--tk-borderRadius-s, .25rem)}.tk-color-picker__chevron{transition:transform .2s ease}.tk-color-picker__chevron--open{transform:rotate(180deg)}.tk-color-picker__error{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-feedback-danger-default, #ff6640)}.tk-color-picker__hint{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-text-muted, #8a8a8b)}.tk-color-picker__panel{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-m, .75rem);width:16rem;padding:var(--tk-spacing-padding-m, 1rem);box-sizing:border-box}.tk-color-picker__panel:focus,.tk-color-picker__panel:focus-visible{outline:none}.tk-color-picker__section{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-xs, .25rem)}.tk-color-picker__section-label{font-size:var(--tk-font-size-legal-m, .75rem);font-weight:var(--tk-font-weight-600, 600);color:var(--tk-color-text-subtle, #5d5d5e)}.tk-color-picker__add-custom{appearance:none;padding:0;width:100%;aspect-ratio:1;border:1px dashed var(--tk-color-border-default, #cecdcd);border-radius:var(--tk-borderRadius-xs, .125rem);background:var(--tk-color-background-default, #ffffff);color:var(--tk-color-text-muted, #8a8a8b);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:border-color .12s ease,color .12s ease}.tk-color-picker__add-custom:hover{border-color:var(--tk-color-accent-default, #6ad0bc);color:var(--tk-color-accent-default, #6ad0bc)}.tk-color-picker__add-custom:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__remove-custom{appearance:none;padding:0;width:100%;aspect-ratio:1;border:1px dashed var(--tk-color-border-default, #cecdcd);border-radius:var(--tk-borderRadius-xs, .125rem);background:var(--tk-color-background-default, #ffffff);color:var(--tk-color-text-muted, #8a8a8b);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:border-color .12s ease,color .12s ease}.tk-color-picker__remove-custom:hover{border-color:var(--tk-color-accent-default, #6ad0bc);color:var(--tk-color-accent-default, #6ad0bc)}.tk-color-picker__remove-custom:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__hue{appearance:none;width:100%;height:.625rem;border-radius:var(--tk-borderRadius-full, 9999px);outline:none;cursor:pointer;background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.tk-color-picker__hue::-webkit-slider-thumb{appearance:none;width:1.125rem;height:1.125rem;border-radius:var(--tk-borderRadius-full, 50%);background:var(--tk-color-background-default, #ffffff);border:1px solid var(--tk-color-border-default, #cecdcd);cursor:grab}.tk-color-picker__hue::-moz-range-thumb{width:1.125rem;height:1.125rem;border-radius:var(--tk-borderRadius-full, 50%);background:var(--tk-color-background-default, #ffffff);border:1px solid var(--tk-color-border-default, #cecdcd);cursor:grab}.tk-color-picker__hue:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:2px}.tk-color-picker__divider{width:100%;height:1px;background:var(--tk-color-border-subtle, #e4e4e4);flex-shrink:0}.tk-color-picker__hex-row{display:flex;flex-direction:row;align-items:center;gap:var(--tk-spacing-gap-s, .5rem);margin-top:var(--tk-spacing-gap-s, .5rem)}.tk-color-picker__hex-row>span{flex-shrink:0}.tk-color-picker__hex-row tk-button{flex-shrink:0;min-width:2.5rem;min-height:2.5rem}.tk-color-picker__eyedropper{margin-top:-12px}.tk-color-picker__eyedropper:focus,.tk-color-picker__eyedropper:focus-visible{outline:none;box-shadow:none}.tk-color-picker__panel-hex{flex:1;min-width:0}.tk-color-picker__contrast-row{display:flex;align-items:center;gap:var(--tk-spacing-gap-s, .5rem)}.tk-color-picker__contrast-pill{flex-shrink:0;width:2.5rem;height:2rem;border-radius:var(--tk-borderRadius-s, .25rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);display:inline-flex;align-items:center;justify-content:center}.tk-color-picker__contrast-sample{font-size:var(--tk-font-size-paragraph-s, .875rem);font-weight:var(--tk-font-weight-600, 600);line-height:1}.tk-color-picker__contrast-info{flex:1;min-width:0;display:flex;flex-direction:column}.tk-color-picker__contrast-label{font-size:var(--tk-font-size-legal-m, .75rem);font-weight:var(--tk-font-weight-600, 600);color:var(--tk-color-text-default, #222324)}.tk-color-picker__contrast-ratio{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-text-muted, #8a8a8b)}.tk-color-picker__contrast-badge{flex-shrink:0;font-size:var(--tk-font-size-legal-s, .625rem);font-weight:var(--tk-font-weight-600, 600);padding:var(--tk-spacing-padding-xs, .25rem) var(--tk-spacing-padding-s, .5rem);border-radius:var(--tk-borderRadius-full, 9999px)}.tk-color-picker__contrast-badge--aaa,.tk-color-picker__contrast-badge--aa{background:var(--tk-color-feedback-success-muted, #d1fadf);color:var(--tk-color-feedback-success-strong, #114a3f)}.tk-color-picker__contrast-badge--fail{background:var(--tk-color-feedback-danger-muted, #feede8);color:var(--tk-color-feedback-danger-strong, #7f1d1d)}::ng-deep .tk-color-picker-popover{margin:0!important}::ng-deep .tk-color-picker-popover:before,::ng-deep .tk-color-picker-popover:after{display:none!important}::ng-deep .tk-color-picker-popover--input{margin-top:-22px!important}:host ::ng-deep .tk-color-picker__trigger-input--invalid input.p-inputtext{border-color:var(--tk-color-feedback-danger-default, #ff6640)}:host ::ng-deep .tk-color-picker__trigger-input:has(input:focus) .tk-color-picker__input-label{top:-.75rem;left:0;font-size:var(--tk-font-size-legal-m, .75rem);color:var(--tk-color-base-primary-600, #140065);max-width:none;overflow:visible;text-overflow:clip}:host ::ng-deep .tk-color-picker__trigger-input:has(input.p-filled) .tk-color-picker__input-label{top:-.75rem;left:0;font-size:var(--tk-font-size-legal-m, .75rem);color:var(--tk-color-base-surface-950, #191a1b);max-width:none;overflow:visible;text-overflow:clip}:host ::ng-deep .tk-color-picker__trigger-input:has(input.ng-invalid.ng-dirty) .tk-color-picker__input-label,:host ::ng-deep .tk-color-picker__trigger-input:has(input.ng-invalid.ng-touched) .tk-color-picker__input-label{color:var(--tk-color-base-red-700, #cf2604)}\n"] }]
|
|
1021
|
-
}], ctorParameters: () => [], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], sections: [{ type: i0.Input, args: [{ isSignal: true, alias: "sections", required: false }] }], presetColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "presetColors", required: false }] }], contrastColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "contrastColor", required: false }] }], maxCustomColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxCustomColors", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], customColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "customColors", required: false }] }, { type: i0.Output, args: ["customColorsChange"] }], colorChange: [{ type: i0.Output, args: ["colorChange"] }], textColorChange: [{ type: i0.Output, args: ["textColorChange"] }], validChange: [{ type: i0.Output, args: ["validChange"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], popover: [{ type: i0.ViewChild, args: ['op', { isSignal: true }] }], swatchBtnRef: [{ type: i0.ViewChild, args: ['swatchBtn', { ...{ read: ElementRef }, isSignal: true }] }], inputTriggerRef: [{ type: i0.ViewChild, args: ['inputTrigger', { ...{ read: ElementRef }, isSignal: true }] }], panelHexInput: [{ type: i0.ViewChild, args: ['panelHexInput', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
1194
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"tk-color-picker\"\n [class.tk-color-picker--disabled]=\"isDisabled()\"\n [class.tk-color-picker--open]=\"isOpen()\"\n [class.tk-color-picker--invalid]=\"!isValid()\">\n @if (variant() === 'swatch') {\n @if (label()) {\n <span class=\"tk-color-picker__label\">{{ label() }}</span>\n }\n <button\n #swatchBtn\n type=\"button\"\n class=\"tk-color-picker__trigger tk-color-picker__trigger--swatch\"\n [disabled]=\"isDisabled()\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-label]=\"t().openPickerLabel + (label() ? ': ' + label() : '')\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onTriggerClick($event)\">\n <span\n class=\"tk-color-picker__swatch\"\n [class.tk-color-picker__swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor()\"\n aria-hidden=\"true\"></span>\n <tk-icon\n class=\"tk-color-picker__chevron\"\n [class.tk-color-picker__chevron--open]=\"isOpen()\"\n icon=\"chevron-down\"\n styleIcon=\"regular\"\n size=\"xs\"></tk-icon>\n </button>\n } @else {\n <div\n #inputTrigger\n class=\"tk-color-picker__trigger-input\"\n [class.tk-color-picker__trigger-input--invalid]=\"!isValid()\">\n @if (label()) {\n <label\n class=\"tk-color-picker__input-label\"\n [for]=\"fieldId\"\n [title]=\"label()\"\n >{{ label() }}</label\n >\n }\n <div class=\"tk-color-picker__input-wrap\">\n <button\n type=\"button\"\n class=\"tk-color-picker__input-swatch\"\n [class.tk-color-picker__input-swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor() ?? null\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"t().openPickerLabel\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onTriggerClick($event)\"></button>\n <span class=\"tk-color-picker__input-prefix\" aria-hidden=\"true\">#</span>\n <input\n pInputText\n [id]=\"fieldId\"\n [value]=\"displayHexNoHash()\"\n [disabled]=\"isDisabled()\"\n [class.ng-invalid]=\"triggerControl.invalid\"\n [class.ng-dirty]=\"triggerControl.dirty\"\n [class.ng-touched]=\"triggerControl.touched\"\n [attr.aria-describedby]=\"!isValid() ? errorId : null\"\n [attr.aria-invalid]=\"!isValid()\"\n autocomplete=\"off\"\n (input)=\"onHexNativeInput($event)\"\n (keydown)=\"onHexKeydown($event)\"\n (paste)=\"onHexPaste($event)\"\n (blur)=\"onHexBlur()\" />\n </div>\n <div class=\"tk-color-picker__input-bottom\">\n @if (!isValid()) {\n <p-message\n severity=\"error\"\n size=\"small\"\n variant=\"simple\"\n [id]=\"errorId\"\n >{{ errorText() }}</p-message\n >\n } @else if (hint()) {\n <p-message severity=\"secondary\" size=\"small\" variant=\"simple\">{{\n hint()\n }}</p-message>\n }\n </div>\n </div>\n }\n\n @if (variant() === 'swatch') {\n @if (!isValid()) {\n <span\n [id]=\"errorId\"\n class=\"tk-color-picker__error\"\n role=\"alert\"\n aria-live=\"polite\">\n {{ errorText() }}\n </span>\n } @else if (hint()) {\n <span class=\"tk-color-picker__hint\">{{ hint() }}</span>\n }\n }\n</div>\n\n<p-popover\n #op\n [styleClass]=\"\n 'tk-color-picker-popover' +\n (variant() === 'input' ? ' tk-color-picker-popover--input' : '')\n \"\n position=\"bottom\"\n appendTo=\"body\"\n (onShow)=\"onPopoverShow()\"\n (onHide)=\"onPopoverHide()\">\n <div\n class=\"tk-color-picker__panel\"\n role=\"group\"\n [attr.aria-label]=\"t().dialogLabel\"\n tabindex=\"-1\"\n autofocus\n (keydown.enter)=\"onPanelEnter($event)\"\n (keydown.escape)=\"onPanelEscape($event)\">\n @if (resolvedSections().swatches && presetColors().length) {\n <section class=\"tk-color-picker__section\">\n <span class=\"tk-color-picker__section-label\">{{\n t().swatchesLabel\n }}</span>\n <tk-color-picker-swatch-grid\n [colors]=\"presetColors()\"\n [selected]=\"draftHex()\"\n [ariaLabel]=\"t().swatchesLabel\"\n (picked)=\"onSwatchPick($event)\" />\n </section>\n }\n\n @if (resolvedSections().customColors) {\n <section class=\"tk-color-picker__section\">\n <span class=\"tk-color-picker__section-label\">{{\n t().customColorsLabel\n }}</span>\n <tk-color-picker-swatch-grid\n [colors]=\"customColors()\"\n [selected]=\"draftHex()\"\n [ariaLabel]=\"t().customColorsLabel\"\n (picked)=\"onSwatchPick($event)\">\n @if (canAddCustom()) {\n <button\n type=\"button\"\n class=\"tk-color-picker__add-custom\"\n [attr.aria-label]=\"t().addCustomColorLabel\"\n (click)=\"addCustomColor()\">\n <tk-icon icon=\"plus\" styleIcon=\"regular\" size=\"xs\"></tk-icon>\n </button>\n }\n @if (isCustomColorSelected()) {\n <button\n type=\"button\"\n class=\"tk-color-picker__remove-custom\"\n [attr.aria-label]=\"t().removeCustomColorLabel\"\n (click)=\"removeCustomColor()\">\n \u2212\n </button>\n }\n </tk-color-picker-swatch-grid>\n </section>\n }\n\n @if (\n resolvedSections().customColors &&\n (resolvedSections().spectrum ||\n resolvedSections().hue ||\n resolvedSections().hex)\n ) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (resolvedSections().spectrum) {\n <tk-color-picker-spectrum\n [hue]=\"hue()\"\n [saturation]=\"saturation()\"\n [brightness]=\"brightness()\"\n [color]=\"swatchColor() ?? ''\"\n [ariaLabel]=\"t().spectrumLabel\"\n (changed)=\"onSpectrumChange($event)\" />\n }\n\n @if (resolvedSections().hue) {\n <input\n class=\"tk-color-picker__hue\"\n type=\"range\"\n min=\"0\"\n max=\"360\"\n [value]=\"hue()\"\n [attr.aria-label]=\"t().hueLabel\"\n (input)=\"onHueChange($event)\" />\n }\n\n @if (\n (resolvedSections().spectrum || resolvedSections().hue) &&\n resolvedSections().hex\n ) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (resolvedSections().hex) {\n <section class=\"tk-color-picker__section tk-color-picker__hex-row\">\n <span\n class=\"tk-color-picker__swatch tk-color-picker__swatch--large\"\n [class.tk-color-picker__swatch--fallback]=\"!swatchColor()\"\n [style.background-color]=\"swatchColor()\"\n aria-hidden=\"true\"></span>\n <tk-input-text\n #panelHexInput\n class=\"tk-color-picker__panel-hex\"\n [class.tk-color-picker__trigger-input--invalid]=\"!isValid()\"\n [label]=\"t().hexLabel\"\n [id]=\"panelFieldId\"\n [value]=\"displayHexNoHash()\"\n prefixText=\"#\"\n (input)=\"onHexNativeInput($event)\"\n (keydown)=\"onHexKeydown($event)\"\n (paste)=\"onHexPaste($event)\"\n (focusout)=\"onHexBlur()\" />\n @if (showEyedropper()) {\n <tk-button\n class=\"tk-color-picker__eyedropper\"\n tabindex=\"-1\"\n severity=\"secondary\"\n variant=\"outlined\"\n icon=\"eye-dropper\"\n styleIcon=\"regular\"\n [attr.aria-label]=\"t().eyedropperLabel\"\n (clicked)=\"openEyeDropper()\">\n </tk-button>\n }\n </section>\n }\n\n @if (resolvedSections().hex && showContrast()) {\n <div class=\"tk-color-picker__divider\" role=\"separator\"></div>\n }\n\n @if (showContrast()) {\n <section class=\"tk-color-picker__section tk-color-picker__contrast\">\n <span class=\"tk-color-picker__section-label\">{{\n t().contrastLabel\n }}</span>\n <div class=\"tk-color-picker__contrast-row\">\n <span\n class=\"tk-color-picker__contrast-pill\"\n [style.background-color]=\"draftHex()\"\n [attr.aria-label]=\"t().contrastSampleLabel\">\n <span\n class=\"tk-color-picker__contrast-sample\"\n [style.color]=\"contrastTextColor()\">\n {{ t().contrastSampleText }}\n </span>\n </span>\n <div class=\"tk-color-picker__contrast-info\">\n <span class=\"tk-color-picker__contrast-label\">{{\n t().contrastSampleLabel\n }}</span>\n <span class=\"tk-color-picker__contrast-ratio\"\n >{{ contrastResult()!.ratio }}:1</span\n >\n </div>\n @switch (contrastResult()!.level) {\n @case ('AAA') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--aaa\"\n >AAA</span\n >\n }\n @case ('AA') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--aa\"\n >AA</span\n >\n }\n @case ('fail') {\n <span\n class=\"tk-color-picker__contrast-badge tk-color-picker__contrast-badge--fail\">\n {{ t().contrastLowLabel }}\n </span>\n }\n }\n </div>\n </section>\n }\n </div>\n</p-popover>\n", styles: [":host{display:inline-block;font-family:var(--tk-font-family, sans-serif)}.tk-color-picker{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-xs, .25rem)}.tk-color-picker__label{font-size:var(--tk-font-size-paragraph-m, 1rem);font-weight:var(--tk-font-weight-400, 400);color:var(--tk-color-base-surface-950, #191a1b);margin-bottom:.25rem}.tk-color-picker__trigger{display:flex;align-items:center;gap:var(--tk-spacing-gap-s, .5rem);padding:var(--tk-spacing-padding-xs, .25rem) var(--tk-spacing-padding-s, .5rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);border-radius:var(--tk-borderRadius-s, .25rem);background:var(--tk-color-background-default, #ffffff);cursor:pointer;transition:border-color .14s ease,background .14s ease}.tk-color-picker__trigger:hover{border-color:var(--tk-color-border-default, #cecdcd)}.tk-color-picker__trigger:focus-within{border-color:var(--tk-color-border-focus, #16006f)}.tk-color-picker__trigger--swatch{appearance:none;width:fit-content;font:inherit;-webkit-user-select:none;user-select:none}.tk-color-picker__trigger--swatch>*{pointer-events:none}.tk-color-picker__trigger--swatch:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__trigger--swatch:disabled{cursor:not-allowed}.tk-color-picker__trigger-input{display:flex;flex-direction:column;position:relative}.tk-color-picker__input-label{position:absolute;left:var(--tk-spacing-base-300, 3rem);top:.75rem;font-size:var(--tk-font-size-paragraph-m, 1rem);font-weight:var(--tk-font-weight-400, 400);color:var(--tk-color-base-surface-500, #8a8a8b);background:var(--tk-color-background-default, #ffffff);padding:0 .25rem;transition:top .2s ease,left .2s ease,color .2s ease;pointer-events:none;z-index:1;max-width:calc(100% - 4rem);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tk-color-picker--disabled .tk-color-picker__input-label{display:none}.tk-color-picker--invalid .tk-color-picker__input-label{color:var(--tk-color-base-red-700, #cf2604)}.tk-color-picker__input-wrap{position:relative;display:flex;align-items:center;width:100%}.tk-color-picker__input-wrap input.p-inputtext{width:100%;flex:1;border:none;border-bottom:.0625rem solid var(--tk-color-base-surface-300, #d2d2d2);border-radius:0;padding:var(--tk-spacing-base-75, .75rem);padding-left:var(--tk-spacing-base-300, 3rem);color:var(--tk-color-base-surface-950, #191a1b);background-color:transparent;outline:none}.tk-color-picker__input-wrap input.p-inputtext:focus{border-color:var(--tk-color-base-primary-600, #140065);box-shadow:none}.tk-color-picker__input-wrap input.p-inputtext.ng-invalid.ng-dirty,.tk-color-picker__input-wrap input.p-inputtext.ng-invalid.ng-touched{border-color:var(--tk-color-base-red-700, #cf2604)}.tk-color-picker__input-wrap input.p-inputtext:disabled{background-color:var(--tk-color-base-surface-200, #e4e4e4);color:var(--tk-color-base-surface-500, #8a8a8b);opacity:1}.tk-color-picker__input-swatch{appearance:none;padding:0;position:absolute;left:var(--tk-spacing-base-25, .25rem);top:50%;transform:translateY(-50%);width:1.25rem;height:1.25rem;border-radius:var(--tk-borderRadius-xs, .125rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);flex-shrink:0;cursor:pointer;z-index:1;-webkit-user-select:none;user-select:none;background:transparent}.tk-color-picker__input-swatch--fallback{background:var(--tk-color-base-surface-400, #cecdcd)}.tk-color-picker__input-swatch:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__input-swatch:disabled{cursor:not-allowed;opacity:.5}.tk-color-picker__input-prefix{position:absolute;left:calc(var(--tk-spacing-base-25, .25rem) + 1.25rem + .25rem);top:50%;transform:translateY(-50%);color:var(--tk-color-text-muted, #8a8a8b);font-size:var(--tk-font-size-paragraph-s, .875rem);line-height:1;pointer-events:none;z-index:1}.tk-color-picker__input-bottom{display:flex;margin-top:.25rem;min-height:1.25rem}.tk-color-picker--open .tk-color-picker__trigger{border-color:var(--tk-color-border-strong, #424243)}.tk-color-picker--invalid .tk-color-picker__trigger{border-color:var(--tk-color-feedback-danger-default, #ff6640)}.tk-color-picker--disabled .tk-color-picker__trigger{opacity:.55;cursor:not-allowed;pointer-events:none;background:var(--tk-color-background-soft, #f2f1f1)}.tk-color-picker__swatch{flex-shrink:0;width:1.25rem;height:1.25rem;border-radius:var(--tk-borderRadius-xs, .125rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4)}.tk-color-picker__swatch--fallback{background:var(--tk-color-base-surface-400, #cecdcd)}.tk-color-picker__swatch--large{width:2rem;height:2rem;border-radius:var(--tk-borderRadius-s, .25rem)}.tk-color-picker__chevron{transition:transform .2s ease}.tk-color-picker__chevron--open{transform:rotate(180deg)}.tk-color-picker__error{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-feedback-danger-default, #ff6640)}.tk-color-picker__hint{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-text-muted, #8a8a8b)}.tk-color-picker__panel{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-m, .75rem);width:16rem;padding:var(--tk-spacing-padding-m, 1rem);box-sizing:border-box}.tk-color-picker__panel:focus,.tk-color-picker__panel:focus-visible{outline:none}.tk-color-picker__section{display:flex;flex-direction:column;gap:var(--tk-spacing-gap-xs, .25rem)}.tk-color-picker__section-label{font-size:var(--tk-font-size-legal-m, .75rem);font-weight:var(--tk-font-weight-600, 600);color:var(--tk-color-text-subtle, #5d5d5e)}.tk-color-picker__add-custom{appearance:none;padding:0;width:100%;aspect-ratio:1;border:1px dashed var(--tk-color-border-default, #cecdcd);border-radius:var(--tk-borderRadius-xs, .125rem);background:var(--tk-color-background-default, #ffffff);color:var(--tk-color-text-muted, #8a8a8b);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:border-color .12s ease,color .12s ease}.tk-color-picker__add-custom:hover{border-color:var(--tk-color-accent-default, #6ad0bc);color:var(--tk-color-accent-default, #6ad0bc)}.tk-color-picker__add-custom:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__remove-custom{appearance:none;padding:0;width:100%;aspect-ratio:1;border:1px dashed var(--tk-color-border-default, #cecdcd);border-radius:var(--tk-borderRadius-xs, .125rem);background:var(--tk-color-background-default, #ffffff);color:var(--tk-color-text-muted, #8a8a8b);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:border-color .12s ease,color .12s ease}.tk-color-picker__remove-custom:hover{border-color:var(--tk-color-accent-default, #6ad0bc);color:var(--tk-color-accent-default, #6ad0bc)}.tk-color-picker__remove-custom:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:1px}.tk-color-picker__hue{appearance:none;width:100%;height:.625rem;border-radius:var(--tk-borderRadius-full, 9999px);outline:none;cursor:pointer;background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.tk-color-picker__hue::-webkit-slider-thumb{appearance:none;width:1.125rem;height:1.125rem;border-radius:var(--tk-borderRadius-full, 50%);background:var(--tk-color-background-default, #ffffff);border:1px solid var(--tk-color-border-default, #cecdcd);cursor:grab}.tk-color-picker__hue::-moz-range-thumb{width:1.125rem;height:1.125rem;border-radius:var(--tk-borderRadius-full, 50%);background:var(--tk-color-background-default, #ffffff);border:1px solid var(--tk-color-border-default, #cecdcd);cursor:grab}.tk-color-picker__hue:focus-visible{outline:2px solid var(--tk-color-border-focus, #16006f);outline-offset:2px}.tk-color-picker__divider{width:100%;height:1px;background:var(--tk-color-border-subtle, #e4e4e4);flex-shrink:0}.tk-color-picker__hex-row{display:flex;flex-direction:row;align-items:center;gap:var(--tk-spacing-gap-s, .5rem);margin-top:var(--tk-spacing-gap-s, .5rem)}.tk-color-picker__hex-row>span{flex-shrink:0}.tk-color-picker__hex-row tk-button{flex-shrink:0;min-width:2.5rem;min-height:2.5rem}.tk-color-picker__eyedropper{margin-top:-12px}.tk-color-picker__eyedropper:focus,.tk-color-picker__eyedropper:focus-visible{outline:none;box-shadow:none}.tk-color-picker__panel-hex{flex:1;min-width:0}.tk-color-picker__contrast-row{display:flex;align-items:center;gap:var(--tk-spacing-gap-s, .5rem)}.tk-color-picker__contrast-pill{flex-shrink:0;width:2.5rem;height:2rem;border-radius:var(--tk-borderRadius-s, .25rem);border:1px solid var(--tk-color-border-subtle, #e4e4e4);display:inline-flex;align-items:center;justify-content:center}.tk-color-picker__contrast-sample{font-size:var(--tk-font-size-paragraph-s, .875rem);font-weight:var(--tk-font-weight-600, 600);line-height:1}.tk-color-picker__contrast-info{flex:1;min-width:0;display:flex;flex-direction:column}.tk-color-picker__contrast-label{font-size:var(--tk-font-size-legal-m, .75rem);font-weight:var(--tk-font-weight-600, 600);color:var(--tk-color-text-default, #222324)}.tk-color-picker__contrast-ratio{font-size:var(--tk-font-size-legal-s, .625rem);color:var(--tk-color-text-muted, #8a8a8b)}.tk-color-picker__contrast-badge{flex-shrink:0;font-size:var(--tk-font-size-legal-s, .625rem);font-weight:var(--tk-font-weight-600, 600);padding:var(--tk-spacing-padding-xs, .25rem) var(--tk-spacing-padding-s, .5rem);border-radius:var(--tk-borderRadius-full, 9999px)}.tk-color-picker__contrast-badge--aaa,.tk-color-picker__contrast-badge--aa{background:var(--tk-color-feedback-success-muted, #d1fadf);color:var(--tk-color-feedback-success-strong, #114a3f)}.tk-color-picker__contrast-badge--fail{background:var(--tk-color-feedback-danger-muted, #feede8);color:var(--tk-color-feedback-danger-strong, #7f1d1d)}::ng-deep .tk-color-picker-popover{margin:0!important}::ng-deep .tk-color-picker-popover:before,::ng-deep .tk-color-picker-popover:after{display:none!important}::ng-deep .tk-color-picker-popover--input{margin-top:-22px!important}:host ::ng-deep .tk-color-picker__trigger-input--invalid input.p-inputtext{border-color:var(--tk-color-feedback-danger-default, #ff6640)}:host ::ng-deep .tk-color-picker__trigger-input:has(input:focus) .tk-color-picker__input-label{top:-.75rem;left:0;font-size:var(--tk-font-size-legal-m, .75rem);color:var(--tk-color-base-primary-600, #140065);max-width:none;overflow:visible;text-overflow:clip}:host ::ng-deep .tk-color-picker__trigger-input:has(input.p-filled) .tk-color-picker__input-label{top:-.75rem;left:0;font-size:var(--tk-font-size-legal-m, .75rem);color:var(--tk-color-base-surface-950, #191a1b);max-width:none;overflow:visible;text-overflow:clip}:host ::ng-deep .tk-color-picker__trigger-input:has(input.ng-invalid.ng-dirty) .tk-color-picker__input-label,:host ::ng-deep .tk-color-picker__trigger-input:has(input.ng-invalid.ng-touched) .tk-color-picker__input-label{color:var(--tk-color-base-red-700, #cf2604)}\n"] }]
|
|
1195
|
+
}], ctorParameters: () => [], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], sections: [{ type: i0.Input, args: [{ isSignal: true, alias: "sections", required: false }] }], presetColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "presetColors", required: false }] }], contrastColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "contrastColor", required: false }] }], maxCustomColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxCustomColors", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], emitMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "emitMode", required: false }] }], texts: [{ type: i0.Input, args: [{ isSignal: true, alias: "texts", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], customColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "customColors", required: false }] }, { type: i0.Output, args: ["customColorsChange"] }], colorChange: [{ type: i0.Output, args: ["colorChange"] }], textColorChange: [{ type: i0.Output, args: ["textColorChange"] }], validChange: [{ type: i0.Output, args: ["validChange"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], popover: [{ type: i0.ViewChild, args: ['op', { isSignal: true }] }], swatchBtnRef: [{ type: i0.ViewChild, args: ['swatchBtn', { ...{ read: ElementRef }, isSignal: true }] }], inputTriggerRef: [{ type: i0.ViewChild, args: ['inputTrigger', { ...{ read: ElementRef }, isSignal: true }] }], panelHexInput: [{ type: i0.ViewChild, args: ['panelHexInput', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
1022
1196
|
|
|
1023
1197
|
/**
|
|
1024
1198
|
* Generated bundle index. Do not edit.
|