@nuralyui/colorpicker 0.0.3 → 0.0.5

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.
@@ -1,9 +1,50 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
1
6
  import { LitElement } from 'lit';
2
- import { ColorPickerSize } from './color-picker.types';
3
- export declare class ColerHolderBox extends LitElement {
7
+ import { ColorPickerSize } from './color-picker.types.js';
8
+ /**
9
+ * Color holder box component for displaying a color swatch.
10
+ *
11
+ * Renders a colored box that can be used as a color indicator or trigger.
12
+ * Supports various sizes and can be disabled.
13
+ *
14
+ * @example
15
+ * ```html
16
+ * <hy-colorholder-box color="#3498db"></hy-colorholder-box>
17
+ * <hy-colorholder-box color="rgb(52, 152, 219)" size="large"></hy-colorholder-box>
18
+ * <hy-colorholder-box color="#e74c3c" disabled></hy-colorholder-box>
19
+ * ```
20
+ *
21
+ * @cssproperty --color-holder-size - Size of the color box
22
+ * @cssproperty --color-holder-border - Border style
23
+ * @cssproperty --color-holder-border-radius - Border radius
24
+ * @cssproperty --color-holder-cursor - Cursor style
25
+ */
26
+ export declare class ColorHolderBox extends LitElement {
27
+ static styles: import("lit").CSSResult;
28
+ /** The color value to display */
4
29
  color: string;
30
+ /** Size variant (small, default, large) */
5
31
  size: ColorPickerSize;
6
- static styles: import("lit").CSSResult;
32
+ /** Whether the color holder is disabled */
33
+ disabled: boolean;
34
+ /** Show a checkered background for transparent colors */
35
+ showTransparencyGrid: boolean;
36
+ /** Border width in pixels */
37
+ borderWidth: number;
38
+ /** Whether to show a border */
39
+ showBorder: boolean;
40
+ /**
41
+ * Validates if the color is valid CSS color
42
+ */
43
+ private isValidColor;
44
+ /**
45
+ * Checks if the color is transparent or has transparency
46
+ */
47
+ private isTransparent;
7
48
  render(): import("lit").TemplateResult<1>;
8
49
  }
9
50
  //# sourceMappingURL=color-holder.component.d.ts.map
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
1
6
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
7
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
8
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -6,25 +11,106 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
11
  };
7
12
  import { LitElement, html } from 'lit';
8
13
  import { customElement, property } from 'lit/decorators.js';
14
+ import { classMap } from 'lit/directives/class-map.js';
15
+ import { styleMap } from 'lit/directives/style-map.js';
9
16
  import { styles } from './color-holder.style.js';
