From 9ca9aa55eabcbd91a3ef0ca5b7b2d20721b97474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Tue, 6 Apr 2021 19:06:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8D=95=E9=80=89/=E5=A4=8D?= =?UTF-8?q?=E9=80=89=E6=A1=86=E7=9A=84=E6=A0=B7=E5=BC=8F=E5=8F=8A=E4=BA=A4?= =?UTF-8?q?=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/form/checkbox-item.wc | 162 +++++++++++++++++++++++++++++--------- src/form/checkbox.wc | 19 ++++- src/form/radio-item.wc | 32 ++++++-- src/form/radio.wc | 17 +++- src/meditor/index.wc | 2 +- 5 files changed, 183 insertions(+), 49 deletions(-) diff --git a/src/form/checkbox-item.wc b/src/form/checkbox-item.wc index d732b3d..b3182ed 100644 --- a/src/form/checkbox-item.wc +++ b/src/form/checkbox-item.wc @@ -1,6 +1,6 @@ @@ -24,16 +24,113 @@ user-select: none; white-space: nowrap; cursor: inherit; + outline: none; color: var(--color-dark-1); + + &.checked .dot { + background: var(--color-dark-1); + + wc-icon { + --size: 14px; + } + } } .dot { - --size: 20px; - padding: 2px; + display: flex; + justify-content: center; + align-items: center; + width: 16px; + height: 16px; margin-right: 4px; + border: 1px solid var(--color-dark-1); + border-radius: 4px; + background: #fff; + color: #fff; + transition: box-shadow 0.15s linear, background 0.15s linear; + + wc-icon { + --size: 0px; + transition: width 0.15s linear; + } } } +:host(:focus-within) .dot { + box-shadow: 0 0 0 2px var(--color-plain-a); +} + +:host([type='danger']) label { + color: var(--color-red-1); + .dot { + border-color: var(--color-red-1); + } + + &.checked .dot { + background: var(--color-red-1); + } +} +:host([type='danger']:focus-within) .dot { + box-shadow: 0 0 0 2px var(--color-red-a); +} + +:host([type='info']) label { + color: var(--color-blue-1); + .dot { + border-color: var(--color-bule-1); + } + + &.checked .dot { + background: var(--color-bule-1); + } +} +:host([type='info']:focus-within) .dot { + box-shadow: 0 0 0 2px var(--color-blue-a); +} + +:host([type='success']) label { + color: var(--color-green-1); + .dot { + border-color: var(--color-green-1); + } + + &.checked .dot { + background: var(--color-green-1); + } +} +:host([type='success']:focus-within) .dot { + box-shadow: 0 0 0 2px var(--color-green-a); +} + +:host([type='primary']) label { + color: var(--color-teal-1); + + .dot { + border-color: var(--color-teal-1); + } + + &.checked .dot { + background: var(--color-teal-1); + } +} +:host([type='primary']:focus-within) .dot { + box-shadow: 0 0 0 2px var(--color-teal-a); +} + +:host([type='warning']) label { + color: var(--color-orange-1); + .dot { + border-color: var(--color-orange-1); + } + + &.checked .dot { + background: var(--color-orange-1); + } +} +:host([type='warning']:focus-within) .dot { + box-shadow: 0 0 0 2px var(--color-orange-a); +} + :host([readonly]) { cursor: default; opacity: 0.8; @@ -47,26 +144,6 @@ color: var(--color-grey-2); } } - -:host([type='danger']) label { - color: var(--color-red-1); -} - -:host([type='info']) label { - color: var(--color-blue-1); -} - -:host([type='success']) label { - color: var(--color-green-1); -} - -:host([type='primary']) label { - color: var(--color-teal-1); -} - -:host([type='warning']) label { - color: var(--color-orange-1); -}