vuetify-swatches 1.3.0 → 1.3.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
@@ -5,10 +5,11 @@
5
5
  [![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/vuetify-swatches/file/README.md)
6
6
  [![npm version](https://img.shields.io/npm/v/vuetify-swatches.svg)](https://www.npmjs.com/package/vuetify-swatches)
7
7
  [![Open in Gitpod](https://shields.io/badge/Open%20in-Gitpod-green?logo=Gitpod)](https://gitpod.io/#https://github.com/logue/vuetify-swatches)
8
+ [![Twitter Follow](https://img.shields.io/twitter/follow/logue256?style=plastic)](https://twitter.com/logue256)
8
9
 
9
10
  ![demo](https://user-images.githubusercontent.com/480173/156681882-d3d5e868-ba9a-4a34-9e75-08272d39da64.gif)
10
11
 
11
- This branch is for vuetify3. Not usable for production, experimental use only. Bidirectional binding (select swatch button by value) does not work due to a problem on the Vuetify3 side.
12
+ This branch is for vuetify3. Not usable for production, experimental use only.
12
13
 
13
14
  This project is a remake of [saintplay's vue-swatches](https://saintplay.github.io/vue-swatches/) with [Vuetify](https://vuetifyjs.com/).
14
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,GAAG,EAET,MAAM,KAAK,CAAC;AAKb,uBAAuB;;IAUnB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;;;uBAoBuB,KAAK;;;IA7E/B,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;AAlEP,wBAoGG"}
1
+ {"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,GAAG,EAET,MAAM,KAAK,CAAC;AAKb,uBAAuB;;IAUnB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;;;uBAoBuB,KAAK;;;IA7E/B,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;AAlEP,wBAoGG"}
package/dist/index.es.js CHANGED
@@ -5,45 +5,46 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.0
8
+ * @version 1.3.2
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- import { defineComponent as k, ref as S, resolveComponent as d, openBlock as n, createBlock as u, withCtx as c, createElementBlock as p, Fragment as b, renderList as h, normalizeClass as _, createTextVNode as C, toDisplayString as z, createCommentVNode as B } from "vue";
13
- import e from "vuetify/lib/util/colors.mjs";
14
- const $ = k({
12
+ import { defineComponent, ref, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
13
+ import colors from 'vuetify/lib/util/colors.mjs';
14
+
15
+ const _sfc_main = defineComponent({
15
16
  name: "VSwatches",
16
17
  model: {
17
18
  prop: "modelValue",
18
19
  event: "update:modelValue"
19
20
  },
20
21
  props: {
21
- modelValue: { type: String, default: e.shades.white },
22
+ modelValue: { type: String, default: colors.shades.white },
22
23
  swatches: {
23
24
  type: Array,
24
25
  default: () => [
25
- [e.shades.black, e.shades.white, e.shades.transparent],
26
+ [colors.shades.black, colors.shades.white, colors.shades.transparent],
26
27
  [
27
- e.red.base,
28
- e.pink.base,
29
- e.purple.base,
30
- e.deepPurple.base,
31
- e.indigo.base,
32
- e.blue.base,
33
- e.lightBlue.base,
34
- e.cyan.base
28
+ colors.red.base,
29
+ colors.pink.base,
30
+ colors.purple.base,
31
+ colors.deepPurple.base,
32
+ colors.indigo.base,
33
+ colors.blue.base,
34
+ colors.lightBlue.base,
35
+ colors.cyan.base
35
36
  ],
36
37
  [
37
- e.teal.base,
38
- e.green.base,
39
- e.lightGreen.base,
40
- e.lime.base,
41
- e.yellow.base,
42
- e.amber.base,
43
- e.orange.base,
44
- e.deepOrange.base
38
+ colors.teal.base,
39
+ colors.green.base,
40
+ colors.lightGreen.base,
41
+ colors.lime.base,
42
+ colors.yellow.base,
43
+ colors.amber.base,
44
+ colors.orange.base,
45
+ colors.deepOrange.base
45
46
  ],
46
- [e.brown.base, e.blueGrey.base, e.grey.base]
47
+ [colors.brown.base, colors.blueGrey.base, colors.grey.base]
47
48
  ]
48
49
  },
49
50
  size: { type: String, default: "2rem" },
@@ -57,63 +58,81 @@ const $ = k({
57
58
  rounded: { type: String, Number, default: void 0 }
58
59
  },
59
60
  emits: ["update:modelValue"],
60
- setup(t, s) {
61
+ setup(props, context) {
62
+ const checkedVisibilty = ref(false);
63
+ const onSwatchClick = (e) => {
64
+ const value = e.target.dataset.value;
65
+ if (!value || props.modelValue === value) {
66
+ return;
67
+ }
68
+ context.emit("update:modelValue", value);
69
+ };
61
70
  return {
62
- checkedVisibilty: S(!1),
63
- onSwatchClick: (o) => {
64
- const l = o.target.dataset.value;
65
- !l || t.modelValue === l || s.emit("update:modelValue", l);
66
- },
67
- shades: e.shades
71
+ checkedVisibilty,
72
+ onSwatchClick,
73
+ shades: colors.shades
68
74
  };
69
75
  }
70
76
  });
71
- const N = (t, s) => {
72
- const i = t.__vccOpts || t;
73
- for (const [r, o] of s)
74
- i[r] = o;
75
- return i;
77
+
78
+ const VSwatches_vue_vue_type_style_index_0_lang = '';
79
+
80
+ const _export_sfc = (sfc, props) => {
81
+ const target = sfc.__vccOpts || sfc;
82
+ for (const [key, val] of props) {
83
+ target[key] = val;
84
+ }
85
+ return target;
76
86
  };
77
- function G(t, s, i, r, o, l) {
78
- const v = d("v-icon"), f = d("v-btn"), w = d("v-sheet");
79
- return n(), u(w, { class: "v-swatches" }, {
80
- default: c(() => [
81
- (n(!0), p(b, null, h(t.swatches, (y, g) => (n(), p("div", { key: g }, [
82
- (n(!0), p(b, null, h(y, (a) => (n(), u(f, {
83
- key: a,
84
- color: a,
85
- disabled: t.disabled,
86
- height: t.size,
87
- value: a,
88
- variant: t.variant,
89
- width: t.size,
90
- "data-value": a,
91
- class: _(a === t.shades.transparent ? "bg-trasparent" : ""),
92
- "min-width": "auto",
93
- onClick: s[0] || (s[0] = (V) => t.onSwatchClick(V))
94
- }, {
95
- default: c(() => [
96
- a === t.modelValue ? (n(), u(v, {
97
- key: 0,
98
- size: t.iconSize,
99
- color: a !== t.shades.transparent ? a : void 0
87
+
88
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
89
+ const _component_v_icon = resolveComponent("v-icon");
90
+ const _component_v_btn = resolveComponent("v-btn");
91
+ const _component_v_sheet = resolveComponent("v-sheet");
92
+ return openBlock(), createBlock(_component_v_sheet, { class: "v-swatches" }, {
93
+ default: withCtx(() => [
94
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.swatches, (colors, rows) => {
95
+ return openBlock(), createElementBlock("div", { key: rows }, [
96
+ (openBlock(true), createElementBlock(Fragment, null, renderList(colors, (color) => {
97
+ return openBlock(), createBlock(_component_v_btn, {
98
+ key: color,
99
+ color,
100
+ disabled: _ctx.disabled,
101
+ height: _ctx.size,
102
+ value: color,
103
+ variant: _ctx.variant,
104
+ width: _ctx.size,
105
+ "data-value": color,
106
+ class: normalizeClass(color === _ctx.shades.transparent ? "bg-trasparent" : ""),
107
+ "min-width": "auto",
108
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.onSwatchClick($event))
100
109
  }, {
101
- default: c(() => [
102
- C(z(t.icon), 1)
110
+ default: withCtx(() => [
111
+ color === _ctx.modelValue ? (openBlock(), createBlock(_component_v_icon, {
112
+ key: 0,
113
+ size: _ctx.iconSize,
114
+ color: color !== _ctx.shades.transparent ? color : void 0
115
+ }, {
116
+ default: withCtx(() => [
117
+ createTextVNode(toDisplayString(_ctx.icon), 1)
118
+ ]),
119
+ _: 2
120
+ }, 1032, ["size", "color"])) : createCommentVNode("", true)
103
121
  ]),
104
122
  _: 2
105
- }, 1032, ["size", "color"])) : B("", !0)
106
- ]),
107
- _: 2
108
- }, 1032, ["color", "disabled", "height", "value", "variant", "width", "data-value", "class"]))), 128))
109
- ]))), 128))
123
+ }, 1032, ["color", "disabled", "height", "value", "variant", "width", "data-value", "class"]);
124
+ }), 128))
125
+ ]);
126
+ }), 128))
110
127
  ]),
111
128
  _: 1
112
129
  });
113
130
  }
114
- const m = /* @__PURE__ */ N($, [["render", G]]), D = (t) => t.component("VSwatches", m);
115
- typeof window < "u" && window.Vue && window.Vue.use(m);
116
- export {
117
- m as default,
118
- D as install
119
- };
131
+ const VSwatches = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
132
+
133
+ const installVSwatches = (app) => app.component("VSwatches", VSwatches);
134
+ if (typeof window !== "undefined" && window.Vue) {
135
+ window.Vue.use(VSwatches);
136
+ }
137
+
138
+ export { VSwatches as default, installVSwatches as install };
@@ -5,8 +5,145 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.0
8
+ * @version 1.3.2
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- var VSwatches=function(s,e,u){"use strict";const t=(a=>a&&typeof a=="object"&&"default"in a?a:{default:a})(u),f=e.defineComponent({name:"VSwatches",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:t.default.shades.white},swatches:{type:Array,default:()=>[[t.default.shades.black,t.default.shades.white,t.default.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:void 0},rounded:{type:String,Number,default:void 0}},emits:["update:modelValue"],setup(a,n){return{checkedVisibilty:e.ref(!1),onSwatchClick:o=>{const i=o.target.dataset.value;!i||a.modelValue===i||n.emit("update:modelValue",i)},shades:t.default.shades}}}),V="",p=(a,n)=>{const d=a.__vccOpts||a;for(const[c,o]of n)d[c]=o;return d};function b(a,n,d,c,o,i){const m=e.resolveComponent("v-icon"),w=e.resolveComponent("v-btn"),y=e.resolveComponent("v-sheet");return e.openBlock(),e.createBlock(y,{class:"v-swatches"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.swatches,(g,k)=>(e.openBlock(),e.createElementBlock("div",{key:k},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g,l=>(e.openBlock(),e.createBlock(w,{key:l,color:l,disabled:a.disabled,height:a.size,value:l,variant:a.variant,width:a.size,"data-value":l,class:e.normalizeClass(l===a.shades.transparent?"bg-trasparent":""),"min-width":"auto",onClick:n[0]||(n[0]=_=>a.onSwatchClick(_))},{default:e.withCtx(()=>[l===a.modelValue?(e.openBlock(),e.createBlock(m,{key:0,size:a.iconSize,color:l!==a.shades.transparent?l:void 0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.icon),1)]),_:2},1032,["size","color"])):e.createCommentVNode("",!0)]),_:2},1032,["color","disabled","height","value","variant","width","data-value","class"]))),128))]))),128))]),_:1})}const r=p(f,[["render",b]]),h=a=>a.component("VSwatches",r);return typeof window<"u"&&window.Vue&&window.Vue.use(r),s.default=r,s.install=h,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),s}({},Vue,colors);
12
+ var VSwatches = (function (exports, vue, colors) {
13
+ 'use strict';
14
+
15
+ const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
16
+
17
+ const colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
18
+
19
+ const _sfc_main = vue.defineComponent({
20
+ name: "VSwatches",
21
+ model: {
22
+ prop: "modelValue",
23
+ event: "update:modelValue"
24
+ },
25
+ props: {
26
+ modelValue: { type: String, default: colors__default.default.shades.white },
27
+ swatches: {
28
+ type: Array,
29
+ default: () => [
30
+ [colors__default.default.shades.black, colors__default.default.shades.white, colors__default.default.shades.transparent],
31
+ [
32
+ colors__default.default.red.base,
33
+ colors__default.default.pink.base,
34
+ colors__default.default.purple.base,
35
+ colors__default.default.deepPurple.base,
36
+ colors__default.default.indigo.base,
37
+ colors__default.default.blue.base,
38
+ colors__default.default.lightBlue.base,
39
+ colors__default.default.cyan.base
40
+ ],
41
+ [
42
+ colors__default.default.teal.base,
43
+ colors__default.default.green.base,
44
+ colors__default.default.lightGreen.base,
45
+ colors__default.default.lime.base,
46
+ colors__default.default.yellow.base,
47
+ colors__default.default.amber.base,
48
+ colors__default.default.orange.base,
49
+ colors__default.default.deepOrange.base
50
+ ],
51
+ [colors__default.default.brown.base, colors__default.default.blueGrey.base, colors__default.default.grey.base]
52
+ ]
53
+ },
54
+ size: { type: String, default: "2rem" },
55
+ icon: { type: String, default: "mdi-checkbox-marked-circle" },
56
+ iconSize: { type: String, default: "1rem" },
57
+ variant: {
58
+ type: String,
59
+ default: void 0
60
+ },
61
+ disabled: { type: Boolean, default: void 0 },
62
+ rounded: { type: String, Number, default: void 0 }
63
+ },
64
+ emits: ["update:modelValue"],
65
+ setup(props, context) {
66
+ const checkedVisibilty = vue.ref(false);
67
+ const onSwatchClick = (e) => {
68
+ const value = e.target.dataset.value;
69
+ if (!value || props.modelValue === value) {
70
+ return;
71
+ }
72
+ context.emit("update:modelValue", value);
73
+ };
74
+ return {
75
+ checkedVisibilty,
76
+ onSwatchClick,
77
+ shades: colors__default.default.shades
78
+ };
79
+ }
80
+ });
81
+
82
+ const VSwatches_vue_vue_type_style_index_0_lang = '';
83
+
84
+ const _export_sfc = (sfc, props) => {
85
+ const target = sfc.__vccOpts || sfc;
86
+ for (const [key, val] of props) {
87
+ target[key] = val;
88
+ }
89
+ return target;
90
+ };
91
+
92
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
93
+ const _component_v_icon = vue.resolveComponent("v-icon");
94
+ const _component_v_btn = vue.resolveComponent("v-btn");
95
+ const _component_v_sheet = vue.resolveComponent("v-sheet");
96
+ return vue.openBlock(), vue.createBlock(_component_v_sheet, { class: "v-swatches" }, {
97
+ default: vue.withCtx(() => [
98
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.swatches, (colors, rows) => {
99
+ return vue.openBlock(), vue.createElementBlock("div", { key: rows }, [
100
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(colors, (color) => {
101
+ return vue.openBlock(), vue.createBlock(_component_v_btn, {
102
+ key: color,
103
+ color,
104
+ disabled: _ctx.disabled,
105
+ height: _ctx.size,
106
+ value: color,
107
+ variant: _ctx.variant,
108
+ width: _ctx.size,
109
+ "data-value": color,
110
+ class: vue.normalizeClass(color === _ctx.shades.transparent ? "bg-trasparent" : ""),
111
+ "min-width": "auto",
112
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.onSwatchClick($event))
113
+ }, {
114
+ default: vue.withCtx(() => [
115
+ color === _ctx.modelValue ? (vue.openBlock(), vue.createBlock(_component_v_icon, {
116
+ key: 0,
117
+ size: _ctx.iconSize,
118
+ color: color !== _ctx.shades.transparent ? color : void 0
119
+ }, {
120
+ default: vue.withCtx(() => [
121
+ vue.createTextVNode(vue.toDisplayString(_ctx.icon), 1)
122
+ ]),
123
+ _: 2
124
+ }, 1032, ["size", "color"])) : vue.createCommentVNode("", true)
125
+ ]),
126
+ _: 2
127
+ }, 1032, ["color", "disabled", "height", "value", "variant", "width", "data-value", "class"]);
128
+ }), 128))
129
+ ]);
130
+ }), 128))
131
+ ]),
132
+ _: 1
133
+ });
134
+ }
135
+ const VSwatches = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
136
+
137
+ const installVSwatches = (app) => app.component("VSwatches", VSwatches);
138
+ if (typeof window !== "undefined" && window.Vue) {
139
+ window.Vue.use(VSwatches);
140
+ }
141
+
142
+ exports.default = VSwatches;
143
+ exports.install = installVSwatches;
144
+
145
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
146
+
147
+ return exports;
148
+
149
+ })({}, Vue, colors);
package/dist/index.umd.js CHANGED
@@ -5,8 +5,146 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.0
8
+ * @version 1.3.2
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- (function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vuetify/lib/util/colors.mjs")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify/lib/util/colors.mjs"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.VSwatches={},n.Vue,n.colors))})(this,function(n,e,c){"use strict";const t=(a=>a&&typeof a=="object"&&"default"in a?a:{default:a})(c),f=e.defineComponent({name:"VSwatches",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:t.default.shades.white},swatches:{type:Array,default:()=>[[t.default.shades.black,t.default.shades.white,t.default.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:void 0},rounded:{type:String,Number,default:void 0}},emits:["update:modelValue"],setup(a,s){return{checkedVisibilty:e.ref(!1),onSwatchClick:d=>{const i=d.target.dataset.value;!i||a.modelValue===i||s.emit("update:modelValue",i)},shades:t.default.shades}}}),V="",p=(a,s)=>{const o=a.__vccOpts||a;for(const[u,d]of s)o[u]=d;return o};function h(a,s,o,u,d,i){const b=e.resolveComponent("v-icon"),y=e.resolveComponent("v-btn"),w=e.resolveComponent("v-sheet");return e.openBlock(),e.createBlock(w,{class:"v-swatches"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.swatches,(k,g)=>(e.openBlock(),e.createElementBlock("div",{key:g},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k,l=>(e.openBlock(),e.createBlock(y,{key:l,color:l,disabled:a.disabled,height:a.size,value:l,variant:a.variant,width:a.size,"data-value":l,class:e.normalizeClass(l===a.shades.transparent?"bg-trasparent":""),"min-width":"auto",onClick:s[0]||(s[0]=_=>a.onSwatchClick(_))},{default:e.withCtx(()=>[l===a.modelValue?(e.openBlock(),e.createBlock(b,{key:0,size:a.iconSize,color:l!==a.shades.transparent?l:void 0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.icon),1)]),_:2},1032,["size","color"])):e.createCommentVNode("",!0)]),_:2},1032,["color","disabled","height","value","variant","width","data-value","class"]))),128))]))),128))]),_:1})}const r=p(f,[["render",h]]),m=a=>a.component("VSwatches",r);typeof window<"u"&&window.Vue&&window.Vue.use(r),n.default=r,n.install=m,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
12
+ (function (global, factory) {
13
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('vuetify/lib/util/colors.mjs')) :
14
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'vuetify/lib/util/colors.mjs'], factory) :
15
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VSwatches = {}, global.Vue, global.colors));
16
+ })(this, (function (exports, vue, colors) { 'use strict';
17
+
18
+ const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
19
+
20
+ const colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
21
+
22
+ const _sfc_main = vue.defineComponent({
23
+ name: "VSwatches",
24
+ model: {
25
+ prop: "modelValue",
26
+ event: "update:modelValue"
27
+ },
28
+ props: {
29
+ modelValue: { type: String, default: colors__default.default.shades.white },
30
+ swatches: {
31
+ type: Array,
32
+ default: () => [
33
+ [colors__default.default.shades.black, colors__default.default.shades.white, colors__default.default.shades.transparent],
34
+ [
35
+ colors__default.default.red.base,
36
+ colors__default.default.pink.base,
37
+ colors__default.default.purple.base,
38
+ colors__default.default.deepPurple.base,
39
+ colors__default.default.indigo.base,
40
+ colors__default.default.blue.base,
41
+ colors__default.default.lightBlue.base,
42
+ colors__default.default.cyan.base
43
+ ],
44
+ [
45
+ colors__default.default.teal.base,
46
+ colors__default.default.green.base,
47
+ colors__default.default.lightGreen.base,
48
+ colors__default.default.lime.base,
49
+ colors__default.default.yellow.base,
50
+ colors__default.default.amber.base,
51
+ colors__default.default.orange.base,
52
+ colors__default.default.deepOrange.base
53
+ ],
54
+ [colors__default.default.brown.base, colors__default.default.blueGrey.base, colors__default.default.grey.base]
55
+ ]
56
+ },
57
+ size: { type: String, default: "2rem" },
58
+ icon: { type: String, default: "mdi-checkbox-marked-circle" },
59
+ iconSize: { type: String, default: "1rem" },
60
+ variant: {
61
+ type: String,
62
+ default: void 0
63
+ },
64
+ disabled: { type: Boolean, default: void 0 },
65
+ rounded: { type: String, Number, default: void 0 }
66
+ },
67
+ emits: ["update:modelValue"],
68
+ setup(props, context) {
69
+ const checkedVisibilty = vue.ref(false);
70
+ const onSwatchClick = (e) => {
71
+ const value = e.target.dataset.value;
72
+ if (!value || props.modelValue === value) {
73
+ return;
74
+ }
75
+ context.emit("update:modelValue", value);
76
+ };
77
+ return {
78
+ checkedVisibilty,
79
+ onSwatchClick,
80
+ shades: colors__default.default.shades
81
+ };
82
+ }
83
+ });
84
+
85
+ const VSwatches_vue_vue_type_style_index_0_lang = '';
86
+
87
+ const _export_sfc = (sfc, props) => {
88
+ const target = sfc.__vccOpts || sfc;
89
+ for (const [key, val] of props) {
90
+ target[key] = val;
91
+ }
92
+ return target;
93
+ };
94
+
95
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
96
+ const _component_v_icon = vue.resolveComponent("v-icon");
97
+ const _component_v_btn = vue.resolveComponent("v-btn");
98
+ const _component_v_sheet = vue.resolveComponent("v-sheet");
99
+ return vue.openBlock(), vue.createBlock(_component_v_sheet, { class: "v-swatches" }, {
100
+ default: vue.withCtx(() => [
101
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.swatches, (colors, rows) => {
102
+ return vue.openBlock(), vue.createElementBlock("div", { key: rows }, [
103
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(colors, (color) => {
104
+ return vue.openBlock(), vue.createBlock(_component_v_btn, {
105
+ key: color,
106
+ color,
107
+ disabled: _ctx.disabled,
108
+ height: _ctx.size,
109
+ value: color,
110
+ variant: _ctx.variant,
111
+ width: _ctx.size,
112
+ "data-value": color,
113
+ class: vue.normalizeClass(color === _ctx.shades.transparent ? "bg-trasparent" : ""),
114
+ "min-width": "auto",
115
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.onSwatchClick($event))
116
+ }, {
117
+ default: vue.withCtx(() => [
118
+ color === _ctx.modelValue ? (vue.openBlock(), vue.createBlock(_component_v_icon, {
119
+ key: 0,
120
+ size: _ctx.iconSize,
121
+ color: color !== _ctx.shades.transparent ? color : void 0
122
+ }, {
123
+ default: vue.withCtx(() => [
124
+ vue.createTextVNode(vue.toDisplayString(_ctx.icon), 1)
125
+ ]),
126
+ _: 2
127
+ }, 1032, ["size", "color"])) : vue.createCommentVNode("", true)
128
+ ]),
129
+ _: 2
130
+ }, 1032, ["color", "disabled", "height", "value", "variant", "width", "data-value", "class"]);
131
+ }), 128))
132
+ ]);
133
+ }), 128))
134
+ ]),
135
+ _: 1
136
+ });
137
+ }
138
+ const VSwatches = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
139
+
140
+ const installVSwatches = (app) => app.component("VSwatches", VSwatches);
141
+ if (typeof window !== "undefined" && window.Vue) {
142
+ window.Vue.use(VSwatches);
143
+ }
144
+
145
+ exports.default = VSwatches;
146
+ exports.install = installVSwatches;
147
+
148
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
149
+
150
+ }));
package/dist/style.css CHANGED
@@ -5,8 +5,20 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.0
8
+ * @version 1.3.2
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- .v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%) grayscale(100%) contrast(100)}.v-swatches .v-btn.bg-trasparent{background:linear-gradient(to top left,transparent 0,transparent calc(50% - .1rem),#F44336 50%,transparent calc(50% + .1rem),transparent)}.v-swatches .v-btn.bg-trasparent .v-icon{filter:none}
12
+ .v-swatches .v-btn {
13
+ padding: 0 !important;
14
+ margin: 0.1rem;
15
+ }
16
+ .v-swatches .v-btn .v-icon {
17
+ filter: invert(100%) grayscale(100%) contrast(100);
18
+ }
19
+ .v-swatches .v-btn.bg-trasparent {
20
+ background: linear-gradient(to top left, transparent 0, transparent calc(50% - 0.1rem), #F44336 50%, transparent calc(50% + 0.1rem), transparent);
21
+ }
22
+ .v-swatches .v-btn.bg-trasparent .v-icon {
23
+ filter: none;
24
+ }
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.0",
4
+ "version": "1.3.2",
5
5
  "description": "Color Swatch component for Vuetify3.",
6
6
  "keywords": [
7
7
  "vuejs",
@@ -54,10 +54,10 @@
54
54
  "src/components/VSwatches.vue"
55
55
  ],
56
56
  "engines": {
57
- "node": ">=16.17.0",
57
+ "node": ">=16.18.0",
58
58
  "yarn": ">=1.22.10"
59
59
  },
60
- "packageManager": "yarn@3.2.3",
60
+ "packageManager": "yarn@3.2.4",
61
61
  "sideEffects": false,
62
62
  "scripts": {
63
63
  "dev": "vite",
@@ -73,26 +73,27 @@
73
73
  "prepare": "husky install"
74
74
  },
75
75
  "peerDependencies": {
76
- "vue": "^3.2.39",
77
- "vuetify": "^3.0.0-beta.10"
76
+ "vue": "^3.2.41",
77
+ "vuetify": "^3.0.0-beta.15"
78
78
  },
79
79
  "devDependencies": {
80
- "@codemirror/lang-html": "^6.1.1",
81
- "@types/node": "^18.7.18",
82
- "@typescript-eslint/eslint-plugin": "^5.37.0",
83
- "@typescript-eslint/parser": "^5.37.0",
84
- "@vitejs/plugin-vue": "^3.1.0",
80
+ "@codemirror/lang-html": "^6.1.3",
81
+ "@types/node": "^18.11.7",
82
+ "@typescript-eslint/eslint-plugin": "^5.41.0",
83
+ "@typescript-eslint/parser": "^5.41.0",
84
+ "@vitejs/plugin-vue": "^3.2.0",
85
+ "@vue/eslint-config-prettier": "^7.0.0",
85
86
  "@vue/tsconfig": "^0.1.3",
86
87
  "codemirror": "^6.0.1",
87
- "eslint": "^8.23.1",
88
+ "eslint": "^8.26.0",
88
89
  "eslint-config-google": "^0.14.0",
89
90
  "eslint-config-prettier": "^8.5.0",
90
91
  "eslint-import-resolver-alias": "^1.1.2",
91
- "eslint-import-resolver-typescript": "^3.5.1",
92
+ "eslint-import-resolver-typescript": "^3.5.2",
92
93
  "eslint-plugin-import": "^2.26.0",
93
- "eslint-plugin-jsdoc": "^39.3.6",
94
+ "eslint-plugin-jsdoc": "^39.3.25",
94
95
  "eslint-plugin-tsdoc": "^0.2.17",
95
- "eslint-plugin-vue": "^9.4.0",
96
+ "eslint-plugin-vue": "^9.6.0",
96
97
  "eslint-plugin-vuejs-accessibility": "^1.2.0",
97
98
  "eslint-plugin-vuetify": "^1.1.0",
98
99
  "eslint-plugin-yaml": "^0.5.0",
@@ -101,24 +102,24 @@
101
102
  "postcss-html": "^1.5.0",
102
103
  "prettier": "^2.7.1",
103
104
  "rimraf": "^3.0.2",
104
- "rollup-plugin-visualizer": "^5.8.1",
105
- "sass": "1.54.9",
106
- "stylelint": "^14.11.0",
105
+ "rollup-plugin-visualizer": "^5.8.3",
106
+ "sass": "1.55.0",
107
+ "stylelint": "^14.14.0",
107
108
  "stylelint-config-prettier": "^9.0.3",
108
- "stylelint-config-recommended-scss": "^7.0.0",
109
+ "stylelint-config-recommended-scss": "^8.0.0",
109
110
  "stylelint-config-recommended-vue": "^1.4.0",
110
111
  "stylelint-order": "^5.0.0",
111
112
  "stylelint-prettier": "^2.0.0",
112
- "typescript": "^4.8.3",
113
- "vite": "^3.1.0",
113
+ "typescript": "^4.8.4",
114
+ "vite": "^3.2.0",
114
115
  "vite-plugin-banner": "^0.5.0",
115
116
  "vite-plugin-checker": "^0.5.1",
116
- "vite-plugin-vuetify": "^1.0.0-alpha.17",
117
- "vue": "^3.2.39",
118
- "vue-codemirror6": "1.0.1",
117
+ "vite-plugin-vuetify": "^1.0.0",
118
+ "vue": "^3.2.41",
119
+ "vue-codemirror6": "1.0.3",
119
120
  "vue-eslint-parser": "^9.1.0",
120
- "vue-tsc": "^0.40.13",
121
- "vuetify": "^3.0.0-beta.10"
121
+ "vue-tsc": "^1.0.9",
122
+ "vuetify": "^3.0.0-beta.14"
122
123
  },
123
124
  "husky": {
124
125
  "hooks": {