10
- let ColerHolderBox = class ColerHolderBox extends LitElement {
17
+ /**
18
+ * Color holder box component for displaying a color swatch.
19
+ *
20
+ * Renders a colored box that can be used as a color indicator or trigger.
21
+ * Supports various sizes and can be disabled.
22
+ *
23
+ * @example
24
+ * ```html
25
+ * <hy-colorholder-box color="#3498db"></hy-colorholder-box>
26
+ * <hy-colorholder-box color="rgb(52, 152, 219)" size="large"></hy-colorholder-box>
27
+ * <hy-colorholder-box color="#e74c3c" disabled></hy-colorholder-box>
28
+ * ```
29
+ *
30
+ * @cssproperty --color-holder-size - Size of the color box
31
+ * @cssproperty --color-holder-border - Border style
32
+ * @cssproperty --color-holder-border-radius - Border radius
33
+ * @cssproperty --color-holder-cursor - Cursor style
34
+ */
35
+ let ColorHolderBox = class ColorHolderBox extends LitElement {
11
36
  constructor() {
12
37
  super(...arguments);
13
- this.color = '#FFFFFF';
38
+ /** The color value to display */
39
+ this.color = '#3498db';
40
+ /** Size variant (small, default, large) */
41
+ this.size = "default" /* ColorPickerSize.Default */;
42
+ /** Whether the color holder is disabled */
43
+ this.disabled = false;
44
+ /** Show a checkered background for transparent colors */
45
+ this.showTransparencyGrid = true;
46
+ /** Border width in pixels */
47
+ this.borderWidth = 2;
48
+ /** Whether to show a border */
49
+ this.showBorder = true;
50
+ }
51
+ /**
52
+ * Validates if the color is valid CSS color
53
+ */
54
+ isValidColor() {
55
+ try {
56
+ return CSS.supports('color', this.color);
57
+ }
58
+ catch (_a) {
59
+ return false;
60
+ }
61
+ }
62
+ /**
63
+ * Checks if the color is transparent or has transparency
64
+ */
65
+ isTransparent() {
66
+ return this.color === 'transparent' ||
67
+ this.color.toLowerCase().includes('rgba') ||
68
+ this.color.toLowerCase().includes('hsla');
14
69
  }
15
70
  render() {
16
- return html ` <div class="color-holder-container" style="background-color: ${this.color}"></div> `;
71
+ const containerClasses = {
72
+ 'color-holder-container': true,
73
+ 'color-holder-container--disabled': this.disabled,
74
+ 'color-holder-container--invalid': !this.isValidColor(),
75
+ 'color-holder-container--transparent': this.isTransparent() && this.showTransparencyGrid,
76
+ [`color-holder-container--${this.size}`]: true,
77
+ };
78
+ const containerStyles = {
79
+ backgroundColor: this.isValidColor() ? this.color : '#ffffff',
80
+ borderWidth: this.showBorder ? `${this.borderWidth}px` : '0',
81
+ };
82
+ return html `
83
+ <div
84
+ class="${classMap(containerClasses)}"
85
+ style="${styleMap(containerStyles)}"
86
+ role="img"
87
+ aria-label="Color swatch: ${this.color}"
88
+ title="${this.color}"
89
+ ></div>
90
+ `;
17
91
  }
18
92
  };
19
- ColerHolderBox.styles = styles;
93
+ ColorHolderBox.styles = styles;
20
94
  __decorate([
21
95
  property({ type: String })
22
- ], ColerHolderBox.prototype, "color", void 0);
96
+ ], ColorHolderBox.prototype, "color", void 0);
23
97
  __decorate([
24
98
  property({ type: String, reflect: true })
25
- ], ColerHolderBox.prototype, "size", void 0);
26
- ColerHolderBox = __decorate([
99
+ ], ColorHolderBox.prototype, "size", void 0);
100
+ __decorate([
101
+ property({ type: Boolean, reflect: true })
102
+ ], ColorHolderBox.prototype, "disabled", void 0);
103
+ __decorate([
104
+ property({ type: Boolean, attribute: 'show-transparency-grid' })
105
+ ], ColorHolderBox.prototype, "showTransparencyGrid", void 0);
106
+ __decorate([
107
+ property({ type: Number, attribute: 'border-width' })
108
+ ], ColorHolderBox.prototype, "borderWidth", void 0);
109
+ __decorate([
110
+ property({ type: Boolean, attribute: 'show-border' })
111
+ ], ColorHolderBox.prototype, "showBorder", void 0);
112
+ ColorHolderBox = __decorate([
27
113
  customElement('hy-colorholder-box')
28
- ], ColerHolderBox);
29
- export { ColerHolderBox };
114
+ ], ColorHolderBox);
115
+ export { ColorHolderBox };
30
116
  //# sourceMappingURL=color-holder.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color-holder.component.js","sourceRoot":"","sources":["../../../src/components/colorpicker/color-holder.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AACrC,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAI/C,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,UAAU;IAA9C;;QAEE,UAAK,GAAG,SAAS,CAAC;IAUpB,CAAC;IAHU,MAAM;QACb,OAAO,IAAI,CAAA,iEAAiE,IAAI,CAAC,KAAK,WAAW,CAAC;IACpG,CAAC;CACF,CAAA;AALiB,qBAAM,GAAG,MAAO,CAAA;AALhC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACP;AAGlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CACjB;AALZ,cAAc;IAD1B,aAAa,CAAC,oBAAoB,CAAC;GACvB,cAAc,CAY1B;SAZY,cAAc","sourcesContent":["import {LitElement, html} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {styles} from './color-holder.style.js';\nimport {ColorPickerSize} from './color-picker.types';\n\n@customElement('hy-colorholder-box')\nexport class ColerHolderBox extends LitElement {\n @property({type: String})\n color = '#FFFFFF';\n\n @property({type: String, reflect: true})\n size!: ColorPickerSize;\n\n static override styles = styles;\n\n override render() {\n return html` <div class=\"color-holder-container\" style=\"background-color: ${this.color}\"></div> `;\n }\n}\n"]}
