Skip to content

Commit

Permalink
feat(global): apply readonly color to icons & add control to select
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 df51f02 commit ef54fc2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ $ods-datepicker-padding: 6px;
&__icon {
color: var(--ods-color-primary-500);

&--disabled {
&--disabled,
&--readonly {
color: var(--ods-color-neutral-500);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export class OdsDatepicker {
class={{
'ods-datepicker__actions__icon': true,
'ods-datepicker__actions__icon--disabled': this.isDisabled,
'ods-datepicker__actions__icon--readonly': this.isReadonly,
}}
name={ ODS_ICON_NAME.calendar }
onClick={ () => this.open() }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $select-padding-right: $select-caret-size + ($select-base-padding * 2);
border: solid 1px var(--ods-color-neutral-300);
border-radius: 0;
background-color: $select-background-color;
cursor: pointer !important;
cursor: pointer;
padding: 0 $select-padding-right 0 $select-base-padding !important;
height: input.$ods-input-input-height;
min-height: auto;
Expand Down Expand Up @@ -247,6 +247,21 @@ $select-padding-right: $select-caret-size + ($select-base-padding * 2);
&.locked {
.ts-control {
@include state.ods-is-readonly();

cursor: default;

&::after {
color: var(--ods-color-neutral-500);
}

.ts-merged-items {
background: var(--ods-color-neutral-050);

&__count {
color: var(--ods-color-text);
font-weight: 700;
}
}
}
}
}
Expand Down
20 changes: 20 additions & 0 deletions packages/storybook/stories/components/select/select.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const Demo: StoryObj = {
render: (arg) => html`
<ods-select has-error="${arg.hasError}"
is-disabled="${arg.isDisabled}"
is-readonly="${arg.isReadonly}"
placeholder="${arg.placeholder}">
<option value="dog">Dog</option>
<option value="cat">Cat</option>
Expand All @@ -41,6 +42,14 @@ export const Demo: StoryObj = {
},
control: 'boolean',
},
isReadonly: {
table: {
category: CONTROL_CATEGORY.general,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
control: 'boolean',
},
placeholder: {
table: {
category: CONTROL_CATEGORY.general,
Expand All @@ -53,6 +62,7 @@ export const Demo: StoryObj = {
args: {
hasError: false,
isDisabled: false,
isReadonly: false,
},
};

Expand All @@ -61,6 +71,7 @@ export const DemoMultiple: StoryObj = {
<ods-select allow-multiple
has-error="${arg.hasError}"
is-disabled="${arg.isDisabled}"
is-readonly="${arg.isReadonly}"
multiple-selection-label="${arg.multipleSelectionLabel}"
placeholder="${arg.placeholder}">
<option value="dog">Dog</option>
Expand Down Expand Up @@ -88,6 +99,14 @@ export const DemoMultiple: StoryObj = {
},
control: 'boolean',
},
isReadonly: {
table: {
category: CONTROL_CATEGORY.general,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
control: 'boolean',
},
multipleSelectionLabel: {
table: {
category: CONTROL_CATEGORY.general,
Expand All @@ -108,6 +127,7 @@ export const DemoMultiple: StoryObj = {
args: {
hasError: false,
isDisabled: false,
isReadonly: false,
multipleSelectionLabel: 'Selected item',
},
};
Expand Down

0 comments on commit ef54fc2

Please sign in to comment.