vuetify-swatches 1.0.0 → 1.3.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/README.md +77 -87
- package/dist/components/VSwatches.vue.d.ts +125 -217
- package/dist/components/VSwatches.vue.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.es.js +83 -93
- package/dist/index.iife.js +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/style.css +3 -3
- package/package.json +16 -28
- package/src/components/VSwatches.vue +24 -57
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
|
+
This branch is for vuetify3. Not usable for production, experimental use only. Bidirectional binding (select swatch button by value) does not work due to a problem on the Vuetify3 side.
|
|
12
|
+
|
|
11
13
|
This project is a remake of [saintplay's vue-swatches](https://saintplay.github.io/vue-swatches/) with [Vuetify](https://vuetifyjs.com/).
|
|
12
14
|
|
|
13
15
|
Unlike the original version, it provides a UI based on Vuetify, such as ripple effects and dark mode.
|
|
@@ -19,26 +21,20 @@ This library is positioned as a complement to Vuetify and provides a minimal UI.
|
|
|
19
21
|
In this example, the selected color is assigned to `selected`.
|
|
20
22
|
|
|
21
23
|
```vue
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
import Vue from 'vue';
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
import { ref, type Ref } from 'vue';
|
|
28
26
|
|
|
29
27
|
import VSwatches from 'vuetify-swatches';
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
data() {
|
|
33
|
-
return {
|
|
34
|
-
selected: '#ffffff',
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
});
|
|
29
|
+
const selected: Ref<string> = ref('#ffffff');
|
|
38
30
|
</script>
|
|
39
31
|
|
|
32
|
+
<template>
|
|
33
|
+
<v-swatches v-model="selected" />
|
|
34
|
+
</template>
|
|
35
|
+
|
|
40
36
|
<style>
|
|
41
|
-
@import 'vuetify-swatches/style.css';
|
|
37
|
+
@import 'vuetify-swatches/dist/style.css';
|
|
42
38
|
</style>
|
|
43
39
|
```
|
|
44
40
|
|
|
@@ -47,11 +43,64 @@ The method of specifying `swatches` is the same as [nested-color of Vue Swatches
|
|
|
47
43
|
If you want to make the color palette appear when you click it, combine it with VMenu.
|
|
48
44
|
|
|
49
45
|
```vue
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { ref, type Ref } from 'vue';
|
|
48
|
+
|
|
49
|
+
import VSwatches from 'vuetify-swatches';
|
|
50
|
+
|
|
51
|
+
const palette: Ref<string[] | string[][]> = ref([
|
|
52
|
+
[
|
|
53
|
+
'#ffb7b7',
|
|
54
|
+
'#ffdbb7',
|
|
55
|
+
'#ffffb7',
|
|
56
|
+
'#b7ffb7',
|
|
57
|
+
'#b7ffff',
|
|
58
|
+
'#b7b7ff',
|
|
59
|
+
'#ffb7ff',
|
|
60
|
+
'#ffffff',
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
'#ff5555',
|
|
64
|
+
'#ffa555',
|
|
65
|
+
'#ffff55',
|
|
66
|
+
'#55ff55',
|
|
67
|
+
'#55ffff',
|
|
68
|
+
'#5555ff',
|
|
69
|
+
'#ff55ff',
|
|
70
|
+
'#aaaaaa',
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
'#ff0000',
|
|
74
|
+
'#ff7f00',
|
|
75
|
+
'#ffff00',
|
|
76
|
+
'#00ff00',
|
|
77
|
+
'#00ffff',
|
|
78
|
+
'#0000ff',
|
|
79
|
+
'#ff00ff',
|
|
80
|
+
'#555555',
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
'#7f0000',
|
|
84
|
+
'#7f4c00',
|
|
85
|
+
'#7f7f00',
|
|
86
|
+
'#007f00',
|
|
87
|
+
'#007f7f',
|
|
88
|
+
'#00007f',
|
|
89
|
+
'#7f007f',
|
|
90
|
+
'#000000',
|
|
91
|
+
],
|
|
92
|
+
]);
|
|
93
|
+
const selected: Ref<string> = ref('#ffffff');
|
|
94
|
+
</script>
|
|
95
|
+
|
|
50
96
|
<template>
|
|
51
97
|
<v-menu offset-y>
|
|
52
|
-
<template #activator="{
|
|
53
|
-
<v-btn v-bind="
|
|
54
|
-
<v-icon
|
|
98
|
+
<template #activator="{ props }">
|
|
99
|
+
<v-btn v-bind="props" class="mb-3" min-width="auto" :color="selected">
|
|
100
|
+
<v-icon
|
|
101
|
+
:color="selected"
|
|
102
|
+
style="filter: invert(100%) grayscale(100%) contrast(100)"
|
|
103
|
+
>
|
|
55
104
|
mdi-menu-down
|
|
56
105
|
</v-icon>
|
|
57
106
|
</v-btn>
|
|
@@ -60,82 +109,23 @@ If you want to make the color palette appear when you click it, combine it with
|
|
|
60
109
|
</v-menu>
|
|
61
110
|
</template>
|
|
62
111
|
|
|
63
|
-
<script>
|
|
64
|
-
import Vue from 'vue';
|
|
65
|
-
|
|
66
|
-
import VSwatches from 'vuetify-swatches';
|
|
67
|
-
|
|
68
|
-
export default Vue.extend({
|
|
69
|
-
data() {
|
|
70
|
-
return {
|
|
71
|
-
selected: '#ffffff',
|
|
72
|
-
palette: [
|
|
73
|
-
[
|
|
74
|
-
'#ffb7b7',
|
|
75
|
-
'#ffdbb7',
|
|
76
|
-
'#ffffb7',
|
|
77
|
-
'#b7ffb7',
|
|
78
|
-
'#b7ffff',
|
|
79
|
-
'#b7b7ff',
|
|
80
|
-
'#ffb7ff',
|
|
81
|
-
'#ffffff',
|
|
82
|
-
],
|
|
83
|
-
[
|
|
84
|
-
'#ff5555',
|
|
85
|
-
'#ffa555',
|
|
86
|
-
'#ffff55',
|
|
87
|
-
'#55ff55',
|
|
88
|
-
'#55ffff',
|
|
89
|
-
'#5555ff',
|
|
90
|
-
'#ff55ff',
|
|
91
|
-
'#aaaaaa',
|
|
92
|
-
],
|
|
93
|
-
[
|
|
94
|
-
'#ff0000',
|
|
95
|
-
'#ff7f00',
|
|
96
|
-
'#ffff00',
|
|
97
|
-
'#00ff00',
|
|
98
|
-
'#00ffff',
|
|
99
|
-
'#0000ff',
|
|
100
|
-
'#ff00ff',
|
|
101
|
-
'#555555',
|
|
102
|
-
],
|
|
103
|
-
[
|
|
104
|
-
'#7f0000',
|
|
105
|
-
'#7f4c00',
|
|
106
|
-
'#7f7f00',
|
|
107
|
-
'#007f00',
|
|
108
|
-
'#007f7f',
|
|
109
|
-
'#00007f',
|
|
110
|
-
'#7f007f',
|
|
111
|
-
'#000000',
|
|
112
|
-
],
|
|
113
|
-
],
|
|
114
|
-
};
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
</script>
|
|
118
|
-
|
|
119
112
|
<style>
|
|
120
|
-
@import 'vuetify-swatches/style.css';
|
|
113
|
+
@import 'vuetify-swatches/dist/style.css';
|
|
121
114
|
</style>
|
|
122
115
|
```
|
|
123
116
|
|
|
124
117
|
### Options
|
|
125
118
|
|
|
126
|
-
| Variables | Type | Default
|
|
127
|
-
| --------- | -------------- |
|
|
128
|
-
| size | string | 2rem
|
|
129
|
-
| icon | string | mdi-checkbox-marked-circle
|
|
130
|
-
| icon-size | string | 1rem
|
|
131
|
-
|
|
|
132
|
-
|
|
|
133
|
-
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
| raised | true | Raised buttons have a box shadow that increases when clicked. This is the default style. |
|
|
137
|
-
| rounded | false | Applies a large border radius on the button. |
|
|
138
|
-
| tile | false | Removes the component’s border-radius. |
|
|
119
|
+
| Variables | Type | Default | Info |
|
|
120
|
+
| --------- | -------------- | -------------------------- | -------------------------------------------------------------------------- |
|
|
121
|
+
| size | string | 2rem | Swatch Button size |
|
|
122
|
+
| icon | string | mdi-checkbox-marked-circle | checked icon |
|
|
123
|
+
| icon-size | string | 1rem | checked icon size |
|
|
124
|
+
| disabled | boolean | false | Removes the ability to click or target the component. |
|
|
125
|
+
| rounded | number\|string | undefined | Applies a large border radius on the button. |
|
|
126
|
+
| variant | string [^1] | undefined | The variant prop gives you easy access to several different button styles. |
|
|
127
|
+
|
|
128
|
+
[^1] Available variants are: elevated(default), flat, tonal, outlined, text, and plain.
|
|
139
129
|
|
|
140
130
|
## LICENSE
|
|
141
131
|
|
|
@@ -1,218 +1,126 @@
|
|
|
1
|
-
import { type PropType, type Ref } from 'vue
|
|
2
|
-
/** Vuetify Swatches */
|
|
3
|
-
declare const _default: import("vue
|
|
4
|
-
/** Model value */
|
|
5
|
-
modelValue: {
|
|
6
|
-
type: StringConstructor;
|
|
7
|
-
default:
|
|
8
|
-
};
|
|
9
|
-
/** Swatch colors */
|
|
10
|
-
swatches: {
|
|
11
|
-
type: PropType<string[] | string[][]>;
|
|
12
|
-
default: () =>
|
|
13
|
-
};
|
|
14
|
-
/** Swatch
|
|
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
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
type:
|
|
36
|
-
default:
|
|
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:
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @see {@link https://vuetifyjs.com/en/
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
type:
|
|
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
|
-
default:
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
iconSize: {
|
|
127
|
-
type: StringConstructor;
|
|
128
|
-
default: string;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Removes the button box shadow.
|
|
132
|
-
*
|
|
133
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#depressed}
|
|
134
|
-
*/
|
|
135
|
-
depressed: {
|
|
136
|
-
type: BooleanConstructor;
|
|
137
|
-
default: boolean;
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* Removes the ability to click or target the component.
|
|
141
|
-
*
|
|
142
|
-
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
|
|
143
|
-
*/
|
|
144
|
-
disabled: {
|
|
145
|
-
type: BooleanConstructor;
|
|
146
|
-
default: boolean;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* Designates an elevation applied to the component between 0 and 24.
|
|
150
|
-
*
|
|
151
|
-
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
|
|
152
|
-
*/
|
|
153
|
-
elevation: {
|
|
154
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
155
|
-
default: undefined;
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* Makes the background transparent and applies a thin border.
|
|
159
|
-
*
|
|
160
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#outlined}
|
|
161
|
-
*/
|
|
162
|
-
outlined: {
|
|
163
|
-
type: BooleanConstructor;
|
|
164
|
-
default: boolean;
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* Removes the default background change applied when hovering over the button.
|
|
168
|
-
*
|
|
169
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#plain}
|
|
170
|
-
*/
|
|
171
|
-
plain: {
|
|
172
|
-
type: BooleanConstructor;
|
|
173
|
-
default: boolean;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Raised buttons have a box shadow that increases when clicked. This is the default style.
|
|
177
|
-
*
|
|
178
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#raised}
|
|
179
|
-
*/
|
|
180
|
-
raised: {
|
|
181
|
-
type: BooleanConstructor;
|
|
182
|
-
default: boolean;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* Applies a large border radius on the button.
|
|
186
|
-
*
|
|
187
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
|
|
188
|
-
*/
|
|
189
|
-
rounded: {
|
|
190
|
-
type: BooleanConstructor;
|
|
191
|
-
default: boolean;
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Removes the component’s border-radius.
|
|
195
|
-
*
|
|
196
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#tile}
|
|
197
|
-
*/
|
|
198
|
-
tile: {
|
|
199
|
-
type: BooleanConstructor;
|
|
200
|
-
default: boolean;
|
|
201
|
-
};
|
|
202
|
-
}>>, {
|
|
203
|
-
modelValue: string;
|
|
204
|
-
swatches: string[] | string[][];
|
|
205
|
-
size: string;
|
|
206
|
-
icon: string;
|
|
207
|
-
iconSize: string;
|
|
208
|
-
depressed: boolean;
|
|
209
|
-
disabled: boolean;
|
|
210
|
-
elevation: string | number;
|
|
211
|
-
outlined: boolean;
|
|
212
|
-
plain: boolean;
|
|
213
|
-
raised: boolean;
|
|
214
|
-
rounded: boolean;
|
|
215
|
-
tile: boolean;
|
|
216
|
-
}>;
|
|
217
|
-
export default _default;
|
|
1
|
+
import { type PropType, type Ref } from 'vue';
|
|
2
|
+
/** Vuetify Swatches */
|
|
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<"text" | "elevated" | "flat" | "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;
|
|
54
|
+
Number: NumberConstructor;
|
|
55
|
+
default: undefined;
|
|
56
|
+
};
|
|
57
|
+
}, {
|
|
58
|
+
checkedVisibilty: Ref<boolean>;
|
|
59
|
+
onSwatchClick: (e: Event) => void;
|
|
60
|
+
shades: any;
|
|
61
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
62
|
+
/** Model value */
|
|
63
|
+
modelValue: {
|
|
64
|
+
type: StringConstructor;
|
|
65
|
+
default: any;
|
|
66
|
+
};
|
|
67
|
+
/** Swatch colors */
|
|
68
|
+
swatches: {
|
|
69
|
+
type: PropType<string[] | string[][]>;
|
|
70
|
+
default: () => any[][];
|
|
71
|
+
};
|
|
72
|
+
/** Swatch size */
|
|
73
|
+
size: {
|
|
74
|
+
type: StringConstructor;
|
|
75
|
+
default: string;
|
|
76
|
+
};
|
|
77
|
+
/** Selected icon */
|
|
78
|
+
icon: {
|
|
79
|
+
type: StringConstructor;
|
|
80
|
+
default: string;
|
|
81
|
+
};
|
|
82
|
+
/** selected icon size */
|
|
83
|
+
iconSize: {
|
|
84
|
+
type: StringConstructor;
|
|
85
|
+
default: string;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* The variant prop gives you easy access to several different button styles..
|
|
89
|
+
*
|
|
90
|
+
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
|
|
91
|
+
*/
|
|
92
|
+
variant: {
|
|
93
|
+
type: PropType<"text" | "elevated" | "flat" | "tonal" | "outlined" | "plain">;
|
|
94
|
+
default: undefined;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Removes the ability to click or target the component.
|
|
98
|
+
*
|
|
99
|
+
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
|
|
100
|
+
*/
|
|
101
|
+
disabled: {
|
|
102
|
+
type: BooleanConstructor;
|
|
103
|
+
default: undefined;
|
|
104
|
+
};
|
|
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: {
|
|
111
|
+
type: StringConstructor;
|
|
112
|
+
Number: NumberConstructor;
|
|
113
|
+
default: undefined;
|
|
114
|
+
};
|
|
115
|
+
}>>, {
|
|
116
|
+
modelValue: string;
|
|
117
|
+
swatches: string[] | string[][];
|
|
118
|
+
size: string;
|
|
119
|
+
icon: string;
|
|
120
|
+
iconSize: string;
|
|
121
|
+
variant: "text" | "elevated" | "flat" | "tonal" | "outlined" | "plain";
|
|
122
|
+
disabled: boolean;
|
|
123
|
+
rounded: string;
|
|
124
|
+
}>;
|
|
125
|
+
export default _default;
|
|
218
126
|
//# sourceMappingURL=VSwatches.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,GAAG,EAET,MAAM,
|
|
1
|
+
{"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,GAAG,EAET,MAAM,KAAK,CAAC;AAKb,uBAAuB;;IAUnB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;;;uBAoBuB,KAAK;;;IA7E/B,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAOH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;AAlEP,wBAoGG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import VSwatches from './components/VSwatches.vue';
|
|
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
|
@@ -1,129 +1,119 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* vuetify-swatches
|
|
3
3
|
*
|
|
4
|
-
* @description Color Swatch component for
|
|
4
|
+
* @description Color Swatch component for Vuetify3.
|
|
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.
|
|
8
|
+
* @version 1.3.0
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { defineComponent as
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
const S = b({
|
|
12
|
+
import { defineComponent as k, ref as S, resolveComponent as d, openBlock as n, createBlock as u, withCtx as c, createElementBlock as p, Fragment as b, renderList as h, normalizeClass as _, createTextVNode as C, toDisplayString as z, createCommentVNode as B } from "vue";
|
|
13
|
+
import e from "vuetify/lib/util/colors.mjs";
|
|
14
|
+
const $ = k({
|
|
16
15
|
name: "VSwatches",
|
|
17
|
-
components: {
|
|
18
|
-
VSheet: y,
|
|
19
|
-
VBtn: w,
|
|
20
|
-
VIcon: V
|
|
21
|
-
},
|
|
22
16
|
model: {
|
|
23
17
|
prop: "modelValue",
|
|
24
18
|
event: "update:modelValue"
|
|
25
19
|
},
|
|
26
20
|
props: {
|
|
27
|
-
modelValue: { type: String, default:
|
|
21
|
+
modelValue: { type: String, default: e.shades.white },
|
|
28
22
|
swatches: {
|
|
29
23
|
type: Array,
|
|
30
24
|
default: () => [
|
|
31
|
-
[
|
|
25
|
+
[e.shades.black, e.shades.white, e.shades.transparent],
|
|
32
26
|
[
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
e.red.base,
|
|
28
|
+
e.pink.base,
|
|
29
|
+
e.purple.base,
|
|
30
|
+
e.deepPurple.base,
|
|
31
|
+
e.indigo.base,
|
|
32
|
+
e.blue.base,
|
|
33
|
+
e.lightBlue.base,
|
|
34
|
+
e.cyan.base
|
|
41
35
|
],
|
|
42
36
|
[
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
e.teal.base,
|
|
38
|
+
e.green.base,
|
|
39
|
+
e.lightGreen.base,
|
|
40
|
+
e.lime.base,
|
|
41
|
+
e.yellow.base,
|
|
42
|
+
e.amber.base,
|
|
43
|
+
e.orange.base,
|
|
44
|
+
e.deepOrange.base
|
|
51
45
|
],
|
|
52
|
-
[
|
|
46
|
+
[e.brown.base, e.blueGrey.base, e.grey.base]
|
|
53
47
|
]
|
|
54
48
|
},
|
|
55
49
|
size: { type: String, default: "2rem" },
|
|
56
50
|
icon: { type: String, default: "mdi-checkbox-marked-circle" },
|
|
57
51
|
iconSize: { type: String, default: "1rem" },
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
rounded: { type: Boolean, default: !1 },
|
|
65
|
-
tile: { type: Boolean, default: !1 }
|
|
52
|
+
variant: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: void 0
|
|
55
|
+
},
|
|
56
|
+
disabled: { type: Boolean, default: void 0 },
|
|
57
|
+
rounded: { type: String, Number, default: void 0 }
|
|
66
58
|
},
|
|
67
59
|
emits: ["update:modelValue"],
|
|
68
|
-
setup(
|
|
60
|
+
setup(t, s) {
|
|
69
61
|
return {
|
|
70
|
-
checkedVisibilty:
|
|
71
|
-
onSwatchClick: (
|
|
72
|
-
const
|
|
73
|
-
!
|
|
74
|
-
}
|
|
62
|
+
checkedVisibilty: S(!1),
|
|
63
|
+
onSwatchClick: (o) => {
|
|
64
|
+
const l = o.target.dataset.value;
|
|
65
|
+
!l || t.modelValue === l || s.emit("update:modelValue", l);
|
|
66
|
+
},
|
|
67
|
+
shades: e.shades
|
|
75
68
|
};
|
|
76
69
|
}
|
|
77
70
|
});
|
|
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
|
-
|
|
71
|
+
const N = (t, s) => {
|
|
72
|
+
const i = t.__vccOpts || t;
|
|
73
|
+
for (const [r, o] of s)
|
|
74
|
+
i[r] = o;
|
|
75
|
+
return i;
|
|
76
|
+
};
|
|
77
|
+
function G(t, s, i, r, o, l) {
|
|
78
|
+
const v = d("v-icon"), f = d("v-btn"), w = d("v-sheet");
|
|
79
|
+
return n(), u(w, { class: "v-swatches" }, {
|
|
80
|
+
default: c(() => [
|
|
81
|
+
(n(!0), p(b, null, h(t.swatches, (y, g) => (n(), p("div", { key: g }, [
|
|
82
|
+
(n(!0), p(b, null, h(y, (a) => (n(), u(f, {
|
|
83
|
+
key: a,
|
|
84
|
+
color: a,
|
|
85
|
+
disabled: t.disabled,
|
|
86
|
+
height: t.size,
|
|
87
|
+
value: a,
|
|
88
|
+
variant: t.variant,
|
|
89
|
+
width: t.size,
|
|
90
|
+
"data-value": a,
|
|
91
|
+
class: _(a === t.shades.transparent ? "bg-trasparent" : ""),
|
|
92
|
+
"min-width": "auto",
|
|
93
|
+
onClick: s[0] || (s[0] = (V) => t.onSwatchClick(V))
|
|
94
|
+
}, {
|
|
95
|
+
default: c(() => [
|
|
96
|
+
a === t.modelValue ? (n(), u(v, {
|
|
97
|
+
key: 0,
|
|
98
|
+
size: t.iconSize,
|
|
99
|
+
color: a !== t.shades.transparent ? a : void 0
|
|
100
|
+
}, {
|
|
101
|
+
default: c(() => [
|
|
102
|
+
C(z(t.icon), 1)
|
|
103
|
+
]),
|
|
104
|
+
_: 2
|
|
105
|
+
}, 1032, ["size", "color"])) : B("", !0)
|
|
106
|
+
]),
|
|
107
|
+
_: 2
|
|
108
|
+
}, 1032, ["color", "disabled", "height", "value", "variant", "width", "data-value", "class"]))), 128))
|
|
109
|
+
]))), 128))
|
|
110
|
+
]),
|
|
111
|
+
_: 1
|
|
112
|
+
});
|
|
104
113
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return e._self._setupProxy, r("v-sheet", { staticClass: "v-swatches" }, e._l(e.swatches, function(d, i) {
|
|
108
|
-
return r("div", { key: i }, e._l(d, function(n) {
|
|
109
|
-
return r("v-btn", { key: n, attrs: { color: n, depressed: e.depressed, disabled: e.disabled, elevation: e.elevation, height: e.size, outlined: e.outlined, plain: e.plain, raised: e.raised, tile: e.tile, value: n, width: e.size, "min-width": "auto" }, on: { click: function(u) {
|
|
110
|
-
return e.onSwatchClick(u);
|
|
111
|
-
} } }, [n === e.modelValue ? r("v-icon", { attrs: { size: e.iconSize, color: n !== "transparent" ? n : void 0 } }, [e._v(" " + e._s(e.icon) + " ")]) : e._e()], 1);
|
|
112
|
-
}), 1);
|
|
113
|
-
}), 0);
|
|
114
|
-
}, k = [], B = /* @__PURE__ */ g(
|
|
115
|
-
S,
|
|
116
|
-
C,
|
|
117
|
-
k,
|
|
118
|
-
!1,
|
|
119
|
-
null,
|
|
120
|
-
null,
|
|
121
|
-
null,
|
|
122
|
-
null
|
|
123
|
-
);
|
|
124
|
-
const c = B.exports, T = (s) => s.component("VSwatches", c);
|
|
125
|
-
typeof window < "u" && window.Vue && window.Vue.use(c);
|
|
114
|
+
const m = /* @__PURE__ */ N($, [["render", G]]), D = (t) => t.component("VSwatches", m);
|
|
115
|
+
typeof window < "u" && window.Vue && window.Vue.use(m);
|
|
126
116
|
export {
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
m as default,
|
|
118
|
+
D as install
|
|
129
119
|
};
|
package/dist/index.iife.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* vuetify-swatches
|
|
3
3
|
*
|
|
4
|
-
* @description Color Swatch component for
|
|
4
|
+
* @description Color Swatch component for Vuetify3.
|
|
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.
|
|
8
|
+
* @version 1.3.0
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
var VSwatches=function(
|
|
12
|
+
var VSwatches=function(s,e,u){"use strict";const t=(a=>a&&typeof a=="object"&&"default"in a?a:{default:a})(u),f=e.defineComponent({name:"VSwatches",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:t.default.shades.white},swatches:{type:Array,default:()=>[[t.default.shades.black,t.default.shades.white,t.default.shades.transparent],[t.default.red.base,t.default.pink.base,t.default.purple.base,t.default.deepPurple.base,t.default.indigo.base,t.default.blue.base,t.default.lightBlue.base,t.default.cyan.base],[t.default.teal.base,t.default.green.base,t.default.lightGreen.base,t.default.lime.base,t.default.yellow.base,t.default.amber.base,t.default.orange.base,t.default.deepOrange.base],[t.default.brown.base,t.default.blueGrey.base,t.default.grey.base]]},size:{type:String,default:"2rem"},icon:{type:String,default:"mdi-checkbox-marked-circle"},iconSize:{type:String,default:"1rem"},variant:{type:String,default:void 0},disabled:{type:Boolean,default:void 0},rounded:{type:String,Number,default:void 0}},emits:["update:modelValue"],setup(a,n){return{checkedVisibilty:e.ref(!1),onSwatchClick:o=>{const i=o.target.dataset.value;!i||a.modelValue===i||n.emit("update:modelValue",i)},shades:t.default.shades}}}),V="",p=(a,n)=>{const d=a.__vccOpts||a;for(const[c,o]of n)d[c]=o;return d};function b(a,n,d,c,o,i){const m=e.resolveComponent("v-icon"),w=e.resolveComponent("v-btn"),y=e.resolveComponent("v-sheet");return e.openBlock(),e.createBlock(y,{class:"v-swatches"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.swatches,(g,k)=>(e.openBlock(),e.createElementBlock("div",{key:k},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g,l=>(e.openBlock(),e.createBlock(w,{key:l,color:l,disabled:a.disabled,height:a.size,value:l,variant:a.variant,width:a.size,"data-value":l,class:e.normalizeClass(l===a.shades.transparent?"bg-trasparent":""),"min-width":"auto",onClick:n[0]||(n[0]=_=>a.onSwatchClick(_))},{default:e.withCtx(()=>[l===a.modelValue?(e.openBlock(),e.createBlock(m,{key:0,size:a.iconSize,color:l!==a.shades.transparent?l:void 0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.icon),1)]),_:2},1032,["size","color"])):e.createCommentVNode("",!0)]),_:2},1032,["color","disabled","height","value","variant","width","data-value","class"]))),128))]))),128))]),_:1})}const r=p(f,[["render",b]]),h=a=>a.component("VSwatches",r);return typeof window<"u"&&window.Vue&&window.Vue.use(r),s.default=r,s.install=h,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),s}({},Vue,colors);
|
package/dist/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* vuetify-swatches
|
|
3
3
|
*
|
|
4
|
-
* @description Color Swatch component for
|
|
4
|
+
* @description Color Swatch component for Vuetify3.
|
|
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.
|
|
8
|
+
* @version 1.3.0
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
(function(
|
|
12
|
+
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vuetify/lib/util/colors.mjs")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify/lib/util/colors.mjs"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.VSwatches={},n.Vue,n.colors))})(this,function(n,e,c){"use strict";const t=(a=>a&&typeof a=="object"&&"default"in a?a:{default:a})(c),f=e.defineComponent({name:"VSwatches",model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,default:t.default.shades.white},swatches:{type:Array,default:()=>[[t.default.shades.black,t.default.shades.white,t.default.shades.transparent],[t.default.red.base,t.default.pink.base,t.default.purple.base,t.default.deepPurple.base,t.default.indigo.base,t.default.blue.base,t.default.lightBlue.base,t.default.cyan.base],[t.default.teal.base,t.default.green.base,t.default.lightGreen.base,t.default.lime.base,t.default.yellow.base,t.default.amber.base,t.default.orange.base,t.default.deepOrange.base],[t.default.brown.base,t.default.blueGrey.base,t.default.grey.base]]},size:{type:String,default:"2rem"},icon:{type:String,default:"mdi-checkbox-marked-circle"},iconSize:{type:String,default:"1rem"},variant:{type:String,default:void 0},disabled:{type:Boolean,default:void 0},rounded:{type:String,Number,default:void 0}},emits:["update:modelValue"],setup(a,s){return{checkedVisibilty:e.ref(!1),onSwatchClick:d=>{const i=d.target.dataset.value;!i||a.modelValue===i||s.emit("update:modelValue",i)},shades:t.default.shades}}}),V="",p=(a,s)=>{const o=a.__vccOpts||a;for(const[u,d]of s)o[u]=d;return o};function h(a,s,o,u,d,i){const b=e.resolveComponent("v-icon"),y=e.resolveComponent("v-btn"),w=e.resolveComponent("v-sheet");return e.openBlock(),e.createBlock(w,{class:"v-swatches"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.swatches,(k,g)=>(e.openBlock(),e.createElementBlock("div",{key:g},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k,l=>(e.openBlock(),e.createBlock(y,{key:l,color:l,disabled:a.disabled,height:a.size,value:l,variant:a.variant,width:a.size,"data-value":l,class:e.normalizeClass(l===a.shades.transparent?"bg-trasparent":""),"min-width":"auto",onClick:s[0]||(s[0]=_=>a.onSwatchClick(_))},{default:e.withCtx(()=>[l===a.modelValue?(e.openBlock(),e.createBlock(b,{key:0,size:a.iconSize,color:l!==a.shades.transparent?l:void 0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.icon),1)]),_:2},1032,["size","color"])):e.createCommentVNode("",!0)]),_:2},1032,["color","disabled","height","value","variant","width","data-value","class"]))),128))]))),128))]),_:1})}const r=p(f,[["render",h]]),m=a=>a.component("VSwatches",r);typeof window<"u"&&window.Vue&&window.Vue.use(r),n.default=r,n.install=m,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* vuetify-swatches
|
|
3
3
|
*
|
|
4
|
-
* @description Color Swatch component for
|
|
4
|
+
* @description Color Swatch component for Vuetify3.
|
|
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.
|
|
8
|
+
* @version 1.3.0
|
|
9
9
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
.v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%) grayscale(100%) contrast(100)}.v-swatches .v-btn.
|
|
12
|
+
.v-swatches .v-btn{padding:0!important;margin:.1rem}.v-swatches .v-btn .v-icon{filter:invert(100%) grayscale(100%) contrast(100)}.v-swatches .v-btn.bg-trasparent{background:linear-gradient(to top left,transparent 0,transparent calc(50% - .1rem),#F44336 50%,transparent calc(50% + .1rem),transparent)}.v-swatches .v-btn.bg-trasparent .v-icon{filter:none}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "vuetify-swatches",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"
|
|
6
|
-
"description": "Color Swatch component for Vuetify.",
|
|
4
|
+
"version": "1.3.0",
|
|
5
|
+
"description": "Color Swatch component for Vuetify3.",
|
|
7
6
|
"keywords": [
|
|
8
7
|
"vuejs",
|
|
9
8
|
"vue",
|
|
@@ -11,12 +10,14 @@
|
|
|
11
10
|
"color-picker",
|
|
12
11
|
"color-palette",
|
|
13
12
|
"swatches",
|
|
14
|
-
"
|
|
13
|
+
"vue3",
|
|
15
14
|
"vue-plugin",
|
|
16
15
|
"vue-resource",
|
|
17
16
|
"vuetify",
|
|
17
|
+
"vuetify3",
|
|
18
18
|
"vuetify-components"
|
|
19
19
|
],
|
|
20
|
+
"license": "MIT",
|
|
20
21
|
"type": "module",
|
|
21
22
|
"author": {
|
|
22
23
|
"name": "Logue",
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
"types": "dist/index.d.ts",
|
|
37
38
|
"style": "dist/style.css",
|
|
38
39
|
"browser": {
|
|
39
|
-
"sfc": "src/components/VSwatches.vue"
|
|
40
|
+
"./sfc": "./src/components/VSwatches.vue"
|
|
40
41
|
},
|
|
41
42
|
"exports": {
|
|
42
43
|
".": {
|
|
@@ -52,17 +53,17 @@
|
|
|
52
53
|
"dist",
|
|
53
54
|
"src/components/VSwatches.vue"
|
|
54
55
|
],
|
|
55
|
-
"sideEffects": false,
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=16.17.0",
|
|
58
58
|
"yarn": ">=1.22.10"
|
|
59
59
|
},
|
|
60
|
-
"packageManager": "yarn@3.2.
|
|
60
|
+
"packageManager": "yarn@3.2.3",
|
|
61
|
+
"sideEffects": false,
|
|
61
62
|
"scripts": {
|
|
62
63
|
"dev": "vite",
|
|
63
64
|
"clean": "rimraf node_modules/.vite ",
|
|
64
65
|
"build": "vite build & vue-tsc --declaration --emitDeclarationOnly",
|
|
65
|
-
"build:analyze": "vue-tsc --noEmit
|
|
66
|
+
"build:analyze": "vue-tsc --noEmit & vite build --mode analyze",
|
|
66
67
|
"build:docs": "vite build --config vite.config.docs.ts",
|
|
67
68
|
"build:clean": "rimraf dist",
|
|
68
69
|
"lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . -w -u",
|
|
@@ -71,27 +72,16 @@
|
|
|
71
72
|
"preview": "vite preview --config vite.config.docs.ts",
|
|
72
73
|
"prepare": "husky install"
|
|
73
74
|
},
|
|
74
|
-
"dependencies": {
|
|
75
|
-
"vue-demi": "latest"
|
|
76
|
-
},
|
|
77
75
|
"peerDependencies": {
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"vuetify": "^2.6.10"
|
|
81
|
-
},
|
|
82
|
-
"peerDependenciesMeta": {
|
|
83
|
-
"@vue/composition-api": {
|
|
84
|
-
"optional": true
|
|
85
|
-
}
|
|
76
|
+
"vue": "^3.2.39",
|
|
77
|
+
"vuetify": "^3.0.0-beta.10"
|
|
86
78
|
},
|
|
87
79
|
"devDependencies": {
|
|
88
80
|
"@codemirror/lang-html": "^6.1.1",
|
|
89
|
-
"@types/lodash": "^4.14.185",
|
|
90
81
|
"@types/node": "^18.7.18",
|
|
91
82
|
"@typescript-eslint/eslint-plugin": "^5.37.0",
|
|
92
83
|
"@typescript-eslint/parser": "^5.37.0",
|
|
93
|
-
"@vitejs/plugin-
|
|
94
|
-
"@vue/eslint-config-prettier": "^7.0.0",
|
|
84
|
+
"@vitejs/plugin-vue": "^3.1.0",
|
|
95
85
|
"@vue/tsconfig": "^0.1.3",
|
|
96
86
|
"codemirror": "^6.0.1",
|
|
97
87
|
"eslint": "^8.23.1",
|
|
@@ -99,7 +89,6 @@
|
|
|
99
89
|
"eslint-config-prettier": "^8.5.0",
|
|
100
90
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
101
91
|
"eslint-import-resolver-typescript": "^3.5.1",
|
|
102
|
-
"eslint-plugin-html": "^7.1.0",
|
|
103
92
|
"eslint-plugin-import": "^2.26.0",
|
|
104
93
|
"eslint-plugin-jsdoc": "^39.3.6",
|
|
105
94
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
@@ -113,7 +102,7 @@
|
|
|
113
102
|
"prettier": "^2.7.1",
|
|
114
103
|
"rimraf": "^3.0.2",
|
|
115
104
|
"rollup-plugin-visualizer": "^5.8.1",
|
|
116
|
-
"sass": "1.
|
|
105
|
+
"sass": "1.54.9",
|
|
117
106
|
"stylelint": "^14.11.0",
|
|
118
107
|
"stylelint-config-prettier": "^9.0.3",
|
|
119
108
|
"stylelint-config-recommended-scss": "^7.0.0",
|
|
@@ -121,16 +110,15 @@
|
|
|
121
110
|
"stylelint-order": "^5.0.0",
|
|
122
111
|
"stylelint-prettier": "^2.0.0",
|
|
123
112
|
"typescript": "^4.8.3",
|
|
124
|
-
"unplugin-vue-components": "^0.22.7",
|
|
125
113
|
"vite": "^3.1.0",
|
|
126
114
|
"vite-plugin-banner": "^0.5.0",
|
|
127
115
|
"vite-plugin-checker": "^0.5.1",
|
|
128
|
-
"
|
|
116
|
+
"vite-plugin-vuetify": "^1.0.0-alpha.17",
|
|
117
|
+
"vue": "^3.2.39",
|
|
129
118
|
"vue-codemirror6": "1.0.1",
|
|
130
119
|
"vue-eslint-parser": "^9.1.0",
|
|
131
|
-
"vue-template-compiler": "^2.7.10",
|
|
132
120
|
"vue-tsc": "^0.40.13",
|
|
133
|
-
"vuetify": "^
|
|
121
|
+
"vuetify": "^3.0.0-beta.10"
|
|
134
122
|
},
|
|
135
123
|
"husky": {
|
|
136
124
|
"hooks": {
|
|
@@ -5,23 +5,20 @@
|
|
|
5
5
|
v-for="color in colors"
|
|
6
6
|
:key="color"
|
|
7
7
|
:color="color"
|
|
8
|
-
:depressed="depressed"
|
|
9
8
|
:disabled="disabled"
|
|
10
|
-
:elevation="elevation"
|
|
11
9
|
:height="size"
|
|
12
|
-
:outlined="outlined"
|
|
13
|
-
:plain="plain"
|
|
14
|
-
:raised="raised"
|
|
15
|
-
:tile="tile"
|
|
16
10
|
:value="color"
|
|
11
|
+
:variant="variant"
|
|
17
12
|
:width="size"
|
|
13
|
+
:data-value="color"
|
|
14
|
+
:class="color === shades.transparent ? 'bg-trasparent' : ''"
|
|
18
15
|
min-width="auto"
|
|
19
16
|
@click="onSwatchClick($event)"
|
|
20
17
|
>
|
|
21
18
|
<v-icon
|
|
22
19
|
v-if="color === modelValue"
|
|
23
20
|
:size="iconSize"
|
|
24
|
-
:color="color !==
|
|
21
|
+
:color="color !== shades.transparent ? color : undefined"
|
|
25
22
|
>
|
|
26
23
|
{{ icon }}
|
|
27
24
|
</v-icon>
|
|
@@ -37,21 +34,15 @@ import {
|
|
|
37
34
|
type PropType,
|
|
38
35
|
type Ref,
|
|
39
36
|
type SetupContext,
|
|
40
|
-
} from 'vue
|
|
37
|
+
} from 'vue';
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
import colors from 'vuetify/lib/util/colors';
|
|
39
|
+
// eslint-disable-next-line import/no-unresolved
|
|
40
|
+
import colors from 'vuetify/lib/util/colors.mjs';
|
|
44
41
|
|
|
45
42
|
/** Vuetify Swatches */
|
|
46
43
|
export default defineComponent({
|
|
47
44
|
/** Component name */
|
|
48
45
|
name: 'VSwatches',
|
|
49
|
-
/** Components */
|
|
50
|
-
components: {
|
|
51
|
-
VSheet,
|
|
52
|
-
VBtn,
|
|
53
|
-
VIcon,
|
|
54
|
-
},
|
|
55
46
|
/** Model Definition */
|
|
56
47
|
model: {
|
|
57
48
|
prop: 'modelValue',
|
|
@@ -59,7 +50,7 @@ export default defineComponent({
|
|
|
59
50
|
},
|
|
60
51
|
props: {
|
|
61
52
|
/** Model value */
|
|
62
|
-
modelValue: { type: String, default:
|
|
53
|
+
modelValue: { type: String, default: colors.shades.white },
|
|
63
54
|
/** Swatch colors */
|
|
64
55
|
swatches: {
|
|
65
56
|
type: Array as PropType<string[] | string[][]>,
|
|
@@ -88,60 +79,35 @@ export default defineComponent({
|
|
|
88
79
|
[colors.brown.base, colors.blueGrey.base, colors.grey.base],
|
|
89
80
|
],
|
|
90
81
|
},
|
|
91
|
-
/** Swatch
|
|
82
|
+
/** Swatch size */
|
|
92
83
|
size: { type: String, default: '2rem' },
|
|
93
84
|
/** Selected icon */
|
|
94
85
|
icon: { type: String, default: 'mdi-checkbox-marked-circle' },
|
|
95
86
|
/** selected icon size */
|
|
96
87
|
iconSize: { type: String, default: '1rem' },
|
|
97
88
|
/**
|
|
98
|
-
*
|
|
89
|
+
* The variant prop gives you easy access to several different button styles..
|
|
99
90
|
*
|
|
100
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#
|
|
91
|
+
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#variant}
|
|
101
92
|
*/
|
|
102
|
-
|
|
93
|
+
variant: {
|
|
94
|
+
type: String as PropType<
|
|
95
|
+
'elevated' | 'flat' | 'tonal' | 'outlined' | 'text' | 'plain'
|
|
96
|
+
>,
|
|
97
|
+
default: undefined,
|
|
98
|
+
},
|
|
103
99
|
/**
|
|
104
100
|
* Removes the ability to click or target the component.
|
|
105
101
|
*
|
|
106
102
|
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-disabled}
|
|
107
103
|
*/
|
|
108
|
-
disabled: { type: Boolean, default:
|
|
109
|
-
/**
|
|
110
|
-
* Designates an elevation applied to the component between 0 and 24.
|
|
111
|
-
*
|
|
112
|
-
* @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
|
|
113
|
-
*/
|
|
114
|
-
elevation: { type: [Number, String], default: undefined },
|
|
115
|
-
/**
|
|
116
|
-
* Makes the background transparent and applies a thin border.
|
|
117
|
-
*
|
|
118
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#outlined}
|
|
119
|
-
*/
|
|
120
|
-
outlined: { type: Boolean, default: false },
|
|
121
|
-
/**
|
|
122
|
-
* Removes the default background change applied when hovering over the button.
|
|
123
|
-
*
|
|
124
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#plain}
|
|
125
|
-
*/
|
|
126
|
-
plain: { type: Boolean, default: false },
|
|
127
|
-
/**
|
|
128
|
-
* Raised buttons have a box shadow that increases when clicked. This is the default style.
|
|
129
|
-
*
|
|
130
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#raised}
|
|
131
|
-
*/
|
|
132
|
-
raised: { type: Boolean, default: true },
|
|
104
|
+
disabled: { type: Boolean, default: undefined },
|
|
133
105
|
/**
|
|
134
106
|
* Applies a large border radius on the button.
|
|
135
107
|
*
|
|
136
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
|
|
137
|
-
*/
|
|
138
|
-
rounded: { type: Boolean, default: false },
|
|
139
|
-
/**
|
|
140
|
-
* Removes the component’s border-radius.
|
|
141
|
-
*
|
|
142
|
-
* @see {@link https://vuetifyjs.com/en/components/buttons/#tile}
|
|
108
|
+
* @see {@link https://next.vuetifyjs.com/en/components/buttons/#rounded}
|
|
143
109
|
*/
|
|
144
|
-
|
|
110
|
+
rounded: { type: String, Number, default: undefined },
|
|
145
111
|
},
|
|
146
112
|
/** Emits */
|
|
147
113
|
emits: ['update:modelValue'],
|
|
@@ -161,7 +127,7 @@ export default defineComponent({
|
|
|
161
127
|
* @param e - Event
|
|
162
128
|
*/
|
|
163
129
|
const onSwatchClick = (e: Event) => {
|
|
164
|
-
const value = (e.target as HTMLButtonElement).value;
|
|
130
|
+
const value = (e.target as HTMLButtonElement).dataset.value;
|
|
165
131
|
if (!value || props.modelValue === value) {
|
|
166
132
|
return;
|
|
167
133
|
}
|
|
@@ -171,13 +137,14 @@ export default defineComponent({
|
|
|
171
137
|
return {
|
|
172
138
|
checkedVisibilty,
|
|
173
139
|
onSwatchClick,
|
|
140
|
+
shades: colors.shades,
|
|
174
141
|
};
|
|
175
142
|
},
|
|
176
143
|
});
|
|
177
144
|
</script>
|
|
178
145
|
|
|
179
146
|
<style lang="scss">
|
|
180
|
-
@import 'node_modules/vuetify/
|
|
147
|
+
@import 'node_modules/vuetify/lib/styles/settings';
|
|
181
148
|
|
|
182
149
|
.v-swatches {
|
|
183
150
|
.v-btn {
|
|
@@ -188,7 +155,7 @@ export default defineComponent({
|
|
|
188
155
|
filter: invert(100%) grayscale(100%) contrast(100);
|
|
189
156
|
}
|
|
190
157
|
|
|
191
|
-
&.
|
|
158
|
+
&.bg-trasparent {
|
|
192
159
|
background: linear-gradient(
|
|
193
160
|
to top left,
|
|
194
161
|
transparent 0,
|