1
+ {"version":3,"file":"color-holder.component.js","sourceRoot":"","sources":["../../../src/components/colorpicker/color-holder.component.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { styles } from './color-holder.style.js';\nimport { ColorPickerSize } from './color-picker.types.js';\n\n/**\n * Color holder box component for displaying a color swatch.\n * \n * Renders a colored box that can be used as a color indicator or trigger.\n * Supports various sizes and can be disabled.\n * \n * @example\n * ```html\n * <hy-colorholder-box color=\"#3498db\"></hy-colorholder-box>\n * <hy-colorholder-box color=\"rgb(52, 152, 219)\" size=\"large\"></hy-colorholder-box>\n * <hy-colorholder-box color=\"#e74c3c\" disabled></hy-colorholder-box>\n * ```\n * \n * @cssproperty --color-holder-size - Size of the color box\n * @cssproperty --color-holder-border - Border style\n * @cssproperty --color-holder-border-radius - Border radius\n * @cssproperty --color-holder-cursor - Cursor style\n */\n@customElement('hy-colorholder-box')\nexport class ColorHolderBox extends LitElement {\n static override styles = styles;\n\n /** The color value to display */\n @property({ type: String })\n color = '#3498db';\n\n /** Size variant (small, default, large) */\n @property({ type: String, reflect: true })\n size: ColorPickerSize = ColorPickerSize.Default;\n\n /** Whether the color holder is disabled */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Show a checkered background for transparent colors */\n @property({ type: Boolean, attribute: 'show-transparency-grid' })\n showTransparencyGrid = true;\n\n /** Border width in pixels */\n @property({ type: Number, attribute: 'border-width' })\n borderWidth = 2;\n\n /** Whether to show a border */\n @property({ type: Boolean, attribute: 'show-border' })\n showBorder = true;\n\n /**\n * Validates if the color is valid CSS color\n */\n private isValidColor(): boolean {\n try {\n return CSS.supports('color', this.color);\n } catch {\n return false;\n }\n }\n\n /**\n * Checks if the color is transparent or has transparency\n */\n private isTransparent(): boolean {\n return this.color === 'transparent' || \n this.color.toLowerCase().includes('rgba') ||\n this.color.toLowerCase().includes('hsla');\n }\n\n override render() {\n const containerClasses = {\n 'color-holder-container': true,\n 'color-holder-container--disabled': this.disabled,\n 'color-holder-container--invalid': !this.isValidColor(),\n 'color-holder-container--transparent': this.isTransparent() && this.showTransparencyGrid,\n [`color-holder-container--${this.size}`]: true,\n };\n\n const containerStyles = {\n backgroundColor: this.isValidColor() ? this.color : '#ffffff',\n borderWidth: this.showBorder ? `${this.borderWidth}px` : '0',\n };\n\n return html`\n <div \n class=\"${classMap(containerClasses)}\" \n style=\"${styleMap(containerStyles)}\"\n role=\"img\"\n aria-label=\"Color swatch: ${this.color}\"\n title=\"${this.color}\"\n ></div>\n `;\n }\n}\n"]}
@@ -1,20 +1,44 @@
1
1
  import { css } from 'lit';
