vuetify-swatches 0.0.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/LICENSE +21 -0
- package/README.md +46 -0
- package/dist/VSwatches.es.js +3143 -0
- package/dist/VSwatches.umd.js +33 -0
- package/dist/components/VSwatches.vue.d.ts +23 -0
- package/dist/components/VSwatches.vue.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.d.ts +6 -0
- package/dist/index.esm.d.ts.map +1 -0
- package/dist/style.css +5 -0
- package/package.json +125 -0
- package/src/components/VSwatches.vue +115 -0
package/package.json
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
+
"name": "vuetify-swatches",
|
|
4
|
+
"private": false,
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"description": "Color Swatch component for Vuetify.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"vuejs",
|
|
9
|
+
"vue",
|
|
10
|
+
"vue-components",
|
|
11
|
+
"color-picker",
|
|
12
|
+
"color-palette",
|
|
13
|
+
"swatches",
|
|
14
|
+
"vue2",
|
|
15
|
+
"vue-plugin",
|
|
16
|
+
"vue-resource",
|
|
17
|
+
"vuetify",
|
|
18
|
+
"vuetify-components"
|
|
19
|
+
],
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "Logue",
|
|
22
|
+
"email": "logue@hotmail.co.jp",
|
|
23
|
+
"url": "https://logue.dev/"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/logue/vuetify-swatches",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git@github.com:logue/vuetify-swatches.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/logue/vuetify-swatches/issues"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=16"
|
|
35
|
+
},
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"main": "./dist/VSwatches.umd.js",
|
|
38
|
+
"module": "./dist/VSwatches.es.js",
|
|
39
|
+
"browser": {
|
|
40
|
+
"./sfc": "./src/components/VSwatches.vue"
|
|
41
|
+
},
|
|
42
|
+
"exports": {
|
|
43
|
+
".": {
|
|
44
|
+
"import": "./dist/VSwatches.es.js",
|
|
45
|
+
"require": "./dist/VSwatches.umd.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"types": "./types/index.d.ts",
|
|
49
|
+
"files": [
|
|
50
|
+
"/dist",
|
|
51
|
+
"/src/components/VSwatches.vue"
|
|
52
|
+
],
|
|
53
|
+
"sideEffects": false,
|
|
54
|
+
"scripts": {
|
|
55
|
+
"dev": "vite",
|
|
56
|
+
"build": "vite build & vue-tsc",
|
|
57
|
+
"build:clean": "rimraf dist && rimraf types",
|
|
58
|
+
"lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
|
|
59
|
+
"lint:style": "stylelint **/*.{css,sass,scss,htm,html,vue} --fix --cache",
|
|
60
|
+
"lint:markup": "vue-tsc --noEmit",
|
|
61
|
+
"prepare": "husky install"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"vue": "^2.6.14",
|
|
65
|
+
"vue-class-component": "^7.2.6",
|
|
66
|
+
"vue-property-decorator": "^9.1.2",
|
|
67
|
+
"vuetify": "^2.6.4"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@types/node": "^17.0.21",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^5.15.0",
|
|
72
|
+
"@typescript-eslint/parser": "^5.15.0",
|
|
73
|
+
"@vue/compiler-sfc": "^3.2.31",
|
|
74
|
+
"@vue/eslint-config-typescript": "^10.0.0",
|
|
75
|
+
"eslint": "^8.11.0",
|
|
76
|
+
"eslint-config-google": "^0.14.0",
|
|
77
|
+
"eslint-config-prettier": "^8.5.0",
|
|
78
|
+
"eslint-config-vuetify": "^0.6.1",
|
|
79
|
+
"eslint-import-resolver-alias": "^1.1.2",
|
|
80
|
+
"eslint-import-resolver-typescript": "^2.5.0",
|
|
81
|
+
"eslint-plugin-import": "^2.25.4",
|
|
82
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
83
|
+
"eslint-plugin-prettier-vue": "^3.1.0",
|
|
84
|
+
"eslint-plugin-tsdoc": "^0.2.14",
|
|
85
|
+
"eslint-plugin-vue": "^8.5.0",
|
|
86
|
+
"eslint-plugin-vuejs-accessibility": "^1.1.1",
|
|
87
|
+
"eslint-plugin-vuetify": "^1.1.0",
|
|
88
|
+
"eslint-plugin-yaml": "^0.5.0",
|
|
89
|
+
"husky": "^7.0.4",
|
|
90
|
+
"lint-staged": "^12.3.6",
|
|
91
|
+
"postcss-html": "^1.3.0",
|
|
92
|
+
"prettier": "^2.6.0",
|
|
93
|
+
"prettier-plugin-jsdoc": "^0.3.31",
|
|
94
|
+
"prettier-plugin-md-nocjsp": "^1.2.0",
|
|
95
|
+
"prettier-plugin-sort-imports": "^1.6.0",
|
|
96
|
+
"rimraf": "^3.0.2",
|
|
97
|
+
"sass": "1.32.12",
|
|
98
|
+
"stylelint": "^14.6.0",
|
|
99
|
+
"stylelint-config-prettier": "^9.0.3",
|
|
100
|
+
"stylelint-config-recommended-scss": "^5.0.2",
|
|
101
|
+
"stylelint-config-recommended-vue": "^1.3.0",
|
|
102
|
+
"stylelint-order": "^5.0.0",
|
|
103
|
+
"stylelint-prettier": "^2.0.0",
|
|
104
|
+
"typescript": ">=3.3.1 <4.6.0",
|
|
105
|
+
"unplugin-vue-components": "^0.18.0",
|
|
106
|
+
"vite": "^2.8.6",
|
|
107
|
+
"vite-plugin-eslint": "^1.3.0",
|
|
108
|
+
"vite-plugin-stylelint": "^1.2.0",
|
|
109
|
+
"vite-plugin-vue2": "^1.9.3",
|
|
110
|
+
"vue-eslint-parser": "^8.3.0",
|
|
111
|
+
"vue-template-compiler": "^2.6.14",
|
|
112
|
+
"vue-tsc": "^0.33.2"
|
|
113
|
+
},
|
|
114
|
+
"husky": {
|
|
115
|
+
"hooks": {
|
|
116
|
+
"pre-commit": "lint-staged"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"lint-staged": {
|
|
120
|
+
"*.vue": "vue-tsc --noEmit",
|
|
121
|
+
"*.{js,ts,json,yml,yaml,vue,htm,html}": "eslint --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint",
|
|
122
|
+
"*.{css,sass,scss,vue,htm,html}": "stylelint --fix --cache --cache-location ./node_modules/.vite/vite-plugin-stylelint",
|
|
123
|
+
"*": "prettier -w -u"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-sheet class="v-swatches">
|
|
3
|
+
<div v-for="(colors, rows) in palette" :key="rows">
|
|
4
|
+
<v-btn
|
|
5
|
+
v-for="color in colors"
|
|
6
|
+
:key="color"
|
|
7
|
+
elevation="1"
|
|
8
|
+
:width="size"
|
|
9
|
+
:height="size"
|
|
10
|
+
:color="color"
|
|
11
|
+
:value="color"
|
|
12
|
+
min-width="auto"
|
|
13
|
+
@click="onSwatchClick"
|
|
14
|
+
>
|
|
15
|
+
<v-icon
|
|
16
|
+
v-if="color === selected"
|
|
17
|
+
:size="iconSize"
|
|
18
|
+
:color="color"
|
|
19
|
+
v-text="icon"
|
|
20
|
+
/>
|
|
21
|
+
</v-btn>
|
|
22
|
+
</div>
|
|
23
|
+
</v-sheet>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script lang="ts">
|
|
27
|
+
import { Component, Prop, PropSync, Vue } from 'vue-property-decorator';
|
|
28
|
+
|
|
29
|
+
import { VSheet, VIcon, VBtn } from 'vuetify/lib';
|
|
30
|
+
import colors from 'vuetify/lib/util/colors';
|
|
31
|
+
|
|
32
|
+
@Component({
|
|
33
|
+
components: {
|
|
34
|
+
VSheet,
|
|
35
|
+
VBtn,
|
|
36
|
+
VIcon,
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
/** Swatch */
|
|
40
|
+
export default class VSwatches extends Vue {
|
|
41
|
+
/** チェックアイコンの表示制御 */
|
|
42
|
+
checkedVisibilty = false;
|
|
43
|
+
|
|
44
|
+
/** カラー一覧 */
|
|
45
|
+
@PropSync('swatches', {
|
|
46
|
+
type: Array,
|
|
47
|
+
default: () => [
|
|
48
|
+
[colors.shades.black, colors.shades.white],
|
|
49
|
+
[
|
|
50
|
+
colors.red.base,
|
|
51
|
+
colors.pink.base,
|
|
52
|
+
colors.purple.base,
|
|
53
|
+
colors.deepPurple.base,
|
|
54
|
+
colors.indigo.base,
|
|
55
|
+
colors.blue.base,
|
|
56
|
+
colors.lightBlue.base,
|
|
57
|
+
colors.cyan.base,
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
colors.teal.base,
|
|
61
|
+
colors.green.base,
|
|
62
|
+
colors.lightGreen.base,
|
|
63
|
+
colors.lime.base,
|
|
64
|
+
colors.yellow.base,
|
|
65
|
+
colors.amber.base,
|
|
66
|
+
colors.orange.base,
|
|
67
|
+
colors.deepOrange.base,
|
|
68
|
+
],
|
|
69
|
+
[colors.brown.base, colors.blueGrey.base, colors.grey.base],
|
|
70
|
+
],
|
|
71
|
+
})
|
|
72
|
+
palette!: string[] | string[][];
|
|
73
|
+
|
|
74
|
+
/** 親コンポーネントからのバインディング */
|
|
75
|
+
@PropSync('value', { required: true, type: String })
|
|
76
|
+
selected!: string;
|
|
77
|
+
|
|
78
|
+
/** ボタンの大きさ */
|
|
79
|
+
@Prop({ default: '2rem', type: String })
|
|
80
|
+
readonly size!: string;
|
|
81
|
+
|
|
82
|
+
/** 使用するアイコン */
|
|
83
|
+
@Prop({ default: 'mdi-checkbox-marked-circle', type: String })
|
|
84
|
+
readonly icon!: string;
|
|
85
|
+
|
|
86
|
+
/** アイコンサイズ */
|
|
87
|
+
@Prop({ default: '1rem', type: String })
|
|
88
|
+
readonly iconSize!: string;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* ボタンがクリックされた
|
|
92
|
+
*
|
|
93
|
+
* @param e - イベント
|
|
94
|
+
*/
|
|
95
|
+
onSwatchClick(e: Event) {
|
|
96
|
+
const value = (e.target as HTMLButtonElement).value;
|
|
97
|
+
if (!value || this.selected === value) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.selected = value;
|
|
101
|
+
this.$emit('input', value);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<style lang="scss" scoped>
|
|
107
|
+
.v-btn {
|
|
108
|
+
padding: 0 !important;
|
|
109
|
+
margin: 0.1rem;
|
|
110
|
+
|
|
111
|
+
.v-icon {
|
|
112
|
+
filter: invert(100%);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
</style>
|