vuetify-swatches 0.3.0 → 0.3.1

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 CHANGED
@@ -8,6 +8,8 @@
8
8
 
9
9
  ![demo](https://user-images.githubusercontent.com/480173/156681882-d3d5e868-ba9a-4a34-9e75-08272d39da64.gif)
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,15 +1,15 @@
1
1
  import { type PropType, type Ref } from 'vue';
2
2
  /** Vuetify Swatches */
3
- declare const _default: import("vue").DefineComponent<{
3
+ declare const _default: import("vue/types/v3-define-component").DefineComponent<{
4
4
  /** Model value */
5
5
  modelValue: {
6
6
  type: StringConstructor;
7
- required: true;
7
+ default: string;
8
8
  };
9
9
  /** Swatch colors */
10
10
  swatches: {
11
11
  type: PropType<string[] | string[][]>;
12
- default: () => any[][];
12
+ default: () => string[][];
13
13
  };
14
14
  /** The size of the shadow of the button */
15
15
  elevation: {
@@ -33,18 +33,17 @@ declare const _default: import("vue").DefineComponent<{
33
33
  };
34
34
  }, {
35
35
  checkedVisibilty: Ref<boolean>;
36
- selected: Ref<string>;
37
- onSwatchClick: (value: string) => void;
38
- }, 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<{
36
+ onSwatchClick: (e: Event) => void;
37
+ }, import("vue").Data, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
39
38
  /** Model value */
40
39
  modelValue: {
41
40
  type: StringConstructor;
42
- required: true;
41
+ default: string;
43
42
  };
44
43
  /** Swatch colors */
45
44
  swatches: {
46
45
  type: PropType<string[] | string[][]>;
47
- default: () => any[][];
46
+ default: () => string[][];
48
47
  };
49
48
  /** The size of the shadow of the button */
50
49
  elevation: {
@@ -67,6 +66,7 @@ declare const _default: import("vue").DefineComponent<{
67
66
  default: string;
68
67
  };
69
68
  }>>, {
69
+ modelValue: string;
70
70
  swatches: string[] | string[][];
71
71
  elevation: number;
72
72
  size: string;
@@ -1 +1 @@
1
- {"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.ts"],"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;;;;;;;;2BAsBK,MAAM;;IA1DpC,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;;;;;;AA7C7B,wBAiFG"}
1
+ {"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,GAAG,EAET,MAAM,KAAK,CAAC;AAKb,uBAAuB;;IAgBnB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;uBAmBC,KAAK;;IAvD/B,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;;;;;;;AAnD7B,wBAmFG"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,3 @@
1
- /**
2
- * Vuetify3 Swatches Component
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
1
  import VSwatches from './components/VSwatches.vue';
10
2
  declare const installVSwatches: (app: any) => any;
11
3
  export { VSwatches as default, installVSwatches as install };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,SAAS,MAAM,4BAA4B,CAAC;AAEnD,QAAA,MAAM,gBAAgB,mBAA+C,CAAC;AAEtE,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,4BAA4B,CAAC;AAEnD,QAAA,MAAM,gBAAgB,mBAA+C,CAAC;AAEtE,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC"}
package/dist/index.es.js CHANGED
@@ -1,364 +1,55 @@
1
- import { defineComponent, ref, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createCommentVNode } from "vue";
2
- const red = Object.freeze({
3
- base: "#f44336",
4
- lighten5: "#ffebee",
5
- lighten4: "#ffcdd2",
6
- lighten3: "#ef9a9a",
7
- lighten2: "#e57373",
8
- lighten1: "#ef5350",
9
- darken1: "#e53935",
10
- darken2: "#d32f2f",
11
- darken3: "#c62828",
12
- darken4: "#b71c1c",
13
- accent1: "#ff8a80",
14
- accent2: "#ff5252",
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 Vuetify.
5
+ * @author Logue <logue@hotmail.co.jp>
6
+ * @copyright 2022 By Masashi Yoshikawa All rights reserved.
7
+ * @license MIT
8
+ * @version 0.0.11
9
+ * @see {@link https://github.com/logue/vuetify-swatches}
10
+ */
11
+
12
+ import { defineComponent as b, ref as v } from "vue";
13
+ import { VSheet as w, VBtn as V, VIcon as y } from "vuetify/lib/components";
14
+ import e from "vuetify/lib/util/colors";
15
+ const S = b({
330
16
  name: "VSwatches",
17
+ components: {
18
+ VSheet: w,
19
+ VBtn: V,
20
+ VIcon: y
21
+ },
331
22
  model: {
332
23
  prop: "modelValue",
333
24
  event: "update:modelValue"
334
25
  },
335
26
  props: {
336
- modelValue: { type: String, required: true },
27
+ modelValue: { type: String, default: "#ffffff" },
337
28
  swatches: {
338
29
  type: Array,
339
30
  default: () => [
340
- [colors.shades.black, colors.shades.white],
31
+ [e.shades.black, e.shades.white],
341
32
  [
342
- colors.red.base,
343
- colors.pink.base,
344
- colors.purple.base,
345
- colors.deepPurple.base,
346
- colors.indigo.base,
347
- colors.blue.base,
348
- colors.lightBlue.base,
349
- colors.cyan.base
33
+ e.red.base,
34
+ e.pink.base,
35
+ e.purple.base,
36
+ e.deepPurple.base,
37
+ e.indigo.base,
38
+ e.blue.base,
39
+ e.lightBlue.base,
40
+ e.cyan.base
350
41
  ],
351
42
  [
352
- colors.teal.base,
353
- colors.green.base,
354
- colors.lightGreen.base,
355
- colors.lime.base,
356
- colors.yellow.base,
357
- colors.amber.base,
358
- colors.orange.base,
359
- colors.deepOrange.base
43
+ e.teal.base,
44
+ e.green.base,
45
+ e.lightGreen.base,
46
+ e.lime.base,
47
+ e.yellow.base,
48
+ e.amber.base,
49
+ e.orange.base,
50
+ e.deepOrange.base
360
51
  ],
361
- [colors.brown.base, colors.blueGrey.base, colors.grey.base]
52
+ [e.brown.base, e.blueGrey.base, e.grey.base]
362
53
  ]
363
54
  },
364
55
  elevation: { type: Number, default: 1 },
@@ -367,70 +58,53 @@ const _sfc_main = defineComponent({
367
58
  iconSize: { type: String, default: "1rem" }
368
59
  },
369
60
  emits: ["update:modelValue"],
370
- setup(props, context) {
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
- };
61
+ setup(s, t) {
380
62
  return {
381
- checkedVisibilty,
382
- selected,
383
- onSwatchClick
63
+ checkedVisibilty: v(!1),
64
+ onSwatchClick: (i) => {
65
+ const a = i.target.value;
66
+ !a || s.modelValue === a || t.emit("update:modelValue", a);
67
+ }
384
68
  };
385
69
  }
386
70
  });
387
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
388
- const _component_v_icon = resolveComponent("v-icon");
389
- const _component_v_btn = resolveComponent("v-btn");
390
- const _component_v_sheet = resolveComponent("v-sheet");
391
- return openBlock(), createBlock(_component_v_sheet, { class: "v-swatches" }, {
392
- default: withCtx(() => [
393
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.swatches, (colors2, rows) => {
394
- return openBlock(), createElementBlock("div", { key: rows }, [
395
- (openBlock(true), createElementBlock(Fragment, null, renderList(colors2, (color) => {
396
- return openBlock(), createBlock(_component_v_btn, {
397
- key: color,
398
- elevation: _ctx.elevation,
399
- width: _ctx.size,
400
- height: _ctx.size,
401
- color,
402
- "min-width": "auto",
403
- onClick: ($event) => _ctx.onSwatchClick(color)
404
- }, {
405
- default: withCtx(() => [
406
- color === _ctx.selected ? (openBlock(), createBlock(_component_v_icon, {
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)
416
- ]),
417
- _: 2
418
- }, 1032, ["elevation", "width", "height", "color", "onClick"]);
419
- }), 128))
420
- ]);
421
- }), 128))
422
- ]),
423
- _: 1
424
- });
71
+ function g(s, t, l, u, i, a, d, p) {
72
+ var n = typeof s == "function" ? s.options : s;
73
+ t && (n.render = t, n.staticRenderFns = l, n._compiled = !0), u && (n.functional = !0), a && (n._scopeId = "data-v-" + a);
74
+ var r;
75
+ if (d ? (r = function(o) {
76
+ o = o || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !o && typeof __VUE_SSR_CONTEXT__ < "u" && (o = __VUE_SSR_CONTEXT__), i && i.call(this, o), o && o._registeredComponents && o._registeredComponents.add(d);
77
+ }, n._ssrRegister = r) : i && (r = p ? function() {
78
+ i.call(this, (n.functional ? this.parent : this).$root.$options.shadowRoot);
79
+ } : i), r)
80
+ if (n.functional) {
81
+ n._injectStyles = r;
82
+ var h = n.render;
83
+ n.render = function(m, c) {
84
+ return r.call(c), h(m, c);
85
+ };
86
+ } else {
87
+ var f = n.beforeCreate;
88
+ n.beforeCreate = f ? [].concat(f, r) : [r];
89
+ }
90
+ return {
91
+ exports: s,
92
+ options: n
93
+ };
425
94
  }
426
- var VSwatches = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
427
- /**
428
- * Vuetify3 Swatches Component
429
- *
430
- * @license MIT
431
- * @author Logue {@link logue@hotmail.co.jp}
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 };
95
+ var C = function() {
96
+ var t = this, l = t._self._c;
97
+ return t._self._setupProxy, l("v-sheet", { staticClass: "v-swatches" }, t._l(t.swatches, function(u, i) {
98
+ return l("div", { key: i }, t._l(u, function(a) {
99
+ return l("v-btn", { key: a, attrs: { elevation: t.elevation, width: t.size, height: t.size, color: a, value: a, "min-width": "auto" }, on: { click: function(d) {
100
+ return t.onSwatchClick(d);
101
+ } } }, [a === t.modelValue ? l("v-icon", { attrs: { size: t.iconSize, color: a } }, [t._v(" " + t._s(t.icon) + " ")]) : t._e()], 1);
102
+ }), 1);
103
+ }), 0);
104
+ }, k = [], z = /* @__PURE__ */ g(S, C, k, !1, null, null, null, null);
105
+ const _ = z.exports, N = (s) => s.component("VSwatches", _);
106
+ typeof window < "u" && window.Vue && window.Vue.use(_);
107
+ export {
108
+ _ as default,
109
+ N as install
110
+ };
package/dist/index.umd.js CHANGED
@@ -1,9 +1,12 @@
1
- (function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a.VSwatches={},a.Vue))})(this,function(a,e){"use strict";const h=Object.freeze({base:"#f44336",lighten5:"#ffebee",lighten4:"#ffcdd2",lighten3:"#ef9a9a",lighten2:"#e57373",lighten1:"#ef5350",darken1:"#e53935",darken2:"#d32f2f",darken3:"#c62828",darken4:"#b71c1c",accent1:"#ff8a80",accent2:"#ff5252",accent3:"#ff1744",accent4:"#d50000"}),s=Object.freeze({base:"#e91e63",lighten5:"#fce4ec",lighten4:"#f8bbd0",lighten3:"#f48fb1",lighten2:"#f06292",lighten1:"#ec407a",darken1:"#d81b60",darken2:"#c2185b",darken3:"#ad1457",darken4:"#880e4f",accent1:"#ff80ab",accent2:"#ff4081",accent3:"#f50057",accent4:"#c51162"}),o=Object.freeze({base:"#9c27b0",lighten5:"#f3e5f5",lighten4:"#e1bee7",lighten3:"#ce93d8",lighten2:"#ba68c8",lighten1:"#ab47bc",darken1:"#8e24aa",darken2:"#7b1fa2",darken3:"#6a1b9a",darken4:"#4a148c",accent1:"#ea80fc",accent2:"#e040fb",accent3:"#d500f9",accent4:"#aa00ff"}),g=Object.freeze({base:"#673ab7",lighten5:"#ede7f6",lighten4:"#d1c4e9",lighten3:"#b39ddb",lighten2:"#9575cd",lighten1:"#7e57c2",darken1:"#5e35b1",darken2:"#512da8",darken3:"#4527a0",darken4:"#311b92",accent1:"#b388ff",accent2:"#7c4dff",accent3:"#651fff",accent4:"#6200ea"}),k=Object.freeze({base:"#3f51b5",lighten5:"#e8eaf6",lighten4:"#c5cae9",lighten3:"#9fa8da",lighten2:"#7986cb",lighten1:"#5c6bc0",darken1:"#3949ab",darken2:"#303f9f",darken3:"#283593",darken4:"#1a237e",accent1:"#8c9eff",accent2:"#536dfe",accent3:"#3d5afe",accent4:"#304ffe"}),p=Object.freeze({base:"#2196f3",lighten5:"#e3f2fd",lighten4:"#bbdefb",lighten3:"#90caf9",lighten2:"#64b5f6",lighten1:"#42a5f5",darken1:"#1e88e5",darken2:"#1976d2",darken3:"#1565c0",darken4:"#0d47a1",accent1:"#82b1ff",accent2:"#448aff",accent3:"#2979ff",accent4:"#2962ff"}),m=Object.freeze({base:"#03a9f4",lighten5:"#e1f5fe",lighten4:"#b3e5fc",lighten3:"#81d4fa",lighten2:"#4fc3f7",lighten1:"#29b6f6",darken1:"#039be5",darken2:"#0288d1",darken3:"#0277bd",darken4:"#01579b",accent1:"#80d8ff",accent2:"#40c4ff",accent3:"#00b0ff",accent4:"#0091ea"}),u=Object.freeze({base:"#00bcd4",lighten5:"#e0f7fa",lighten4:"#b2ebf2",lighten3:"#80deea",lighten2:"#4dd0e1",lighten1:"#26c6da",darken1:"#00acc1",darken2:"#0097a7",darken3:"#00838f",darken4:"#006064",accent1:"#84ffff",accent2:"#18ffff",accent3:"#00e5ff",accent4:"#00b8d4"}),z=Object.freeze({base:"#009688",lighten5:"#e0f2f1",lighten4:"#b2dfdb",lighten3:"#80cbc4",lighten2:"#4db6ac",lighten1:"#26a69a",darken1:"#00897b",darken2:"#00796b",darken3:"#00695c",darken4:"#004d40",accent1:"#a7ffeb",accent2:"#64ffda",accent3:"#1de9b6",accent4:"#00bfa5"}),w=Object.freeze({base:"#4caf50",lighten5:"#e8f5e9",lighten4:"#c8e6c9",lighten3:"#a5d6a7",lighten2:"#81c784",lighten1:"#66bb6a",darken1:"#43a047",darken2:"#388e3c",darken3:"#2e7d32",darken4:"#1b5e20",accent1:"#b9f6ca",accent2:"#69f0ae",accent3:"#00e676",accent4:"#00c853"}),y=Object.freeze({base:"#8bc34a",lighten5:"#f1f8e9",lighten4:"#dcedc8",lighten3:"#c5e1a5",lighten2:"#aed581",lighten1:"#9ccc65",darken1:"#7cb342",darken2:"#689f38",darken3:"#558b2f",darken4:"#33691e",accent1:"#ccff90",accent2:"#b2ff59",accent3:"#76ff03",accent4:"#64dd17"}),O=Object.freeze({base:"#cddc39",lighten5:"#f9fbe7",lighten4:"#f0f4c3",lighten3:"#e6ee9c",lighten2:"#dce775",lighten1:"#d4e157",darken1:"#c0ca33",darken2:"#afb42b",darken3:"#9e9d24",darken4:"#827717",accent1:"#f4ff81",accent2:"#eeff41",accent3:"#c6ff00",accent4:"#aeea00"}),j=Object.freeze({base:"#ffeb3b",lighten5:"#fffde7",lighten4:"#fff9c4",lighten3:"#fff59d",lighten2:"#fff176",lighten1:"#ffee58",darken1:"#fdd835",darken2:"#fbc02d",darken3:"#f9a825",darken4:"#f57f17",accent1:"#ffff8d",accent2:"#ffff00",accent3:"#ffea00",accent4:"#ffd600"}),_=Object.freeze({base:"#ffc107",lighten5:"#fff8e1",lighten4:"#ffecb3",lighten3:"#ffe082",lighten2:"#ffd54f",lighten1:"#ffca28",darken1:"#ffb300",darken2:"#ffa000",darken3:"#ff8f00",darken4:"#ff6f00",accent1:"#ffe57f",accent2:"#ffd740",accent3:"#ffc400",accent4:"#ffab00"}),S=Object.freeze({base:"#ff9800",lighten5:"#fff3e0",lighten4:"#ffe0b2",lighten3:"#ffcc80",lighten2:"#ffb74d",lighten1:"#ffa726",darken1:"#fb8c00",darken2:"#f57c00",darken3:"#ef6c00",darken4:"#e65100",accent1:"#ffd180",accent2:"#ffab40",accent3:"#ff9100",accent4:"#ff6d00"}),V=Object.freeze({base:"#ff5722",lighten5:"#fbe9e7",lighten4:"#ffccbc",lighten3:"#ffab91",lighten2:"#ff8a65",lighten1:"#ff7043",darken1:"#f4511e",darken2:"#e64a19",darken3:"#d84315",darken4:"#bf360c",accent1:"#ff9e80",accent2:"#ff6e40",accent3:"#ff3d00",accent4:"#dd2c00"}),B=Object.freeze({base:"#795548",lighten5:"#efebe9",lighten4:"#d7ccc8",lighten3:"#bcaaa4",lighten2:"#a1887f",lighten1:"#8d6e63",darken1:"#6d4c41",darken2:"#5d4037",darken3:"#4e342e",darken4:"#3e2723"}),C=Object.freeze({base:"#607d8b",lighten5:"#eceff1",lighten4:"#cfd8dc",lighten3:"#b0bec5",lighten2:"#90a4ae",lighten1:"#78909c",darken1:"#546e7a",darken2:"#455a64",darken3:"#37474f",darken4:"#263238"}),v=Object.freeze({base:"#9e9e9e",lighten5:"#fafafa",lighten4:"#f5f5f5",lighten3:"#eeeeee",lighten2:"#e0e0e0",lighten1:"#bdbdbd",darken1:"#757575",darken2:"#616161",darken3:"#424242",darken4:"#212121"}),$=Object.freeze({black:"#000000",white:"#ffffff",transparent:"transparent"});var n=Object.freeze({red:h,pink:s,purple:o,deepPurple:g,indigo:k,blue:p,lightBlue:m,cyan:u,teal:z,green:w,lightGreen:y,lime:O,yellow:j,amber:_,orange:S,deepOrange:V,brown:B,blueGrey:C,grey:v,shades:$}),x=(()=>`.v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%)}
2
- `)(),G=(t,l)=>{const f=t.__vccOpts||t;for(const[c,i]of l)f[c]=i;return f};const T=e.defineComponent({name:"VSwatches",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,required:!0},swatches:{type:Array,default:()=>[[n.shades.black,n.shades.white],[n.red.base,n.pink.base,n.purple.base,n.deepPurple.base,n.indigo.base,n.blue.base,n.lightBlue.base,n.cyan.base],[n.teal.base,n.green.base,n.lightGreen.base,n.lime.base,n.yellow.base,n.amber.base,n.orange.base,n.deepOrange.base],[n.brown.base,n.blueGrey.base,n.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(t,l){const f=e.ref(!1),c=e.ref(t.modelValue);return{checkedVisibilty:f,selected:c,onSwatchClick:d=>{!d||c.value===d||(c.value=d,l.emit("update:modelValue",d))}}}});function E(t,l,f,c,i,d){const P=e.resolveComponent("v-icon"),q=e.resolveComponent("v-btn"),F=e.resolveComponent("v-sheet");return e.openBlock(),e.createBlock(F,{class:"v-swatches"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.swatches,(L,M)=>(e.openBlock(),e.createElementBlock("div",{key:M},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L,r=>(e.openBlock(),e.createBlock(q,{key:r,elevation:t.elevation,width:t.size,height:t.size,color:r,"min-width":"auto",onClick:A=>t.onSwatchClick(r)},{default:e.withCtx(()=>[r===t.selected?(e.openBlock(),e.createBlock(P,{key:0,size:t.iconSize,color:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.icon),1)]),_:2},1032,["size","color"])):e.createCommentVNode("",!0)]),_:2},1032,["elevation","width","height","color","onClick"]))),128))]))),128))]),_:1})}var b=G(T,[["render",E]]);/**
3
- * Vuetify3 Swatches Component
1
+ /**
2
+ * vuetify-swatches
4
3
  *
4
+ * @description Color Swatch component for Vuetify.
5
+ * @author Logue <logue@hotmail.co.jp>
6
+ * @copyright 2022 By Masashi Yoshikawa All rights reserved.
5
7
  * @license MIT
6
- * @author Logue {@link logue@hotmail.co.jp}
7
- * @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
8
+ * @version 0.0.11
8
9
  * @see {@link https://github.com/logue/vuetify-swatches}
9
- */const N=t=>t.component("VSwatches",b);a.default=b,a.install=N,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
10
+ */
11
+
12
+ (function(l,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("vuetify/lib/components"),require("vuetify/lib/util/colors")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify/lib/components","vuetify/lib/util/colors"],r):(l=typeof globalThis<"u"?globalThis:l||self,r(l.VSwatches={},l.Vue,l.Vuetify,l.colors))})(this,function(l,r,_,v){"use strict";const e=(n=>n&&typeof n=="object"&&"default"in n?n:{default:n})(v),m=r.defineComponent({name:"VSwatches",components:{VSheet:_.VSheet,VBtn:_.VBtn,VIcon:_.VIcon},model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:"#ffffff"},swatches:{type:Array,default:()=>[[e.default.shades.black,e.default.shades.white],[e.default.red.base,e.default.pink.base,e.default.purple.base,e.default.deepPurple.base,e.default.indigo.base,e.default.blue.base,e.default.lightBlue.base,e.default.cyan.base],[e.default.teal.base,e.default.green.base,e.default.lightGreen.base,e.default.lime.base,e.default.yellow.base,e.default.amber.base,e.default.orange.base,e.default.deepOrange.base],[e.default.brown.base,e.default.blueGrey.base,e.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(n,t){return{checkedVisibilty:r.ref(!1),onSwatchClick:u=>{const i=u.target.value;!i||n.modelValue===i||t.emit("update:modelValue",i)}}}}),R="";function y(n,t,f,d,u,i,c,C){var a=typeof n=="function"?n.options:n;t&&(a.render=t,a.staticRenderFns=f,a._compiled=!0),d&&(a.functional=!0),i&&(a._scopeId="data-v-"+i);var o;if(c?(o=function(s){s=s||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!s&&typeof __VUE_SSR_CONTEXT__<"u"&&(s=__VUE_SSR_CONTEXT__),u&&u.call(this,s),s&&s._registeredComponents&&s._registeredComponents.add(c)},a._ssrRegister=o):u&&(o=C?function(){u.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:u),o)if(a.functional){a._injectStyles=o;var k=a.render;a.render=function(z,b){return o.call(b),k(z,b)}}else{var h=a.beforeCreate;a.beforeCreate=h?[].concat(h,o):[o]}return{exports:n,options:a}}var V=function(){var t=this,f=t._self._c;return t._self._setupProxy,f("v-sheet",{staticClass:"v-swatches"},t._l(t.swatches,function(d,u){return f("div",{key:u},t._l(d,function(i){return f("v-btn",{key:i,attrs:{elevation:t.elevation,width:t.size,height:t.size,color:i,value:i,"min-width":"auto"},on:{click:function(c){return t.onSwatchClick(c)}}},[i===t.modelValue?f("v-icon",{attrs:{size:t.iconSize,color:i}},[t._v(" "+t._s(t.icon)+" ")]):t._e()],1)}),1)}),0)},w=[],S=y(m,V,w,!1,null,null,null,null);const p=S.exports,g=n=>n.component("VSwatches",p);typeof window<"u"&&window.Vue&&window.Vue.use(p),l.default=p,l.install=g,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css CHANGED
@@ -1 +1,12 @@
1
+ /**
2
+ * vuetify-swatches
3
+ *
4
+ * @description Color Swatch component for Vuetify.
5
+ * @author Logue <logue@hotmail.co.jp>
6
+ * @copyright 2022 By Masashi Yoshikawa All rights reserved.
7
+ * @license MIT
8
+ * @version 0.0.11
9
+ * @see {@link https://github.com/logue/vuetify-swatches}
10
+ */
11
+
1
12
  .v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(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.0",
4
+ "version": "0.3.1",
5
5
  "description": "Color Swatch component for Vuetify3.",
6
6
  "keywords": [
7
7
  "vuejs",
@@ -17,6 +17,7 @@
17
17
  "vuetify3",
18
18
  "vuetify-components"
19
19
  ],
20
+ "license": "MIT",
20
21
  "author": {
21
22
  "name": "Logue",
22
23
  "email": "logue@hotmail.co.jp",
@@ -30,14 +31,10 @@
30
31
  "bugs": {
31
32
  "url": "https://github.com/logue/vuetify-swatches/issues"
32
33
  },
33
- "engines": {
34
- "node": ">=16.15.0",
35
- "yarn": ">=1.22.4"
36
- },
37
- "packageManager": "yarn@3.2.1",
38
- "license": "MIT",
39
- "main": "./dist/index.umd.js",
40
- "module": "./dist/index.es.js",
34
+ "main": "dist/index.umd.js",
35
+ "module": "dist/index.es.js",
36
+ "types": "dist/index.d.ts",
37
+ "style": "dist/style.css",
41
38
  "browser": {
42
39
  "./sfc": "./src/components/VSwatches.vue"
43
40
  },
@@ -51,11 +48,15 @@
51
48
  "require": "./dist/style.css"
52
49
  }
53
50
  },
54
- "types": "./dist/index.d.ts",
55
51
  "files": [
56
52
  "dist",
57
53
  "src/components/VSwatches.vue"
58
54
  ],
55
+ "engines": {
56
+ "node": ">=16.15.0",
57
+ "yarn": ">=1.22.4"
58
+ },
59
+ "packageManager": "yarn@3.2.1",
59
60
  "sideEffects": false,
60
61
  "scripts": {
61
62
  "dev": "vite",
@@ -72,53 +73,54 @@
72
73
  },
73
74
  "peerDependencies": {
74
75
  "vue": "^3.2.37",
75
- "vuetify": "^3.0.0-beta.4"
76
+ "vuetify": "^3.0.0-beta.6"
76
77
  },
77
78
  "devDependencies": {
78
79
  "@codemirror/lang-html": "^6.1.0",
79
- "@codemirror/state": "^6.0.1",
80
- "@codemirror/view": "^6.0.2",
81
- "@types/node": "^18.0.0",
82
- "@typescript-eslint/eslint-plugin": "^5.30.0",
83
- "@typescript-eslint/parser": "^5.30.0",
84
- "@vitejs/plugin-vue": "^2.3.3",
85
- "eslint": "^8.18.0",
80
+ "@types/node": "^18.6.3",
81
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
82
+ "@typescript-eslint/parser": "^5.32.0",
83
+ "@vitejs/plugin-vue": "^3.0.1",
84
+ "@vue/tsconfig": "^0.1.3",
85
+ "codemirror": "^6.0.1",
86
+ "eslint": "^8.21.0",
86
87
  "eslint-config-google": "^0.14.0",
87
88
  "eslint-config-prettier": "^8.5.0",
88
89
  "eslint-import-resolver-alias": "^1.1.2",
89
- "eslint-import-resolver-typescript": "^3.1.1",
90
+ "eslint-import-resolver-typescript": "^3.4.0",
90
91
  "eslint-plugin-import": "^2.26.0",
91
- "eslint-plugin-jsdoc": "^39.3.3",
92
+ "eslint-plugin-jsdoc": "^39.3.4",
92
93
  "eslint-plugin-tsdoc": "^0.2.16",
93
- "eslint-plugin-vue": "^9.1.1",
94
+ "eslint-plugin-vue": "^9.3.0",
94
95
  "eslint-plugin-vuejs-accessibility": "^1.2.0",
95
96
  "eslint-plugin-vuetify": "^1.1.0",
96
97
  "eslint-plugin-yaml": "^0.5.0",
97
98
  "husky": "^8.0.1",
98
99
  "lint-staged": "^13.0.3",
99
- "postcss-html": "^1.4.1",
100
+ "postcss-html": "^1.5.0",
100
101
  "prettier": "^2.7.1",
101
102
  "prettier-plugin-jsdoc": "^0.3.38",
102
- "prettier-plugin-md-nocjsp": "^1.2.0",
103
+ "prettier-plugin-md-nocjsp": "^1.3.0",
103
104
  "prettier-plugin-sort-imports": "^1.7.0",
104
105
  "rimraf": "^3.0.2",
105
- "rollup-plugin-visualizer": "^5.6.0",
106
- "sass": "1.53.0",
106
+ "rollup-plugin-visualizer": "^5.7.1",
107
+ "sass": "1.54.0",
107
108
  "stylelint": "^14.9.1",
108
109
  "stylelint-config-prettier": "^9.0.3",
109
- "stylelint-config-recommended-scss": "^6.0.0",
110
+ "stylelint-config-recommended-scss": "^7.0.0",
110
111
  "stylelint-config-recommended-vue": "^1.4.0",
111
112
  "stylelint-order": "^5.0.0",
112
113
  "stylelint-prettier": "^2.0.0",
113
114
  "typescript": "^4.7.4",
114
- "vite": "^2.9.13",
115
- "vite-plugin-checker": "^0.4.6",
116
- "vite-plugin-vuetify": "^1.0.0-alpha.12",
115
+ "vite": "^3.0.4",
116
+ "vite-plugin-banner": "^0.3.0",
117
+ "vite-plugin-checker": "^0.4.9",
118
+ "vite-plugin-vuetify": "^1.0.0-alpha.14",
117
119
  "vue": "^3.2.37",
118
- "vue-codemirror6": "0.6.4",
120
+ "vue-codemirror6": "0.6.8",
119
121
  "vue-eslint-parser": "^9.0.3",
120
- "vue-tsc": "^0.38.2",
121
- "vuetify": "^3.0.0-beta.4"
122
+ "vue-tsc": "^0.39.4",
123
+ "vuetify": "^3.0.0-beta.6"
122
124
  },
123
125
  "husky": {
124
126
  "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(color)"
13
+ @click="onSwatchClick($event)"
13
14
  >
14
- <v-icon v-if="color === selected" :size="iconSize" :color="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, required: true },
46
+ modelValue: { type: String, default: '#ffffff' },
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 value - 色
97
+ * @param e - イベント
101
98
  */
102
- const onSwatchClick = (value: string) => {
103
- if (!value || selected.value === value) {
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
  }