2
+ /**
3
+ * Color Holder component styles
4
+ * Using shared CSS variables from /src/shared/themes/
5
+ */
2
6
  const colorHolderStyles = css `
3
7
  :host {
8
+ display: inline-block;
4
9
  cursor: pointer;
10
+
11
+ /* Ensure clean state transitions */
12
+ * {
13
+ transition: all var(--nuraly-transition-fast, 0.15s) ease;
14
+ }
5
15
  }
6
16
 
7
17
  .color-holder-container {
8
- width: var(--hybrid-colorpicker-default-width);
9
- height: var(--hybrid-colorpicker-default-height);
18
+ width: var(--nuraly-size-colorpicker-default, 30px);
19
+ height: var(--nuraly-size-colorpicker-default-height, 25px);
20
+ border: 1px solid var(--nuraly-color-border, rgba(0, 0, 0, 0.2));
21
+ box-sizing: border-box;
22
+ border-radius: var(--nuraly-border-radius-small, 2px);
10
23
  }
24
+
11
25
  :host([size='small']) .color-holder-container {
12
- width: var(--hybrid-colorpicker-small-width);
13
- height: var(--hybrid-colorpicker-small-height);
26
+ width: var(--nuraly-size-colorpicker-small, 20px);
27
+ height: var(--nuraly-size-colorpicker-small-height, 15px);
14
28
  }
29
+
15
30
  :host([size='large']) .color-holder-container {
16
- width: var(--hybrid-colorpicker-large-width);
17
- height: var(--hybrid-colorpicker-large-height);
31
+ width: var(--nuraly-size-colorpicker-large, 35px);
32
+ height: var(--nuraly-size-colorpicker-large-height, 30px);
33
+ }
34
+
35
+ .color-holder-container--disabled {
36
+ opacity: var(--nuraly-opacity-disabled, 0.5);
37
+ cursor: not-allowed;
38
+ }
39
+
40
+ :host(:hover:not([disabled])) .color-holder-container {
41
+ border-color: var(--nuraly-color-border-hover, rgba(0, 0, 0, 0.4));
18
42
  }
19
43
  `;
20
44
  export const styles = colorHolderStyles;
