vuetify-swatches 2.1.0 → 2.1.1

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/dist/index.es.js CHANGED
@@ -5,268 +5,253 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2026 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 2.0.1
8
+ * @version 2.1.1
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- import { defineComponent as B, openBlock as n, createBlock as c, unref as r, withCtx as p, createVNode as z, mergeProps as C, createCommentVNode as x, computed as N, ref as L, watch as S, normalizeClass as A, createElementBlock as f, Fragment as b, renderList as y } from "vue";
13
- import { VTooltip as I, VBtn as g, VIcon as j, VItemGroup as $, VItem as k } from "vuetify/components";
14
- import m from "vuetify/util/colors";
15
- function E(...l) {
16
- let d = 0;
17
- for (let i = 0; i < l.length; i++)
18
- l[i].length > d && (d = l[i].length);
19
- const t = l.length, e = Array(d);
20
- for (let i = 0; i < d; ++i) {
21
- const a = Array(t);
22
- for (let o = 0; o < t; ++o)
23
- a[o] = l[o][i];
24
- e[i] = a;
25
- }
26
- return e;
12
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createVNode as a, defineComponent as o, mergeProps as s, normalizeClass as c, openBlock as l, ref as u, renderList as d, unref as f, watch as p, withCtx as m } from "vue";
13
+ import { VBtn as h, VIcon as g, VItem as _, VItemGroup as v, VTooltip as y } from "vuetify/components";
14
+ import b from "vuetify/util/colors";
15
+ //#region node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/array/zip.mjs
16
+ function x(...e) {
17
+ let t = 0;
18
+ for (let n = 0; n < e.length; n++) e[n].length > t && (t = e[n].length);
19
+ let n = e.length, r = Array(t);
20
+ for (let i = 0; i < t; ++i) {
21
+ let t = Array(n);
22
+ for (let r = 0; r < n; ++r) t[r] = e[r][i];
23
+ r[i] = t;
24
+ }
25
+ return r;
27
26
  }
