'use client'; import * as React from 'react'; import { createSwitchController, type SwitchProps, type SwitchController } from '@uifn/core/primitives/switch'; import { ReactPrimitivePart, ReactPrimitiveRoot, useReactPrimitive, type ReactPrimitiveBridge, type ReactPrimitiveDefinition, type ReactPrimitiveHookResult, type ReactPrimitivePartProps, type ReactPrimitiveRootProps, } from '../internal/compound'; const SwitchContext = React.createContext | null>(null); const SwitchDefinition: ReactPrimitiveDefinition = { name: 'Switch', family: 'forms-input', kind: 'interactive-controller', rootPart: 'root', inputNames: ["checked","defaultChecked","name","value","disabled","readOnly","required"], context: SwitchContext, createController: createSwitchController as never, }; export type SwitchRootProps = ReactPrimitiveRootProps; export const SwitchRoot = React.forwardRef, SwitchRootProps>((props, ref) => ( } props={props as never} /> )); SwitchRoot.displayName = 'SwitchRoot'; export type SwitchControlProps = ReactPrimitivePartProps; export const SwitchControl = React.forwardRef, SwitchControlProps>((props, ref) => ( } props={props as never} /> )); SwitchControl.displayName = 'SwitchControl'; export type SwitchThumbProps = ReactPrimitivePartProps; export const SwitchThumb = React.forwardRef, SwitchThumbProps>((props, ref) => ( } props={props as never} /> )); SwitchThumb.displayName = 'SwitchThumb'; export type SwitchLabelProps = ReactPrimitivePartProps; export const SwitchLabel = React.forwardRef, SwitchLabelProps>((props, ref) => ( } props={props as never} /> )); SwitchLabel.displayName = 'SwitchLabel'; export type SwitchHiddenInputProps = ReactPrimitivePartProps; export const SwitchHiddenInput = React.forwardRef, SwitchHiddenInputProps>((props, ref) => ( } props={props as never} /> )); SwitchHiddenInput.displayName = 'SwitchHiddenInput'; export const SwitchProvider = SwitchRoot; export function useSwitch(inputs: SwitchProps = {} as SwitchProps): ReactPrimitiveHookResult { return useReactPrimitive(SwitchDefinition, inputs) as ReactPrimitiveHookResult; } export const Switch = Object.assign(SwitchRoot, { Provider: SwitchProvider, Root: SwitchRoot, Control: SwitchControl, Thumb: SwitchThumb, Label: SwitchLabel, HiddenInput: SwitchHiddenInput });