Skip to content

Commit

Permalink
feat(Experimental/Select): custom selected icon placement
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitano committed Sep 4, 2023
1 parent ea551d3 commit cbf6c47
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/select/src/Select.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ Clearable.args = {
clearable: true,
};

export const SelectedIconPlacementRight = Template.bind({});
SelectedIconPlacementRight.args = {
selectedIconPlacement: 'right',
};

export const WrapperClass = Template.bind({});
WrapperClass.args = {
wrapperClass: 'border-b-2 border-error-500 rounded-b-lg',
Expand Down
4 changes: 4 additions & 0 deletions packages/select/src/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const props = withDefaults(
searchSuffixIconSize?: string;
searchSuffixIconClass?: string;
wrapperClass?: string;
selectedIconPlacement?: 'left' | 'right';
}>(),
{
itemText: 'text',
Expand All @@ -96,6 +97,7 @@ const props = withDefaults(
clearIcon: 'heroicons:x-mark',
searchPrefixIconSize: 'sm',
searchSuffixIconSize: 'sm',
selectedIconPlacement: 'right',
},
);
Expand Down Expand Up @@ -431,6 +433,8 @@ defineSlots<{
:class="{
'v-select-option--active': active,
'v-select-option--selected': selected,
'v-select-option--icon-left': selectedIconPlacement === 'left',
'v-select-option--icon-right': selectedIconPlacement === 'right',
}"
>
<div
Expand Down
4 changes: 4 additions & 0 deletions packages/themes/src/morpheme/_select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@
height: 1.25rem /* 20px */;
}
}

&--icon-right {
flex-direction: row-reverse;
}
}

&-searchable {
Expand Down

0 comments on commit cbf6c47

Please sign in to comment.