vuetify-swatches 1.0.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,9 +5,12 @@
5
5
  [![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/vuetify-swatches/file/README.md)
6
6
  [![npm version](https://img.shields.io/npm/v/vuetify-swatches.svg)](https://www.npmjs.com/package/vuetify-swatches)
7
7
  [![Open in Gitpod](https://shields.io/badge/Open%20in-Gitpod-green?logo=Gitpod)](https://gitpod.io/#https://github.com/logue/vuetify-swatches)
8
+ [![Twitter Follow](https://img.shields.io/twitter/follow/logue256?style=plastic)](https://twitter.com/logue256)
8
9
 
9
10
  ![demo](https://user-images.githubusercontent.com/480173/156681882-d3d5e868-ba9a-4a34-9e75-08272d39da64.gif)
10
11
 
12
+ 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.
13
+
11
14
  This project is a remake of [saintplay's vue-swatches](https://saintplay.github.io/vue-swatches/) with [Vuetify](https://vuetifyjs.com/).
12
15
 
13
16
  Unlike the original version, it provides a UI based on Vuetify, such as ripple effects and dark mode.
@@ -19,26 +22,20 @@ This library is positioned as a complement to Vuetify and provides a minimal UI.
19
22
  In this example, the selected color is assigned to `selected`.
20
23
 
21
24
  ```vue
22
- <template>
23
- <v-swatches v-model="selected" />
24
- </template>
25
-
26
- <script>
27
- import Vue from 'vue';
25
+ <script setup lang="ts">
26
+ import { ref, type Ref } from 'vue';
28
27
 
29
28
  import VSwatches from 'vuetify-swatches';
30
29
 
31
- export default Vue.extend({
32
- data() {
33
- return {
34
- selected: '#ffffff',
35
- };
36
- },
37
- });
30
+ const selected: Ref<string> = ref('#ffffff');
38
31
  </script>
39
32
 
33
+ <template>
34
+ <v-swatches v-model="selected" />
35
+ </template>
36
+
40
37
  <style>
41
- @import 'vuetify-swatches/style.css';
38
+ @import 'vuetify-swatches/dist/style.css';
42
39
  </style>
43
40
  ```
44
41
 
@@ -47,11 +44,64 @@ The method of specifying `swatches` is the same as [nested-color of Vue Swatches
47
44
  If you want to make the color palette appear when you click it, combine it with VMenu.
48
45
 
49
46
  ```vue
47
+ <script setup lang="ts">
48
+ import { ref, type Ref } from 'vue';
49
+
50
+ import VSwatches from 'vuetify-swatches';
51
+
52
+ const palette: Ref<string[] | string[][]> = ref([
53
+ [
54
+ '#ffb7b7',
55
+ '#ffdbb7',
56
+ '#ffffb7',
57
+ '#b7ffb7',
58
+ '#b7ffff',
59
+ '#b7b7ff',
60
+ '#ffb7ff',
61
+ '#ffffff',
62
+ ],
63
+ [
64
+ '#ff5555',
65
+ '#ffa555',
66
+ '#ffff55',
67
+ '#55ff55',
68
+ '#55ffff',
69
+ '#5555ff',
70
+ '#ff55ff',
71
+ '#aaaaaa',
72
+ ],
73
+ [
74
+ '#ff0000',
75
+ '#ff7f00',
76
+ '#ffff00',
77
+ '#00ff00',
78
+ '#00ffff',
79
+ '#0000ff',
80
+ '#ff00ff',
81
+ '#555555',
82
+ ],
83
+ [
84
+ '#7f0000',
85
+ '#7f4c00',
86
+ '#7f7f00',
87
+ '#007f00',
88
+ '#007f7f',
89
+ '#00007f',
90
+ '#7f007f',
91
+ '#000000',
92
+ ],
93
+ ]);
94
+ const selected: Ref<string> = ref('#ffffff');
95
+ </script>
96
+
50
97
  <template>
51
98
  <v-menu offset-y>
52
- <template #activator="{ on, attrs }">
53
- <v-btn v-bind="attrs" min-width="auto" :color="selected" v-on="on">
54
- <v-icon :color="selected" style="filter: invert(100%)">
99
+ <template #activator="{ props }">
100
+ <v-btn v-bind="props" class="mb-3" min-width="auto" :color="selected">
101
+ <v-icon
102
+ :color="selected"
103
+ style="filter: invert(100%) grayscale(100%) contrast(100)"
104
+ >
55
105
  mdi-menu-down
56
106
  </v-icon>
57
107
  </v-btn>
@@ -60,82 +110,23 @@ If you want to make the color palette appear when you click it, combine it with
60
110
  </v-menu>
61
111
  </template>
62
112
 
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
113
  <style>
120
- @import 'vuetify-swatches/style.css';
114
+ @import 'vuetify-swatches/dist/style.css';
121
115
  </style>
122
116
  ```
123
117
 
124
118
  ### Options
125
119
 
126
- | Variables | Type | Default | Info |
127
- | --------- | -------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
128
- | size | string | 2rem | Swatch Button size |
129
- | icon | string | mdi-checkbox-marked-circle | checked icon |
130
- | icon-size | string | 1rem | checked icon size |
131
- | depressed | boolean | false | Removes the button box shadow. |
132
- | disabled | boolean | false | Removes the ability to click or target the component. |
133
- | elevation | number\|string | undefined | Designates an elevation applied to the component between 0 and 24. |
134
- | outlined | false | Makes the background transparent and applies a thin border. |
135
- | plain | false | Removes the default background change applied when hovering over the button. |
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. |
120
+ | Variables | Type | Default | Info |
121
+ | --------- | -------------- | -------------------------- | -------------------------------------------------------------------------- |
122
+ | size | string | 2rem | Swatch Button size |
123
+ | icon | string | mdi-checkbox-marked-circle | checked icon |
124
+ | icon-size | string | 1rem | checked icon size |
125
+ | disabled | boolean | false | Removes the ability to click or target the component. |
126
+ | rounded | number\|string | undefined | Applies a large border radius on the button. |
127
+ | variant | string [^1] | undefined | The variant prop gives you easy access to several different button styles. |
128
+
129
+ [^1] Available variants are: elevated(default), flat, tonal, outlined, text, and plain.
139
130
 
140
131
  ## LICENSE
141
132
 
@@ -1,218 +1,126 @@
1
- import { type PropType, type Ref } from 'vue-demi';
2
- /** Vuetify Swatches */
3
- declare const _default: import("vue-demi").DefineComponent<{
4
- /** Model value */
5
- modelValue: {
6
- type: StringConstructor;
7
- default: string;
8
- };
9
- /** Swatch colors */
10
- swatches: {
11
- type: PropType<string[] | string[][]>;
12
- default: () => string[][];
13
- };
14
- /** Swatch sized */
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
- * Removes the button box shadow.
31
- *
32
- * @see {@link https://vuetifyjs.com/en/components/buttons/#depressed}
33
- */
34
- depressed: {
35
- type: BooleanConstructor;
36
- default: boolean;
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: boolean;
46
- };
47
- /**
48
- * Designates an elevation applied to the component between 0 and 24.
49
- *
50
- * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-elevation}
51
- */
52
- elevation: {
53
- type: (StringConstructor | NumberConstructor)[];
54
- default: undefined;
55
- };
56
- /**
57
- * Makes the background transparent and applies a thin border.
58
- *
59
- * @see {@link https://vuetifyjs.com/en/components/buttons/#outlined}
60
- */
61
- outlined: {
62
- type: BooleanConstructor;
63
- default: boolean;
64
- };
65
- /**
66
- * Removes the default background change applied when hovering over the button.
67
- *
68
- * @see {@link https://vuetifyjs.com/en/components/buttons/#plain}
69
- */
70
- plain: {
71
- type: BooleanConstructor;
72
- default: boolean;
73
- };
74
- /**
75
- * Raised buttons have a box shadow that increases when clicked. This is the default style.
76
- *
77
- * @see {@link https://vuetifyjs.com/en/components/buttons/#raised}
78
- */
79
- raised: {
80
- type: BooleanConstructor;
81
- default: boolean;
82
- };
83
- /**
84
- * Applies a large border radius on the button.
85
- *
86
- * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
87
- */
88
- rounded: {
89
- type: BooleanConstructor;
90
- default: boolean;
91
- };
92
- /**
93
- * Removes the component’s border-radius.
94
- *
95
- * @see {@link https://vuetifyjs.com/en/components/buttons/#tile}
96
- */
97
- tile: {
98
- type: BooleanConstructor;
99
- default: boolean;
100
- };
101
- }, {
102
- checkedVisibilty: Ref<boolean>;
103
- onSwatchClick: (e: Event) => void;
104
- }, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue-demi").ExtractPropTypes<{
105
- /** Model value */
106
- modelValue: {
107
- type: StringConstructor;
108
- default: string;
109
- };
110
- /** Swatch colors */
111
- swatches: {
112
- type: PropType<string[] | string[][]>;
113
- default: () => string[][];
114
- };
115
- /** Swatch sized */
116
- size: {
117
- type: StringConstructor;
118
- default: string;
119
- };
120
- /** Selected icon */
121
- icon: {
122
- type: StringConstructor;
123
- default: string;
124
- };
125
- /** selected icon size */
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,UAAU,CAAC;AAKlB,uBAAuB;;IAgBnB,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;;uBAoBuB,KAAK;;IAtG/B,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;IAEzB;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;AAjGP,wBAkIG"}
1
+ {"version":3,"file":"VSwatches.vue.d.ts","sourceRoot":"","sources":["../../src/components/VSwatches.vue.ts"],"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