From ee96fa93858277e3ba5002f26e8aa6bdc596f8dc Mon Sep 17 00:00:00 2001 From: Eiinu Date: Fri, 15 Dec 2023 15:36:35 +0800 Subject: [PATCH] chore(radio): improve type def (#2743) --- src/packages/__VUE/radio/demo.vue | 4 ++-- src/packages/__VUE/radio/index.scss | 1 + src/packages/__VUE/radio/index.taro.vue | 6 +++--- src/packages/__VUE/radio/index.vue | 6 +++--- src/packages/__VUE/radio/types.ts | 9 ++++++++- src/packages/__VUE/radiogroup/index.scss | 5 ----- src/packages/__VUE/radiogroup/index.taro.vue | 10 +++++----- src/packages/__VUE/radiogroup/index.vue | 10 +++++----- 8 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/packages/__VUE/radio/demo.vue b/src/packages/__VUE/radio/demo.vue index 100942e6a5..3efb72dd1f 100644 --- a/src/packages/__VUE/radio/demo.vue +++ b/src/packages/__VUE/radio/demo.vue @@ -17,7 +17,7 @@ - {{ translate('option1') }} + {{ translate('option1') }} {{ translate('option2') }} {{ translate('option3') }} @@ -40,7 +40,7 @@ - {{ translate('option1') }} + {{ translate('option1') }} {{ translate('option2') }} {{ translate('option3') }} diff --git a/src/packages/__VUE/radio/index.scss b/src/packages/__VUE/radio/index.scss index 75abf1ab3d..42980764cd 100644 --- a/src/packages/__VUE/radio/index.scss +++ b/src/packages/__VUE/radio/index.scss @@ -24,6 +24,7 @@ display: flex; align-items: center; flex-shrink: 0; + cursor: pointer; &:last-child { margin-bottom: 0 !important; diff --git a/src/packages/__VUE/radio/index.taro.vue b/src/packages/__VUE/radio/index.taro.vue index f74f9589e7..d3e4988179 100644 --- a/src/packages/__VUE/radio/index.taro.vue +++ b/src/packages/__VUE/radio/index.taro.vue @@ -4,7 +4,7 @@ import { createComponent } from '@/packages/utils/create'; const { componentName, create } = createComponent('radio'); import { CheckNormal, CheckChecked } from '@nutui/icons-vue-taro'; import { pxCheck } from '@/packages/utils/pxCheck'; -import { RADIO_KEY, RadioButtonSize } from './types'; +import { RADIO_KEY, RadioShape, RadioButtonSize } from './types'; export default create({ components: { @@ -17,8 +17,8 @@ export default create({ default: false }, shape: { - type: String, - default: 'round' // button + type: String as PropType, + default: 'round' }, label: { type: [String, Number, Boolean], diff --git a/src/packages/__VUE/radio/index.vue b/src/packages/__VUE/radio/index.vue index 97a2c62862..291566cce4 100644 --- a/src/packages/__VUE/radio/index.vue +++ b/src/packages/__VUE/radio/index.vue @@ -4,7 +4,7 @@ import { createComponent } from '@/packages/utils/create'; const { componentName, create } = createComponent('radio'); import { CheckNormal, CheckChecked } from '@nutui/icons-vue'; import { pxCheck } from '@/packages/utils/pxCheck'; -import { RADIO_KEY, RadioButtonSize } from './types'; +import { RADIO_KEY, RadioShape, RadioButtonSize } from './types'; export default create({ components: { @@ -17,8 +17,8 @@ export default create({ default: false }, shape: { - type: String, - default: 'round' // button + type: String as PropType, + default: 'round' }, label: { type: [String, Number, Boolean], diff --git a/src/packages/__VUE/radio/types.ts b/src/packages/__VUE/radio/types.ts index bd9ba1b284..5c3ef6f6d8 100644 --- a/src/packages/__VUE/radio/types.ts +++ b/src/packages/__VUE/radio/types.ts @@ -1,2 +1,9 @@ export const RADIO_KEY = Symbol('nut-radio'); -export type RadioButtonSize = 'large' | 'normal' | 'small' | 'mini'; + +// Radio +export type RadioShape = 'round' | 'button'; +export type RadioButtonSize = 'normal' | 'small' | 'mini'; + +// RadioGroup +export type RadioGroupTextPosition = 'right' | 'left'; +export type RadioGroupDirection = 'vertical' | 'horizontal'; diff --git a/src/packages/__VUE/radiogroup/index.scss b/src/packages/__VUE/radiogroup/index.scss index 581e18ea2a..1d5e530167 100644 --- a/src/packages/__VUE/radiogroup/index.scss +++ b/src/packages/__VUE/radiogroup/index.scss @@ -3,8 +3,6 @@ .nut-radio { margin-bottom: 5px; } - &--vertical { - } &--horizontal { .nut-radio { display: inline-flex; @@ -14,9 +12,6 @@ margin: 0 6px; } } - &--button { - // ... - } } } } diff --git a/src/packages/__VUE/radiogroup/index.taro.vue b/src/packages/__VUE/radiogroup/index.taro.vue index 3c7f3aea08..4bbadad7c0 100644 --- a/src/packages/__VUE/radiogroup/index.taro.vue +++ b/src/packages/__VUE/radiogroup/index.taro.vue @@ -1,7 +1,7 @@