vuetify-swatches 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Masashi Yoshikawa
3
+ Copyright (c) 2022-2023 Masashi Yoshikawa
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/Meta.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type MetaInterface from '@/interfaces/MetaInterface';
2
+ declare const meta: MetaInterface;
3
+ export default meta;
package/dist/Meta.js ADDED
@@ -0,0 +1,6 @@
1
+ // This file is auto-generated by the build system.
2
+ const meta = {
3
+ version: '1.0.6',
4
+ date: '2023-02-04T12:13:06.676Z',
5
+ };
6
+ export default meta;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import VSwatches from './components/VSwatches.vue';
1
+ import VSwatches from '@/components/VSwatches.vue';
2
+ import Meta from '@/Meta';
2
3
  declare const installVSwatches: (app: any) => any;
3
- export { VSwatches as default, installVSwatches as install };
4
- //# sourceMappingURL=index.d.ts.map
4
+ export { VSwatches as default, installVSwatches as install, Meta };
package/dist/index.es.js CHANGED
@@ -3,29 +3,28 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify.
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2022 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.0.4
8
+ * @version 1.0.6
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- import { defineComponent, ref } from 'vue-demi';
13
12
  import { VSheet, VBtn, VIcon } from 'vuetify/lib';
13
+ import { defineComponent, ref, watch } from 'vue-demi';
14
14
  import colors from 'vuetify/lib/util/colors';
15
15
 
