vuetify-swatches 1.5.0 → 1.6.2

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
@@ -153,9 +153,6 @@ Most props other than size and placement are the same as [v-btn](https://vuetify
153
153
  </script>
154
154
  ```
155
155
 
156
- ```
157
-
158
156
  ## LICENSE
159
157
 
160
- ©2022-2023 by Logue. Licensed under the [MIT License](LICENSE).
161
- ```
158
+ ©2022-2024 by Logue. Licensed under the [MIT License](LICENSE).
package/dist/index.es.js CHANGED
@@ -3,47 +3,46 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify3.
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2022-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.5.0
8
+ * @version 1.6.2
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- import { defineComponent, ref, watch, onMounted, openBlock, createBlock, unref, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
13
- import { VSheet, VBtn, VIcon } from 'vuetify/components';
14
- import { shades, red, pink, purple, deepPurple, indigo, blue, lightBlue, cyan, teal, green, lightGreen, lime, yellow, amber, orange, deepOrange, brown, blueGrey, grey } from 'vuetify/lib/util/colors.mjs';
15
-
16
- var _sfc_main = /* @__PURE__ */ defineComponent({
12
+ import { defineComponent as g, ref as y, watch as w, onMounted as S, openBlock as l, createBlock as d, unref as r, withCtx as o, createElementBlock as u, Fragment as c, renderList as b, normalizeClass as V, createTextVNode as k, toDisplayString as z, createCommentVNode as B } from "vue";
13
+ import { VSheet as C, VBtn as x, VIcon as N } from "vuetify/components";
14
+ import e from "vuetify/util/colors";
15
+ var _ = /* @__PURE__ */ g({
17
16
  __name: "VSwatches",
18
17
  props: {
19
18
  /** Model value */
20
- modelValue: { type: String, default: shades.white },
19
+ modelValue: { type: String, default: e.shades.white },
21
20
  /** Swatch colors */
22
21
  swatches: {
23
22
  type: Array,
24
23
  default: () => [
25
- [shades.black, shades.white, shades.transparent],
24
+ [e.shades.black, e.shades.white, e.shades.transparent],
26
25
  [
27
- red.base,
28
- pink.base,
29
- purple.base,
30
- deepPurple.base,
31
- indigo.base,
32
- blue.base,
33
- lightBlue.base,
34
- cyan.base
26
+ e.red.base,
27
+ e.pink.base,
28
+ e.purple.base,
29
+ e.deepPurple.base,
30
+ e.indigo.base,
31
+ e.blue.base,
32
+ e.lightBlue.base,
33
+ e.cyan.base
35
34
  ],
36
35
  [
37
- teal.base,
38
- green.base,
39
- lightGreen.base,
40
- lime.base,
41
- yellow.base,
42
- amber.base,
43
- orange.base,
44
- deepOrange.base
36
+ e.teal.base,
37
+ e.green.base,
38
+ e.lightGreen.base,
39
+ e.lime.base,
40
+ e.yellow.base,
41
+ e.amber.base,
42
+ e.orange.base,
43
+ e.deepOrange.base
45
44
  ],
46
- [brown.base, blueGrey.base, grey.base]
45
+ [e.brown.base, e.blueGrey.base, e.grey.base]
47
46
  ]
48
47
  },
49
48
  /** Swatch size */
@@ -77,7 +76,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
77
76
  */
78
77
  disabled: {
79
78
  type: Boolean,
80
- default: false
79
+ default: !1
81
80
  },
82
81
  /**
83
82
  * Applies a large border radius on the button.
@@ -95,7 +94,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
95
94
  */
96
95
  border: {
97
96
  type: [String, Number, Boolean],
98
- default: false
97
+ default: !1
99
98
  },
100
99
  /**
101
100
  * Designates an elevation applied to the component between 0 and 24.
@@ -108,66 +107,54 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
108
107
  }
109
108
  },
110
109
  emits: {
111
- "update:modelValue": (value) => true
110
+ "update:modelValue": (t) => !0
112
111
  },
113
- setup(__props, { emit: __emit }) {
114
- const emits = __emit;
115
- const props = __props;
116
- const selected = ref(shades.white);
117
- const onSwatchClick = (e) => selected.value = e.target.value || shades.white;
118
- watch(
119
- () => selected.value,
120
- (s) => emits("update:modelValue", s)
121
- );
122
- onMounted(() => {
123
- if (props.modelValue) {
124
- selected.value = props.modelValue;
125
- }
126
- });
127
- return (_ctx, _cache) => {
128
- return openBlock(), createBlock(unref(VSheet), { class: "v-swatches" }, {
129
- default: withCtx(() => [
130
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.swatches, (cols, rows) => {
131
- return openBlock(), createElementBlock("div", { key: rows }, [
132
- (openBlock(true), createElementBlock(Fragment, null, renderList(cols, (color) => {
133
- return openBlock(), createBlock(unref(VBtn), {
134
- key: color,
135
- border: props.border,
136
- class: normalizeClass(color === unref(shades).transparent ? "bg-trasparent" : ""),
137
- color,
138
- disabled: props.disabled,
139
- elevation: props.elevation,
140
- height: props.size,
141
- value: color,
142
- variant: props.variant,
143
- width: props.size,
144
- "min-width": "auto",
145
- onClick: onSwatchClick
146
- }, {
147
- default: withCtx(() => [
148
- color === __props.modelValue ? (openBlock(), createBlock(unref(VIcon), {
149
- key: 0,
150
- size: __props.iconSize,
151
- color: color !== unref(shades).transparent ? color : void 0
152
- }, {
153
- default: withCtx(() => [
154
- createTextVNode(toDisplayString(props.icon), 1)
155
- ]),
156
- _: 2
157
- }, 1032, ["size", "color"])) : createCommentVNode("", true)
158
- ]),
159
- _: 2
160
- }, 1032, ["border", "class", "color", "disabled", "elevation", "height", "value", "variant", "width"]);
161
- }), 128))
162
- ]);
163
- }), 128))
164
- ]),
165
- _: 1
166
- });
167
- };
112
+ setup(t, { emit: m }) {
113
+ const h = m, a = t, i = y(e.shades.white), p = (n) => i.value = n.target.value || e.shades.white;
114
+ return w(
115
+ () => i.value,
116
+ (n) => h("update:modelValue", n)
117
+ ), S(() => {
118
+ a.modelValue && (i.value = a.modelValue);
119
+ }), (n, G) => (l(), d(r(C), { class: "v-swatches" }, {
120
+ default: o(() => [
121
+ (l(!0), u(c, null, b(t.swatches, (f, v) => (l(), u("div", { key: v }, [
122
+ (l(!0), u(c, null, b(f, (s) => (l(), d(r(x), {
123
+ key: s,
124
+ border: a.border,
125
+ class: V(s === r(e).shades.transparent ? "bg-trasparent" : ""),
126
+ color: s,
127
+ disabled: a.disabled,
128
+ elevation: a.elevation,
129
+ height: a.size,
130
+ value: s,
131
+ variant: a.variant,
132
+ width: a.size,
133
+ "min-width": "auto",
134
+ onClick: p
135
+ }, {
136
+ default: o(() => [
137
+ s === t.modelValue ? (l(), d(r(N), {
138
+ key: 0,
139
+ size: t.iconSize,
140
+ color: s !== r(e).shades.transparent ? s : void 0
141
+ }, {
142
+ default: o(() => [
143
+ k(z(a.icon), 1)
144
+ ]),
145
+ _: 2
146
+ }, 1032, ["size", "color"])) : B("", !0)
147
+ ]),
148
+ _: 2
149
+ }, 1032, ["border", "class", "color", "disabled", "elevation", "height", "value", "variant", "width"]))), 128))
150
+ ]))), 128))
151
+ ]),
152
+ _: 1
153
+ }));
168
154
  }
169
155
  });
170
-
171
- const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
172
-
173
- export { _sfc_main as default, installVSwatches as install };
156
+ const F = (t) => t.component("VSwatches", _);
157
+ export {
158
+ _ as default,
159
+ F as install
160
+ };
@@ -3,177 +3,10 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify3.
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2022-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.5.0
8
+ * @version 1.6.2
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- var VSwatches = (function (exports, vue, components, colors_mjs) {
13
- 'use strict';
14
-
15
- var _sfc_main = /* @__PURE__ */ vue.defineComponent({
16
- __name: "VSwatches",
17
- props: {
18
- /** Model value */
19
- modelValue: { type: String, default: colors_mjs.shades.white },
20
- /** Swatch colors */
21
- swatches: {
22
- type: Array,
23
- default: () => [
24
- [colors_mjs.shades.black, colors_mjs.shades.white, colors_mjs.shades.transparent],
25
- [
26
- colors_mjs.red.base,
27
- colors_mjs.pink.base,
28
- colors_mjs.purple.base,
29
- colors_mjs.deepPurple.base,
30
- colors_mjs.indigo.base,
31
- colors_mjs.blue.base,
32
- colors_mjs.lightBlue.base,
33
- colors_mjs.cyan.base
34
- ],
35
- [
36
- colors_mjs.teal.base,
37
- colors_mjs.green.base,
38
- colors_mjs.lightGreen.base,
39
- colors_mjs.lime.base,
40
- colors_mjs.yellow.base,
41
- colors_mjs.amber.base,
42
- colors_mjs.orange.base,
43
- colors_mjs.deepOrange.base
44
- ],
45
- [colors_mjs.brown.base, colors_mjs.blueGrey.base, colors_mjs.grey.base]
46
- ]
47
- },
48
- /** Swatch size */
49
- size: {
50
- type: String,
51
- default: "2rem"
52
- },
53
- /** Selected icon */
54
- icon: {
55
- type: String,
56
- default: "mdi-checkbox-marked-circle"
57
- },
58
- /** selected icon size */
59
- iconSize: {
60
- type: String,
61
- default: "1rem"
62
- },
63
- /**
64
- * The variant prop gives you easy access to several different button styles..
65
- *
66
- * @see {@link https://vuetifyjs.com/en/components/buttons/#variant}
67
- */
68
- variant: {
69
- type: String,
70
- default: void 0
71
- },
72
- /**
73
- * Removes the ability to click or target the component.
74
- *
75
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
76
- */
77
- disabled: {
78
- type: Boolean,
79
- default: false
80
- },
81
- /**
82
- * Applies a large border radius on the button.
83
- *
84
- * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
85
- */
86
- rounded: {
87
- type: [String, Number, Boolean],
88
- default: void 0
89
- },
90
- /**
91
- * Applies border styles to component.
92
- *
93
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-border}
94
- */
95
- border: {
96
- type: [String, Number, Boolean],
97
- default: false
98
- },
99
- /**
100
- * Designates an elevation applied to the component between 0 and 24.
101
- *
102
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
103
- */
104
- elevation: {
105
- type: [String, Number],
106
- default: void 0
107
- }
108
- },
109
- emits: {
110
- "update:modelValue": (value) => true
111
- },
112
- setup(__props, { emit: __emit }) {
113
- const emits = __emit;
114
- const props = __props;
115
- const selected = vue.ref(colors_mjs.shades.white);
116
- const onSwatchClick = (e) => selected.value = e.target.value || colors_mjs.shades.white;
117
- vue.watch(
118
- () => selected.value,
119
- (s) => emits("update:modelValue", s)
120
- );
121
- vue.onMounted(() => {
122
- if (props.modelValue) {
123
- selected.value = props.modelValue;
124
- }
125
- });
126
- return (_ctx, _cache) => {
127
- return vue.openBlock(), vue.createBlock(vue.unref(components.VSheet), { class: "v-swatches" }, {
128
- default: vue.withCtx(() => [
129
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.swatches, (cols, rows) => {
130
- return vue.openBlock(), vue.createElementBlock("div", { key: rows }, [
131
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(cols, (color) => {
132
- return vue.openBlock(), vue.createBlock(vue.unref(components.VBtn), {
133
- key: color,
134
- border: props.border,
135
- class: vue.normalizeClass(color === vue.unref(colors_mjs.shades).transparent ? "bg-trasparent" : ""),
136
- color,
137
- disabled: props.disabled,
138
- elevation: props.elevation,
139
- height: props.size,
140
- value: color,
141
- variant: props.variant,
142
- width: props.size,
143
- "min-width": "auto",
144
- onClick: onSwatchClick
145
- }, {
146
- default: vue.withCtx(() => [
147
- color === __props.modelValue ? (vue.openBlock(), vue.createBlock(vue.unref(components.VIcon), {
148
- key: 0,
149
- size: __props.iconSize,
150
- color: color !== vue.unref(colors_mjs.shades).transparent ? color : void 0
151
- }, {
152
- default: vue.withCtx(() => [
153
- vue.createTextVNode(vue.toDisplayString(props.icon), 1)
154
- ]),
155
- _: 2
156
- }, 1032, ["size", "color"])) : vue.createCommentVNode("", true)
157
- ]),
158
- _: 2
159
- }, 1032, ["border", "class", "color", "disabled", "elevation", "height", "value", "variant", "width"]);
160
- }), 128))
161
- ]);
162
- }), 128))
163
- ]),
164
- _: 1
165
- });
166
- };
167
- }
168
- });
169
-
170
- const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
171
-
172
- exports["default"] = _sfc_main;
173
- exports.install = installVSwatches;
174
-
175
- Object.defineProperty(exports, '__esModule', { value: true });
176
-
177
- return exports;
178
-
179
- })({}, Vue, Vuetify/components, colors);
12
+ var VSwatches=function(n,e,s,u){"use strict";function f(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var t=f(u),o=e.defineComponent({__name:"VSwatches",props:{modelValue:{type:String,default:t.default.shades.white},swatches:{type:Array,default:()=>[[t.default.shades.black,t.default.shades.white,t.default.shades.transparent],[t.default.red.base,t.default.pink.base,t.default.purple.base,t.default.deepPurple.base,t.default.indigo.base,t.default.blue.base,t.default.lightBlue.base,t.default.cyan.base],[t.default.teal.base,t.default.green.base,t.default.lightGreen.base,t.default.lime.base,t.default.yellow.base,t.default.amber.base,t.default.orange.base,t.default.deepOrange.base],[t.default.brown.base,t.default.blueGrey.base,t.default.grey.base]]},size:{type:String,default:"2rem"},icon:{type:String,default:"mdi-checkbox-marked-circle"},iconSize:{type:String,default:"1rem"},variant:{type:String,default:void 0},disabled:{type:Boolean,default:!1},rounded:{type:[String,Number,Boolean],default:void 0},border:{type:[String,Number,Boolean],default:!1},elevation:{type:[String,Number],default:void 0}},emits:{"update:modelValue":a=>!0},setup(a,{emit:b}){const h=b,l=a,i=e.ref(t.default.shades.white),m=r=>i.value=r.target.value||t.default.shades.white;return e.watch(()=>i.value,r=>h("update:modelValue",r)),e.onMounted(()=>{l.modelValue&&(i.value=l.modelValue)}),(r,y)=>(e.openBlock(),e.createBlock(e.unref(s.VSheet),{class:"v-swatches"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.swatches,(p,g)=>(e.openBlock(),e.createElementBlock("div",{key:g},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p,d=>(e.openBlock(),e.createBlock(e.unref(s.VBtn),{key:d,border:l.border,class:e.normalizeClass(d===e.unref(t.default).shades.transparent?"bg-trasparent":""),color:d,disabled:l.disabled,elevation:l.elevation,height:l.size,value:d,variant:l.variant,width:l.size,"min-width":"auto",onClick:m},{default:e.withCtx(()=>[d===a.modelValue?(e.openBlock(),e.createBlock(e.unref(s.VIcon),{key:0,size:a.iconSize,color:d!==e.unref(t.default).shades.transparent?d:void 0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.icon),1)]),_:2},1032,["size","color"])):e.createCommentVNode("",!0)]),_:2},1032,["border","class","color","disabled","elevation","height","value","variant","width"]))),128))]))),128))]),_:1}))}});const c=a=>a.component("VSwatches",o);return n.default=o,n.install=c,Object.defineProperty(n,"__esModule",{value:!0}),n}({},Vue,Vuetify/components,colors);
package/dist/index.umd.js CHANGED
@@ -3,178 +3,10 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify3.
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2022-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.5.0
8
+ * @version 1.6.2
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- (function (global, factory) {
13
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('vuetify/components'), require('vuetify/lib/util/colors.mjs')) :
14
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'vuetify/components', 'vuetify/lib/util/colors.mjs'], factory) :
15
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VSwatches = {}, global.Vue, global["Vuetify/components"], global.colors));
16
- })(this, (function (exports, vue, components, colors_mjs) { 'use strict';
17
-
18
- var _sfc_main = /* @__PURE__ */ vue.defineComponent({
19
- __name: "VSwatches",
20
- props: {
21
- /** Model value */
22
- modelValue: { type: String, default: colors_mjs.shades.white },
23
- /** Swatch colors */
24
- swatches: {
25
- type: Array,
26
- default: () => [
27
- [colors_mjs.shades.black, colors_mjs.shades.white, colors_mjs.shades.transparent],
28
- [
29
- colors_mjs.red.base,
30
- colors_mjs.pink.base,
31
- colors_mjs.purple.base,
32
- colors_mjs.deepPurple.base,
33
- colors_mjs.indigo.base,
34
- colors_mjs.blue.base,
35
- colors_mjs.lightBlue.base,
36
- colors_mjs.cyan.base
37
- ],
38
- [
39
- colors_mjs.teal.base,
40
- colors_mjs.green.base,
41
- colors_mjs.lightGreen.base,
42
- colors_mjs.lime.base,
43
- colors_mjs.yellow.base,
44
- colors_mjs.amber.base,
45
- colors_mjs.orange.base,
46
- colors_mjs.deepOrange.base
47
- ],
48
- [colors_mjs.brown.base, colors_mjs.blueGrey.base, colors_mjs.grey.base]
49
- ]
50
- },
51
- /** Swatch size */
52
- size: {
53
- type: String,
54
- default: "2rem"
55
- },
56
- /** Selected icon */
57
- icon: {
58
- type: String,
59
- default: "mdi-checkbox-marked-circle"
60
- },
61
- /** selected icon size */
62
- iconSize: {
63
- type: String,
64
- default: "1rem"
65
- },
66
- /**
67
- * The variant prop gives you easy access to several different button styles..
68
- *
69
- * @see {@link https://vuetifyjs.com/en/components/buttons/#variant}
70
- */
71
- variant: {
72
- type: String,
73
- default: void 0
74
- },
75
- /**
76
- * Removes the ability to click or target the component.
77
- *
78
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
79
- */
80
- disabled: {
81
- type: Boolean,
82
- default: false
83
- },
84
- /**
85
- * Applies a large border radius on the button.
86
- *
87
- * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
88
- */
89
- rounded: {
90
- type: [String, Number, Boolean],
91
- default: void 0
92
- },
93
- /**
94
- * Applies border styles to component.
95
- *
96
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-border}
97
- */
98
- border: {
99
- type: [String, Number, Boolean],
100
- default: false
101
- },
102
- /**
103
- * Designates an elevation applied to the component between 0 and 24.
104
- *
105
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
106
- */
107
- elevation: {
108
- type: [String, Number],
109
- default: void 0
110
- }
111
- },
112
- emits: {
113
- "update:modelValue": (value) => true
114
- },
115
- setup(__props, { emit: __emit }) {
116
- const emits = __emit;
117
- const props = __props;
118
- const selected = vue.ref(colors_mjs.shades.white);
119
- const onSwatchClick = (e) => selected.value = e.target.value || colors_mjs.shades.white;
120
- vue.watch(
121
- () => selected.value,
122
- (s) => emits("update:modelValue", s)
123
- );
124
- vue.onMounted(() => {
125
- if (props.modelValue) {
126
- selected.value = props.modelValue;
127
- }
128
- });
129
- return (_ctx, _cache) => {
130
- return vue.openBlock(), vue.createBlock(vue.unref(components.VSheet), { class: "v-swatches" }, {
131
- default: vue.withCtx(() => [
132
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.swatches, (cols, rows) => {
133
- return vue.openBlock(), vue.createElementBlock("div", { key: rows }, [
134
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(cols, (color) => {
135
- return vue.openBlock(), vue.createBlock(vue.unref(components.VBtn), {
136
- key: color,
137
- border: props.border,
138
- class: vue.normalizeClass(color === vue.unref(colors_mjs.shades).transparent ? "bg-trasparent" : ""),
139
- color,
140
- disabled: props.disabled,
141
- elevation: props.elevation,
142
- height: props.size,
143
- value: color,
144
- variant: props.variant,
145
- width: props.size,
146
- "min-width": "auto",
147
- onClick: onSwatchClick
148
- }, {
149
- default: vue.withCtx(() => [
150
- color === __props.modelValue ? (vue.openBlock(), vue.createBlock(vue.unref(components.VIcon), {
151
- key: 0,
152
- size: __props.iconSize,
153
- color: color !== vue.unref(colors_mjs.shades).transparent ? color : void 0
154
- }, {
155
- default: vue.withCtx(() => [
156
- vue.createTextVNode(vue.toDisplayString(props.icon), 1)
157
- ]),
158
- _: 2
159
- }, 1032, ["size", "color"])) : vue.createCommentVNode("", true)
160
- ]),
161
- _: 2
162
- }, 1032, ["border", "class", "color", "disabled", "elevation", "height", "value", "variant", "width"]);
163
- }), 128))
164
- ]);
165
- }), 128))
166
- ]),
167
- _: 1
168
- });
169
- };
170
- }
171
- });
172
-
173
- const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
174
-
175
- exports["default"] = _sfc_main;
176
- exports.install = installVSwatches;
177
-
178
- Object.defineProperty(exports, '__esModule', { value: true });
179
-
180
- }));
12
+ (function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vuetify/components"),require("vuetify/util/colors")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify/components","vuetify/util/colors"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l.VSwatches={},l.Vue,l["Vuetify/components"],l.colors))})(this,function(l,e,r,u){"use strict";function f(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var t=f(u),o=e.defineComponent({__name:"VSwatches",props:{modelValue:{type:String,default:t.default.shades.white},swatches:{type:Array,default:()=>[[t.default.shades.black,t.default.shades.white,t.default.shades.transparent],[t.default.red.base,t.default.pink.base,t.default.purple.base,t.default.deepPurple.base,t.default.indigo.base,t.default.blue.base,t.default.lightBlue.base,t.default.cyan.base],[t.default.teal.base,t.default.green.base,t.default.lightGreen.base,t.default.lime.base,t.default.yellow.base,t.default.amber.base,t.default.orange.base,t.default.deepOrange.base],[t.default.brown.base,t.default.blueGrey.base,t.default.grey.base]]},size:{type:String,default:"2rem"},icon:{type:String,default:"mdi-checkbox-marked-circle"},iconSize:{type:String,default:"1rem"},variant:{type:String,default:void 0},disabled:{type:Boolean,default:!1},rounded:{type:[String,Number,Boolean],default:void 0},border:{type:[String,Number,Boolean],default:!1},elevation:{type:[String,Number],default:void 0}},emits:{"update:modelValue":a=>!0},setup(a,{emit:p}){const h=p,n=a,s=e.ref(t.default.shades.white),b=i=>s.value=i.target.value||t.default.shades.white;return e.watch(()=>s.value,i=>h("update:modelValue",i)),e.onMounted(()=>{n.modelValue&&(s.value=n.modelValue)}),(i,k)=>(e.openBlock(),e.createBlock(e.unref(r.VSheet),{class:"v-swatches"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.swatches,(m,y)=>(e.openBlock(),e.createElementBlock("div",{key:y},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m,d=>(e.openBlock(),e.createBlock(e.unref(r.VBtn),{key:d,border:n.border,class:e.normalizeClass(d===e.unref(t.default).shades.transparent?"bg-trasparent":""),color:d,disabled:n.disabled,elevation:n.elevation,height:n.size,value:d,variant:n.variant,width:n.size,"min-width":"auto",onClick:b},{default:e.withCtx(()=>[d===a.modelValue?(e.openBlock(),e.createBlock(e.unref(r.VIcon),{key:0,size:a.iconSize,color:d!==e.unref(t.default).shades.transparent?d:void 0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.icon),1)]),_:2},1032,["size","color"])):e.createCommentVNode("",!0)]),_:2},1032,["border","class","color","disabled","elevation","height","value","variant","width"]))),128))]))),128))]),_:1}))}});const c=a=>a.component("VSwatches",o);l.default=o,l.install=c,Object.defineProperty(l,"__esModule",{value:!0})});
package/dist/style.css CHANGED
@@ -3,24 +3,10 @@
3
3
  *
4
4
  * @description Color Swatch component for Vuetify3.
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2022-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.5.0
8
+ * @version 1.6.2
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- .v-swatches div .v-btn {
13
- padding: 0 !important;
14
- margin: 0.1rem;
15
- /** Reverse checkd mark color */
16
- /** Add Slash */
17
- }
18
- .v-swatches div .v-btn .v-icon {
19
- filter: invert(100%) grayscale(100%) contrast(100);
20
- }
21
- .v-swatches div .v-btn.bg-trasparent {
22
- background: linear-gradient(to top left, transparent 0, transparent calc(50% - 0.1rem), rgb(var(--v-theme-error)) 50%, transparent calc(50% + 0.1rem), transparent);
23
- }
24
- .v-swatches div .v-btn.bg-trasparent .v-icon {
25
- filter: none;
26
- }
12
+ .v-swatches div .v-btn{padding:0!important;margin:.1rem}.v-swatches div .v-btn .v-icon{filter:invert(100%) grayscale(100%) contrast(100)}.v-swatches div .v-btn.bg-trasparent{background:linear-gradient(to top left,transparent 0,transparent calc(50% - .1rem),rgb(var(--v-theme-error)) 50%,transparent calc(50% + .1rem),transparent)}.v-swatches div .v-btn.bg-trasparent .v-icon{filter:none}
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.5.0",
4
+ "version": "1.6.2",
5
5
  "description": "Color Swatch component for Vuetify3.",
6
6
  "keywords": [
7
7
  "vuejs",
@@ -63,13 +63,13 @@
63
63
  "engines": {
64
64
  "yarn": ">=1.22.19"
65
65
  },
66
- "packageManager": "yarn@4.0.2",
66
+ "packageManager": "yarn@4.1.0",
67
67
  "sideEffects": false,
68
68
  "scripts": {
69
69
  "dev": "vite",
70
70
  "clean": "rimraf node_modules/.vite",
71
- "type-check": "tsc --noEmit --composite false",
72
- "build": "run-p type-check build-only",
71
+ "type-check": "vue-tsc --build --force",
72
+ "build": "run-p type-check \"build-only {@}\" --",
73
73
  "build:analyze": "vite build --mode=analyze",
74
74
  "build:clean": "rimraf dist docs",
75
75
  "build:docs": "vite build --mode=docs",
@@ -80,48 +80,48 @@
80
80
  "version": "auto-changelog -p && git add CHANGELOG.md"
81
81
  },
82
82
  "peerDependencies": {
83
- "vuetify": "^3.3.15"
83
+ "vuetify": "^3.5.6"
84
84
  },
85
85
  "devDependencies": {
86
- "@codemirror/lang-vue": "^0.1.2",
87
- "@tsconfig/node-lts": "^18.12.5",
88
- "@types/node": "^20.10.1",
89
- "@typescript-eslint/eslint-plugin": "^6.13.1",
90
- "@typescript-eslint/parser": "^6.13.1",
91
- "@vitejs/plugin-vue": "^4.5.0",
92
- "@vue/eslint-config-prettier": "^8.0.0",
93
- "@vue/tsconfig": "^0.4.0",
94
- "eslint": "^8.54.0",
95
- "eslint-config-standard-with-typescript": "^40.0.0",
86
+ "@codemirror/lang-vue": "0.1.2",
87
+ "@tsconfig/node-lts": "^20.1.1",
88
+ "@types/node": "^20.11.21",
89
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
90
+ "@typescript-eslint/parser": "^7.1.0",
91
+ "@vitejs/plugin-vue": "^5.0.4",
92
+ "@vue/eslint-config-prettier": "^9.0.0",
93
+ "@vue/tsconfig": "^0.5.1",
94
+ "eslint": "^8.57.0",
95
+ "eslint-config-standard-with-typescript": "^43.0.1",
96
96
  "eslint-import-resolver-alias": "^1.1.2",
97
97
  "eslint-import-resolver-typescript": "^3.6.1",
98
- "eslint-plugin-html": "^7.1.0",
99
- "eslint-plugin-import": "^2.29.0",
100
- "eslint-plugin-n": "^16.3.1",
98
+ "eslint-plugin-html": "^8.0.0",
99
+ "eslint-plugin-import": "^2.29.1",
100
+ "eslint-plugin-n": "^16.6.2",
101
101
  "eslint-plugin-promise": "^6.1.1",
102
102
  "eslint-plugin-tsdoc": "^0.2.17",
103
- "eslint-plugin-vue": "^9.18.1",
104
- "eslint-plugin-vuejs-accessibility": "^2.2.0",
105
- "eslint-plugin-vuetify": "^2.1.0",
103
+ "eslint-plugin-vue": "^9.22.0",
104
+ "eslint-plugin-vuejs-accessibility": "^2.2.1",
105
+ "eslint-plugin-vuetify": "^2.1.1",
106
106
  "eslint-plugin-yaml": "^0.5.0",
107
- "husky": "^8.0.3",
108
- "lint-staged": "^15.1.0",
107
+ "husky": "^9.0.11",
108
+ "lint-staged": "^15.2.2",
109
109
  "npm-run-all": "^4.1.5",
110
- "prettier": "^3.1.0",
110
+ "prettier": "^3.2.5",
111
111
  "rimraf": "^5.0.5",
112
- "rollup-plugin-visualizer": "^5.9.3",
113
- "sass": "^1.69.5",
114
- "typescript": "^5.3.2",
115
- "vite": "^5.0.4",
112
+ "rollup-plugin-visualizer": "^5.12.0",
113
+ "sass": "^1.71.1",
114
+ "typescript": "^5.3.3",
115
+ "vite": "^5.1.4",
116
116
  "vite-plugin-banner": "^0.7.1",
117
- "vite-plugin-checker": "^0.6.2",
118
- "vite-plugin-dts": "^3.6.4",
119
- "vite-plugin-vuetify": "^1.0.2",
120
- "vue": "^3.3.9",
121
- "vue-codemirror6": "^1.1.31",
122
- "vue-eslint-parser": "^9.3.2",
123
- "vue-tsc": "^1.8.24",
124
- "vuetify": "^3.4.4"
117
+ "vite-plugin-checker": "^0.6.4",
118
+ "vite-plugin-dts": "^3.7.3",
119
+ "vite-plugin-vuetify": "^2.0.1",
120
+ "vue": "^3.4.20",
121
+ "vue-codemirror6": "^1.2.5",
122
+ "vue-eslint-parser": "^9.4.2",
123
+ "vue-tsc": "^1.8.27",
124
+ "vuetify": "^3.5.6"
125
125
  },
126
126
  "husky": {
127
127
  "hooks": {
@@ -3,28 +3,7 @@
3
3
  import { ref, watch, type PropType, type Ref, onMounted } from 'vue';
4
4
 
5
5
  import { VBtn, VIcon, VSheet } from 'vuetify/components';
6
- import {
7
- shades,
8
- red,
9
- pink,
10
- purple,
11
- deepPurple,
12
- indigo,
13
- blue,
14
- lightBlue,
15
- cyan,
16
- teal,
17
- green,
18
- lightGreen,
19
- lime,
20
- yellow,
21
- amber,
22
- orange,
23
- deepOrange,
24
- brown,
25
- blueGrey,
26
- grey,
27
- } from 'vuetify/lib/util/colors.mjs';
6
+ import colors from 'vuetify/util/colors';
28
7
 
29
8
  /** Emits */
30
9
  const emits = defineEmits({
@@ -34,33 +13,33 @@ const emits = defineEmits({
34
13
  /** Props */
35
14
  const props = defineProps({
36
15
  /** Model value */
37
- modelValue: { type: String, default: shades.white },
16
+ modelValue: { type: String, default: colors.shades.white },
38
17
  /** Swatch colors */
39
18
  swatches: {
40
19
  type: Array as PropType<string[] | string[][] | Record<string, string[]>>,
41
20
  default: () => [
42
- [shades.black, shades.white, shades.transparent],
21
+ [colors.shades.black, colors.shades.white, colors.shades.transparent],
43
22
  [
44
- red.base,
45
- pink.base,
46
- purple.base,
47
- deepPurple.base,
48
- indigo.base,
49
- blue.base,
50
- lightBlue.base,
51
- cyan.base,
23
+ colors.red.base,
24
+ colors.pink.base,
25
+ colors.purple.base,
26
+ colors.deepPurple.base,
27
+ colors.indigo.base,
28
+ colors.blue.base,
29
+ colors.lightBlue.base,
30
+ colors.cyan.base,
52
31
  ],
53
32
  [
54
- teal.base,
55
- green.base,
56
- lightGreen.base,
57
- lime.base,
58
- yellow.base,
59
- amber.base,
60
- orange.base,
61
- deepOrange.base,
33
+ colors.teal.base,
34
+ colors.green.base,
35
+ colors.lightGreen.base,
36
+ colors.lime.base,
37
+ colors.yellow.base,
38
+ colors.amber.base,
39
+ colors.orange.base,
40
+ colors.deepOrange.base,
62
41
  ],
63
- [brown.base, blueGrey.base, grey.base],
42
+ [colors.brown.base, colors.blueGrey.base, colors.grey.base],
64
43
  ],
65
44
  },
66
45
  /** Swatch size */
@@ -128,7 +107,7 @@ const props = defineProps({
128
107
  });
129
108
 
130
109
  /** Selected Color */
131
- const selected: Ref<string> = ref(shades.white);
110
+ const selected: Ref<string> = ref(colors.shades.white);
132
111
 
133
112
  /**
134
113
  * Swatch button clicked handler
@@ -136,7 +115,8 @@ const selected: Ref<string> = ref(shades.white);
136
115
  * @param e - Event
137
116
  */
138
117
  const onSwatchClick = (e: Event) =>
139
- (selected.value = (e.target as HTMLButtonElement).value || shades.white);
118
+ (selected.value =
119
+ (e.target as HTMLButtonElement).value || colors.shades.white);
140
120
 
141
121
  watch(
142
122
  () => selected.value,
@@ -157,7 +137,7 @@ onMounted(() => {
157
137
  v-for="color in cols"
158
138
  :key="color"
159
139
  :border="props.border"
160
- :class="color === shades.transparent ? 'bg-trasparent' : ''"
140
+ :class="color === colors.shades.transparent ? 'bg-trasparent' : ''"
161
141
  :color="color"
162
142
  :disabled="props.disabled"
163
143
  :elevation="props.elevation"
@@ -171,7 +151,7 @@ onMounted(() => {
171
151
  <v-icon
172
152
  v-if="color === modelValue"
173
153
  :size="iconSize"
174
- :color="color !== shades.transparent ? color : undefined"
154
+ :color="color !== colors.shades.transparent ? color : undefined"
175
155
  >
176
156
  {{ props.icon }}
177
157
  </v-icon>