@@ -1 +1 @@
1
- {"version":3,"file":"color-holder.style.js","sourceRoot":"","sources":["../../../src/components/colorpicker/color-holder.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB,MAAM,iBAAiB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;CAiB5B,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAAC","sourcesContent":["import {css} from 'lit';\n\nconst colorHolderStyles = css`\n :host {\n cursor: pointer;\n }\n\n .color-holder-container {\n width: var(--hybrid-colorpicker-default-width);\n height: var(--hybrid-colorpicker-default-height);\n }\n :host([size='small']) .color-holder-container {\n width: var(--hybrid-colorpicker-small-width);\n height: var(--hybrid-colorpicker-small-height);\n }\n :host([size='large']) .color-holder-container {\n width: var(--hybrid-colorpicker-large-width);\n height: var(--hybrid-colorpicker-large-height);\n }\n`;\n\nexport const styles = colorHolderStyles;\n"]}
1
+ {"version":3,"file":"color-holder.style.js","sourceRoot":"","sources":["../../../src/components/colorpicker/color-holder.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;GAGG;AACH,MAAM,iBAAiB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC5B,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAAC","sourcesContent":["import { css } from 'lit';\n\n/**\n * Color Holder component styles\n * Using shared CSS variables from /src/shared/themes/\n */\nconst colorHolderStyles = css`\n :host {\n display: inline-block;\n cursor: pointer;\n \n /* Ensure clean state transitions */\n * {\n transition: all var(--nuraly-transition-fast, 0.15s) ease;\n }\n }\n\n .color-holder-container {\n width: var(--nuraly-size-colorpicker-default, 30px);\n height: var(--nuraly-size-colorpicker-default-height, 25px);\n border: 1px solid var(--nuraly-color-border, rgba(0, 0, 0, 0.2));\n box-sizing: border-box;\n border-radius: var(--nuraly-border-radius-small, 2px);\n }\n \n :host([size='small']) .color-holder-container {\n width: var(--nuraly-size-colorpicker-small, 20px);\n height: var(--nuraly-size-colorpicker-small-height, 15px);\n }\n \n :host([size='large']) .color-holder-container {\n width: var(--nuraly-size-colorpicker-large, 35px);\n height: var(--nuraly-size-colorpicker-large-height, 30px);\n }\n \n .color-holder-container--disabled {\n opacity: var(--nuraly-opacity-disabled, 0.5);\n cursor: not-allowed;\n }\n \n :host(:hover:not([disabled])) .color-holder-container {\n border-color: var(--nuraly-color-border-hover, rgba(0, 0, 0, 0.4));\n }\n`;\n\nexport const styles = colorHolderStyles;\n"]}
@@ -1,26 +1,179 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly, Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
1
6
  import { LitElement, PropertyValues } from 'lit';
7
+ import '../input/index.js';
2
8
  import './color-holder.component.js';
3
9
  import './default-color-sets.component.js';
4
- import { ColorPickerSize } from './color-picker.types.js';
5
- export declare class ColorPicker extends LitElement {
10
+ import { ColorPickerSize, ColorPickerTrigger, ColorPickerPlacement, ColorPickerAnimation, ColorFormat } from './color-picker.types.js';
11
+ import type { ColorPickerHost } from './interfaces/index.js';
12
+ declare const ColorPicker_base: (new (...args: any[]) => import("../../shared/dependency-mixin.js").DependencyAware) & (new (...args: any[]) => import("../../shared/theme-mixin.js").ThemeAware) & (new (...args: any[]) => import("../../shared/event-handler-mixin.js").EventHandlerCapable) & typeof LitElement;
13
+ /**
14
+ * Advanced color picker component with dropdown positioning, validation, and accessibility.
15
+ *
16
+ * Supports multiple color formats, default color sets, custom triggers, keyboard navigation,
17
+ * and various display configurations.
18
+ *
19
+ * @example
20
+ * ```html
21
+ * <!-- Basic color picker -->
22
+ * <hy-color-picker color="#3498db"></hy-color-picker>
23
+ *
24
+ * <!-- With default colors -->
25
+ * <hy-color-picker
26
+ * color="#3498db"
27
+ * .defaultColorSets="${['#3498db', '#e74c3c', '#2ecc71']}">
28
+ * </hy-color-picker>
29
+ *
30
+ * <!-- With custom configuration -->
31
+ * <hy-color-picker
32
+ * color="#3498db"
33
+ * trigger="click"
34
+ * placement="top"
35
+ * size="large"
36
+ * show-input="true"
37
+ * show-copy-button="true">
38
+ * </hy-color-picker>
39
+ *
40
+ * <!-- Disabled -->
41
+ * <hy-color-picker color="#3498db" disabled></hy-color-picker>
42
+ * ```
43
+ *
44
+ * @fires hy-color-change - Color value changed
45
+ * @fires hy-colorpicker-open - Dropdown opened
46
+ * @fires hy-colorpicker-close - Dropdown closed
47
+ * @fires color-changed - Legacy event for backwards compatibility
48
+ *
49
+ * @slot - Default slot for custom content
50
+ *
51
+ * @cssproperty --colorpicker-trigger-size - Size of the color trigger box
52
+ * @cssproperty --colorpicker-dropdown-width - Width of the dropdown panel
53
+ * @cssproperty --colorpicker-dropdown-background - Background color of dropdown
54
+ * @cssproperty --colorpicker-dropdown-shadow - Shadow of dropdown panel
55
+ * @cssproperty --colorpicker-dropdown-border-radius - Border radius of dropdown
56
+ */
57
+ export declare class ColorPicker extends ColorPicker_base implements ColorPickerHost {
58
+ static styles: import("lit").CSSResult;
59
+ requiredComponents: string[];
60
+ /** Current color value */
6
61
  color: string;
62
+ /** Controls dropdown visibility */
7
63
  show: boolean;
8
- defaultColorSets: Array<string>;
64
+ /** Array of preset colors to display */
65
+ defaultColorSets: string[];
66
+ /** Disables the color picker */
9
67
  disabled: boolean;
68
+ /** Color picker size (small, default, large) */
10
69
  size: ColorPickerSize;
11
- isValidColor: boolean;
12
- static styles: import("lit").CSSResult;
70
+ /** Trigger mode for opening dropdown */
71
+ trigger: ColorPickerTrigger;
72
+ /** Dropdown placement */
73
+ placement: ColorPickerPlacement;
74
+ /** Animation style for dropdown */
75
+ animation: ColorPickerAnimation;
76
+ /** Close dropdown when a color is selected */
77
+ closeOnSelect: boolean;
78
+ /** Close dropdown on outside click */
79
+ closeOnOutsideClick: boolean;
80
+ /** Close dropdown on escape key */
81
+ closeOnEscape: boolean;
82
+ /** Show color input field */
83
+ showInput: boolean;
84
+ /** Show copy button on input */
85
+ showCopyButton: boolean;
86
+ /** Color format (hex, rgb, rgba, hsl, hsla) */
87
+ format: ColorFormat;
88
+ /** Placeholder text for color input */
89
+ inputPlaceholder: string;
90
+ /** Label text */
91
+ label: string;
92
+ /** Helper text */
93
+ helperText: string;
94
+ /** Validation state for color value */
95
+ private isValidColor;
96
+ /** Manages dropdown visibility and positioning */
97
+ private dropdownController;
98
+ /** Handles all event management */
99
+ private eventController;
13
100
  constructor();
101
+ /**
102
+ * Component connected to DOM - initialize base functionality
103
+ */
14
104
  connectedCallback(): void;
105
+ /**
106
+ * Component disconnected from DOM - cleanup event listeners
107
+ */
108
+ disconnectedCallback(): void;
109
+ /**
110
+ * Called after component updates
111
+ */
15
112
  updated(changedProperties: PropertyValues): void;
16
- private toggleColorHolder;
17
- private onClickOutside;
18
- private calculateDropDownPosition;
113
+ /**
114
+ * Opens the color picker dropdown
115
+ */
116
+ open(): void;
117
+ /**
118
+ * Closes the color picker dropdown
119
+ */
120
+ close(): void;
121
+ /**
122
+ * Toggles the color picker dropdown
123
+ */
124
+ toggle(): void;
125
+ /**
126
+ * Validates the current color value
127
+ */
128
+ validateColor(): boolean;
129
+ /**
130
+ * Sets up global event listeners (called by dropdown controller)
131
+ */
132
+ setupEventListeners(): void;
133
+ /**
134
+ * Removes global event listeners (called by dropdown controller)
135
+ */
136
+ removeEventListeners(): void;
137
+ /**
138
+ * Handles trigger click to toggle dropdown
139
+ */
140
+ private handleTriggerClick;
141
+ /**
142
+ * Handles color selection from hex-color-picker or default colors
143
+ */
19
144
  private handleColorChanged;
20
- private onInputChange;
21
- private dispatchColorChange;
22
- private checkIsValidColor;
23
- disconnectedCallback(): void;
145
+ /**
146
+ * Handles input change from text input
147
+ */
148
+ private handleInputChange;
149
+ /**
150
+ * Main render method
151
+ */
24
152
  render(): import("lit").TemplateResult<1>;
153
+ /**
154
+ * Renders the label if provided
155
+ */
156
+ private renderLabel;
157
+ /**
158
+ * Renders the dropdown panel with color picker
159
+ */
160
+ private renderDropdown;
161
+ /**
162
+ * Renders default color sets if provided
163
+ */
164
+ private renderDefaultColorSets;
165
+ /**
166
+ * Renders the hex color picker
167
+ */
168
+ private renderColorPicker;
169
+ /**
170
+ * Renders the color input field
171
+ */
172
+ private renderColorInput;
173
+ /**
174
+ * Renders helper text if provided
175
+ */
176
+ private renderHelperText;
25
177
  }
178
+ export {};
26
179
  //# sourceMappingURL=color-picker.component.d.ts.map