vuetify-swatches 0.3.0 → 0.3.3
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/README.md +2 -0
- package/dist/components/VSwatches.vue.d.ts +76 -76
- package/dist/components/VSwatches.vue.d.ts.map +1 -1
- package/dist/index.d.ts +3 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +81 -404
- package/dist/index.umd.js +9 -6
- package/dist/style.css +12 -1
- package/package.json +36 -36
- package/src/components/VSwatches.vue +11 -16
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
|
+
This branch is for vuetify3. Not usable for production, experimental use only. Bidirectional binding (select swatch button by value) does not work due to a problem on the Vuetify3 side.
|
|
12
|
+
|
|
11
13
|
This project is a remake of [saintplay's vue-swatches](https://saintplay.github.io/vue-swatches/) with [Vuetify](https://vuetifyjs.com/).
|
|
12
14
|
|
|
13
15
|
Unlike the original version, it provides a UI based on Vuetify, such as ripple effects and dark mode.
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { type PropType, type Ref } from 'vue';
|
|
2
|
-
/** Vuetify Swatches */
|
|
3
|
-
declare const _default: import("vue").DefineComponent<{
|
|
4
|
-
/** Model value */
|
|
5
|
-
modelValue: {
|
|
6
|
-
type: StringConstructor;
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
/** Swatch colors */
|
|
10
|
-
swatches: {
|
|
11
|
-
type: PropType<string[] | string[][]>;
|
|
12
|
-
default: () => any[][];
|
|
13
|
-
};
|
|
14
|
-
/** The size of the shadow of the button */
|
|
15
|
-
elevation: {
|
|
16
|
-
type: NumberConstructor;
|
|
17
|
-
default: number;
|
|
18
|
-
};
|
|
19
|
-
/** Swatch sized */
|
|
20
|
-
size: {
|
|
21
|
-
type: StringConstructor;
|
|
22
|
-
default: string;
|
|
23
|
-
};
|
|
24
|
-
/** selected icon */
|
|
25
|
-
icon: {
|
|
26
|
-
type: StringConstructor;
|
|
27
|
-
default: string;
|
|
28
|
-
};
|
|
29
|
-
/** selected icon size */
|
|
30
|
-
iconSize: {
|
|
31
|
-
type: StringConstructor;
|
|
32
|
-
default: string;
|
|
33
|
-
};
|
|
34
|
-
}, {
|
|
35
|
-
checkedVisibilty: Ref<boolean>;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
swatches: string[] | string[][];
|
|
71
|
-
elevation: number;
|
|
72
|
-
size: string;
|
|
73
|
-
icon: string;
|
|
74
|
-
iconSize: string;
|
|
75
|
-
}>;
|
|
76
|
-
export default _default;
|
|
1
|
+
import { type PropType, type Ref } from 'vue';
|
|
2
|
+
/** Vuetify Swatches */
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
/** Model value */
|
|
5
|
+
modelValue: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
default: any;
|
|
8
|
+
};
|
|
9
|
+
/** Swatch colors */
|
|
10
|
+
swatches: {
|
|
11
|
+
type: PropType<string[] | string[][]>;
|
|
12
|
+
default: () => any[][];
|
|
13
|
+
};
|
|
14
|
+
/** The size of the shadow of the button */
|
|
15
|
+
elevation: {
|
|
16
|
+
type: NumberConstructor;
|
|
17
|
+
default: number;
|
|
18
|
+
};
|
|
19
|
+
/** Swatch sized */
|
|
20
|
+
size: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
/** selected icon */
|
|
25
|
+
icon: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
default: string;
|
|
28
|
+
};
|
|
29
|
+
/** selected icon size */
|
|
30
|
+
iconSize: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
}, {
|
|
35
|
+
checkedVisibilty: Ref<boolean>;
|
|
36
|
+
onSwatchClick: (e: Event) => void;
|
|
37
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
38
|
+
/** Model value */
|
|
39
|
+
modelValue: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: any;
|
|
42
|
+
};
|
|
43
|
+
/** Swatch colors */
|
|
44
|
+
swatches: {
|
|
45
|
+
type: PropType<string[] | string[][]>;
|
|
46
|
+
default: () => any[][];
|
|
47
|
+
};
|
|
48
|
+
/** The size of the shadow of the button */
|
|
49
|
+
elevation: {
|
|
50
|
+
type: NumberConstructor;
|
|
51
|
+
default: number;
|
|
52
|
+
};
|
|
53
|
+
/** Swatch sized */
|
|
54
|
+
size: {
|
|
55
|
+
type: StringConstructor;
|
|
56
|
+
default: string;
|
|
57
|
+
};
|
|
58
|
+
/** selected icon */
|
|
59
|
+
icon: {
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
default: string;
|
|
62
|
+
};
|
|
63
|
+
/** selected icon size */
|
|
64
|
+
iconSize: {
|
|
65
|
+
type: StringConstructor;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
68
|
+
}>>, {
|
|
69
|
+
modelValue: string;
|
|
70
|
+
swatches: string[] | string[][];
|
|
71
|
+
elevation: number;
|
|
72
|
+
size: string;
|
|
73
|
+
icon: string;
|
|
74
|
+
iconSize: string;
|
|
75
|
+
}>;
|
|
76
|
+
export default _default;
|
|
77
77
|
//# sourceMappingURL=VSwatches.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.
|
|
1
|
+
{"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,GAAG,EAET,MAAM,KAAK,CAAC;AAKb,uBAAuB;;IAUnB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;uBAkBC,KAAK;;IAtD/B,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;;;;;;;AA7C7B,wBA2EG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @author Logue {@link logue@hotmail.co.jp}
|
|
6
|
-
* @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
|
|
7
|
-
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
8
|
-
*/
|
|
9
|
-
import VSwatches from './components/VSwatches.vue';
|
|
10
|
-
declare const installVSwatches: (app: any) => any;
|
|
11
|
-
export { VSwatches as default, installVSwatches as install };
|
|
1
|
+
import VSwatches from './components/VSwatches.vue';
|
|
2
|
+
declare const installVSwatches: (app: any) => any;
|
|
3
|
+
export { VSwatches as default, installVSwatches as install };
|
|
12
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,4BAA4B,CAAC;AAEnD,QAAA,MAAM,gBAAgB,QAAS,GAAG,QAA0C,CAAC;AAE7E,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,364 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
accent3: "#ff1744",
|
|
16
|
-
accent4: "#d50000"
|
|
17
|
-
});
|
|
18
|
-
const pink = Object.freeze({
|
|
19
|
-
base: "#e91e63",
|
|
20
|
-
lighten5: "#fce4ec",
|
|
21
|
-
lighten4: "#f8bbd0",
|
|
22
|
-
lighten3: "#f48fb1",
|
|
23
|
-
lighten2: "#f06292",
|
|
24
|
-
lighten1: "#ec407a",
|
|
25
|
-
darken1: "#d81b60",
|
|
26
|
-
darken2: "#c2185b",
|
|
27
|
-
darken3: "#ad1457",
|
|
28
|
-
darken4: "#880e4f",
|
|
29
|
-
accent1: "#ff80ab",
|
|
30
|
-
accent2: "#ff4081",
|
|
31
|
-
accent3: "#f50057",
|
|
32
|
-
accent4: "#c51162"
|
|
33
|
-
});
|
|
34
|
-
const purple = Object.freeze({
|
|
35
|
-
base: "#9c27b0",
|
|
36
|
-
lighten5: "#f3e5f5",
|
|
37
|
-
lighten4: "#e1bee7",
|
|
38
|
-
lighten3: "#ce93d8",
|
|
39
|
-
lighten2: "#ba68c8",
|
|
40
|
-
lighten1: "#ab47bc",
|
|
41
|
-
darken1: "#8e24aa",
|
|
42
|
-
darken2: "#7b1fa2",
|
|
43
|
-
darken3: "#6a1b9a",
|
|
44
|
-
darken4: "#4a148c",
|
|
45
|
-
accent1: "#ea80fc",
|
|
46
|
-
accent2: "#e040fb",
|
|
47
|
-
accent3: "#d500f9",
|
|
48
|
-
accent4: "#aa00ff"
|
|
49
|
-
});
|
|
50
|
-
const deepPurple = Object.freeze({
|
|
51
|
-
base: "#673ab7",
|
|
52
|
-
lighten5: "#ede7f6",
|
|
53
|
-
lighten4: "#d1c4e9",
|
|
54
|
-
lighten3: "#b39ddb",
|
|
55
|
-
lighten2: "#9575cd",
|
|
56
|
-
lighten1: "#7e57c2",
|
|
57
|
-
darken1: "#5e35b1",
|
|
58
|
-
darken2: "#512da8",
|
|
59
|
-
darken3: "#4527a0",
|
|
60
|
-
darken4: "#311b92",
|
|
61
|
-
accent1: "#b388ff",
|
|
62
|
-
accent2: "#7c4dff",
|
|
63
|
-
accent3: "#651fff",
|
|
64
|
-
accent4: "#6200ea"
|
|
65
|
-
});
|
|
66
|
-
const indigo = Object.freeze({
|
|
67
|
-
base: "#3f51b5",
|
|
68
|
-
lighten5: "#e8eaf6",
|
|
69
|
-
lighten4: "#c5cae9",
|
|
70
|
-
lighten3: "#9fa8da",
|
|
71
|
-
lighten2: "#7986cb",
|
|
72
|
-
lighten1: "#5c6bc0",
|
|
73
|
-
darken1: "#3949ab",
|
|
74
|
-
darken2: "#303f9f",
|
|
75
|
-
darken3: "#283593",
|
|
76
|
-
darken4: "#1a237e",
|
|
77
|
-
accent1: "#8c9eff",
|
|
78
|
-
accent2: "#536dfe",
|
|
79
|
-
accent3: "#3d5afe",
|
|
80
|
-
accent4: "#304ffe"
|
|
81
|
-
});
|
|
82
|
-
const blue = Object.freeze({
|
|
83
|
-
base: "#2196f3",
|
|
84
|
-
lighten5: "#e3f2fd",
|
|
85
|
-
lighten4: "#bbdefb",
|
|
86
|
-
lighten3: "#90caf9",
|
|
87
|
-
lighten2: "#64b5f6",
|
|
88
|
-
lighten1: "#42a5f5",
|
|
89
|
-
darken1: "#1e88e5",
|
|
90
|
-
darken2: "#1976d2",
|
|
91
|
-
darken3: "#1565c0",
|
|
92
|
-
darken4: "#0d47a1",
|
|
93
|
-
accent1: "#82b1ff",
|
|
94
|
-
accent2: "#448aff",
|
|
95
|
-
accent3: "#2979ff",
|
|
96
|
-
accent4: "#2962ff"
|
|
97
|
-
});
|
|
98
|
-
const lightBlue = Object.freeze({
|
|
99
|
-
base: "#03a9f4",
|
|
100
|
-
lighten5: "#e1f5fe",
|
|
101
|
-
lighten4: "#b3e5fc",
|
|
102
|
-
lighten3: "#81d4fa",
|
|
103
|
-
lighten2: "#4fc3f7",
|
|
104
|
-
lighten1: "#29b6f6",
|
|
105
|
-
darken1: "#039be5",
|
|
106
|
-
darken2: "#0288d1",
|
|
107
|
-
darken3: "#0277bd",
|
|
108
|
-
darken4: "#01579b",
|
|
109
|
-
accent1: "#80d8ff",
|
|
110
|
-
accent2: "#40c4ff",
|
|
111
|
-
accent3: "#00b0ff",
|
|
112
|
-
accent4: "#0091ea"
|
|
113
|
-
});
|
|
114
|
-
const cyan = Object.freeze({
|
|
115
|
-
base: "#00bcd4",
|
|
116
|
-
lighten5: "#e0f7fa",
|
|
117
|
-
lighten4: "#b2ebf2",
|
|
118
|
-
lighten3: "#80deea",
|
|
119
|
-
lighten2: "#4dd0e1",
|
|
120
|
-
lighten1: "#26c6da",
|
|
121
|
-
darken1: "#00acc1",
|
|
122
|
-
darken2: "#0097a7",
|
|
123
|
-
darken3: "#00838f",
|
|
124
|
-
darken4: "#006064",
|
|
125
|
-
accent1: "#84ffff",
|
|
126
|
-
accent2: "#18ffff",
|
|
127
|
-
accent3: "#00e5ff",
|
|
128
|
-
accent4: "#00b8d4"
|
|
129
|
-
});
|
|
130
|
-
const teal = Object.freeze({
|
|
131
|
-
base: "#009688",
|
|
132
|
-
lighten5: "#e0f2f1",
|
|
133
|
-
lighten4: "#b2dfdb",
|
|
134
|
-
lighten3: "#80cbc4",
|
|
135
|
-
lighten2: "#4db6ac",
|
|
136
|
-
lighten1: "#26a69a",
|
|
137
|
-
darken1: "#00897b",
|
|
138
|
-
darken2: "#00796b",
|
|
139
|
-
darken3: "#00695c",
|
|
140
|
-
darken4: "#004d40",
|
|
141
|
-
accent1: "#a7ffeb",
|
|
142
|
-
accent2: "#64ffda",
|
|
143
|
-
accent3: "#1de9b6",
|
|
144
|
-
accent4: "#00bfa5"
|
|
145
|
-
});
|
|
146
|
-
const green = Object.freeze({
|
|
147
|
-
base: "#4caf50",
|
|
148
|
-
lighten5: "#e8f5e9",
|
|
149
|
-
lighten4: "#c8e6c9",
|
|
150
|
-
lighten3: "#a5d6a7",
|
|
151
|
-
lighten2: "#81c784",
|
|
152
|
-
lighten1: "#66bb6a",
|
|
153
|
-
darken1: "#43a047",
|
|
154
|
-
darken2: "#388e3c",
|
|
155
|
-
darken3: "#2e7d32",
|
|
156
|
-
darken4: "#1b5e20",
|
|
157
|
-
accent1: "#b9f6ca",
|
|
158
|
-
accent2: "#69f0ae",
|
|
159
|
-
accent3: "#00e676",
|
|
160
|
-
accent4: "#00c853"
|
|
161
|
-
});
|
|
162
|
-
const lightGreen = Object.freeze({
|
|
163
|
-
base: "#8bc34a",
|
|
164
|
-
lighten5: "#f1f8e9",
|
|
165
|
-
lighten4: "#dcedc8",
|
|
166
|
-
lighten3: "#c5e1a5",
|
|
167
|
-
lighten2: "#aed581",
|
|
168
|
-
lighten1: "#9ccc65",
|
|
169
|
-
darken1: "#7cb342",
|
|
170
|
-
darken2: "#689f38",
|
|
171
|
-
darken3: "#558b2f",
|
|
172
|
-
darken4: "#33691e",
|
|
173
|
-
accent1: "#ccff90",
|
|
174
|
-
accent2: "#b2ff59",
|
|
175
|
-
accent3: "#76ff03",
|
|
176
|
-
accent4: "#64dd17"
|
|
177
|
-
});
|
|
178
|
-
const lime = Object.freeze({
|
|
179
|
-
base: "#cddc39",
|
|
180
|
-
lighten5: "#f9fbe7",
|
|
181
|
-
lighten4: "#f0f4c3",
|
|
182
|
-
lighten3: "#e6ee9c",
|
|
183
|
-
lighten2: "#dce775",
|
|
184
|
-
lighten1: "#d4e157",
|
|
185
|
-
darken1: "#c0ca33",
|
|
186
|
-
darken2: "#afb42b",
|
|
187
|
-
darken3: "#9e9d24",
|
|
188
|
-
darken4: "#827717",
|
|
189
|
-
accent1: "#f4ff81",
|
|
190
|
-
accent2: "#eeff41",
|
|
191
|
-
accent3: "#c6ff00",
|
|
192
|
-
accent4: "#aeea00"
|
|
193
|
-
});
|
|
194
|
-
const yellow = Object.freeze({
|
|
195
|
-
base: "#ffeb3b",
|
|
196
|
-
lighten5: "#fffde7",
|
|
197
|
-
lighten4: "#fff9c4",
|
|
198
|
-
lighten3: "#fff59d",
|
|
199
|
-
lighten2: "#fff176",
|
|
200
|
-
lighten1: "#ffee58",
|
|
201
|
-
darken1: "#fdd835",
|
|
202
|
-
darken2: "#fbc02d",
|
|
203
|
-
darken3: "#f9a825",
|
|
204
|
-
darken4: "#f57f17",
|
|
205
|
-
accent1: "#ffff8d",
|
|
206
|
-
accent2: "#ffff00",
|
|
207
|
-
accent3: "#ffea00",
|
|
208
|
-
accent4: "#ffd600"
|
|
209
|
-
});
|
|
210
|
-
const amber = Object.freeze({
|
|
211
|
-
base: "#ffc107",
|
|
212
|
-
lighten5: "#fff8e1",
|
|
213
|
-
lighten4: "#ffecb3",
|
|
214
|
-
lighten3: "#ffe082",
|
|
215
|
-
lighten2: "#ffd54f",
|
|
216
|
-
lighten1: "#ffca28",
|
|
217
|
-
darken1: "#ffb300",
|
|
218
|
-
darken2: "#ffa000",
|
|
219
|
-
darken3: "#ff8f00",
|
|
220
|
-
darken4: "#ff6f00",
|
|
221
|
-
accent1: "#ffe57f",
|
|
222
|
-
accent2: "#ffd740",
|
|
223
|
-
accent3: "#ffc400",
|
|
224
|
-
accent4: "#ffab00"
|
|
225
|
-
});
|
|
226
|
-
const orange = Object.freeze({
|
|
227
|
-
base: "#ff9800",
|
|
228
|
-
lighten5: "#fff3e0",
|
|
229
|
-
lighten4: "#ffe0b2",
|
|
230
|
-
lighten3: "#ffcc80",
|
|
231
|
-
lighten2: "#ffb74d",
|
|
232
|
-
lighten1: "#ffa726",
|
|
233
|
-
darken1: "#fb8c00",
|
|
234
|
-
darken2: "#f57c00",
|
|
235
|
-
darken3: "#ef6c00",
|
|
236
|
-
darken4: "#e65100",
|
|
237
|
-
accent1: "#ffd180",
|
|
238
|
-
accent2: "#ffab40",
|
|
239
|
-
accent3: "#ff9100",
|
|
240
|
-
accent4: "#ff6d00"
|
|
241
|
-
});
|
|
242
|
-
const deepOrange = Object.freeze({
|
|
243
|
-
base: "#ff5722",
|
|
244
|
-
lighten5: "#fbe9e7",
|
|
245
|
-
lighten4: "#ffccbc",
|
|
246
|
-
lighten3: "#ffab91",
|
|
247
|
-
lighten2: "#ff8a65",
|
|
248
|
-
lighten1: "#ff7043",
|
|
249
|
-
darken1: "#f4511e",
|
|
250
|
-
darken2: "#e64a19",
|
|
251
|
-
darken3: "#d84315",
|
|
252
|
-
darken4: "#bf360c",
|
|
253
|
-
accent1: "#ff9e80",
|
|
254
|
-
accent2: "#ff6e40",
|
|
255
|
-
accent3: "#ff3d00",
|
|
256
|
-
accent4: "#dd2c00"
|
|
257
|
-
});
|
|
258
|
-
const brown = Object.freeze({
|
|
259
|
-
base: "#795548",
|
|
260
|
-
lighten5: "#efebe9",
|
|
261
|
-
lighten4: "#d7ccc8",
|
|
262
|
-
lighten3: "#bcaaa4",
|
|
263
|
-
lighten2: "#a1887f",
|
|
264
|
-
lighten1: "#8d6e63",
|
|
265
|
-
darken1: "#6d4c41",
|
|
266
|
-
darken2: "#5d4037",
|
|
267
|
-
darken3: "#4e342e",
|
|
268
|
-
darken4: "#3e2723"
|
|
269
|
-
});
|
|
270
|
-
const blueGrey = Object.freeze({
|
|
271
|
-
base: "#607d8b",
|
|
272
|
-
lighten5: "#eceff1",
|
|
273
|
-
lighten4: "#cfd8dc",
|
|
274
|
-
lighten3: "#b0bec5",
|
|
275
|
-
lighten2: "#90a4ae",
|
|
276
|
-
lighten1: "#78909c",
|
|
277
|
-
darken1: "#546e7a",
|
|
278
|
-
darken2: "#455a64",
|
|
279
|
-
darken3: "#37474f",
|
|
280
|
-
darken4: "#263238"
|
|
281
|
-
});
|
|
282
|
-
const grey = Object.freeze({
|
|
283
|
-
base: "#9e9e9e",
|
|
284
|
-
lighten5: "#fafafa",
|
|
285
|
-
lighten4: "#f5f5f5",
|
|
286
|
-
lighten3: "#eeeeee",
|
|
287
|
-
lighten2: "#e0e0e0",
|
|
288
|
-
lighten1: "#bdbdbd",
|
|
289
|
-
darken1: "#757575",
|
|
290
|
-
darken2: "#616161",
|
|
291
|
-
darken3: "#424242",
|
|
292
|
-
darken4: "#212121"
|
|
293
|
-
});
|
|
294
|
-
const shades = Object.freeze({
|
|
295
|
-
black: "#000000",
|
|
296
|
-
white: "#ffffff",
|
|
297
|
-
transparent: "transparent"
|
|
298
|
-
});
|
|
299
|
-
var colors = Object.freeze({
|
|
300
|
-
red,
|
|
301
|
-
pink,
|
|
302
|
-
purple,
|
|
303
|
-
deepPurple,
|
|
304
|
-
indigo,
|
|
305
|
-
blue,
|
|
306
|
-
lightBlue,
|
|
307
|
-
cyan,
|
|
308
|
-
teal,
|
|
309
|
-
green,
|
|
310
|
-
lightGreen,
|
|
311
|
-
lime,
|
|
312
|
-
yellow,
|
|
313
|
-
amber,
|
|
314
|
-
orange,
|
|
315
|
-
deepOrange,
|
|
316
|
-
brown,
|
|
317
|
-
blueGrey,
|
|
318
|
-
grey,
|
|
319
|
-
shades
|
|
320
|
-
});
|
|
321
|
-
var VSwatches_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%)}\n")();
|
|
322
|
-
var _export_sfc = (sfc, props) => {
|
|
323
|
-
const target = sfc.__vccOpts || sfc;
|
|
324
|
-
for (const [key, val] of props) {
|
|
325
|
-
target[key] = val;
|
|
326
|
-
}
|
|
327
|
-
return target;
|
|
328
|
-
};
|
|
329
|
-
const _sfc_main = defineComponent({
|
|
1
|
+
/**
|
|
2
|
+
* vuetify-swatches
|
|
3
|
+
*
|
|
4
|
+
* @description Color Swatch component for Vuetify3.
|
|
5
|
+
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
+
* @copyright 2022 By Masashi Yoshikawa All rights reserved.
|
|
7
|
+
* @license MIT
|
|
8
|
+
* @version 0.3.3
|
|
9
|
+
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { defineComponent as V, ref as k, resolveComponent as d, openBlock as n, createBlock as c, withCtx as u, createElementBlock as p, Fragment as m, renderList as b, createTextVNode as S, toDisplayString as C, createCommentVNode as z } from "vue";
|
|
13
|
+
import e from "vuetify/lib/util/colors.mjs";
|
|
14
|
+
const B = V({
|
|
330
15
|
name: "VSwatches",
|
|
331
16
|
model: {
|
|
332
17
|
prop: "modelValue",
|
|
333
18
|
event: "update:modelValue"
|
|
334
19
|
},
|
|
335
20
|
props: {
|
|
336
|
-
modelValue: { type: String,
|
|
21
|
+
modelValue: { type: String, default: e.shades.white },
|
|
337
22
|
swatches: {
|
|
338
23
|
type: Array,
|
|
339
24
|
default: () => [
|
|
340
|
-
[
|
|
25
|
+
[e.shades.black, e.shades.white],
|
|
341
26
|
[
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
27
|
+
e.red.base,
|
|
28
|
+
e.pink.base,
|
|
29
|
+
e.purple.base,
|
|
30
|
+
e.deepPurple.base,
|
|
31
|
+
e.indigo.base,
|
|
32
|
+
e.blue.base,
|
|
33
|
+
e.lightBlue.base,
|
|
34
|
+
e.cyan.base
|
|
350
35
|
],
|
|
351
36
|
[
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
37
|
+
e.teal.base,
|
|
38
|
+
e.green.base,
|
|
39
|
+
e.lightGreen.base,
|
|
40
|
+
e.lime.base,
|
|
41
|
+
e.yellow.base,
|
|
42
|
+
e.amber.base,
|
|
43
|
+
e.orange.base,
|
|
44
|
+
e.deepOrange.base
|
|
360
45
|
],
|
|
361
|
-
[
|
|
46
|
+
[e.brown.base, e.blueGrey.base, e.grey.base]
|
|
362
47
|
]
|
|
363
48
|
},
|
|
364
49
|
elevation: { type: Number, default: 1 },
|
|
@@ -367,70 +52,62 @@ const _sfc_main = defineComponent({
|
|
|
367
52
|
iconSize: { type: String, default: "1rem" }
|
|
368
53
|
},
|
|
369
54
|
emits: ["update:modelValue"],
|
|
370
|
-
setup(
|
|
371
|
-
const checkedVisibilty = ref(false);
|
|
372
|
-
const selected = ref(props.modelValue);
|
|
373
|
-
const onSwatchClick = (value) => {
|
|
374
|
-
if (!value || selected.value === value) {
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
selected.value = value;
|
|
378
|
-
context.emit("update:modelValue", value);
|
|
379
|
-
};
|
|
55
|
+
setup(t, a) {
|
|
380
56
|
return {
|
|
381
|
-
checkedVisibilty,
|
|
382
|
-
|
|
383
|
-
|
|
57
|
+
checkedVisibilty: k(!1),
|
|
58
|
+
onSwatchClick: (l) => {
|
|
59
|
+
const i = l.target.dataset.value;
|
|
60
|
+
!i || t.modelValue === i || a.emit("update:modelValue", i);
|
|
61
|
+
}
|
|
384
62
|
};
|
|
385
63
|
}
|
|
386
64
|
});
|
|
387
|
-
|
|
388
|
-
const
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
return
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
65
|
+
const $ = (t, a) => {
|
|
66
|
+
const o = t.__vccOpts || t;
|
|
67
|
+
for (const [r, l] of a)
|
|
68
|
+
o[r] = l;
|
|
69
|
+
return o;
|
|
70
|
+
};
|
|
71
|
+
function N(t, a, o, r, l, i) {
|
|
72
|
+
const f = d("v-icon"), w = d("v-btn"), v = d("v-sheet");
|
|
73
|
+
return n(), c(v, { class: "v-swatches" }, {
|
|
74
|
+
default: u(() => [
|
|
75
|
+
(n(!0), p(m, null, b(t.swatches, (y, _) => (n(), p("div", {
|
|
76
|
+
key: _,
|
|
77
|
+
class: "d-flex"
|
|
78
|
+
}, [
|
|
79
|
+
(n(!0), p(m, null, b(y, (s) => (n(), c(w, {
|
|
80
|
+
key: s,
|
|
81
|
+
elevation: t.elevation,
|
|
82
|
+
width: t.size,
|
|
83
|
+
height: t.size,
|
|
84
|
+
color: s,
|
|
85
|
+
"data-value": s,
|
|
86
|
+
"min-width": "auto",
|
|
87
|
+
onClick: a[0] || (a[0] = (g) => t.onSwatchClick(g))
|
|
88
|
+
}, {
|
|
89
|
+
default: u(() => [
|
|
90
|
+
s === t.modelValue ? (n(), c(f, {
|
|
91
|
+
key: 0,
|
|
92
|
+
size: t.iconSize,
|
|
93
|
+
color: s
|
|
404
94
|
}, {
|
|
405
|
-
default:
|
|
406
|
-
|
|
407
|
-
key: 0,
|
|
408
|
-
size: _ctx.iconSize,
|
|
409
|
-
color
|
|
410
|
-
}, {
|
|
411
|
-
default: withCtx(() => [
|
|
412
|
-
createTextVNode(toDisplayString(_ctx.icon), 1)
|
|
413
|
-
]),
|
|
414
|
-
_: 2
|
|
415
|
-
}, 1032, ["size", "color"])) : createCommentVNode("", true)
|
|
95
|
+
default: u(() => [
|
|
96
|
+
S(C(t.icon), 1)
|
|
416
97
|
]),
|
|
417
98
|
_: 2
|
|
418
|
-
}, 1032, ["
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
99
|
+
}, 1032, ["size", "color"])) : z("", !0)
|
|
100
|
+
]),
|
|
101
|
+
_: 2
|
|
102
|
+
}, 1032, ["elevation", "width", "height", "color", "data-value"]))), 128))
|
|
103
|
+
]))), 128))
|
|
422
104
|
]),
|
|
423
105
|
_: 1
|
|
424
106
|
});
|
|
425
107
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
* @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
|
|
433
|
-
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
434
|
-
*/
|
|
435
|
-
const installVSwatches = (app) => app.component("VSwatches", VSwatches);
|
|
436
|
-
export { VSwatches as default, installVSwatches as install };
|
|
108
|
+
const h = /* @__PURE__ */ $(B, [["render", N]]), A = (t) => t.component("VSwatches", h);
|
|
109
|
+
typeof window < "u" && window.Vue && window.Vue.use(h);
|
|
110
|
+
export {
|
|
111
|
+
h as default,
|
|
112
|
+
A as install
|
|
113
|
+
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Vuetify3 Swatches Component
|
|
1
|
+
/**
|
|
2
|
+
* vuetify-swatches
|
|
4
3
|
*
|
|
4
|
+
* @description Color Swatch component for Vuetify3.
|
|
5
|
+
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
+
* @copyright 2022 By Masashi Yoshikawa All rights reserved.
|
|
5
7
|
* @license MIT
|
|
6
|
-
* @
|
|
7
|
-
* @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
|
|
8
|
+
* @version 0.3.3
|
|
8
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
9
|
-
*/
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
(function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vuetify/lib/util/colors.mjs")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify/lib/util/colors.mjs"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l.VSwatches={},l.Vue,l.colors))})(this,function(l,e,u){"use strict";const t=(a=>a&&typeof a=="object"&&"default"in a?a:{default:a})(u),f=e.defineComponent({name:"VSwatches",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:t.default.shades.white},swatches:{type:Array,default:()=>[[t.default.shades.black,t.default.shades.white],[t.default.red.base,t.default.pink.base,t.default.purple.base,t.default.deepPurple.base,t.default.indigo.base,t.default.blue.base,t.default.lightBlue.base,t.default.cyan.base],[t.default.teal.base,t.default.green.base,t.default.lightGreen.base,t.default.lime.base,t.default.yellow.base,t.default.amber.base,t.default.orange.base,t.default.deepOrange.base],[t.default.brown.base,t.default.blueGrey.base,t.default.grey.base]]},elevation:{type:Number,default:1},size:{type:String,default:"2rem"},icon:{type:String,default:"mdi-checkbox-marked-circle"},iconSize:{type:String,default:"1rem"}},emits:["update:modelValue"],setup(a,n){return{checkedVisibilty:e.ref(!1),onSwatchClick:i=>{const d=i.target.dataset.value;!d||a.modelValue===d||n.emit("update:modelValue",d)}}}}),S="",p=(a,n)=>{const s=a.__vccOpts||a;for(const[c,i]of n)s[c]=i;return s};function m(a,n,s,c,i,d){const b=e.resolveComponent("v-icon"),y=e.resolveComponent("v-btn"),w=e.resolveComponent("v-sheet");return e.openBlock(),e.createBlock(w,{class:"v-swatches"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.swatches,(k,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:"d-flex"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k,o=>(e.openBlock(),e.createBlock(y,{key:o,elevation:a.elevation,width:a.size,height:a.size,color:o,"data-value":o,"min-width":"auto",onClick:n[0]||(n[0]=g=>a.onSwatchClick(g))},{default:e.withCtx(()=>[o===a.modelValue?(e.openBlock(),e.createBlock(b,{key:0,size:a.iconSize,color:o},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.icon),1)]),_:2},1032,["size","color"])):e.createCommentVNode("",!0)]),_:2},1032,["elevation","width","height","color","data-value"]))),128))]))),128))]),_:1})}const r=p(f,[["render",m]]),h=a=>a.component("VSwatches",r);typeof window<"u"&&window.Vue&&window.Vue.use(r),l.default=r,l.install=h,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* vuetify-swatches
|
|
3
|
+
*
|
|
4
|
+
* @description Color Swatch component for Vuetify3.
|
|
5
|
+
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
+
* @copyright 2022 By Masashi Yoshikawa All rights reserved.
|
|
7
|
+
* @license MIT
|
|
8
|
+
* @version 0.3.3
|
|
9
|
+
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
.v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%) grayscale(100%) contrast(100)}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "vuetify-swatches",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"description": "Color Swatch component for Vuetify3.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vuejs",
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
"vuetify3",
|
|
18
18
|
"vuetify-components"
|
|
19
19
|
],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"type": "module",
|
|
20
22
|
"author": {
|
|
21
23
|
"name": "Logue",
|
|
22
24
|
"email": "logue@hotmail.co.jp",
|
|
@@ -30,14 +32,10 @@
|
|
|
30
32
|
"bugs": {
|
|
31
33
|
"url": "https://github.com/logue/vuetify-swatches/issues"
|
|
32
34
|
},
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"packageManager": "yarn@3.2.1",
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"main": "./dist/index.umd.js",
|
|
40
|
-
"module": "./dist/index.es.js",
|
|
35
|
+
"main": "dist/index.umd.js",
|
|
36
|
+
"module": "dist/index.es.js",
|
|
37
|
+
"types": "dist/index.d.ts",
|
|
38
|
+
"style": "dist/style.css",
|
|
41
39
|
"browser": {
|
|
42
40
|
"./sfc": "./src/components/VSwatches.vue"
|
|
43
41
|
},
|
|
@@ -51,17 +49,21 @@
|
|
|
51
49
|
"require": "./dist/style.css"
|
|
52
50
|
}
|
|
53
51
|
},
|
|
54
|
-
"types": "./dist/index.d.ts",
|
|
55
52
|
"files": [
|
|
56
53
|
"dist",
|
|
57
54
|
"src/components/VSwatches.vue"
|
|
58
55
|
],
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=16.17.0",
|
|
58
|
+
"yarn": ">=1.22.10"
|
|
59
|
+
},
|
|
60
|
+
"packageManager": "yarn@3.2.2",
|
|
59
61
|
"sideEffects": false,
|
|
60
62
|
"scripts": {
|
|
61
63
|
"dev": "vite",
|
|
62
64
|
"clean": "rimraf node_modules/.vite ",
|
|
63
65
|
"build": "vite build & vue-tsc --declaration --emitDeclarationOnly",
|
|
64
|
-
"build:analyze": "vue-tsc --noEmit
|
|
66
|
+
"build:analyze": "vue-tsc --noEmit & vite build --mode analyze",
|
|
65
67
|
"build:docs": "vite build --config vite.config.docs.ts",
|
|
66
68
|
"build:clean": "rimraf dist",
|
|
67
69
|
"lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . -w -u",
|
|
@@ -72,53 +74,51 @@
|
|
|
72
74
|
},
|
|
73
75
|
"peerDependencies": {
|
|
74
76
|
"vue": "^3.2.37",
|
|
75
|
-
"vuetify": "^3.0.0-beta.
|
|
77
|
+
"vuetify": "^3.0.0-beta.8"
|
|
76
78
|
},
|
|
77
79
|
"devDependencies": {
|
|
78
80
|
"@codemirror/lang-html": "^6.1.0",
|
|
79
|
-
"@
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
82
|
-
"@
|
|
83
|
-
"@
|
|
84
|
-
"
|
|
85
|
-
"eslint": "^8.
|
|
81
|
+
"@types/node": "^18.7.6",
|
|
82
|
+
"@typescript-eslint/eslint-plugin": "^5.33.1",
|
|
83
|
+
"@typescript-eslint/parser": "^5.33.1",
|
|
84
|
+
"@vitejs/plugin-vue": "^3.0.3",
|
|
85
|
+
"@vue/tsconfig": "^0.1.3",
|
|
86
|
+
"codemirror": "^6.0.1",
|
|
87
|
+
"eslint": "^8.22.0",
|
|
86
88
|
"eslint-config-google": "^0.14.0",
|
|
87
89
|
"eslint-config-prettier": "^8.5.0",
|
|
88
90
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
89
|
-
"eslint-import-resolver-typescript": "^3.
|
|
91
|
+
"eslint-import-resolver-typescript": "^3.4.2",
|
|
90
92
|
"eslint-plugin-import": "^2.26.0",
|
|
91
|
-
"eslint-plugin-jsdoc": "^39.3.
|
|
93
|
+
"eslint-plugin-jsdoc": "^39.3.6",
|
|
92
94
|
"eslint-plugin-tsdoc": "^0.2.16",
|
|
93
|
-
"eslint-plugin-vue": "^9.
|
|
95
|
+
"eslint-plugin-vue": "^9.3.0",
|
|
94
96
|
"eslint-plugin-vuejs-accessibility": "^1.2.0",
|
|
95
97
|
"eslint-plugin-vuetify": "^1.1.0",
|
|
96
98
|
"eslint-plugin-yaml": "^0.5.0",
|
|
97
99
|
"husky": "^8.0.1",
|
|
98
100
|
"lint-staged": "^13.0.3",
|
|
99
|
-
"postcss-html": "^1.
|
|
101
|
+
"postcss-html": "^1.5.0",
|
|
100
102
|
"prettier": "^2.7.1",
|
|
101
|
-
"prettier-plugin-jsdoc": "^0.3.38",
|
|
102
|
-
"prettier-plugin-md-nocjsp": "^1.2.0",
|
|
103
|
-
"prettier-plugin-sort-imports": "^1.7.0",
|
|
104
103
|
"rimraf": "^3.0.2",
|
|
105
|
-
"rollup-plugin-visualizer": "^5.
|
|
106
|
-
"sass": "1.
|
|
107
|
-
"stylelint": "^14.
|
|
104
|
+
"rollup-plugin-visualizer": "^5.7.1",
|
|
105
|
+
"sass": "1.54.4",
|
|
106
|
+
"stylelint": "^14.10.0",
|
|
108
107
|
"stylelint-config-prettier": "^9.0.3",
|
|
109
|
-
"stylelint-config-recommended-scss": "^
|
|
108
|
+
"stylelint-config-recommended-scss": "^7.0.0",
|
|
110
109
|
"stylelint-config-recommended-vue": "^1.4.0",
|
|
111
110
|
"stylelint-order": "^5.0.0",
|
|
112
111
|
"stylelint-prettier": "^2.0.0",
|
|
113
112
|
"typescript": "^4.7.4",
|
|
114
|
-
"vite": "^
|
|
115
|
-
"vite-plugin-
|
|
116
|
-
"vite-plugin-
|
|
113
|
+
"vite": "^3.0.8",
|
|
114
|
+
"vite-plugin-banner": "^0.3.0",
|
|
115
|
+
"vite-plugin-checker": "^0.4.9",
|
|
116
|
+
"vite-plugin-vuetify": "^1.0.0-alpha.14",
|
|
117
117
|
"vue": "^3.2.37",
|
|
118
|
-
"vue-codemirror6": "0.6.
|
|
118
|
+
"vue-codemirror6": "0.6.8",
|
|
119
119
|
"vue-eslint-parser": "^9.0.3",
|
|
120
|
-
"vue-tsc": "^0.
|
|
121
|
-
"vuetify": "^3.0.0-beta.
|
|
120
|
+
"vue-tsc": "^0.40.1",
|
|
121
|
+
"vuetify": "^3.0.0-beta.8"
|
|
122
122
|
},
|
|
123
123
|
"husky": {
|
|
124
124
|
"hooks": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-sheet class="v-swatches">
|
|
3
|
-
<div v-for="(colors, rows) in swatches" :key="rows">
|
|
3
|
+
<div v-for="(colors, rows) in swatches" :key="rows" class="d-flex">
|
|
4
4
|
<v-btn
|
|
5
5
|
v-for="color in colors"
|
|
6
6
|
:key="color"
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
:width="size"
|
|
9
9
|
:height="size"
|
|
10
10
|
:color="color"
|
|
11
|
+
:data-value="color"
|
|
11
12
|
min-width="auto"
|
|
12
|
-
@click="onSwatchClick(
|
|
13
|
+
@click="onSwatchClick($event)"
|
|
13
14
|
>
|
|
14
|
-
<v-icon v-if="color ===
|
|
15
|
+
<v-icon v-if="color === modelValue" :size="iconSize" :color="color">
|
|
15
16
|
{{ icon }}
|
|
16
17
|
</v-icon>
|
|
17
18
|
</v-btn>
|
|
@@ -42,7 +43,7 @@ export default defineComponent({
|
|
|
42
43
|
},
|
|
43
44
|
props: {
|
|
44
45
|
/** Model value */
|
|
45
|
-
modelValue: { type: String,
|
|
46
|
+
modelValue: { type: String, default: colors.shades.white },
|
|
46
47
|
/** Swatch colors */
|
|
47
48
|
swatches: {
|
|
48
49
|
type: Array as PropType<string[] | string[][]>,
|
|
@@ -88,28 +89,22 @@ export default defineComponent({
|
|
|
88
89
|
* @param context - Context
|
|
89
90
|
*/
|
|
90
91
|
setup(props, context: SetupContext) {
|
|
91
|
-
/**
|
|
92
|
+
/** Check icon visibility */
|
|
92
93
|
const checkedVisibilty: Ref<boolean> = ref(false);
|
|
93
|
-
|
|
94
|
-
/** Selected color */
|
|
95
|
-
const selected: Ref<string> = ref(props.modelValue);
|
|
96
|
-
|
|
97
94
|
/**
|
|
98
95
|
* ボタンがクリックされた
|
|
99
96
|
*
|
|
100
|
-
* @param
|
|
97
|
+
* @param e - イベント
|
|
101
98
|
*/
|
|
102
|
-
const onSwatchClick = (
|
|
103
|
-
|
|
99
|
+
const onSwatchClick = (e: Event) => {
|
|
100
|
+
const value = (e.target as HTMLButtonElement).dataset.value;
|
|
101
|
+
if (!value || props.modelValue === value) {
|
|
104
102
|
return;
|
|
105
103
|
}
|
|
106
|
-
selected.value = value;
|
|
107
104
|
context.emit('update:modelValue', value);
|
|
108
105
|
};
|
|
109
|
-
|
|
110
106
|
return {
|
|
111
107
|
checkedVisibilty,
|
|
112
|
-
selected,
|
|
113
108
|
onSwatchClick,
|
|
114
109
|
};
|
|
115
110
|
},
|
|
@@ -123,7 +118,7 @@ export default defineComponent({
|
|
|
123
118
|
margin: 0.1rem;
|
|
124
119
|
|
|
125
120
|
.v-icon {
|
|
126
|
-
filter: invert(100%);
|
|
121
|
+
filter: invert(100%) grayscale(100%) contrast(100);
|
|
127
122
|
}
|
|
128
123
|
}
|
|
129
124
|
}
|