vuetify-swatches 1.6.0 → 1.7.0

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-2023 Masashi Yoshikawa
3
+ Copyright (c) 2022-2024 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/index.es.js CHANGED
@@ -5,45 +5,44 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.6.0
8
+ * @version 1.7.0
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,55 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
108
107
  }
109
108
  },
110
109
  emits: {
111
- "update:modelValue": (value) => true
110
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
111
+ "update:modelValue": (t) => !0
112
112
  },
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
- };
113
+ setup(t, { emit: m }) {
114
+ const h = m, a = t, i = y(e.shades.white), p = (n) => i.value = n.target.value || e.shades.white;
115
+ return w(
116
+ () => i.value,
117
+ (n) => h("update:modelValue", n)
118
+ ), S(() => {
119
+ a.modelValue && (i.value = a.modelValue);
120
+ }), (n, G) => (l(), d(r(C), { class: "v-swatches" }, {
121
+ default: o(() => [
122
+ (l(!0), u(c, null, b(t.swatches, (f, v) => (l(), u("div", { key: v }, [
123
+ (l(!0), u(c, null, b(f, (s) => (l(), d(r(x), {
124
+ key: s,
125
+ border: a.border,
126
+ class: V(s === r(e).shades.transparent ? "bg-trasparent" : ""),
127
+ color: s,
128
+ disabled: a.disabled,
129
+ elevation: a.elevation,
130
+ height: a.size,
131
+ value: s,
132
+ variant: a.variant,
133
+ width: a.size,
134
+ "min-width": "auto",
135
+ onClick: p
136
+ }, {
137
+ default: o(() => [
138
+ s === t.modelValue ? (l(), d(r(N), {
139
+ key: 0,
140
+ size: t.iconSize,
141
+ color: s !== r(e).shades.transparent ? s : void 0
142
+ }, {
143
+ default: o(() => [
144
+ k(z(a.icon), 1)
145
+ ]),
146
+ _: 2
147
+ }, 1032, ["size", "color"])) : B("", !0)
148
+ ]),
149
+ _: 2
150
+ }, 1032, ["border", "class", "color", "disabled", "elevation", "height", "value", "variant", "width"]))), 128))
151
+ ]))), 128))
152
+ ]),
153
+ _: 1
154
+ }));
168
155
  }
169
156
  });
170
-
171
- const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
172
-
173
- export { _sfc_main as default, installVSwatches as install };
157
+ const F = (t) => t.component("VSwatches", _);
158
+ export {
159
+ _ as default,
160
+ F as install
161
+ };
@@ -5,175 +5,8 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.6.0
8
+ * @version 1.7.0
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
@@ -5,176 +5,8 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.6.0
8
+ * @version 1.7.0
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
@@ -5,22 +5,8 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.6.0
8
+ * @version 1.7.0
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.6.0",
4
+ "version": "1.7.0",
5
5
  "description": "Color Swatch component for Vuetify3.",
6
6
  "keywords": [
7
7
  "vuejs",
@@ -61,9 +61,10 @@
61
61
  "src/components/VSwatches.vue"
62
62
  ],
63
63
  "engines": {
64
- "yarn": ">=1.22.19"
64
+ "node": ">=20.16.0",
65
+ "pnpm": ">=9.6.0"
65
66
  },
66
- "packageManager": "yarn@4.0.2",
67
+ "packageManager": "pnpm@9.7.0",
67
68
  "sideEffects": false,
68
69
  "scripts": {
69
70
  "dev": "vite",
@@ -76,52 +77,48 @@
76
77
  "build-only": "vite build",
77
78
  "lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
78
79
  "preview": "vite preview --mode=docs",
79
- "prepare": "husky install",
80
+ "prepare": "husky",
80
81
  "version": "auto-changelog -p && git add CHANGELOG.md"
81
82
  },
82
83
  "peerDependencies": {
83
- "vuetify": "^3.3.15"
84
+ "vuetify": "^3.5.17"
84
85
  },
