@nuralyui/colorpicker 0.0.4 → 0.0.6
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/bundle.js +1621 -0
- package/color-holder.component.d.ts +44 -3
- package/color-holder.component.js +96 -10
- package/color-holder.component.js.map +1 -1
- package/color-holder.style.js +30 -6
- package/color-holder.style.js.map +1 -1
- package/color-picker.component.d.ts +165 -12
- package/color-picker.component.js +316 -93
- package/color-picker.component.js.map +1 -1
- package/color-picker.style.d.ts +7 -0
- package/color-picker.style.js +49 -38
- package/color-picker.style.js.map +1 -1
- package/color-picker.types.d.ts +54 -0
- package/color-picker.types.js.map +1 -1
- package/default-color-sets.component.d.ts +40 -4
- package/default-color-sets.component.js +90 -12
- package/default-color-sets.component.js.map +1 -1
- package/default-color-sets.style.js +21 -3
- package/default-color-sets.style.js.map +1 -1
- package/package.json +16 -2
- package/react.js +1 -1
- package/react.js.map +1 -1
- package/color-holder.component.d.ts.map +0 -1
- package/color-holder.style.d.ts.map +0 -1
- package/color-picker.component.d.ts.map +0 -1
- package/color-picker.style.d.ts.map +0 -1
- package/color-picker.types.d.ts.map +0 -1
- package/default-color-sets.component.d.ts.map +0 -1
- package/default-color-sets.style.d.ts.map +0 -1
- package/demo/color-picker-demo.d.ts +0 -18
- package/demo/color-picker-demo.d.ts.map +0 -1
- package/demo/color-picker-demo.js +0 -157
- package/demo/color-picker-demo.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/react.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.style.js","sourceRoot":"","sources":["../../../src/components/colorpicker/color-picker.style.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"color-picker.style.js","sourceRoot":"","sources":["../../../src/components/colorpicker/color-picker.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;;;GAMG;AACH,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4EjB,CAAC","sourcesContent":["import { css } from 'lit';\n\n/**\n * Color Picker component styles for the Hybrid UI Library\n * Using shared CSS variables from /src/shared/themes/\n * \n * This file contains all the styling for the nr-colorpicker component with\n * clean CSS variable usage without local fallbacks and proper theme switching support.\n */\nexport default css`\n :host {\n display: inline-block;\n vertical-align: middle;\n \n /* Force CSS custom property inheritance to ensure theme switching works properly */\n color: var(--nuraly-color-text);\n background-color: var(--nuraly-color-background);\n \n /* Ensure clean state transitions when theme changes */\n * {\n transition: all var(--nuraly-transition-fast, 0.15s) ease;\n }\n }\n\n /* Force re-evaluation of theme-dependent properties on theme change */\n :host([data-theme]) {\n color: inherit;\n background-color: inherit;\n }\n\n .color-picker-container {\n display: inline-flex;\n flex-direction: column;\n }\n \n hex-color-picker {\n width: 100%;\n }\n \n .dropdown-container {\n display: none;\n }\n \n hex-color-picker::part(saturation) {\n border-radius: 0px;\n }\n \n hex-color-picker::part(hue) {\n border-radius: 0px;\n }\n \n hex-color-picker::part(saturation-pointer),\n hex-color-picker::part(hue-pointer) {\n cursor: pointer;\n }\n \n .color-holder {\n cursor: pointer;\n }\n \n :host([disabled]) .color-holder {\n opacity: var(--nuraly-opacity-disabled, 0.5);\n cursor: not-allowed;\n }\n\n :host([show]) .dropdown-container {\n display: block;\n position: fixed;\n width: 180px;\n z-index: var(--nuraly-z-index-dropdown, 1000);\n padding: var(--nuraly-spacing-2, 0.5rem);\n background-color: var(--nuraly-color-surface, #ffffff);\n border: 1px solid var(--nuraly-color-border, rgba(0, 0, 0, 0.1));\n border-radius: var(--nuraly-border-radius-medium, 4px);\n box-shadow: var(--nuraly-shadow-dropdown, 0 2px 8px rgba(0, 0, 0, 0.15));\n opacity: 0;\n visibility: hidden;\n transition: opacity var(--nuraly-transition-fast, 0.15s) ease-in-out,\n visibility var(--nuraly-transition-fast, 0.15s) ease-in-out;\n }\n\n :host([show]) .dropdown-container.positioned {\n opacity: 1;\n visibility: visible;\n }\n`;\n"]}
|
package/color-picker.types.d.ts
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ColorPicker size variants
|
|
3
|
+
*/
|
|
1
4
|
export declare const enum ColorPickerSize {
|
|
2
5
|
Default = "default",
|
|
3
6
|
Small = "small",
|
|
4
7
|
Large = "large"
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* ColorPicker trigger modes
|
|
11
|
+
*/
|
|
12
|
+
export declare const enum ColorPickerTrigger {
|
|
13
|
+
Click = "click",
|
|
14
|
+
Hover = "hover",
|
|
15
|
+
Manual = "manual"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ColorPicker placement options
|
|
19
|
+
*/
|
|
20
|
+
export declare const enum ColorPickerPlacement {
|
|
21
|
+
Top = "top",
|
|
22
|
+
Bottom = "bottom",
|
|
23
|
+
Auto = "auto"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* ColorPicker animation types
|
|
27
|
+
*/
|
|
28
|
+
export declare const enum ColorPickerAnimation {
|
|
29
|
+
None = "none",
|
|
30
|
+
Fade = "fade",
|
|
31
|
+
Slide = "slide",
|
|
32
|
+
Scale = "scale"
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* ColorPicker format options
|
|
36
|
+
*/
|
|
37
|
+
export declare const enum ColorFormat {
|
|
38
|
+
Hex = "hex",
|
|
39
|
+
RGB = "rgb",
|
|
40
|
+
RGBA = "rgba",
|
|
41
|
+
HSL = "hsl",
|
|
42
|
+
HSLA = "hsla"
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* ColorPicker configuration
|
|
46
|
+
*/
|
|
47
|
+
export interface ColorPickerConfig {
|
|
48
|
+
trigger?: ColorPickerTrigger;
|
|
49
|
+
placement?: ColorPickerPlacement;
|
|
50
|
+
animation?: ColorPickerAnimation;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
closeOnSelect?: boolean;
|
|
53
|
+
closeOnOutsideClick?: boolean;
|
|
54
|
+
closeOnEscape?: boolean;
|
|
55
|
+
showInput?: boolean;
|
|
56
|
+
showCopyButton?: boolean;
|
|
57
|
+
format?: ColorFormat;
|
|
58
|
+
defaultColorSets?: string[];
|
|
59
|
+
}
|
|
6
60
|
//# sourceMappingURL=color-picker.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.types.js","sourceRoot":"","sources":["../../../src/components/colorpicker/color-picker.types.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"color-picker.types.js","sourceRoot":"","sources":["../../../src/components/colorpicker/color-picker.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * ColorPicker size variants\n */\nexport const enum ColorPickerSize {\n Default = 'default',\n Small = 'small',\n Large = 'large',\n}\n\n/**\n * ColorPicker trigger modes\n */\nexport const enum ColorPickerTrigger {\n Click = 'click',\n Hover = 'hover',\n Manual = 'manual',\n}\n\n/**\n * ColorPicker placement options\n */\nexport const enum ColorPickerPlacement {\n Top = 'top',\n Bottom = 'bottom',\n Auto = 'auto',\n}\n\n/**\n * ColorPicker animation types\n */\nexport const enum ColorPickerAnimation {\n None = 'none',\n Fade = 'fade',\n Slide = 'slide',\n Scale = 'scale',\n}\n\n/**\n * ColorPicker format options\n */\nexport const enum ColorFormat {\n Hex = 'hex',\n RGB = 'rgb',\n RGBA = 'rgba',\n HSL = 'hsl',\n HSLA = 'hsla',\n}\n\n/**\n * ColorPicker configuration\n */\nexport interface ColorPickerConfig {\n trigger?: ColorPickerTrigger;\n placement?: ColorPickerPlacement;\n animation?: ColorPickerAnimation;\n disabled?: boolean;\n closeOnSelect?: boolean;\n closeOnOutsideClick?: boolean;\n closeOnEscape?: boolean;\n showInput?: boolean;\n showCopyButton?: boolean;\n format?: ColorFormat;\n defaultColorSets?: string[];\n}\n"]}
|
|
@@ -1,9 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { LitElement, nothing } from 'lit';
|
|
2
7
|
import './color-holder.component.js';
|
|
8
|
+
/**
|
|
9
|
+
* Default color sets component for displaying preset color swatches.
|
|
10
|
+
*
|
|
11
|
+
* Renders a grid of clickable color swatches that can be used as quick color selections.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <nr-default-color-sets
|
|
16
|
+
* .defaultColorSets="${['#3498db', '#e74c3c', '#2ecc71', '#f39c12']}">
|
|
17
|
+
* </nr-default-color-sets>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @fires color-click - Fired when a color swatch is clicked
|
|
21
|
+
*
|
|
22
|
+
* @cssproperty --default-color-sets-gap - Gap between color swatches
|
|
23
|
+
* @cssproperty --default-color-sets-padding - Padding around the color grid
|
|
24
|
+
*/
|
|
3
25
|
export declare class DefaultColorSets extends LitElement {
|
|
4
|
-
defaultColorSets: Array<string>;
|
|
5
26
|
static styles: import("lit").CSSResult;
|
|
6
|
-
|
|
7
|
-
|
|
27
|
+
/** Array of color values to display as swatches */
|
|
28
|
+
defaultColorSets: string[];
|
|
29
|
+
/** Size of the color swatches */
|
|
30
|
+
size: 'small' | 'default' | 'large';
|
|
31
|
+
/** Number of columns in the grid */
|
|
32
|
+
columns: number;
|
|
33
|
+
/**
|
|
34
|
+
* Handles color swatch click
|
|
35
|
+
* @param color - The clicked color value
|
|
36
|
+
* @param event - The click event
|
|
37
|
+
*/
|
|
38
|
+
private handleColorClick;
|
|
39
|
+
/**
|
|
40
|
+
* Validates if a color string is valid CSS color
|
|
41
|
+
*/
|
|
42
|
+
private isValidColor;
|
|
43
|
+
render(): import("lit").TemplateResult<1> | typeof nothing;
|
|
8
44
|
}
|
|
9
45
|
//# sourceMappingURL=default-color-sets.component.d.ts.map
|
|
@@ -1,43 +1,121 @@
|
|
|
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);
|
|
4
9
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
10
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
11
|
};
|
|
7
|
-
import { LitElement, html } from 'lit';
|
|
12
|
+
import { LitElement, html, nothing } from 'lit';
|
|
8
13
|
import { customElement, property } from 'lit/decorators.js';
|
|
14
|
+
import { map } from 'lit/directives/map.js';
|
|
9
15
|
import { styles } from './default-color-sets.style.js';
|
|
10
16
|
import './color-holder.component.js';
|
|
17
|
+
/**
|
|
18
|
+
* Default color sets component for displaying preset color swatches.
|
|
19
|
+
*
|
|
20
|
+
* Renders a grid of clickable color swatches that can be used as quick color selections.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <nr-default-color-sets
|
|
25
|
+
* .defaultColorSets="${['#3498db', '#e74c3c', '#2ecc71', '#f39c12']}">
|
|
26
|
+
* </nr-default-color-sets>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @fires color-click - Fired when a color swatch is clicked
|
|
30
|
+
*
|
|
31
|
+
* @cssproperty --default-color-sets-gap - Gap between color swatches
|
|
32
|
+
* @cssproperty --default-color-sets-padding - Padding around the color grid
|
|
33
|
+
*/
|
|
11
34
|
let DefaultColorSets = class DefaultColorSets extends LitElement {
|
|
12
35
|
constructor() {
|
|
13
36
|
super(...arguments);
|
|
37
|
+
/** Array of color values to display as swatches */
|
|
14
38
|
this.defaultColorSets = [];
|
|
39
|
+
/** Size of the color swatches */
|
|
40
|
+
this.size = 'default';
|
|
41
|
+
/** Number of columns in the grid */
|
|
42
|
+
this.columns = 8;
|
|
15
43
|
}
|
|
16
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Handles color swatch click
|
|
46
|
+
* @param color - The clicked color value
|
|
47
|
+
* @param event - The click event
|
|
48
|
+
*/
|
|
49
|
+
handleColorClick(color, event) {
|
|
50
|
+
event.stopPropagation();
|
|
51
|
+
if (!this.isValidColor(color)) {
|
|
52
|
+
console.warn(`Invalid color: ${color}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const detail = {
|
|
56
|
+
value: color,
|
|
57
|
+
};
|
|
17
58
|
this.dispatchEvent(new CustomEvent('color-click', {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
59
|
+
bubbles: true,
|
|
60
|
+
composed: true,
|
|
61
|
+
detail,
|
|
21
62
|
}));
|
|
22
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Validates if a color string is valid CSS color
|
|
66
|
+
*/
|
|
67
|
+
isValidColor(color) {
|
|
68
|
+
try {
|
|
69
|
+
return CSS.supports('color', color);
|
|
70
|
+
}
|
|
71
|
+
catch (_a) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
23
75
|
render() {
|
|
76
|
+
if (!this.defaultColorSets || this.defaultColorSets.length === 0) {
|
|
77
|
+
return nothing;
|
|
78
|
+
}
|
|
24
79
|
return html `
|
|
25
|
-
<div
|
|
26
|
-
|
|
27
|
-
|
|
80
|
+
<div
|
|
81
|
+
class="default-color-sets-container"
|
|
82
|
+
role="list"
|
|
83
|
+
aria-label="Preset color swatches"
|
|
84
|
+
style="--columns: ${this.columns}"
|
|
85
|
+
>
|
|
86
|
+
${map(this.defaultColorSets, (color) => html `
|
|
87
|
+
<nr-colorholder-box
|
|
28
88
|
color="${color}"
|
|
29
|
-
|
|
30
|
-
|
|
89
|
+
.size=${this.size}
|
|
90
|
+
class="color-set-container"
|
|
91
|
+
role="listitem"
|
|
92
|
+
tabindex="0"
|
|
93
|
+
aria-label="Color ${color}"
|
|
94
|
+
@click=${(e) => this.handleColorClick(color, e)}
|
|
95
|
+
@keydown=${(e) => {
|
|
96
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
97
|
+
e.preventDefault();
|
|
98
|
+
this.handleColorClick(color, e);
|
|
99
|
+
}
|
|
100
|
+
}}
|
|
101
|
+
></nr-colorholder-box>
|
|
102
|
+
`)}
|
|
31
103
|
</div>
|
|
32
104
|
`;
|
|
33
105
|
}
|
|
34
106
|
};
|
|
35
107
|
DefaultColorSets.styles = styles;
|
|
36
108
|
__decorate([
|
|
37
|
-
property({ type: Array })
|
|
109
|
+
property({ type: Array, attribute: 'default-color-sets' })
|
|
38
110
|
], DefaultColorSets.prototype, "defaultColorSets", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
property({ type: String, reflect: true })
|
|
113
|
+
], DefaultColorSets.prototype, "size", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
property({ type: Number, attribute: 'columns' })
|
|
116
|
+
], DefaultColorSets.prototype, "columns", void 0);
|
|
39
117
|
DefaultColorSets = __decorate([
|
|
40
|
-
customElement('
|
|
118
|
+
customElement('nr-default-color-sets')
|
|
41
119
|
], DefaultColorSets);
|
|
42
120
|
export { DefaultColorSets };
|
|
43
121
|
//# sourceMappingURL=default-color-sets.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-color-sets.component.js","sourceRoot":"","sources":["../../../src/components/colorpicker/default-color-sets.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default-color-sets.component.js","sourceRoot":"","sources":["../../../src/components/colorpicker/default-color-sets.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,6BAA6B,CAAC;AAGrC;;;;;;;;;;;;;;;;GAgBG;AAEH,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,UAAU;IAAhD;;QAGE,mDAAmD;QAEnD,qBAAgB,GAAa,EAAE,CAAC;QAEhC,iCAAiC;QAEjC,SAAI,GAAkC,SAAS,CAAC;QAEhD,oCAAoC;QAEpC,YAAO,GAAG,CAAC,CAAC;IA0Ed,CAAC;IAxEC;;;;OAIG;IACK,gBAAgB,CAAC,KAAa,EAAE,KAAY;QAClD,KAAK,CAAC,eAAe,EAAE,CAAC;QAExB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAC;YACxC,OAAO;SACR;QAED,MAAM,MAAM,GAA0B;YACpC,KAAK,EAAE,KAAK;SACb,CAAC;QAEF,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,aAAa,EAAE;YAC7B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM;SACP,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,YAAY,CAAC,KAAa;QAChC,IAAI;YACF,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACrC;QAAC,WAAM;YACN,OAAO,KAAK,CAAC;SACd;IACH,CAAC;IAEQ,MAAM;QACb,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;YAChE,OAAO,OAAO,CAAC;SAChB;QAED,OAAO,IAAI,CAAA;;;;;4BAKa,IAAI,CAAC,OAAO;;UAE9B,GAAG,CACH,IAAI,CAAC,gBAAgB,EACrB,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;;uBAEF,KAAK;sBACN,IAAI,CAAC,IAAI;;;;kCAIG,KAAK;uBAChB,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC;yBAC3C,CAAC,CAAgB,EAAE,EAAE;YAC9B,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE;gBACtC,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;aACjC;QACH,CAAC;;WAEJ,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAtFiB,uBAAM,GAAG,MAAO,CAAA;AAIhC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;0DAC3B;AAIhC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CACM;AAIhD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;iDACrC;AAbD,gBAAgB;IAD5B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,gBAAgB,CAuF5B;SAvFY,gBAAgB","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { LitElement, html, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { map } from 'lit/directives/map.js';\nimport { styles } from './default-color-sets.style.js';\nimport './color-holder.component.js';\nimport type { ColorClickEventDetail } from './interfaces/index.js';\n\n/**\n * Default color sets component for displaying preset color swatches.\n * \n * Renders a grid of clickable color swatches that can be used as quick color selections.\n * \n * @example\n * ```html\n * <nr-default-color-sets \n * .defaultColorSets=\"${['#3498db', '#e74c3c', '#2ecc71', '#f39c12']}\">\n * </nr-default-color-sets>\n * ```\n * \n * @fires color-click - Fired when a color swatch is clicked\n * \n * @cssproperty --default-color-sets-gap - Gap between color swatches\n * @cssproperty --default-color-sets-padding - Padding around the color grid\n */\n@customElement('nr-default-color-sets')\nexport class DefaultColorSets extends LitElement {\n static override styles = styles;\n\n /** Array of color values to display as swatches */\n @property({ type: Array, attribute: 'default-color-sets' })\n defaultColorSets: string[] = [];\n\n /** Size of the color swatches */\n @property({ type: String, reflect: true })\n size: 'small' | 'default' | 'large' = 'default';\n\n /** Number of columns in the grid */\n @property({ type: Number, attribute: 'columns' })\n columns = 8;\n\n /**\n * Handles color swatch click\n * @param color - The clicked color value\n * @param event - The click event\n */\n private handleColorClick(color: string, event: Event): void {\n event.stopPropagation();\n \n if (!this.isValidColor(color)) {\n console.warn(`Invalid color: ${color}`);\n return;\n }\n\n const detail: ColorClickEventDetail = {\n value: color,\n };\n\n this.dispatchEvent(\n new CustomEvent('color-click', {\n bubbles: true,\n composed: true,\n detail,\n })\n );\n }\n\n /**\n * Validates if a color string is valid CSS color\n */\n private isValidColor(color: string): boolean {\n try {\n return CSS.supports('color', color);\n } catch {\n return false;\n }\n }\n\n override render() {\n if (!this.defaultColorSets || this.defaultColorSets.length === 0) {\n return nothing;\n }\n\n return html`\n <div \n class=\"default-color-sets-container\"\n role=\"list\"\n aria-label=\"Preset color swatches\"\n style=\"--columns: ${this.columns}\"\n >\n ${map(\n this.defaultColorSets,\n (color) => html`\n <nr-colorholder-box\n color=\"${color}\"\n .size=${this.size}\n class=\"color-set-container\"\n role=\"listitem\"\n tabindex=\"0\"\n aria-label=\"Color ${color}\"\n @click=${(e: Event) => this.handleColorClick(color, e)}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.handleColorClick(color, e);\n }\n }}\n ></nr-colorholder-box>\n `\n )}\n </div>\n `;\n }\n}\n"]}
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Default Color Sets component styles
|
|
4
|
+
* Using shared CSS variables from /src/shared/themes/
|
|
5
|
+
*/
|
|
2
6
|
const defaultColorSetsStyle = css `
|
|
3
7
|
.default-color-sets-container {
|
|
4
8
|
display: flex;
|
|
5
9
|
flex-wrap: wrap;
|
|
6
10
|
justify-content: center;
|
|
7
11
|
}
|
|
12
|
+
|
|
8
13
|
.default-color-sets-container * {
|
|
9
|
-
margin:
|
|
14
|
+
margin: var(--nuraly-spacing-1, 0.25rem);
|
|
10
15
|
}
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
|
|
17
|
+
.color-set-container {
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
position: relative;
|
|
20
|
+
transition: all var(--nuraly-transition-base, 0.2s) ease-in-out;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.color-set-container:hover {
|
|
24
|
+
box-shadow: 0 0 0 2px var(--nuraly-color-focus, rgba(15, 98, 254, 0.5));
|
|
25
|
+
opacity: var(--nuraly-opacity-hover, 0.9);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.color-set-container:active {
|
|
29
|
+
box-shadow: 0 0 0 2px var(--nuraly-color-focus-active, rgba(15, 98, 254, 0.8));
|
|
30
|
+
opacity: 1;
|
|
13
31
|
}
|
|
14
32
|
`;
|
|
15
33
|
export const styles = defaultColorSetsStyle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-color-sets.style.js","sourceRoot":"","sources":["../../../src/components/colorpicker/default-color-sets.style.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"default-color-sets.style.js","sourceRoot":"","sources":["../../../src/components/colorpicker/default-color-sets.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;GAGG;AACH,MAAM,qBAAqB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BhC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,qBAAqB,CAAC","sourcesContent":["import { css } from 'lit';\n\n/**\n * Default Color Sets component styles\n * Using shared CSS variables from /src/shared/themes/\n */\nconst defaultColorSetsStyle = css`\n .default-color-sets-container {\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n }\n \n .default-color-sets-container * {\n margin: var(--nuraly-spacing-1, 0.25rem);\n }\n \n .color-set-container {\n cursor: pointer;\n position: relative;\n transition: all var(--nuraly-transition-base, 0.2s) ease-in-out;\n }\n \n .color-set-container:hover {\n box-shadow: 0 0 0 2px var(--nuraly-color-focus, rgba(15, 98, 254, 0.5));\n opacity: var(--nuraly-opacity-hover, 0.9);\n }\n \n .color-set-container:active {\n box-shadow: 0 0 0 2px var(--nuraly-color-focus-active, rgba(15, 98, 254, 0.8));\n opacity: 1;\n }\n`;\n\nexport const styles = defaultColorSetsStyle;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuralyui/colorpicker",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -8,5 +8,19 @@
|
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
9
|
},
|
|
10
10
|
"author": "Labidi Aymen",
|
|
11
|
-
"license": "ISC"
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./index.js"
|
|
15
|
+
},
|
|
16
|
+
"./bundle": {
|
|
17
|
+
"import": "./bundle.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"bundle.js",
|
|
22
|
+
"*.js",
|
|
23
|
+
"*.d.ts",
|
|
24
|
+
"*.js.map"
|
|
25
|
+
]
|
|
12
26
|
}
|
package/react.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createComponent } from '@lit-labs/react';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ColorPicker } from './color-picker.component.js';
|
|
4
4
|
export const HyColorPicker = createComponent({
|
|
5
|
-
tagName: '
|
|
5
|
+
tagName: 'nr-color-picker',
|
|
6
6
|
elementClass: ColorPicker,
|
|
7
7
|
react: React,
|
|
8
8
|
events: {
|
package/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/components/colorpicker/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;IAC3C,OAAO,EAAE,iBAAiB;IAC1B,YAAY,EAAE,WAAW;IACzB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACN,WAAW,EAAE,cAAc;QAC3B,MAAM,EAAE,QAAQ;KACjB;CACF,CAAC,CAAC","sourcesContent":["import { createComponent } from '@lit-labs/react';\nimport * as React from 'react';\nimport { ColorPicker } from './color-picker.component.js';\n\nexport const HyColorPicker = createComponent({\n tagName: '
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/components/colorpicker/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;IAC3C,OAAO,EAAE,iBAAiB;IAC1B,YAAY,EAAE,WAAW;IACzB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACN,WAAW,EAAE,cAAc;QAC3B,MAAM,EAAE,QAAQ;KACjB;CACF,CAAC,CAAC","sourcesContent":["import { createComponent } from '@lit-labs/react';\nimport * as React from 'react';\nimport { ColorPicker } from './color-picker.component.js';\n\nexport const HyColorPicker = createComponent({\n tagName: 'nr-color-picker',\n elementClass: ColorPicker,\n react: React,\n events: {\n colorChange: 'color-change',\n change: 'change',\n },\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-holder.component.d.ts","sourceRoot":"","sources":["../../../src/components/colorpicker/color-holder.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAO,MAAM,KAAK,CAAC;AAGrC,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,qBACa,cAAe,SAAQ,UAAU;IAE5C,KAAK,SAAa;IAGlB,IAAI,EAAG,eAAe,CAAC;IAEvB,OAAgB,MAAM,0BAAU;IAEvB,MAAM;CAGhB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-holder.style.d.ts","sourceRoot":"","sources":["../../../src/components/colorpicker/color-holder.style.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,MAAM,yBAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.component.d.ts","sourceRoot":"","sources":["../../../src/components/colorpicker/color-picker.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,cAAc,EAAgB,MAAM,KAAK,CAAC;AAE9D,OAAO,6BAA6B,CAAC;AACrC,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAExD,qBACa,WAAY,SAAQ,UAAU;IAEzC,KAAK,SAAiB;IAGtB,IAAI,UAAS;IAGb,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAGrC,QAAQ,UAAS;IAGjB,IAAI,kBAA2B;IAG/B,YAAY,UAAK;IAEjB,OAAgB,MAAM,0BAAU;;IASvB,iBAAiB,IAAI,IAAI;IASzB,OAAO,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;YAK3C,iBAAiB;IAK/B,OAAO,CAAC,cAAc,CAIpB;IACF,OAAO,CAAC,yBAAyB,CA4B/B;IAEF,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,iBAAiB;IAIhB,oBAAoB,IAAI,IAAI;IAK5B,MAAM;CAmBhB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.style.d.ts","sourceRoot":"","sources":["../../../src/components/colorpicker/color-picker.style.ts"],"names":[],"mappings":";AAEA,wBAwEE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.types.d.ts","sourceRoot":"","sources":["../../../src/components/colorpicker/color-picker.types.ts"],"names":[],"mappings":"AAAA,0BAAkB,eAAe;IAC/B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-color-sets.component.d.ts","sourceRoot":"","sources":["../../../src/components/colorpicker/default-color-sets.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAO,MAAM,KAAK,CAAC;AAGrC,OAAO,6BAA6B,CAAC;AACrC,qBACa,gBAAiB,SAAQ,UAAU;IAE9C,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAErC,OAAgB,MAAM,0BAAU;IAEhC,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAUrB,MAAM;CAchB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-color-sets.style.d.ts","sourceRoot":"","sources":["../../../src/components/colorpicker/default-color-sets.style.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,MAAM,yBAAwB,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2023 Google Laabidi Aymen
|
|
4
|
-
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/
|
|
6
|
-
import { LitElement } from 'lit';
|
|
7
|
-
import '../color-picker.component';
|
|
8
|
-
import '../../../helpers/ThemeHandler';
|
|
9
|
-
export declare class ColorDemoElement extends LitElement {
|
|
10
|
-
static styles: import("lit").CSSResult;
|
|
11
|
-
render(): import("lit").TemplateResult<1>;
|
|
12
|
-
}
|
|
13
|
-
declare global {
|
|
14
|
-
interface HTMLElementTagNameMap {
|
|
15
|
-
'hy-colorpicker-demo': ColorDemoElement;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=color-picker-demo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker-demo.d.ts","sourceRoot":"","sources":["../../../../src/components/colorpicker/demo/color-picker-demo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,UAAU,EAAY,MAAM,KAAK,CAAC;AAE1C,OAAO,2BAA2B,CAAC;AACnC,OAAO,+BAA+B,CAAC;AAEvC,qBACa,gBAAiB,SAAQ,UAAU;IAC9C,OAAgB,MAAM,0BAKpB;IAEO,MAAM;CAiIhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,gBAAgB,CAAC;KACzC;CACF"}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2023 Google Laabidi Aymen
|
|
4
|
-
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/
|
|
6
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
-
};
|
|
12
|
-
import { LitElement, html, css } from 'lit';
|
|
13
|
-
import { customElement } from 'lit/decorators.js';
|
|
14
|
-
import '../color-picker.component';
|
|
15
|
-
import '../../../helpers/ThemeHandler';
|
|
16
|
-
let ColorDemoElement = class ColorDemoElement extends LitElement {
|
|
17
|
-
render() {
|
|
18
|
-
return html `
|
|
19
|
-
<theme-handler>
|
|
20
|
-
<div style="display: flex;">
|
|
21
|
-
<!-- Left Section -->
|
|
22
|
-
<div>
|
|
23
|
-
<h3>Default</h3>
|
|
24
|
-
<hy-color-picker
|
|
25
|
-
@color-changed="${(e) => {
|
|
26
|
-
console.log(e.detail.value);
|
|
27
|
-
}}"
|
|
28
|
-
></hy-color-picker>
|
|
29
|
-
<br />
|
|
30
|
-
<h3>With default color value</h3>
|
|
31
|
-
<hy-color-picker
|
|
32
|
-
.color="${'#E92222'}"
|
|
33
|
-
@color-changed="${(e) => {
|
|
34
|
-
console.log(e.detail.value);
|
|
35
|
-
}}"
|
|
36
|
-
></hy-color-picker>
|
|
37
|
-
<br />
|
|
38
|
-
<h3>With default color value and color sets</h3>
|
|
39
|
-
<hy-color-picker
|
|
40
|
-
.color="${'#ECDA1E'}"
|
|
41
|
-
.defaultColorSets=${[
|
|
42
|
-
'#264653',
|
|
43
|
-
'#2a9d8f',
|
|
44
|
-
'#e9c46a',
|
|
45
|
-
'#f4a261',
|
|
46
|
-
'#e76f51',
|
|
47
|
-
'#e63946',
|
|
48
|
-
'#f1faee',
|
|
49
|
-
'#a8dadc',
|
|
50
|
-
'#457b9d',
|
|
51
|
-
'#1d3557',
|
|
52
|
-
]}
|
|
53
|
-
@color-changed="${(e) => {
|
|
54
|
-
console.log(e.detail.value);
|
|
55
|
-
}}"
|
|
56
|
-
></hy-color-picker>
|
|
57
|
-
<br />
|
|
58
|
-
<h3>Disabled color picker</h3>
|
|
59
|
-
<hy-color-picker
|
|
60
|
-
.disabled=${true}
|
|
61
|
-
.color="${'#67d640'}"
|
|
62
|
-
@color-changed="${(e) => {
|
|
63
|
-
console.log(e.detail.value);
|
|
64
|
-
}}"
|
|
65
|
-
></hy-color-picker>
|
|
66
|
-
|
|
67
|
-
<br />
|
|
68
|
-
<h3>small color picker</h3>
|
|
69
|
-
<hy-color-picker
|
|
70
|
-
.color="${'#E92222'}"
|
|
71
|
-
.size="${'small'}"
|
|
72
|
-
@color-changed="${(e) => {
|
|
73
|
-
console.log(e.detail.value);
|
|
74
|
-
}}"
|
|
75
|
-
></hy-color-picker>
|
|
76
|
-
|
|
77
|
-
<br />
|
|
78
|
-
<h3>large color picker</h3>
|
|
79
|
-
<hy-color-picker
|
|
80
|
-
.color="${'#ECDA1E'}"
|
|
81
|
-
.size="${'large'}"
|
|
82
|
-
@color-changed="${(e) => {
|
|
83
|
-
console.log(e.detail.value);
|
|
84
|
-
}}"
|
|
85
|
-
></hy-color-picker>
|
|
86
|
-
|
|
87
|
-
<br />
|
|
88
|
-
<div style="margin-top:50%;">
|
|
89
|
-
<hy-color-picker
|
|
90
|
-
.color="${'#67d640'}"
|
|
91
|
-
@color-changed="${(e) => {
|
|
92
|
-
console.log(e.detail.value);
|
|
93
|
-
}}"
|
|
94
|
-
></hy-color-picker>
|
|
95
|
-
</div>
|
|
96
|
-
<br />
|
|
97
|
-
<div style="margin-top:100%;">
|
|
98
|
-
<hy-color-picker
|
|
99
|
-
.color="${'#000000'}"
|
|
100
|
-
@color-changed="${(e) => {
|
|
101
|
-
console.log(e.detail.value);
|
|
102
|
-
}}"
|
|
103
|
-
></hy-color-picker>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
<!-- Right Section -->
|
|
108
|
-
<div id="right">
|
|
109
|
-
<h3>Right Demo Section</h3>
|
|
110
|
-
<hy-color-picker
|
|
111
|
-
.color="${'#3498db'}"
|
|
112
|
-
@color-changed="${(e) => {
|
|
113
|
-
console.log('Right side color changed:', e.detail.value);
|
|
114
|
-
}}"
|
|
115
|
-
></hy-color-picker>
|
|
116
|
-
<br />
|
|
117
|
-
<h3>Another color picker</h3>
|
|
118
|
-
<hy-color-picker
|
|
119
|
-
id="right-block"
|
|
120
|
-
|
|
121
|
-
.color="${'#9b59b6'}"
|
|
122
|
-
@color-changed="${(e) => {
|
|
123
|
-
console.log('Right side color changed:', e.detail.value);
|
|
124
|
-
}}"
|
|
125
|
-
></hy-color-picker>
|
|
126
|
-
<br />
|
|
127
|
-
<h3>Custom color set on the right</h3>
|
|
128
|
-
<hy-color-picker
|
|
129
|
-
.color="${'#f39c12'}"
|
|
130
|
-
.defaultColorSets=${[
|
|
131
|
-
'#8e44ad',
|
|
132
|
-
'#e74c3c',
|
|
133
|
-
'#2ecc71',
|
|
134
|
-
'#f1c40f',
|
|
135
|
-
'#3498db',
|
|
136
|
-
]}
|
|
137
|
-
@color-changed="${(e) => {
|
|
138
|
-
console.log('Right side color changed:', e.detail.value);
|
|
139
|
-
}}"
|
|
140
|
-
></hy-color-picker>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
</theme-handler>
|
|
144
|
-
`;
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
ColorDemoElement.styles = css `
|
|
148
|
-
#right-block {
|
|
149
|
-
right: 0;
|
|
150
|
-
position: fixed;
|
|
151
|
-
}
|
|
152
|
-
`;
|
|
153
|
-
ColorDemoElement = __decorate([
|
|
154
|
-
customElement('hy-colorpicker-demo')
|
|
155
|
-
], ColorDemoElement);
|
|
156
|
-
export { ColorDemoElement };
|
|
157
|
-
//# sourceMappingURL=color-picker-demo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker-demo.js","sourceRoot":"","sources":["../../../../src/components/colorpicker/demo/color-picker-demo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;AAEH,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAC,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,2BAA2B,CAAC;AACnC,OAAO,+BAA+B,CAAC;AAGvC,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,UAAU;IAQrC,MAAM;QACb,OAAO,IAAI,CAAA;;;;;;;gCAOiB,CAAC,CAAc,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;;;;;wBAKmB,SAAS;gCACD,CAAC,CAAc,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;;;;;wBAKmB,SAAS;kCACC;YAC5B,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;gCAC2B,CAAC,CAAc,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;;;;;0BAKqB,IAAI;wBACN,SAAS;gCACD,CAAC,CAAc,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;;;;;;wBAMmB,SAAS;uBACV,OAAO;gCACE,CAAC,CAAc,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;;;;;;wBAMmB,SAAS;uBACV,OAAO;gCACE,CAAC,CAAc,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;;;;;;0BAMqB,SAAS;kCACD,CAAC,CAAc,EAAE,EAAE;YAC/C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;;;;;;0BAMqB,SAAS;kCACD,CAAC,CAAc,EAAE,EAAE;YAC/C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;;;;;;;;;wBASmB,SAAS;gCACD,CAAC,CAAc,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC;;;;;;;wBAOmB,SAAS;gCACD,CAAC,CAAc,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC;;;;;wBAKmB,SAAS;kCACC;YAC5B,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;gCAC2B,CAAC,CAAc,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC;;;;;KAKA,CAAC;IACJ,CAAC;CACF,CAAA;AAxIiB,uBAAM,GAAG,GAAG,CAAA;;;;;GAK1B,CAAA;AANS,gBAAgB;IAD5B,aAAa,CAAC,qBAAqB,CAAC;GACxB,gBAAgB,CAyI5B;SAzIY,gBAAgB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport {LitElement, html, css} from 'lit';\nimport {customElement} from 'lit/decorators.js';\nimport '../color-picker.component';\nimport '../../../helpers/ThemeHandler';\n\n@customElement('hy-colorpicker-demo')\nexport class ColorDemoElement extends LitElement {\n static override styles = css`\n #right-block {\n right: 0;\n position: fixed;\n }\n `;\n\n override render() {\n return html`\n <theme-handler>\n <div style=\"display: flex;\">\n <!-- Left Section -->\n <div>\n <h3>Default</h3>\n <hy-color-picker\n @color-changed=\"${(e: CustomEvent) => {\n console.log(e.detail.value);\n }}\"\n ></hy-color-picker>\n <br />\n <h3>With default color value</h3>\n <hy-color-picker\n .color=\"${'#E92222'}\"\n @color-changed=\"${(e: CustomEvent) => {\n console.log(e.detail.value);\n }}\"\n ></hy-color-picker>\n <br />\n <h3>With default color value and color sets</h3>\n <hy-color-picker\n .color=\"${'#ECDA1E'}\"\n .defaultColorSets=${[\n '#264653',\n '#2a9d8f',\n '#e9c46a',\n '#f4a261',\n '#e76f51',\n '#e63946',\n '#f1faee',\n '#a8dadc',\n '#457b9d',\n '#1d3557',\n ]}\n @color-changed=\"${(e: CustomEvent) => {\n console.log(e.detail.value);\n }}\"\n ></hy-color-picker>\n <br />\n <h3>Disabled color picker</h3>\n <hy-color-picker\n .disabled=${true}\n .color=\"${'#67d640'}\"\n @color-changed=\"${(e: CustomEvent) => {\n console.log(e.detail.value);\n }}\"\n ></hy-color-picker>\n\n <br />\n <h3>small color picker</h3>\n <hy-color-picker\n .color=\"${'#E92222'}\"\n .size=\"${'small'}\"\n @color-changed=\"${(e: CustomEvent) => {\n console.log(e.detail.value);\n }}\"\n ></hy-color-picker>\n\n <br />\n <h3>large color picker</h3>\n <hy-color-picker\n .color=\"${'#ECDA1E'}\"\n .size=\"${'large'}\"\n @color-changed=\"${(e: CustomEvent) => {\n console.log(e.detail.value);\n }}\"\n ></hy-color-picker>\n\n <br />\n <div style=\"margin-top:50%;\">\n <hy-color-picker\n .color=\"${'#67d640'}\"\n @color-changed=\"${(e: CustomEvent) => {\n console.log(e.detail.value);\n }}\"\n ></hy-color-picker>\n </div>\n <br />\n <div style=\"margin-top:100%;\">\n <hy-color-picker\n .color=\"${'#000000'}\"\n @color-changed=\"${(e: CustomEvent) => {\n console.log(e.detail.value);\n }}\"\n ></hy-color-picker>\n </div>\n </div>\n\n <!-- Right Section -->\n <div id=\"right\">\n <h3>Right Demo Section</h3>\n <hy-color-picker\n .color=\"${'#3498db'}\"\n @color-changed=\"${(e: CustomEvent) => {\n console.log('Right side color changed:', e.detail.value);\n }}\"\n ></hy-color-picker>\n <br />\n <h3>Another color picker</h3>\n <hy-color-picker\n id=\"right-block\"\n \n .color=\"${'#9b59b6'}\"\n @color-changed=\"${(e: CustomEvent) => {\n console.log('Right side color changed:', e.detail.value);\n }}\"\n ></hy-color-picker>\n <br />\n <h3>Custom color set on the right</h3>\n <hy-color-picker\n .color=\"${'#f39c12'}\"\n .defaultColorSets=${[\n '#8e44ad',\n '#e74c3c',\n '#2ecc71',\n '#f1c40f',\n '#3498db',\n ]}\n @color-changed=\"${(e: CustomEvent) => {\n console.log('Right side color changed:', e.detail.value);\n }}\"\n ></hy-color-picker>\n </div>\n </div>\n </theme-handler>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hy-colorpicker-demo': ColorDemoElement;\n }\n}"]}
|
package/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/colorpicker/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC"}
|
package/react.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/components/colorpicker/react.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,eAAO,MAAM,aAAa;;;EAQxB,CAAC"}
|