vuetify-swatches 0.0.6 → 0.0.7
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 +1 -0
- package/dist/components/VSwatches.vue.d.ts +71 -0
- package/dist/components/VSwatches.vue.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/v-swatches.es.js +3 -6
- package/dist/v-swatches.umd.js +2 -2
- package/package.json +5 -4
- package/src/components/VSwatches.vue +12 -8
- package/dist/stats.html +0 -2689
package/README.md
CHANGED
|
@@ -125,6 +125,7 @@ export default Vue.extend({
|
|
|
125
125
|
|
|
126
126
|
| Variables | Type | Default | Info |
|
|
127
127
|
| --------- | ------ | -------------------------- | ------------------ |
|
|
128
|
+
| elevation | number | 1 | shadow size |
|
|
128
129
|
| size | string | 2rem | Swatch Button size |
|
|
129
130
|
| icon | string | mdi-checkbox-marked-circle | checked icon |
|
|
130
131
|
| icon-size | string | 1rem | checked icon size |
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type PropType, type Ref } from 'vue-demi';
|
|
2
|
+
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
3
|
+
checkedVisibilty: Ref<boolean>;
|
|
4
|
+
selected: Ref<string>;
|
|
5
|
+
onSwatchClick: (e: Event) => void;
|
|
6
|
+
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
7
|
+
/** Model value */
|
|
8
|
+
modelValue: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
/** Swatch colors */
|
|
13
|
+
swatches: {
|
|
14
|
+
type: PropType<string[] | string[][]>;
|
|
15
|
+
default: () => string[][];
|
|
16
|
+
};
|
|
17
|
+
/** The size of the shadow of the button */
|
|
18
|
+
elevation: {
|
|
19
|
+
type: NumberConstructor;
|
|
20
|
+
default: number;
|
|
21
|
+
};
|
|
22
|
+
/** Swatch sized */
|
|
23
|
+
size: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
/** selected icon */
|
|
28
|
+
icon: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
/** selected icon size */
|
|
33
|
+
iconSize: {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
}, {
|
|
38
|
+
modelValue: string;
|
|
39
|
+
swatches: string[] | string[][];
|
|
40
|
+
elevation: number;
|
|
41
|
+
size: string;
|
|
42
|
+
icon: string;
|
|
43
|
+
iconSize: string;
|
|
44
|
+
} & {}> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
45
|
+
modelValue: string;
|
|
46
|
+
swatches: string[] | string[][];
|
|
47
|
+
elevation: number;
|
|
48
|
+
size: string;
|
|
49
|
+
icon: string;
|
|
50
|
+
iconSize: string;
|
|
51
|
+
} & {}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
52
|
+
checkedVisibilty: Ref<boolean>;
|
|
53
|
+
selected: Ref<string>;
|
|
54
|
+
onSwatchClick: (e: Event) => void;
|
|
55
|
+
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, {}, {
|
|
56
|
+
modelValue: string;
|
|
57
|
+
swatches: string[] | string[][];
|
|
58
|
+
elevation: number;
|
|
59
|
+
size: string;
|
|
60
|
+
icon: string;
|
|
61
|
+
iconSize: string;
|
|
62
|
+
} & {}, {
|
|
63
|
+
swatches: string[] | string[][];
|
|
64
|
+
elevation: number;
|
|
65
|
+
size: string;
|
|
66
|
+
icon: string;
|
|
67
|
+
iconSize: string;
|
|
68
|
+
}, true>);
|
|
69
|
+
/** Vuetify Swatches */
|
|
70
|
+
export default _default;
|
|
71
|
+
//# sourceMappingURL=VSwatches.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,UAAU,CAAC;;;;uBA+EY,KAAK;;IA1D/B,kBAAkB;;;;;IAElB,oBAAoB;;;;;IA4BpB,2CAA2C;;;;;IAE3C,mBAAmB;;;;;IAEnB,oBAAoB;;;;;IAEpB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;uBAsBC,KAAK;;;;;;;;;;;;;;;AA1EnC,uBAAuB;AACvB,wBAwFG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vuetify Swatches Component
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @author Logue {@link logue@hotmail.co.jp}
|
|
6
|
+
* @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
|
|
7
|
+
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
8
|
+
*/
|
|
9
|
+
import VSwatches from './components/VSwatches.vue';
|
|
10
|
+
declare const installVSwatches: void | ((app: any) => void);
|
|
11
|
+
export { VSwatches as default, installVSwatches as install };
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,SAAS,MAAM,4BAA4B,CAAC;AAGnD,QAAA,MAAM,gBAAgB,6BAIT,CAAC;AAEd,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC"}
|
package/dist/v-swatches.es.js
CHANGED
|
@@ -41,6 +41,7 @@ var __vue2_script = defineComponent({
|
|
|
41
41
|
[colors.brown.base, colors.blueGrey.base, colors.grey.base]
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
|
+
elevation: { type: Number, default: 1 },
|
|
44
45
|
size: { type: String, default: "2rem" },
|
|
45
46
|
icon: { type: String, default: "mdi-checkbox-marked-circle" },
|
|
46
47
|
iconSize: { type: String, default: "1rem" }
|
|
@@ -48,7 +49,6 @@ var __vue2_script = defineComponent({
|
|
|
48
49
|
emits: ["update:modelValue"],
|
|
49
50
|
setup(props, context) {
|
|
50
51
|
const checkedVisibilty = ref(false);
|
|
51
|
-
const palette = ref(props.swatches);
|
|
52
52
|
const selected = ref(props.modelValue);
|
|
53
53
|
const onSwatchClick = (e) => {
|
|
54
54
|
const value = e.target.value;
|
|
@@ -60,7 +60,6 @@ var __vue2_script = defineComponent({
|
|
|
60
60
|
};
|
|
61
61
|
return {
|
|
62
62
|
checkedVisibilty,
|
|
63
|
-
palette,
|
|
64
63
|
selected,
|
|
65
64
|
onSwatchClick
|
|
66
65
|
};
|
|
@@ -72,14 +71,14 @@ var render = function() {
|
|
|
72
71
|
var _c = _vm._self._c || _h;
|
|
73
72
|
return _c(VSheet, {
|
|
74
73
|
staticClass: "v-swatches"
|
|
75
|
-
}, _vm._l(_vm.
|
|
74
|
+
}, _vm._l(_vm.swatches, function(colors2, rows) {
|
|
76
75
|
return _c("div", {
|
|
77
76
|
key: rows
|
|
78
77
|
}, _vm._l(colors2, function(color) {
|
|
79
78
|
return _c(VBtn, {
|
|
80
79
|
key: color,
|
|
81
80
|
attrs: {
|
|
82
|
-
"elevation":
|
|
81
|
+
"elevation": _vm.elevation,
|
|
83
82
|
"width": _vm.size,
|
|
84
83
|
"height": _vm.size,
|
|
85
84
|
"color": color,
|
|
@@ -99,7 +98,6 @@ var render = function() {
|
|
|
99
98
|
}), 0);
|
|
100
99
|
};
|
|
101
100
|
var staticRenderFns = [];
|
|
102
|
-
render._withStripped = true;
|
|
103
101
|
var VSwatches_vue_vue_type_style_index_0_lang = "";
|
|
104
102
|
function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
105
103
|
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
@@ -159,7 +157,6 @@ function __vue2_injectStyles(context) {
|
|
|
159
157
|
this[o] = __cssModules[o];
|
|
160
158
|
}
|
|
161
159
|
}
|
|
162
|
-
__component__.options.__file = "src/components/VSwatches.vue";
|
|
163
160
|
var VSwatches = /* @__PURE__ */ function() {
|
|
164
161
|
return __component__.exports;
|
|
165
162
|
}();
|
package/dist/v-swatches.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(n,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue-demi"),require("vuetify/lib"),require("vuetify/lib/util/colors")):typeof define=="function"&&define.amd?define(["exports","vue-demi","vuetify/lib","vuetify/lib/util/colors"],l):(n=typeof globalThis<"u"?globalThis:n||self,l(n.VSwatches={},n.VueDemi,n.Vuetify,n.colors))})(this,function(n,l,_,b){"use strict";function y(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var t=y(b),V=l.defineComponent({name:"VSwatches",components:{VSheet:_.VSheet,VBtn:_.VBtn,VIcon:_.VIcon},model:{prop:"modelValue",event:"update:modelValue"},props:{modelValue:{type:String,required:!0},swatches:{type:Array,default:()=>[[t.default.shades.black,t.default.shades.white],[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]]},elevation:{type:Number,default:1},size:{type:String,default:"2rem"},icon:{type:String,default:"mdi-checkbox-marked-circle"},iconSize:{type:String,default:"1rem"}},emits:["update:modelValue"],setup(e,u){const r=l.ref(!1),f=l.ref(e.modelValue);return{checkedVisibilty:r,selected:f,onSwatchClick:i=>{const c=i.target.value;!c||f.value===c||(f.value=c,u.emit("update:modelValue",c))}}}}),S=function(){var e=this,u=e.$createElement,r=e._self._c||u;return r(_.VSheet,{staticClass:"v-swatches"},e._l(e.swatches,function(f,o){return r("div",{key:o},e._l(f,function(i){return r(_.VBtn,{key:i,attrs:{elevation:e.elevation,width:e.size,height:e.size,color:i,value:i,"min-width":"auto"},on:{click:e.onSwatchClick}},[i===e.selected?r(_.VIcon,{attrs:{size:e.iconSize,color:i}},[e._v(" "+e._s(e.icon)+" ")]):e._e()],1)}),1)}),0)},w=[],q="";function g(e,u,r,f,o,i,c,T){var a=typeof e=="function"?e.options:e;u&&(a.render=u,a.staticRenderFns=r,a._compiled=!0),f&&(a.functional=!0),i&&(a._scopeId="data-v-"+i);var d;if(c?(d=function(s){s=s||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!s&&typeof __VUE_SSR_CONTEXT__<"u"&&(s=__VUE_SSR_CONTEXT__),o&&o.call(this,s),s&&s._registeredComponents&&s._registeredComponents.add(c)},a._ssrRegister=d):o&&(d=T?function(){o.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:o),d)if(a.functional){a._injectStyles=d;var $=a.render;a.render=function(R,m){return d.call(m),$(R,m)}}else{var v=a.beforeCreate;a.beforeCreate=v?[].concat(v,d):[d]}return{exports:e,options:a}}const h={};var C=g(V,S,w,!1,k,null,null,null);function k(e){for(let u in h)this[u]=h[u]}var p=function(){return C.exports}();/**
|
|
2
2
|
* Vuetify Swatches Component
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @author Logue {@link logue@hotmail.co.jp}
|
|
6
6
|
* @copyright 2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
|
|
7
7
|
* @see {@link https://github.com/logue/vuetify-swatches}
|
|
8
|
-
*/const
|
|
8
|
+
*/const z=l.isVue2?e=>{e.component("VSwatches",p)}:l.install();n.default=p,n.install=z,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "vuetify-swatches",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.7",
|
|
6
6
|
"description": "Color Swatch component for Vuetify.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"vuejs",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"url": "https://github.com/logue/vuetify-swatches/issues"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=16"
|
|
34
|
+
"node": ">=16.15.0",
|
|
35
|
+
"yarn": ">=1.22.4"
|
|
35
36
|
},
|
|
36
37
|
"license": "MIT",
|
|
37
38
|
"main": "./dist/v-swatches.umd.js",
|
|
@@ -91,7 +92,7 @@
|
|
|
91
92
|
"@typescript-eslint/parser": "^5.25.0",
|
|
92
93
|
"@vue/composition-api": "^1.6.1",
|
|
93
94
|
"@vue/eslint-config-typescript": "^10.0.0",
|
|
94
|
-
"eslint": "^8.
|
|
95
|
+
"eslint": "^8.16.0",
|
|
95
96
|
"eslint-config-google": "^0.14.0",
|
|
96
97
|
"eslint-config-prettier": "^8.5.0",
|
|
97
98
|
"eslint-config-vuetify": "^0.6.1",
|
|
@@ -115,7 +116,7 @@
|
|
|
115
116
|
"rimraf": "^3.0.2",
|
|
116
117
|
"rollup-plugin-visualizer": "^5.6.0",
|
|
117
118
|
"sass": "1.32.12",
|
|
118
|
-
"stylelint": "^14.8.
|
|
119
|
+
"stylelint": "^14.8.3",
|
|
119
120
|
"stylelint-config-prettier": "^9.0.3",
|
|
120
121
|
"stylelint-config-recommended-scss": "^6.0.0",
|
|
121
122
|
"stylelint-config-recommended-vue": "^1.4.0",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-sheet class="v-swatches">
|
|
3
|
-
<div v-for="(colors, rows) in
|
|
3
|
+
<div v-for="(colors, rows) in swatches" :key="rows">
|
|
4
4
|
<v-btn
|
|
5
5
|
v-for="color in colors"
|
|
6
6
|
:key="color"
|
|
7
|
-
elevation="
|
|
7
|
+
:elevation="elevation"
|
|
8
8
|
:width="size"
|
|
9
9
|
:height="size"
|
|
10
10
|
:color="color"
|
|
@@ -21,7 +21,13 @@
|
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<script lang="ts">
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
defineComponent,
|
|
26
|
+
ref,
|
|
27
|
+
type PropType,
|
|
28
|
+
type Ref,
|
|
29
|
+
type SetupContext,
|
|
30
|
+
} from 'vue-demi';
|
|
25
31
|
|
|
26
32
|
import { VSheet, VIcon, VBtn } from 'vuetify/lib';
|
|
27
33
|
import colors from 'vuetify/lib/util/colors';
|
|
@@ -46,7 +52,7 @@ export default defineComponent({
|
|
|
46
52
|
modelValue: { type: String, required: true },
|
|
47
53
|
/** Swatch colors */
|
|
48
54
|
swatches: {
|
|
49
|
-
type: Array as
|
|
55
|
+
type: Array as PropType<string[] | string[][]>,
|
|
50
56
|
default: () => [
|
|
51
57
|
[colors.shades.black, colors.shades.white],
|
|
52
58
|
[
|
|
@@ -72,6 +78,8 @@ export default defineComponent({
|
|
|
72
78
|
[colors.brown.base, colors.blueGrey.base, colors.grey.base],
|
|
73
79
|
],
|
|
74
80
|
},
|
|
81
|
+
/** The size of the shadow of the button */
|
|
82
|
+
elevation: { type: Number, default: 1 },
|
|
75
83
|
/** Swatch sized */
|
|
76
84
|
size: { type: String, default: '2rem' },
|
|
77
85
|
/** selected icon */
|
|
@@ -90,9 +98,6 @@ export default defineComponent({
|
|
|
90
98
|
/** チェックアイコンの表示制御 */
|
|
91
99
|
const checkedVisibilty: Ref<boolean> = ref(false);
|
|
92
100
|
|
|
93
|
-
/** Palette */
|
|
94
|
-
const palette: Ref<string[] | string[][]> = ref(props.swatches);
|
|
95
|
-
|
|
96
101
|
/** Selected color */
|
|
97
102
|
const selected: Ref<string> = ref(props.modelValue);
|
|
98
103
|
|
|
@@ -112,7 +117,6 @@ export default defineComponent({
|
|
|
112
117
|
|
|
113
118
|
return {
|
|
114
119
|
checkedVisibilty,
|
|
115
|
-
palette,
|
|
116
120
|
selected,
|
|
117
121
|
onSwatchClick,
|
|
118
122
|
};
|