85
86
  "devDependencies": {
86
- "@codemirror/lang-vue": "0.1.2",
87
- "@tsconfig/node-lts": "^20.1.1",
88
- "@types/node": "^20.11.5",
89
- "@typescript-eslint/eslint-plugin": "^6.19.1",
90
- "@typescript-eslint/parser": "^6.19.1",
91
- "@vitejs/plugin-vue": "^5.0.3",
87
+ "@codemirror/lang-vue": "0.1.3",
88
+ "@eslint/js": "^9.9.0",
89
+ "@tsconfig/node-lts": "^20.1.3",
90
+ "@types/node": "^22.2.0",
91
+ "@vitejs/plugin-vue": "^5.1.2",
92
92
  "@vue/eslint-config-prettier": "^9.0.0",
93
93
  "@vue/tsconfig": "^0.5.1",
94
- "eslint": "^8.56.0",
95
- "eslint-config-standard-with-typescript": "^43.0.1",
94
+ "eslint": "^9.9.0",
96
95
  "eslint-import-resolver-alias": "^1.1.2",
97
96
  "eslint-import-resolver-typescript": "^3.6.1",
98
- "eslint-plugin-html": "^7.1.0",
99
97
  "eslint-plugin-import": "^2.29.1",
100
- "eslint-plugin-n": "^16.6.2",
101
- "eslint-plugin-promise": "^6.1.1",
102
- "eslint-plugin-tsdoc": "^0.2.17",
103
- "eslint-plugin-vue": "^9.20.1",
104
- "eslint-plugin-vuejs-accessibility": "^2.2.1",
105
- "eslint-plugin-vuetify": "^2.1.1",
106
- "eslint-plugin-yaml": "^0.5.0",
107
- "husky": "^8.0.3",
108
- "lint-staged": "^15.2.0",
98
+ "eslint-plugin-tsdoc": "^0.3.0",
99
+ "eslint-plugin-vue": "^9.27.0",
100
+ "eslint-plugin-vuejs-accessibility": "^2.4.1",
101
+ "eslint-plugin-vuetify": "^2.4.0",
102
+ "eslint-plugin-yaml": "^1.0.3",
103
+ "husky": "^9.1.4",
104
+ "lint-staged": "^15.2.8",
109
105
  "npm-run-all": "^4.1.5",
110
- "prettier": "^3.2.4",
111
- "rimraf": "^5.0.5",
106
+ "prettier": "^3.3.3",
107
+ "rimraf": "^6.0.1",
112
108
  "rollup-plugin-visualizer": "^5.12.0",
113
- "sass": "^1.70.0",
114
- "typescript": "^5.3.3",
115
- "vite": "^5.0.12",
109
+ "sass": "^1.77.8",
110
+ "typescript": "^5.5.4",
111
+ "typescript-eslint": "^8.0.1",
112
+ "vite": "^5.4.0",
116
113
  "vite-plugin-banner": "^0.7.1",
117
- "vite-plugin-checker": "^0.6.2",
118
- "vite-plugin-dts": "^3.7.1",
119
- "vite-plugin-vuetify": "^2.0.1",
120
- "vue": "^3.4.15",
121
- "vue-codemirror6": "^1.2.3",
122
- "vue-eslint-parser": "^9.4.1",
123
- "vue-tsc": "^1.8.27",
124
- "vuetify": "^3.5.1"
114
+ "vite-plugin-checker": "^0.7.2",
115
+ "vite-plugin-dts": "^4.0.2",
116
+ "vite-plugin-vuetify": "^2.0.4",
117
+ "vue": "^3.4.37",
118
+ "vue-codemirror6": "^1.3.4",
119
+ "vue-eslint-parser": "^9.4.3",
120
+ "vue-tsc": "^2.0.29",
121
+ "vuetify": "^3.6.14"
125
122
  },
126
123
  "husky": {
127
124
  "hooks": {
@@ -134,9 +131,14 @@
134
131
  "*": "prettier -w -u"
135
132
  },
136
133
  "resolutions": {
137
- "http-cache-semantics": "^4.1.1",
138
- "json5": "^2.2.3",
139
- "semver": "^7.5.2",
140
- "yaml": "^2.2.2"
134
+ "get-func-name": ">=2.0.2",
135
+ "ip": ">=2.0.1",
136
+ "json5": ">=2.2.3",
137
+ "lodash": ">=4.17.21",
138
+ "postcss": ">=8.4.31",
139
+ "semver": ">=7.5.3",
140
+ "tar": ">=6.2.1",
141
+ "vite": ">=5.0.12",
142
+ "yaml": ">=2.3.2"
141
143
  }
142
144
  }
