@spark-ui/components 10.0.2 → 10.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/checkbox/index.js +117 -478
  3. package/dist/checkbox/index.js.map +1 -1
  4. package/dist/checkbox/index.mjs +3 -4
  5. package/dist/checkbox/index.mjs.map +1 -1
  6. package/dist/{chunk-JC6KKYUQ.mjs → chunk-7BTJUYP3.mjs} +6 -5
  7. package/dist/{chunk-JC6KKYUQ.mjs.map → chunk-7BTJUYP3.mjs.map} +1 -1
  8. package/dist/combobox/index.js +301 -710
  9. package/dist/combobox/index.js.map +1 -1
  10. package/dist/combobox/index.mjs +3 -5
  11. package/dist/combobox/index.mjs.map +1 -1
  12. package/dist/dropdown/index.js +252 -662
  13. package/dist/dropdown/index.js.map +1 -1
  14. package/dist/dropdown/index.mjs +1 -4
  15. package/dist/dropdown/index.mjs.map +1 -1
  16. package/dist/form-field/index.mjs +373 -7
  17. package/dist/form-field/index.mjs.map +1 -1
  18. package/dist/input/index.js +47 -454
  19. package/dist/input/index.js.map +1 -1
  20. package/dist/input/index.mjs +1 -3
  21. package/dist/radio-group/index.js +47 -553
  22. package/dist/radio-group/index.js.map +1 -1
  23. package/dist/radio-group/index.mjs +3 -9
  24. package/dist/radio-group/index.mjs.map +1 -1
  25. package/dist/select/index.js +159 -569
  26. package/dist/select/index.js.map +1 -1
  27. package/dist/select/index.mjs +1 -4
  28. package/dist/select/index.mjs.map +1 -1
  29. package/dist/stepper/index.js +110 -516
  30. package/dist/stepper/index.js.map +1 -1
  31. package/dist/stepper/index.mjs +2 -5
  32. package/dist/stepper/index.mjs.map +1 -1
  33. package/dist/switch/index.js +96 -545
  34. package/dist/switch/index.js.map +1 -1
  35. package/dist/switch/index.mjs +3 -6
  36. package/dist/switch/index.mjs.map +1 -1
  37. package/dist/textarea/index.js +58 -465
  38. package/dist/textarea/index.js.map +1 -1
  39. package/dist/textarea/index.mjs +1 -3
  40. package/dist/textarea/index.mjs.map +1 -1
  41. package/package.json +16 -6
  42. package/tsup.config.ts +2 -1
  43. package/dist/chunk-7PMPYEHJ.mjs +0 -379
  44. package/dist/chunk-7PMPYEHJ.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/switch/index.ts","../../src/form-field/FormField.tsx","../../src/slot/Slot.tsx","../../src/form-field/FormFieldContext.tsx","../../src/form-field/FormFieldProvider.tsx","../../src/form-field/FormFieldStateMessage.tsx","../../src/icon/Icon.tsx","../../src/visually-hidden/VisuallyHidden.tsx","../../src/icon/Icon.styles.tsx","../../src/form-field/FormFieldMessage.tsx","../../src/form-field/FormFieldAlertMessage.tsx","../../src/form-field/FormFieldCharactersCount.tsx","../../src/form-field/FormFieldControl.tsx","../../src/form-field/FormFieldErrorMessage.tsx","../../src/form-field/FormFieldHelperMessage.tsx","../../src/form-field/FormFieldLabel.tsx","../../src/label/Label.tsx","../../src/label/LabelRequiredIndicator.tsx","../../src/label/index.ts","../../src/form-field/FormFieldRequiredIndicator.tsx","../../src/form-field/FormFieldSuccessMessage.tsx","../../src/form-field/index.ts","../../src/switch/Switch.tsx","../../src/switch/SwitchInput.tsx","../../src/switch/SwitchInput.styles.ts","../../src/switch/SwitchLabel.styles.ts","../../src/switch/SwitchLabel.tsx"],"sourcesContent":["export * from './Switch'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, Ref, useId } from 'react'\n\nimport { Slot } from '../slot'\nimport { FormFieldContextState, ID_PREFIX } from './FormFieldContext'\nimport { FormFieldProvider } from './FormFieldProvider'\n\nexport interface FormFieldProps\n extends ComponentPropsWithoutRef<'div'>,\n Pick<FormFieldContextState, 'name' | 'state' | 'isRequired'> {\n /**\n * Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n */\n asChild?: boolean\n /**\n * When `true`, prevents the user from interacting.\n */\n disabled?: boolean\n /**\n * Sets the component as interactive or not.\n */\n readOnly?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const FormField = ({\n className,\n disabled = false,\n readOnly = false,\n name,\n state,\n isRequired = false,\n asChild = false,\n ref,\n ...others\n}: FormFieldProps) => {\n const id = `${ID_PREFIX}-${useId()}`\n const Component = asChild ? Slot : 'div'\n\n return (\n <FormFieldProvider\n id={id}\n name={name}\n isRequired={isRequired}\n disabled={disabled}\n readOnly={readOnly}\n state={state}\n >\n <Component\n ref={ref}\n data-spark-component=\"form-field\"\n className={cx(className, 'gap-sm flex flex-col')}\n {...others}\n />\n </FormFieldProvider>\n )\n}\n\nFormField.displayName = 'FormField'\n","import { Slot as RadixSlot } from 'radix-ui'\nimport {\n cloneElement,\n HTMLAttributes,\n isValidElement,\n PropsWithChildren,\n ReactNode,\n Ref,\n} from 'react'\n\nexport const Slottable = RadixSlot.Slottable\n\nexport type SlotProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Slot = ({ ref, ...props }: SlotProps) => {\n return <RadixSlot.Root ref={ref} {...props} />\n}\n\n/**\n * When using Radix `Slot` component, it will consider its first child to merge its props with.\n * In some cases, you might need to wrap the top child with additional markup without breaking this behaviour.\n */\nexport const wrapPolymorphicSlot = (\n asChild: boolean | undefined,\n children: ReactNode,\n callback: (children: ReactNode) => ReactNode\n) => {\n if (!asChild) return callback(children) // If polymorphic behaviour is not used, we keep the original children\n\n return isValidElement(children)\n ? cloneElement(\n children,\n undefined,\n callback((children.props as { children: ReactNode }).children)\n )\n : null\n}\n","import { createContext, useContext } from 'react'\n\nexport interface FormFieldContextState {\n /**\n * Generated id for the input component.\n */\n id: string\n /**\n * Generated id for the label component.\n */\n labelId?: string\n /**\n * The name of the input. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * A set of ids separated by a space used to describe the input component given by a set of messages.\n */\n description?: string\n /**\n * Disables the field and its associated input\n */\n disabled?: boolean\n /**\n * Marks the field and its associated input as read only\n */\n readOnly?: boolean\n /**\n * The validation state of the input.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the form field will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the form field will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to store a descriptive message.\n */\n onMessageIdAdd: (id: string) => void\n /**\n * Callback used to remove a descriptive message.\n */\n onMessageIdRemove: (id: string) => void\n}\n\nexport const FormFieldContext = createContext<FormFieldContextState | null>(null)\n\nexport const ID_PREFIX = ':form-field'\n\nexport const useFormField = () => {\n const context = useContext(FormFieldContext)\n\n if (!context) {\n throw Error('useFormField must be used within a FormField provider')\n }\n\n return context\n}\n","import { ReactNode, useCallback, useId, useMemo, useState } from 'react'\n\nimport { FormFieldContext, FormFieldContextState, ID_PREFIX } from './FormFieldContext'\n\nexport interface FormFieldProviderProps\n extends Pick<\n FormFieldContextState,\n 'id' | 'name' | 'disabled' | 'readOnly' | 'state' | 'isRequired'\n > {\n children: ReactNode\n}\n\nexport const FormFieldProvider = ({\n id,\n name,\n disabled = false,\n readOnly = false,\n state,\n isRequired,\n children,\n}: FormFieldProviderProps) => {\n const labelId = `${ID_PREFIX}-label-${useId()}`\n const [messageIds, setMessageIds] = useState<string[]>([])\n const description = messageIds.length > 0 ? messageIds.join(' ') : undefined\n\n const handleMessageIdAdd = useCallback((msgId: string) => {\n setMessageIds(ids => [...ids, msgId])\n }, [])\n\n const handleMessageIdRemove = useCallback((msgId: string) => {\n setMessageIds(ids => ids.filter(current => current !== msgId))\n }, [])\n\n const value = useMemo(() => {\n const isInvalid = state === 'error'\n\n return {\n id,\n labelId,\n name,\n disabled,\n readOnly,\n state,\n isRequired,\n isInvalid,\n description,\n onMessageIdAdd: handleMessageIdAdd,\n onMessageIdRemove: handleMessageIdRemove,\n }\n }, [\n id,\n labelId,\n name,\n disabled,\n readOnly,\n description,\n state,\n isRequired,\n handleMessageIdAdd,\n handleMessageIdRemove,\n ])\n\n return <FormFieldContext.Provider value={value}>{children}</FormFieldContext.Provider>\n}\n\nFormFieldProvider.displayName = 'FormFieldProvider'\n","import { AlertOutline } from '@spark-ui/icons/AlertOutline'\nimport { Check } from '@spark-ui/icons/Check'\nimport { WarningOutline } from '@spark-ui/icons/WarningOutline'\nimport { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useFormField } from './FormFieldContext'\nimport { FormFieldMessage, FormFieldMessageProps } from './FormFieldMessage'\n\nexport interface FormFieldStateMessageProps extends FormFieldMessageProps {\n state: 'error' | 'alert' | 'success'\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldStateMessage = ({\n className,\n state,\n children,\n ref,\n ...others\n}: FormFieldStateMessageProps) => {\n const field = useFormField()\n\n if (field.state !== state) {\n return null\n }\n\n return (\n <FormFieldMessage\n ref={ref}\n data-spark-component=\"form-field-state-message\"\n aria-live=\"polite\"\n className={cx(\n 'gap-sm flex items-center',\n state === 'error' ? 'text-error' : 'text-on-surface/dim-1',\n className\n )}\n {...others}\n >\n {state === 'alert' && (\n <Icon size=\"sm\">\n <WarningOutline />\n </Icon>\n )}\n {state === 'error' && (\n <Icon size=\"sm\" intent=\"error\">\n <AlertOutline />\n </Icon>\n )}\n {state === 'success' && (\n <Icon size=\"sm\">\n <Check />\n </Icon>\n )}\n\n {children}\n </FormFieldMessage>\n )\n}\n\nFormFieldStateMessage.displayName = 'FormField.StateMessage'\n","import { Children, cloneElement, ComponentPropsWithoutRef, ReactElement, ReactNode } from 'react'\n\nimport { VisuallyHidden } from '../visually-hidden'\nimport { iconStyles, IconVariantsProps } from './Icon.styles'\n\nexport interface IconProps extends IconVariantsProps, ComponentPropsWithoutRef<'svg'> {\n /**\n * The svg icon that will be wrapped\n */\n children: ReactNode\n /**\n * The accessible label for the icon. This label will be visually hidden but announced to screen\n * reader users, similar to `alt` text for `img` tags.\n */\n label?: string\n}\n\nexport const Icon = ({\n label,\n className,\n size = 'current',\n intent = 'current',\n children,\n ...others\n}: IconProps) => {\n const child = Children.only(children)\n\n return (\n <>\n {cloneElement(child as ReactElement<Record<string, any>>, {\n className: iconStyles({ className, size, intent }),\n 'data-spark-component': 'icon',\n 'aria-hidden': 'true',\n focusable: 'false',\n ...others,\n })}\n\n {label && <VisuallyHidden>{label}</VisuallyHidden>}\n </>\n )\n}\n\nIcon.displayName = 'Icon'\n","import { HTMLAttributes, PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\n\nexport type VisuallyHiddenProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLElement>\n}\n\nexport const VisuallyHidden = ({ asChild = false, ref, ...props }: VisuallyHiddenProps) => {\n const Component = asChild ? Slot : 'span'\n\n return (\n <Component\n {...props}\n ref={ref}\n style={{\n // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss\n position: 'absolute',\n border: 0,\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n wordWrap: 'normal',\n ...props.style,\n }}\n />\n )\n}\n\nVisuallyHidden.displayName = 'VisuallyHidden'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const iconStyles = cva(['fill-current shrink-0'], {\n variants: {\n /**\n * Color scheme of the icon.\n */\n intent: makeVariants<\n 'intent',\n [\n 'current',\n 'main',\n 'support',\n 'accent',\n 'basic',\n 'success',\n 'alert',\n 'error',\n 'info',\n 'neutral',\n ]\n >({\n current: ['text-current'],\n main: ['text-main'],\n support: ['text-support'],\n accent: ['text-accent'],\n basic: ['text-basic'],\n success: ['text-success'],\n alert: ['text-alert'],\n error: ['text-error'],\n info: ['text-info'],\n neutral: ['text-neutral'],\n }),\n /**\n * Sets the size of the icon.\n */\n size: makeVariants<'size', ['current', 'sm', 'md', 'lg', 'xl']>({\n current: ['u-current-font-size'],\n sm: ['w-sz-16', 'h-sz-16'],\n md: ['w-sz-24', 'h-sz-24'],\n lg: ['w-sz-32', 'h-sz-32'],\n xl: ['w-sz-40', 'h-sz-40'],\n }),\n },\n})\n\nexport type IconVariantsProps = VariantProps<typeof iconStyles>\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useId } from 'react'\n\nimport { ID_PREFIX, useFormField } from './FormFieldContext'\n\nexport type FormFieldMessageProps = ComponentPropsWithoutRef<'span'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldMessage = ({\n id: idProp,\n className,\n ref,\n ...others\n}: FormFieldMessageProps) => {\n const { onMessageIdAdd, onMessageIdRemove } = useFormField()\n const currentId = `${ID_PREFIX}-message-${useId()}`\n const id = idProp || currentId\n\n useEffect(() => {\n onMessageIdAdd(id)\n\n return () => {\n onMessageIdRemove(id)\n }\n }, [id, onMessageIdAdd, onMessageIdRemove])\n\n return (\n <span\n ref={ref}\n id={id}\n data-spark-component=\"form-field-message\"\n className={cx(className, 'text-caption')}\n {...others}\n />\n )\n}\n\nFormFieldMessage.displayName = 'FormField.Message'\n","import { Ref } from 'react'\n\nimport { FormFieldStateMessage, FormFieldStateMessageProps } from './FormFieldStateMessage'\n\nexport type FormFieldAlertMessageProps = Omit<FormFieldStateMessageProps, 'state'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldAlertMessage = ({ ref, ...props }: FormFieldAlertMessageProps) => {\n return (\n <FormFieldStateMessage\n ref={ref}\n data-spark-component=\"form-field-alert-message\"\n state=\"alert\"\n {...props}\n />\n )\n}\n\nFormFieldAlertMessage.displayName = 'FormField.AlertMessage'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, Ref } from 'react'\n\nexport type FormFieldCharactersCountProps = ComponentPropsWithoutRef<'span'> & {\n /**\n * Current value for the input this component belongs to.\n */\n value?: string\n /**\n * Maximum numeric value to be displayed.\n */\n maxLength: number\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldCharactersCount = ({\n className,\n value = '',\n maxLength,\n ref,\n ...others\n}: FormFieldCharactersCountProps) => {\n const displayValue = `${value.length}/${maxLength}`\n\n return (\n <span\n ref={ref}\n data-spark-component=\"form-field-characters-count\"\n className={cx(className, 'text-caption', 'text-neutral')}\n {...others}\n >\n {displayValue}\n </span>\n )\n}\n\nFormFieldCharactersCount.displayName = 'FormField.CharactersCount'\n","import { ReactNode, useContext } from 'react'\n\nimport { FormFieldContext, FormFieldContextState } from './FormFieldContext'\n\ntype State = Partial<\n Pick<\n FormFieldContextState,\n | 'id'\n | 'name'\n | 'description'\n | 'labelId'\n | 'disabled'\n | 'readOnly'\n | 'state'\n | 'isInvalid'\n | 'isRequired'\n >\n>\n\nexport interface FormFieldControlProps {\n children: (state: State) => ReactNode\n}\n\nexport const useFormFieldControl = () => {\n const { id, name, description, disabled, readOnly, state, labelId, isInvalid, isRequired } =\n useContext(FormFieldContext) || {}\n\n return {\n id,\n name,\n description,\n disabled,\n readOnly,\n state,\n labelId,\n isInvalid,\n isRequired,\n } as State\n}\n\nexport const FormFieldControl = ({ children }: FormFieldControlProps) => {\n const props = useFormFieldControl()\n\n return <>{children(props)}</>\n}\n\nFormFieldControl.displayName = 'FormField.Control'\n","import { Ref } from 'react'\n\nimport { FormFieldStateMessage, FormFieldStateMessageProps } from './FormFieldStateMessage'\n\nexport type FormFieldErrorMessageProps = Omit<FormFieldStateMessageProps, 'state'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldErrorMessage = ({ ref, ...props }: FormFieldErrorMessageProps) => {\n return (\n <FormFieldStateMessage\n ref={ref}\n data-spark-component=\"form-field-error-message\"\n state=\"error\"\n {...props}\n />\n )\n}\n\nFormFieldErrorMessage.displayName = 'FormField.ErrorMessage'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { FormFieldMessage, FormFieldMessageProps } from './FormFieldMessage'\n\nexport type FormFieldHelperMessageProps = FormFieldMessageProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldHelperMessage = ({\n className,\n ref,\n ...others\n}: FormFieldHelperMessageProps) => {\n return (\n <FormFieldMessage\n ref={ref}\n data-spark-component=\"form-field-helper-message\"\n className={cx('text-on-surface/dim-1', className)}\n {...others}\n />\n )\n}\n\nFormFieldHelperMessage.displayName = 'FormField.HelperMessage'\n","import { cx } from 'class-variance-authority'\nimport { ReactNode, Ref } from 'react'\n\nimport { Label, LabelProps } from '../label'\nimport { Slottable } from '../slot'\nimport { useFormField } from './FormFieldContext'\nimport { FormFieldRequiredIndicator } from './FormFieldRequiredIndicator'\n\nexport interface FormFieldLabelProps extends LabelProps {\n /**\n * Element shown when the input is required inside the label.\n */\n requiredIndicator?: ReactNode\n ref?: Ref<HTMLLabelElement>\n}\n\nexport const FormFieldLabel = ({\n htmlFor: htmlForProp,\n className,\n children,\n requiredIndicator = <FormFieldRequiredIndicator />,\n asChild,\n ref,\n ...others\n}: FormFieldLabelProps) => {\n const control = useFormField()\n\n const { disabled, labelId, isRequired } = control\n const htmlFor = asChild ? undefined : htmlForProp || control.id\n\n return (\n <Label\n ref={ref}\n id={labelId}\n data-spark-component=\"form-field-label\"\n htmlFor={htmlFor}\n className={cx(className, disabled ? 'text-on-surface/dim-3 pointer-events-none' : undefined)}\n asChild={asChild}\n {...others}\n >\n <>\n <Slottable>{children}</Slottable>\n {isRequired && requiredIndicator}\n </>\n </Label>\n )\n}\n\nFormFieldLabel.displayName = 'FormField.Label'\n","import { cx } from 'class-variance-authority'\nimport { Label as RadixLabel } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type LabelProps = RadixLabel.LabelProps & {\n ref?: Ref<HTMLLabelElement>\n}\n\nexport const Label = ({ className, ref, ...others }: LabelProps) => {\n return (\n <RadixLabel.Label\n ref={ref}\n data-spark-component=\"label\"\n className={cx('text-body-1', className)}\n {...others}\n />\n )\n}\n\nLabel.displayName = 'Label'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nexport type LabelRequiredIndicatorProps = ComponentPropsWithRef<'span'>\n\nexport const LabelRequiredIndicator = ({\n className,\n children = '*',\n ref,\n ...others\n}: LabelRequiredIndicatorProps) => {\n return (\n <span\n ref={ref}\n data-spark-component=\"label-required-indicator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cx(className, 'text-caption text-on-surface/dim-1')}\n {...others}\n >\n {children}\n </span>\n )\n}\n\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n","import { Label as Root } from './Label'\nimport { LabelRequiredIndicator } from './LabelRequiredIndicator'\n\nexport const Label: typeof Root & {\n RequiredIndicator: typeof LabelRequiredIndicator\n} = Object.assign(Root, {\n RequiredIndicator: LabelRequiredIndicator,\n})\n\nLabel.displayName = 'Label'\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n\nexport type { LabelProps } from './Label'\nexport type { LabelRequiredIndicatorProps } from './LabelRequiredIndicator'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { Label, LabelRequiredIndicatorProps } from '../label'\n\nexport type FormFieldRequiredIndicatorProps = LabelRequiredIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldRequiredIndicator = ({\n className,\n ref,\n ...props\n}: FormFieldRequiredIndicatorProps) => {\n return <Label.RequiredIndicator ref={ref} className={cx('ml-sm', className)} {...props} />\n}\n\nFormFieldRequiredIndicator.displayName = 'FormField.RequiredIndicator'\n","import { Ref } from 'react'\n\nimport { FormFieldStateMessage, FormFieldStateMessageProps } from './FormFieldStateMessage'\n\nexport type FormFieldSuccessMessageProps = Omit<FormFieldStateMessageProps, 'state'> & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const FormFieldSuccessMessage = ({ ref, ...props }: FormFieldSuccessMessageProps) => {\n return (\n <FormFieldStateMessage\n ref={ref}\n data-spark-component=\"form-field-success-message\"\n state=\"success\"\n {...props}\n />\n )\n}\n\nFormFieldSuccessMessage.displayName = 'FormField.SuccessMessage'\n","import { FormField as Root } from './FormField'\nimport { FormFieldAlertMessage } from './FormFieldAlertMessage'\nimport { FormFieldCharactersCount } from './FormFieldCharactersCount'\nimport { FormFieldControl } from './FormFieldControl'\nimport { FormFieldErrorMessage } from './FormFieldErrorMessage'\nimport { FormFieldHelperMessage } from './FormFieldHelperMessage'\nimport { FormFieldLabel } from './FormFieldLabel'\nimport { FormFieldRequiredIndicator } from './FormFieldRequiredIndicator'\nimport { FormFieldStateMessage } from './FormFieldStateMessage'\nimport { FormFieldSuccessMessage } from './FormFieldSuccessMessage'\n\nexport const FormField: typeof Root & {\n Label: typeof FormFieldLabel\n Control: typeof FormFieldControl\n StateMessage: typeof FormFieldStateMessage\n SuccessMessage: typeof FormFieldSuccessMessage\n AlertMessage: typeof FormFieldAlertMessage\n ErrorMessage: typeof FormFieldErrorMessage\n HelperMessage: typeof FormFieldHelperMessage\n RequiredIndicator: typeof FormFieldRequiredIndicator\n CharactersCount: typeof FormFieldCharactersCount\n} = Object.assign(Root, {\n Label: FormFieldLabel,\n Control: FormFieldControl,\n StateMessage: FormFieldStateMessage,\n SuccessMessage: FormFieldSuccessMessage,\n AlertMessage: FormFieldAlertMessage,\n ErrorMessage: FormFieldErrorMessage,\n HelperMessage: FormFieldHelperMessage,\n RequiredIndicator: FormFieldRequiredIndicator,\n CharactersCount: FormFieldCharactersCount,\n})\n\nFormField.displayName = 'FormField'\nFormFieldLabel.displayName = 'FormField.Label'\nFormFieldControl.displayName = 'FormField.Control'\nFormFieldStateMessage.displayName = 'FormField.StateMessage'\nFormFieldSuccessMessage.displayName = 'FormField.SuccessMessage'\nFormFieldAlertMessage.displayName = 'FormField.AlertMessage'\nFormFieldErrorMessage.displayName = 'FormField.ErrorMessage'\nFormFieldHelperMessage.displayName = 'FormField.HelperMessage'\nFormFieldRequiredIndicator.displayName = 'FormField.RequiredIndicator'\nFormFieldCharactersCount.displayName = 'FormField.CharactersCount'\n\nexport { type FormFieldProps } from './FormField'\nexport { type FormFieldStateMessageProps } from './FormFieldStateMessage'\nexport { type FormFieldControl, useFormFieldControl } from './FormFieldControl'\nexport { type FormFieldHelperMessageProps } from './FormFieldHelperMessage'\nexport { type FormFieldSuccessMessageProps } from './FormFieldSuccessMessage'\nexport { type FormFieldAlertMessageProps } from './FormFieldAlertMessage'\nexport { type FormFieldErrorMessageProps } from './FormFieldErrorMessage'\nexport { type FormFieldLabelProps } from './FormFieldLabel'\nexport { type FormFieldRequiredIndicatorProps } from './FormFieldRequiredIndicator'\nexport { type FormFieldCharactersCountProps } from './FormFieldCharactersCount'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { cx } from 'class-variance-authority'\nimport { useId } from 'react'\n\nimport { SwitchInput, SwitchInputProps } from './SwitchInput'\nimport { SwitchLabel } from './SwitchLabel'\n\nexport type SwitchProps = SwitchInputProps\n\nconst ID_PREFIX = ':switch'\n\nexport const Switch = ({\n size = 'md',\n children,\n className,\n id,\n disabled,\n reverse = false,\n ref,\n ...rest\n}: SwitchProps) => {\n const field = useFormFieldControl()\n\n const labelID = `${ID_PREFIX}-label-${useId()}`\n const innerID = `${ID_PREFIX}-input-${useId()}`\n const fieldID = field.id || id || innerID\n\n const switchLabel = children && (\n <SwitchLabel disabled={disabled} htmlFor={fieldID} id={labelID}>\n {children}\n </SwitchLabel>\n )\n\n const switchInput = (\n <SwitchInput\n ref={ref}\n size={size}\n id={fieldID}\n disabled={disabled}\n /**\n * If the switch doesn't have any direct label (children) then we should try to\n * get an eventual alternative label from FormField.\n * On last resort, we shouldn't forget to define an aria-label attribute.\n */\n aria-labelledby={children ? labelID : field.labelId}\n {...rest}\n />\n )\n\n const content = reverse ? (\n <>\n {switchLabel}\n {switchInput}\n </>\n ) : (\n <>\n {switchInput}\n {switchLabel}\n </>\n )\n\n return (\n <div\n data-spark-component=\"switch\"\n className={cx('gap-md text-body-1 flex items-center', className)}\n >\n {content}\n </div>\n )\n}\n\nSwitch.displayName = 'Switch'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { Check } from '@spark-ui/icons/Check'\nimport { Close } from '@spark-ui/icons/Close'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { Switch as RadixSwitch } from 'radix-ui'\nimport { type ComponentPropsWithRef, type ReactNode } from 'react'\n\nimport { Slot } from '../slot'\nimport {\n styles,\n type StylesProps,\n thumbCheckSVGStyles,\n thumbStyles,\n thumbWrapperStyles,\n} from './SwitchInput.styles'\n\nexport interface SwitchInputProps\n extends StylesProps,\n Omit<ComponentPropsWithRef<'button'>, 'value'> {\n /**\n * The state of the switch when it is initially rendered. Use when you do not need to control its state.\n */\n defaultChecked?: boolean\n /**\n * The controlled state of the switch. Must be used in conjunction with `onCheckedChange`.\n */\n checked?: boolean\n /**\n * When true, prevents the user from interacting with the switch.\n */\n /**\n * Event handler called when the state of the switch changes.\n */\n onCheckedChange?: (checked: boolean) => void\n /**\n * When `true`, prevents the user from interacting with the switch.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the switch before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the switch. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value given as data when submitted with a name.\n */\n value?: string\n /**\n * Icon shown inside the thumb of the Switch whenever it is checked\n */\n checkedIcon?: ReactNode\n /**\n * Icon shown inside the thumb of the Switch whenever it is unchecked\n */\n uncheckedIcon?: ReactNode\n /**\n * When true, the label will be placed on the left side of the Switch\n */\n reverse?: boolean\n}\n\nexport const SwitchInput = ({\n checked,\n checkedIcon = <Check />,\n defaultChecked,\n intent: intentProp,\n uncheckedIcon = <Close />,\n size = 'md',\n value = 'on',\n onCheckedChange,\n className,\n required,\n ref,\n ...rest\n}: SwitchInputProps) => {\n const [isChecked, setIsChecked] = useCombinedState(checked, defaultChecked)\n const { name, description, state, isRequired, isInvalid } = useFormFieldControl()\n const intent = state ?? intentProp\n\n const handleCheckedChange = (updatedValue: boolean): void => {\n setIsChecked(updatedValue)\n onCheckedChange?.(updatedValue)\n }\n\n return (\n <RadixSwitch.Root\n ref={ref}\n className={styles({ intent, size, className })}\n value={value}\n checked={checked}\n defaultChecked={defaultChecked}\n onCheckedChange={handleCheckedChange}\n name={name}\n required={required || isRequired}\n aria-invalid={isInvalid}\n aria-describedby={description}\n {...rest}\n >\n <span className={thumbWrapperStyles({ checked: isChecked })}>\n <RadixSwitch.Thumb className={thumbStyles({ size, checked: isChecked })}>\n {isChecked && checkedIcon && (\n <Slot className={thumbCheckSVGStyles({ size })}>{checkedIcon}</Slot>\n )}\n {!isChecked && uncheckedIcon && (\n <Slot className={thumbCheckSVGStyles({ size })}>{uncheckedIcon}</Slot>\n )}\n </RadixSwitch.Thumb>\n </span>\n </RadixSwitch.Root>\n )\n}\n\nSwitchInput.displayName = 'SwitchInput'\n","import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const styles = cva(\n tw([\n 'relative shrink-0 self-baseline',\n 'cursor-pointer',\n 'rounded-full border-transparent',\n 'hover:ring-4',\n 'transition-colors duration-200 ease-in-out',\n 'disabled:hover:ring-transparent disabled:cursor-not-allowed disabled:opacity-dim-3',\n 'focus-visible:u-outline',\n 'data-[state=unchecked]:bg-on-surface/dim-4',\n 'u-shadow-border-transition',\n 'overflow-x-hidden',\n ]),\n {\n variants: {\n /**\n * Size of the switch input.\n */\n size: makeVariants<'size', ['sm', 'md']>({\n sm: tw(['h-sz-24', 'w-sz-40', 'border-md']),\n md: tw(['h-sz-32', 'w-sz-56', 'border-[4px]']),\n }),\n /**\n * Color scheme of the switch input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['data-[state=checked]:bg-main', 'hover:ring-main-container', 'text-main'],\n support: [\n 'data-[state=checked]:bg-support',\n 'hover:ring-support-container',\n 'text-support',\n ],\n accent: ['data-[state=checked]:bg-accent', 'hover:ring-accent-container', 'text-accent'],\n basic: ['data-[state=checked]:bg-basic', 'hover:ring-basic-container', 'text-basic'],\n success: [\n 'data-[state=checked]:bg-success',\n 'hover:ring-success-container',\n 'text-success',\n ],\n alert: ['data-[state=checked]:bg-alert', 'hover:ring-alert-container', 'text-alert'],\n error: ['data-[state=checked]:bg-error', 'hover:ring-error-container', 'text-error'],\n info: ['data-[state=checked]:bg-info', 'hover:ring-info-container', 'text-info'],\n neutral: [\n 'data-[state=checked]:bg-neutral',\n 'hover:ring-neutral-container',\n 'text-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n size: 'sm',\n },\n }\n)\n\nexport type StylesProps = VariantProps<typeof styles>\n\nexport const thumbWrapperStyles = cva(\n [\n 'pointer-events-none absolute inset-0 flex items-center',\n 'transition-all duration-200 ease-in-out',\n ],\n {\n variants: {\n checked: {\n true: 'translate-x-full',\n false: 'translate-x-0',\n },\n },\n }\n)\n\nexport const thumbStyles = cva(\n [\n 'absolute left-0 top-0 flex items-center justify-center',\n 'bg-surface',\n 'rounded-full',\n 'ring-0',\n 'transition-all duration-200 ease-in-out',\n ],\n {\n variants: {\n size: makeVariants<'size', ['sm', 'md']>({\n sm: ['h-sz-20', 'w-sz-20'],\n md: ['h-sz-24', 'w-sz-24'],\n }),\n checked: {\n true: '-translate-x-full',\n false: 'translate-x-0 text-on-surface/dim-4',\n },\n },\n defaultVariants: {\n size: 'sm',\n checked: false,\n },\n }\n)\n\nexport const thumbCheckSVGStyles = cva(['transition-opacity duration-200'], {\n variants: {\n size: makeVariants<'size', ['sm', 'md']>({\n sm: ['h-sz-10 w-sz-10'],\n md: ['h-sz-12 w-sz-12'],\n }),\n },\n defaultVariants: {\n size: 'sm',\n },\n})\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = cva('', {\n variants: {\n disabled: {\n true: ['text-neutral/dim-2', 'cursor-not-allowed'],\n false: ['cursor-pointer'],\n },\n },\n defaultVariants: {\n disabled: false,\n },\n})\n\nexport type LabelStylesProps = VariantProps<typeof labelStyles>\n","import { Label, LabelProps } from '../label'\nimport { labelStyles, LabelStylesProps } from './SwitchLabel.styles'\n\nexport interface SwitchLabelProps extends LabelStylesProps, LabelProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The id of the element the label is associated with.\n */\n htmlFor?: string\n /**\n * When true, prevents the user from interacting with the switch item.\n */\n disabled?: boolean\n}\n\nexport const SwitchLabel = ({ className, disabled, ...others }: SwitchLabelProps) => (\n <Label className={labelStyles({ disabled, className })} {...others} />\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sCAAmB;AACnB,IAAAA,gBAAqD;;;ACDrD,sBAAkC;AAClC,mBAOO;AASE;AAPF,IAAM,YAAY,gBAAAC,KAAU;AAM5B,IAAM,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,MAAiB;AACpD,SAAO,4CAAC,gBAAAA,KAAU,MAAV,EAAe,KAAW,GAAG,OAAO;AAC9C;;;AClBA,IAAAC,gBAA0C;AAiDnC,IAAM,uBAAmB,6BAA4C,IAAI;AAEzE,IAAM,YAAY;AAElB,IAAM,eAAe,MAAM;AAChC,QAAM,cAAU,0BAAW,gBAAgB;AAE3C,MAAI,CAAC,SAAS;AACZ,UAAM,MAAM,uDAAuD;AAAA,EACrE;AAEA,SAAO;AACT;;;AC7DA,IAAAC,gBAAiE;AA8DxD,IAAAC,sBAAA;AAlDF,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AACF,MAA8B;AAC5B,QAAM,UAAU,GAAG,SAAS,cAAU,qBAAM,CAAC;AAC7C,QAAM,CAAC,YAAY,aAAa,QAAI,wBAAmB,CAAC,CAAC;AACzD,QAAM,cAAc,WAAW,SAAS,IAAI,WAAW,KAAK,GAAG,IAAI;AAEnE,QAAM,yBAAqB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wC,SAAS;AAAA,MAE9D;AAAA;AAAA,EACH;AAEJ;AAEA,OAAO,cAAc;","names":["import_react","RadixSlot","import_react","import_react","import_jsx_runtime","import_jsx_runtime","import_class_variance_authority","import_react","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","import_class_variance_authority","import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","import_react","import_jsx_runtime","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","import_class_variance_authority","import_class_variance_authority","import_radix_ui","import_jsx_runtime","RadixLabel","import_class_variance_authority","import_jsx_runtime","Label","import_class_variance_authority","import_jsx_runtime","Label","import_jsx_runtime","Label","import_jsx_runtime","FormField","import_class_variance_authority","import_react","import_Check","import_radix_ui","import_internal_utils","import_class_variance_authority","import_jsx_runtime","RadixSwitch","import_class_variance_authority","import_jsx_runtime","Label","import_jsx_runtime","ID_PREFIX"]}
1
+ {"version":3,"sources":["../../src/switch/index.ts","../../src/switch/Switch.tsx","../../src/switch/SwitchInput.tsx","../../src/slot/Slot.tsx","../../src/switch/SwitchInput.styles.ts","../../src/label/Label.tsx","../../src/label/LabelRequiredIndicator.tsx","../../src/label/index.ts","../../src/switch/SwitchLabel.styles.ts","../../src/switch/SwitchLabel.tsx"],"sourcesContent":["export * from './Switch'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { cx } from 'class-variance-authority'\nimport { useId } from 'react'\n\nimport { SwitchInput, SwitchInputProps } from './SwitchInput'\nimport { SwitchLabel } from './SwitchLabel'\n\nexport type SwitchProps = SwitchInputProps\n\nconst ID_PREFIX = ':switch'\n\nexport const Switch = ({\n size = 'md',\n children,\n className,\n id,\n disabled,\n reverse = false,\n ref,\n ...rest\n}: SwitchProps) => {\n const field = useFormFieldControl()\n\n const labelID = `${ID_PREFIX}-label-${useId()}`\n const innerID = `${ID_PREFIX}-input-${useId()}`\n const fieldID = field.id || id || innerID\n\n const switchLabel = children && (\n <SwitchLabel disabled={disabled} htmlFor={fieldID} id={labelID}>\n {children}\n </SwitchLabel>\n )\n\n const switchInput = (\n <SwitchInput\n ref={ref}\n size={size}\n id={fieldID}\n disabled={disabled}\n /**\n * If the switch doesn't have any direct label (children) then we should try to\n * get an eventual alternative label from FormField.\n * On last resort, we shouldn't forget to define an aria-label attribute.\n */\n aria-labelledby={children ? labelID : field.labelId}\n {...rest}\n />\n )\n\n const content = reverse ? (\n <>\n {switchLabel}\n {switchInput}\n </>\n ) : (\n <>\n {switchInput}\n {switchLabel}\n </>\n )\n\n return (\n <div\n data-spark-component=\"switch\"\n className={cx('gap-md text-body-1 flex items-center', className)}\n >\n {content}\n </div>\n )\n}\n\nSwitch.displayName = 'Switch'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { Check } from '@spark-ui/icons/Check'\nimport { Close } from '@spark-ui/icons/Close'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { Switch as RadixSwitch } from 'radix-ui'\nimport { type ComponentPropsWithRef, type ReactNode } from 'react'\n\nimport { Slot } from '../slot'\nimport {\n styles,\n type StylesProps,\n thumbCheckSVGStyles,\n thumbStyles,\n thumbWrapperStyles,\n} from './SwitchInput.styles'\n\nexport interface SwitchInputProps\n extends StylesProps,\n Omit<ComponentPropsWithRef<'button'>, 'value'> {\n /**\n * The state of the switch when it is initially rendered. Use when you do not need to control its state.\n */\n defaultChecked?: boolean\n /**\n * The controlled state of the switch. Must be used in conjunction with `onCheckedChange`.\n */\n checked?: boolean\n /**\n * When true, prevents the user from interacting with the switch.\n */\n /**\n * Event handler called when the state of the switch changes.\n */\n onCheckedChange?: (checked: boolean) => void\n /**\n * When `true`, prevents the user from interacting with the switch.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the switch before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the switch. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value given as data when submitted with a name.\n */\n value?: string\n /**\n * Icon shown inside the thumb of the Switch whenever it is checked\n */\n checkedIcon?: ReactNode\n /**\n * Icon shown inside the thumb of the Switch whenever it is unchecked\n */\n uncheckedIcon?: ReactNode\n /**\n * When true, the label will be placed on the left side of the Switch\n */\n reverse?: boolean\n}\n\nexport const SwitchInput = ({\n checked,\n checkedIcon = <Check />,\n defaultChecked,\n intent: intentProp,\n uncheckedIcon = <Close />,\n size = 'md',\n value = 'on',\n onCheckedChange,\n className,\n required,\n ref,\n ...rest\n}: SwitchInputProps) => {\n const [isChecked, setIsChecked] = useCombinedState(checked, defaultChecked)\n const { name, description, state, isRequired, isInvalid } = useFormFieldControl()\n const intent = state ?? intentProp\n\n const handleCheckedChange = (updatedValue: boolean): void => {\n setIsChecked(updatedValue)\n onCheckedChange?.(updatedValue)\n }\n\n return (\n <RadixSwitch.Root\n ref={ref}\n className={styles({ intent, size, className })}\n value={value}\n checked={checked}\n defaultChecked={defaultChecked}\n onCheckedChange={handleCheckedChange}\n name={name}\n required={required || isRequired}\n aria-invalid={isInvalid}\n aria-describedby={description}\n {...rest}\n >\n <span className={thumbWrapperStyles({ checked: isChecked })}>\n <RadixSwitch.Thumb className={thumbStyles({ size, checked: isChecked })}>\n {isChecked && checkedIcon && (\n <Slot className={thumbCheckSVGStyles({ size })}>{checkedIcon}</Slot>\n )}\n {!isChecked && uncheckedIcon && (\n <Slot className={thumbCheckSVGStyles({ size })}>{uncheckedIcon}</Slot>\n )}\n </RadixSwitch.Thumb>\n </span>\n </RadixSwitch.Root>\n )\n}\n\nSwitchInput.displayName = 'SwitchInput'\n","import { Slot as RadixSlot } from 'radix-ui'\nimport {\n cloneElement,\n HTMLAttributes,\n isValidElement,\n PropsWithChildren,\n ReactNode,\n Ref,\n} from 'react'\n\nexport const Slottable = RadixSlot.Slottable\n\nexport type SlotProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Slot = ({ ref, ...props }: SlotProps) => {\n return <RadixSlot.Root ref={ref} {...props} />\n}\n\n/**\n * When using Radix `Slot` component, it will consider its first child to merge its props with.\n * In some cases, you might need to wrap the top child with additional markup without breaking this behaviour.\n */\nexport const wrapPolymorphicSlot = (\n asChild: boolean | undefined,\n children: ReactNode,\n callback: (children: ReactNode) => ReactNode\n) => {\n if (!asChild) return callback(children) // If polymorphic behaviour is not used, we keep the original children\n\n return isValidElement(children)\n ? cloneElement(\n children,\n undefined,\n callback((children.props as { children: ReactNode }).children)\n )\n : null\n}\n","import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const styles = cva(\n tw([\n 'relative shrink-0 self-baseline',\n 'cursor-pointer',\n 'rounded-full border-transparent',\n 'hover:ring-4',\n 'transition-colors duration-200 ease-in-out',\n 'disabled:hover:ring-transparent disabled:cursor-not-allowed disabled:opacity-dim-3',\n 'focus-visible:u-outline',\n 'data-[state=unchecked]:bg-on-surface/dim-4',\n 'u-shadow-border-transition',\n 'overflow-x-hidden',\n ]),\n {\n variants: {\n /**\n * Size of the switch input.\n */\n size: makeVariants<'size', ['sm', 'md']>({\n sm: tw(['h-sz-24', 'w-sz-40', 'border-md']),\n md: tw(['h-sz-32', 'w-sz-56', 'border-[4px]']),\n }),\n /**\n * Color scheme of the switch input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['data-[state=checked]:bg-main', 'hover:ring-main-container', 'text-main'],\n support: [\n 'data-[state=checked]:bg-support',\n 'hover:ring-support-container',\n 'text-support',\n ],\n accent: ['data-[state=checked]:bg-accent', 'hover:ring-accent-container', 'text-accent'],\n basic: ['data-[state=checked]:bg-basic', 'hover:ring-basic-container', 'text-basic'],\n success: [\n 'data-[state=checked]:bg-success',\n 'hover:ring-success-container',\n 'text-success',\n ],\n alert: ['data-[state=checked]:bg-alert', 'hover:ring-alert-container', 'text-alert'],\n error: ['data-[state=checked]:bg-error', 'hover:ring-error-container', 'text-error'],\n info: ['data-[state=checked]:bg-info', 'hover:ring-info-container', 'text-info'],\n neutral: [\n 'data-[state=checked]:bg-neutral',\n 'hover:ring-neutral-container',\n 'text-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n size: 'sm',\n },\n }\n)\n\nexport type StylesProps = VariantProps<typeof styles>\n\nexport const thumbWrapperStyles = cva(\n [\n 'pointer-events-none absolute inset-0 flex items-center',\n 'transition-all duration-200 ease-in-out',\n ],\n {\n variants: {\n checked: {\n true: 'translate-x-full',\n false: 'translate-x-0',\n },\n },\n }\n)\n\nexport const thumbStyles = cva(\n [\n 'absolute left-0 top-0 flex items-center justify-center',\n 'bg-surface',\n 'rounded-full',\n 'ring-0',\n 'transition-all duration-200 ease-in-out',\n ],\n {\n variants: {\n size: makeVariants<'size', ['sm', 'md']>({\n sm: ['h-sz-20', 'w-sz-20'],\n md: ['h-sz-24', 'w-sz-24'],\n }),\n checked: {\n true: '-translate-x-full',\n false: 'translate-x-0 text-on-surface/dim-4',\n },\n },\n defaultVariants: {\n size: 'sm',\n checked: false,\n },\n }\n)\n\nexport const thumbCheckSVGStyles = cva(['transition-opacity duration-200'], {\n variants: {\n size: makeVariants<'size', ['sm', 'md']>({\n sm: ['h-sz-10 w-sz-10'],\n md: ['h-sz-12 w-sz-12'],\n }),\n },\n defaultVariants: {\n size: 'sm',\n },\n})\n","import { cx } from 'class-variance-authority'\nimport { Label as RadixLabel } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type LabelProps = RadixLabel.LabelProps & {\n ref?: Ref<HTMLLabelElement>\n}\n\nexport const Label = ({ className, ref, ...others }: LabelProps) => {\n return (\n <RadixLabel.Label\n ref={ref}\n data-spark-component=\"label\"\n className={cx('text-body-1', className)}\n {...others}\n />\n )\n}\n\nLabel.displayName = 'Label'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithRef } from 'react'\n\nexport type LabelRequiredIndicatorProps = ComponentPropsWithRef<'span'>\n\nexport const LabelRequiredIndicator = ({\n className,\n children = '*',\n ref,\n ...others\n}: LabelRequiredIndicatorProps) => {\n return (\n <span\n ref={ref}\n data-spark-component=\"label-required-indicator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cx(className, 'text-caption text-on-surface/dim-1')}\n {...others}\n >\n {children}\n </span>\n )\n}\n\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n","import { Label as Root } from './Label'\nimport { LabelRequiredIndicator } from './LabelRequiredIndicator'\n\nexport const Label: typeof Root & {\n RequiredIndicator: typeof LabelRequiredIndicator\n} = Object.assign(Root, {\n RequiredIndicator: LabelRequiredIndicator,\n})\n\nLabel.displayName = 'Label'\nLabelRequiredIndicator.displayName = 'Label.RequiredIndicator'\n\nexport type { LabelProps } from './Label'\nexport type { LabelRequiredIndicatorProps } from './LabelRequiredIndicator'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = cva('', {\n variants: {\n disabled: {\n true: ['text-neutral/dim-2', 'cursor-not-allowed'],\n false: ['cursor-pointer'],\n },\n },\n defaultVariants: {\n disabled: false,\n },\n})\n\nexport type LabelStylesProps = VariantProps<typeof labelStyles>\n","import { Label, LabelProps } from '../label'\nimport { labelStyles, LabelStylesProps } from './SwitchLabel.styles'\n\nexport interface SwitchLabelProps extends LabelStylesProps, LabelProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The id of the element the label is associated with.\n */\n htmlFor?: string\n /**\n * When true, prevents the user from interacting with the switch item.\n */\n disabled?: boolean\n}\n\nexport const SwitchLabel = ({ className, disabled, ...others }: SwitchLabelProps) => (\n <Label className={labelStyles({ disabled, className })} {...others} />\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,qBAAoC;AACpC,IAAAC,mCAAmB;AACnB,IAAAC,gBAAsB;;;ACFtB,wBAAoC;AACpC,mBAAsB;AACtB,mBAAsB;AACtB,gCAAiC;AACjC,IAAAC,mBAAsC;;;ACJtC,sBAA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AAM,UAAU,UACd,8EACG;AAAA;AAAA,IACA;AAAA,KACH,IAEA,8EACG;AAAA;AAAA,IACA;AAAA,KACH;AAGF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,wBAAqB;AAAA,MACrB,eAAW,qCAAG,wCAAwC,SAAS;AAAA,MAE9D;AAAA;AAAA,EACH;AAEJ;AAEA,OAAO,cAAc;","names":["import_form_field","import_class_variance_authority","import_react","import_radix_ui","RadixSlot","import_jsx_runtime","RadixSwitch","import_class_variance_authority","import_radix_ui","import_jsx_runtime","RadixLabel","import_class_variance_authority","import_jsx_runtime","Label","import_class_variance_authority","import_jsx_runtime","Label","import_jsx_runtime"]}
@@ -1,20 +1,17 @@
1
- import {
2
- useFormFieldControl
3
- } from "../chunk-7PMPYEHJ.mjs";
4
1
  import {
5
2
  Label
6
3
  } from "../chunk-HLXYG643.mjs";
7
- import "../chunk-AESXFMCC.mjs";
8
- import "../chunk-NBZKMCHF.mjs";
9
4
  import {
10
5
  Slot
11
6
  } from "../chunk-4F5DOL57.mjs";
12
7
 
13
8
  // src/switch/Switch.tsx
9
+ import { useFormFieldControl as useFormFieldControl2 } from "@spark-ui/components/form-field";
14
10
  import { cx } from "class-variance-authority";
15
11
  import { useId } from "react";
16
12
 
17
13
  // src/switch/SwitchInput.tsx
14
+ import { useFormFieldControl } from "@spark-ui/components/form-field";
18
15
  import { Check } from "@spark-ui/icons/Check";
19
16
  import { Close } from "@spark-ui/icons/Close";
20
17
  import { useCombinedState } from "@spark-ui/use-combined-state";
@@ -206,7 +203,7 @@ var Switch = ({
206
203
  ref,
207
204
  ...rest
208
205
  }) => {
209
- const field = useFormFieldControl();
206
+ const field = useFormFieldControl2();
210
207
  const labelID = `${ID_PREFIX}-label-${useId()}`;
211
208
  const innerID = `${ID_PREFIX}-input-${useId()}`;
212
209
  const fieldID = field.id || id || innerID;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/switch/Switch.tsx","../../src/switch/SwitchInput.tsx","../../src/switch/SwitchInput.styles.ts","../../src/switch/SwitchLabel.styles.ts","../../src/switch/SwitchLabel.tsx"],"sourcesContent":["import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { cx } from 'class-variance-authority'\nimport { useId } from 'react'\n\nimport { SwitchInput, SwitchInputProps } from './SwitchInput'\nimport { SwitchLabel } from './SwitchLabel'\n\nexport type SwitchProps = SwitchInputProps\n\nconst ID_PREFIX = ':switch'\n\nexport const Switch = ({\n size = 'md',\n children,\n className,\n id,\n disabled,\n reverse = false,\n ref,\n ...rest\n}: SwitchProps) => {\n const field = useFormFieldControl()\n\n const labelID = `${ID_PREFIX}-label-${useId()}`\n const innerID = `${ID_PREFIX}-input-${useId()}`\n const fieldID = field.id || id || innerID\n\n const switchLabel = children && (\n <SwitchLabel disabled={disabled} htmlFor={fieldID} id={labelID}>\n {children}\n </SwitchLabel>\n )\n\n const switchInput = (\n <SwitchInput\n ref={ref}\n size={size}\n id={fieldID}\n disabled={disabled}\n /**\n * If the switch doesn't have any direct label (children) then we should try to\n * get an eventual alternative label from FormField.\n * On last resort, we shouldn't forget to define an aria-label attribute.\n */\n aria-labelledby={children ? labelID : field.labelId}\n {...rest}\n />\n )\n\n const content = reverse ? (\n <>\n {switchLabel}\n {switchInput}\n </>\n ) : (\n <>\n {switchInput}\n {switchLabel}\n </>\n )\n\n return (\n <div\n data-spark-component=\"switch\"\n className={cx('gap-md text-body-1 flex items-center', className)}\n >\n {content}\n </div>\n )\n}\n\nSwitch.displayName = 'Switch'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { Check } from '@spark-ui/icons/Check'\nimport { Close } from '@spark-ui/icons/Close'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { Switch as RadixSwitch } from 'radix-ui'\nimport { type ComponentPropsWithRef, type ReactNode } from 'react'\n\nimport { Slot } from '../slot'\nimport {\n styles,\n type StylesProps,\n thumbCheckSVGStyles,\n thumbStyles,\n thumbWrapperStyles,\n} from './SwitchInput.styles'\n\nexport interface SwitchInputProps\n extends StylesProps,\n Omit<ComponentPropsWithRef<'button'>, 'value'> {\n /**\n * The state of the switch when it is initially rendered. Use when you do not need to control its state.\n */\n defaultChecked?: boolean\n /**\n * The controlled state of the switch. Must be used in conjunction with `onCheckedChange`.\n */\n checked?: boolean\n /**\n * When true, prevents the user from interacting with the switch.\n */\n /**\n * Event handler called when the state of the switch changes.\n */\n onCheckedChange?: (checked: boolean) => void\n /**\n * When `true`, prevents the user from interacting with the switch.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the switch before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the switch. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value given as data when submitted with a name.\n */\n value?: string\n /**\n * Icon shown inside the thumb of the Switch whenever it is checked\n */\n checkedIcon?: ReactNode\n /**\n * Icon shown inside the thumb of the Switch whenever it is unchecked\n */\n uncheckedIcon?: ReactNode\n /**\n * When true, the label will be placed on the left side of the Switch\n */\n reverse?: boolean\n}\n\nexport const SwitchInput = ({\n checked,\n checkedIcon = <Check />,\n defaultChecked,\n intent: intentProp,\n uncheckedIcon = <Close />,\n size = 'md',\n value = 'on',\n onCheckedChange,\n className,\n required,\n ref,\n ...rest\n}: SwitchInputProps) => {\n const [isChecked, setIsChecked] = useCombinedState(checked, defaultChecked)\n const { name, description, state, isRequired, isInvalid } = useFormFieldControl()\n const intent = state ?? intentProp\n\n const handleCheckedChange = (updatedValue: boolean): void => {\n setIsChecked(updatedValue)\n onCheckedChange?.(updatedValue)\n }\n\n return (\n <RadixSwitch.Root\n ref={ref}\n className={styles({ intent, size, className })}\n value={value}\n checked={checked}\n defaultChecked={defaultChecked}\n onCheckedChange={handleCheckedChange}\n name={name}\n required={required || isRequired}\n aria-invalid={isInvalid}\n aria-describedby={description}\n {...rest}\n >\n <span className={thumbWrapperStyles({ checked: isChecked })}>\n <RadixSwitch.Thumb className={thumbStyles({ size, checked: isChecked })}>\n {isChecked && checkedIcon && (\n <Slot className={thumbCheckSVGStyles({ size })}>{checkedIcon}</Slot>\n )}\n {!isChecked && uncheckedIcon && (\n <Slot className={thumbCheckSVGStyles({ size })}>{uncheckedIcon}</Slot>\n )}\n </RadixSwitch.Thumb>\n </span>\n </RadixSwitch.Root>\n )\n}\n\nSwitchInput.displayName = 'SwitchInput'\n","import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const styles = cva(\n tw([\n 'relative shrink-0 self-baseline',\n 'cursor-pointer',\n 'rounded-full border-transparent',\n 'hover:ring-4',\n 'transition-colors duration-200 ease-in-out',\n 'disabled:hover:ring-transparent disabled:cursor-not-allowed disabled:opacity-dim-3',\n 'focus-visible:u-outline',\n 'data-[state=unchecked]:bg-on-surface/dim-4',\n 'u-shadow-border-transition',\n 'overflow-x-hidden',\n ]),\n {\n variants: {\n /**\n * Size of the switch input.\n */\n size: makeVariants<'size', ['sm', 'md']>({\n sm: tw(['h-sz-24', 'w-sz-40', 'border-md']),\n md: tw(['h-sz-32', 'w-sz-56', 'border-[4px]']),\n }),\n /**\n * Color scheme of the switch input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['data-[state=checked]:bg-main', 'hover:ring-main-container', 'text-main'],\n support: [\n 'data-[state=checked]:bg-support',\n 'hover:ring-support-container',\n 'text-support',\n ],\n accent: ['data-[state=checked]:bg-accent', 'hover:ring-accent-container', 'text-accent'],\n basic: ['data-[state=checked]:bg-basic', 'hover:ring-basic-container', 'text-basic'],\n success: [\n 'data-[state=checked]:bg-success',\n 'hover:ring-success-container',\n 'text-success',\n ],\n alert: ['data-[state=checked]:bg-alert', 'hover:ring-alert-container', 'text-alert'],\n error: ['data-[state=checked]:bg-error', 'hover:ring-error-container', 'text-error'],\n info: ['data-[state=checked]:bg-info', 'hover:ring-info-container', 'text-info'],\n neutral: [\n 'data-[state=checked]:bg-neutral',\n 'hover:ring-neutral-container',\n 'text-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n size: 'sm',\n },\n }\n)\n\nexport type StylesProps = VariantProps<typeof styles>\n\nexport const thumbWrapperStyles = cva(\n [\n 'pointer-events-none absolute inset-0 flex items-center',\n 'transition-all duration-200 ease-in-out',\n ],\n {\n variants: {\n checked: {\n true: 'translate-x-full',\n false: 'translate-x-0',\n },\n },\n }\n)\n\nexport const thumbStyles = cva(\n [\n 'absolute left-0 top-0 flex items-center justify-center',\n 'bg-surface',\n 'rounded-full',\n 'ring-0',\n 'transition-all duration-200 ease-in-out',\n ],\n {\n variants: {\n size: makeVariants<'size', ['sm', 'md']>({\n sm: ['h-sz-20', 'w-sz-20'],\n md: ['h-sz-24', 'w-sz-24'],\n }),\n checked: {\n true: '-translate-x-full',\n false: 'translate-x-0 text-on-surface/dim-4',\n },\n },\n defaultVariants: {\n size: 'sm',\n checked: false,\n },\n }\n)\n\nexport const thumbCheckSVGStyles = cva(['transition-opacity duration-200'], {\n variants: {\n size: makeVariants<'size', ['sm', 'md']>({\n sm: ['h-sz-10 w-sz-10'],\n md: ['h-sz-12 w-sz-12'],\n }),\n },\n defaultVariants: {\n size: 'sm',\n },\n})\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = cva('', {\n variants: {\n disabled: {\n true: ['text-neutral/dim-2', 'cursor-not-allowed'],\n false: ['cursor-pointer'],\n },\n },\n defaultVariants: {\n disabled: false,\n },\n})\n\nexport type LabelStylesProps = VariantProps<typeof labelStyles>\n","import { Label, LabelProps } from '../label'\nimport { labelStyles, LabelStylesProps } from './SwitchLabel.styles'\n\nexport interface SwitchLabelProps extends LabelStylesProps, LabelProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The id of the element the label is associated with.\n */\n htmlFor?: string\n /**\n * When true, prevents the user from interacting with the switch item.\n */\n disabled?: boolean\n}\n\nexport const SwitchLabel = ({ className, disabled, ...others }: SwitchLabelProps) => (\n <Label className={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AAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAAmB;AACjB,QAAM,QAAQ,oBAAoB;AAElC,QAAM,UAAU,GAAG,SAAS,UAAU,MAAM,CAAC;AAC7C,QAAM,UAAU,GAAG,SAAS,UAAU,MAAM,CAAC;AAC7C,QAAM,UAAU,MAAM,MAAM,MAAM;AAElC,QAAM,cAAc,YAClB,gBAAAD,KAAC,eAAY,UAAoB,SAAS,SAAS,IAAI,SACpD,UACH;AAGF,QAAM,cACJ,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,IAAI;AAAA,MACJ;AAAA,MAMA,mBAAiB,WAAW,UAAU,MAAM;AAAA,MAC3C,GAAG;AAAA;AAAA,EACN;AAGF,QAAM,UAAU,UACd,gBAAAC,MAAA,YACG;AAAA;AAAA,IACA;AAAA,KACH,IAEA,gBAAAA,MAAA,YACG;AAAA;AAAA,IACA;AAAA,KACH;AAGF,SACE,gBAAAD;AAAA,IAAC;AAAA;AAAA,MACC,wBAAqB;AAAA,MACrB,WAAW,GAAG,wCAAwC,SAAS;AAAA,MAE9D;AAAA;AAAA,EACH;AAEJ;AAEA,OAAO,cAAc;","names":["cva","jsx","jsx","jsxs"]}
1
+ {"version":3,"sources":["../../src/switch/Switch.tsx","../../src/switch/SwitchInput.tsx","../../src/switch/SwitchInput.styles.ts","../../src/switch/SwitchLabel.styles.ts","../../src/switch/SwitchLabel.tsx"],"sourcesContent":["import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { cx } from 'class-variance-authority'\nimport { useId } from 'react'\n\nimport { SwitchInput, SwitchInputProps } from './SwitchInput'\nimport { SwitchLabel } from './SwitchLabel'\n\nexport type SwitchProps = SwitchInputProps\n\nconst ID_PREFIX = ':switch'\n\nexport const Switch = ({\n size = 'md',\n children,\n className,\n id,\n disabled,\n reverse = false,\n ref,\n ...rest\n}: SwitchProps) => {\n const field = useFormFieldControl()\n\n const labelID = `${ID_PREFIX}-label-${useId()}`\n const innerID = `${ID_PREFIX}-input-${useId()}`\n const fieldID = field.id || id || innerID\n\n const switchLabel = children && (\n <SwitchLabel disabled={disabled} htmlFor={fieldID} id={labelID}>\n {children}\n </SwitchLabel>\n )\n\n const switchInput = (\n <SwitchInput\n ref={ref}\n size={size}\n id={fieldID}\n disabled={disabled}\n /**\n * If the switch doesn't have any direct label (children) then we should try to\n * get an eventual alternative label from FormField.\n * On last resort, we shouldn't forget to define an aria-label attribute.\n */\n aria-labelledby={children ? labelID : field.labelId}\n {...rest}\n />\n )\n\n const content = reverse ? (\n <>\n {switchLabel}\n {switchInput}\n </>\n ) : (\n <>\n {switchInput}\n {switchLabel}\n </>\n )\n\n return (\n <div\n data-spark-component=\"switch\"\n className={cx('gap-md text-body-1 flex items-center', className)}\n >\n {content}\n </div>\n )\n}\n\nSwitch.displayName = 'Switch'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { Check } from '@spark-ui/icons/Check'\nimport { Close } from '@spark-ui/icons/Close'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { Switch as RadixSwitch } from 'radix-ui'\nimport { type ComponentPropsWithRef, type ReactNode } from 'react'\n\nimport { Slot } from '../slot'\nimport {\n styles,\n type StylesProps,\n thumbCheckSVGStyles,\n thumbStyles,\n thumbWrapperStyles,\n} from './SwitchInput.styles'\n\nexport interface SwitchInputProps\n extends StylesProps,\n Omit<ComponentPropsWithRef<'button'>, 'value'> {\n /**\n * The state of the switch when it is initially rendered. Use when you do not need to control its state.\n */\n defaultChecked?: boolean\n /**\n * The controlled state of the switch. Must be used in conjunction with `onCheckedChange`.\n */\n checked?: boolean\n /**\n * When true, prevents the user from interacting with the switch.\n */\n /**\n * Event handler called when the state of the switch changes.\n */\n onCheckedChange?: (checked: boolean) => void\n /**\n * When `true`, prevents the user from interacting with the switch.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the switch before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the switch. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value given as data when submitted with a name.\n */\n value?: string\n /**\n * Icon shown inside the thumb of the Switch whenever it is checked\n */\n checkedIcon?: ReactNode\n /**\n * Icon shown inside the thumb of the Switch whenever it is unchecked\n */\n uncheckedIcon?: ReactNode\n /**\n * When true, the label will be placed on the left side of the Switch\n */\n reverse?: boolean\n}\n\nexport const SwitchInput = ({\n checked,\n checkedIcon = <Check />,\n defaultChecked,\n intent: intentProp,\n uncheckedIcon = <Close />,\n size = 'md',\n value = 'on',\n onCheckedChange,\n className,\n required,\n ref,\n ...rest\n}: SwitchInputProps) => {\n const [isChecked, setIsChecked] = useCombinedState(checked, defaultChecked)\n const { name, description, state, isRequired, isInvalid } = useFormFieldControl()\n const intent = state ?? intentProp\n\n const handleCheckedChange = (updatedValue: boolean): void => {\n setIsChecked(updatedValue)\n onCheckedChange?.(updatedValue)\n }\n\n return (\n <RadixSwitch.Root\n ref={ref}\n className={styles({ intent, size, className })}\n value={value}\n checked={checked}\n defaultChecked={defaultChecked}\n onCheckedChange={handleCheckedChange}\n name={name}\n required={required || isRequired}\n aria-invalid={isInvalid}\n aria-describedby={description}\n {...rest}\n >\n <span className={thumbWrapperStyles({ checked: isChecked })}>\n <RadixSwitch.Thumb className={thumbStyles({ size, checked: isChecked })}>\n {isChecked && checkedIcon && (\n <Slot className={thumbCheckSVGStyles({ size })}>{checkedIcon}</Slot>\n )}\n {!isChecked && uncheckedIcon && (\n <Slot className={thumbCheckSVGStyles({ size })}>{uncheckedIcon}</Slot>\n )}\n </RadixSwitch.Thumb>\n </span>\n </RadixSwitch.Root>\n )\n}\n\nSwitchInput.displayName = 'SwitchInput'\n","import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const styles = cva(\n tw([\n 'relative shrink-0 self-baseline',\n 'cursor-pointer',\n 'rounded-full border-transparent',\n 'hover:ring-4',\n 'transition-colors duration-200 ease-in-out',\n 'disabled:hover:ring-transparent disabled:cursor-not-allowed disabled:opacity-dim-3',\n 'focus-visible:u-outline',\n 'data-[state=unchecked]:bg-on-surface/dim-4',\n 'u-shadow-border-transition',\n 'overflow-x-hidden',\n ]),\n {\n variants: {\n /**\n * Size of the switch input.\n */\n size: makeVariants<'size', ['sm', 'md']>({\n sm: tw(['h-sz-24', 'w-sz-40', 'border-md']),\n md: tw(['h-sz-32', 'w-sz-56', 'border-[4px]']),\n }),\n /**\n * Color scheme of the switch input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['data-[state=checked]:bg-main', 'hover:ring-main-container', 'text-main'],\n support: [\n 'data-[state=checked]:bg-support',\n 'hover:ring-support-container',\n 'text-support',\n ],\n accent: ['data-[state=checked]:bg-accent', 'hover:ring-accent-container', 'text-accent'],\n basic: ['data-[state=checked]:bg-basic', 'hover:ring-basic-container', 'text-basic'],\n success: [\n 'data-[state=checked]:bg-success',\n 'hover:ring-success-container',\n 'text-success',\n ],\n alert: ['data-[state=checked]:bg-alert', 'hover:ring-alert-container', 'text-alert'],\n error: ['data-[state=checked]:bg-error', 'hover:ring-error-container', 'text-error'],\n info: ['data-[state=checked]:bg-info', 'hover:ring-info-container', 'text-info'],\n neutral: [\n 'data-[state=checked]:bg-neutral',\n 'hover:ring-neutral-container',\n 'text-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n size: 'sm',\n },\n }\n)\n\nexport type StylesProps = VariantProps<typeof styles>\n\nexport const thumbWrapperStyles = cva(\n [\n 'pointer-events-none absolute inset-0 flex items-center',\n 'transition-all duration-200 ease-in-out',\n ],\n {\n variants: {\n checked: {\n true: 'translate-x-full',\n false: 'translate-x-0',\n },\n },\n }\n)\n\nexport const thumbStyles = cva(\n [\n 'absolute left-0 top-0 flex items-center justify-center',\n 'bg-surface',\n 'rounded-full',\n 'ring-0',\n 'transition-all duration-200 ease-in-out',\n ],\n {\n variants: {\n size: makeVariants<'size', ['sm', 'md']>({\n sm: ['h-sz-20', 'w-sz-20'],\n md: ['h-sz-24', 'w-sz-24'],\n }),\n checked: {\n true: '-translate-x-full',\n false: 'translate-x-0 text-on-surface/dim-4',\n },\n },\n defaultVariants: {\n size: 'sm',\n checked: false,\n },\n }\n)\n\nexport const thumbCheckSVGStyles = cva(['transition-opacity duration-200'], {\n variants: {\n size: makeVariants<'size', ['sm', 'md']>({\n sm: ['h-sz-10 w-sz-10'],\n md: ['h-sz-12 w-sz-12'],\n }),\n },\n defaultVariants: {\n size: 'sm',\n },\n})\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = cva('', {\n variants: {\n disabled: {\n true: ['text-neutral/dim-2', 'cursor-not-allowed'],\n false: ['cursor-pointer'],\n },\n },\n defaultVariants: {\n disabled: false,\n },\n})\n\nexport type LabelStylesProps = VariantProps<typeof labelStyles>\n","import { Label, LabelProps } from '../label'\nimport { labelStyles, LabelStylesProps } from './SwitchLabel.styles'\n\nexport interface SwitchLabelProps extends LabelStylesProps, LabelProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The id of the element the label is associated with.\n */\n htmlFor?: string\n /**\n * When true, prevents the user from interacting with the switch item.\n */\n disabled?: boolean\n}\n\nexport const SwitchLabel = ({ className, disabled, ...others }: SwitchLabelProps) => (\n <Label className={labelStyles({ disabled, className })} {...others} />\n)\n"],"mappings":";;;;;;;;AAAA,SAAS,uBAAAA,4BAA2B;AACpC,SAAS,UAAU;AACnB,SAAS,aAAa;;;ACFtB,SAAS,2BAA2B;AACpC,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAS,UAAU,mBAAmB;;;ACJtC,SAAS,cAAc,UAAU;AACjC,SAAS,WAAyB;AAE3B,IAAM,SAAS;AAAA,EACpB,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;A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