vuetify-swatches 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/components/VSwatches.vue.d.ts +159 -125
- package/dist/components/VSwatches.vue.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.es.js +58 -72
- package/dist/index.iife.js +57 -71
- package/dist/index.umd.js +57 -71
- package/dist/style.css +1 -1
- package/package.json +39 -35
- package/src/components/VSwatches.vue +114 -127
package/README.md
CHANGED
|
@@ -117,6 +117,8 @@ const selected: Ref<string> = ref('#ffffff');
|
|
|
117
117
|
|
|
118
118
|
### Options
|
|
119
119
|
|
|
120
|
+
Most props other than size and placement are the same as [v-btn](https://next.vuetifyjs.com/en/api/v-btn/).
|
|
121
|
+
|
|
120
122
|
| Variables | Type | Default | Info |
|
|
121
123
|
| --------- | -------------- | -------------------------- | -------------------------------------------------------------------------- |
|
|
122
124
|
| size | string | 2rem | Swatch Button size |
|
|
@@ -125,6 +127,8 @@ const selected: Ref<string> = ref('#ffffff');
|
|
|
125
127
|
| disabled | boolean | false | Removes the ability to click or target the component. |
|
|
126
128
|
| rounded | number\|string | undefined | Applies a large border radius on the button. |
|
|
127
129
|
| variant | string [^1] | undefined | The variant prop gives you easy access to several different button styles. |
|
|
130
|
+
| elevation | number\|string | undefined |
|
|
131
|
+
| border | number\|string | undefined |
|
|
128
132
|
|
|
129
133
|
[^1] Available variants are: elevated(default), flat, tonal, outlined, text, and plain.
|
|
130
134
|
|
|
@@ -1,126 +1,160 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const _default: import("vue").DefineComponent<{
|
|
4
|
-
/** Model value */
|
|
5
|
-
modelValue: {
|
|
6
|
-
type: StringConstructor;
|
|
7
|
-
default: any;
|
|
8
|
-
};
|
|
9
|
-
/** Swatch colors */
|
|
10
|
-
swatches: {
|
|
11
|
-
type: PropType<string[] | string[][]>;
|
|
12
|
-
default: () => any[][];
|
|
13
|
-
};
|
|
14
|
-
/** Swatch size */
|
|
15
|
-
size: {
|
|
16
|
-
type: StringConstructor;
|
|
17
|
-
default: string;
|
|
18
|
-
};
|
|
19
|
-
/** Selected icon */
|
|
20
|
-
icon: {
|
|
21
|
-
type: StringConstructor;
|
|
22
|
-
default: string;
|
|
23
|
-
};
|
|
24
|
-
/** selected icon size */
|
|
25
|
-
iconSize: {
|
|
26
|
-
type: StringConstructor;
|
|
27
|
-
default: string;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* The variant prop gives you easy access to several different button styles..
|
|
31
|
-
*
|
|
32
|
-
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
|
|
33
|
-
*/
|
|
34
|
-
variant: {
|
|
35
|
-
type: PropType<"
|
|
36
|
-
default: undefined;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Removes the ability to click or target the component.
|
|
40
|
-
*
|
|
41
|
-
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
|
|
42
|
-
*/
|
|
43
|
-
disabled: {
|
|
44
|
-
type: BooleanConstructor;
|
|
45
|
-
default: undefined;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Applies a large border radius on the button.
|
|
49
|
-
*
|
|
50
|
-
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#rounded}
|
|
51
|
-
*/
|
|
52
|
-
rounded: {
|
|
53
|
-
type: StringConstructor;
|
|
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
|
-
rounded:
|
|
124
|
-
|
|
125
|
-
|
|
1
|
+
/** Vuetify Swatches */
|
|
2
|
+
import { type PropType } from 'vue';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
/** Model value */
|
|
5
|
+
modelValue: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
default: any;
|
|
8
|
+
};
|
|
9
|
+
/** Swatch colors */
|
|
10
|
+
swatches: {
|
|
11
|
+
type: PropType<string[] | string[][]>;
|
|
12
|
+
default: () => any[][];
|
|
13
|
+
};
|
|
14
|
+
/** Swatch size */
|
|
15
|
+
size: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
/** Selected icon */
|
|
20
|
+
icon: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
/** selected icon size */
|
|
25
|
+
iconSize: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
default: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The variant prop gives you easy access to several different button styles..
|
|
31
|
+
*
|
|
32
|
+
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
|
|
33
|
+
*/
|
|
34
|
+
variant: {
|
|
35
|
+
type: PropType<"flat" | "text" | "elevated" | "tonal" | "outlined" | "plain">;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Removes the ability to click or target the component.
|
|
40
|
+
*
|
|
41
|
+
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
|
|
42
|
+
*/
|
|
43
|
+
disabled: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Applies a large border radius on the button.
|
|
49
|
+
*
|
|
50
|
+
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#rounded}
|
|
51
|
+
*/
|
|
52
|
+
rounded: {
|
|
53
|
+
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
54
|
+
default: undefined;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Applies border styles to component.
|
|
58
|
+
*
|
|
59
|
+
* @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-border}
|
|
60
|
+
*/
|
|
61
|
+
border: {
|
|
62
|
+
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
63
|
+
default: boolean;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Designates an elevation applied to the component between 0 and 24.
|
|
67
|
+
*
|
|
68
|
+
* @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-elevation}
|
|
69
|
+
*/
|
|
70
|
+
elevation: {
|
|
71
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
72
|
+
default: undefined;
|
|
73
|
+
};
|
|
74
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
75
|
+
/** Model value */
|
|
76
|
+
modelValue: {
|
|
77
|
+
type: StringConstructor;
|
|
78
|
+
default: any;
|
|
79
|
+
};
|
|
80
|
+
/** Swatch colors */
|
|
81
|
+
swatches: {
|
|
82
|
+
type: PropType<string[] | string[][]>;
|
|
83
|
+
default: () => any[][];
|
|
84
|
+
};
|
|
85
|
+
/** Swatch size */
|
|
86
|
+
size: {
|
|
87
|
+
type: StringConstructor;
|
|
88
|
+
default: string;
|
|
89
|
+
};
|
|
90
|
+
/** Selected icon */
|
|
91
|
+
icon: {
|
|
92
|
+
type: StringConstructor;
|
|
93
|
+
default: string;
|
|
94
|
+
};
|
|
95
|
+
/** selected icon size */
|
|
96
|
+
iconSize: {
|
|
97
|
+
type: StringConstructor;
|
|
98
|
+
default: string;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* The variant prop gives you easy access to several different button styles..
|
|
102
|
+
*
|
|
103
|
+
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
|
|
104
|
+
*/
|
|
105
|
+
variant: {
|
|
106
|
+
type: PropType<"flat" | "text" | "elevated" | "tonal" | "outlined" | "plain">;
|
|
107
|
+
default: undefined;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Removes the ability to click or target the component.
|
|
111
|
+
*
|
|
112
|
+
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
|
|
113
|
+
*/
|
|
114
|
+
disabled: {
|
|
115
|
+
type: BooleanConstructor;
|
|
116
|
+
default: undefined;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Applies a large border radius on the button.
|
|
120
|
+
*
|
|
121
|
+
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#rounded}
|
|
122
|
+
*/
|
|
123
|
+
rounded: {
|
|
124
|
+
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
125
|
+
default: undefined;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Applies border styles to component.
|
|
129
|
+
*
|
|
130
|
+
* @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-border}
|
|
131
|
+
*/
|
|
132
|
+
border: {
|
|
133
|
+
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
134
|
+
default: boolean;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Designates an elevation applied to the component between 0 and 24.
|
|
138
|
+
*
|
|
139
|
+
* @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-elevation}
|
|
140
|
+
*/
|
|
141
|
+
elevation: {
|
|
142
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
143
|
+
default: undefined;
|
|
144
|
+
};
|
|
145
|
+
}>> & {
|
|
146
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
147
|
+
}, {
|
|
148
|
+
modelValue: string;
|
|
149
|
+
swatches: string[] | string[][];
|
|
150
|
+
size: string;
|
|
151
|
+
icon: string;
|
|
152
|
+
iconSize: string;
|
|
153
|
+
variant: "flat" | "text" | "elevated" | "tonal" | "outlined" | "plain";
|
|
154
|
+
disabled: boolean;
|
|
155
|
+
rounded: string | number | boolean;
|
|
156
|
+
border: string | number | boolean;
|
|
157
|
+
elevation: string | number;
|
|
158
|
+
}>;
|
|
159
|
+
export default _default;
|
|
126
160
|
//# sourceMappingURL=VSwatches.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.ts"],"names":[],"mappings":"AACA,uBAAuB;AACvB,OAAO,EAAc,KAAK,QAAQ,EAAY,MAAM,KAAK,CAAC;;IAsGxD,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;IArEH,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;AAxKL,wBAwQc"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import VSwatches from '
|
|
2
|
-
declare const installVSwatches: (app: any) => any;
|
|
3
|
-
export { VSwatches as default, installVSwatches as install };
|
|
1
|
+
import VSwatches from '@/components/VSwatches.vue';
|
|
2
|
+
declare const installVSwatches: (app: any) => any;
|
|
3
|
+
export { VSwatches as default, installVSwatches as install };
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.es.js
CHANGED
|
@@ -5,19 +5,15 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.3.
|
|
8
|
+
* @version 1.3.4
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { defineComponent, ref, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
|
|
12
|
+
import { defineComponent, ref, watch, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, normalizeClass, unref, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
|
|
13
13
|
import colors from 'vuetify/lib/util/colors.mjs';
|
|
14
14
|
|
|
15
|
-
const _sfc_main = defineComponent({
|
|
16
|
-
|
|
17
|
-
model: {
|
|
18
|
-
prop: "modelValue",
|
|
19
|
-
event: "update:modelValue"
|
|
20
|
-
},
|
|
15
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
|
+
__name: "VSwatches",
|
|
21
17
|
props: {
|
|
22
18
|
modelValue: { type: String, default: colors.shades.white },
|
|
23
19
|
swatches: {
|
|
@@ -55,84 +51,74 @@ const _sfc_main = defineComponent({
|
|
|
55
51
|
default: void 0
|
|
56
52
|
},
|
|
57
53
|
disabled: { type: Boolean, default: void 0 },
|
|
58
|
-
rounded: { type: String, Number, default: void 0 }
|
|
54
|
+
rounded: { type: [String, Number, Boolean], default: void 0 },
|
|
55
|
+
border: { type: [String, Number, Boolean], default: false },
|
|
56
|
+
elevation: { type: [String, Number], default: void 0 }
|
|
59
57
|
},
|
|
60
58
|
emits: ["update:modelValue"],
|
|
61
|
-
setup(
|
|
62
|
-
const
|
|
59
|
+
setup(__props, { emit }) {
|
|
60
|
+
const props = __props;
|
|
61
|
+
const selected = ref(props.modelValue);
|
|
63
62
|
const onSwatchClick = (e) => {
|
|
64
63
|
const value = e.target.dataset.value;
|
|
65
64
|
if (!value || props.modelValue === value) {
|
|
66
65
|
return;
|
|
67
66
|
}
|
|
68
|
-
|
|
69
|
-
};
|
|
70
|
-
return {
|
|
71
|
-
checkedVisibilty,
|
|
72
|
-
onSwatchClick,
|
|
73
|
-
shades: colors.shades
|
|
67
|
+
emit("update:modelValue", value);
|
|
74
68
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
key: color,
|
|
99
|
-
color,
|
|
100
|
-
disabled: _ctx.disabled,
|
|
101
|
-
height: _ctx.size,
|
|
102
|
-
value: color,
|
|
103
|
-
variant: _ctx.variant,
|
|
104
|
-
width: _ctx.size,
|
|
105
|
-
"data-value": color,
|
|
106
|
-
class: normalizeClass(color === _ctx.shades.transparent ? "bg-trasparent" : ""),
|
|
107
|
-
"min-width": "auto",
|
|
108
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.onSwatchClick($event))
|
|
109
|
-
}, {
|
|
110
|
-
default: withCtx(() => [
|
|
111
|
-
color === _ctx.modelValue ? (openBlock(), createBlock(_component_v_icon, {
|
|
112
|
-
key: 0,
|
|
113
|
-
size: _ctx.iconSize,
|
|
114
|
-
color: color !== _ctx.shades.transparent ? color : void 0
|
|
69
|
+
watch(selected, (value) => void 0);
|
|
70
|
+
return (_ctx, _cache) => {
|
|
71
|
+
const _component_v_icon = resolveComponent("v-icon");
|
|
72
|
+
const _component_v_btn = resolveComponent("v-btn");
|
|
73
|
+
const _component_v_sheet = resolveComponent("v-sheet");
|
|
74
|
+
return openBlock(), createBlock(_component_v_sheet, { class: "v-swatches" }, {
|
|
75
|
+
default: withCtx(() => [
|
|
76
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.swatches, (cols, rows) => {
|
|
77
|
+
return openBlock(), createElementBlock("div", { key: rows }, [
|
|
78
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(cols, (color) => {
|
|
79
|
+
return openBlock(), createBlock(_component_v_btn, {
|
|
80
|
+
key: color,
|
|
81
|
+
border: props.border,
|
|
82
|
+
class: normalizeClass(color === unref(colors).shades.transparent ? "bg-trasparent" : ""),
|
|
83
|
+
color,
|
|
84
|
+
disabled: props.disabled,
|
|
85
|
+
elevation: props.elevation,
|
|
86
|
+
height: props.size,
|
|
87
|
+
"data-value": color,
|
|
88
|
+
variant: props.variant,
|
|
89
|
+
width: props.size,
|
|
90
|
+
"min-width": "auto",
|
|
91
|
+
onClick: _cache[0] || (_cache[0] = ($event) => onSwatchClick($event))
|
|
115
92
|
}, {
|
|
116
93
|
default: withCtx(() => [
|
|
117
|
-
|
|
94
|
+
color === __props.modelValue ? (openBlock(), createBlock(_component_v_icon, {
|
|
95
|
+
key: 0,
|
|
96
|
+
size: __props.iconSize,
|
|
97
|
+
color: color !== unref(colors).shades.transparent ? color : void 0
|
|
98
|
+
}, {
|
|
99
|
+
default: withCtx(() => [
|
|
100
|
+
createTextVNode(toDisplayString(props.icon), 1)
|
|
101
|
+
]),
|
|
102
|
+
_: 2
|
|
103
|
+
}, 1032, ["size", "color"])) : createCommentVNode("", true)
|
|
118
104
|
]),
|
|
119
105
|
_: 2
|
|
120
|
-
}, 1032, ["
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}, 1032, ["color", "disabled", "height", "value", "variant", "width", "data-value", "class"]);
|
|
106
|
+
}, 1032, ["border", "class", "color", "disabled", "elevation", "height", "data-value", "variant", "width"]);
|
|
107
|
+
}), 128))
|
|
108
|
+
]);
|
|
124
109
|
}), 128))
|
|
125
|
-
])
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
110
|
+
]),
|
|
111
|
+
_: 1
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const VSwatches_vue_vue_type_style_index_0_lang = '';
|
|
132
118
|
|
|
133
|
-
const installVSwatches = (app) => app.component("VSwatches",
|
|
119
|
+
const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
|
|
134
120
|
if (typeof window !== "undefined" && window.Vue) {
|
|
135
|
-
window.Vue.use(
|
|
121
|
+
window.Vue.use(_sfc_main);
|
|
136
122
|
}
|
|
137
123
|
|
|
138
|
-
export {
|
|
124
|
+
export { _sfc_main as default, installVSwatches as install };
|
package/dist/index.iife.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.3.
|
|
8
|
+
* @version 1.3.4
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -16,12 +16,8 @@ var VSwatches = (function (exports, vue, colors) {
|
|
|
16
16
|
|
|
17
17
|
const colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
18
18
|
|
|
19
|
-
const _sfc_main = vue.defineComponent({
|
|
20
|
-
|
|
21
|
-
model: {
|
|
22
|
-
prop: "modelValue",
|
|
23
|
-
event: "update:modelValue"
|
|
24
|
-
},
|
|
19
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
20
|
+
__name: "VSwatches",
|
|
25
21
|
props: {
|
|
26
22
|
modelValue: { type: String, default: colors__default.default.shades.white },
|
|
27
23
|
swatches: {
|
|
@@ -59,87 +55,77 @@ var VSwatches = (function (exports, vue, colors) {
|
|
|
59
55
|
default: void 0
|
|
60
56
|
},
|
|
61
57
|
disabled: { type: Boolean, default: void 0 },
|
|
62
|
-
rounded: { type: String, Number, default: void 0 }
|
|
58
|
+
rounded: { type: [String, Number, Boolean], default: void 0 },
|
|
59
|
+
border: { type: [String, Number, Boolean], default: false },
|
|
60
|
+
elevation: { type: [String, Number], default: void 0 }
|
|
63
61
|
},
|
|
64
62
|
emits: ["update:modelValue"],
|
|
65
|
-
setup(
|
|
66
|
-
const
|
|
63
|
+
setup(__props, { emit }) {
|
|
64
|
+
const props = __props;
|
|
65
|
+
const selected = vue.ref(props.modelValue);
|
|
67
66
|
const onSwatchClick = (e) => {
|
|
68
67
|
const value = e.target.dataset.value;
|
|
69
68
|
if (!value || props.modelValue === value) {
|
|
70
69
|
return;
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
return {
|
|
75
|
-
checkedVisibilty,
|
|
76
|
-
onSwatchClick,
|
|
77
|
-
shades: colors__default.default.shades
|
|
71
|
+
emit("update:modelValue", value);
|
|
78
72
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
key: color,
|
|
103
|
-
color,
|
|
104
|
-
disabled: _ctx.disabled,
|
|
105
|
-
height: _ctx.size,
|
|
106
|
-
value: color,
|
|
107
|
-
variant: _ctx.variant,
|
|
108
|
-
width: _ctx.size,
|
|
109
|
-
"data-value": color,
|
|
110
|
-
class: vue.normalizeClass(color === _ctx.shades.transparent ? "bg-trasparent" : ""),
|
|
111
|
-
"min-width": "auto",
|
|
112
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.onSwatchClick($event))
|
|
113
|
-
}, {
|
|
114
|
-
default: vue.withCtx(() => [
|
|
115
|
-
color === _ctx.modelValue ? (vue.openBlock(), vue.createBlock(_component_v_icon, {
|
|
116
|
-
key: 0,
|
|
117
|
-
size: _ctx.iconSize,
|
|
118
|
-
color: color !== _ctx.shades.transparent ? color : void 0
|
|
73
|
+
vue.watch(selected, (value) => void 0);
|
|
74
|
+
return (_ctx, _cache) => {
|
|
75
|
+
const _component_v_icon = vue.resolveComponent("v-icon");
|
|
76
|
+
const _component_v_btn = vue.resolveComponent("v-btn");
|
|
77
|
+
const _component_v_sheet = vue.resolveComponent("v-sheet");
|
|
78
|
+
return vue.openBlock(), vue.createBlock(_component_v_sheet, { class: "v-swatches" }, {
|
|
79
|
+
default: vue.withCtx(() => [
|
|
80
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.swatches, (cols, rows) => {
|
|
81
|
+
return vue.openBlock(), vue.createElementBlock("div", { key: rows }, [
|
|
82
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(cols, (color) => {
|
|
83
|
+
return vue.openBlock(), vue.createBlock(_component_v_btn, {
|
|
84
|
+
key: color,
|
|
85
|
+
border: props.border,
|
|
86
|
+
class: vue.normalizeClass(color === vue.unref(colors__default.default).shades.transparent ? "bg-trasparent" : ""),
|
|
87
|
+
color,
|
|
88
|
+
disabled: props.disabled,
|
|
89
|
+
elevation: props.elevation,
|
|
90
|
+
height: props.size,
|
|
91
|
+
"data-value": color,
|
|
92
|
+
variant: props.variant,
|
|
93
|
+
width: props.size,
|
|
94
|
+
"min-width": "auto",
|
|
95
|
+
onClick: _cache[0] || (_cache[0] = ($event) => onSwatchClick($event))
|
|
119
96
|
}, {
|
|
120
97
|
default: vue.withCtx(() => [
|
|
121
|
-
|
|
98
|
+
color === __props.modelValue ? (vue.openBlock(), vue.createBlock(_component_v_icon, {
|
|
99
|
+
key: 0,
|
|
100
|
+
size: __props.iconSize,
|
|
101
|
+
color: color !== vue.unref(colors__default.default).shades.transparent ? color : void 0
|
|
102
|
+
}, {
|
|
103
|
+
default: vue.withCtx(() => [
|
|
104
|
+
vue.createTextVNode(vue.toDisplayString(props.icon), 1)
|
|
105
|
+
]),
|
|
106
|
+
_: 2
|
|
107
|
+
}, 1032, ["size", "color"])) : vue.createCommentVNode("", true)
|
|
122
108
|
]),
|
|
123
109
|
_: 2
|
|
124
|
-
}, 1032, ["
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}, 1032, ["color", "disabled", "height", "value", "variant", "width", "data-value", "class"]);
|
|
110
|
+
}, 1032, ["border", "class", "color", "disabled", "elevation", "height", "data-value", "variant", "width"]);
|
|
111
|
+
}), 128))
|
|
112
|
+
]);
|
|
128
113
|
}), 128))
|
|
129
|
-
])
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
114
|
+
]),
|
|
115
|
+
_: 1
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const VSwatches_vue_vue_type_style_index_0_lang = '';
|
|
136
122
|
|
|
137
|
-
const installVSwatches = (app) => app.component("VSwatches",
|
|
123
|
+
const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
|
|
138
124
|
if (typeof window !== "undefined" && window.Vue) {
|
|
139
|
-
window.Vue.use(
|
|
125
|
+
window.Vue.use(_sfc_main);
|
|
140
126
|
}
|
|
141
127
|
|
|
142
|
-
exports.default =
|
|
128
|
+
exports.default = _sfc_main;
|
|
143
129
|
exports.install = installVSwatches;
|
|
144
130
|
|
|
145
131
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
package/dist/index.umd.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2022 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.3.
|
|
8
|
+
* @version 1.3.4
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -19,12 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
const colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
21
21
|
|
|
22
|
-
const _sfc_main = vue.defineComponent({
|
|
23
|
-
|
|
24
|
-
model: {
|
|
25
|
-
prop: "modelValue",
|
|
26
|
-
event: "update:modelValue"
|
|
27
|
-
},
|
|
22
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
23
|
+
__name: "VSwatches",
|
|
28
24
|
props: {
|
|
29
25
|
modelValue: { type: String, default: colors__default.default.shades.white },
|
|
30
26
|
swatches: {
|
|
@@ -62,87 +58,77 @@
|
|
|
62
58
|
default: void 0
|
|
63
59
|
},
|
|
64
60
|
disabled: { type: Boolean, default: void 0 },
|
|
65
|
-
rounded: { type: String, Number, default: void 0 }
|
|
61
|
+
rounded: { type: [String, Number, Boolean], default: void 0 },
|
|
62
|
+
border: { type: [String, Number, Boolean], default: false },
|
|
63
|
+
elevation: { type: [String, Number], default: void 0 }
|
|
66
64
|
},
|
|
67
65
|
emits: ["update:modelValue"],
|
|
68
|
-
setup(
|
|
69
|
-
const
|
|
66
|
+
setup(__props, { emit }) {
|
|
67
|
+
const props = __props;
|
|
68
|
+
const selected = vue.ref(props.modelValue);
|
|
70
69
|
const onSwatchClick = (e) => {
|
|
71
70
|
const value = e.target.dataset.value;
|
|
72
71
|
if (!value || props.modelValue === value) {
|
|
73
72
|
return;
|
|
74
73
|
}
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
return {
|
|
78
|
-
checkedVisibilty,
|
|
79
|
-
onSwatchClick,
|
|
80
|
-
shades: colors__default.default.shades
|
|
74
|
+
emit("update:modelValue", value);
|
|
81
75
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
key: color,
|
|
106
|
-
color,
|
|
107
|
-
disabled: _ctx.disabled,
|
|
108
|
-
height: _ctx.size,
|
|
109
|
-
value: color,
|
|
110
|
-
variant: _ctx.variant,
|
|
111
|
-
width: _ctx.size,
|
|
112
|
-
"data-value": color,
|
|
113
|
-
class: vue.normalizeClass(color === _ctx.shades.transparent ? "bg-trasparent" : ""),
|
|
114
|
-
"min-width": "auto",
|
|
115
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.onSwatchClick($event))
|
|
116
|
-
}, {
|
|
117
|
-
default: vue.withCtx(() => [
|
|
118
|
-
color === _ctx.modelValue ? (vue.openBlock(), vue.createBlock(_component_v_icon, {
|
|
119
|
-
key: 0,
|
|
120
|
-
size: _ctx.iconSize,
|
|
121
|
-
color: color !== _ctx.shades.transparent ? color : void 0
|
|
76
|
+
vue.watch(selected, (value) => void 0);
|
|
77
|
+
return (_ctx, _cache) => {
|
|
78
|
+
const _component_v_icon = vue.resolveComponent("v-icon");
|
|
79
|
+
const _component_v_btn = vue.resolveComponent("v-btn");
|
|
80
|
+
const _component_v_sheet = vue.resolveComponent("v-sheet");
|
|
81
|
+
return vue.openBlock(), vue.createBlock(_component_v_sheet, { class: "v-swatches" }, {
|
|
82
|
+
default: vue.withCtx(() => [
|
|
83
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.swatches, (cols, rows) => {
|
|
84
|
+
return vue.openBlock(), vue.createElementBlock("div", { key: rows }, [
|
|
85
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(cols, (color) => {
|
|
86
|
+
return vue.openBlock(), vue.createBlock(_component_v_btn, {
|
|
87
|
+
key: color,
|
|
88
|
+
border: props.border,
|
|
89
|
+
class: vue.normalizeClass(color === vue.unref(colors__default.default).shades.transparent ? "bg-trasparent" : ""),
|
|
90
|
+
color,
|
|
91
|
+
disabled: props.disabled,
|
|
92
|
+
elevation: props.elevation,
|
|
93
|
+
height: props.size,
|
|
94
|
+
"data-value": color,
|
|
95
|
+
variant: props.variant,
|
|
96
|
+
width: props.size,
|
|
97
|
+
"min-width": "auto",
|
|
98
|
+
onClick: _cache[0] || (_cache[0] = ($event) => onSwatchClick($event))
|
|
122
99
|
}, {
|
|
123
100
|
default: vue.withCtx(() => [
|
|
124
|
-
|
|
101
|
+
color === __props.modelValue ? (vue.openBlock(), vue.createBlock(_component_v_icon, {
|
|
102
|
+
key: 0,
|
|
103
|
+
size: __props.iconSize,
|
|
104
|
+
color: color !== vue.unref(colors__default.default).shades.transparent ? color : void 0
|
|
105
|
+
}, {
|
|
106
|
+
default: vue.withCtx(() => [
|
|
107
|
+
vue.createTextVNode(vue.toDisplayString(props.icon), 1)
|
|
108
|
+
]),
|
|
109
|
+
_: 2
|
|
110
|
+
}, 1032, ["size", "color"])) : vue.createCommentVNode("", true)
|
|
125
111
|
]),
|
|
126
112
|
_: 2
|
|
127
|
-
}, 1032, ["
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}, 1032, ["color", "disabled", "height", "value", "variant", "width", "data-value", "class"]);
|
|
113
|
+
}, 1032, ["border", "class", "color", "disabled", "elevation", "height", "data-value", "variant", "width"]);
|
|
114
|
+
}), 128))
|
|
115
|
+
]);
|
|
131
116
|
}), 128))
|
|
132
|
-
])
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
117
|
+
]),
|
|
118
|
+
_: 1
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const VSwatches_vue_vue_type_style_index_0_lang = '';
|
|
139
125
|
|
|
140
|
-
const installVSwatches = (app) => app.component("VSwatches",
|
|
126
|
+
const installVSwatches = (app) => app.component("VSwatches", _sfc_main);
|
|
141
127
|
if (typeof window !== "undefined" && window.Vue) {
|
|
142
|
-
window.Vue.use(
|
|
128
|
+
window.Vue.use(_sfc_main);
|
|
143
129
|
}
|
|
144
130
|
|
|
145
|
-
exports.default =
|
|
131
|
+
exports.default = _sfc_main;
|
|
146
132
|
exports.install = installVSwatches;
|
|
147
133
|
|
|
148
134
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
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.3.
|
|
4
|
+
"version": "1.3.4",
|
|
5
5
|
"description": "Color Swatch component for Vuetify3.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vuejs",
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"exports": {
|
|
43
43
|
".": {
|
|
44
44
|
"import": "./dist/index.es.js",
|
|
45
|
-
"require": "./dist/index.umd.js"
|
|
45
|
+
"require": "./dist/index.umd.js",
|
|
46
|
+
"types": "./dist/index.d.ts"
|
|
46
47
|
},
|
|
47
48
|
"./dist/style.css": {
|
|
48
49
|
"import": "./dist/style.css",
|
|
@@ -54,72 +55,75 @@
|
|
|
54
55
|
"src/components/VSwatches.vue"
|
|
55
56
|
],
|
|
56
57
|
"engines": {
|
|
57
|
-
"node": ">=
|
|
58
|
+
"node": ">=18.12.1",
|
|
58
59
|
"yarn": ">=1.22.10"
|
|
59
60
|
},
|
|
60
|
-
"packageManager": "yarn@3.
|
|
61
|
+
"packageManager": "yarn@3.3.0",
|
|
61
62
|
"sideEffects": false,
|
|
62
63
|
"scripts": {
|
|
63
64
|
"dev": "vite",
|
|
64
65
|
"clean": "rimraf node_modules/.vite ",
|
|
65
|
-
"
|
|
66
|
-
"build:analyze": "vue-tsc --noEmit & vite build --mode analyze",
|
|
67
|
-
"build:docs": "vite build --config vite.config.docs.ts",
|
|
68
|
-
"build:clean": "rimraf dist",
|
|
66
|
+
"type-check": "vue-tsc --noEmit --composite false",
|
|
69
67
|
"lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . -w -u",
|
|
70
|
-
"lint:style": "stylelint
|
|
71
|
-
"
|
|
68
|
+
"lint:style": "stylelint \"./**/*.{css,sass,scss,htm,html,vue}\" --fix --cache-location ./node_modules/.vite/vite-plugin-stylelint && prettier \"./**/*.{css,sass,scss,htm,html,vue}\" -w -u",
|
|
69
|
+
"build": "run-p type-check build-only build-declaration",
|
|
70
|
+
"build:analyze": "vite build --mode analyze",
|
|
71
|
+
"build:clean": "rimraf dist",
|
|
72
|
+
"build:docs": "vite build --config vite.config.docs.ts",
|
|
73
|
+
"build-only": "vite build",
|
|
74
|
+
"build-declaration": "vue-tsc --composite false --declaration --emitDeclarationOnly --declarationDir ./dist",
|
|
72
75
|
"preview": "vite preview --config vite.config.docs.ts",
|
|
73
76
|
"prepare": "husky install"
|
|
74
77
|
},
|
|
75
78
|
"peerDependencies": {
|
|
76
|
-
"vue": "^3.2.
|
|
77
|
-
"vuetify": "^3.0.0
|
|
79
|
+
"vue": "^3.2.45",
|
|
80
|
+
"vuetify": "^3.0.0"
|
|
78
81
|
},
|
|
79
82
|
"devDependencies": {
|
|
80
|
-
"@codemirror/lang-html": "^6.
|
|
81
|
-
"@types/node": "^18.11.
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
83
|
-
"@typescript-eslint/parser": "^5.
|
|
83
|
+
"@codemirror/lang-html": "^6.4.0",
|
|
84
|
+
"@types/node": "^18.11.11",
|
|
85
|
+
"@typescript-eslint/eslint-plugin": "^5.45.1",
|
|
86
|
+
"@typescript-eslint/parser": "^5.45.1",
|
|
84
87
|
"@vitejs/plugin-vue": "^3.2.0",
|
|
85
88
|
"@vue/eslint-config-prettier": "^7.0.0",
|
|
86
89
|
"@vue/tsconfig": "^0.1.3",
|
|
87
90
|
"codemirror": "^6.0.1",
|
|
88
|
-
"eslint": "^8.
|
|
91
|
+
"eslint": "^8.29.0",
|
|
89
92
|
"eslint-config-google": "^0.14.0",
|
|
90
93
|
"eslint-config-prettier": "^8.5.0",
|
|
91
94
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
92
95
|
"eslint-import-resolver-typescript": "^3.5.2",
|
|
93
96
|
"eslint-plugin-import": "^2.26.0",
|
|
94
|
-
"eslint-plugin-jsdoc": "^39.
|
|
97
|
+
"eslint-plugin-jsdoc": "^39.6.4",
|
|
95
98
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
96
|
-
"eslint-plugin-vue": "^9.
|
|
97
|
-
"eslint-plugin-vuejs-accessibility": "^
|
|
98
|
-
"eslint-plugin-vuetify": "^
|
|
99
|
+
"eslint-plugin-vue": "^9.8.0",
|
|
100
|
+
"eslint-plugin-vuejs-accessibility": "^2.0.0",
|
|
101
|
+
"eslint-plugin-vuetify": "^2.0.0-beta.2",
|
|
99
102
|
"eslint-plugin-yaml": "^0.5.0",
|
|
100
|
-
"husky": "^8.0.
|
|
101
|
-
"lint-staged": "^13.0
|
|
103
|
+
"husky": "^8.0.2",
|
|
104
|
+
"lint-staged": "^13.1.0",
|
|
105
|
+
"npm-run-all": "^4.1.5",
|
|
102
106
|
"postcss-html": "^1.5.0",
|
|
103
|
-
"prettier": "^2.
|
|
107
|
+
"prettier": "^2.8.1",
|
|
104
108
|
"rimraf": "^3.0.2",
|
|
105
109
|
"rollup-plugin-visualizer": "^5.8.3",
|
|
106
|
-
"sass": "1.
|
|
107
|
-
"stylelint": "^14.
|
|
108
|
-
"stylelint-config-prettier": "^9.0.
|
|
110
|
+
"sass": "1.56.1",
|
|
111
|
+
"stylelint": "^14.16.0",
|
|
112
|
+
"stylelint-config-prettier": "^9.0.4",
|
|
109
113
|
"stylelint-config-recommended-scss": "^8.0.0",
|
|
110
114
|
"stylelint-config-recommended-vue": "^1.4.0",
|
|
111
115
|
"stylelint-order": "^5.0.0",
|
|
112
116
|
"stylelint-prettier": "^2.0.0",
|
|
113
|
-
"typescript": "^4.
|
|
114
|
-
"vite": "^3.2.
|
|
115
|
-
"vite-plugin-banner": "^0.
|
|
117
|
+
"typescript": "^4.9.4",
|
|
118
|
+
"vite": "^3.2.5",
|
|
119
|
+
"vite-plugin-banner": "^0.6.1",
|
|
116
120
|
"vite-plugin-checker": "^0.5.1",
|
|
117
121
|
"vite-plugin-vuetify": "^1.0.0",
|
|
118
|
-
"vue": "^3.2.
|
|
119
|
-
"vue-codemirror6": "1.
|
|
122
|
+
"vue": "^3.2.45",
|
|
123
|
+
"vue-codemirror6": "1.1.1",
|
|
120
124
|
"vue-eslint-parser": "^9.1.0",
|
|
121
|
-
"vue-tsc": "^1.0.
|
|
122
|
-
"vuetify": "^3.0.
|
|
125
|
+
"vue-tsc": "^1.0.11",
|
|
126
|
+
"vuetify": "^3.0.4"
|
|
123
127
|
},
|
|
124
128
|
"husky": {
|
|
125
129
|
"hooks": {
|
|
@@ -133,6 +137,6 @@
|
|
|
133
137
|
"*": "prettier -w -u"
|
|
134
138
|
},
|
|
135
139
|
"resolutions": {
|
|
136
|
-
"prettier": "^2.
|
|
140
|
+
"prettier": "^2.8.1"
|
|
137
141
|
}
|
|
138
142
|
}
|
|
@@ -1,150 +1,137 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/** Vuetify Swatches */
|
|
3
|
+
import { ref, watch, type PropType, type Ref } from 'vue';
|
|
4
|
+
import colors from 'vuetify/lib/util/colors.mjs';
|
|
5
|
+
|
|
6
|
+
/** Props */
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
/** Model value */
|
|
9
|
+
modelValue: { type: String, default: colors.shades.white },
|
|
10
|
+
/** Swatch colors */
|
|
11
|
+
swatches: {
|
|
12
|
+
type: Array as PropType<string[] | string[][]>,
|
|
13
|
+
default: () => [
|
|
14
|
+
[colors.shades.black, colors.shades.white, colors.shades.transparent],
|
|
15
|
+
[
|
|
16
|
+
colors.red.base,
|
|
17
|
+
colors.pink.base,
|
|
18
|
+
colors.purple.base,
|
|
19
|
+
colors.deepPurple.base,
|
|
20
|
+
colors.indigo.base,
|
|
21
|
+
colors.blue.base,
|
|
22
|
+
colors.lightBlue.base,
|
|
23
|
+
colors.cyan.base,
|
|
24
|
+
],
|
|
25
|
+
[
|
|
26
|
+
colors.teal.base,
|
|
27
|
+
colors.green.base,
|
|
28
|
+
colors.lightGreen.base,
|
|
29
|
+
colors.lime.base,
|
|
30
|
+
colors.yellow.base,
|
|
31
|
+
colors.amber.base,
|
|
32
|
+
colors.orange.base,
|
|
33
|
+
colors.deepOrange.base,
|
|
34
|
+
],
|
|
35
|
+
[colors.brown.base, colors.blueGrey.base, colors.grey.base],
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
/** Swatch size */
|
|
39
|
+
size: { type: String, default: '2rem' },
|
|
40
|
+
/** Selected icon */
|
|
41
|
+
icon: { type: String, default: 'mdi-checkbox-marked-circle' },
|
|
42
|
+
/** selected icon size */
|
|
43
|
+
iconSize: { type: String, default: '1rem' },
|
|
44
|
+
/**
|
|
45
|
+
* The variant prop gives you easy access to several different button styles..
|
|
46
|
+
*
|
|
47
|
+
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
|
|
48
|
+
*/
|
|
49
|
+
variant: {
|
|
50
|
+
type: String as PropType<
|
|
51
|
+
'flat' | 'text' | 'elevated' | 'tonal' | 'outlined' | 'plain'
|
|
52
|
+
>,
|
|
53
|
+
default: undefined,
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Removes the ability to click or target the component.
|
|
57
|
+
*
|
|
58
|
+
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
|
|
59
|
+
*/
|
|
60
|
+
disabled: { type: Boolean, default: undefined },
|
|
61
|
+
/**
|
|
62
|
+
* Applies a large border radius on the button.
|
|
63
|
+
*
|
|
64
|
+
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#rounded}
|
|
65
|
+
*/
|
|
66
|
+
rounded: { type: [String, Number, Boolean], default: undefined },
|
|
67
|
+
/**
|
|
68
|
+
* Applies border styles to component.
|
|
69
|
+
*
|
|
70
|
+
* @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-border}
|
|
71
|
+
*/
|
|
72
|
+
border: { type: [String, Number, Boolean], default: false },
|
|
73
|
+
/**
|
|
74
|
+
* Designates an elevation applied to the component between 0 and 24.
|
|
75
|
+
*
|
|
76
|
+
* @see {@link https://next.vuetifyjs.com/en/api/v-btn/#props-elevation}
|
|
77
|
+
*/
|
|
78
|
+
elevation: { type: [String, Number], default: undefined },
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
/** Emits */
|
|
82
|
+
const emit = defineEmits(['update:modelValue']);
|
|
83
|
+
|
|
84
|
+
const selected: Ref<string | undefined> = ref(props.modelValue);
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Swatch button clicked handler
|
|
88
|
+
*
|
|
89
|
+
* @param e - Event
|
|
90
|
+
*/
|
|
91
|
+
const onSwatchClick = (e: Event) => {
|
|
92
|
+
console.log(e.target);
|
|
93
|
+
const value = (e.target as HTMLButtonElement).dataset.value;
|
|
94
|
+
if (!value || props.modelValue === value) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
emit('update:modelValue', value);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
watch(selected, value => console.log(value));
|
|
101
|
+
</script>
|
|
102
|
+
|
|
1
103
|
<template>
|
|
2
104
|
<v-sheet class="v-swatches">
|
|
3
|
-
<div v-for="(
|
|
105
|
+
<div v-for="(cols, rows) in swatches" :key="rows">
|
|
4
106
|
<v-btn
|
|
5
|
-
v-for="color in
|
|
107
|
+
v-for="color in cols"
|
|
6
108
|
:key="color"
|
|
109
|
+
:border="props.border"
|
|
110
|
+
:class="color === colors.shades.transparent ? 'bg-trasparent' : ''"
|
|
7
111
|
:color="color"
|
|
8
|
-
:disabled="disabled"
|
|
9
|
-
:
|
|
10
|
-
:
|
|
11
|
-
:variant="variant"
|
|
12
|
-
:width="size"
|
|
112
|
+
:disabled="props.disabled"
|
|
113
|
+
:elevation="props.elevation"
|
|
114
|
+
:height="props.size"
|
|
13
115
|
:data-value="color"
|
|
14
|
-
:
|
|
116
|
+
:variant="props.variant"
|
|
117
|
+
:width="props.size"
|
|
15
118
|
min-width="auto"
|
|
16
119
|
@click="onSwatchClick($event)"
|
|
17
120
|
>
|
|
18
121
|
<v-icon
|
|
19
122
|
v-if="color === modelValue"
|
|
20
123
|
:size="iconSize"
|
|
21
|
-
:color="color !== shades.transparent ? color : undefined"
|
|
124
|
+
:color="color !== colors.shades.transparent ? color : undefined"
|
|
22
125
|
>
|
|
23
|
-
{{ icon }}
|
|
126
|
+
{{ props.icon }}
|
|
24
127
|
</v-icon>
|
|
25
128
|
</v-btn>
|
|
26
129
|
</div>
|
|
27
130
|
</v-sheet>
|
|
28
131
|
</template>
|
|
29
132
|
|
|
30
|
-
<script lang="ts">
|
|
31
|
-
import {
|
|
32
|
-
defineComponent,
|
|
33
|
-
ref,
|
|
34
|
-
type PropType,
|
|
35
|
-
type Ref,
|
|
36
|
-
type SetupContext,
|
|
37
|
-
} from 'vue';
|
|
38
|
-
|
|
39
|
-
// eslint-disable-next-line import/no-unresolved
|
|
40
|
-
import colors from 'vuetify/lib/util/colors.mjs';
|
|
41
|
-
|
|
42
|
-
/** Vuetify Swatches */
|
|
43
|
-
export default defineComponent({
|
|
44
|
-
/** Component name */
|
|
45
|
-
name: 'VSwatches',
|
|
46
|
-
/** Model Definition */
|
|
47
|
-
model: {
|
|
48
|
-
prop: 'modelValue',
|
|
49
|
-
event: 'update:modelValue',
|
|
50
|
-
},
|
|
51
|
-
props: {
|
|
52
|
-
/** Model value */
|
|
53
|
-
modelValue: { type: String, default: colors.shades.white },
|
|
54
|
-
/** Swatch colors */
|
|
55
|
-
swatches: {
|
|
56
|
-
type: Array as PropType<string[] | string[][]>,
|
|
57
|
-
default: () => [
|
|
58
|
-
[colors.shades.black, colors.shades.white, colors.shades.transparent],
|
|
59
|
-
[
|
|
60
|
-
colors.red.base,
|
|
61
|
-
colors.pink.base,
|
|
62
|
-
colors.purple.base,
|
|
63
|
-
colors.deepPurple.base,
|
|
64
|
-
colors.indigo.base,
|
|
65
|
-
colors.blue.base,
|
|
66
|
-
colors.lightBlue.base,
|
|
67
|
-
colors.cyan.base,
|
|
68
|
-
],
|
|
69
|
-
[
|
|
70
|
-
colors.teal.base,
|
|
71
|
-
colors.green.base,
|
|
72
|
-
colors.lightGreen.base,
|
|
73
|
-
colors.lime.base,
|
|
74
|
-
colors.yellow.base,
|
|
75
|
-
colors.amber.base,
|
|
76
|
-
colors.orange.base,
|
|
77
|
-
colors.deepOrange.base,
|
|
78
|
-
],
|
|
79
|
-
[colors.brown.base, colors.blueGrey.base, colors.grey.base],
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
/** Swatch size */
|
|
83
|
-
size: { type: String, default: '2rem' },
|
|
84
|
-
/** Selected icon */
|
|
85
|
-
icon: { type: String, default: 'mdi-checkbox-marked-circle' },
|
|
86
|
-
/** selected icon size */
|
|
87
|
-
iconSize: { type: String, default: '1rem' },
|
|
88
|
-
/**
|
|
89
|
-
* The variant prop gives you easy access to several different button styles..
|
|
90
|
-
*
|
|
91
|
-
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
|
|
92
|
-
*/
|
|
93
|
-
variant: {
|
|
94
|
-
type: String as PropType<
|
|
95
|
-
'elevated' | 'flat' | 'tonal' | 'outlined' | 'text' | 'plain'
|
|
96
|
-
>,
|
|
97
|
-
default: undefined,
|
|
98
|
-
},
|
|
99
|
-
/**
|
|
100
|
-
* Removes the ability to click or target the component.
|
|
101
|
-
*
|
|
102
|
-
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
|
|
103
|
-
*/
|
|
104
|
-
disabled: { type: Boolean, default: undefined },
|
|
105
|
-
/**
|
|
106
|
-
* Applies a large border radius on the button.
|
|
107
|
-
*
|
|
108
|
-
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#rounded}
|
|
109
|
-
*/
|
|
110
|
-
rounded: { type: String, Number, default: undefined },
|
|
111
|
-
},
|
|
112
|
-
/** Emits */
|
|
113
|
-
emits: ['update:modelValue'],
|
|
114
|
-
/**
|
|
115
|
-
* Setup
|
|
116
|
-
*
|
|
117
|
-
* @param props - Props
|
|
118
|
-
* @param context - Context
|
|
119
|
-
*/
|
|
120
|
-
setup(props, context: SetupContext) {
|
|
121
|
-
/** Check icon visibility */
|
|
122
|
-
const checkedVisibilty: Ref<boolean> = ref(false);
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Swatch button clicked handler
|
|
126
|
-
*
|
|
127
|
-
* @param e - Event
|
|
128
|
-
*/
|
|
129
|
-
const onSwatchClick = (e: Event) => {
|
|
130
|
-
const value = (e.target as HTMLButtonElement).dataset.value;
|
|
131
|
-
if (!value || props.modelValue === value) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
context.emit('update:modelValue', value);
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
checkedVisibilty,
|
|
139
|
-
onSwatchClick,
|
|
140
|
-
shades: colors.shades,
|
|
141
|
-
};
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
</script>
|
|
145
|
-
|
|
146
133
|
<style lang="scss">
|
|
147
|
-
@import '
|
|
134
|
+
@import '~/vuetify/lib/styles/settings';
|
|
148
135
|
|
|
149
136
|
.v-swatches {
|
|
150
137
|
.v-btn {
|