vuetify-swatches 1.7.10 → 2.0.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 CHANGED
@@ -9,6 +9,8 @@
9
9
 
10
10
  ![demo](https://user-images.githubusercontent.com/480173/156681882-d3d5e868-ba9a-4a34-9e75-08272d39da64.gif)
11
11
 
12
+ ⚠ **Version 2.x Breaking Changes**: This version includes significant architectural changes.
13
+
12
14
  ⚠ This is for Vuetify3. If you are using Vuetify2, please use 1.0.x.
13
15
 
14
16
  This project is a remake of [saintplay's vue-swatches](https://saintplay.github.io/vue-swatches/) with [Vuetify](https://vuetifyjs.com/).
@@ -19,19 +21,31 @@ This library is positioned as a complement to Vuetify and provides a minimal UI.
19
21
 
20
22
  ## Usage
21
23
 
22
- In this example, the selected color is assigned to `selected`.
24
+ **Note**: In v2.x, the component requires a `swatches` prop to display colors. You can either provide your own color array or use the preset palettes.
25
+
26
+ ### Using Preset Palettes
27
+
28
+ You can import pre-defined color palettes separately. This keeps your bundle size small by only importing what you need:
23
29
 
24
30
  ```vue
25
31
  <script setup lang="ts">
26
32
  import { ref, type Ref } from 'vue';
27
33
 
28
34
  import VSwatches from 'vuetify-swatches';
35
+ // Import only the palette you need
36
+ import { basicPalette } from 'vuetify-swatches/presets/basic';
37
+ // or
38
+ import { advancedPalette } from 'vuetify-swatches/presets/advanced';
29
39
 
30
40
  const selected: Ref<string> = ref('#ffffff');
31
41
  </script>
32
42
 
33
43
  <template>
34
- <v-swatches v-model="selected" />
44
+ <!-- Use the basic palette (22 colors) -->
45
+ <v-swatches v-model="selected" :swatches="basicPalette" />
46
+
47
+ <!-- Or use the advanced palette (~200 color variations) -->
48
+ <v-swatches v-model="selected" :swatches="advancedPalette" />
35
49
  </template>
36
50
 
37
51
  <style>
@@ -39,17 +53,72 @@ const selected: Ref<string> = ref('#ffffff');
39
53
  </style>
40
54
  ```
41
55
 
42
- The method of specifying `swatches` is the same as [nested-color of Vue Swatches](https://saintplay.github.io/vue-swatches/examples/#nested-colors).
56
+ ## Props
57
+
58
+ Most props other than size and placement are the same as [v-btn](https://vuetifyjs.com/en/api/v-btn/).
59
+
60
+ | Variables | Type | Default | Info |
61
+ | ---------------- | -------------- | -------------------------- | -------------------------------------------------------------------------- |
62
+ | size | string | 2rem | Swatch Button size |
63
+ | icon | string | mdi-checkbox-marked-circle | checked icon |
64
+ | icon-size | string | 1rem | checked icon size |
65
+ | disabled | boolean | false | Removes the ability to click or target the component. |
66
+ | rounded | number\|string | undefined | Applies a large border radius on the button. |
67
+ | variant | Variant [^1] | undefined | The variant prop gives you easy access to several different button styles. |
68
+ | elevation | number\|string | undefined | |
69
+ | border | number\|string | undefined | |
70
+ | transpose | boolean | false | Swaps the rows and columns of swatches. |
71
+ | tooltip | boolean | false | Display color value in tooltip. |
72
+ | tooltip-location | Anchor [^2] | undefined | Tooltip location. |
43
73
 
44
- If you want to make the color palette appear when you click it, combine it with VMenu.
74
+ [^1]: <https://vuetifyjs.com/api/v-btn/#props-variant>
75
+
76
+ [^2]: <https://vuetifyjs.com/en/components/tooltips/#props-location>
77
+
78
+ ## Example
79
+
80
+ For more details, see the [demo page](https://logue.dev/vuetify-swatches).
81
+
82
+ ### Show color code in tooltip
83
+
84
+ Display the color code in a tooltip when you hover over the swatch.
45
85
 
46
86
  ```vue
47
87
  <script setup lang="ts">
48
88
  import { ref, type Ref } from 'vue';
49
89
 
50
90
  import VSwatches from 'vuetify-swatches';
91
+ import { basicPalette } from 'vuetify-swatches/presets';
92
+
93
+ const selected: Ref<string> = ref('#ffffff');
94
+ </script>
95
+
96
+ <template>
97
+ <v-swatches
98
+ v-model="selected"
99
+ :swatches="basicPalette"
100
+ tooltip
101
+ tooltip-location="top"
102
+ class="mb-3"
103
+ />
104
+ </template>
105
+
106
+ <style>
107
+ @import 'vuetify-swatches/dist/style.css';
108
+ </style>
109
+ ```
110
+
111
+ ### Using Custom Colors
112
+
113
+ You can also provide your own custom color palette. The method of specifying `swatches` is the same as [nested-color of Vue Swatches](https://saintplay.github.io/vue-swatches/examples/#nested-colors).
51
114
 
52
- const palette: Ref<string[] | string[][]> = ref([
115
+ ```vue
116
+ <script setup lang="ts">
117
+ import { ref, type Ref } from 'vue';
118
+
119
+ import VSwatches from 'vuetify-swatches';
120
+
121
+ const customPalette: Ref<string[][]> = ref([
53
122
  [
54
123
  '#ffb7b7',
55
124
  '#ffdbb7',
@@ -95,18 +164,43 @@ const selected: Ref<string> = ref('#ffffff');
95
164
  </script>
96
165
 
97
166
  <template>
98
- <v-menu offset-y>
167
+ <v-swatches v-model="selected" :swatches="customPalette" />
168
+ </template>
169
+
170
+ <style>
171
+ @import 'vuetify-swatches/dist/style.css';
172
+ </style>
173
+ ```
174
+
175
+ ### Using with VMenu
176
+
177
+ If you want to make the color palette appear when you click it, combine it with VMenu:
178
+
179
+ ```vue
180
+ <script setup lang="ts">
181
+ import { ref, type Ref } from 'vue';
182
+
183
+ import VSwatches from 'vuetify-swatches';
184
+ import { advancedPalette } from 'vuetify-swatches/presets';
185
+
186
+ const selected: Ref<string> = ref('#ffffff');
187
+ </script>
188
+
189
+ <template>
190
+ <v-menu class="mb-3">
99
191
  <template #activator="{ props }">
100
- <v-btn v-bind="props" class="mb-3" min-width="auto" :color="selected">
192
+ <v-btn v-bind="props" class="mb-3" min-width="auto" :color="color4">
101
193
  <v-icon
102
- :color="selected"
194
+ :color="color4"
103
195
  style="filter: invert(100%) grayscale(100%) contrast(100)"
104
196
  >
105
197
  mdi-menu-down
106
198
  </v-icon>
107
199
  </v-btn>
108
200
  </template>
109
- <v-swatches v-model="selected" :swatches="palette" />
201
+ <v-card title="Select a color">
202
+ <v-swatches v-model="color4" :swatches="advancedPalette" />
203
+ </v-card>
110
204
  </v-menu>
111
205
  </template>
112
206
 
@@ -115,35 +209,18 @@ const selected: Ref<string> = ref('#ffffff');
115
209
  </style>
116
210
  ```
117
211
 
118
- ### Options
119
-
120
- Most props other than size and placement are the same as [v-btn](https://vuetifyjs.com/en/api/v-btn/).
121
-
122
- | Variables | Type | Default | Info |
123
- | --------- | -------------- | -------------------------- | -------------------------------------------------------------------------- |
124
- | size | string | 2rem | Swatch Button size |
125
- | icon | string | mdi-checkbox-marked-circle | checked icon |
126
- | icon-size | string | 1rem | checked icon size |
127
- | disabled | boolean | false | Removes the ability to click or target the component. |
128
- | rounded | number\|string | undefined | Applies a large border radius on the button. |
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 |
132
-
133
- [^1] Available variants are: elevated(default), flat, tonal, outlined, text, and plain.
134
-
135
212
  ### CDN Usage
136
213
 
137
214
  ```html
138
215
  <!-- Vue core -->
139
- <script src="https://cdn.jsdelivr.net/npm/vue@3.3.4/dist/vue.global.js"></script>
140
- <script src="https://cdn.jsdelivr.net/npm/vuetify@3.3.14/dist/vuetify.min.js"></script>
216
+ <script src="https://cdn.jsdelivr.net/npm/vue@3.5.25/dist/vue.global.js"></script>
217
+ <script src="https://cdn.jsdelivr.net/npm/vuetify@3.11.0/dist/vuetify.min.js"></script>
141
218
  <link
142
219
  rel="stylesheet"
143
- href="https://cdn.jsdelivr.net/npm/vuetify@3.3.14/dist/vuetify.min.js"
220
+ href="https://cdn.jsdelivr.net/npm/vuetify@3.11.0/dist/vuetify.min.js"
144
221
  />
145
222
  <!-- Markdown wasm -->
146
- <script src="https://cdn.jsdelivr.net/npm/vuetify-swatches@1.4.3/dist/index.iife.min.js"></script>
223
+ <script src="https://cdn.jsdelivr.net/npm/vuetify-swatches@2.0.3/dist/index.iife.min.js"></script>
147
224
  <script>
148
225
  const { createApp } = Vue;
149
226
  const { createVuetify } = Vuetify;
@@ -0,0 +1,35 @@
1
+ import { Variant } from 'vuetify/lib/composables/variant.d.ts';
2
+ import { Anchor } from 'vuetify/lib/util/index.d.ts';
3
+ interface Props {
4
+ color: string;
5
+ isSelected: boolean;
6
+ size: string;
7
+ icon: string;
8
+ iconSize: string;
9
+ variant: Variant;
10
+ disabled: boolean;
11
+ rounded: string | number | boolean;
12
+ border: string | number | boolean;
13
+ elevation: string | number;
14
+ tooltip: boolean;
15
+ tooltipLocation: Anchor;
16
+ }
17
+ declare const _default: import('vue').DefineComponent<Partial<Props>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
18
+ click: () => any;
19
+ }, string, import('vue').PublicProps, Readonly<Partial<Props>> & Readonly<{
20
+ onClick?: (() => any) | undefined;
21
+ }>, {
22
+ color: string;
23
+ isSelected: boolean;
24
+ size: string;
25
+ icon: string;
26
+ iconSize: string;
27
+ variant: Variant;
28
+ disabled: boolean;
29
+ rounded: string | number | boolean;
30
+ border: string | number | boolean;
31
+ elevation: string | number;
32
+ tooltip: boolean;
33
+ tooltipLocation: Anchor;
34
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
35
+ export default _default;
@@ -1,4 +1,6 @@
1
1
  import { PropType } from 'vue';
2
+ import { Variant } from 'vuetify/lib/composables/variant.d.ts';
3
+ import { Anchor } from 'vuetify/lib/util/index.d.ts';
2
4
  declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
3
5
  /** Model value */
4
6
  modelValue: {
@@ -7,15 +9,18 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
7
9
  };
8
10
  /** Swatch colors */
9
11
  swatches: {
10
- type: PropType<string[] | string[][] | Record<string, string[]>>;
11
- default: () => string[][];
12
+ type: PropType<(string | undefined)[] | (string | undefined)[][] | Record<string, (string | undefined)[]> | readonly (string | undefined)[] | readonly (readonly (string | undefined)[])[]>;
13
+ default: () => never[];
12
14
  };
13
15
  /** Swatch size */
14
16
  size: {
15
17
  type: StringConstructor;
16
18
  default: string;
17
19
  };
18
- /** Selected icon */
20
+ /**
21
+ * Selected icon
22
+ * @see {@link https://vuetifyjs.com/en/components/icons/#usage
23
+ */
19
24
  icon: {
20
25
  type: StringConstructor;
21
26
  default: string;
@@ -25,13 +30,18 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
25
30
  type: StringConstructor;
26
31
  default: string;
27
32
  };
33
+ /** Display swatches in a single row */
34
+ inline: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
28
38
  /**
29
39
  * The variant prop gives you easy access to several different button styles..
30
40
  *
31
41
  * @see {@link https://vuetifyjs.com/en/components/buttons/#variant}
32
42
  */
33
43
  variant: {
34
- type: PropType<NonNullable<"flat" | "text" | "elevated" | "tonal" | "outlined" | "plain">>;
44
+ type: PropType<Variant>;
35
45
  default: undefined;
36
46
  };
37
47
  /**
@@ -49,7 +59,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
49
59
  * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
50
60
  */
51
61
  rounded: {
52
- type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
62
+ type: (BooleanConstructor | StringConstructor | NumberConstructor)[];
53
63
  default: undefined;
54
64
  };
55
65
  /**
@@ -58,7 +68,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
58
68
  * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-border}
59
69
  */
60
70
  border: {
61
- type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
71
+ type: (BooleanConstructor | StringConstructor | NumberConstructor)[];
62
72
  default: boolean;
63
73
  };
64
74
  /**
@@ -70,6 +80,27 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
70
80
  type: (StringConstructor | NumberConstructor)[];
71
81
  default: undefined;
72
82
  };
83
+ /** Swap cols and rows */
84
+ transpose: {
85
+ type: BooleanConstructor;
86
+ default: boolean;
87
+ };
88
+ /**
89
+ * Tooltip
90
+ * @see {@link https://vuetifyjs.com/en/components/tooltips/}
91
+ */
92
+ tooltip: {
93
+ type: BooleanConstructor;
94
+ default: boolean;
95
+ };
96
+ /**
97
+ * Tooltip location
98
+ * @see {@link https://vuetifyjs.com/en/components/tooltips/#props-location}
99
+ */
100
+ tooltipLocation: {
101
+ type: PropType<Anchor>;
102
+ default: undefined;
103
+ };
73
104
  }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
74
105
  "update:modelValue": (_value: string) => void;
75
106
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
@@ -80,15 +111,18 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
80
111
  };
81
112
  /** Swatch colors */
82
113
  swatches: {
83
- type: PropType<string[] | string[][] | Record<string, string[]>>;
84
- default: () => string[][];
114
+ type: PropType<(string | undefined)[] | (string | undefined)[][] | Record<string, (string | undefined)[]> | readonly (string | undefined)[] | readonly (readonly (string | undefined)[])[]>;
115
+ default: () => never[];
85
116
  };
86
117
  /** Swatch size */
87
118
  size: {
88
119
  type: StringConstructor;
89
120
  default: string;
90
121
  };
91
- /** Selected icon */
122
+ /**
123
+ * Selected icon
124
+ * @see {@link https://vuetifyjs.com/en/components/icons/#usage
125
+ */
92
126
  icon: {
93
127
  type: StringConstructor;
94
128
  default: string;
@@ -98,13 +132,18 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
98
132
  type: StringConstructor;
99
133
  default: string;
100
134
  };
135
+ /** Display swatches in a single row */
136
+ inline: {
137
+ type: BooleanConstructor;
138
+ default: boolean;
139
+ };
101
140
  /**
102
141
  * The variant prop gives you easy access to several different button styles..
103
142
  *
104
143
  * @see {@link https://vuetifyjs.com/en/components/buttons/#variant}
105
144
  */
106
145
  variant: {
107
- type: PropType<NonNullable<"flat" | "text" | "elevated" | "tonal" | "outlined" | "plain">>;
146
+ type: PropType<Variant>;
108
147
  default: undefined;
109
148
  };
110
149
  /**
@@ -122,7 +161,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
122
161
  * @see {@link https://vuetifyjs.com/en/components/buttons/#rounded}
123
162
  */
124
163
  rounded: {
125
- type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
164
+ type: (BooleanConstructor | StringConstructor | NumberConstructor)[];
126
165
  default: undefined;
127
166
  };
128
167
  /**
@@ -131,7 +170,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
131
170
  * @see {@link https://vuetifyjs.com/en/api/v-btn/#props-border}
132
171
  */
133
172
  border: {
134
- type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
173
+ type: (BooleanConstructor | StringConstructor | NumberConstructor)[];
135
174
  default: boolean;
136
175
  };
137
176
  /**
@@ -143,18 +182,43 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
143
182
  type: (StringConstructor | NumberConstructor)[];
144
183
  default: undefined;
145
184
  };
185
+ /** Swap cols and rows */
186
+ transpose: {
187
+ type: BooleanConstructor;
188
+ default: boolean;
189
+ };
190
+ /**
191
+ * Tooltip
192
+ * @see {@link https://vuetifyjs.com/en/components/tooltips/}
193
+ */
194
+ tooltip: {
195
+ type: BooleanConstructor;
196
+ default: boolean;
197
+ };
198
+ /**
199
+ * Tooltip location
200
+ * @see {@link https://vuetifyjs.com/en/components/tooltips/#props-location}
201
+ */
202
+ tooltipLocation: {
203
+ type: PropType<Anchor>;
204
+ default: undefined;
205
+ };
146
206
  }>> & Readonly<{
147
207
  "onUpdate:modelValue"?: ((_value: string) => any) | undefined;
148
208
  }>, {
149
- modelValue: string;
150
- swatches: string[] | Record<string, string[]> | string[][];
151
209
  size: string;
152
210
  icon: string;
153
211
  iconSize: string;
154
- variant: NonNullable<"flat" | "text" | "elevated" | "tonal" | "outlined" | "plain">;
212
+ variant: "elevated" | "flat" | "tonal" | "outlined" | "text" | "plain";
155
213
  disabled: boolean;
156
214
  rounded: string | number | boolean;
157
215
  border: string | number | boolean;
158
216
  elevation: string | number;
217
+ tooltip: boolean;
218
+ tooltipLocation: Anchor;
219
+ modelValue: string;
220
+ swatches: (string | undefined)[] | Record<string, (string | undefined)[]> | (string | undefined)[][] | readonly (string | undefined)[] | readonly (readonly (string | undefined)[])[];
221
+ inline: boolean;
222
+ transpose: boolean;
159
223
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
160
224
  export default _default;
package/dist/index.cjs.js CHANGED
@@ -5,8 +5,8 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2025 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.7.10
8
+ * @version 2.0.0
9
9
  * @see {@link https://github.com/logue/vuetify-swatches}
10
10
  */
11
11
 
12
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),n=require("vuetify/components"),h=require("vuetify/util/colors");function p(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var t=p(h),s=e.defineComponent({__name:"VSwatches",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:!1},rounded:{type:[String,Number,Boolean],default:void 0},border:{type:[String,Number,Boolean],default:!1},elevation:{type:[String,Number],default:void 0}},emits:{"update:modelValue":a=>!0},setup(a,{emit:i}){const o=i,l=a,u=e.ref(t.default.shades.white),c=d=>u.value=d.target.value||t.default.shades.white;return e.watch(()=>u.value,d=>o("update:modelValue",d)),e.onMounted(()=>{l.modelValue&&(u.value=l.modelValue)}),(d,v)=>(e.openBlock(),e.createBlock(e.unref(n.VSheet),{class:"v-swatches"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.swatches,(f,b)=>(e.openBlock(),e.createElementBlock("div",{key:b},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f,r=>(e.openBlock(),e.createBlock(e.unref(n.VBtn),{key:r,border:l.border,class:e.normalizeClass(r===e.unref(t.default).shades.transparent?"bg-trasparent":""),color:r,disabled:l.disabled,elevation:l.elevation,height:l.size,value:r,variant:l.variant,width:l.size,"min-width":"auto",onClick:c},{default:e.withCtx(()=>[r===a.modelValue?(e.openBlock(),e.createBlock(e.unref(n.VIcon),{key:0,size:a.iconSize,color:r!==e.unref(t.default).shades.transparent?r:void 0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.icon),1)]),_:2},1032,["size","color"])):e.createCommentVNode("",!0)]),_:2},1032,["border","class","color","disabled","elevation","height","value","variant","width"]))),128))]))),128))]),_:1}))}});const m=a=>a.component("VSwatches",s);exports.default=s;exports.install=m;
12
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),c=require("vuetify/components"),b=require("vuetify/util/colors");function y(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var u=y(b);function B(...l){let r=0;for(let a=0;a<l.length;a++)l[a].length>r&&(r=l[a].length);const o=l.length,t=Array(r);for(let a=0;a<r;++a){const n=Array(o);for(let i=0;i<o;++i)n[i]=l[i][a];t[a]=n}return t}var m=e.defineComponent({__name:"SwatchButton",props:{color:{default:void 0},isSelected:{type:Boolean,default:!1},size:{default:"2rem"},icon:{default:"mdi-checkbox-marked-circle"},iconSize:{default:"1rem"},variant:{default:void 0},disabled:{type:Boolean,default:!1},rounded:{type:[String,Number,Boolean],default:void 0},border:{type:[String,Number,Boolean],default:!1},elevation:{default:void 0},tooltip:{type:Boolean,default:!1},tooltipLocation:{default:void 0}},emits:["click"],setup(l,{emit:r}){const o=l,t=r;return(a,n)=>o.color?(e.openBlock(),e.createBlock(e.unref(c.VTooltip),{key:0,disabled:!o.tooltip,location:o.tooltipLocation,text:o.color},{activator:e.withCtx(({props:i})=>[e.createVNode(e.unref(c.VBtn),e.mergeProps(i,{border:o.border,class:[o.color===e.unref(u.default).shades.transparent?"bg-transparent":"","p-0"],color:o.color,disabled:o.disabled,elevation:o.elevation,height:o.size,variant:o.variant,width:o.size,"min-width":"auto",onClick:n[0]||(n[0]=p=>t("click"))}),{default:e.withCtx(()=>[o.isSelected?(e.openBlock(),e.createBlock(e.unref(c.VIcon),{key:0,size:o.iconSize,color:o.color!==e.unref(u.default).shades.transparent?o.color:void 0,icon:o.icon},null,8,["size","color","icon"])):e.createCommentVNode("",!0)]),_:1},16,["border","class","color","disabled","elevation","height","variant","width"])]),_:1},8,["disabled","location","text"])):(e.openBlock(),e.createBlock(e.unref(c.VBtn),{key:1,height:o.size,width:o.size,class:"p-0",disabled:"","min-width":"auto",variant:"text"},null,8,["height","width"]))}}),v=e.defineComponent({__name:"VSwatches",props:{modelValue:{type:String,default:u.default.shades.white},swatches:{type:Array,default:()=>[]},size:{type:String,default:"2rem"},icon:{type:String,default:"mdi-checkbox-marked-circle"},iconSize:{type:String,default:"1rem"},inline:{type:Boolean,default:!1},variant:{type:String,default:void 0},disabled:{type:Boolean,default:!1},rounded:{type:[String,Number,Boolean],default:void 0},border:{type:[String,Number,Boolean],default:!1},elevation:{type:[String,Number],default:void 0},transpose:{type:Boolean,default:!1},tooltip:{type:Boolean,default:!1},tooltipLocation:{type:String,default:void 0}},emits:{"update:modelValue":l=>!0},setup(l,{emit:r}){const o=r,t=l,a=e.computed(()=>{const i=Array.isArray(t.swatches)?t.swatches:Object.values(t.swatches);return t.inline?[i.flat(1/0)]:t.transpose?B(...i):i}),n=e.ref(u.default.shades.white);return e.watch(()=>n.value,i=>o("update:modelValue",i)),e.watch(()=>t.modelValue,i=>{i&&(n.value=i)},{immediate:!0}),(i,p)=>(e.openBlock(),e.createBlock(e.unref(c.VItemGroup),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=d=>n.value=d),class:e.normalizeClass([{"d-inline":t.inline},"v-swatches"]),mandatory:""},{default:e.withCtx(()=>[t.inline?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(a.value[0],d=>(e.openBlock(),e.createBlock(e.unref(c.VItem),{key:d,value:d},{default:e.withCtx(({isSelected:f,toggle:s})=>[e.createVNode(m,{border:t.border,color:d,disabled:t.disabled,elevation:t.elevation,"icon-size":t.iconSize,icon:t.icon,"is-selected":f,rounded:t.rounded,size:t.size,"tooltip-location":t.tooltipLocation,tooltip:t.tooltip,variant:t.variant,onClick:s},null,8,["border","color","disabled","elevation","icon-size","icon","is-selected","rounded","size","tooltip-location","tooltip","variant","onClick"])]),_:2},1032,["value"]))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.value,(d,f)=>(e.openBlock(),e.createElementBlock("div",{key:f},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d,s=>(e.openBlock(),e.createBlock(e.unref(c.VItem),{key:s,value:s},{default:e.withCtx(({isSelected:h,toggle:k})=>[e.createVNode(m,{border:t.border,color:s,disabled:t.disabled,elevation:t.elevation,"icon-size":t.iconSize,icon:t.icon,"is-selected":h,rounded:t.rounded,size:t.size,"tooltip-location":t.tooltipLocation,tooltip:t.tooltip,variant:t.variant,onClick:k},null,8,["border","color","disabled","elevation","icon-size","icon","is-selected","rounded","size","tooltip-location","tooltip","variant","onClick"])]),_:2},1032,["value"]))),128))]))),128))]),_:1},8,["modelValue","class"]))}});const w=l=>l.component("VSwatches",v);exports.default=v;exports.install=w;