Skip to content

Commit

Permalink
feat(global): add read-only tokens & apply style to components
Browse files Browse the repository at this point in the history
Signed-off-by: astagnol <[email protected]>
  • Loading branch information
astagnol authored and dpellier committed Oct 31, 2024
1 parent 7e6309b commit df51f02
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $ods-datepicker-padding: 6px;

padding-right: input.$ods-input-input-padding-right;

&:not(#{$input}--error, :disabled) {
&:not(#{$input}--error, :disabled, :read-only) {
&:focus {
border-color: var(--ods-color-form-element-border-focus-default);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
margin: 0;
}

&:not(#{$input}--error, :disabled) {
&:not(#{$input}--error, :disabled, :read-only) {
&:focus {
border-color: var(--ods-color-form-element-border-focus-default);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ $select-padding-right: $select-caret-size + ($select-base-padding * 2);
}
}

&.readonly {
&.locked {
.ts-control {
@include state.ods-is-readonly();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export class OdsSelect {

@Watch('isReadonly')
onIsReadonlyChange(newValue: boolean): void {
// TODO use same still as input readonly (focused)
if (newValue) {
this.select?.lock();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
height: auto;
resize: none;

&:not(#{$textarea}--error, :disabled) {
&:not(#{$textarea}--error, :disabled, :read-only) {
&:focus {
border-color: var(--ods-color-form-element-border-focus-default);
}
Expand Down
5 changes: 4 additions & 1 deletion packages/ods/src/style/_state.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
$ods-state-is-disabled-background-color: var(--ods-color-background-disabled-default);
$ods-state-is-disabled-border-color: var(--ods-color-border-disabled-default);
$ods-state-is-disabled-text-color: var(--ods-color-text-disabled-default);
$ods-state-is-readonly-background-color: var(--ods-color-background-readonly-default);
$ods-state-is-readonly-border-color: var(--ods-color-border-readonly-default);

@mixin ods-is-disabled() {
border-color: $ods-state-is-disabled-border-color;
Expand All @@ -10,5 +12,6 @@ $ods-state-is-disabled-text-color: var(--ods-color-text-disabled-default);
}

@mixin ods-is-readonly() {
// Empty for now, no style has been yet defined
border-color: $ods-state-is-readonly-border-color;
background-color: $ods-state-is-readonly-background-color;
}
2 changes: 2 additions & 0 deletions packages/themes/src/default/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ $ods-color-new: $ods-palette-bright-cyan;
$ods-color-promotion: $ods-palette-royal-fuschia;
$ods-color-text: $ods-palette-twilight;
$ods-color-background-disabled-default: $ods-color-neutral-100;
$ods-color-background-readonly-default: $ods-color-neutral-050;
$ods-color-border-disabled-default: $ods-color-neutral-200;
$ods-color-border-readonly-default: $ods-color-neutral-050;
$ods-color-text-disabled-default: $ods-color-neutral-500;
$ods-color-form-element-background-default: $ods-color-neutral-000;
$ods-color-form-element-background-hover-default: $ods-color-neutral-000;
Expand Down
2 changes: 2 additions & 0 deletions packages/themes/src/default/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
--ods-border-width-md: #{var.$ods-border-width-md};
--ods-color-alpha: #{var.$ods-color-alpha};
--ods-color-background-disabled-default: #{var.$ods-color-background-disabled-default};
--ods-color-background-readonly-default: #{var.$ods-color-background-readonly-default};
--ods-color-border-disabled-default: #{var.$ods-color-border-disabled-default};
--ods-color-border-readonly-default: #{var.$ods-color-border-readonly-default};
--ods-color-beta: #{var.$ods-color-beta};
--ods-color-critical-000: #{var.$ods-color-critical-000};
--ods-color-critical-050: #{var.$ods-color-critical-050};
Expand Down

0 comments on commit df51f02

Please sign in to comment.