From b830f009ba76c3a19fc678d9f415b520a64b3dfd Mon Sep 17 00:00:00 2001 From: yutent Date: Tue, 15 Aug 2023 17:44:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4passwd=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/form/button.js | 2 +- src/form/passwd.js | 87 +++++++++++----------------------------------- 2 files changed, 22 insertions(+), 67 deletions(-) diff --git a/src/form/button.js b/src/form/button.js index d66a0b4..70e34bb 100644 --- a/src/form/button.js +++ b/src/form/button.js @@ -118,7 +118,7 @@ class Button extends Component { } :host(:focus-within) { - box-shadow: 0 0 0 2px var(--color-dark-a); + box-shadow: 0 0 0 2px var(--color-plain-a); } :host(:empty) { button .icon { diff --git a/src/form/passwd.js b/src/form/passwd.js index c1abc7a..0980c06 100644 --- a/src/form/passwd.js +++ b/src/form/passwd.js @@ -8,18 +8,12 @@ import '../icon/index.js' class Passwd extends Component { static props = { - type: 'primary', - icon: '', - size: 'l', - value: { - type: String, - default: '', - attribute: false - }, + value: 'str!', autofocus: false, readonly: false, disabled: false, - lazy: 0 // 并发拦截时间, 单位毫秒 + placeholder: 'str!', + lazy: 'num!0' // 并发拦截时间, 单位毫秒 } static styles = [ @@ -43,9 +37,9 @@ class Passwd extends Component { align-items: center; height: 32px; font-size: 14px; - border: 1px solid var(--color-grey-2); + border: 1px solid var(--wc-passwd-border-color, var(--color-dark-2)); border-radius: inherit; - background: var(--input-bg-color, #fff); + background: var(--wc-passwd-background, #fff); color: inherit; cursor: inherit; @@ -65,17 +59,23 @@ class Passwd extends Component { cursor: inherit; &::placeholder { - color: var(--color-grey-1); + color: var(--color-grey-2); } } } + :host([round]) .label input { + padding: 0 6px 0 20px; + } + :host(:focus-within) { + box-shadow: 0 0 0 2px var(--color-plain-a); + } `, css` .label { .icon { --wc-icon-size: 16px; margin: 0 8px 0 4px; - color: var(--color-grey-2); + color: var(--color-grey-3); cursor: pointer; } } @@ -89,16 +89,13 @@ class Passwd extends Component { h: 24px, f: 12px ), - l: ( - w: 108px, - h: 32px, - f: 14px - ), - xl: ( - w: 132px, - h: 36px, - f: 14px - ), + // l default + xl: + ( + w: 132px, + h: 36px, + f: 14px + ), xxl: ( w: 160px, h: 44px, @@ -118,45 +115,9 @@ class Passwd extends Component { --wc-icon-size: 18px; } } - - @if $s == 'xxxl' { - .label input { - padding: 0 6px 0 10px; - } - .icon { - --wc-icon-size: 22px; - margin: 0 12px 0 4px; - } - } - } - :host([round][size='#{$s}']) .label input { - padding: 0 6px 0 20px; } } `, - // 配色 - css` - $colors: ( - primary: 'teal', - info: 'blue', - success: 'green', - warning: 'orange', - danger: 'red', - secondary: 'dark', - help: 'grey' - ); - - @loop $t, $c in $colors { - :host([type='#{$t}']:focus-within) { - box-shadow: 0 0 0 2px var(--color-#{$c}-a); - } - - :host([type='#{$t}']) .label { - border-color: var(--color-#{$c}-2); - } - } - `, - css` :host([disabled]), :host([readonly]) { @@ -174,13 +135,6 @@ class Passwd extends Component { opacity: 0.6; } } - - :host([no-border]), - :host(:focus-within[no-border]) { - .label { - border: 0; - } - } ` ] @@ -215,6 +169,7 @@ class Passwd extends Component {