调整passwd组件

master
yutent 2023-08-15 17:44:53 +08:00
parent 1f2b9c3432
commit b830f009ba
2 changed files with 22 additions and 67 deletions

View File

@ -118,7 +118,7 @@ class Button extends Component {
} }
:host(:focus-within) { :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) { :host(:empty) {
button .icon { button .icon {

View File

@ -8,18 +8,12 @@ import '../icon/index.js'
class Passwd extends Component { class Passwd extends Component {
static props = { static props = {
type: 'primary', value: 'str!',
icon: '',
size: 'l',
value: {
type: String,
default: '',
attribute: false
},
autofocus: false, autofocus: false,
readonly: false, readonly: false,
disabled: false, disabled: false,
lazy: 0 // 并发拦截时间, 单位毫秒 placeholder: 'str!',
lazy: 'num!0' // 并发拦截时间, 单位毫秒
} }
static styles = [ static styles = [
@ -43,9 +37,9 @@ class Passwd extends Component {
align-items: center; align-items: center;
height: 32px; height: 32px;
font-size: 14px; 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; border-radius: inherit;
background: var(--input-bg-color, #fff); background: var(--wc-passwd-background, #fff);
color: inherit; color: inherit;
cursor: inherit; cursor: inherit;
@ -65,17 +59,23 @@ class Passwd extends Component {
cursor: inherit; cursor: inherit;
&::placeholder { &::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` css`
.label { .label {
.icon { .icon {
--wc-icon-size: 16px; --wc-icon-size: 16px;
margin: 0 8px 0 4px; margin: 0 8px 0 4px;
color: var(--color-grey-2); color: var(--color-grey-3);
cursor: pointer; cursor: pointer;
} }
} }
@ -89,12 +89,9 @@ class Passwd extends Component {
h: 24px, h: 24px,
f: 12px f: 12px
), ),
l: ( // l default
w: 108px, xl:
h: 32px, (
f: 14px
),
xl: (
w: 132px, w: 132px,
h: 36px, h: 36px,
f: 14px f: 14px
@ -118,45 +115,9 @@ class Passwd extends Component {
--wc-icon-size: 18px; --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` css`
:host([disabled]), :host([disabled]),
:host([readonly]) { :host([readonly]) {
@ -174,13 +135,6 @@ class Passwd extends Component {
opacity: 0.6; opacity: 0.6;
} }
} }
:host([no-border]),
:host(:focus-within[no-border]) {
.label {
border: 0;
}
}
` `
] ]
@ -215,6 +169,7 @@ class Passwd extends Component {
<input <input
spellcheck="false" spellcheck="false"
ref="input" ref="input"
placeholder=${this.placeholder}
@input=${this.handleInput} @input=${this.handleInput}
@change=${this.handleChange} @change=${this.handleChange}
:readOnly=${this.readOnly} :readOnly=${this.readOnly}