28
- var w = /* @__PURE__ */ B({
29
- __name: "SwatchButton",
30
- props: {
31
- color: { default: void 0 },
32
- isSelected: { type: Boolean, default: !1 },
33
- size: { default: "2rem" },
34
- icon: { default: "mdi-checkbox-marked-circle" },
35
- iconSize: { default: "1rem" },
36
- variant: { default: void 0 },
37
- disabled: { type: Boolean, default: !1 },
38
- rounded: { type: [String, Number, Boolean], default: void 0 },
39
- border: { type: [String, Number, Boolean], default: !1 },
40
- elevation: { default: void 0 },
41
- tooltip: { type: Boolean, default: !1 },
42
- tooltipLocation: { default: void 0 }
43
- },
44
- emits: ["click"],
45
- setup(l, { emit: d }) {
46
- const t = l, e = d;
47
- return (i, a) => t.color ? (n(), c(r(I), {
48
- key: 0,
49
- disabled: !t.tooltip,
50
- location: t.tooltipLocation,
51
- text: t.color
52
- }, {
53
- activator: p(({ props: o }) => [
54
- z(r(g), C(o, {
55
- border: t.border,
56
- class: [
57
- t.color === r(m).shades.transparent ? "bg-transparent" : "",
58
- "p-0"
59
- ],
60
- color: t.color,
61
- disabled: t.disabled,
62
- elevation: t.elevation,
63
- height: t.size,
64
- variant: t.variant,
65
- width: t.size,
66
- "min-width": "auto",
67
- onClick: a[0] || (a[0] = (v) => e("click"))
68
- }), {
69
- default: p(() => [
70
- t.isSelected ? (n(), c(r(j), {
71
- key: 0,
72
- size: t.iconSize,
73
- color: t.color !== r(m).shades.transparent ? t.color : void 0,
74
- icon: t.icon
75
- }, null, 8, ["size", "color", "icon"])) : x("", !0)
76
- ]),
77
- _: 1
78
- }, 16, ["border", "class", "color", "disabled", "elevation", "height", "variant", "width"])
79
- ]),
80
- _: 1
81
- }, 8, ["disabled", "location", "text"])) : (n(), c(r(g), {
82
- key: 1,
83
- height: t.size,
84
- width: t.size,
85
- class: "p-0",
86
- disabled: "",
87
- "min-width": "auto",
88
- variant: "text"
89
- }, null, 8, ["height", "width"]));
90
- }
91
- }), F = /* @__PURE__ */ B({
92
- __name: "VSwatches",
93
- props: {
94
- /** Model value */
95
- modelValue: { type: String, default: m.shades.white },
96
- /** Swatch colors */
97
- swatches: {
98
- type: Array,
99
- default: () => []
100
- },
101
- /** Swatch size */
102
- size: {
103
- type: String,
104
- default: "2rem"
105
- },
106
- /**
107
- * Selected icon
108
- * @see {@link https://vuetifyjs.com/en/components/icons/#usage
109
- */
110
- icon: {
111
- type: String,
112
- default: "mdi-checkbox-marked-circle"
113
- },
114
- /** selected icon size */
115
- iconSize: {
116
- type: String,
117
- default: "1rem"
118
- },
119
- /** Display swatches in a single row */
120
- inline: {
121
- type: Boolean,
122
- default: !1
123
- },
124
- /**
125
- * The variant prop gives you easy access to several different button styles..
126
- *
127
- * @see {@link https://vuetifyjs.com/en/components/buttons/#variant}
128
- */
129
- variant: {
130
- type: String,
131
- default: void 0
132
- },
133
- /**
134
- * Removes the ability to click or target the component.
135
- *
136
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
137
- */
138
- disabled: {
139
- type: Boolean,
140
- default: !1
141
- },
142
- /**
143
- * Applies a large border radius on the button.
144
- *
145
- * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
146
- */
147
- rounded: {
148
- type: [String, Number, Boolean],
149
- default: void 0
150
- },
151
- /**
152
- * Applies border styles to component.
153
- *
154
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-border}
155
- */
156
- border: {
157
- type: [String, Number, Boolean],
158
- default: !1
159
- },
160
- /**
161
- * Designates an elevation applied to the component between 0 and 24.
162
- *
163
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
164
- */
165
- elevation: {
166
- type: [String, Number],
167
- default: void 0
168
- },
169
- /** Swap cols and rows */
170
- transpose: {
171
- type: Boolean,
172
- default: !1
173
- },
174
- /**
175
- * Tooltip
176
- * @see {@link https://vuetifyjs.com/en/components/tooltips/}
177
- */
178
- tooltip: {
179
- type: Boolean,
180
- default: !1
181
- },
182
- /**
183
- * Tooltip location
184
- * @see {@link https://vuetifyjs.com/en/components/tooltips/#props-location}
185
- */
186
- tooltipLocation: {
187
- type: String,
188
- default: void 0
189
- }
190
- },
191
- emits: {
192
- // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
193
- "update:modelValue": (l) => !0
194
- },
195
- setup(l, { emit: d }) {
196
- const t = d, e = l, i = N(() => {
197
- const o = Array.isArray(e.swatches) ? e.swatches : Object.values(e.swatches);
198
- return e.inline ? [o.flat(1 / 0)] : e.transpose ? E(...o) : o;
199
- }), a = L(m.shades.white);
200
- return S(
201
- () => a.value,
202
- (o) => t("update:modelValue", o)
203
- ), S(
204
- () => e.modelValue,
205
- (o) => {
206
- o && (a.value = o);
207
- },
208
- { immediate: !0 }
209
- ), (o, v) => (n(), c(r($), {
210
- modelValue: a.value,
211
- "onUpdate:modelValue": v[0] || (v[0] = (s) => a.value = s),
212
- class: A([{ "d-inline": e.inline }, "v-swatches"]),
213
- mandatory: ""
214
- }, {
215
- default: p(() => [
216
- e.inline ? (n(!0), f(b, { key: 0 }, y(i.value[0], (s) => (n(), c(r(k), {
217
- key: s,
218
- value: s
219
- }, {
220
- default: p(({ isSelected: h, toggle: u }) => [
221
- z(w, {
222
- border: e.border,
223
- color: s,
224
- disabled: e.disabled,
225
- elevation: e.elevation,
226
- "icon-size": e.iconSize,
227
- icon: e.icon,
228
- "is-selected": h,
229
- rounded: e.rounded,
230
- size: e.size,
231
- "tooltip-location": e.tooltipLocation,
232
- tooltip: e.tooltip,
233
- variant: e.variant,
234
- onClick: u
235
- }, null, 8, ["border", "color", "disabled", "elevation", "icon-size", "icon", "is-selected", "rounded", "size", "tooltip-location", "tooltip", "variant", "onClick"])
236
- ]),
237
- _: 2
238
- }, 1032, ["value"]))), 128)) : (n(!0), f(b, { key: 1 }, y(i.value, (s, h) => (n(), f("div", { key: h }, [
239
- (n(!0), f(b, null, y(s, (u) => (n(), c(r(k), {
240
- key: u,
241
- value: u
242
- }, {
243
- default: p(({ isSelected: V, toggle: _ }) => [
244
- z(w, {
245
- border: e.border,
246
- color: u,
247
- disabled: e.disabled,
248
- elevation: e.elevation,
249
- "icon-size": e.iconSize,
250
- icon: e.icon,
251
- "is-selected": V,
252
- rounded: e.rounded,
253
- size: e.size,
254
- "tooltip-location": e.tooltipLocation,
255
- tooltip: e.tooltip,
256
- variant: e.variant,
257
- onClick: _
258
- }, null, 8, ["border", "color", "disabled", "elevation", "icon-size", "icon", "is-selected", "rounded", "size", "tooltip-location", "tooltip", "variant", "onClick"])
259
- ]),
260
- _: 2
261
- }, 1032, ["value"]))), 128))
262
- ]))), 128))
263
- ]),
264
- _: 1
265
- }, 8, ["modelValue", "class"]));
266
- }
267
- });
268
- const T = (l) => l.component("VSwatches", F);
269
- export {
270
- F as default,
271
- T as install
272
- };
27
+ //#endregion
28
+ //#region src/components/SwatchButton.vue
29
+ var S = /* @__PURE__ */ o({
30
+ __name: "SwatchButton",
31
+ props: {
32
+ color: { default: void 0 },
33
+ isSelected: {
34
+ type: Boolean,
35
+ default: !1
36
+ },
37
+ size: { default: "2rem" },
38
+ icon: { default: "mdi-checkbox-marked-circle" },
39
+ iconSize: { default: "1rem" },
40
+ variant: { default: void 0 },
41
+ disabled: {
42
+ type: Boolean,
43
+ default: !1
44
+ },
45
+ rounded: {
46
+ type: [
47
+ String,
48
+ Number,
49
+ Boolean
50
+ ],
51
+ default: void 0
52
+ },
53
+ border: {
54
+ type: [
55
+ String,
56
+ Number,
57
+ Boolean
58
+ ],
59
+ default: !1
60
+ },
61
+ elevation: { default: void 0 },
62
+ tooltip: {
63
+ type: Boolean,
64
+ default: !1
65
+ },
66
+ tooltipLocation: { default: void 0 }
67
+ },
68
+ emits: ["click"],
69
+ setup(e, { emit: t }) {
70
+ let i = e, o = t;
71
+ return (e, t) => i.color ? (l(), n(f(y), {
72
+ key: 0,
73
+ disabled: !i.tooltip,
74
+ location: i.tooltipLocation,
75
+ text: i.color
76
+ }, {
77
+ activator: m(({ props: e }) => [a(f(h), s(e, {
78
+ border: i.border,
79
+ class: [i.color === f(b).shades.transparent ? "bg-transparent" : "", "p-0"],
80
+ color: i.color,
81
+ disabled: i.disabled,
82
+ elevation: i.elevation,
83
+ height: i.size,
84
+ variant: i.variant,
85
+ width: i.size,
86
+ "min-width": "auto",
87
+ onClick: t[0] ||= (e) => o("click")
88
+ }), {
89
+ default: m(() => [i.isSelected ? (l(), n(f(g), {
90
+ key: 0,
91
+ size: i.iconSize,
92
+ color: i.color === f(b).shades.transparent ? void 0 : i.color,
93
+ icon: i.icon
94
+ }, null, 8, [
95
+ "size",
96
+ "color",
97
+ "icon"
98
+ ])) : r("", !0)]),
99
+ _: 1
100
+ }, 16, [
101
+ "border",
102
+ "class",
103
+ "color",
104
+ "disabled",
105
+ "elevation",
106
+ "height",
107
+ "variant",
108
+ "width"
109
+ ])]),
110
+ _: 1
111
+ }, 8, [
112
+ "disabled",
113
+ "location",
114
+ "text"
115
+ ])) : (l(), n(f(h), {
116
+ key: 1,
117
+ height: i.size,
118
+ width: i.size,
119
+ class: "p-0",
120
+ "min-width": "auto",
121
+ variant: "text",
122
+ disabled: ""
123
+ }, null, 8, ["height", "width"]));
124
+ }
125
+ }), C = /* @__PURE__ */ o({
126
+ __name: "VSwatches",
127
+ props: {
128
+ modelValue: { default: b.shades.white },
129
+ swatches: { default: () => [] },
130
+ size: { default: "2rem" },
131
+ icon: { default: "mdi-checkbox-marked-circle" },
132
+ iconSize: { default: "1rem" },
133
+ inline: {
134
+ type: Boolean,
135
+ default: !1
136
+ },
137
+ variant: { default: void 0 },
138
+ disabled: {
139
+ type: Boolean,
140
+ default: !1
141
+ },
142
+ rounded: {
143
+ type: [
144
+ String,
145
+ Number,
146
+ Boolean
147
+ ],
148
+ default: void 0
149
+ },
150
+ border: {
151
+ type: [
152
+ String,
153
+ Number,
154
+ Boolean
155
+ ],
156
+ default: !1
157
+ },
158
+ elevation: { default: void 0 },
159
+ transpose: {
160
+ type: Boolean,
161
+ default: !1
162
+ },
163
+ tooltip: {
164
+ type: Boolean,
165
+ default: !1
166
+ },
167
+ tooltipLocation: { default: void 0 }
168
+ },
169
+ emits: ["update:modelValue"],
170
+ setup(r, { emit: o }) {
171
+ let s = o, h = r, g = t(() => {
172
+ let e = Array.isArray(h.swatches) ? h.swatches : Object.values(h.swatches);
173
+ return h.inline ? [e.flat(Infinity)] : h.transpose ? x(...e) : e;
174
+ }), y = u(b.shades.white);
175
+ return p(() => y.value, (e) => s("update:modelValue", e)), p(() => h.modelValue, (e) => {
176
+ e && (y.value = e);
177
+ }, { immediate: !0 }), (t, r) => (l(), n(f(v), {
178
+ modelValue: y.value,
179
+ "onUpdate:modelValue": r[0] ||= (e) => y.value = e,
180
+ class: c([{ "d-inline": h.inline }, "v-swatches"]),
181
+ mandatory: ""
182
+ }, {
183
+ default: m(() => [h.inline ? (l(!0), i(e, { key: 0 }, d(g.value[0], (e) => (l(), n(f(_), {
184
+ key: e,
185
+ value: e
186
+ }, {
187
+ default: m(({ isSelected: t, toggle: n }) => [a(S, {
188
+ border: h.border,
189
+ color: e,
190
+ disabled: h.disabled,
191
+ elevation: h.elevation,
192
+ "icon-size": h.iconSize,
193
+ icon: h.icon,
194
+ "is-selected": t,
195
+ rounded: h.rounded,
196
+ size: h.size,
197
+ "tooltip-location": h.tooltipLocation,
198
+ tooltip: h.tooltip,
199
+ variant: h.variant,
200
+ onClick: n
201
+ }, null, 8, [
202
+ "border",
203
+ "color",
204
+ "disabled",
205
+ "elevation",
206
+ "icon-size",
207
+ "icon",
208
+ "is-selected",
209
+ "rounded",
210
+ "size",
211
+ "tooltip-location",
212
+ "tooltip",
213
+ "variant",
214
+ "onClick"
215
+ ])]),
216
+ _: 2
217
+ }, 1032, ["value"]))), 128)) : (l(!0), i(e, { key: 1 }, d(g.value, (t, r) => (l(), i("div", { key: r }, [(l(!0), i(e, null, d(t, (e) => (l(), n(f(_), {
218
+ key: e,
219
+ value: e
220
+ }, {
221
+ default: m(({ isSelected: t, toggle: n }) => [a(S, {
222
+ border: h.border,
223
+ color: e,
224
+ disabled: h.disabled,
225
+ elevation: h.elevation,
226
+ "icon-size": h.iconSize,
227
+ icon: h.icon,
228
+ "is-selected": t,
229
+ rounded: h.rounded,
230
+ size: h.size,
231
+ "tooltip-location": h.tooltipLocation,
232
+ tooltip: h.tooltip,
233
+ variant: h.variant,
234
+ onClick: n
235
+ }, null, 8, [
236
+ "border",
237
+ "color",
238
+ "disabled",
239
+ "elevation",
240
+ "icon-size",
241
+ "icon",
242
+ "is-selected",
243
+ "rounded",
244
+ "size",
245
+ "tooltip-location",
246
+ "tooltip",
247
+ "variant",
248
+ "onClick"
249
+ ])]),
250
+ _: 2
251
+ }, 1032, ["value"]))), 128))]))), 128))]),
252
+ _: 1
253
+ }, 8, ["modelValue", "class"]));
254
+ }
255
+ }), w = (e) => e.component("VSwatches", C);
256
+ //#endregion
257
+ export { C as default, w as install };
@@ -5,8 +5,8 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2026 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 2.0.1
8
+ * @version 2.1.1
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- var VSwatches=(function(f,e,d,b){"use strict";function y(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var u=y(b);function B(...l){let r=0;for(let a=0;a<l.length;a++)l[a].length>r&&(r=l[a].length);const o=l.length,t=Array(r);for(let a=0;a<r;++a){const n=Array(o);for(let i=0;i<o;++i)n[i]=l[i][a];t[a]=n}return t}var h=e.defineComponent({__name:"SwatchButton",props:{color:{default:void 0},isSelected:{type:Boolean,default:!1},size:{default:"2rem"},icon:{default:"mdi-checkbox-marked-circle"},iconSize:{default:"1rem"},variant:{default:void 0},disabled:{type:Boolean,default:!1},rounded:{type:[String,Number,Boolean],default:void 0},border:{type:[String,Number,Boolean],default:!1},elevation:{default:void 0},tooltip:{type:Boolean,default:!1},tooltipLocation:{default:void 0}},emits:["click"],setup(l,{emit:r}){const o=l,t=r;return(a,n)=>o.color?(e.openBlock(),e.createBlock(e.unref(d.VTooltip),{key:0,disabled:!o.tooltip,location:o.tooltipLocation,text:o.color},{activator:e.withCtx(({props:i})=>[e.createVNode(e.unref(d.VBtn),e.mergeProps(i,{border:o.border,class:[o.color===e.unref(u.default).shades.transparent?"bg-transparent":"","p-0"],color:o.color,disabled:o.disabled,elevation:o.elevation,height:o.size,variant:o.variant,width:o.size,"min-width":"auto",onClick:n[0]||(n[0]=p=>t("click"))}),{default:e.withCtx(()=>[o.isSelected?(e.openBlock(),e.createBlock(e.unref(d.VIcon),{key:0,size:o.iconSize,color:o.color!==e.unref(u.default).shades.transparent?o.color:void 0,icon:o.icon},null,8,["size","color","icon"])):e.createCommentVNode("",!0)]),_:1},16,["border","class","color","disabled","elevation","height","variant","width"])]),_:1},8,["disabled","location","text"])):(e.openBlock(),e.createBlock(e.unref(d.VBtn),{key:1,height:o.size,width:o.size,class:"p-0",disabled:"","min-width":"auto",variant:"text"},null,8,["height","width"]))}}),k=e.defineComponent({__name:"VSwatches",props:{modelValue:{type:String,default:u.default.shades.white},swatches:{type:Array,default:()=>[]},size:{type:String,default:"2rem"},icon:{type:String,default:"mdi-checkbox-marked-circle"},iconSize:{type:String,default:"1rem"},inline:{type:Boolean,default:!1},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},transpose:{type:Boolean,default:!1},tooltip:{type:Boolean,default:!1},tooltipLocation:{type:String,default:void 0}},emits:{"update:modelValue":l=>!0},setup(l,{emit:r}){const o=r,t=l,a=e.computed(()=>{const i=Array.isArray(t.swatches)?t.swatches:Object.values(t.swatches);return t.inline?[i.flat(1/0)]:t.transpose?B(...i):i}),n=e.ref(u.default.shades.white);return e.watch(()=>n.value,i=>o("update:modelValue",i)),e.watch(()=>t.modelValue,i=>{i&&(n.value=i)},{immediate:!0}),(i,p)=>(e.openBlock(),e.createBlock(e.unref(d.VItemGroup),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=c=>n.value=c),class:e.normalizeClass([{"d-inline":t.inline},"v-swatches"]),mandatory:""},{default:e.withCtx(()=>[t.inline?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(a.value[0],c=>(e.openBlock(),e.createBlock(e.unref(d.VItem),{key:c,value:c},{default:e.withCtx(({isSelected:m,toggle:s})=>[e.createVNode(h,{border:t.border,color:c,disabled:t.disabled,elevation:t.elevation,"icon-size":t.iconSize,icon:t.icon,"is-selected":m,rounded:t.rounded,size:t.size,"tooltip-location":t.tooltipLocation,tooltip:t.tooltip,variant:t.variant,onClick:s},null,8,["border","color","disabled","elevation","icon-size","icon","is-selected","rounded","size","tooltip-location","tooltip","variant","onClick"])]),_:2},1032,["value"]))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.value,(c,m)=>(e.openBlock(),e.createElementBlock("div",{key:m},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c,s=>(e.openBlock(),e.createBlock(e.unref(d.VItem),{key:s,value:s},{default:e.withCtx(({isSelected:z,toggle:S})=>[e.createVNode(h,{border:t.border,color:s,disabled:t.disabled,elevation:t.elevation,"icon-size":t.iconSize,icon:t.icon,"is-selected":z,rounded:t.rounded,size:t.size,"tooltip-location":t.tooltipLocation,tooltip:t.tooltip,variant:t.variant,onClick:S},null,8,["border","color","disabled","elevation","icon-size","icon","is-selected","rounded","size","tooltip-location","tooltip","variant","onClick"])]),_:2},1032,["value"]))),128))]))),128))]),_:1},8,["modelValue","class"]))}});const w=l=>l.component("VSwatches",k);return f.default=k,f.install=w,Object.defineProperty(f,"__esModule",{value:!0}),f})({},Vue,Vuetify/components,colors);
12
+ var VSwatches=(function(e,t,n,r){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=s(t),c=0,u=i.length,d;c<u;c++)d=i[c],!l.call(e,d)&&d!==n&&a(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=o(t,d))||r.enumerable});return e};r=((e,t,n)=>(n=e==null?{}:i(c(e)),u(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e)))(r,1);function d(...e){let t=0;for(let n=0;n<e.length;n++)e[n].length>t&&(t=e[n].length);let n=e.length,r=Array(t);for(let i=0;i<t;++i){let t=Array(n);for(let r=0;r<n;++r)t[r]=e[r][i];r[i]=t}return r}var f=(0,t.defineComponent)({__name:`SwatchButton`,props:{color:{default:void 0},isSelected:{type:Boolean,default:!1},size:{default:`2rem`},icon:{default:`mdi-checkbox-marked-circle`},iconSize:{default:`1rem`},variant:{default:void 0},disabled:{type:Boolean,default:!1},rounded:{type:[String,Number,Boolean],default:void 0},border:{type:[String,Number,Boolean],default:!1},elevation:{default:void 0},tooltip:{type:Boolean,default:!1},tooltipLocation:{default:void 0}},emits:[`click`],setup(e,{emit:i}){let a=e,o=i;return(e,i)=>a.color?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VTooltip),{key:0,disabled:!a.tooltip,location:a.tooltipLocation,text:a.color},{activator:(0,t.withCtx)(({props:e})=>[(0,t.createVNode)((0,t.unref)(n.VBtn),(0,t.mergeProps)(e,{border:a.border,class:[a.color===(0,t.unref)(r.default).shades.transparent?`bg-transparent`:``,`p-0`],color:a.color,disabled:a.disabled,elevation:a.elevation,height:a.size,variant:a.variant,width:a.size,"min-width":`auto`,onClick:i[0]||=e=>o(`click`)}),{default:(0,t.withCtx)(()=>[a.isSelected?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VIcon),{key:0,size:a.iconSize,color:a.color===(0,t.unref)(r.default).shades.transparent?void 0:a.color,icon:a.icon},null,8,[`size`,`color`,`icon`])):(0,t.createCommentVNode)(``,!0)]),_:1},16,[`border`,`class`,`color`,`disabled`,`elevation`,`height`,`variant`,`width`])]),_:1},8,[`disabled`,`location`,`text`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VBtn),{key:1,height:a.size,width:a.size,class:`p-0`,"min-width":`auto`,variant:`text`,disabled:``},null,8,[`height`,`width`]))}}),p=(0,t.defineComponent)({__name:`VSwatches`,props:{modelValue:{default:r.default.shades.white},swatches:{default:()=>[]},size:{default:`2rem`},icon:{default:`mdi-checkbox-marked-circle`},iconSize:{default:`1rem`},inline:{type:Boolean,default:!1},variant:{default:void 0},disabled:{type:Boolean,default:!1},rounded:{type:[String,Number,Boolean],default:void 0},border:{type:[String,Number,Boolean],default:!1},elevation:{default:void 0},transpose:{type:Boolean,default:!1},tooltip:{type:Boolean,default:!1},tooltipLocation:{default:void 0}},emits:[`update:modelValue`],setup(e,{emit:i}){let a=i,o=e,s=(0,t.computed)(()=>{let e=Array.isArray(o.swatches)?o.swatches:Object.values(o.swatches);return o.inline?[e.flat(1/0)]:o.transpose?d(...e):e}),c=(0,t.ref)(r.default.shades.white);return(0,t.watch)(()=>c.value,e=>a(`update:modelValue`,e)),(0,t.watch)(()=>o.modelValue,e=>{e&&(c.value=e)},{immediate:!0}),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VItemGroup),{modelValue:c.value,"onUpdate:modelValue":r[0]||=e=>c.value=e,class:(0,t.normalizeClass)([{"d-inline":o.inline},`v-swatches`]),mandatory:``},{default:(0,t.withCtx)(()=>[o.inline?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(s.value[0],e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VItem),{key:e,value:e},{default:(0,t.withCtx)(({isSelected:n,toggle:r})=>[(0,t.createVNode)(f,{border:o.border,color:e,disabled:o.disabled,elevation:o.elevation,"icon-size":o.iconSize,icon:o.icon,"is-selected":n,rounded:o.rounded,size:o.size,"tooltip-location":o.tooltipLocation,tooltip:o.tooltip,variant:o.variant,onClick:r},null,8,[`border`,`color`,`disabled`,`elevation`,`icon-size`,`icon`,`is-selected`,`rounded`,`size`,`tooltip-location`,`tooltip`,`variant`,`onClick`])]),_:2},1032,[`value`]))),128)):((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(s.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VItem),{key:e,value:e},{default:(0,t.withCtx)(({isSelected:n,toggle:r})=>[(0,t.createVNode)(f,{border:o.border,color:e,disabled:o.disabled,elevation:o.elevation,"icon-size":o.iconSize,icon:o.icon,"is-selected":n,rounded:o.rounded,size:o.size,"tooltip-location":o.tooltipLocation,tooltip:o.tooltip,variant:o.variant,onClick:r},null,8,[`border`,`color`,`disabled`,`elevation`,`icon-size`,`icon`,`is-selected`,`rounded`,`size`,`tooltip-location`,`tooltip`,`variant`,`onClick`])]),_:2},1032,[`value`]))),128))]))),128))]),_:1},8,[`modelValue`,`class`]))}});return e.default=p,e.install=e=>e.component(`VSwatches`,p),e})({},Vue,Vuetify/components,colors);
package/dist/index.umd.js CHANGED
@@ -5,8 +5,8 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2026 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 2.0.1
8
+ * @version 2.1.1
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- (function(a,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):(a=typeof globalThis<"u"?globalThis:a||self,e(a.VSwatches={},a.Vue,a["Vuetify/components"],a.colors))})(this,(function(a,e,c,k){"use strict";function b(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var u=b(k);function B(...i){let d=0;for(let n=0;n<i.length;n++)i[n].length>d&&(d=i[n].length);const o=i.length,t=Array(d);for(let n=0;n<d;++n){const r=Array(o);for(let l=0;l<o;++l)r[l]=i[l][n];t[n]=r}return t}var h=e.defineComponent({__name:"SwatchButton",props:{color:{default:void 0},isSelected:{type:Boolean,default:!1},size:{default:"2rem"},icon:{default:"mdi-checkbox-marked-circle"},iconSize:{default:"1rem"},variant:{default:void 0},disabled:{type:Boolean,default:!1},rounded:{type:[String,Number,Boolean],default:void 0},border:{type:[String,Number,Boolean],default:!1},elevation:{default:void 0},tooltip:{type:Boolean,default:!1},tooltipLocation:{default:void 0}},emits:["click"],setup(i,{emit:d}){const o=i,t=d;return(n,r)=>o.color?(e.openBlock(),e.createBlock(e.unref(c.VTooltip),{key:0,disabled:!o.tooltip,location:o.tooltipLocation,text:o.color},{activator:e.withCtx(({props:l})=>[e.createVNode(e.unref(c.VBtn),e.mergeProps(l,{border:o.border,class:[o.color===e.unref(u.default).shades.transparent?"bg-transparent":"","p-0"],color:o.color,disabled:o.disabled,elevation:o.elevation,height:o.size,variant:o.variant,width:o.size,"min-width":"auto",onClick:r[0]||(r[0]=p=>t("click"))}),{default:e.withCtx(()=>[o.isSelected?(e.openBlock(),e.createBlock(e.unref(c.VIcon),{key:0,size:o.iconSize,color:o.color!==e.unref(u.default).shades.transparent?o.color:void 0,icon:o.icon},null,8,["size","color","icon"])):e.createCommentVNode("",!0)]),_:1},16,["border","class","color","disabled","elevation","height","variant","width"])]),_:1},8,["disabled","location","text"])):(e.openBlock(),e.createBlock(e.unref(c.VBtn),{key:1,height:o.size,width:o.size,class:"p-0",disabled:"","min-width":"auto",variant:"text"},null,8,["height","width"]))}}),y=e.defineComponent({__name:"VSwatches",props:{modelValue:{type:String,default:u.default.shades.white},swatches:{type:Array,default:()=>[]},size:{type:String,default:"2rem"},icon:{type:String,default:"mdi-checkbox-marked-circle"},iconSize:{type:String,default:"1rem"},inline:{type:Boolean,default:!1},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},transpose:{type:Boolean,default:!1},tooltip:{type:Boolean,default:!1},tooltipLocation:{type:String,default:void 0}},emits:{"update:modelValue":i=>!0},setup(i,{emit:d}){const o=d,t=i,n=e.computed(()=>{const l=Array.isArray(t.swatches)?t.swatches:Object.values(t.swatches);return t.inline?[l.flat(1/0)]:t.transpose?B(...l):l}),r=e.ref(u.default.shades.white);return e.watch(()=>r.value,l=>o("update:modelValue",l)),e.watch(()=>t.modelValue,l=>{l&&(r.value=l)},{immediate:!0}),(l,p)=>(e.openBlock(),e.createBlock(e.unref(c.VItemGroup),{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=s=>r.value=s),class:e.normalizeClass([{"d-inline":t.inline},"v-swatches"]),mandatory:""},{default:e.withCtx(()=>[t.inline?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.value[0],s=>(e.openBlock(),e.createBlock(e.unref(c.VItem),{key:s,value:s},{default:e.withCtx(({isSelected:m,toggle:f})=>[e.createVNode(h,{border:t.border,color:s,disabled:t.disabled,elevation:t.elevation,"icon-size":t.iconSize,icon:t.icon,"is-selected":m,rounded:t.rounded,size:t.size,"tooltip-location":t.tooltipLocation,tooltip:t.tooltip,variant:t.variant,onClick:f},null,8,["border","color","disabled","elevation","icon-size","icon","is-selected","rounded","size","tooltip-location","tooltip","variant","onClick"])]),_:2},1032,["value"]))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(n.value,(s,m)=>(e.openBlock(),e.createElementBlock("div",{key:m},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s,f=>(e.openBlock(),e.createBlock(e.unref(c.VItem),{key:f,value:f},{default:e.withCtx(({isSelected:z,toggle:S})=>[e.createVNode(h,{border:t.border,color:f,disabled:t.disabled,elevation:t.elevation,"icon-size":t.iconSize,icon:t.icon,"is-selected":z,rounded:t.rounded,size:t.size,"tooltip-location":t.tooltipLocation,tooltip:t.tooltip,variant:t.variant,onClick:S},null,8,["border","color","disabled","elevation","icon-size","icon","is-selected","rounded","size","tooltip-location","tooltip","variant","onClick"])]),_:2},1032,["value"]))),128))]))),128))]),_:1},8,["modelValue","class"]))}});const w=i=>i.component("VSwatches",y);a.default=y,a.install=w,Object.defineProperty(a,"__esModule",{value:!0})}));
12
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue"),require("vuetify/components"),require("vuetify/util/colors")):typeof define==`function`&&define.amd?define([`exports`,`vue`,`vuetify/components`,`vuetify/util/colors`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.VSwatches={},e.Vue,e[`Vuetify/components`],e.colors))})(this,function(e,t,n,r){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=s(t),c=0,u=i.length,d;c<u;c++)d=i[c],!l.call(e,d)&&d!==n&&a(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=o(t,d))||r.enumerable});return e};r=((e,t,n)=>(n=e==null?{}:i(c(e)),u(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e)))(r,1);function d(...e){let t=0;for(let n=0;n<e.length;n++)e[n].length>t&&(t=e[n].length);let n=e.length,r=Array(t);for(let i=0;i<t;++i){let t=Array(n);for(let r=0;r<n;++r)t[r]=e[r][i];r[i]=t}return r}var f=(0,t.defineComponent)({__name:`SwatchButton`,props:{color:{default:void 0},isSelected:{type:Boolean,default:!1},size:{default:`2rem`},icon:{default:`mdi-checkbox-marked-circle`},iconSize:{default:`1rem`},variant:{default:void 0},disabled:{type:Boolean,default:!1},rounded:{type:[String,Number,Boolean],default:void 0},border:{type:[String,Number,Boolean],default:!1},elevation:{default:void 0},tooltip:{type:Boolean,default:!1},tooltipLocation:{default:void 0}},emits:[`click`],setup(e,{emit:i}){let a=e,o=i;return(e,i)=>a.color?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VTooltip),{key:0,disabled:!a.tooltip,location:a.tooltipLocation,text:a.color},{activator:(0,t.withCtx)(({props:e})=>[(0,t.createVNode)((0,t.unref)(n.VBtn),(0,t.mergeProps)(e,{border:a.border,class:[a.color===(0,t.unref)(r.default).shades.transparent?`bg-transparent`:``,`p-0`],color:a.color,disabled:a.disabled,elevation:a.elevation,height:a.size,variant:a.variant,width:a.size,"min-width":`auto`,onClick:i[0]||=e=>o(`click`)}),{default:(0,t.withCtx)(()=>[a.isSelected?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VIcon),{key:0,size:a.iconSize,color:a.color===(0,t.unref)(r.default).shades.transparent?void 0:a.color,icon:a.icon},null,8,[`size`,`color`,`icon`])):(0,t.createCommentVNode)(``,!0)]),_:1},16,[`border`,`class`,`color`,`disabled`,`elevation`,`height`,`variant`,`width`])]),_:1},8,[`disabled`,`location`,`text`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VBtn),{key:1,height:a.size,width:a.size,class:`p-0`,"min-width":`auto`,variant:`text`,disabled:``},null,8,[`height`,`width`]))}}),p=(0,t.defineComponent)({__name:`VSwatches`,props:{modelValue:{default:r.default.shades.white},swatches:{default:()=>[]},size:{default:`2rem`},icon:{default:`mdi-checkbox-marked-circle`},iconSize:{default:`1rem`},inline:{type:Boolean,default:!1},variant:{default:void 0},disabled:{type:Boolean,default:!1},rounded:{type:[String,Number,Boolean],default:void 0},border:{type:[String,Number,Boolean],default:!1},elevation:{default:void 0},transpose:{type:Boolean,default:!1},tooltip:{type:Boolean,default:!1},tooltipLocation:{default:void 0}},emits:[`update:modelValue`],setup(e,{emit:i}){let a=i,o=e,s=(0,t.computed)(()=>{let e=Array.isArray(o.swatches)?o.swatches:Object.values(o.swatches);return o.inline?[e.flat(1/0)]:o.transpose?d(...e):e}),c=(0,t.ref)(r.default.shades.white);return(0,t.watch)(()=>c.value,e=>a(`update:modelValue`,e)),(0,t.watch)(()=>o.modelValue,e=>{e&&(c.value=e)},{immediate:!0}),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VItemGroup),{modelValue:c.value,"onUpdate:modelValue":r[0]||=e=>c.value=e,class:(0,t.normalizeClass)([{"d-inline":o.inline},`v-swatches`]),mandatory:``},{default:(0,t.withCtx)(()=>[o.inline?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(s.value[0],e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VItem),{key:e,value:e},{default:(0,t.withCtx)(({isSelected:n,toggle:r})=>[(0,t.createVNode)(f,{border:o.border,color:e,disabled:o.disabled,elevation:o.elevation,"icon-size":o.iconSize,icon:o.icon,"is-selected":n,rounded:o.rounded,size:o.size,"tooltip-location":o.tooltipLocation,tooltip:o.tooltip,variant:o.variant,onClick:r},null,8,[`border`,`color`,`disabled`,`elevation`,`icon-size`,`icon`,`is-selected`,`rounded`,`size`,`tooltip-location`,`tooltip`,`variant`,`onClick`])]),_:2},1032,[`value`]))),128)):((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(s.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.VItem),{key:e,value:e},{default:(0,t.withCtx)(({isSelected:n,toggle:r})=>[(0,t.createVNode)(f,{border:o.border,color:e,disabled:o.disabled,elevation:o.elevation,"icon-size":o.iconSize,icon:o.icon,"is-selected":n,rounded:o.rounded,size:o.size,"tooltip-location":o.tooltipLocation,tooltip:o.tooltip,variant:o.variant,onClick:r},null,8,[`border`,`color`,`disabled`,`elevation`,`icon-size`,`icon`,`is-selected`,`rounded`,`size`,`tooltip-location`,`tooltip`,`variant`,`onClick`])]),_:2},1032,[`value`]))),128))]))),128))]),_:1},8,[`modelValue`,`class`]))}});e.default=p,e.install=e=>e.component(`VSwatches`,p)});