From 156960b92ed4e0d0adaadf2306838cdd10e2ef73 Mon Sep 17 00:00:00 2001 From: kawamataryo <ba068082@gmail.com> Date: Fri, 25 Oct 2024 13:29:40 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20types=E3=81=A8disabled=E3=82=92props?= =?UTF-8?q?=E3=81=A7=E5=8F=97=E3=81=91=E5=8F=96=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TextInput/TextInput.stories.ts | 7 +++++++ src/components/TextInput/TextInput.vue | 12 +++++++++++- types/components/TextInput/TextInput.vue.d.ts | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/components/TextInput/TextInput.stories.ts b/src/components/TextInput/TextInput.stories.ts index 116c6bf..6361ede 100644 --- a/src/components/TextInput/TextInput.stories.ts +++ b/src/components/TextInput/TextInput.stories.ts @@ -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() { diff --git a/src/components/TextInput/TextInput.vue b/src/components/TextInput/TextInput.vue index bb617b3..2b0b0bc 100644 --- a/src/components/TextInput/TextInput.vue +++ b/src/components/TextInput/TextInput.vue @@ -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')" @@ -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')" @@ -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, diff --git a/types/components/TextInput/TextInput.vue.d.ts b/types/components/TextInput/TextInput.vue.d.ts index f66dfcb..ecb8ffb 100644 --- a/types/components/TextInput/TextInput.vue.d.ts +++ b/types/components/TextInput/TextInput.vue.d.ts @@ -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; @@ -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;