import {
forwardRef,
type HTMLAttributes,
type InputHTMLAttributes,
type ForwardedRef,
} from 'react'
import {
getSwitchProps,
getSwitchWrapperProps,
splitClassNameProp,
} from '@pluralsight/headless-styles'
import type { SwitchOptions } from '@pluralsight/headless-styles/types'
import { useFormControl } from '../context/FormControl.tsx'
//
type ToggleProps = HTMLAttributes
function ToggleEl(props: ToggleProps, ref: ForwardedRef) {
const pandoProps = getSwitchWrapperProps({
classNames: splitClassNameProp(props.className),
})
return
}
//
interface ToggleButtonProps
extends SwitchOptions,
Omit, 'id' | 'name' | 'children'> {}
function ToggleButtonEl(
props: ToggleButtonProps,
ref: ForwardedRef
) {
const { pandoSize, ...nativeProps } = props
const state = useFormControl()
const pandoProps = getSwitchProps({
...nativeProps,
...state,
classNames: splitClassNameProp(nativeProps.className),
pandoSize,
})
return (
)
}
// exports
export const Toggle = forwardRef(ToggleEl)
export const ToggleButton = forwardRef(
ToggleButtonEl
)