@@ -3,64 +3,44 @@
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({
31
- 'update:modelValue': (value: string) => true,
10
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
11
+ 'update:modelValue': (_value: string) => true,
32
12
  });
33
13
 
34
14
  /** Props */
35
15
  const props = defineProps({
36
16
  /** Model value */
37
- modelValue: { type: String, default: shades.white },
17
+ modelValue: { type: String, default: colors.shades.white },
38
18
  /** Swatch colors */
39
19
  swatches: {
40
20
  type: Array as PropType<string[] | string[][] | Record<string, string[]>>,
41
21
  default: () => [
42
- [shades.black, shades.white, shades.transparent],
22
+ [colors.shades.black, colors.shades.white, colors.shades.transparent],
43
23
  [
44
- red.base,
45
- pink.base,
46
- purple.base,
47
- deepPurple.base,
48
- indigo.base,
49
- blue.base,
50
- lightBlue.base,
51
- cyan.base,
24
+ colors.red.base,
25
+ colors.pink.base,
26
+ colors.purple.base,
27
+ colors.deepPurple.base,
28
+ colors.indigo.base,
29
+ colors.blue.base,
30
+ colors.lightBlue.base,
31
+ colors.cyan.base,
52
32
  ],
53
33
  [
54
- teal.base,
55
- green.base,
56
- lightGreen.base,
57
- lime.base,
58
- yellow.base,
59
- amber.base,
60
- orange.base,
61
- deepOrange.base,
34
+ colors.teal.base,
35
+ colors.green.base,
36
+ colors.lightGreen.base,
37
+ colors.lime.base,
38
+ colors.yellow.base,
39
+ colors.amber.base,
40
+ colors.orange.base,
41
+ colors.deepOrange.base,
62
42
  ],
63
- [brown.base, blueGrey.base, grey.base],
43
+ [colors.brown.base, colors.blueGrey.base, colors.grey.base],
64
44
  ],
65
45
  },
66
46
  /** Swatch size */
@@ -128,7 +108,7 @@ const props = defineProps({
128
108
  });
129
109
 
130
110
  /** Selected Color */
131
- const selected: Ref<string> = ref(shades.white);
111
+ const selected: Ref<string> = ref(colors.shades.white);
132
112
 
133
113
  /**
134
114
  * Swatch button clicked handler
@@ -136,7 +116,8 @@ const selected: Ref<string> = ref(shades.white);
136
116
  * @param e - Event
137
117
  */
138
118
  const onSwatchClick = (e: Event) =>
139
- (selected.value = (e.target as HTMLButtonElement).value || shades.white);
119
+ (selected.value =
120
+ (e.target as HTMLButtonElement).value || colors.shades.white);
140
121
 
141
122
  watch(
142
123
  () => selected.value,
@@ -157,7 +138,7 @@ onMounted(() => {
157
138
  v-for="color in cols"
158
139
  :key="color"
159
140
  :border="props.border"
160
- :class="color === shades.transparent ? 'bg-trasparent' : ''"
141
+ :class="color === colors.shades.transparent ? 'bg-trasparent' : ''"
161
142
  :color="color"
162
143
  :disabled="props.disabled"
163
144
  :elevation="props.elevation"
@@ -171,7 +152,7 @@ onMounted(() => {
171
152
  <v-icon
172
153
  v-if="color === modelValue"
173
154
  :size="iconSize"
174
- :color="color !== shades.transparent ? color : undefined"
155
+ :color="color !== colors.shades.transparent ? color : undefined"
175
156
  >
176
157
  {{ props.icon }}
177
158
  </v-icon>
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import VSwatches from './components/VSwatches.vue';
2
- declare const installVSwatches: (app: any) => void;
3
- export { VSwatches as default, installVSwatches as install };