vuetify-swatches 1.4.5 → 1.5.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/dist/index.es.js +27 -28
- package/dist/index.iife.js +27 -32
- package/dist/index.umd.js +27 -32
- package/dist/style.css +1 -1
- package/package.json +24 -24
- package/src/components/VSwatches.vue +45 -25
package/dist/index.es.js
CHANGED
|
@@ -5,45 +5,45 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.
|
|
8
|
+
* @version 1.5.0
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { defineComponent, ref, watch, onMounted, openBlock, createBlock, unref, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
|
|
13
13
|
import { VSheet, VBtn, VIcon } from 'vuetify/components';
|
|
14
|
-
import
|
|
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
15
|
|
|
16
16
|
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
17
|
__name: "VSwatches",
|
|
18
18
|
props: {
|
|
19
19
|
/** Model value */
|
|
20
|
-
modelValue: { type: String, default:
|
|
20
|
+
modelValue: { type: String, default: shades.white },
|
|
21
21
|
/** Swatch colors */
|
|
22
22
|
swatches: {
|
|
23
23
|
type: Array,
|
|
24
24
|
default: () => [
|
|
25
|
-
[
|
|
25
|
+
[shades.black, shades.white, shades.transparent],
|
|
26
26
|
[
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
red.base,
|
|
28
|
+
pink.base,
|
|
29
|
+
purple.base,
|
|
30
|
+
deepPurple.base,
|
|
31
|
+
indigo.base,
|
|
32
|
+
blue.base,
|
|
33
|
+
lightBlue.base,
|
|
34
|
+
cyan.base
|
|
35
35
|
],
|
|
36
36
|
[
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
teal.base,
|
|
38
|
+
green.base,
|
|
39
|
+
lightGreen.base,
|
|
40
|
+
lime.base,
|
|
41
|
+
yellow.base,
|
|
42
|
+
amber.base,
|
|
43
|
+
orange.base,
|
|
44
|
+
deepOrange.base
|
|
45
45
|
],
|
|
46
|
-
[
|
|
46
|
+
[brown.base, blueGrey.base, grey.base]
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
49
|
/** Swatch size */
|
|
@@ -110,10 +110,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
110
110
|
emits: {
|
|
111
111
|
"update:modelValue": (value) => true
|
|
112
112
|
},
|
|
113
|
-
setup(__props, { emit:
|
|
113
|
+
setup(__props, { emit: __emit }) {
|
|
114
|
+
const emits = __emit;
|
|
114
115
|
const props = __props;
|
|
115
|
-
const selected = ref(
|
|
116
|
-
const onSwatchClick = (e) => selected.value = e.target.value ||
|
|
116
|
+
const selected = ref(shades.white);
|
|
117
|
+
const onSwatchClick = (e) => selected.value = e.target.value || shades.white;
|
|
117
118
|
watch(
|
|
118
119
|
() => selected.value,
|
|
119
120
|
(s) => emits("update:modelValue", s)
|
|
@@ -132,7 +133,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
132
133
|
return openBlock(), createBlock(unref(VBtn), {
|
|
133
134
|
key: color,
|
|
134
135
|
border: props.border,
|
|
135
|
-
class: normalizeClass(color === unref(
|
|
136
|
+
class: normalizeClass(color === unref(shades).transparent ? "bg-trasparent" : ""),
|
|
136
137
|
color,
|
|
137
138
|
disabled: props.disabled,
|
|
138
139
|
elevation: props.elevation,
|
|
@@ -147,7 +148,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
147
148
|
color === __props.modelValue ? (openBlock(), createBlock(unref(VIcon), {
|
|
148
149
|
key: 0,
|
|
149
150
|
size: __props.iconSize,
|
|
150
|
-
color: color !== unref(
|
|
151
|
+
color: color !== unref(shades).transparent ? color : void 0
|
|
151
152
|
}, {
|
|
152
153
|
default: withCtx(() => [
|
|
153
154
|
createTextVNode(toDisplayString(props.icon), 1)
|
|
@@ -167,8 +168,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
167
168
|
}
|
|
168
169
|
});
|
|
169
170
|
|
|
170
|
-
var VSwatches_vue_vue_type_style_index_0_lang = '';
|
|
171
|
-
|
|
172
171
|
const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
|
|
173
172
|
|
|
174
173
|
export { _sfc_main as default, installVSwatches as install };
|
package/dist/index.iife.js
CHANGED
|
@@ -5,48 +5,44 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.
|
|
8
|
+
* @version 1.5.0
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
var VSwatches = (function (exports, vue, components,
|
|
12
|
+
var VSwatches = (function (exports, vue, components, colors_mjs) {
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
-
|
|
17
|
-
var colors__default = /*#__PURE__*/_interopDefaultCompat(colors);
|
|
18
|
-
|
|
19
15
|
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
20
16
|
__name: "VSwatches",
|
|
21
17
|
props: {
|
|
22
18
|
/** Model value */
|
|
23
|
-
modelValue: { type: String, default:
|
|
19
|
+
modelValue: { type: String, default: colors_mjs.shades.white },
|
|
24
20
|
/** Swatch colors */
|
|
25
21
|
swatches: {
|
|
26
22
|
type: Array,
|
|
27
23
|
default: () => [
|
|
28
|
-
[
|
|
24
|
+
[colors_mjs.shades.black, colors_mjs.shades.white, colors_mjs.shades.transparent],
|
|
29
25
|
[
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
|
38
34
|
],
|
|
39
35
|
[
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
|
48
44
|
],
|
|
49
|
-
[
|
|
45
|
+
[colors_mjs.brown.base, colors_mjs.blueGrey.base, colors_mjs.grey.base]
|
|
50
46
|
]
|
|
51
47
|
},
|
|
52
48
|
/** Swatch size */
|
|
@@ -113,10 +109,11 @@ var VSwatches = (function (exports, vue, components, colors) {
|
|
|
113
109
|
emits: {
|
|
114
110
|
"update:modelValue": (value) => true
|
|
115
111
|
},
|
|
116
|
-
setup(__props, { emit:
|
|
112
|
+
setup(__props, { emit: __emit }) {
|
|
113
|
+
const emits = __emit;
|
|
117
114
|
const props = __props;
|
|
118
|
-
const selected = vue.ref(
|
|
119
|
-
const onSwatchClick = (e) => selected.value = e.target.value ||
|
|
115
|
+
const selected = vue.ref(colors_mjs.shades.white);
|
|
116
|
+
const onSwatchClick = (e) => selected.value = e.target.value || colors_mjs.shades.white;
|
|
120
117
|
vue.watch(
|
|
121
118
|
() => selected.value,
|
|
122
119
|
(s) => emits("update:modelValue", s)
|
|
@@ -135,7 +132,7 @@ var VSwatches = (function (exports, vue, components, colors) {
|
|
|
135
132
|
return vue.openBlock(), vue.createBlock(vue.unref(components.VBtn), {
|
|
136
133
|
key: color,
|
|
137
134
|
border: props.border,
|
|
138
|
-
class: vue.normalizeClass(color === vue.unref(
|
|
135
|
+
class: vue.normalizeClass(color === vue.unref(colors_mjs.shades).transparent ? "bg-trasparent" : ""),
|
|
139
136
|
color,
|
|
140
137
|
disabled: props.disabled,
|
|
141
138
|
elevation: props.elevation,
|
|
@@ -150,7 +147,7 @@ var VSwatches = (function (exports, vue, components, colors) {
|
|
|
150
147
|
color === __props.modelValue ? (vue.openBlock(), vue.createBlock(vue.unref(components.VIcon), {
|
|
151
148
|
key: 0,
|
|
152
149
|
size: __props.iconSize,
|
|
153
|
-
color: color !== vue.unref(
|
|
150
|
+
color: color !== vue.unref(colors_mjs.shades).transparent ? color : void 0
|
|
154
151
|
}, {
|
|
155
152
|
default: vue.withCtx(() => [
|
|
156
153
|
vue.createTextVNode(vue.toDisplayString(props.icon), 1)
|
|
@@ -170,8 +167,6 @@ var VSwatches = (function (exports, vue, components, colors) {
|
|
|
170
167
|
}
|
|
171
168
|
});
|
|
172
169
|
|
|
173
|
-
var VSwatches_vue_vue_type_style_index_0_lang = '';
|
|
174
|
-
|
|
175
170
|
const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
|
|
176
171
|
|
|
177
172
|
exports["default"] = _sfc_main;
|
package/dist/index.umd.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.
|
|
8
|
+
* @version 1.5.0
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -13,43 +13,39 @@
|
|
|
13
13
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('vuetify/components'), require('vuetify/lib/util/colors.mjs')) :
|
|
14
14
|
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'vuetify/components', 'vuetify/lib/util/colors.mjs'], factory) :
|
|
15
15
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VSwatches = {}, global.Vue, global["Vuetify/components"], global.colors));
|
|
16
|
-
})(this, (function (exports, vue, components,
|
|
17
|
-
|
|
18
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
|
-
|
|
20
|
-
var colors__default = /*#__PURE__*/_interopDefaultCompat(colors);
|
|
16
|
+
})(this, (function (exports, vue, components, colors_mjs) { 'use strict';
|
|
21
17
|
|
|
22
18
|
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
23
19
|
__name: "VSwatches",
|
|
24
20
|
props: {
|
|
25
21
|
/** Model value */
|
|
26
|
-
modelValue: { type: String, default:
|
|
22
|
+
modelValue: { type: String, default: colors_mjs.shades.white },
|
|
27
23
|
/** Swatch colors */
|
|
28
24
|
swatches: {
|
|
29
25
|
type: Array,
|
|
30
26
|
default: () => [
|
|
31
|
-
[
|
|
27
|
+
[colors_mjs.shades.black, colors_mjs.shades.white, colors_mjs.shades.transparent],
|
|
32
28
|
[
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
|
41
37
|
],
|
|
42
38
|
[
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
51
47
|
],
|
|
52
|
-
[
|
|
48
|
+
[colors_mjs.brown.base, colors_mjs.blueGrey.base, colors_mjs.grey.base]
|
|
53
49
|
]
|
|
54
50
|
},
|
|
55
51
|
/** Swatch size */
|
|
@@ -116,10 +112,11 @@
|
|
|
116
112
|
emits: {
|
|
117
113
|
"update:modelValue": (value) => true
|
|
118
114
|
},
|
|
119
|
-
setup(__props, { emit:
|
|
115
|
+
setup(__props, { emit: __emit }) {
|
|
116
|
+
const emits = __emit;
|
|
120
117
|
const props = __props;
|
|
121
|
-
const selected = vue.ref(
|
|
122
|
-
const onSwatchClick = (e) => selected.value = e.target.value ||
|
|
118
|
+
const selected = vue.ref(colors_mjs.shades.white);
|
|
119
|
+
const onSwatchClick = (e) => selected.value = e.target.value || colors_mjs.shades.white;
|
|
123
120
|
vue.watch(
|
|
124
121
|
() => selected.value,
|
|
125
122
|
(s) => emits("update:modelValue", s)
|
|
@@ -138,7 +135,7 @@
|
|
|
138
135
|
return vue.openBlock(), vue.createBlock(vue.unref(components.VBtn), {
|
|
139
136
|
key: color,
|
|
140
137
|
border: props.border,
|
|
141
|
-
class: vue.normalizeClass(color === vue.unref(
|
|
138
|
+
class: vue.normalizeClass(color === vue.unref(colors_mjs.shades).transparent ? "bg-trasparent" : ""),
|
|
142
139
|
color,
|
|
143
140
|
disabled: props.disabled,
|
|
144
141
|
elevation: props.elevation,
|
|
@@ -153,7 +150,7 @@
|
|
|
153
150
|
color === __props.modelValue ? (vue.openBlock(), vue.createBlock(vue.unref(components.VIcon), {
|
|
154
151
|
key: 0,
|
|
155
152
|
size: __props.iconSize,
|
|
156
|
-
color: color !== vue.unref(
|
|
153
|
+
color: color !== vue.unref(colors_mjs.shades).transparent ? color : void 0
|
|
157
154
|
}, {
|
|
158
155
|
default: vue.withCtx(() => [
|
|
159
156
|
vue.createTextVNode(vue.toDisplayString(props.icon), 1)
|
|
@@ -173,8 +170,6 @@
|
|
|
173
170
|
}
|
|
174
171
|
});
|
|
175
172
|
|
|
176
|
-
var VSwatches_vue_vue_type_style_index_0_lang = '';
|
|
177
|
-
|
|
178
173
|
const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
|
|
179
174
|
|
|
180
175
|
exports["default"] = _sfc_main;
|
package/dist/style.css
CHANGED
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.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"description": "Color Swatch component for Vuetify3.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vuejs",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"engines": {
|
|
64
64
|
"yarn": ">=1.22.19"
|
|
65
65
|
},
|
|
66
|
-
"packageManager": "yarn@
|
|
66
|
+
"packageManager": "yarn@4.0.2",
|
|
67
67
|
"sideEffects": false,
|
|
68
68
|
"scripts": {
|
|
69
69
|
"dev": "vite",
|
|
@@ -85,43 +85,43 @@
|
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@codemirror/lang-vue": "^0.1.2",
|
|
87
87
|
"@tsconfig/node-lts": "^18.12.5",
|
|
88
|
-
"@types/node": "^20.
|
|
89
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
90
|
-
"@typescript-eslint/parser": "^6.
|
|
91
|
-
"@vitejs/plugin-vue": "^4.
|
|
88
|
+
"@types/node": "^20.10.1",
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^6.13.1",
|
|
90
|
+
"@typescript-eslint/parser": "^6.13.1",
|
|
91
|
+
"@vitejs/plugin-vue": "^4.5.0",
|
|
92
92
|
"@vue/eslint-config-prettier": "^8.0.0",
|
|
93
93
|
"@vue/tsconfig": "^0.4.0",
|
|
94
|
-
"eslint": "^8.
|
|
95
|
-
"eslint-config-standard-with-typescript": "^
|
|
94
|
+
"eslint": "^8.54.0",
|
|
95
|
+
"eslint-config-standard-with-typescript": "^40.0.0",
|
|
96
96
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
97
97
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
98
98
|
"eslint-plugin-html": "^7.1.0",
|
|
99
|
-
"eslint-plugin-import": "^2.
|
|
100
|
-
"eslint-plugin-n": "^16.1
|
|
99
|
+
"eslint-plugin-import": "^2.29.0",
|
|
100
|
+
"eslint-plugin-n": "^16.3.1",
|
|
101
101
|
"eslint-plugin-promise": "^6.1.1",
|
|
102
102
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
103
|
-
"eslint-plugin-vue": "^9.
|
|
103
|
+
"eslint-plugin-vue": "^9.18.1",
|
|
104
104
|
"eslint-plugin-vuejs-accessibility": "^2.2.0",
|
|
105
|
-
"eslint-plugin-vuetify": "^2.0
|
|
105
|
+
"eslint-plugin-vuetify": "^2.1.0",
|
|
106
106
|
"eslint-plugin-yaml": "^0.5.0",
|
|
107
107
|
"husky": "^8.0.3",
|
|
108
|
-
"lint-staged": "^
|
|
108
|
+
"lint-staged": "^15.1.0",
|
|
109
109
|
"npm-run-all": "^4.1.5",
|
|
110
|
-
"prettier": "^3.0
|
|
110
|
+
"prettier": "^3.1.0",
|
|
111
111
|
"rimraf": "^5.0.5",
|
|
112
|
-
"rollup-plugin-visualizer": "^5.9.
|
|
113
|
-
"sass": "^1.
|
|
114
|
-
"typescript": "^5.
|
|
115
|
-
"vite": "^
|
|
112
|
+
"rollup-plugin-visualizer": "^5.9.3",
|
|
113
|
+
"sass": "^1.69.5",
|
|
114
|
+
"typescript": "^5.3.2",
|
|
115
|
+
"vite": "^5.0.4",
|
|
116
116
|
"vite-plugin-banner": "^0.7.1",
|
|
117
117
|
"vite-plugin-checker": "^0.6.2",
|
|
118
|
-
"vite-plugin-dts": "^3.6.
|
|
118
|
+
"vite-plugin-dts": "^3.6.4",
|
|
119
119
|
"vite-plugin-vuetify": "^1.0.2",
|
|
120
|
-
"vue": "^3.3.
|
|
121
|
-
"vue-codemirror6": "^1.1.
|
|
122
|
-
"vue-eslint-parser": "^9.3.
|
|
123
|
-
"vue-tsc": "^1.8.
|
|
124
|
-
"vuetify": "^3.
|
|
120
|
+
"vue": "^3.3.9",
|
|
121
|
+
"vue-codemirror6": "^1.1.31",
|
|
122
|
+
"vue-eslint-parser": "^9.3.2",
|
|
123
|
+
"vue-tsc": "^1.8.24",
|
|
124
|
+
"vuetify": "^3.4.4"
|
|
125
125
|
},
|
|
126
126
|
"husky": {
|
|
127
127
|
"hooks": {
|
|
@@ -3,7 +3,28 @@
|
|
|
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
|
|
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';
|
|
7
28
|
|
|
8
29
|
/** Emits */
|
|
9
30
|
const emits = defineEmits({
|
|
@@ -13,33 +34,33 @@ const emits = defineEmits({
|
|
|
13
34
|
/** Props */
|
|
14
35
|
const props = defineProps({
|
|
15
36
|
/** Model value */
|
|
16
|
-
modelValue: { type: String, default:
|
|
37
|
+
modelValue: { type: String, default: shades.white },
|
|
17
38
|
/** Swatch colors */
|
|
18
39
|
swatches: {
|
|
19
40
|
type: Array as PropType<string[] | string[][] | Record<string, string[]>>,
|
|
20
41
|
default: () => [
|
|
21
|
-
[
|
|
42
|
+
[shades.black, shades.white, shades.transparent],
|
|
22
43
|
[
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
44
|
+
red.base,
|
|
45
|
+
pink.base,
|
|
46
|
+
purple.base,
|
|
47
|
+
deepPurple.base,
|
|
48
|
+
indigo.base,
|
|
49
|
+
blue.base,
|
|
50
|
+
lightBlue.base,
|
|
51
|
+
cyan.base,
|
|
31
52
|
],
|
|
32
53
|
[
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
54
|
+
teal.base,
|
|
55
|
+
green.base,
|
|
56
|
+
lightGreen.base,
|
|
57
|
+
lime.base,
|
|
58
|
+
yellow.base,
|
|
59
|
+
amber.base,
|
|
60
|
+
orange.base,
|
|
61
|
+
deepOrange.base,
|
|
41
62
|
],
|
|
42
|
-
[
|
|
63
|
+
[brown.base, blueGrey.base, grey.base],
|
|
43
64
|
],
|
|
44
65
|
},
|
|
45
66
|
/** Swatch size */
|
|
@@ -107,7 +128,7 @@ const props = defineProps({
|
|
|
107
128
|
});
|
|
108
129
|
|
|
109
130
|
/** Selected Color */
|
|
110
|
-
const selected: Ref<string> = ref(
|
|
131
|
+
const selected: Ref<string> = ref(shades.white);
|
|
111
132
|
|
|
112
133
|
/**
|
|
113
134
|
* Swatch button clicked handler
|
|
@@ -115,8 +136,7 @@ const selected: Ref<string> = ref(colors.shades.white);
|
|
|
115
136
|
* @param e - Event
|
|
116
137
|
*/
|
|
117
138
|
const onSwatchClick = (e: Event) =>
|
|
118
|
-
(selected.value =
|
|
119
|
-
(e.target as HTMLButtonElement).value || colors.shades.white);
|
|
139
|
+
(selected.value = (e.target as HTMLButtonElement).value || shades.white);
|
|
120
140
|
|
|
121
141
|
watch(
|
|
122
142
|
() => selected.value,
|
|
@@ -137,7 +157,7 @@ onMounted(() => {
|
|
|
137
157
|
v-for="color in cols"
|
|
138
158
|
:key="color"
|
|
139
159
|
:border="props.border"
|
|
140
|
-
:class="color ===
|
|
160
|
+
:class="color === shades.transparent ? 'bg-trasparent' : ''"
|
|
141
161
|
:color="color"
|
|
142
162
|
:disabled="props.disabled"
|
|
143
163
|
:elevation="props.elevation"
|
|
@@ -151,7 +171,7 @@ onMounted(() => {
|
|
|
151
171
|
<v-icon
|
|
152
172
|
v-if="color === modelValue"
|
|
153
173
|
:size="iconSize"
|
|
154
|
-
:color="color !==
|
|
174
|
+
:color="color !== shades.transparent ? color : undefined"
|
|
155
175
|
>
|
|
156
176
|
{{ props.icon }}
|
|
157
177
|
</v-icon>
|