@everchron/ec-shards 0.8.5 → 0.8.8
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/ec-shards.common.js +176 -35
- package/dist/ec-shards.common.js.map +1 -1
- package/dist/ec-shards.css +1 -1
- package/dist/ec-shards.umd.js +176 -35
- package/dist/ec-shards.umd.js.map +1 -1
- package/dist/ec-shards.umd.min.js +2 -2
- package/dist/ec-shards.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/button-toolbar-icon/button-toolbar-icon.vue +0 -10
- package/src/components/index.js +2 -0
- package/src/components/swatches-picker/swatches-picker.vue +152 -0
- package/src/stories/swatches-picker/swatches-picker.stories.js +30 -0
package/package.json
CHANGED
package/src/components/index.js
CHANGED
|
@@ -94,6 +94,7 @@ import EcsSkeletonLoader from "./skeleton-loader/skeleton-loader.vue"
|
|
|
94
94
|
import EcsSortbutton from "./sortbutton/sortbutton.vue"
|
|
95
95
|
import EcsSticker from "./sticker/sticker.vue"
|
|
96
96
|
import EcsStructuredContent from "./structured-content/structured-content.vue"
|
|
97
|
+
import EcsSwatchesPicker from "./swatches-picker/swatches-picker.vue"
|
|
97
98
|
import EcsSwitch from "./switch/switch.vue"
|
|
98
99
|
import EcsTab from "./tab/tab.vue"
|
|
99
100
|
import EcsTabs from "./tabs/tabs.vue"
|
|
@@ -204,6 +205,7 @@ const Components = {
|
|
|
204
205
|
EcsSortbutton,
|
|
205
206
|
EcsSticker,
|
|
206
207
|
EcsStructuredContent,
|
|
208
|
+
EcsSwatchesPicker,
|
|
207
209
|
EcsSwitch,
|
|
208
210
|
EcsTab,
|
|
209
211
|
EcsTabs,
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<div class="ecs-swatches" :class="sizeClass">
|
|
4
|
+
<div
|
|
5
|
+
v-for="item in swatches" :key="item.color"
|
|
6
|
+
@click="selectedColor = item.color"
|
|
7
|
+
:title="item.title"
|
|
8
|
+
class="ecs-swatches-color"
|
|
9
|
+
:style="{backgroundColor: item.color, color: item.color}"
|
|
10
|
+
:class="selectedColor == item.color ? 'active' : ''">
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
export default {
|
|
17
|
+
props: {
|
|
18
|
+
/** Sets the size of the color picker elements. */
|
|
19
|
+
size: {
|
|
20
|
+
type: String,
|
|
21
|
+
validator: v => ['sml', 'md', 'lg', 'null', null].includes(v),
|
|
22
|
+
default: 'md'
|
|
23
|
+
},
|
|
24
|
+
/** Sets the selected color value. Must be a HEX value that exists in the swatches (data) list. */
|
|
25
|
+
selected: {
|
|
26
|
+
type: String,
|
|
27
|
+
validator: v => ['#F9DF00', '#F3A100', '#B7EA80', '#48E4C2', '#489DFF', '#B877F0', '#FD78FD', '#C59465', '#858E9F', '#227FD3', '#5DAF00', '#A4927A', '#95989C', '#D78B21', 'null', null].includes(v)
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
data () {
|
|
32
|
+
return {
|
|
33
|
+
swatches: [
|
|
34
|
+
{ title: 'Yellow', color: '#F9DF00' },
|
|
35
|
+
{ title: 'Orange', color: '#F3A100' },
|
|
36
|
+
{ title: 'Lime', color: '#B7EA80' },
|
|
37
|
+
{ title: 'Cyan', color: '#48E4C2' },
|
|
38
|
+
{ title: 'Blue', color: '#489DFF' },
|
|
39
|
+
{ title: 'Indigo', color: '#B877F0' },
|
|
40
|
+
{ title: 'Pink', color: '#FD78FD' },
|
|
41
|
+
{ title: 'Brown', color: '#C59465' },
|
|
42
|
+
{ title: 'Grey', color: '#858E9F' },
|
|
43
|
+
{ title: 'Dark Blue', color: '#227FD3' },
|
|
44
|
+
{ title: 'Grass', color: '#5DAF00' },
|
|
45
|
+
{ title: 'Brass', color: '#A4927A' },
|
|
46
|
+
{ title: 'Silver', color: '#95989C' },
|
|
47
|
+
{ title: 'Gold', color: '#D78B21' },
|
|
48
|
+
],
|
|
49
|
+
selectedColor: this.selected
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
computed: {
|
|
54
|
+
sizeClass() {
|
|
55
|
+
if (this.size && this.size !== '')
|
|
56
|
+
return `ecs-swatches-${this.size}`
|
|
57
|
+
return this.size
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
watch: {
|
|
62
|
+
selectedColor(){
|
|
63
|
+
/** Returns the selected color value as HEX code. */
|
|
64
|
+
this.$emit('input', this.selectedColor)
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<style lang="scss" scoped>
|
|
71
|
+
@import "../tokens/tokens";
|
|
72
|
+
@import "../mixins/svg-uri";
|
|
73
|
+
|
|
74
|
+
.ecs-swatches{
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-wrap: wrap;
|
|
77
|
+
|
|
78
|
+
&-sml{
|
|
79
|
+
.ecs-swatches-color{
|
|
80
|
+
width: 20px;
|
|
81
|
+
height: 20px;
|
|
82
|
+
margin: 6px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&-md{
|
|
87
|
+
.ecs-swatches-color{
|
|
88
|
+
width: 24px;
|
|
89
|
+
height: 24px;
|
|
90
|
+
margin: 8px;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&-lg{
|
|
95
|
+
.ecs-swatches-color{
|
|
96
|
+
width: 32px;
|
|
97
|
+
height: 32px;
|
|
98
|
+
margin: 8px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&-color{
|
|
103
|
+
border-radius: 100%;
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
transition: .2s;
|
|
106
|
+
position: relative;
|
|
107
|
+
|
|
108
|
+
&:before,
|
|
109
|
+
&:after{
|
|
110
|
+
content: "";
|
|
111
|
+
position: absolute;
|
|
112
|
+
opacity: 0;
|
|
113
|
+
transition: .4s;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:before{
|
|
117
|
+
inset: 0;
|
|
118
|
+
box-shadow: 0 0 0 2px #FFF, 0 0 0 4px currentColor;
|
|
119
|
+
border-radius: 100%;
|
|
120
|
+
transform: scale(.8);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&:after{
|
|
124
|
+
left: 50%;
|
|
125
|
+
top: 50%;
|
|
126
|
+
width: 8px;
|
|
127
|
+
height: 8px;
|
|
128
|
+
margin: -4px 0 0 -4px;
|
|
129
|
+
transform: scale(.6) rotate(10deg);
|
|
130
|
+
background: svg-uri('<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 4L3.73077 7L6.5 1" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&:hover{
|
|
134
|
+
transform: scale(1.1);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&.active{
|
|
138
|
+
transform: scale(1.1);
|
|
139
|
+
|
|
140
|
+
&:before{
|
|
141
|
+
opacity: 1;
|
|
142
|
+
transform: scale(1);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&:after{
|
|
146
|
+
opacity: .5;
|
|
147
|
+
transform: scale(1) rotate(0deg);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import EcsSwatchesPicker from '@components/swatches-picker/swatches-picker';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Input/Swatches Picker',
|
|
5
|
+
component: EcsSwatchesPicker
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const SwatchesPicker = () => ({
|
|
9
|
+
components: { EcsSwatchesPicker },
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
selectedColor: ''
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
template: `<ecs-swatches-picker v-model="selectedColor" selected="#F9DF00" />`,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const SwatchesPickerSizes = () => ({
|
|
19
|
+
components: { EcsSwatchesPicker },
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
selectedColor: ''
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
template: `<div>
|
|
26
|
+
<ecs-swatches-picker v-model="selectedColor" size="sml" selected="#F9DF00" />
|
|
27
|
+
<ecs-swatches-picker v-model="selectedColor" size="md" selected="#F9DF00" />
|
|
28
|
+
<ecs-swatches-picker v-model="selectedColor" size="lg" selected="#F9DF00" />
|
|
29
|
+
</div>`,
|
|
30
|
+
});
|