Skip to content

Commit

Permalink
fix: typesとdisabledをpropsで受け取るように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
kawamataryo committed Oct 25, 2024
1 parent 201a17f commit 76562c3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/components/TextInput/TextInput.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ const meta: Meta<TextInputPropsAndCustomArgs> = {
autoExpand: false,
baseTextareaHeight: 56,
},
argTypes: {
type: {
control: { type: 'select' },
options: ['text', 'password', 'email', 'number', 'tel', 'date'],
defaultValue: 'text',
},
},
render: (args) => ({
components: { TextInput },
setup() {
Expand Down
12 changes: 11 additions & 1 deletion src/components/TextInput/TextInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
:value="modelValue"
class="text-input is-multi-line"
:class="{ 'has-error': error }"
:disabled="disabled"
v-if="multiline"
@input="onInput"
@focus="$emit('focus')"
Expand All @@ -15,7 +16,8 @@
:value="modelValue"
class="text-input is-single-line"
:class="{ 'has-error': error }"
type="text"
:disabled="disabled"
:type="type"
@input="onInput"
@focus="$emit('focus')"
@blur="$emit('blur')"
Expand Down Expand Up @@ -49,6 +51,14 @@ export default defineComponent({
type: Number,
default: 56,
},
type: {
type: String,
default: 'text',
},
disabled: {
type: Boolean,
default: false,
},
},
emits: {
'update:modelValue': null,
Expand Down
18 changes: 18 additions & 0 deletions types/components/TextInput/TextInput.vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ declare const _default: import("vue").DefineComponent<{
type: NumberConstructor;
default: number;
};
type: {
type: StringConstructor;
default: string;
};
disabled: {
type: BooleanConstructor;
default: boolean;
};
}, {
textarea: import("vue").Ref<HTMLElement | null>;
onInput: (e: Event) => void;
Expand Down Expand Up @@ -47,12 +55,22 @@ declare const _default: import("vue").DefineComponent<{
type: NumberConstructor;
default: number;
};
type: {
type: StringConstructor;
default: string;
};
disabled: {
type: BooleanConstructor;
default: boolean;
};
}>> & {
onFocus?: ((...args: any[]) => any) | undefined;
onBlur?: ((...args: any[]) => any) | undefined;
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
}, {
type: string;
error: boolean;
disabled: boolean;
multiline: boolean;
modelValue: string;
autoExpand: boolean;
Expand Down

0 comments on commit 76562c3

Please sign in to comment.