Skip to content

Commit

Permalink
fix(storybook): readonly & disabled state
Browse files Browse the repository at this point in the history
  • Loading branch information
bar-tay committed Sep 3, 2024
1 parent 1eccc8e commit 4396843
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 13 deletions.
44 changes: 33 additions & 11 deletions packages/ui-library/src/components/input-field-number/index.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ export const staticSemanticStyles = css`
outline-color: ${inputfield.container.border.default.rest.color};
border-radius: ${inputfield.container.borderradius};
&.readonly {
color: ${inputfield.userinput.textcolor.default.readonly};
background-color: ${inputfield.container.bgcolor.default.readonly};
& > input {
color: ${inputfield.userinput.textcolor.default.readonly};
&::placeholder {
color: ${inputfield.placeholder.textcolor.default.readonly};
}
}
}
&:focus-within {
outline-offset: calc(${inputfield.container.border.default.focus.width} * -1);
outline-width: ${inputfield.container.border.default.focus.width};
Expand All @@ -134,14 +147,32 @@ export const staticSemanticStyles = css`
}
}
}
input.${theme} {
all: initial;
all: inherit;
color: ${inputfield.userinput.textcolor.default.rest};
border: none;
&::placeholder {
color: ${inputfield.placeholder.textcolor.default.rest};
}
&.readonly {
color: ${inputfield.userinput.textcolor.default.readonly};
background-color: ${inputfield.container.bgcolor.default.readonly};
&::placeholder {
color: ${inputfield.placeholder.textcolor.default.readonly};
}
}
&:disabled {
color: ${inputfield.userinput.textcolor.default.disabled};
background-color: ${inputfield.container.bgcolor.default.disabled};
&::placeholder {
color: ${inputfield.placeholder.textcolor.default.disabled};
}
}
}
.input-unit-container.${theme} {
Expand Down Expand Up @@ -181,15 +212,6 @@ export const staticSemanticStyles = css`
${inputfield.container.border.default.disabled.color};
background-color: ${inputfield.container.bgcolor.default.disabled};
cursor: not-allowed;
& > input {
color: ${inputfield.userinput.textcolor.default.disabled};
cursor: not-allowed;
&::placeholder {
color: ${inputfield.placeholder.textcolor.default.disabled};
}
}
}
&.error-input.${theme} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class BlrInputFieldNumber extends LitElementCustom {
},
{
'aria-hidden': true,
}
},
)}
</button>
`;
Expand Down Expand Up @@ -335,7 +335,7 @@ export class BlrInputFieldNumber extends LitElementCustom {
? html`<div class="${unitClasses}">${this.unit}</div>`
: nothing}
</div>
${this.renderMode()}
${!this.readonly ? this.renderMode() : nothing}
</div>
</div>
Expand Down

0 comments on commit 4396843

Please sign in to comment.