vuetify-swatches 1.3.4 → 1.3.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,4 @@
1
+ import type MetaInterface from '@/interfaces/MetaInterface';
2
+ declare const meta: MetaInterface;
3
+ export default meta;
4
+ //# sourceMappingURL=Meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Meta.d.ts","sourceRoot":"","sources":["../src/Meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAC;AAG5D,QAAA,MAAM,IAAI,EAAE,aAGX,CAAC;AACF,eAAe,IAAI,CAAC"}
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:14:21.684Z',
5
+ };
6
+ export default meta;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import VSwatches from '@/components/VSwatches.vue';
2
- declare const installVSwatches: (app: any) => any;
3
- 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 };
4
4
  //# sourceMappingURL=index.d.ts.map
package/dist/index.es.js CHANGED
@@ -3,19 +3,21 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify3.
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.3.4
8
+ * @version 1.3.6
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
12
  import { defineComponent, ref, watch, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, normalizeClass, unref, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
13
13
  import colors from 'vuetify/lib/util/colors.mjs';
14
14
 
15
- const _sfc_main = /* @__PURE__ */ defineComponent({
15
+ var _sfc_main = /* @__PURE__ */ defineComponent({
16
16
  __name: "VSwatches",
17
17
  props: {
18
+ /** Model value */
18
19
  modelValue: { type: String, default: colors.shades.white },
20
+ /** Swatch colors */
19
21
  swatches: {
20
22
  type: Array,
21
23
  default: () => [
@@ -43,30 +45,55 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43
45
  [colors.brown.base, colors.blueGrey.base, colors.grey.base]
44
46
  ]
45
47
  },
48
+ /** Swatch size */
46
49
  size: { type: String, default: "2rem" },
50
+ /** Selected icon */
47
51
  icon: { type: String, default: "mdi-checkbox-marked-circle" },
52
+ /** selected icon size */
48
53
  iconSize: { type: String, default: "1rem" },
54
+ /**
55
+ * The variant prop gives you easy access to several different button styles..
56
+ *
57
+ * @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
58
+ */
49
59
  variant: {
50
60
  type: String,
51
61
  default: void 0
52
62
  },
63
+ /**
64
+ * Removes the ability to click or target the component.
65
+ *
66
+ * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
67
+ */
53
68
  disabled: { type: Boolean, default: void 0 },
69
+ /**
70
+ * Applies a large border radius on the button.
71
+ *
72
+ * @see {@link https://next.vuetifyjs.com/en/components/buttons/#rounded}
73
+ */
54
74
  rounded: { type: [String, Number, Boolean], default: void 0 },
75
+ /**
76
+ * Applies border styles to component.
77
+ *
78
+ * @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-border}
79
+ */
55
80
  border: { type: [String, Number, Boolean], default: false },
81
+ /**
82
+ * Designates an elevation applied to the component between 0 and 24.
83
+ *
84
+ * @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-elevation}
85
+ */
56
86
  elevation: { type: [String, Number], default: void 0 }
57
87
  },
58
88
  emits: ["update:modelValue"],
59
- setup(__props, { emit }) {
89
+ setup(__props, { emit: emits }) {
60
90
  const props = __props;
61
- const selected = ref(props.modelValue);
62
- const onSwatchClick = (e) => {
63
- const value = e.target.dataset.value;
64
- if (!value || props.modelValue === value) {
65
- return;
66
- }
67
- emit("update:modelValue", value);
68
- };
69
- watch(selected, (value) => void 0);
91
+ const selected = ref(props.modelValue || colors.shades.white);
92
+ const onSwatchClick = (e) => selected.value = e.target.dataset.value || colors.shades.white;
93
+ watch(
94
+ () => selected.value,
95
+ (s) => emits("update:modelValue", s)
96
+ );
70
97
  return (_ctx, _cache) => {
71
98
  const _component_v_icon = resolveComponent("v-icon");
72
99
  const _component_v_btn = resolveComponent("v-btn");
@@ -114,7 +141,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
114
141
  }
115
142
  });
116
143
 
117
- const VSwatches_vue_vue_type_style_index_0_lang = '';
144
+ var VSwatches_vue_vue_type_style_index_0_lang = '';
118
145
 
119
146
  const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
120
147
  if (typeof window !== "undefined" && window.Vue) {
@@ -3,74 +3,101 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify3.
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.3.4
8
+ * @version 1.3.6
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
12
  var VSwatches = (function (exports, vue, colors) {
13
13
  'use strict';
14
14
 
15
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
15
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
16
 
17
- const colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
17
+ var colors__default = /*#__PURE__*/_interopDefaultCompat(colors);
18
18
 
19
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
19
+ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
20
20
  __name: "VSwatches",
21
21
  props: {
22
- modelValue: { type: String, default: colors__default.default.shades.white },
22
+ /** Model value */
23
+ modelValue: { type: String, default: colors__default["default"].shades.white },
24
+ /** Swatch colors */
23
25
  swatches: {
24
26
  type: Array,
25
27
  default: () => [
26
- [colors__default.default.shades.black, colors__default.default.shades.white, colors__default.default.shades.transparent],
28
+ [colors__default["default"].shades.black, colors__default["default"].shades.white, colors__default["default"].shades.transparent],
27
29
  [
28
- colors__default.default.red.base,
29
- colors__default.default.pink.base,
30
- colors__default.default.purple.base,
31
- colors__default.default.deepPurple.base,
32
- colors__default.default.indigo.base,
33
- colors__default.default.blue.base,
34
- colors__default.default.lightBlue.base,
35
- colors__default.default.cyan.base
30
+ colors__default["default"].red.base,
31
+ colors__default["default"].pink.base,
32
+ colors__default["default"].purple.base,
33
+ colors__default["default"].deepPurple.base,
34
+ colors__default["default"].indigo.base,
35
+ colors__default["default"].blue.base,
36
+ colors__default["default"].lightBlue.base,
37
+ colors__default["default"].cyan.base
36
38
  ],
37
39
  [
38
- colors__default.default.teal.base,
39
- colors__default.default.green.base,
40
- colors__default.default.lightGreen.base,
41
- colors__default.default.lime.base,
42
- colors__default.default.yellow.base,
43
- colors__default.default.amber.base,
44
- colors__default.default.orange.base,
45
- colors__default.default.deepOrange.base
40
+ colors__default["default"].teal.base,
41
+ colors__default["default"].green.base,
42
+ colors__default["default"].lightGreen.base,
43
+ colors__default["default"].lime.base,
44
+ colors__default["default"].yellow.base,
45
+ colors__default["default"].amber.base,
46
+ colors__default["default"].orange.base,
47
+ colors__default["default"].deepOrange.base
46
48
  ],
47
- [colors__default.default.brown.base, colors__default.default.blueGrey.base, colors__default.default.grey.base]
49
+ [colors__default["default"].brown.base, colors__default["default"].blueGrey.base, colors__default["default"].grey.base]
48
50
  ]
49
51
  },
52
+ /** Swatch size */
50
53
  size: { type: String, default: "2rem" },
54
+ /** Selected icon */
51
55
  icon: { type: String, default: "mdi-checkbox-marked-circle" },
56
+ /** selected icon size */
52
57
  iconSize: { type: String, default: "1rem" },
58
+ /**
59
+ * The variant prop gives you easy access to several different button styles..
60
+ *
61
+ * @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
62
+ */
53
63
  variant: {
54
64
  type: String,
55
65
  default: void 0
56
66
  },
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
+ */
57
72
  disabled: { type: Boolean, default: void 0 },
73
+ /**
74
+ * Applies a large border radius on the button.
75
+ *
76
+ * @see {@link https://next.vuetifyjs.com/en/components/buttons/#rounded}
77
+ */
58
78
  rounded: { type: [String, Number, Boolean], default: void 0 },
79
+ /**
80
+ * Applies border styles to component.
81
+ *
82
+ * @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-border}
83
+ */
59
84
  border: { type: [String, Number, Boolean], default: false },
85
+ /**
86
+ * Designates an elevation applied to the component between 0 and 24.
87
+ *
88
+ * @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-elevation}
89
+ */
60
90
  elevation: { type: [String, Number], default: void 0 }
61
91
  },
62
92
  emits: ["update:modelValue"],
63
- setup(__props, { emit }) {
93
+ setup(__props, { emit: emits }) {
64
94
  const props = __props;
65
- const selected = vue.ref(props.modelValue);
66
- const onSwatchClick = (e) => {
67
- const value = e.target.dataset.value;
68
- if (!value || props.modelValue === value) {
69
- return;
70
- }
71
- emit("update:modelValue", value);
72
- };
73
- vue.watch(selected, (value) => void 0);
95
+ const selected = vue.ref(props.modelValue || colors__default["default"].shades.white);
96
+ const onSwatchClick = (e) => selected.value = e.target.dataset.value || colors__default["default"].shades.white;
97
+ vue.watch(
98
+ () => selected.value,
99
+ (s) => emits("update:modelValue", s)
100
+ );
74
101
  return (_ctx, _cache) => {
75
102
  const _component_v_icon = vue.resolveComponent("v-icon");
76
103
  const _component_v_btn = vue.resolveComponent("v-btn");
@@ -83,7 +110,7 @@ var VSwatches = (function (exports, vue, colors) {
83
110
  return vue.openBlock(), vue.createBlock(_component_v_btn, {
84
111
  key: color,
85
112
  border: props.border,
86
- class: vue.normalizeClass(color === vue.unref(colors__default.default).shades.transparent ? "bg-trasparent" : ""),
113
+ class: vue.normalizeClass(color === vue.unref(colors__default["default"]).shades.transparent ? "bg-trasparent" : ""),
87
114
  color,
88
115
  disabled: props.disabled,
89
116
  elevation: props.elevation,
@@ -98,7 +125,7 @@ var VSwatches = (function (exports, vue, colors) {
98
125
  color === __props.modelValue ? (vue.openBlock(), vue.createBlock(_component_v_icon, {
99
126
  key: 0,
100
127
  size: __props.iconSize,
101
- color: color !== vue.unref(colors__default.default).shades.transparent ? color : void 0
128
+ color: color !== vue.unref(colors__default["default"]).shades.transparent ? color : void 0
102
129
  }, {
103
130
  default: vue.withCtx(() => [
104
131
  vue.createTextVNode(vue.toDisplayString(props.icon), 1)
@@ -118,17 +145,17 @@ var VSwatches = (function (exports, vue, colors) {
118
145
  }
119
146
  });
120
147
 
121
- const VSwatches_vue_vue_type_style_index_0_lang = '';
148
+ var VSwatches_vue_vue_type_style_index_0_lang = '';
122
149
 
123
150
  const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
124
151
  if (typeof window !== "undefined" && window.Vue) {
125
152
  window.Vue.use(_sfc_main);
126
153
  }
127
154
 
128
- exports.default = _sfc_main;
155
+ exports["default"] = _sfc_main;
129
156
  exports.install = installVSwatches;
130
157
 
131
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
158
+ Object.defineProperty(exports, '__esModule', { value: true });
132
159
 
133
160
  return exports;
134
161
 
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ import VSwatches from '@/components/VSwatches.vue';
2
+ const installVSwatches = (app) => app.component('VSwatches', VSwatches);
3
+ export { VSwatches as default, installVSwatches as install };
4
+ // For CDN.
5
+ // @ts-ignore
6
+ if (typeof window !== 'undefined' && window.Vue) {
7
+ // @ts-ignore
8
+ window.Vue.use(VSwatches);
9
+ }
package/dist/index.umd.js CHANGED
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify3.
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.3.4
8
+ * @version 1.3.6
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
@@ -15,65 +15,92 @@
15
15
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VSwatches = {}, global.Vue, global.colors));
16
16
  })(this, (function (exports, vue, colors) { 'use strict';
17
17
 
18
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
18
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
19
 
20
- const colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
20
+ var colors__default = /*#__PURE__*/_interopDefaultCompat(colors);
21
21
 
22
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22
+ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
23
23
  __name: "VSwatches",
24
24
  props: {
25
- modelValue: { type: String, default: colors__default.default.shades.white },
25
+ /** Model value */
26
+ modelValue: { type: String, default: colors__default["default"].shades.white },
27
+ /** Swatch colors */
26
28
  swatches: {
27
29
  type: Array,
28
30
  default: () => [
29
- [colors__default.default.shades.black, colors__default.default.shades.white, colors__default.default.shades.transparent],
31
+ [colors__default["default"].shades.black, colors__default["default"].shades.white, colors__default["default"].shades.transparent],
30
32
  [
31
- colors__default.default.red.base,
32
- colors__default.default.pink.base,
33
- colors__default.default.purple.base,
34
- colors__default.default.deepPurple.base,
35
- colors__default.default.indigo.base,
36
- colors__default.default.blue.base,
37
- colors__default.default.lightBlue.base,
38
- colors__default.default.cyan.base
33
+ colors__default["default"].red.base,
34
+ colors__default["default"].pink.base,
35
+ colors__default["default"].purple.base,
36
+ colors__default["default"].deepPurple.base,
37
+ colors__default["default"].indigo.base,
38
+ colors__default["default"].blue.base,
39
+ colors__default["default"].lightBlue.base,
40
+ colors__default["default"].cyan.base
39
41
  ],
40
42
  [
41
- colors__default.default.teal.base,
42
- colors__default.default.green.base,
43
- colors__default.default.lightGreen.base,
44
- colors__default.default.lime.base,
45
- colors__default.default.yellow.base,
46
- colors__default.default.amber.base,
47
- colors__default.default.orange.base,
48
- colors__default.default.deepOrange.base
43
+ colors__default["default"].teal.base,
44
+ colors__default["default"].green.base,
45
+ colors__default["default"].lightGreen.base,
46
+ colors__default["default"].lime.base,
47
+ colors__default["default"].yellow.base,
48
+ colors__default["default"].amber.base,
49
+ colors__default["default"].orange.base,
50
+ colors__default["default"].deepOrange.base
49
51
  ],
50
- [colors__default.default.brown.base, colors__default.default.blueGrey.base, colors__default.default.grey.base]
52
+ [colors__default["default"].brown.base, colors__default["default"].blueGrey.base, colors__default["default"].grey.base]
51
53
  ]
52
54
  },
55
+ /** Swatch size */
53
56
  size: { type: String, default: "2rem" },
57
+ /** Selected icon */
54
58
  icon: { type: String, default: "mdi-checkbox-marked-circle" },
59
+ /** selected icon size */
55
60
  iconSize: { type: String, default: "1rem" },
61
+ /**
62
+ * The variant prop gives you easy access to several different button styles..
63
+ *
64
+ * @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
65
+ */
56
66
  variant: {
57
67
  type: String,
58
68
  default: void 0
59
69
  },
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
+ */
60
75
  disabled: { type: Boolean, default: void 0 },
76
+ /**
77
+ * Applies a large border radius on the button.
78
+ *
79
+ * @see {@link https://next.vuetifyjs.com/en/components/buttons/#rounded}
80
+ */
61
81
  rounded: { type: [String, Number, Boolean], default: void 0 },
82
+ /**
83
+ * Applies border styles to component.
84
+ *
85
+ * @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-border}
86
+ */
62
87
  border: { type: [String, Number, Boolean], default: false },
88
+ /**
89
+ * Designates an elevation applied to the component between 0 and 24.
90
+ *
91
+ * @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-elevation}
92
+ */
63
93
  elevation: { type: [String, Number], default: void 0 }
64
94
  },
65
95
  emits: ["update:modelValue"],
66
- setup(__props, { emit }) {
96
+ setup(__props, { emit: emits }) {
67
97
  const props = __props;
68
- const selected = vue.ref(props.modelValue);
69
- const onSwatchClick = (e) => {
70
- const value = e.target.dataset.value;
71
- if (!value || props.modelValue === value) {
72
- return;
73
- }
74
- emit("update:modelValue", value);
75
- };
76
- vue.watch(selected, (value) => void 0);
98
+ const selected = vue.ref(props.modelValue || colors__default["default"].shades.white);
99
+ const onSwatchClick = (e) => selected.value = e.target.dataset.value || colors__default["default"].shades.white;
100
+ vue.watch(
101
+ () => selected.value,
102
+ (s) => emits("update:modelValue", s)
103
+ );
77
104
  return (_ctx, _cache) => {
78
105
  const _component_v_icon = vue.resolveComponent("v-icon");
79
106
  const _component_v_btn = vue.resolveComponent("v-btn");
@@ -86,7 +113,7 @@
86
113
  return vue.openBlock(), vue.createBlock(_component_v_btn, {
87
114
  key: color,
88
115
  border: props.border,
89
- class: vue.normalizeClass(color === vue.unref(colors__default.default).shades.transparent ? "bg-trasparent" : ""),
116
+ class: vue.normalizeClass(color === vue.unref(colors__default["default"]).shades.transparent ? "bg-trasparent" : ""),
90
117
  color,
91
118
  disabled: props.disabled,
92
119
  elevation: props.elevation,
@@ -101,7 +128,7 @@
101
128
  color === __props.modelValue ? (vue.openBlock(), vue.createBlock(_component_v_icon, {
102
129
  key: 0,
103
130
  size: __props.iconSize,
104
- color: color !== vue.unref(colors__default.default).shades.transparent ? color : void 0
131
+ color: color !== vue.unref(colors__default["default"]).shades.transparent ? color : void 0
105
132
  }, {
106
133
  default: vue.withCtx(() => [
107
134
  vue.createTextVNode(vue.toDisplayString(props.icon), 1)
@@ -121,16 +148,16 @@
121
148
  }
122
149
  });
123
150
 
124
- const VSwatches_vue_vue_type_style_index_0_lang = '';
151
+ var VSwatches_vue_vue_type_style_index_0_lang = '';
125
152
 
126
153
  const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
127
154
  if (typeof window !== "undefined" && window.Vue) {
128
155
  window.Vue.use(_sfc_main);
129
156
  }
130
157
 
131
- exports.default = _sfc_main;
158
+ exports["default"] = _sfc_main;
132
159
  exports.install = installVSwatches;
133
160
 
134
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
161
+ Object.defineProperty(exports, '__esModule', { value: true });
135
162
 
136
163
  }));
@@ -0,0 +1,8 @@
1
+ /** Build information meta data */
2
+ export default interface MetaInterface {
3
+ /** Version */
4
+ version: string;
5
+ /** Build date */
6
+ date: string;
7
+ }
8
+ //# sourceMappingURL=MetaInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetaInterface.d.ts","sourceRoot":"","sources":["../../src/interfaces/MetaInterface.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,MAAM,CAAC,OAAO,WAAW,aAAa;IACpC,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1 @@
1
+ export {};
package/dist/style.css CHANGED
@@ -3,22 +3,23 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify3.
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.3.4
8
+ * @version 1.3.6
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- .v-swatches .v-btn {
12
+ /** if false, disabled buttons will be greyed out */
13
+ .v-swatches div .v-btn {
13
14
  padding: 0 !important;
14
15
  margin: 0.1rem;
15
16
  }
16
- .v-swatches .v-btn .v-icon {
17
+ .v-swatches div .v-btn .v-icon {
17
18
  filter: invert(100%) grayscale(100%) contrast(100);
18
19
  }
19
- .v-swatches .v-btn.bg-trasparent {
20
+ .v-swatches div .v-btn.bg-trasparent {
20
21
  background: linear-gradient(to top left, transparent 0, transparent calc(50% - 0.1rem), #F44336 50%, transparent calc(50% + 0.1rem), transparent);
21
22
  }
22
- .v-swatches .v-btn.bg-trasparent .v-icon {
23
+ .v-swatches div .v-btn.bg-trasparent .v-icon {
23
24
  filter: none;
24
25
  }
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.3.4",
4
+ "version": "1.3.6",
5
5
  "description": "Color Swatch component for Vuetify3.",
6
6
  "keywords": [
7
7
  "vuejs",
@@ -56,73 +56,74 @@
56
56
  ],
57
57
  "engines": {
58
58
  "node": ">=18.12.1",
59
- "yarn": ">=1.22.10"
59
+ "yarn": ">=1.22.19"
60
60
  },
61
- "packageManager": "yarn@3.3.0",
61
+ "packageManager": "yarn@3.3.1",
62
62
  "sideEffects": false,
63
63
  "scripts": {
64
64
  "dev": "vite",
65
- "clean": "rimraf node_modules/.vite ",
66
- "type-check": "vue-tsc --noEmit --composite false",
67
- "lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . -w -u",
68
- "lint:style": "stylelint \"./**/*.{css,sass,scss,htm,html,vue}\" --fix --cache-location ./node_modules/.vite/vite-plugin-stylelint && prettier \"./**/*.{css,sass,scss,htm,html,vue}\" -w -u",
65
+ "clean": "rimraf node_modules/.vite",
66
+ "type-check": "tsc --noEmit --composite false",
69
67
  "build": "run-p type-check build-only build-declaration",
70
- "build:analyze": "vite build --mode analyze",
71
- "build:clean": "rimraf dist",
72
- "build:docs": "vite build --config vite.config.docs.ts",
68
+ "build:analyze": "vite build --mode=analyze",
69
+ "build:clean": "rimraf dist docs",
70
+ "build:docs": "vite build --mode=docs",
73
71
  "build-only": "vite build",
74
- "build-declaration": "vue-tsc --composite false --declaration --emitDeclarationOnly --declarationDir ./dist",
75
- "preview": "vite preview --config vite.config.docs.ts",
76
- "prepare": "husky install"
72
+ "build-declaration": "tsc -p tsconfig.app.json --composite false --declaration --declarationMap",
73
+ "lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
74
+ "preview": "vite preview --mode=docs",
75
+ "prepare": "husky install",
76
+ "version": "auto-changelog -p && git add CHANGELOG.md"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "vue": "^3.2.45",
80
- "vuetify": "^3.0.0"
80
+ "vuetify": "^3.1.3"
81
81
  },
82
82
  "devDependencies": {
83
- "@codemirror/lang-html": "^6.4.0",
84
- "@types/node": "^18.11.11",
85
- "@typescript-eslint/eslint-plugin": "^5.45.1",
86
- "@typescript-eslint/parser": "^5.45.1",
87
- "@vitejs/plugin-vue": "^3.2.0",
83
+ "@codemirror/lang-html": "6.1.0",
84
+ "@types/node": "^18.11.18",
85
+ "@typescript-eslint/eslint-plugin": "^5.50.0",
86
+ "@typescript-eslint/parser": "^5.50.0",
87
+ "@vitejs/plugin-vue": "^4.0.0",
88
88
  "@vue/eslint-config-prettier": "^7.0.0",
89
89
  "@vue/tsconfig": "^0.1.3",
90
- "codemirror": "^6.0.1",
91
- "eslint": "^8.29.0",
90
+ "eslint": "^8.33.0",
92
91
  "eslint-config-google": "^0.14.0",
93
- "eslint-config-prettier": "^8.5.0",
92
+ "eslint-config-prettier": "^8.6.0",
94
93
  "eslint-import-resolver-alias": "^1.1.2",
95
- "eslint-import-resolver-typescript": "^3.5.2",
96
- "eslint-plugin-import": "^2.26.0",
97
- "eslint-plugin-jsdoc": "^39.6.4",
94
+ "eslint-import-resolver-typescript": "^3.5.3",
95
+ "eslint-plugin-import": "^2.27.5",
96
+ "eslint-plugin-jsdoc": "^39.8.0",
97
+ "eslint-plugin-prettier": "^4.2.1",
98
98
  "eslint-plugin-tsdoc": "^0.2.17",
99
- "eslint-plugin-vue": "^9.8.0",
100
- "eslint-plugin-vuejs-accessibility": "^2.0.0",
99
+ "eslint-plugin-vue": "^9.9.0",
100
+ "eslint-plugin-vuejs-accessibility": "^2.1.0",
101
101
  "eslint-plugin-vuetify": "^2.0.0-beta.2",
102
102
  "eslint-plugin-yaml": "^0.5.0",
103
- "husky": "^8.0.2",
103
+ "husky": "^8.0.3",
104
104
  "lint-staged": "^13.1.0",
105
105
  "npm-run-all": "^4.1.5",
106
106
  "postcss-html": "^1.5.0",
107
- "prettier": "^2.8.1",
108
- "rimraf": "^3.0.2",
109
- "rollup-plugin-visualizer": "^5.8.3",
110
- "sass": "1.56.1",
111
- "stylelint": "^14.16.0",
107
+ "prettier": "^2.8.3",
108
+ "rimraf": "^4.1.2",
109
+ "rollup-plugin-visualizer": "^5.9.0",
110
+ "sass": "^1.58.0",
111
+ "sass-loader": "^13.2.0",
112
+ "stylelint": "^14.16.1",
112
113
  "stylelint-config-prettier": "^9.0.4",
113
114
  "stylelint-config-recommended-scss": "^8.0.0",
114
115
  "stylelint-config-recommended-vue": "^1.4.0",
115
- "stylelint-order": "^5.0.0",
116
+ "stylelint-order": "^6.0.1",
116
117
  "stylelint-prettier": "^2.0.0",
117
- "typescript": "^4.9.4",
118
- "vite": "^3.2.5",
119
- "vite-plugin-banner": "^0.6.1",
120
- "vite-plugin-checker": "^0.5.1",
121
- "vite-plugin-vuetify": "^1.0.0",
122
- "vue": "^3.2.45",
123
- "vue-codemirror6": "1.1.1",
118
+ "typescript": "^4.9.5",
119
+ "vite": "^4.1.1",
120
+ "vite-plugin-banner": "^0.7.0",
121
+ "vite-plugin-checker": "^0.5.5",
122
+ "vite-plugin-vuetify": "^1.0.2",
123
+ "vue": "^3.2.47",
124
+ "vue-codemirror6": "1.1.10",
124
125
  "vue-eslint-parser": "^9.1.0",
125
- "vue-tsc": "^1.0.11",
126
+ "vue-tsc": "^1.0.24",
126
127
  "vuetify": "^3.0.4"
127
128
  },
128
129
  "husky": {
@@ -131,12 +132,11 @@
131
132
  }
132
133
  },
133
134
  "lint-staged": {
134
- "*.vue": "vue-tsc --noEmit",
135
135
  "*.{js,ts,json,yml,yaml,vue,htm,html}": "eslint --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint",
136
136
  "*.{css,sass,scss,vue,htm,html}": "stylelint --fix --cache --cache-location ./node_modules/.vite/vite-plugin-stylelint",
137
137
  "*": "prettier -w -u"
138
138
  },
139
139
  "resolutions": {
140
- "prettier": "^2.8.1"
140
+ "json5": "^2.2.3"
141
141
  }
142
142
  }
@@ -3,6 +3,11 @@
3
3
  import { ref, watch, type PropType, type Ref } from 'vue';
4
4
  import colors from 'vuetify/lib/util/colors.mjs';
5
5
 
6
+ /** Emits */
7
+ const emits = defineEmits<{
8
+ (event: 'update:modelValue', value: string): void;
9
+ }>();
10
+
6
11
  /** Props */
7
12
  const props = defineProps({
8
13
  /** Model value */
@@ -78,26 +83,22 @@ const props = defineProps({
78
83
  elevation: { type: [String, Number], default: undefined },
79
84
  });
80
85
 
81
- /** Emits */
82
- const emit = defineEmits(['update:modelValue']);
83
-
84
- const selected: Ref<string | undefined> = ref(props.modelValue);
86
+ /** Selected Color */
87
+ const selected: Ref<string> = ref(props.modelValue || colors.shades.white);
85
88
 
86
89
  /**
87
90
  * Swatch button clicked handler
88
91
  *
89
92
  * @param e - Event
90
93
  */
91
- const onSwatchClick = (e: Event) => {
92
- console.log(e.target);
93
- const value = (e.target as HTMLButtonElement).dataset.value;
94
- if (!value || props.modelValue === value) {
95
- return;
96
- }
97
- emit('update:modelValue', value);
98
- };
94
+ const onSwatchClick = (e: Event) =>
95
+ (selected.value =
96
+ (e.target as HTMLButtonElement).dataset.value || colors.shades.white);
99
97
 
100
- watch(selected, value => console.log(value));
98
+ watch(
99
+ () => selected.value,
100
+ s => emits('update:modelValue', s)
101
+ );
101
102
  </script>
102
103
 
103
104
  <template>
@@ -131,28 +132,30 @@ watch(selected, value => console.log(value));
131
132
  </template>
132
133
 
133
134
  <style lang="scss">
134
- @import '~/vuetify/lib/styles/settings';
135
+ @use 'vuetify/settings';
135
136
 
136
137
  .v-swatches {
137
- .v-btn {
138
- padding: 0 !important;
139
- margin: 0.1rem;
138
+ div {
139
+ .v-btn {
140
+ padding: 0 !important;
141
+ margin: 0.1rem;
140
142
 
141
- .v-icon {
142
- filter: invert(100%) grayscale(100%) contrast(100);
143
- }
144
-
145
- &.bg-trasparent {
146
- background: linear-gradient(
147
- to top left,
148
- transparent 0,
149
- transparent calc(50% - 0.1rem),
150
- map-get($red, 'base') 50%,
151
- transparent calc(50% + 0.1rem),
152
- transparent
153
- );
154
143
  .v-icon {
155
- filter: none;
144
+ filter: invert(100%) grayscale(100%) contrast(100);
145
+ }
146
+
147
+ &.bg-trasparent {
148
+ background: linear-gradient(
149
+ to top left,
150
+ transparent 0,
151
+ transparent calc(50% - 0.1rem),
152
+ map-get(settings.$red, 'base') 50%,
153
+ transparent calc(50% + 0.1rem),
154
+ transparent
155
+ );
156
+ .v-icon {
157
+ filter: none;
158
+ }
156
159
  }
157
160
  }
158
161
  }
@@ -1,160 +0,0 @@
1
- /** Vuetify Swatches */
2
- import { type PropType } from 'vue';
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
- /** Swatch size */
15
- size: {
16
- type: StringConstructor;
17
- default: string;
18
- };
19
- /** Selected icon */
20
- icon: {
21
- type: StringConstructor;
22
- default: string;
23
- };
24
- /** selected icon size */
25
- iconSize: {
26
- type: StringConstructor;
27
- default: string;
28
- };
29
- /**
30
- * The variant prop gives you easy access to several different button styles..
31
- *
32
- * @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
33
- */
34
- variant: {
35
- type: PropType<"flat" | "text" | "elevated" | "tonal" | "outlined" | "plain">;
36
- default: undefined;
37
- };
38
- /**
39
- * Removes the ability to click or target the component.
40
- *
41
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
42
- */
43
- disabled: {
44
- type: BooleanConstructor;
45
- default: undefined;
46
- };
47
- /**
48
- * Applies a large border radius on the button.
49
- *
50
- * @see {@link https://next.vuetifyjs.com/en/components/buttons/#rounded}
51
- */
52
- rounded: {
53
- type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
54
- default: undefined;
55
- };
56
- /**
57
- * Applies border styles to component.
58
- *
59
- * @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-border}
60
- */
61
- border: {
62
- type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
63
- default: boolean;
64
- };
65
- /**
66
- * Designates an elevation applied to the component between 0 and 24.
67
- *
68
- * @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-elevation}
69
- */
70
- elevation: {
71
- type: (StringConstructor | NumberConstructor)[];
72
- default: undefined;
73
- };
74
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
75
- /** Model value */
76
- modelValue: {
77
- type: StringConstructor;
78
- default: any;
79
- };
80
- /** Swatch colors */
81
- swatches: {
82
- type: PropType<string[] | string[][]>;
83
- default: () => any[][];
84
- };
85
- /** Swatch size */
86
- size: {
87
- type: StringConstructor;
88
- default: string;
89
- };
90
- /** Selected icon */
91
- icon: {
92
- type: StringConstructor;
93
- default: string;
94
- };
95
- /** selected icon size */
96
- iconSize: {
97
- type: StringConstructor;
98
- default: string;
99
- };
100
- /**
101
- * The variant prop gives you easy access to several different button styles..
102
- *
103
- * @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
104
- */
105
- variant: {
106
- type: PropType<"flat" | "text" | "elevated" | "tonal" | "outlined" | "plain">;
107
- default: undefined;
108
- };
109
- /**
110
- * Removes the ability to click or target the component.
111
- *
112
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
113
- */
114
- disabled: {
115
- type: BooleanConstructor;
116
- default: undefined;
117
- };
118
- /**
119
- * Applies a large border radius on the button.
120
- *
121
- * @see {@link https://next.vuetifyjs.com/en/components/buttons/#rounded}
122
- */
123
- rounded: {
124
- type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
125
- default: undefined;
126
- };
127
- /**
128
- * Applies border styles to component.
129
- *
130
- * @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-border}
131
- */
132
- border: {
133
- type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
134
- default: boolean;
135
- };
136
- /**
137
- * Designates an elevation applied to the component between 0 and 24.
138
- *
139
- * @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-elevation}
140
- */
141
- elevation: {
142
- type: (StringConstructor | NumberConstructor)[];
143
- default: undefined;
144
- };
145
- }>> & {
146
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
147
- }, {
148
- modelValue: string;
149
- swatches: string[] | string[][];
150
- size: string;
151
- icon: string;
152
- iconSize: string;
153
- variant: "flat" | "text" | "elevated" | "tonal" | "outlined" | "plain";
154
- disabled: boolean;
155
- rounded: string | number | boolean;
156
- border: string | number | boolean;
157
- elevation: string | number;
158
- }>;
159
- export default _default;
160
- //# sourceMappingURL=VSwatches.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.ts"],"names":[],"mappings":"AACA,uBAAuB;AACvB,OAAO,EAAc,KAAK,QAAQ,EAAY,MAAM,KAAK,CAAC;;IAsGxD,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;IArEH,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;AAxKL,wBAwQc"}