vuetify-swatches 2.0.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/LICENSE +1 -1
- package/README.ja.md +159 -0
- package/README.md +51 -128
- package/dist/components/SwatchButton.vue.d.ts +2 -1
- package/dist/components/VSwatches.vue.d.ts +30 -173
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +247 -262
- package/dist/index.iife.js +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/presets/advanced.js +237 -233
- package/dist/presets/basic.js +34 -26
- package/dist/presets/index.d.ts +2 -2
- package/dist/presets/index.js +3 -6
- package/dist/presets/src/Meta.d.ts +3 -0
- package/dist/presets/src/components/SwatchButton.vue.d.ts +36 -0
- package/dist/presets/src/components/VSwatches.vue.d.ts +81 -0
- package/dist/presets/src/index.d.ts +3 -0
- package/dist/presets/src/interfaces/MetaInterface.d.ts +7 -0
- package/dist/vuetify-swatches.css +4 -3
- package/package.json +79 -59
- package/src/components/VSwatches.vue +85 -117
package/dist/index.es.js
CHANGED
|
@@ -3,270 +3,255 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @description Color Swatch component for Vuetify3.
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
-
* @copyright 2022-
|
|
6
|
+
* @copyright 2022-2026 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 2.
|
|
8
|
+
* @version 2.1.1
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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 };
|
package/dist/index.iife.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @description Color Swatch component for Vuetify3.
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
-
* @copyright 2022-
|
|
6
|
+
* @copyright 2022-2026 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 2.
|
|
8
|
+
* @version 2.1.1
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
var VSwatches=(function(
|
|
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
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @description Color Swatch component for Vuetify3.
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
-
* @copyright 2022-
|
|
6
|
+
* @copyright 2022-2026 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 2.
|
|
8
|
+
* @version 2.1.1
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
(function(
|
|
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)});
|