mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
refactor: prefer class directive over class attribute (#1318)
This commit is contained in:
parent
40e18fbc88
commit
0801e1d078
9 changed files with 34 additions and 18 deletions
|
@ -178,8 +178,9 @@
|
|||
class:bx--text-input--light="{light}"
|
||||
class:bx--text-input--invalid="{invalid}"
|
||||
class:bx--text-input--warning="{warn}"
|
||||
class:bx--text-input--sm="{size === 'sm'}"
|
||||
class:bx--text-input--xl="{size === 'xl'}"
|
||||
{...$$restProps}
|
||||
class="{size && `bx--text-input--${size}`}"
|
||||
on:change
|
||||
on:input
|
||||
on:input="{({ target }) => {
|
||||
|
@ -199,8 +200,13 @@
|
|||
class:bx--btn--disabled="{disabled}"
|
||||
class:bx--tooltip__trigger="{true}"
|
||||
class:bx--tooltip--a11y="{true}"
|
||||
class="{tooltipPosition && `bx--tooltip--${tooltipPosition}`}
|
||||
{tooltipAlignment && `bx--tooltip--align-${tooltipAlignment}`}"
|
||||
class:bx--tooltip--top="{tooltipPosition === 'top'}"
|
||||
class:bx--tooltip--right="{tooltipPosition === 'right'}"
|
||||
class:bx--tooltip--bottom="{tooltipPosition === 'bottom'}"
|
||||
class:bx--tooltip--left="{tooltipPosition === 'left'}"
|
||||
class:bx--tooltip--align-start="{tooltipAlignment === 'start'}"
|
||||
class:bx--tooltip--align-center="{tooltipAlignment === 'center'}"
|
||||
class:bx--tooltip--align-end="{tooltipAlignment === 'end'}"
|
||||
on:click="{() => {
|
||||
type = type === 'password' ? 'text' : 'password';
|
||||
}}"
|
||||
|
|
|
@ -120,7 +120,8 @@
|
|||
class:bx--visually-hidden="{hideLabel}"
|
||||
class:bx--label--disabled="{disabled}"
|
||||
class:bx--label--inline="{inline}"
|
||||
class="{inline && !!size && `bx--label--inline--${size}`}"
|
||||
class:bx--label--inline--sm="{size === 'sm'}"
|
||||
class:bx--label--inline--xl="{size === 'xl'}"
|
||||
>
|
||||
<slot name="labelText">
|
||||
{labelText}
|
||||
|
@ -191,8 +192,9 @@
|
|||
class:bx--text-input--light="{light}"
|
||||
class:bx--text-input--invalid="{invalid}"
|
||||
class:bx--text-input--warn="{warn}"
|
||||
class:bx--text-input--sm="{size === 'sm'}"
|
||||
class:bx--text-input--xl="{size === 'xl'}"
|
||||
{...$$restProps}
|
||||
class="{size && `bx--text-input--${size}`}"
|
||||
on:change="{onChange}"
|
||||
on:input="{onInput}"
|
||||
on:keydown
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue