Skip to content

Commit

Permalink
feat(Autocomplete): add shadow prop and fix disabled styles
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitano committed May 23, 2023
1 parent 1b12e8a commit 4260db5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/autocomplete/src/VAutocomplete.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import VAutocomplete from './VAutocomplete.vue';
import VBtn from '@morpheme/button';
import {Story} from '@storybook/vue3';


const items = [
{value: 1, text: 'Wade Cooper'},
{value: 2, text: 'Arlene Mccoy'},
Expand Down Expand Up @@ -39,6 +38,11 @@ const Template: Story = (args) => ({
export const Default = Template.bind({});
Default.args = {};

export const Shadow = Template.bind({});
Shadow.args = {
shadow: true,
};

export const Clearable = Template.bind({});
Clearable.args = {
clearable: true,
Expand Down
2 changes: 2 additions & 0 deletions packages/autocomplete/src/VAutocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type Props = {
disabled?: boolean
hideError?: boolean
hint?: string
shadow?: boolean
};
const props = withDefaults(defineProps<Props>(), {
Expand Down Expand Up @@ -97,6 +98,7 @@ const clear = () => {
'autocomplete--error': !!errorMessage,
'autocomplete--selected': !!uncontrolledValue,
'autocomplete--disabled': disabled,
'autocomplete--shadow': shadow,
},
]"
as="div"
Expand Down
18 changes: 17 additions & 1 deletion packages/themes/src/morpheme/_autocomplete.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
--v-autocomplete-error-color: var(--color-base-error-300);

// disabled
--v-autocomplete-input-disabled-color: var(--v-input-disabled-bg-color);
--v-autocomplete-input-disabled-bg-color: var(--v-input-disabled-bg-color);
--v-autocomplete-input-disabled-border-color: var(--v-input-disabled-border-color);

// hint
--v-autocomplete-hint-font-size: var(--v-input-hint-font-size, 14px);
Expand All @@ -65,6 +66,21 @@

.autocomplete {
position: relative;
border-radius: var(--border-radius-lg);

$c: &;

&--disabled {
#{$c}-input {
cursor: not-allowed;
background-color: var(--v-autocomplete-input-disabled-bg-color);
border-color: var(--v-autocomplete-input-disabled-border-color);
}
}

&--shadow {
box-shadow: var(--effect-shadow-md);
}

&-label {
color: var(--v-input-label-color);
Expand Down

0 comments on commit 4260db5

Please sign in to comment.