@alegendstale/holly-components 0.2.8 → 0.2.10
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/dist/components/absolute-container/absolute-container.js +113 -91
- package/dist/components/absolute-container/absolute-container.stories.js +36 -0
- package/dist/components/absolute-container/index.js +1 -1
- package/dist/components/bottom-sheet/bottom-sheet.js +415 -308
- package/dist/components/bottom-sheet/bottom-sheet.stories.js +43 -0
- package/dist/components/bottom-sheet/bottom-sheet.test.js +15 -0
- package/dist/components/bottom-sheet/index.js +1 -1
- package/dist/components/canvas/canvas-base.d.ts +2 -1
- package/dist/components/canvas/canvas-base.d.ts.map +1 -1
- package/dist/components/canvas/canvas-base.js +56 -44
- package/dist/components/canvas/canvas-gradient.d.ts.map +1 -1
- package/dist/components/canvas/canvas-gradient.js +61 -45
- package/dist/components/canvas/canvas-image.js +158 -111
- package/dist/components/canvas/index.js +2 -2
- package/dist/components/carousel-scroller/carousel-scroller.js +133 -121
- package/dist/components/carousel-scroller/carousel-scroller.stories.js +40 -0
- package/dist/components/carousel-scroller/index.js +1 -1
- package/dist/components/color-palette/color-palette-utils.d.ts.map +1 -1
- package/dist/components/color-palette/color-palette-utils.js +105 -40
- package/dist/components/color-palette/color-palette.js +429 -337
- package/dist/components/color-palette/component/color-palette-component.js +184 -142
- package/dist/components/color-palette/component/color-palette-component.stories.js +74 -0
- package/dist/components/color-palette/component/index.js +1 -0
- package/dist/components/color-palette/editor/color-palette-editor.js +702 -591
- package/dist/components/color-palette/editor/color-palette-editor.stories.js +39 -0
- package/dist/components/color-palette/editor/index.js +1 -0
- package/dist/components/color-palette/index.js +5 -7
- package/dist/components/color-palette/item/color-palette-item-edit.js +114 -87
- package/dist/components/color-palette/item/color-palette-item.js +155 -140
- package/dist/components/color-palette/item/index.js +2 -0
- package/dist/components/color-palette/menu/color-palette-menu.js +241 -217
- package/dist/components/color-palette/menu/color-palette-reorder.js +117 -103
- package/dist/components/color-palette/menu/index.js +2 -0
- package/dist/components/color-palette/storybook/color-palette-invalid.stories.js +90 -0
- package/dist/components/color-palette/storybook/color-palette-valid.stories.js +295 -0
- package/dist/components/color-palette/storybook/color-palette.stories.js +76 -0
- package/dist/components/tool-tip/Tooltip2.js +103 -0
- package/dist/components/tool-tip/index.js +1 -1
- package/dist/components/tool-tip/tool-tip.d.ts +1 -0
- package/dist/components/tool-tip/tool-tip.d.ts.map +1 -1
- package/dist/components/tool-tip/tool-tip.js +125 -102
- package/dist/components/tool-tip/tool-tip.stories.js +30 -0
- package/dist/index.js +6 -14
- package/dist/utils/EventEmitter.js +23 -23
- package/dist/utils/basicUtils.d.ts +2 -0
- package/dist/utils/basicUtils.d.ts.map +1 -1
- package/dist/utils/basicUtils.js +149 -23
- package/dist/utils/dragDropUtils.js +121 -0
- package/dist/utils/generateUtils.js +73 -39
- package/dist/utils/types.d.ts +1 -1
- package/dist/utils/types.d.ts.map +1 -1
- package/dist/utils/types.js +1 -0
- package/package.json +2 -3
|
@@ -1,108 +1,122 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
)
|
|
33
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import colorsea from 'colorsea';
|
|
8
|
+
import { LitElement, html, css } from 'lit';
|
|
9
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
10
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
11
|
+
import { EventEmitter } from '../../../utils/EventEmitter';
|
|
12
|
+
var Reorder;
|
|
13
|
+
(function (Reorder) {
|
|
14
|
+
Reorder["Hue"] = "Hue";
|
|
15
|
+
Reorder["Saturation"] = "Saturation";
|
|
16
|
+
Reorder["Lightness"] = "Lightness";
|
|
17
|
+
Reorder["Red"] = "Red";
|
|
18
|
+
Reorder["Green"] = "Green";
|
|
19
|
+
Reorder["Blue"] = "Blue";
|
|
20
|
+
Reorder["Alpha"] = "Alpha";
|
|
21
|
+
})(Reorder || (Reorder = {}));
|
|
22
|
+
let ColorPaletteReorder = class ColorPaletteReorder extends LitElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.colors = [];
|
|
26
|
+
this.emitter = new EventEmitter();
|
|
27
|
+
}
|
|
28
|
+
disconnectedCallback() {
|
|
29
|
+
super.disconnectedCallback();
|
|
30
|
+
this.emitter.clear();
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
return html `
|
|
34
|
+
<menu>
|
|
35
|
+
${repeat(Object.keys(Reorder), (item) => {
|
|
36
|
+
return html `
|
|
37
|
+
<button
|
|
38
|
+
@click=${(e) => {
|
|
39
|
+
this.selectOption(item);
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<span>${item}</span>
|
|
43
|
+
</button>
|
|
44
|
+
`;
|
|
45
|
+
})}
|
|
46
|
+
</menu>
|
|
34
47
|
`;
|
|
35
|
-
}
|
|
36
|
-
selectOption(t) {
|
|
37
|
-
const o = this.colors.map((e) => u(e));
|
|
38
|
-
let s = [];
|
|
39
|
-
switch (t) {
|
|
40
|
-
case "Hue":
|
|
41
|
-
s = o.sort((e, r) => e.hue() - r.hue()).map((e) => e.hex());
|
|
42
|
-
break;
|
|
43
|
-
case "Saturation":
|
|
44
|
-
s = o.sort((e, r) => e.saturation() - r.saturation()).map((e) => e.hex());
|
|
45
|
-
break;
|
|
46
|
-
case "Lightness":
|
|
47
|
-
s = o.sort((e, r) => e.lightness() - r.lightness()).map((e) => e.hex());
|
|
48
|
-
break;
|
|
49
|
-
case "Red":
|
|
50
|
-
s = o.sort((e, r) => e.red() - r.red()).map((e) => e.hex());
|
|
51
|
-
break;
|
|
52
|
-
case "Green":
|
|
53
|
-
s = o.sort((e, r) => e.green() - r.green()).map((e) => e.hex());
|
|
54
|
-
break;
|
|
55
|
-
case "Blue":
|
|
56
|
-
s = o.sort((e, r) => e.blue() - r.blue()).map((e) => e.hex());
|
|
57
|
-
break;
|
|
58
|
-
case "Alpha":
|
|
59
|
-
s = o.sort((e, r) => e.alpha() - r.alpha()).map((e) => e.hex());
|
|
60
|
-
break;
|
|
61
48
|
}
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
selectOption(item) {
|
|
50
|
+
// Create colorsea array
|
|
51
|
+
const csColors = this.colors.map((color) => {
|
|
52
|
+
return colorsea(color);
|
|
53
|
+
});
|
|
54
|
+
let colors = [];
|
|
55
|
+
switch (item) {
|
|
56
|
+
case Reorder.Hue:
|
|
57
|
+
colors = csColors.sort((a, b) => a.hue() - b.hue()).map((color) => color.hex());
|
|
58
|
+
break;
|
|
59
|
+
case Reorder.Saturation:
|
|
60
|
+
colors = csColors.sort((a, b) => a.saturation() - b.saturation()).map((color) => color.hex());
|
|
61
|
+
break;
|
|
62
|
+
case Reorder.Lightness:
|
|
63
|
+
colors = csColors.sort((a, b) => a.lightness() - b.lightness()).map((color) => color.hex());
|
|
64
|
+
break;
|
|
65
|
+
case Reorder.Red:
|
|
66
|
+
colors = csColors.sort((a, b) => a.red() - b.red()).map((color) => color.hex());
|
|
67
|
+
break;
|
|
68
|
+
case Reorder.Green:
|
|
69
|
+
colors = csColors.sort((a, b) => a.green() - b.green()).map((color) => color.hex());
|
|
70
|
+
break;
|
|
71
|
+
case Reorder.Blue:
|
|
72
|
+
colors = csColors.sort((a, b) => a.blue() - b.blue()).map((color) => color.hex());
|
|
73
|
+
break;
|
|
74
|
+
case Reorder.Alpha:
|
|
75
|
+
colors = csColors.sort((a, b) => a.alpha() - b.alpha()).map((color) => color.hex());
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
this.emitter.emit('submit', colors);
|
|
79
|
+
}
|
|
64
80
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
:host {
|
|
68
|
-
display: block;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
menu {
|
|
72
|
-
display: flex;
|
|
73
|
-
flex-direction: column;
|
|
74
|
-
gap: .5rem;
|
|
75
|
-
background-color: rgb(27, 27, 27);
|
|
76
|
-
padding: .5rem;
|
|
77
|
-
border-radius: 5px;
|
|
78
|
-
|
|
79
|
-
button {
|
|
80
|
-
color: rgb(245, 245, 245);
|
|
81
|
-
background-color: transparent;
|
|
82
|
-
border: none;
|
|
83
|
-
padding: 4px 12px;
|
|
84
|
-
cursor: pointer;
|
|
85
|
-
|
|
86
|
-
&:hover {
|
|
87
|
-
background-color: rgb(75, 75, 75);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
span {
|
|
91
|
-
font-size: 14px;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
81
|
+
ColorPaletteReorder.styles = [
|
|
82
|
+
css `
|
|
83
|
+
:host {
|
|
84
|
+
display: block;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
menu {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
gap: .5rem;
|
|
91
|
+
background-color: rgb(27, 27, 27);
|
|
92
|
+
padding: .5rem;
|
|
93
|
+
border-radius: 5px;
|
|
94
|
+
|
|
95
|
+
button {
|
|
96
|
+
color: rgb(245, 245, 245);
|
|
97
|
+
background-color: transparent;
|
|
98
|
+
border: none;
|
|
99
|
+
padding: 4px 12px;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
|
|
102
|
+
&:hover {
|
|
103
|
+
background-color: rgb(75, 75, 75);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
span {
|
|
107
|
+
font-size: 14px;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
95
111
|
`
|
|
96
112
|
];
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
],
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
],
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
],
|
|
106
|
-
export {
|
|
107
|
-
a as ColorPaletteReorder
|
|
108
|
-
};
|
|
113
|
+
__decorate([
|
|
114
|
+
query('absolute-container')
|
|
115
|
+
], ColorPaletteReorder.prototype, "absolute", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
property({ type: Array })
|
|
118
|
+
], ColorPaletteReorder.prototype, "colors", void 0);
|
|
119
|
+
ColorPaletteReorder = __decorate([
|
|
120
|
+
customElement('color-palette-reorder')
|
|
121
|
+
], ColorPaletteReorder);
|
|
122
|
+
export { ColorPaletteReorder };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { defaultSettings } from '../color-palette-utils';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Color Palette/Palette/Invalid',
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
component: 'color-palette',
|
|
7
|
+
subcomponents: { ColorPaletteItem: 'color-palette-item' },
|
|
8
|
+
argTypes: {
|
|
9
|
+
direction: {
|
|
10
|
+
options: ['row', 'column'],
|
|
11
|
+
control: {
|
|
12
|
+
type: 'select',
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
const Template = {
|
|
19
|
+
render: ({ colors, height, width, direction, gradient, preventHover, override, aliases }) => {
|
|
20
|
+
return html `
|
|
21
|
+
<color-palette
|
|
22
|
+
.colors=${colors}
|
|
23
|
+
height=${height || defaultSettings.height}
|
|
24
|
+
width=${width || defaultSettings.width}
|
|
25
|
+
direction=${direction || defaultSettings.direction}
|
|
26
|
+
?gradient=${gradient || defaultSettings.gradient}
|
|
27
|
+
?preventHover=${preventHover || defaultSettings.preventHover}
|
|
28
|
+
?override=${override || defaultSettings.override}
|
|
29
|
+
.aliases=${aliases}
|
|
30
|
+
>
|
|
31
|
+
</color-palette>
|
|
32
|
+
`;
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export const InvalidColors = {
|
|
36
|
+
...Template,
|
|
37
|
+
args: {
|
|
38
|
+
colors: [
|
|
39
|
+
'#444;',
|
|
40
|
+
'5'
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export const OneColorGradient = {
|
|
45
|
+
...Template,
|
|
46
|
+
args: {
|
|
47
|
+
colors: [
|
|
48
|
+
'#444'
|
|
49
|
+
],
|
|
50
|
+
gradient: true
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export const NonOverriddenPalette = {
|
|
54
|
+
...Template,
|
|
55
|
+
args: {
|
|
56
|
+
colors: [
|
|
57
|
+
'rgb(var(--ctp-peach))'
|
|
58
|
+
],
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
export const InvalidSettings = {
|
|
62
|
+
...Template,
|
|
63
|
+
args: {
|
|
64
|
+
colors: [
|
|
65
|
+
'#555'
|
|
66
|
+
],
|
|
67
|
+
// @ts-expect-error
|
|
68
|
+
aliases: {}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
export const InvalidColorsSettings = {
|
|
72
|
+
...Template,
|
|
73
|
+
args: {
|
|
74
|
+
colors: [
|
|
75
|
+
'#5'
|
|
76
|
+
],
|
|
77
|
+
// @ts-expect-error
|
|
78
|
+
aliases: {}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
export const InvalidDirections = {
|
|
82
|
+
...Template,
|
|
83
|
+
args: {
|
|
84
|
+
colors: [
|
|
85
|
+
'#555'
|
|
86
|
+
],
|
|
87
|
+
// @ts-expect-error
|
|
88
|
+
direction: 'hello'
|
|
89
|
+
}
|
|
90
|
+
};
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { defaultSettings, Direction } from '../color-palette-utils';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Color Palette/Palette/Valid',
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
component: 'color-palette',
|
|
7
|
+
subcomponents: { ColorPaletteItem: 'color-palette-item' },
|
|
8
|
+
argTypes: {
|
|
9
|
+
direction: {
|
|
10
|
+
options: ['row', 'column'],
|
|
11
|
+
control: {
|
|
12
|
+
type: 'select',
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
const Template = {
|
|
19
|
+
render: ({ colors, height, width, direction, gradient, preventHover, override, aliases }) => {
|
|
20
|
+
return html `
|
|
21
|
+
<color-palette
|
|
22
|
+
.colors=${colors}
|
|
23
|
+
height=${height || defaultSettings.height}
|
|
24
|
+
width=${width || defaultSettings.width}
|
|
25
|
+
direction=${direction || defaultSettings.direction}
|
|
26
|
+
?gradient=${gradient || defaultSettings.gradient}
|
|
27
|
+
?preventHover=${preventHover || defaultSettings.preventHover}
|
|
28
|
+
?override=${override || defaultSettings.override}
|
|
29
|
+
.aliases=${aliases}
|
|
30
|
+
>
|
|
31
|
+
</color-palette>
|
|
32
|
+
`;
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export const Hex = {
|
|
36
|
+
...Template,
|
|
37
|
+
args: {
|
|
38
|
+
colors: [
|
|
39
|
+
'#434',
|
|
40
|
+
'#F6F7D7'
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export const HSL = {
|
|
45
|
+
...Template,
|
|
46
|
+
args: {
|
|
47
|
+
colors: [
|
|
48
|
+
'hsl(5, 20%, 70%);',
|
|
49
|
+
'hsl(5, 70%, 70%);'
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
export const RGB = {
|
|
54
|
+
...Template,
|
|
55
|
+
args: {
|
|
56
|
+
colors: [
|
|
57
|
+
'rgb(123, 555, 777);',
|
|
58
|
+
'rgb(122, 222, 772);'
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export const NamedColors = {
|
|
63
|
+
...Template,
|
|
64
|
+
args: {
|
|
65
|
+
colors: [
|
|
66
|
+
'grey',
|
|
67
|
+
'pink'
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
export const URLWithSettings = {
|
|
72
|
+
...Template,
|
|
73
|
+
args: {
|
|
74
|
+
colors: [
|
|
75
|
+
'https://colorhunt.co/palette/3ec1d3f6f7d7ff9a00ff165d',
|
|
76
|
+
],
|
|
77
|
+
gradient: true
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
export const HexHorizontalWithSettings = {
|
|
81
|
+
...Template,
|
|
82
|
+
args: {
|
|
83
|
+
colors: [
|
|
84
|
+
'#434',
|
|
85
|
+
'#f6f7d7',
|
|
86
|
+
'#3EC1D3',
|
|
87
|
+
'#FF165D',
|
|
88
|
+
'#FF9A00',
|
|
89
|
+
'#f6f7d7'
|
|
90
|
+
],
|
|
91
|
+
gradient: true
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
export const Semicolon = {
|
|
95
|
+
...Template,
|
|
96
|
+
args: {
|
|
97
|
+
colors: [
|
|
98
|
+
'#111;',
|
|
99
|
+
'#555;',
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
export const EightCharacterHex = {
|
|
104
|
+
...Template,
|
|
105
|
+
args: {
|
|
106
|
+
colors: [
|
|
107
|
+
'#00444555',
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
export const Black = {
|
|
112
|
+
...Template,
|
|
113
|
+
args: {
|
|
114
|
+
colors: [
|
|
115
|
+
'#000',
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
export const Hex_RGB_HSL = {
|
|
120
|
+
...Template,
|
|
121
|
+
args: {
|
|
122
|
+
colors: [
|
|
123
|
+
'#667',
|
|
124
|
+
'rgb(200, 200, 100)',
|
|
125
|
+
'hsl(12, 66%, 99%)'
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
export const HeightDirection = {
|
|
130
|
+
...Template,
|
|
131
|
+
args: {
|
|
132
|
+
colors: [
|
|
133
|
+
'#434',
|
|
134
|
+
'#f6f7d7',
|
|
135
|
+
'#3EC1D3',
|
|
136
|
+
'#FF165D',
|
|
137
|
+
'#FF9A00',
|
|
138
|
+
'#f6f7d7'
|
|
139
|
+
],
|
|
140
|
+
height: 300,
|
|
141
|
+
direction: Direction.Row
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
export const HorizontalGradient = {
|
|
145
|
+
...Template,
|
|
146
|
+
args: {
|
|
147
|
+
colors: [
|
|
148
|
+
'#444',
|
|
149
|
+
'#545',
|
|
150
|
+
],
|
|
151
|
+
gradient: true
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
export const VerticalGradient = {
|
|
155
|
+
...Template,
|
|
156
|
+
args: {
|
|
157
|
+
colors: [
|
|
158
|
+
'#afc',
|
|
159
|
+
'#b31',
|
|
160
|
+
],
|
|
161
|
+
gradient: true,
|
|
162
|
+
height: 300,
|
|
163
|
+
direction: Direction.Row
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
export const Aliases = {
|
|
167
|
+
...Template,
|
|
168
|
+
args: {
|
|
169
|
+
colors: [
|
|
170
|
+
'#444',
|
|
171
|
+
'#222',
|
|
172
|
+
'#322'
|
|
173
|
+
],
|
|
174
|
+
direction: Direction.Row,
|
|
175
|
+
aliases: [
|
|
176
|
+
'grey',
|
|
177
|
+
'black',
|
|
178
|
+
'brown'
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
export const AliasesSkipColor = {
|
|
183
|
+
...Template,
|
|
184
|
+
args: {
|
|
185
|
+
colors: [
|
|
186
|
+
'https://coolors.co/palette/606c38-283618-fefae0-dda15e-bc6c25',
|
|
187
|
+
],
|
|
188
|
+
aliases: [
|
|
189
|
+
'',
|
|
190
|
+
'light green',
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
export const Width = {
|
|
195
|
+
...Template,
|
|
196
|
+
args: {
|
|
197
|
+
colors: [
|
|
198
|
+
'#999',
|
|
199
|
+
'#222'
|
|
200
|
+
],
|
|
201
|
+
gradient: true,
|
|
202
|
+
height: 200,
|
|
203
|
+
direction: Direction.Column,
|
|
204
|
+
width: 400
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
export const PreventHover = {
|
|
208
|
+
...Template,
|
|
209
|
+
args: {
|
|
210
|
+
colors: [
|
|
211
|
+
'#8ec178',
|
|
212
|
+
'#25136d'
|
|
213
|
+
],
|
|
214
|
+
gradient: false,
|
|
215
|
+
direction: Direction.Column,
|
|
216
|
+
preventHover: true,
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
export const Override = {
|
|
220
|
+
...Template,
|
|
221
|
+
args: {
|
|
222
|
+
colors: [
|
|
223
|
+
'var(--color-orange)',
|
|
224
|
+
],
|
|
225
|
+
override: true,
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
export const RGBA_CSS_Variable = {
|
|
229
|
+
...Template,
|
|
230
|
+
args: {
|
|
231
|
+
colors: [
|
|
232
|
+
'rgba(var(--color-green-rgb), .5)',
|
|
233
|
+
],
|
|
234
|
+
override: true,
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
export const RGBSettings = {
|
|
238
|
+
...Template,
|
|
239
|
+
args: {
|
|
240
|
+
colors: [
|
|
241
|
+
'rgb(123, 555, 777);',
|
|
242
|
+
'rgb(122, 222, 772);'
|
|
243
|
+
],
|
|
244
|
+
gradient: true,
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
export const Others = {
|
|
248
|
+
...Template,
|
|
249
|
+
args: {
|
|
250
|
+
colors: [
|
|
251
|
+
'https://colorhunt.co/palette/3ec1d3f6f7d7ff9a00ff165d',
|
|
252
|
+
],
|
|
253
|
+
gradient: true,
|
|
254
|
+
direction: Direction.Column
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
export const WhiteBlue = {
|
|
258
|
+
...Template,
|
|
259
|
+
args: {
|
|
260
|
+
colors: [
|
|
261
|
+
'#fff',
|
|
262
|
+
'#000fff00'
|
|
263
|
+
],
|
|
264
|
+
gradient: true,
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
export const OrangeBlue = {
|
|
268
|
+
...Template,
|
|
269
|
+
args: {
|
|
270
|
+
colors: [
|
|
271
|
+
'https://colorhunt.co/palette/3ec1d3f6f7d7ff9a00ff165d',
|
|
272
|
+
],
|
|
273
|
+
gradient: true,
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
export const GreyGradient = {
|
|
277
|
+
...Template,
|
|
278
|
+
args: {
|
|
279
|
+
colors: [
|
|
280
|
+
'#444',
|
|
281
|
+
'#555',
|
|
282
|
+
'#666',
|
|
283
|
+
'#777'
|
|
284
|
+
],
|
|
285
|
+
gradient: true,
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
export const URL = {
|
|
289
|
+
...Template,
|
|
290
|
+
args: {
|
|
291
|
+
colors: [
|
|
292
|
+
'https://coolors.co/2c2423-1e5f7b-839199-64abbb-88cc67-a0713e-dc6bad-bd93f9-f2647c-edcb79'
|
|
293
|
+
],
|
|
294
|
+
}
|
|
295
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { defaultSettings, Direction } from '../color-palette-utils';
|
|
3
|
+
import { pluginToPaletteSettings } from '../../../utils/basicUtils';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Color Palette/Palette',
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
component: 'color-palette',
|
|
8
|
+
subcomponents: { ColorPaletteItem: 'color-palette-item' },
|
|
9
|
+
argTypes: {
|
|
10
|
+
direction: {
|
|
11
|
+
options: ['row', 'column'],
|
|
12
|
+
control: {
|
|
13
|
+
type: 'select',
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
const colors = [
|
|
20
|
+
'#E6C47D',
|
|
21
|
+
'#DEB052',
|
|
22
|
+
'#D59C28',
|
|
23
|
+
'#AA7D20',
|
|
24
|
+
'#7F5D18'
|
|
25
|
+
];
|
|
26
|
+
const settings = { ...pluginToPaletteSettings(defaultSettings), aliases: ['', '', 'test', '', ''] };
|
|
27
|
+
const Template = {
|
|
28
|
+
render: ({ colors, height, width, direction, gradient, preventHover, override, aliases }) => {
|
|
29
|
+
const palette = document.createElement('color-palette');
|
|
30
|
+
palette.colors = colors;
|
|
31
|
+
palette.settings = { height, width, direction, gradient, preventHover, override, aliases };
|
|
32
|
+
return html `
|
|
33
|
+
${palette}
|
|
34
|
+
`;
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const Empty = {
|
|
38
|
+
...Template,
|
|
39
|
+
args: {
|
|
40
|
+
colors: [],
|
|
41
|
+
...settings
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export const OneItem = {
|
|
45
|
+
...Template,
|
|
46
|
+
args: {
|
|
47
|
+
colors: [colors[0]],
|
|
48
|
+
...settings
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export const ManyItems = {
|
|
52
|
+
...Template,
|
|
53
|
+
args: {
|
|
54
|
+
colors,
|
|
55
|
+
height: 150,
|
|
56
|
+
width: 700,
|
|
57
|
+
direction: Direction.Column,
|
|
58
|
+
gradient: false,
|
|
59
|
+
preventHover: false,
|
|
60
|
+
override: false,
|
|
61
|
+
aliases: ['', '', 'test', '', '']
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export const Gradient = {
|
|
65
|
+
...Template,
|
|
66
|
+
args: {
|
|
67
|
+
colors,
|
|
68
|
+
height: 150,
|
|
69
|
+
width: 700,
|
|
70
|
+
direction: Direction.Column,
|
|
71
|
+
gradient: true,
|
|
72
|
+
preventHover: false,
|
|
73
|
+
override: false,
|
|
74
|
+
aliases: ['', '', 'test', '', '']
|
|
75
|
+
},
|
|
76
|
+
};
|