16
- const _sfc_main = defineComponent({
16
+ var _sfc_main = defineComponent({
17
+ /** Component name */
17
18
  name: "VSwatches",
18
- components: {
19
- VSheet,
20
- VBtn,
21
- VIcon
22
- },
19
+ /** Model Definition */
23
20
  model: {
24
21
  prop: "modelValue",
25
22
  event: "update:modelValue"
26
23
  },
27
24
  props: {
25
+ /** Model value */
28
26
  modelValue: { type: String, default: "#ffffff" },
27
+ /** Swatch colors */
29
28
  swatches: {
30
29
  type: Array,
31
30
  default: () => [
@@ -53,28 +52,83 @@ const _sfc_main = defineComponent({
53
52
  [colors.brown.base, colors.blueGrey.base, colors.grey.base]
54
53
  ]
55
54
  },
55
+ /** Swatch sized */
56
56
  size: { type: String, default: "2rem" },
57
+ /** Selected icon */
57
58
  icon: { type: String, default: "mdi-checkbox-marked-circle" },
59
+ /** selected icon size */
58
60
  iconSize: { type: String, default: "1rem" },
61
+ /**
62
+ * Removes the button box shadow.
63
+ *
64
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#depressed}
65
+ */
59
66
  depressed: { type: Boolean, default: false },
67
+ /**
68
+ * Removes the ability to click or target the component.
69
+ *
70
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
71
+ */
60
72
  disabled: { type: Boolean, default: false },
73
+ /**
74
+ * Designates an elevation applied to the component between 0 and 24.
75
+ *
76
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
77
+ */
61
78
  elevation: { type: [Number, String], default: void 0 },
79
+ /**
80
+ * Makes the background transparent and applies a thin border.
81
+ *
82
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#outlined}
83
+ */
62
84
  outlined: { type: Boolean, default: false },
85
+ /**
86
+ * Removes the default background change applied when hovering over the button.
87
+ *
88
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#plain}
89
+ */
63
90
  plain: { type: Boolean, default: false },
91
+ /**
92
+ * Raised buttons have a box shadow that increases when clicked. This is the default style.
93
+ *
94
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#raised}
95
+ */
64
96
  raised: { type: Boolean, default: true },
97
+ /**
98
+ * Applies a large border radius on the button.
99
+ *
100
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
101
+ */
65
102
  rounded: { type: Boolean, default: false },
103
+ /**
104
+ * Removes the component’s border-radius.
105
+ *
106
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#tile}
107
+ */
66
108
  tile: { type: Boolean, default: false }
67
109
  },
110
+ /** Emits */
68
111
  emits: ["update:modelValue"],
112
+ /**
113
+ * Setup
114
+ *
115
+ * @param props - Props
116
+ * @param context - Context
117
+ */
69
118
  setup(props, context) {
70
119
  const checkedVisibilty = ref(false);
120
+ const selected = ref(props.modelValue);
71
121
  const onSwatchClick = (e) => {
72
122
  const value = e.target.value;
73
123
  if (!value || props.modelValue === value) {
74
124
  return;
75
125
  }
76
- context.emit("update:modelValue", value);
126
+ selected.value = value;
77
127
  };
128
+ watch(
129
+ () => selected.value,
130
+ (value) => context.emit("update:modelValue", value)
131
+ );
78
132
  return {
79
133
  checkedVisibilty,
80
134
  onSwatchClick
@@ -82,7 +136,7 @@ const _sfc_main = defineComponent({
82
136
  }
83
137
  });
84
138
 
85
- const VSwatches_vue_vue_type_style_index_0_lang = '';
139
+ /* unplugin-vue-components disabled */var VSwatches_vue_vue_type_style_index_0_lang = '';
86
140
 
87
141
  function normalizeComponent (
88
142
  scriptExports,
@@ -179,11 +233,11 @@ function normalizeComponent (
179
233
 
180
234
  var _sfc_render = function render() {
181
235
  var _vm = this, _c = _vm._self._c; _vm._self._setupProxy;
182
- return _c("v-sheet", { staticClass: "v-swatches" }, _vm._l(_vm.swatches, function(colors, rows) {
236
+ return _c(VSheet, { staticClass: "v-swatches" }, _vm._l(_vm.swatches, function(colors, rows) {
183
237
  return _c("div", { key: rows }, _vm._l(colors, function(color) {
184
- return _c("v-btn", { key: color, attrs: { "color": color, "depressed": _vm.depressed, "disabled": _vm.disabled, "elevation": _vm.elevation, "height": _vm.size, "outlined": _vm.outlined, "plain": _vm.plain, "raised": _vm.raised, "tile": _vm.tile, "value": color, "width": _vm.size, "min-width": "auto" }, on: { "click": function($event) {
238
+ return _c(VBtn, { key: color, attrs: { "color": color, "depressed": _vm.depressed, "disabled": _vm.disabled, "elevation": _vm.elevation, "height": _vm.size, "outlined": _vm.outlined, "plain": _vm.plain, "raised": _vm.raised, "tile": _vm.tile, "value": color, "width": _vm.size, "min-width": "auto" }, on: { "click": function($event) {
185
239
  return _vm.onSwatchClick($event);
186
- } } }, [color === _vm.modelValue ? _c("v-icon", { attrs: { "size": _vm.iconSize, "color": color !== "transparent" ? color : void 0 } }, [_vm._v(" " + _vm._s(_vm.icon) + " ")]) : _vm._e()], 1);
240
+ } } }, [color === _vm.modelValue ? _c(VIcon, { attrs: { "size": _vm.iconSize, "color": color !== "transparent" ? color : void 0 } }, [_vm._v(" " + _vm._s(_vm.icon) + " ")]) : _vm._e()], 1);
187
241
  }), 1);
188
242
  }), 0);
189
243
  };
@@ -198,11 +252,16 @@ var __component__ = /* @__PURE__ */ normalizeComponent(
198
252
  null,
199
253
  null
200
254
  );
201
- const VSwatches = __component__.exports;
255
+ var VSwatches = __component__.exports;
256
+
257
+ const meta = {
258
+ version: "1.0.6",
259
+ date: "2023-02-04T12:13:06.676Z"
260
+ };
202
261
 
203
262
  const installVSwatches = (app) => app.component("VSwatches", VSwatches);
204
263
  if (typeof window !== "undefined" && window.Vue) {
205
264
  window.Vue.use(VSwatches);
206
265
  }
207
266
 
208
- export { VSwatches as default, installVSwatches as install };
267
+ export { meta as Meta, VSwatches as default, installVSwatches as install };
@@ -3,77 +3,135 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify.
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2022 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.0.4
8
+ * @version 1.0.6
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- var VSwatches = (function (exports, vueDemi, lib, colors) {
12
+ var VSwatches = (function (exports, lib, vueDemi, colors) {
13
13
  'use strict';
14
14
 
15
- const _sfc_main = vueDemi.defineComponent({
15
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
+
17
+ var colors__default = /*#__PURE__*/_interopDefaultCompat(colors);
18
+
19
+ var _sfc_main = vueDemi.defineComponent({
20
+ /** Component name */
16
21
  name: "VSwatches",
17
- components: {
18
- VSheet: lib.VSheet,
19
- VBtn: lib.VBtn,
20
- VIcon: lib.VIcon
21
- },
22
+ /** Model Definition */
22
23
  model: {
23
24
  prop: "modelValue",
24
25
  event: "update:modelValue"
25
26
  },
26
27
  props: {
28
+ /** Model value */
27
29
  modelValue: { type: String, default: "#ffffff" },
30
+ /** Swatch colors */
28
31
  swatches: {
29
32
  type: Array,
30
33
  default: () => [
31
- [colors.shades.black, colors.shades.white, colors.shades.transparent],
34
+ [colors__default["default"].shades.black, colors__default["default"].shades.white, colors__default["default"].shades.transparent],
32
35
  [
33
- colors.red.base,
34
- colors.pink.base,
35
- colors.purple.base,
36
- colors.deepPurple.base,
37
- colors.indigo.base,
38
- colors.blue.base,
39
- colors.lightBlue.base,
40
- colors.cyan.base
36
+ colors__default["default"].red.base,
37
+ colors__default["default"].pink.base,
38
+ colors__default["default"].purple.base,
39
+ colors__default["default"].deepPurple.base,
40
+ colors__default["default"].indigo.base,
41
+ colors__default["default"].blue.base,
42
+ colors__default["default"].lightBlue.base,
43
+ colors__default["default"].cyan.base
41
44
  ],
42
45
  [
43
- colors.teal.base,
44
- colors.green.base,
45
- colors.lightGreen.base,
46
- colors.lime.base,
47
- colors.yellow.base,
48
- colors.amber.base,
49
- colors.orange.base,
50
- colors.deepOrange.base
46
+ colors__default["default"].teal.base,
47
+ colors__default["default"].green.base,
48
+ colors__default["default"].lightGreen.base,
49
+ colors__default["default"].lime.base,
50
+ colors__default["default"].yellow.base,
51
+ colors__default["default"].amber.base,
52
+ colors__default["default"].orange.base,
53
+ colors__default["default"].deepOrange.base
51
54
  ],
52
- [colors.brown.base, colors.blueGrey.base, colors.grey.base]
55
+ [colors__default["default"].brown.base, colors__default["default"].blueGrey.base, colors__default["default"].grey.base]
53
56
  ]
54
57
  },
58
+ /** Swatch sized */
55
59
  size: { type: String, default: "2rem" },
60
+ /** Selected icon */
56
61
  icon: { type: String, default: "mdi-checkbox-marked-circle" },
62
+ /** selected icon size */
57
63
  iconSize: { type: String, default: "1rem" },
64
+ /**
65
+ * Removes the button box shadow.
66
+ *
67
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#depressed}
68
+ */
58
69
  depressed: { type: Boolean, default: false },
70
+ /**
71
+ * Removes the ability to click or target the component.
72
+ *
73
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
74
+ */
59
75
  disabled: { type: Boolean, default: false },
76
+ /**
77
+ * Designates an elevation applied to the component between 0 and 24.
78
+ *
79
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
80
+ */
60
81
  elevation: { type: [Number, String], default: void 0 },
82
+ /**
83
+ * Makes the background transparent and applies a thin border.
84
+ *
85
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#outlined}
86
+ */
61
87
  outlined: { type: Boolean, default: false },
88
+ /**
89
+ * Removes the default background change applied when hovering over the button.
90
+ *
91
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#plain}
92
+ */
62
93
  plain: { type: Boolean, default: false },
94
+ /**
95
+ * Raised buttons have a box shadow that increases when clicked. This is the default style.
96
+ *
97
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#raised}
98
+ */
63
99
  raised: { type: Boolean, default: true },
100
+ /**
101
+ * Applies a large border radius on the button.
102
+ *
103
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
104
+ */
64
105
  rounded: { type: Boolean, default: false },
106
+ /**
107
+ * Removes the component’s border-radius.
108
+ *
109
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#tile}
110
+ */
65
111
  tile: { type: Boolean, default: false }
66
112
  },
113
+ /** Emits */
67
114
  emits: ["update:modelValue"],
115
+ /**
116
+ * Setup
117
+ *
118
+ * @param props - Props
119
+ * @param context - Context
120
+ */
68
121
  setup(props, context) {
69
122
  const checkedVisibilty = vueDemi.ref(false);
123
+ const selected = vueDemi.ref(props.modelValue);
70
124
  const onSwatchClick = (e) => {
71
125
  const value = e.target.value;
72
126
  if (!value || props.modelValue === value) {
73
127
  return;
74
128
  }
75
- context.emit("update:modelValue", value);
129
+ selected.value = value;
76
130
  };
131
+ vueDemi.watch(
132
+ () => selected.value,
133
+ (value) => context.emit("update:modelValue", value)
134
+ );
77
135
  return {
78
136
  checkedVisibilty,
79
137
  onSwatchClick
@@ -81,7 +139,7 @@ var VSwatches = (function (exports, vueDemi, lib, colors) {
81
139
  }
82
140
  });
83
141
 
84
- const VSwatches_vue_vue_type_style_index_0_lang = '';
142
+ /* unplugin-vue-components disabled */var VSwatches_vue_vue_type_style_index_0_lang = '';
85
143
 
86
144
  function normalizeComponent (
87
145
  scriptExports,
@@ -178,11 +236,11 @@ var VSwatches = (function (exports, vueDemi, lib, colors) {
178
236
 
179
237
  var _sfc_render = function render() {
180
238
  var _vm = this, _c = _vm._self._c; _vm._self._setupProxy;
181
- return _c("v-sheet", { staticClass: "v-swatches" }, _vm._l(_vm.swatches, function(colors, rows) {
239
+ return _c(lib.VSheet, { staticClass: "v-swatches" }, _vm._l(_vm.swatches, function(colors, rows) {
182
240
  return _c("div", { key: rows }, _vm._l(colors, function(color) {
183
- return _c("v-btn", { key: color, attrs: { "color": color, "depressed": _vm.depressed, "disabled": _vm.disabled, "elevation": _vm.elevation, "height": _vm.size, "outlined": _vm.outlined, "plain": _vm.plain, "raised": _vm.raised, "tile": _vm.tile, "value": color, "width": _vm.size, "min-width": "auto" }, on: { "click": function($event) {
241
+ return _c(lib.VBtn, { key: color, attrs: { "color": color, "depressed": _vm.depressed, "disabled": _vm.disabled, "elevation": _vm.elevation, "height": _vm.size, "outlined": _vm.outlined, "plain": _vm.plain, "raised": _vm.raised, "tile": _vm.tile, "value": color, "width": _vm.size, "min-width": "auto" }, on: { "click": function($event) {
184
242
  return _vm.onSwatchClick($event);
185
- } } }, [color === _vm.modelValue ? _c("v-icon", { attrs: { "size": _vm.iconSize, "color": color !== "transparent" ? color : void 0 } }, [_vm._v(" " + _vm._s(_vm.icon) + " ")]) : _vm._e()], 1);
243
+ } } }, [color === _vm.modelValue ? _c(lib.VIcon, { attrs: { "size": _vm.iconSize, "color": color !== "transparent" ? color : void 0 } }, [_vm._v(" " + _vm._s(_vm.icon) + " ")]) : _vm._e()], 1);
186
244
  }), 1);
187
245
  }), 0);
188
246
  };
@@ -197,18 +255,24 @@ var VSwatches = (function (exports, vueDemi, lib, colors) {
197
255
  null,
198
256
  null
199
257
  );
200
- const VSwatches = __component__.exports;
258
+ var VSwatches = __component__.exports;
259
+
260
+ const meta = {
261
+ version: "1.0.6",
262
+ date: "2023-02-04T12:13:06.676Z"
263
+ };
201
264
 
202
265
  const installVSwatches = (app) => app.component("VSwatches", VSwatches);
203
266
  if (typeof window !== "undefined" && window.Vue) {
204
267
  window.Vue.use(VSwatches);
205
268
  }
206
269
 
207
- exports.default = VSwatches;
270
+ exports.Meta = meta;
271
+ exports["default"] = VSwatches;
208
272
  exports.install = installVSwatches;
209
273
 
210
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
274
+ Object.defineProperty(exports, '__esModule', { value: true });
211
275
 
212
276
  return exports;
213
277
 
214
- })({}, VueDemi, Vuetify, colors);
278
+ })({}, Vuetify, VueDemi, colors);
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import VSwatches from '@/components/VSwatches.vue';
2
+ import Meta from '@/Meta';
3
+ const installVSwatches = (app) => app.component('VSwatches', VSwatches);
4
+ export { VSwatches as default, installVSwatches as install, Meta };
5
+ // For CDN.
6
+ // @ts-ignore
7
+ if (typeof window !== 'undefined' && window.Vue) {
8
+ // @ts-ignore
9
+ window.Vue.use(VSwatches);
10
+ }
package/dist/index.umd.js CHANGED
@@ -3,80 +3,138 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify.
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2022 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.0.4
8
+ * @version 1.0.6
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
12
  (function (global, factory) {
13
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue-demi'), require('vuetify/lib'), require('vuetify/lib/util/colors')) :
14
- typeof define === 'function' && define.amd ? define(['exports', 'vue-demi', 'vuetify/lib', 'vuetify/lib/util/colors'], factory) :
15
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VSwatches = {}, global.VueDemi, global.Vuetify, global.colors));
16
- })(this, (function (exports, vueDemi, lib, colors) { 'use strict';
13
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vuetify/lib'), require('vue-demi'), require('vuetify/lib/util/colors')) :
14
+ typeof define === 'function' && define.amd ? define(['exports', 'vuetify/lib', 'vue-demi', 'vuetify/lib/util/colors'], factory) :
15
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VSwatches = {}, global.Vuetify, global.VueDemi, global.colors));
16
+ })(this, (function (exports, lib, vueDemi, colors) { 'use strict';
17
17
 
18
- const _sfc_main = vueDemi.defineComponent({
18
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
+
20
+ var colors__default = /*#__PURE__*/_interopDefaultCompat(colors);
21
+
22
+ var _sfc_main = vueDemi.defineComponent({
23
+ /** Component name */
19
24
  name: "VSwatches",
20
- components: {
21
- VSheet: lib.VSheet,
22
- VBtn: lib.VBtn,
23
- VIcon: lib.VIcon
24
- },
25
+ /** Model Definition */
25
26
  model: {
26
27
  prop: "modelValue",
27
28
  event: "update:modelValue"
28
29
  },
29
30
  props: {
31
+ /** Model value */
30
32
  modelValue: { type: String, default: "#ffffff" },
33
+ /** Swatch colors */
31
34
  swatches: {
32
35
  type: Array,
33
36
  default: () => [
34
- [colors.shades.black, colors.shades.white, colors.shades.transparent],
37
+ [colors__default["default"].shades.black, colors__default["default"].shades.white, colors__default["default"].shades.transparent],
35
38
  [
36
- colors.red.base,
37
- colors.pink.base,
38
- colors.purple.base,
39
- colors.deepPurple.base,
40
- colors.indigo.base,
41
- colors.blue.base,
42
- colors.lightBlue.base,
43
- colors.cyan.base
39
+ colors__default["default"].red.base,
40
+ colors__default["default"].pink.base,
41
+ colors__default["default"].purple.base,
42
+ colors__default["default"].deepPurple.base,
43
+ colors__default["default"].indigo.base,
44
+ colors__default["default"].blue.base,
45
+ colors__default["default"].lightBlue.base,
46
+ colors__default["default"].cyan.base
44
47
  ],
45
48
  [
46
- colors.teal.base,
47
- colors.green.base,
48
- colors.lightGreen.base,
49
- colors.lime.base,
50
- colors.yellow.base,
51
- colors.amber.base,
52
- colors.orange.base,
53
- colors.deepOrange.base
49
+ colors__default["default"].teal.base,
50
+ colors__default["default"].green.base,
51
+ colors__default["default"].lightGreen.base,
52
+ colors__default["default"].lime.base,
53
+ colors__default["default"].yellow.base,
54
+ colors__default["default"].amber.base,
55
+ colors__default["default"].orange.base,
56
+ colors__default["default"].deepOrange.base
54
57
  ],
55
- [colors.brown.base, colors.blueGrey.base, colors.grey.base]
58
+ [colors__default["default"].brown.base, colors__default["default"].blueGrey.base, colors__default["default"].grey.base]
56
59
  ]
57
60
  },
61
+ /** Swatch sized */
58
62
  size: { type: String, default: "2rem" },
63
+ /** Selected icon */
59
64
  icon: { type: String, default: "mdi-checkbox-marked-circle" },
65
+ /** selected icon size */
60
66
  iconSize: { type: String, default: "1rem" },
67
+ /**
68
+ * Removes the button box shadow.
69
+ *
70
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#depressed}
71
+ */
61
72
  depressed: { type: Boolean, default: false },
73
+ /**
74
+ * Removes the ability to click or target the component.
75
+ *
76
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
77
+ */
62
78
  disabled: { type: Boolean, default: false },
79
+ /**
80
+ * Designates an elevation applied to the component between 0 and 24.
81
+ *
82
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
83
+ */
63
84
  elevation: { type: [Number, String], default: void 0 },
85
+ /**
86
+ * Makes the background transparent and applies a thin border.
87
+ *
88
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#outlined}
89
+ */
64
90
  outlined: { type: Boolean, default: false },
91
+ /**
92
+ * Removes the default background change applied when hovering over the button.
93
+ *
94
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#plain}
95
+ */
65
96
  plain: { type: Boolean, default: false },
97
+ /**
98
+ * Raised buttons have a box shadow that increases when clicked. This is the default style.
99
+ *
100
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#raised}
101
+ */
66
102
  raised: { type: Boolean, default: true },
103
+ /**
104
+ * Applies a large border radius on the button.
105
+ *
106
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
107
+ */
67
108
  rounded: { type: Boolean, default: false },
109
+ /**
110
+ * Removes the component’s border-radius.
111
+ *
112
+ * @see {@link https://vuetifyjs.com/en/components/buttons/#tile}
113
+ */
68
114
  tile: { type: Boolean, default: false }
69
115
  },
116
+ /** Emits */
70
117
  emits: ["update:modelValue"],
118
+ /**
119
+ * Setup
120
+ *
121
+ * @param props - Props
122
+ * @param context - Context
123
+ */
71
124
  setup(props, context) {
72
125
  const checkedVisibilty = vueDemi.ref(false);
126
+ const selected = vueDemi.ref(props.modelValue);
73
127
  const onSwatchClick = (e) => {
74
128
  const value = e.target.value;
75
129
  if (!value || props.modelValue === value) {
76
130
  return;
77
131
  }
78
- context.emit("update:modelValue", value);
132
+ selected.value = value;
79
133
  };
134
+ vueDemi.watch(
135
+ () => selected.value,
136
+ (value) => context.emit("update:modelValue", value)
137
+ );
80
138
  return {
81
139
  checkedVisibilty,
82
140
  onSwatchClick
@@ -84,7 +142,7 @@
84
142
  }
85
143
  });
86
144
 
87
- const VSwatches_vue_vue_type_style_index_0_lang = '';
145
+ /* unplugin-vue-components disabled */var VSwatches_vue_vue_type_style_index_0_lang = '';
88
146
 
89
147
  function normalizeComponent (
90
148
  scriptExports,
@@ -181,11 +239,11 @@
181
239
 
182
240
  var _sfc_render = function render() {
183
241
  var _vm = this, _c = _vm._self._c; _vm._self._setupProxy;
184
- return _c("v-sheet", { staticClass: "v-swatches" }, _vm._l(_vm.swatches, function(colors, rows) {
242
+ return _c(lib.VSheet, { staticClass: "v-swatches" }, _vm._l(_vm.swatches, function(colors, rows) {
185
243
  return _c("div", { key: rows }, _vm._l(colors, function(color) {
186
- return _c("v-btn", { key: color, attrs: { "color": color, "depressed": _vm.depressed, "disabled": _vm.disabled, "elevation": _vm.elevation, "height": _vm.size, "outlined": _vm.outlined, "plain": _vm.plain, "raised": _vm.raised, "tile": _vm.tile, "value": color, "width": _vm.size, "min-width": "auto" }, on: { "click": function($event) {
244
+ return _c(lib.VBtn, { key: color, attrs: { "color": color, "depressed": _vm.depressed, "disabled": _vm.disabled, "elevation": _vm.elevation, "height": _vm.size, "outlined": _vm.outlined, "plain": _vm.plain, "raised": _vm.raised, "tile": _vm.tile, "value": color, "width": _vm.size, "min-width": "auto" }, on: { "click": function($event) {
187
245
  return _vm.onSwatchClick($event);
188
- } } }, [color === _vm.modelValue ? _c("v-icon", { attrs: { "size": _vm.iconSize, "color": color !== "transparent" ? color : void 0 } }, [_vm._v(" " + _vm._s(_vm.icon) + " ")]) : _vm._e()], 1);
246
+ } } }, [color === _vm.modelValue ? _c(lib.VIcon, { attrs: { "size": _vm.iconSize, "color": color !== "transparent" ? color : void 0 } }, [_vm._v(" " + _vm._s(_vm.icon) + " ")]) : _vm._e()], 1);
189
247
  }), 1);
190
248
  }), 0);
191
249
  };
@@ -200,16 +258,22 @@
200
258
  null,
201
259
  null
202
260
  );
203
- const VSwatches = __component__.exports;
261
+ var VSwatches = __component__.exports;
262
+
263
+ const meta = {
264
+ version: "1.0.6",
265
+ date: "2023-02-04T12:13:06.676Z"
266
+ };
204
267
 
205
268
  const installVSwatches = (app) => app.component("VSwatches", VSwatches);
206
269
  if (typeof window !== "undefined" && window.Vue) {
207
270
  window.Vue.use(VSwatches);
208
271
  }
209
272
 
210
- exports.default = VSwatches;
273
+ exports.Meta = meta;
274
+ exports["default"] = VSwatches;
211
275
  exports.install = installVSwatches;
212
276
 
213
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
277
+ Object.defineProperty(exports, '__esModule', { value: true });
214
278
 
215
279
  }));
@@ -0,0 +1,7 @@
1
+ /** Build information meta data */
2
+ export default interface MetaInterface {
3
+ /** Version */
4
+ version: string;
5
+ /** Build date */
6
+ date: string;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/style.css CHANGED
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify.
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2022 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.0.4
8
+ * @version 1.0.6
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
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": "1.0.4",
4
+ "version": "1.0.6",
5
5
  "license": "MIT",
6
6
  "description": "Color Swatch component for Vuetify.",
7
7
  "keywords": [
@@ -54,8 +54,8 @@
54
54
  ],
55
55
  "sideEffects": false,
56
56
  "engines": {
57
- "node": ">=18.12.1",
58
- "yarn": ">=1.22.10"
57
+ "node": ">=18.13.0",
58
+ "yarn": ">=1.22.19"
59
59
  },
60
60
  "packageManager": "yarn@3.3.1",
61
61
  "scripts": {
@@ -63,12 +63,13 @@
63
63
  "clean": "rimraf node_modules/.vite",
64
64
  "type-check": "tsc --noEmit --composite false",
65
65
  "build": "run-p type-check build-only build-declaration",
66
- "build:clean": "rimraf dist",
67
- "build:analyze": "vue-tsc --noEmit && vite build --mode analyze",
68
- "build:docs": "vite build --config vite.config.docs.ts",
66
+ "build:analyze": "vite build --mode=analyze",
67
+ "build:clean": "rimraf dist docs",
68
+ "build:docs": "vite build --mode=docs",
69
69
  "build-only": "vite build",
70
- "build-declaration": "tsc -p tsconfig.app.json --composite false --declaration --declarationMap --declarationDir dist",
70
+ "build-declaration": "tsc -p tsconfig.app.json --composite false",
71
71
  "lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
72
+ "preview": "vite preview --mode=docs",
72
73
  "prepare": "husky install",
73
74
  "version": "auto-changelog -p && git add CHANGELOG.md"
74
75
  },
@@ -76,9 +77,9 @@
76
77
  "vue-demi": "latest"
77
78
  },
78
79
  "peerDependencies": {
79
- "@vue/composition-api": "^1.7.0",
80
+ "@vue/composition-api": "^1.7.1",
80
81
  "vue": "^2.6.14 || <3",
81
- "vuetify": "^2.6.12"
82
+ "vuetify": "^2.6.14"
82
83
  },
83
84
  "peerDependenciesMeta": {
84
85
  "@vue/composition-api": {
@@ -86,47 +87,48 @@
86
87
  }
87
88
  },
88
89
  "devDependencies": {
89
- "@codemirror/lang-html": "^6.4.0",
90
+ "@codemirror/lang-html": "6.1.0",
90
91
  "@types/lodash": "^4.14.191",
91
92
  "@types/node": "^18.11.18",
92
- "@typescript-eslint/eslint-plugin": "^5.47.1",
93
- "@typescript-eslint/parser": "^5.47.1",
93
+ "@typescript-eslint/eslint-plugin": "^5.50.0",
94
+ "@typescript-eslint/parser": "^5.50.0",
94
95
  "@vitejs/plugin-vue2": "^2.2.0",
95
96
  "@vue/eslint-config-prettier": "^7.0.0",
96
97
  "@vue/tsconfig": "^0.1.3",
97
- "codemirror": "^6.0.1",
98
- "eslint": "^8.30.0",
98
+ "eslint": "^8.33.0",
99
99
  "eslint-config-google": "^0.14.0",
100
- "eslint-config-prettier": "^8.5.0",
100
+ "eslint-config-prettier": "^8.6.0",
101
101
  "eslint-import-resolver-alias": "^1.1.2",
102
- "eslint-import-resolver-typescript": "^3.5.2",
103
- "eslint-plugin-import": "^2.26.0",
104
- "eslint-plugin-jsdoc": "^39.6.4",
102
+ "eslint-import-resolver-typescript": "^3.5.3",
103
+ "eslint-plugin-import": "^2.27.5",
104
+ "eslint-plugin-jsdoc": "^39.8.0",
105
+ "eslint-plugin-prettier": "^4.2.1",
105
106
  "eslint-plugin-tsdoc": "^0.2.17",
106
- "eslint-plugin-vue": "^9.8.0",
107
- "eslint-plugin-vuejs-accessibility": "^2.0.0",
107
+ "eslint-plugin-vue": "^9.9.0",
108
+ "eslint-plugin-vuejs-accessibility": "^2.1.0",
108
109
  "eslint-plugin-vuetify": "^1.1.0",
109
- "husky": "^8.0.2",
110
+ "husky": "^8.0.3",
110
111
  "lint-staged": "^13.1.0",
112
+ "npm-run-all": "^4.1.5",
111
113
  "postcss-html": "^1.5.0",
112
- "prettier": "^2.8.1",
113
- "rimraf": "^3.0.2",
114
- "rollup-plugin-visualizer": "^5.8.3",
114
+ "prettier": "^2.8.3",
115
+ "rimraf": "^4.1.2",
116
+ "rollup-plugin-visualizer": "^5.9.0",
115
117
  "sass": "1.32.12",
116
118
  "stylelint": "^14.16.1",
117
119
  "stylelint-config-prettier": "^9.0.4",
118
120
  "stylelint-config-recommended-scss": "^8.0.0",
119
121
  "stylelint-config-recommended-vue": "^1.4.0",
120
- "typescript": "^4.9.4",
121
- "unplugin-vue-components": "^0.22.12",
122
- "vite": "^4.0.3",
122
+ "typescript": "^4.9.5",
123
+ "unplugin-vue-components": "^0.23.0",
124
+ "vite": "^4.1.1",
123
125
  "vite-plugin-banner": "^0.7.0",
124
- "vite-plugin-checker": "^0.5.3",
126
+ "vite-plugin-checker": "^0.5.5",
125
127
  "vue": "^2.7.13",
126
- "vue-codemirror6": "^1.1.2",
128
+ "vue-codemirror6": "^1.1.10",
127
129
  "vue-eslint-parser": "^9.1.0",
128
- "vue-tsc": "^1.0.18",
129
- "vuetify": "^2.6.13"
130
+ "vue-tsc": "^1.0.24",
131
+ "vuetify": "^2.6.14"
130
132
  },
131
133
  "husky": {
132
134
  "hooks": {
@@ -134,12 +136,11 @@
134
136
  }
135
137
  },
136
138
  "lint-staged": {
137
- "*.vue": "vue-tsc --noEmit",
138
139
  "*.{js,ts,json,yml,yaml,vue,htm,html}": "eslint --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint",
139
140
  "*.{css,sass,scss,vue,htm,html}": "stylelint --fix --cache --cache-location ./node_modules/.vite/vite-plugin-stylelint",
140
141
  "*": "prettier -w -u"
141
142
  },
142
143
  "resolutions": {
143
- "prettier": "^2.7.1"
144
+ "json5": "^2.2.3"
144
145
  }
145
146
  }
@@ -34,24 +34,18 @@
34
34
  import {
35
35
  defineComponent,
36
36
  ref,
37
+ watch,
37
38
  type PropType,
38
39
  type Ref,
39
40
  type SetupContext,
40
41
  } from 'vue-demi';
41
42
 
42
- import { VSheet, VIcon, VBtn } from 'vuetify/lib';
43
43
  import colors from 'vuetify/lib/util/colors';
44
44
 
45
45
  /** Vuetify Swatches */
46
46
  export default defineComponent({
47
47
  /** Component name */
48
48
  name: 'VSwatches',
49
- /** Components */
50
- components: {
51
- VSheet,
52
- VBtn,
53
- VIcon,
54
- },
55
49
  /** Model Definition */
56
50
  model: {
57
51
  prop: 'modelValue',
@@ -155,19 +149,27 @@ export default defineComponent({
155
149
  /** Check icon visibility */
156
150
  const checkedVisibilty: Ref<boolean> = ref(false);
157
151
 
152
+ /** Selected Color */
153
+ const selected: Ref<string> = ref(props.modelValue);
154
+
158
155
  /**
159
156
  * Swatch button clicked handler
160
157
  *
161
158
  * @param e - Event
162
159
  */
163
- const onSwatchClick = (e: Event) => {
160
+ const onSwatchClick = (e: PointerEvent) => {
164
161
  const value = (e.target as HTMLButtonElement).value;
165
162
  if (!value || props.modelValue === value) {
166
163
  return;
167
164
  }
168
- context.emit('update:modelValue', value);
165
+ selected.value = value;
169
166
  };
170
167
 
168
+ watch(
169
+ () => selected.value,
170
+ value => context.emit('update:modelValue', value)
171
+ );
172
+
171
173
  return {
172
174
  checkedVisibilty,
173
175
  onSwatchClick,
@@ -1 +0,0 @@
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"}