-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
RadioGroupIndicator.ts
43 lines (36 loc) · 1.31 KB
/
RadioGroupIndicator.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { defineComponent, h, mergeProps } from 'vue'
import { useForwardRef } from '@oku-ui/use-composable'
import type { RadioElement } from './Radio'
import { useRadioScope } from './Radio'
import { OkuRadioIndicator, type RadioIndicatorElement, type RadioIndicatorProps } from './RadioIndicator'
import { scopeRadioGroupProps } from './utils'
import { radioGroupProps } from './RadioGroup'
const INDICATOR_NAME = 'OkuRadioGroupIndicator'
export type RadioGroupIndicatorNaviteElement = RadioIndicatorElement
export type RadioGroupIndicatorElement = RadioElement
export interface RadioGroupIndicatorProps extends RadioIndicatorProps {}
export const radioGroupIndicatorProps = {
props: {
...radioGroupProps.props,
},
}
const RadioGroupIndicator = defineComponent({
name: INDICATOR_NAME,
inheritAttrs: false,
props: {
...radioGroupIndicatorProps.props,
...scopeRadioGroupProps,
},
setup(props, { attrs }) {
const { scopeOkuRadioGroup } = props
const radioScope = useRadioScope(scopeOkuRadioGroup)
const forwardedRef = useForwardRef()
return () => h(OkuRadioIndicator,
{ ...mergeProps(attrs), ...radioScope, ref: forwardedRef },
)
},
})
export const OkuRadioGroupIndicator = RadioGroupIndicator as typeof RadioGroupIndicator &
(new () => {
$props: RadioGroupIndicatorNaviteElement
})