Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(styles): add readonly text-input styles #10778

Merged
merged 4 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ export const TogglePasswordVisibility = () => {
);
};

export const ReadOnly = () => {
return (
<TextInput
labelText="Text input label"
helperText="Optional help text"
value="This is read only, you can't type more."
readOnly
/>
);
};

export const WithLayer = () => {
return (
<>
Expand Down
20 changes: 17 additions & 3 deletions packages/styles/scss/components/text-input/_text-input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,19 @@
width: 100%;
}

.#{$prefix}--text-input__invalid-icon {
.#{$prefix}--text-input__invalid-icon,
.#{$prefix}--text-input__readonly-icon {
position: absolute;
// top/transform used to center invalid icon in IE11
top: 50%;
right: $spacing-05;
fill: $support-error;
transform: translateY(-50%);
}

.#{$prefix}--text-input__invalid-icon {
fill: $support-error;
}

.#{$prefix}--text-input__invalid-icon--warning {
fill: $support-warning;
}
Expand Down Expand Up @@ -175,7 +179,8 @@
}

.#{$prefix}--text-input--invalid,
.#{$prefix}--text-input--warning {
.#{$prefix}--text-input--warning,
.#{$prefix}--text-input-wrapper--readonly .#{$prefix}--text-input {
padding-right: $spacing-08;
}

Expand Down Expand Up @@ -381,6 +386,15 @@
flex-direction: column;
}

//-----------------------------
// Readonly
//-----------------------------

.#{$prefix}--form--fluid .#{$prefix}--text-input-wrapper--readonly,
.#{$prefix}--text-input-wrapper--readonly .#{$prefix}--text-input {
background: transparent;
}

// Windows HCM fix
.#{$prefix}--text-input--password__visibility,
// TODO: remove selector above
Expand Down