From 4ee7a8bac6a55b09e0a800815411c5d75a3ddc56 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Thu, 19 Aug 2021 16:20:40 +0200 Subject: [PATCH] feat: native color picker instead of verte Prepare for vue 3 --- package.json | 1 - src/components/input/colorPicker.vue | 80 ++++++++++++------------- src/styles/components/color-picker.scss | 47 +++++++++++++-- yarn.lock | 12 ---- 4 files changed, 82 insertions(+), 58 deletions(-) diff --git a/package.json b/package.json index b2e624944..7d222d837 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "register-service-worker": "1.7.2", "snake-case": "3.0.4", "ufo": "0.7.9", - "verte": "0.0.12", "vue": "2.6.14", "vue-advanced-cropper": "1.8.2", "vue-drag-resize": "1.5.4", diff --git a/src/components/input/colorPicker.vue b/src/components/input/colorPicker.vue index 080089a9e..e48588848 100644 --- a/src/components/input/colorPicker.vue +++ b/src/components/input/colorPicker.vue @@ -1,31 +1,46 @@ - - + \ No newline at end of file diff --git a/src/styles/components/color-picker.scss b/src/styles/components/color-picker.scss index 2df889c9a..0dbaff73c 100644 --- a/src/styles/components/color-picker.scss +++ b/src/styles/components/color-picker.scss @@ -3,9 +3,46 @@ justify-content: center; align-items: center; - .verte__guide { - border-radius: 100%; - border: 1px solid $grey-300; - box-shadow: $card-shadow; - } + // reset / see https://stackoverflow.com/a/11471224/15522256 + input[type="color"] { + -webkit-appearance: none; + border: none; + } + input[type="color"]::-webkit-color-swatch-wrapper { + padding: 0; + } + input[type="color"]::-webkit-color-swatch { + border: none; + } + + $PICKER_SIZE: 24px; + $BORDER_WIDTH: 1px; + .picker { + display: grid; + width: $PICKER_SIZE; + height: $PICKER_SIZE; + overflow: hidden; + border-radius: 100%; + border: $BORDER_WIDTH solid $grey-300; + box-shadow: $card-shadow; + + & > * { + grid-row: 1; + grid-column: 1; + } + } + + input.picker__input { + padding: 0; + width: $PICKER_SIZE - 2 * $BORDER_WIDTH; + height: $PICKER_SIZE - 2 * $BORDER_WIDTH; + } + + .picker__input.is-empty { + opacity: 0; + } + + .picker__pattern { + pointer-events: none; + } } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 4608f9e59..8f4e4047a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3030,11 +3030,6 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-fns@^0.0.10: - version "0.0.10" - resolved "https://registry.yarnpkg.com/color-fns/-/color-fns-0.0.10.tgz#b03f34ab3bb3902ac24e7c86ff32d845fbbaf7bf" - integrity sha512-QFKowTE9CXCLp09Gz5cQo8VPUP55hf73iHEI52JC3NyKfMpQG2VoLWmTxYeTKH6ngkEnoMrCdEX//M6J4PVQBA== - color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" @@ -7447,13 +7442,6 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -verte@0.0.12: - version "0.0.12" - resolved "https://registry.yarnpkg.com/verte/-/verte-0.0.12.tgz#f91b3f82cf2d6ea81ac2ccad66bb9aefe7997503" - integrity sha512-QEWpKkjAT8SLkNJzeiZxN7tJuUiTTFO51tg9dGIrkDlQhzbaM+bTT0wtDM2c/F+Ur9luE64qhsM4xI0Af3Ut1g== - dependencies: - color-fns "^0.0.10" - vite-plugin-pwa@0.11.2: version "0.11.2" resolved "https://registry.yarnpkg.com/vite-plugin-pwa/-/vite-plugin-pwa-0.11.2.tgz#21998b6b00b156c8f395700549a34fb9304db6cb"