@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.
- package/CHANGELOG.md +6 -0
- package/dist/checkbox/index.js +117 -478
- package/dist/checkbox/index.js.map +1 -1
- package/dist/checkbox/index.mjs +3 -4
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/{chunk-JC6KKYUQ.mjs → chunk-7BTJUYP3.mjs} +6 -5
- package/dist/{chunk-JC6KKYUQ.mjs.map → chunk-7BTJUYP3.mjs.map} +1 -1
- package/dist/combobox/index.js +301 -710
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs +3 -5
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/dropdown/index.js +252 -662
- package/dist/dropdown/index.js.map +1 -1
- package/dist/dropdown/index.mjs +1 -4
- package/dist/dropdown/index.mjs.map +1 -1
- package/dist/form-field/index.mjs +373 -7
- package/dist/form-field/index.mjs.map +1 -1
- package/dist/input/index.js +47 -454
- package/dist/input/index.js.map +1 -1
- package/dist/input/index.mjs +1 -3
- package/dist/radio-group/index.js +47 -553
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs +3 -9
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/select/index.js +159 -569
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +1 -4
- package/dist/select/index.mjs.map +1 -1
- package/dist/stepper/index.js +110 -516
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs +2 -5
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/switch/index.js +96 -545
- package/dist/switch/index.js.map +1 -1
- package/dist/switch/index.mjs +3 -6
- package/dist/switch/index.mjs.map +1 -1
- package/dist/textarea/index.js +58 -465
- package/dist/textarea/index.js.map +1 -1
- package/dist/textarea/index.mjs +1 -3
- package/dist/textarea/index.mjs.map +1 -1
- package/package.json +16 -6
- package/tsup.config.ts +2 -1
- package/dist/chunk-7PMPYEHJ.mjs +0 -379
- package/dist/chunk-7PMPYEHJ.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/checkbox/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/checkbox/Checkbox.tsx","../../src/checkbox/CheckboxGroupContext.tsx","../../src/checkbox/CheckboxInput.tsx","../../src/checkbox/CheckboxIndicator.tsx","../../src/checkbox/CheckboxInput.styles.ts","../../src/checkbox/CheckboxLabel.styles.ts","../../src/checkbox/CheckboxLabel.tsx","../../src/checkbox/CheckboxGroup.tsx","../../src/checkbox/CheckboxGroup.styles.ts"],"sourcesContent":["export * from './Checkbox'\nexport * from './CheckboxGroup'\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","/* eslint-disable complexity */\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Ref, useId, useMemo, useRef } from 'react'\n\nimport { CheckboxGroupContextState, useCheckboxGroup } from './CheckboxGroupContext'\nimport { CheckboxInput, CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxLabel } from './CheckboxLabel'\n\nexport type CheckboxProps = CheckboxInputProps &\n Pick<CheckboxGroupContextState, 'reverse'> & {\n ref?: Ref<HTMLButtonElement>\n }\n\nconst ID_PREFIX = ':checkbox'\n\nexport const Checkbox = ({\n id: idProp,\n className,\n intent: intentProp,\n checked: checkedProp,\n value,\n disabled,\n reverse = false,\n onCheckedChange,\n children,\n ref: forwardedRef,\n ...others\n}: CheckboxProps) => {\n const checkboxId = `${ID_PREFIX}-${useId()}`\n const innerId = idProp || checkboxId\n\n const innerLabelId = `${ID_PREFIX}-${useId()}`\n\n const field = useFormFieldControl()\n const group = useCheckboxGroup()\n\n const rootRef = useRef<HTMLButtonElement | undefined>(null)\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n const getCheckboxAttributes = ({\n fieldState,\n groupState,\n checkboxIntent,\n }: {\n fieldState: ReturnType<typeof useFormFieldControl>\n groupState: ReturnType<typeof useCheckboxGroup>\n checkboxIntent: CheckboxInputProps['intent']\n }) => {\n const name = fieldState.name ?? groupState.name\n const isRequired = fieldState.isRequired ?? groupState.isRequired\n const state = fieldState.state ?? groupState.state\n const isInvalid = fieldState.isInvalid ?? groupState.isInvalid\n\n const isFieldEnclosed = fieldState.id !== groupState.id\n const id = isFieldEnclosed ? fieldState.id : undefined\n const description = isFieldEnclosed ? fieldState.description : undefined\n\n const intent = state ?? checkboxIntent ?? groupState.intent\n\n return { name, isRequired, isInvalid, id, description, intent }\n }\n\n const checked = value ? group.value?.includes(value) : checkedProp\n\n const handleCheckedChange = (isChecked: boolean) => {\n onCheckedChange?.(isChecked)\n\n const rootRefValue = rootRef.current?.value\n if (rootRefValue && group.onCheckedChange) {\n group.onCheckedChange(isChecked, rootRefValue)\n }\n }\n\n const {\n id,\n name,\n isInvalid,\n description,\n intent,\n isRequired: isRequiredAttr,\n } = getCheckboxAttributes({\n fieldState: field,\n groupState: group,\n checkboxIntent: intentProp,\n })\n\n const isRequired = useMemo(() => {\n if (!group) return isRequiredAttr\n\n return isRequiredAttr ? !group.value?.length : false\n }, [group, isRequiredAttr])\n\n const checkboxLabel = children && (\n <CheckboxLabel disabled={disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </CheckboxLabel>\n )\n\n const checkboxInput = (\n <CheckboxInput\n ref={ref}\n id={id || innerId}\n name={name}\n value={value}\n intent={intent}\n checked={checked}\n disabled={disabled}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onCheckedChange={handleCheckedChange}\n aria-labelledby={children ? innerLabelId : field.labelId}\n {...others}\n />\n )\n\n const content =\n group.reverse || reverse ? (\n <>\n {checkboxLabel}\n {checkboxInput}\n </>\n ) : (\n <>\n {checkboxInput}\n {checkboxLabel}\n </>\n )\n\n return (\n <div\n data-spark-component=\"checkbox\"\n className={cx('gap-md text-body-1 relative flex items-start', className)}\n >\n {content}\n </div>\n )\n}\n\nCheckbox.displayName = 'Checkbox'\n","import { createContext, useContext } from 'react'\n\nimport { CheckboxInputStylesProps } from './CheckboxInput.styles'\n\nexport interface CheckboxGroupContextState extends Pick<CheckboxInputStylesProps, 'intent'> {\n /**\n * The id of the checkbox group.\n */\n id: string\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value of the checkbox group.\n */\n value?: 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 * The validation state of the checkbox group.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the checkbox group will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the checkbox group will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to update or notify the value of the checkbox group.\n */\n onCheckedChange?: (checked: boolean, changed: string) => void\n /**\n * When true, the label will be placed on the left side of the Checkbox\n */\n reverse?: boolean\n}\n\nexport const CheckboxGroupContext = createContext<Partial<CheckboxGroupContextState>>({})\n\nexport const useCheckboxGroup = () => {\n const context = useContext(CheckboxGroupContext)\n\n return context\n}\n","import { Check } from '@spark-ui/icons/Check'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Checkbox } from 'radix-ui'\nimport { ComponentPropsWithoutRef, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { CheckboxIndicator } from './CheckboxIndicator'\nimport { checkboxInputStyles, type CheckboxInputStylesProps } from './CheckboxInput.styles'\n\ntype CheckedStatus = boolean | 'indeterminate'\n\nconst CheckboxPrimitive = Checkbox.Checkbox\n\nexport interface CheckboxInputProps\n extends CheckboxInputStylesProps,\n Omit<ComponentPropsWithoutRef<'button'>, 'onChange' | 'value' | 'checked' | 'defaultChecked'> {\n /**\n * The checked icon to use.\n */\n icon?: ReactNode\n /**\n * The indeterminate icon to use.\n */\n indeterminateIcon?: ReactNode\n /**\n * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n */\n defaultChecked?: boolean\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n */\n checked?: CheckedStatus\n /**\n * When true, prevents the user from interacting with the checkbox.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the checkbox before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the checkbox. 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 * Event handler called when the checked state of the checkbox changes.\n */\n onCheckedChange?: (checked: boolean) => void\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const CheckboxInput = ({\n className,\n icon = <Check />,\n indeterminateIcon = <Minus />,\n intent,\n checked,\n ref,\n ...others\n}: CheckboxInputProps) => (\n <CheckboxPrimitive\n ref={ref}\n className={checkboxInputStyles({ intent, className })}\n checked={checked}\n {...others}\n >\n <CheckboxIndicator>\n <Icon size=\"sm\">{checked === 'indeterminate' ? indeterminateIcon : icon}</Icon>\n </CheckboxIndicator>\n </CheckboxPrimitive>\n)\n\nCheckboxInput.displayName = 'CheckboxInput'\n","import { Checkbox } from 'radix-ui'\nimport { Ref } from 'react'\n\nconst CheckboxIndicatorPrimitive = Checkbox.CheckboxIndicator\n\nexport type CheckboxIndicatorProps = Checkbox.CheckboxIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const CheckboxIndicator = (props: CheckboxIndicatorProps) => (\n <CheckboxIndicatorPrimitive className=\"flex size-full items-center justify-center\" {...props} />\n)\n\nCheckboxIndicator.displayName = 'CheckboxIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxInputStyles = cva(\n [\n 'size-sz-24 shrink-0 items-center justify-center rounded-sm border-md bg-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3 disabled:hover:ring-0',\n 'focus-visible:u-outline',\n 'hover:ring-4 hover:cursor-pointer',\n 'u-shadow-border-transition',\n ],\n {\n variants: {\n /**\n * Color scheme of the checkbox.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: [\n 'text-on-main',\n 'hover:ring-main-container',\n // data-[ok=cool]:bg-main\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-main data-[state=indeterminate]:bg-main',\n 'data-[state=checked]:border-main data-[state=checked]:bg-main',\n ],\n support: [\n 'text-on-support',\n 'hover:ring-support-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-support data-[state=indeterminate]:bg-support',\n 'data-[state=checked]:border-support data-[state=checked]:bg-support',\n ],\n accent: [\n 'text-on-accent',\n 'hover:ring-accent-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-accent data-[state=indeterminate]:bg-accent',\n 'data-[state=checked]:border-accent data-[state=checked]:bg-accent',\n ],\n basic: [\n 'text-on-basic',\n 'hover:ring-basic-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-basic data-[state=indeterminate]:bg-basic',\n 'data-[state=checked]:border-basic data-[state=checked]:bg-basic',\n ],\n success: [\n 'text-on-success',\n 'hover:ring-success-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-success data-[state=indeterminate]:bg-success',\n 'data-[state=checked]:border-success data-[state=checked]:bg-success',\n ],\n alert: [\n 'text-on-alert',\n 'hover:ring-alert-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-alert data-[state=indeterminate]:bg-alert',\n 'data-[state=checked]:border-alert data-[state=checked]:bg-alert',\n ],\n error: [\n 'text-on-error',\n 'hover:ring-error-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-error data-[state=indeterminate]:bg-error',\n 'data-[state=checked]:border-error data-[state=checked]:bg-error',\n ],\n info: [\n 'text-on-info',\n 'hover:ring-info-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-info data-[state=indeterminate]:bg-info',\n 'data-[state=checked]:border-info data-[state=checked]:bg-info',\n ],\n neutral: [\n 'text-on-neutral',\n 'hover:ring-neutral-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-neutral data-[state=indeterminate]:bg-neutral',\n 'data-[state=checked]:border-neutral data-[state=checked]:bg-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n },\n }\n)\n\nexport type CheckboxInputStylesProps = VariantProps<typeof checkboxInputStyles>\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = cva('grow', {\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, type LabelStylesProps } from './CheckboxLabel.styles'\n\nexport interface CheckboxLabelProps extends LabelProps, LabelStylesProps {\n /**\n * When true, prevents the user from interacting with the checkbox item.\n */\n disabled?: boolean\n}\n\nexport const CheckboxLabel = ({ disabled, ...others }: CheckboxLabelProps) => (\n <Label className={labelStyles({ disabled })} {...others} />\n)\n\nCheckboxLabel.displayName = 'CheckboxLabel'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useMemo, useRef } from 'react'\n\nimport { checkboxGroupStyles, CheckboxGroupStylesProps } from './CheckboxGroup.styles'\nimport { CheckboxGroupContext, CheckboxGroupContextState } from './CheckboxGroupContext'\n\nexport interface CheckboxGroupProps\n extends Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue' | 'onChange'>,\n CheckboxGroupStylesProps,\n Pick<CheckboxGroupContextState, 'intent' | 'name' | 'value' | 'reverse'> {\n /**\n * The initial value of the checkbox group\n */\n defaultValue?: string[]\n /**\n * The callback fired when any children Checkbox is checked or unchecked\n */\n onCheckedChange?: (value: string[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const CheckboxGroup = ({\n name: nameProp,\n value: valueProp,\n defaultValue,\n className,\n intent,\n orientation = 'vertical',\n onCheckedChange: onCheckedChangeProp,\n reverse = false,\n children,\n ref,\n ...others\n}: CheckboxGroupProps) => {\n const [value, setValue] = useCombinedState(valueProp, defaultValue)\n const field = useFormFieldControl()\n const onCheckedChangeRef = useRef(onCheckedChangeProp)\n\n const { id, labelId, description, state, isInvalid, isRequired } = field\n const name = nameProp ?? field.name\n\n const current = useMemo(() => {\n const handleCheckedChange = (checked: boolean, changed: string) => {\n const values = value || []\n const modified = checked ? [...values, changed] : values.filter(val => val !== changed)\n\n setValue(modified)\n\n if (onCheckedChangeRef.current) {\n onCheckedChangeRef.current(modified)\n }\n }\n\n return {\n id,\n name,\n value,\n intent,\n state,\n isInvalid,\n description,\n isRequired,\n reverse,\n onCheckedChange: handleCheckedChange,\n }\n }, [id, name, value, intent, state, isInvalid, description, isRequired, setValue, reverse])\n\n useEffect(() => {\n onCheckedChangeRef.current = onCheckedChangeProp\n }, [onCheckedChangeProp])\n\n return (\n <CheckboxGroupContext.Provider value={current}>\n <div\n ref={ref}\n className={checkboxGroupStyles({ className, orientation })}\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={description}\n {...others}\n >\n {children}\n </div>\n </CheckboxGroupContext.Provider>\n )\n}\n\nCheckboxGroup.displayName = 'CheckboxGroup'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxGroupStyles = cva(['flex'], {\n variants: {\n /**\n * Prop to set the orientation of the checkbox group which could be `vertical` or `horizontal`.\n */\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['gap-xl'],\n },\n },\n})\n\nexport type CheckboxGroupStylesProps = VariantProps<typeof checkboxGroupStyles>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,kBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,sCAAmB;AACnB,IAAAC,gBAAqD;;;ACDrD,sBAAkC;AAClC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AAAA,MACzD,MAAK;AAAA,MACL,mBAAiB;AAAA,MACjB,oBAAkB;AAAA,MACjB,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,cAAc,cAAc;","names":["Checkbox","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_react","import_Check","import_radix_ui","import_radix_ui","import_jsx_runtime","import_internal_utils","import_class_variance_authority","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","Label","import_jsx_runtime","ID_PREFIX","Checkbox","name","isRequired","isInvalid","id","description","intent","import_react","import_class_variance_authority","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../src/checkbox/index.ts","../../src/checkbox/Checkbox.tsx","../../src/checkbox/CheckboxGroupContext.tsx","../../src/checkbox/CheckboxInput.tsx","../../src/icon/Icon.tsx","../../src/slot/Slot.tsx","../../src/visually-hidden/VisuallyHidden.tsx","../../src/icon/Icon.styles.tsx","../../src/checkbox/CheckboxIndicator.tsx","../../src/checkbox/CheckboxInput.styles.ts","../../src/label/Label.tsx","../../src/label/LabelRequiredIndicator.tsx","../../src/label/index.ts","../../src/checkbox/CheckboxLabel.styles.ts","../../src/checkbox/CheckboxLabel.tsx","../../src/checkbox/CheckboxGroup.tsx","../../src/checkbox/CheckboxGroup.styles.ts"],"sourcesContent":["export * from './Checkbox'\nexport * from './CheckboxGroup'\n","/* eslint-disable complexity */\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Ref, useId, useMemo, useRef } from 'react'\n\nimport { CheckboxGroupContextState, useCheckboxGroup } from './CheckboxGroupContext'\nimport { CheckboxInput, CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxLabel } from './CheckboxLabel'\n\nexport type CheckboxProps = CheckboxInputProps &\n Pick<CheckboxGroupContextState, 'reverse'> & {\n ref?: Ref<HTMLButtonElement>\n }\n\nconst ID_PREFIX = ':checkbox'\n\nexport const Checkbox = ({\n id: idProp,\n className,\n intent: intentProp,\n checked: checkedProp,\n value,\n disabled,\n reverse = false,\n onCheckedChange,\n children,\n ref: forwardedRef,\n ...others\n}: CheckboxProps) => {\n const checkboxId = `${ID_PREFIX}-${useId()}`\n const innerId = idProp || checkboxId\n\n const innerLabelId = `${ID_PREFIX}-${useId()}`\n\n const field = useFormFieldControl()\n const group = useCheckboxGroup()\n\n const rootRef = useRef<HTMLButtonElement | undefined>(null)\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n const getCheckboxAttributes = ({\n fieldState,\n groupState,\n checkboxIntent,\n }: {\n fieldState: ReturnType<typeof useFormFieldControl>\n groupState: ReturnType<typeof useCheckboxGroup>\n checkboxIntent: CheckboxInputProps['intent']\n }) => {\n const name = fieldState.name ?? groupState.name\n const isRequired = fieldState.isRequired ?? groupState.isRequired\n const state = fieldState.state ?? groupState.state\n const isInvalid = fieldState.isInvalid ?? groupState.isInvalid\n\n const isFieldEnclosed = fieldState.id !== groupState.id\n const id = isFieldEnclosed ? fieldState.id : undefined\n const description = isFieldEnclosed ? fieldState.description : undefined\n\n const intent = state ?? checkboxIntent ?? groupState.intent\n\n return { name, isRequired, isInvalid, id, description, intent }\n }\n\n const checked = value ? group.value?.includes(value) : checkedProp\n\n const handleCheckedChange = (isChecked: boolean) => {\n onCheckedChange?.(isChecked)\n\n const rootRefValue = rootRef.current?.value\n if (rootRefValue && group.onCheckedChange) {\n group.onCheckedChange(isChecked, rootRefValue)\n }\n }\n\n const {\n id,\n name,\n isInvalid,\n description,\n intent,\n isRequired: isRequiredAttr,\n } = getCheckboxAttributes({\n fieldState: field,\n groupState: group,\n checkboxIntent: intentProp,\n })\n\n const isRequired = useMemo(() => {\n if (!group) return isRequiredAttr\n\n return isRequiredAttr ? !group.value?.length : false\n }, [group, isRequiredAttr])\n\n const checkboxLabel = children && (\n <CheckboxLabel disabled={disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </CheckboxLabel>\n )\n\n const checkboxInput = (\n <CheckboxInput\n ref={ref}\n id={id || innerId}\n name={name}\n value={value}\n intent={intent}\n checked={checked}\n disabled={disabled}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onCheckedChange={handleCheckedChange}\n aria-labelledby={children ? innerLabelId : field.labelId}\n {...others}\n />\n )\n\n const content =\n group.reverse || reverse ? (\n <>\n {checkboxLabel}\n {checkboxInput}\n </>\n ) : (\n <>\n {checkboxInput}\n {checkboxLabel}\n </>\n )\n\n return (\n <div\n data-spark-component=\"checkbox\"\n className={cx('gap-md text-body-1 relative flex items-start', className)}\n >\n {content}\n </div>\n )\n}\n\nCheckbox.displayName = 'Checkbox'\n","import { createContext, useContext } from 'react'\n\nimport { CheckboxInputStylesProps } from './CheckboxInput.styles'\n\nexport interface CheckboxGroupContextState extends Pick<CheckboxInputStylesProps, 'intent'> {\n /**\n * The id of the checkbox group.\n */\n id: string\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value of the checkbox group.\n */\n value?: 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 * The validation state of the checkbox group.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the checkbox group will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the checkbox group will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to update or notify the value of the checkbox group.\n */\n onCheckedChange?: (checked: boolean, changed: string) => void\n /**\n * When true, the label will be placed on the left side of the Checkbox\n */\n reverse?: boolean\n}\n\nexport const CheckboxGroupContext = createContext<Partial<CheckboxGroupContextState>>({})\n\nexport const useCheckboxGroup = () => {\n const context = useContext(CheckboxGroupContext)\n\n return context\n}\n","import { Check } from '@spark-ui/icons/Check'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Checkbox } from 'radix-ui'\nimport { ComponentPropsWithoutRef, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { CheckboxIndicator } from './CheckboxIndicator'\nimport { checkboxInputStyles, type CheckboxInputStylesProps } from './CheckboxInput.styles'\n\ntype CheckedStatus = boolean | 'indeterminate'\n\nconst CheckboxPrimitive = Checkbox.Checkbox\n\nexport interface CheckboxInputProps\n extends CheckboxInputStylesProps,\n Omit<ComponentPropsWithoutRef<'button'>, 'onChange' | 'value' | 'checked' | 'defaultChecked'> {\n /**\n * The checked icon to use.\n */\n icon?: ReactNode\n /**\n * The indeterminate icon to use.\n */\n indeterminateIcon?: ReactNode\n /**\n * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n */\n defaultChecked?: boolean\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n */\n checked?: CheckedStatus\n /**\n * When true, prevents the user from interacting with the checkbox.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the checkbox before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the checkbox. 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 * Event handler called when the checked state of the checkbox changes.\n */\n onCheckedChange?: (checked: boolean) => void\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const CheckboxInput = ({\n className,\n icon = <Check />,\n indeterminateIcon = <Minus />,\n intent,\n checked,\n ref,\n ...others\n}: CheckboxInputProps) => (\n <CheckboxPrimitive\n ref={ref}\n className={checkboxInputStyles({ intent, className })}\n checked={checked}\n {...others}\n >\n <CheckboxIndicator>\n <Icon size=\"sm\">{checked === 'indeterminate' ? indeterminateIcon : icon}</Icon>\n </CheckboxIndicator>\n </CheckboxPrimitive>\n)\n\nCheckboxInput.displayName = 'CheckboxInput'\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 { 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 { 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 { Checkbox } from 'radix-ui'\nimport { Ref } from 'react'\n\nconst CheckboxIndicatorPrimitive = Checkbox.CheckboxIndicator\n\nexport type CheckboxIndicatorProps = Checkbox.CheckboxIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const CheckboxIndicator = (props: CheckboxIndicatorProps) => (\n <CheckboxIndicatorPrimitive className=\"flex size-full items-center justify-center\" {...props} />\n)\n\nCheckboxIndicator.displayName = 'CheckboxIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxInputStyles = cva(\n [\n 'size-sz-24 shrink-0 items-center justify-center rounded-sm border-md bg-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3 disabled:hover:ring-0',\n 'focus-visible:u-outline',\n 'hover:ring-4 hover:cursor-pointer',\n 'u-shadow-border-transition',\n ],\n {\n variants: {\n /**\n * Color scheme of the checkbox.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: [\n 'text-on-main',\n 'hover:ring-main-container',\n // data-[ok=cool]:bg-main\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-main data-[state=indeterminate]:bg-main',\n 'data-[state=checked]:border-main data-[state=checked]:bg-main',\n ],\n support: [\n 'text-on-support',\n 'hover:ring-support-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-support data-[state=indeterminate]:bg-support',\n 'data-[state=checked]:border-support data-[state=checked]:bg-support',\n ],\n accent: [\n 'text-on-accent',\n 'hover:ring-accent-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-accent data-[state=indeterminate]:bg-accent',\n 'data-[state=checked]:border-accent data-[state=checked]:bg-accent',\n ],\n basic: [\n 'text-on-basic',\n 'hover:ring-basic-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-basic data-[state=indeterminate]:bg-basic',\n 'data-[state=checked]:border-basic data-[state=checked]:bg-basic',\n ],\n success: [\n 'text-on-success',\n 'hover:ring-success-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-success data-[state=indeterminate]:bg-success',\n 'data-[state=checked]:border-success data-[state=checked]:bg-success',\n ],\n alert: [\n 'text-on-alert',\n 'hover:ring-alert-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-alert data-[state=indeterminate]:bg-alert',\n 'data-[state=checked]:border-alert data-[state=checked]:bg-alert',\n ],\n error: [\n 'text-on-error',\n 'hover:ring-error-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-error data-[state=indeterminate]:bg-error',\n 'data-[state=checked]:border-error data-[state=checked]:bg-error',\n ],\n info: [\n 'text-on-info',\n 'hover:ring-info-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-info data-[state=indeterminate]:bg-info',\n 'data-[state=checked]:border-info data-[state=checked]:bg-info',\n ],\n neutral: [\n 'text-on-neutral',\n 'hover:ring-neutral-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-neutral data-[state=indeterminate]:bg-neutral',\n 'data-[state=checked]:border-neutral data-[state=checked]:bg-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n },\n }\n)\n\nexport type CheckboxInputStylesProps = VariantProps<typeof checkboxInputStyles>\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('grow', {\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, type LabelStylesProps } from './CheckboxLabel.styles'\n\nexport interface CheckboxLabelProps extends LabelProps, LabelStylesProps {\n /**\n * When true, prevents the user from interacting with the checkbox item.\n */\n disabled?: boolean\n}\n\nexport const CheckboxLabel = ({ disabled, ...others }: CheckboxLabelProps) => (\n <Label className={labelStyles({ disabled })} {...others} />\n)\n\nCheckboxLabel.displayName = 'CheckboxLabel'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useMemo, useRef } from 'react'\n\nimport { checkboxGroupStyles, CheckboxGroupStylesProps } from './CheckboxGroup.styles'\nimport { CheckboxGroupContext, CheckboxGroupContextState } from './CheckboxGroupContext'\n\nexport interface CheckboxGroupProps\n extends Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue' | 'onChange'>,\n CheckboxGroupStylesProps,\n Pick<CheckboxGroupContextState, 'intent' | 'name' | 'value' | 'reverse'> {\n /**\n * The initial value of the checkbox group\n */\n defaultValue?: string[]\n /**\n * The callback fired when any children Checkbox is checked or unchecked\n */\n onCheckedChange?: (value: string[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const CheckboxGroup = ({\n name: nameProp,\n value: valueProp,\n defaultValue,\n className,\n intent,\n orientation = 'vertical',\n onCheckedChange: onCheckedChangeProp,\n reverse = false,\n children,\n ref,\n ...others\n}: CheckboxGroupProps) => {\n const [value, setValue] = useCombinedState(valueProp, defaultValue)\n const field = useFormFieldControl()\n const onCheckedChangeRef = useRef(onCheckedChangeProp)\n\n const { id, labelId, description, state, isInvalid, isRequired } = field\n const name = nameProp ?? field.name\n\n const current = useMemo(() => {\n const handleCheckedChange = (checked: boolean, changed: string) => {\n const values = value || []\n const modified = checked ? [...values, changed] : values.filter(val => val !== changed)\n\n setValue(modified)\n\n if (onCheckedChangeRef.current) {\n onCheckedChangeRef.current(modified)\n }\n }\n\n return {\n id,\n name,\n value,\n intent,\n state,\n isInvalid,\n description,\n isRequired,\n reverse,\n onCheckedChange: handleCheckedChange,\n }\n }, [id, name, value, intent, state, isInvalid, description, isRequired, setValue, reverse])\n\n useEffect(() => {\n onCheckedChangeRef.current = onCheckedChangeProp\n }, [onCheckedChangeProp])\n\n return (\n <CheckboxGroupContext.Provider value={current}>\n <div\n ref={ref}\n className={checkboxGroupStyles({ className, orientation })}\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={description}\n {...others}\n >\n {children}\n </div>\n </CheckboxGroupContext.Provider>\n )\n}\n\nCheckboxGroup.displayName = 'CheckboxGroup'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxGroupStyles = cva(['flex'], {\n variants: {\n /**\n * Prop to set the orientation of the checkbox group which could be `vertical` or `horizontal`.\n */\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['gap-xl'],\n },\n },\n})\n\nexport type CheckboxGroupStylesProps = VariantProps<typeof checkboxGroupStyles>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,kBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACCA,wBAAoC;AACpC,4BAA6B;AAC7B,IAAAC,mCAAmB;AACnB,IAAAC,gBAA4C;;;ACJ5C,mBAA0C;AA2CnC,IAAM,2BAAuB,4BAAkD,CAAC,CAAC;AAEjF,IAAM,mBAAmB,MAAM;AACpC,QAAM,cAAU,yBAAW,oBAAoB;AAE/C,SAAO;AACT;;;ACjDA,mBAAsB;AACtB,mBAAsB;AACtB,IAAAC,mBAAyB;;;ACFzB,IAAAC,gBAA0F;;;ACA1F,sBAAkC;AAClC,IAAAC,gBAOO;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;;;ACFI,IAAAC,sBAAA;AAJG,IAAM,iBAAiB,CAAC,EAAE,UAAU,OAAO,KAAK,GAAG,MAAM,MAA2B;AACzF,QAAM,YAAY,UAAU,OAAO;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,OAAO;AAAA;AAAA,QAEL,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,GAAG,MAAM;AAAA,MACX;AAAA;AAAA,EACF;AAEJ;AAEA,eAAe,cAAc;;;ACrC7B,4BAA6B;AAC7B,sCAAkC;AAE3B,IA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WAAW,aAAa,YAAY,UAAU,OAAO,CAAC;AAE1F,+BAAU,MAAM;AACd,uBAAmB,UAAU;AAAA,EAC/B,GAAG,CAAC,mBAAmB,CAAC;AAExB,SACE,8CAAC,qBAAqB,UAArB,EAA8B,OAAO,SACpC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,oBAAoB,EAAE,WAAW,YAAY,CAAC;AAAA,MACzD,MAAK;AAAA,MACL,mBAAiB;AAAA,MACjB,oBAAkB;AAAA,MACjB,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,cAAc,cAAc;","names":["Checkbox","import_class_variance_authority","import_react","import_radix_ui","import_react","import_react","RadixSlot","import_jsx_runtime","import_jsx_runtime","import_radix_ui","import_jsx_runtime","import_internal_utils","import_class_variance_authority","import_jsx_runtime","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","Checkbox","name","isRequired","isInvalid","id","description","intent","import_form_field","import_react","import_class_variance_authority","import_jsx_runtime"]}
|
package/dist/checkbox/index.mjs
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useFormFieldControl
|
|
3
|
-
} from "../chunk-7PMPYEHJ.mjs";
|
|
4
1
|
import {
|
|
5
2
|
Label
|
|
6
3
|
} from "../chunk-HLXYG643.mjs";
|
|
@@ -11,6 +8,7 @@ import "../chunk-NBZKMCHF.mjs";
|
|
|
11
8
|
import "../chunk-4F5DOL57.mjs";
|
|
12
9
|
|
|
13
10
|
// src/checkbox/Checkbox.tsx
|
|
11
|
+
import { useFormFieldControl } from "@spark-ui/components/form-field";
|
|
14
12
|
import { useMergeRefs } from "@spark-ui/use-merge-refs";
|
|
15
13
|
import { cx } from "class-variance-authority";
|
|
16
14
|
import { useId, useMemo, useRef } from "react";
|
|
@@ -266,6 +264,7 @@ var Checkbox3 = ({
|
|
|
266
264
|
Checkbox3.displayName = "Checkbox";
|
|
267
265
|
|
|
268
266
|
// src/checkbox/CheckboxGroup.tsx
|
|
267
|
+
import { useFormFieldControl as useFormFieldControl2 } from "@spark-ui/components/form-field";
|
|
269
268
|
import { useCombinedState } from "@spark-ui/use-combined-state";
|
|
270
269
|
import { useEffect, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
271
270
|
|
|
@@ -299,7 +298,7 @@ var CheckboxGroup = ({
|
|
|
299
298
|
...others
|
|
300
299
|
}) => {
|
|
301
300
|
const [value, setValue] = useCombinedState(valueProp, defaultValue);
|
|
302
|
-
const field =
|
|
301
|
+
const field = useFormFieldControl2();
|
|
303
302
|
const onCheckedChangeRef = useRef2(onCheckedChangeProp);
|
|
304
303
|
const { id, labelId, description, state, isInvalid, isRequired } = field;
|
|
305
304
|
const name = nameProp ?? field.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/checkbox/Checkbox.tsx","../../src/checkbox/CheckboxGroupContext.tsx","../../src/checkbox/CheckboxInput.tsx","../../src/checkbox/CheckboxIndicator.tsx","../../src/checkbox/CheckboxInput.styles.ts","../../src/checkbox/CheckboxLabel.styles.ts","../../src/checkbox/CheckboxLabel.tsx","../../src/checkbox/CheckboxGroup.tsx","../../src/checkbox/CheckboxGroup.styles.ts"],"sourcesContent":["/* eslint-disable complexity */\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Ref, useId, useMemo, useRef } from 'react'\n\nimport { CheckboxGroupContextState, useCheckboxGroup } from './CheckboxGroupContext'\nimport { CheckboxInput, CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxLabel } from './CheckboxLabel'\n\nexport type CheckboxProps = CheckboxInputProps &\n Pick<CheckboxGroupContextState, 'reverse'> & {\n ref?: Ref<HTMLButtonElement>\n }\n\nconst ID_PREFIX = ':checkbox'\n\nexport const Checkbox = ({\n id: idProp,\n className,\n intent: intentProp,\n checked: checkedProp,\n value,\n disabled,\n reverse = false,\n onCheckedChange,\n children,\n ref: forwardedRef,\n ...others\n}: CheckboxProps) => {\n const checkboxId = `${ID_PREFIX}-${useId()}`\n const innerId = idProp || checkboxId\n\n const innerLabelId = `${ID_PREFIX}-${useId()}`\n\n const field = useFormFieldControl()\n const group = useCheckboxGroup()\n\n const rootRef = useRef<HTMLButtonElement | undefined>(null)\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n const getCheckboxAttributes = ({\n fieldState,\n groupState,\n checkboxIntent,\n }: {\n fieldState: ReturnType<typeof useFormFieldControl>\n groupState: ReturnType<typeof useCheckboxGroup>\n checkboxIntent: CheckboxInputProps['intent']\n }) => {\n const name = fieldState.name ?? groupState.name\n const isRequired = fieldState.isRequired ?? groupState.isRequired\n const state = fieldState.state ?? groupState.state\n const isInvalid = fieldState.isInvalid ?? groupState.isInvalid\n\n const isFieldEnclosed = fieldState.id !== groupState.id\n const id = isFieldEnclosed ? fieldState.id : undefined\n const description = isFieldEnclosed ? fieldState.description : undefined\n\n const intent = state ?? checkboxIntent ?? groupState.intent\n\n return { name, isRequired, isInvalid, id, description, intent }\n }\n\n const checked = value ? group.value?.includes(value) : checkedProp\n\n const handleCheckedChange = (isChecked: boolean) => {\n onCheckedChange?.(isChecked)\n\n const rootRefValue = rootRef.current?.value\n if (rootRefValue && group.onCheckedChange) {\n group.onCheckedChange(isChecked, rootRefValue)\n }\n }\n\n const {\n id,\n name,\n isInvalid,\n description,\n intent,\n isRequired: isRequiredAttr,\n } = getCheckboxAttributes({\n fieldState: field,\n groupState: group,\n checkboxIntent: intentProp,\n })\n\n const isRequired = useMemo(() => {\n if (!group) return isRequiredAttr\n\n return isRequiredAttr ? !group.value?.length : false\n }, [group, isRequiredAttr])\n\n const checkboxLabel = children && (\n <CheckboxLabel disabled={disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </CheckboxLabel>\n )\n\n const checkboxInput = (\n <CheckboxInput\n ref={ref}\n id={id || innerId}\n name={name}\n value={value}\n intent={intent}\n checked={checked}\n disabled={disabled}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onCheckedChange={handleCheckedChange}\n aria-labelledby={children ? innerLabelId : field.labelId}\n {...others}\n />\n )\n\n const content =\n group.reverse || reverse ? (\n <>\n {checkboxLabel}\n {checkboxInput}\n </>\n ) : (\n <>\n {checkboxInput}\n {checkboxLabel}\n </>\n )\n\n return (\n <div\n data-spark-component=\"checkbox\"\n className={cx('gap-md text-body-1 relative flex items-start', className)}\n >\n {content}\n </div>\n )\n}\n\nCheckbox.displayName = 'Checkbox'\n","import { createContext, useContext } from 'react'\n\nimport { CheckboxInputStylesProps } from './CheckboxInput.styles'\n\nexport interface CheckboxGroupContextState extends Pick<CheckboxInputStylesProps, 'intent'> {\n /**\n * The id of the checkbox group.\n */\n id: string\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value of the checkbox group.\n */\n value?: 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 * The validation state of the checkbox group.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the checkbox group will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the checkbox group will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to update or notify the value of the checkbox group.\n */\n onCheckedChange?: (checked: boolean, changed: string) => void\n /**\n * When true, the label will be placed on the left side of the Checkbox\n */\n reverse?: boolean\n}\n\nexport const CheckboxGroupContext = createContext<Partial<CheckboxGroupContextState>>({})\n\nexport const useCheckboxGroup = () => {\n const context = useContext(CheckboxGroupContext)\n\n return context\n}\n","import { Check } from '@spark-ui/icons/Check'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Checkbox } from 'radix-ui'\nimport { ComponentPropsWithoutRef, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { CheckboxIndicator } from './CheckboxIndicator'\nimport { checkboxInputStyles, type CheckboxInputStylesProps } from './CheckboxInput.styles'\n\ntype CheckedStatus = boolean | 'indeterminate'\n\nconst CheckboxPrimitive = Checkbox.Checkbox\n\nexport interface CheckboxInputProps\n extends CheckboxInputStylesProps,\n Omit<ComponentPropsWithoutRef<'button'>, 'onChange' | 'value' | 'checked' | 'defaultChecked'> {\n /**\n * The checked icon to use.\n */\n icon?: ReactNode\n /**\n * The indeterminate icon to use.\n */\n indeterminateIcon?: ReactNode\n /**\n * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n */\n defaultChecked?: boolean\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n */\n checked?: CheckedStatus\n /**\n * When true, prevents the user from interacting with the checkbox.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the checkbox before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the checkbox. 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 * Event handler called when the checked state of the checkbox changes.\n */\n onCheckedChange?: (checked: boolean) => void\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const CheckboxInput = ({\n className,\n icon = <Check />,\n indeterminateIcon = <Minus />,\n intent,\n checked,\n ref,\n ...others\n}: CheckboxInputProps) => (\n <CheckboxPrimitive\n ref={ref}\n className={checkboxInputStyles({ intent, className })}\n checked={checked}\n {...others}\n >\n <CheckboxIndicator>\n <Icon size=\"sm\">{checked === 'indeterminate' ? indeterminateIcon : icon}</Icon>\n </CheckboxIndicator>\n </CheckboxPrimitive>\n)\n\nCheckboxInput.displayName = 'CheckboxInput'\n","import { Checkbox } from 'radix-ui'\nimport { Ref } from 'react'\n\nconst CheckboxIndicatorPrimitive = Checkbox.CheckboxIndicator\n\nexport type CheckboxIndicatorProps = Checkbox.CheckboxIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const CheckboxIndicator = (props: CheckboxIndicatorProps) => (\n <CheckboxIndicatorPrimitive className=\"flex size-full items-center justify-center\" {...props} />\n)\n\nCheckboxIndicator.displayName = 'CheckboxIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxInputStyles = cva(\n [\n 'size-sz-24 shrink-0 items-center justify-center rounded-sm border-md bg-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3 disabled:hover:ring-0',\n 'focus-visible:u-outline',\n 'hover:ring-4 hover:cursor-pointer',\n 'u-shadow-border-transition',\n ],\n {\n variants: {\n /**\n * Color scheme of the checkbox.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: [\n 'text-on-main',\n 'hover:ring-main-container',\n // data-[ok=cool]:bg-main\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-main data-[state=indeterminate]:bg-main',\n 'data-[state=checked]:border-main data-[state=checked]:bg-main',\n ],\n support: [\n 'text-on-support',\n 'hover:ring-support-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-support data-[state=indeterminate]:bg-support',\n 'data-[state=checked]:border-support data-[state=checked]:bg-support',\n ],\n accent: [\n 'text-on-accent',\n 'hover:ring-accent-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-accent data-[state=indeterminate]:bg-accent',\n 'data-[state=checked]:border-accent data-[state=checked]:bg-accent',\n ],\n basic: [\n 'text-on-basic',\n 'hover:ring-basic-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-basic data-[state=indeterminate]:bg-basic',\n 'data-[state=checked]:border-basic data-[state=checked]:bg-basic',\n ],\n success: [\n 'text-on-success',\n 'hover:ring-success-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-success data-[state=indeterminate]:bg-success',\n 'data-[state=checked]:border-success data-[state=checked]:bg-success',\n ],\n alert: [\n 'text-on-alert',\n 'hover:ring-alert-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-alert data-[state=indeterminate]:bg-alert',\n 'data-[state=checked]:border-alert data-[state=checked]:bg-alert',\n ],\n error: [\n 'text-on-error',\n 'hover:ring-error-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-error data-[state=indeterminate]:bg-error',\n 'data-[state=checked]:border-error data-[state=checked]:bg-error',\n ],\n info: [\n 'text-on-info',\n 'hover:ring-info-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-info data-[state=indeterminate]:bg-info',\n 'data-[state=checked]:border-info data-[state=checked]:bg-info',\n ],\n neutral: [\n 'text-on-neutral',\n 'hover:ring-neutral-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-neutral data-[state=indeterminate]:bg-neutral',\n 'data-[state=checked]:border-neutral data-[state=checked]:bg-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n },\n }\n)\n\nexport type CheckboxInputStylesProps = VariantProps<typeof checkboxInputStyles>\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = cva('grow', {\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, type LabelStylesProps } from './CheckboxLabel.styles'\n\nexport interface CheckboxLabelProps extends LabelProps, LabelStylesProps {\n /**\n * When true, prevents the user from interacting with the checkbox item.\n */\n disabled?: boolean\n}\n\nexport const CheckboxLabel = ({ disabled, ...others }: CheckboxLabelProps) => (\n <Label className={labelStyles({ disabled })} {...others} />\n)\n\nCheckboxLabel.displayName = 'CheckboxLabel'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useMemo, useRef } from 'react'\n\nimport { checkboxGroupStyles, CheckboxGroupStylesProps } from './CheckboxGroup.styles'\nimport { CheckboxGroupContext, CheckboxGroupContextState } from './CheckboxGroupContext'\n\nexport interface CheckboxGroupProps\n extends Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue' | 'onChange'>,\n CheckboxGroupStylesProps,\n Pick<CheckboxGroupContextState, 'intent' | 'name' | 'value' | 'reverse'> {\n /**\n * The initial value of the checkbox group\n */\n defaultValue?: string[]\n /**\n * The callback fired when any children Checkbox is checked or unchecked\n */\n onCheckedChange?: (value: string[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const CheckboxGroup = ({\n name: nameProp,\n value: valueProp,\n defaultValue,\n className,\n intent,\n orientation = 'vertical',\n onCheckedChange: onCheckedChangeProp,\n reverse = false,\n children,\n ref,\n ...others\n}: CheckboxGroupProps) => {\n const [value, setValue] = useCombinedState(valueProp, defaultValue)\n const field = useFormFieldControl()\n const onCheckedChangeRef = useRef(onCheckedChangeProp)\n\n const { id, labelId, description, state, isInvalid, isRequired } = field\n const name = nameProp ?? field.name\n\n const current = useMemo(() => {\n const handleCheckedChange = (checked: boolean, changed: string) => {\n const values = value || []\n const modified = checked ? [...values, changed] : values.filter(val => val !== changed)\n\n setValue(modified)\n\n if (onCheckedChangeRef.current) {\n onCheckedChangeRef.current(modified)\n }\n }\n\n return {\n id,\n name,\n value,\n intent,\n state,\n isInvalid,\n description,\n isRequired,\n reverse,\n onCheckedChange: handleCheckedChange,\n }\n }, [id, name, value, intent, state, isInvalid, description, isRequired, setValue, reverse])\n\n useEffect(() => {\n onCheckedChangeRef.current = onCheckedChangeProp\n }, [onCheckedChangeProp])\n\n return (\n <CheckboxGroupContext.Provider value={current}>\n <div\n ref={ref}\n className={checkboxGroupStyles({ className, orientation })}\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={description}\n {...others}\n >\n {children}\n </div>\n </CheckboxGroupContext.Provider>\n )\n}\n\nCheckboxGroup.displayName = 'CheckboxGroup'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxGroupStyles = cva(['flex'], {\n variants: {\n /**\n * Prop to set the orientation of the checkbox group which could be `vertical` or `horizontal`.\n */\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['gap-xl'],\n },\n },\n})\n\nexport type CheckboxGroupStylesProps = VariantProps<typeof checkboxGroupStyles>\n"],"mappings":";;;;;;;;;;;;;AAEA,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAc,OAAO,SAAS,cAAc;;;ACJ5C,SAAS,eAAe,kBAAkB;AA2CnC,IAAM,uBAAuB,cAAkD,CAAC,CAAC;AAEjF,IAAM,mBAAmB,MAAM;AACpC,QAAM,UAAU,WAAW,oBAAoB;AAE/C,SAAO;AACT;;;ACjDA,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,YAAAA,iBAAgB;;;ACFzB,SAAS,gBAAgB;AAUvB;AAPF,IAAM,6BAA6B,SAAS;AAMrC,IAAM,oBAAoB,CAAC,UAChC,oBAAC,8BAA2B,WAAU,8CAA8C,GAAG,OAAO;AAGhG,kBAAkB,cAAc;;;ACbhC,SAAS,oBAAoB;AAC7B,SAAS,WAAyB;AAE3B,IAAM,sBAAsB;AAAA,EACjC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA;AAAA;AAAA;AAAA,MAIR,QAAQ,aAGN;AAAA,QACA,MAAM;AAAA,UACJ;AAAA,UACA;AAAA;AAAA,UAEA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA,SAAS;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA,QAAQ;AAAA,UACN;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA,OAAO;AAAA,UACL;AAAA,UACA;AAAA,U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E1F,YAAU,MAAM;AACd,uBAAmB,UAAU;AAAA,EAC/B,GAAG,CAAC,mBAAmB,CAAC;AAExB,SACE,gBAAAF,KAAC,qBAAqB,UAArB,EAA8B,OAAO,SACpC,0BAAAA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,oBAAoB,EAAE,WAAW,YAAY,CAAC;AAAA,MACzD,MAAK;AAAA,MACL,mBAAiB;AAAA,MACjB,oBAAkB;AAAA,MACjB,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,cAAc,cAAc;","names":["Checkbox","jsx","Checkbox","cva","jsx","jsx","Checkbox","name","isRequired","isInvalid","id","description","intent","useMemo","useRef","cva","jsx","useRef","useMemo"]}
|
|
1
|
+
{"version":3,"sources":["../../src/checkbox/Checkbox.tsx","../../src/checkbox/CheckboxGroupContext.tsx","../../src/checkbox/CheckboxInput.tsx","../../src/checkbox/CheckboxIndicator.tsx","../../src/checkbox/CheckboxInput.styles.ts","../../src/checkbox/CheckboxLabel.styles.ts","../../src/checkbox/CheckboxLabel.tsx","../../src/checkbox/CheckboxGroup.tsx","../../src/checkbox/CheckboxGroup.styles.ts"],"sourcesContent":["/* eslint-disable complexity */\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Ref, useId, useMemo, useRef } from 'react'\n\nimport { CheckboxGroupContextState, useCheckboxGroup } from './CheckboxGroupContext'\nimport { CheckboxInput, CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxLabel } from './CheckboxLabel'\n\nexport type CheckboxProps = CheckboxInputProps &\n Pick<CheckboxGroupContextState, 'reverse'> & {\n ref?: Ref<HTMLButtonElement>\n }\n\nconst ID_PREFIX = ':checkbox'\n\nexport const Checkbox = ({\n id: idProp,\n className,\n intent: intentProp,\n checked: checkedProp,\n value,\n disabled,\n reverse = false,\n onCheckedChange,\n children,\n ref: forwardedRef,\n ...others\n}: CheckboxProps) => {\n const checkboxId = `${ID_PREFIX}-${useId()}`\n const innerId = idProp || checkboxId\n\n const innerLabelId = `${ID_PREFIX}-${useId()}`\n\n const field = useFormFieldControl()\n const group = useCheckboxGroup()\n\n const rootRef = useRef<HTMLButtonElement | undefined>(null)\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n const getCheckboxAttributes = ({\n fieldState,\n groupState,\n checkboxIntent,\n }: {\n fieldState: ReturnType<typeof useFormFieldControl>\n groupState: ReturnType<typeof useCheckboxGroup>\n checkboxIntent: CheckboxInputProps['intent']\n }) => {\n const name = fieldState.name ?? groupState.name\n const isRequired = fieldState.isRequired ?? groupState.isRequired\n const state = fieldState.state ?? groupState.state\n const isInvalid = fieldState.isInvalid ?? groupState.isInvalid\n\n const isFieldEnclosed = fieldState.id !== groupState.id\n const id = isFieldEnclosed ? fieldState.id : undefined\n const description = isFieldEnclosed ? fieldState.description : undefined\n\n const intent = state ?? checkboxIntent ?? groupState.intent\n\n return { name, isRequired, isInvalid, id, description, intent }\n }\n\n const checked = value ? group.value?.includes(value) : checkedProp\n\n const handleCheckedChange = (isChecked: boolean) => {\n onCheckedChange?.(isChecked)\n\n const rootRefValue = rootRef.current?.value\n if (rootRefValue && group.onCheckedChange) {\n group.onCheckedChange(isChecked, rootRefValue)\n }\n }\n\n const {\n id,\n name,\n isInvalid,\n description,\n intent,\n isRequired: isRequiredAttr,\n } = getCheckboxAttributes({\n fieldState: field,\n groupState: group,\n checkboxIntent: intentProp,\n })\n\n const isRequired = useMemo(() => {\n if (!group) return isRequiredAttr\n\n return isRequiredAttr ? !group.value?.length : false\n }, [group, isRequiredAttr])\n\n const checkboxLabel = children && (\n <CheckboxLabel disabled={disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </CheckboxLabel>\n )\n\n const checkboxInput = (\n <CheckboxInput\n ref={ref}\n id={id || innerId}\n name={name}\n value={value}\n intent={intent}\n checked={checked}\n disabled={disabled}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onCheckedChange={handleCheckedChange}\n aria-labelledby={children ? innerLabelId : field.labelId}\n {...others}\n />\n )\n\n const content =\n group.reverse || reverse ? (\n <>\n {checkboxLabel}\n {checkboxInput}\n </>\n ) : (\n <>\n {checkboxInput}\n {checkboxLabel}\n </>\n )\n\n return (\n <div\n data-spark-component=\"checkbox\"\n className={cx('gap-md text-body-1 relative flex items-start', className)}\n >\n {content}\n </div>\n )\n}\n\nCheckbox.displayName = 'Checkbox'\n","import { createContext, useContext } from 'react'\n\nimport { CheckboxInputStylesProps } from './CheckboxInput.styles'\n\nexport interface CheckboxGroupContextState extends Pick<CheckboxInputStylesProps, 'intent'> {\n /**\n * The id of the checkbox group.\n */\n id: string\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * The value of the checkbox group.\n */\n value?: 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 * The validation state of the checkbox group.\n */\n state?: 'error' | 'success' | 'alert'\n /**\n * If true, the checkbox group will be invalid.\n */\n isInvalid?: boolean\n /**\n * If true, the checkbox group will be required.\n */\n isRequired?: boolean\n /**\n * Callback used to update or notify the value of the checkbox group.\n */\n onCheckedChange?: (checked: boolean, changed: string) => void\n /**\n * When true, the label will be placed on the left side of the Checkbox\n */\n reverse?: boolean\n}\n\nexport const CheckboxGroupContext = createContext<Partial<CheckboxGroupContextState>>({})\n\nexport const useCheckboxGroup = () => {\n const context = useContext(CheckboxGroupContext)\n\n return context\n}\n","import { Check } from '@spark-ui/icons/Check'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Checkbox } from 'radix-ui'\nimport { ComponentPropsWithoutRef, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { CheckboxIndicator } from './CheckboxIndicator'\nimport { checkboxInputStyles, type CheckboxInputStylesProps } from './CheckboxInput.styles'\n\ntype CheckedStatus = boolean | 'indeterminate'\n\nconst CheckboxPrimitive = Checkbox.Checkbox\n\nexport interface CheckboxInputProps\n extends CheckboxInputStylesProps,\n Omit<ComponentPropsWithoutRef<'button'>, 'onChange' | 'value' | 'checked' | 'defaultChecked'> {\n /**\n * The checked icon to use.\n */\n icon?: ReactNode\n /**\n * The indeterminate icon to use.\n */\n indeterminateIcon?: ReactNode\n /**\n * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n */\n defaultChecked?: boolean\n /**\n * The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.\n */\n checked?: CheckedStatus\n /**\n * When true, prevents the user from interacting with the checkbox.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the checkbox before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The name of the checkbox. 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 * Event handler called when the checked state of the checkbox changes.\n */\n onCheckedChange?: (checked: boolean) => void\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const CheckboxInput = ({\n className,\n icon = <Check />,\n indeterminateIcon = <Minus />,\n intent,\n checked,\n ref,\n ...others\n}: CheckboxInputProps) => (\n <CheckboxPrimitive\n ref={ref}\n className={checkboxInputStyles({ intent, className })}\n checked={checked}\n {...others}\n >\n <CheckboxIndicator>\n <Icon size=\"sm\">{checked === 'indeterminate' ? indeterminateIcon : icon}</Icon>\n </CheckboxIndicator>\n </CheckboxPrimitive>\n)\n\nCheckboxInput.displayName = 'CheckboxInput'\n","import { Checkbox } from 'radix-ui'\nimport { Ref } from 'react'\n\nconst CheckboxIndicatorPrimitive = Checkbox.CheckboxIndicator\n\nexport type CheckboxIndicatorProps = Checkbox.CheckboxIndicatorProps & {\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const CheckboxIndicator = (props: CheckboxIndicatorProps) => (\n <CheckboxIndicatorPrimitive className=\"flex size-full items-center justify-center\" {...props} />\n)\n\nCheckboxIndicator.displayName = 'CheckboxIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxInputStyles = cva(\n [\n 'size-sz-24 shrink-0 items-center justify-center rounded-sm border-md bg-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3 disabled:hover:ring-0',\n 'focus-visible:u-outline',\n 'hover:ring-4 hover:cursor-pointer',\n 'u-shadow-border-transition',\n ],\n {\n variants: {\n /**\n * Color scheme of the checkbox.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: [\n 'text-on-main',\n 'hover:ring-main-container',\n // data-[ok=cool]:bg-main\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-main data-[state=indeterminate]:bg-main',\n 'data-[state=checked]:border-main data-[state=checked]:bg-main',\n ],\n support: [\n 'text-on-support',\n 'hover:ring-support-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-support data-[state=indeterminate]:bg-support',\n 'data-[state=checked]:border-support data-[state=checked]:bg-support',\n ],\n accent: [\n 'text-on-accent',\n 'hover:ring-accent-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-accent data-[state=indeterminate]:bg-accent',\n 'data-[state=checked]:border-accent data-[state=checked]:bg-accent',\n ],\n basic: [\n 'text-on-basic',\n 'hover:ring-basic-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-basic data-[state=indeterminate]:bg-basic',\n 'data-[state=checked]:border-basic data-[state=checked]:bg-basic',\n ],\n success: [\n 'text-on-success',\n 'hover:ring-success-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-success data-[state=indeterminate]:bg-success',\n 'data-[state=checked]:border-success data-[state=checked]:bg-success',\n ],\n alert: [\n 'text-on-alert',\n 'hover:ring-alert-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-alert data-[state=indeterminate]:bg-alert',\n 'data-[state=checked]:border-alert data-[state=checked]:bg-alert',\n ],\n error: [\n 'text-on-error',\n 'hover:ring-error-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-error data-[state=indeterminate]:bg-error',\n 'data-[state=checked]:border-error data-[state=checked]:bg-error',\n ],\n info: [\n 'text-on-info',\n 'hover:ring-info-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-info data-[state=indeterminate]:bg-info',\n 'data-[state=checked]:border-info data-[state=checked]:bg-info',\n ],\n neutral: [\n 'text-on-neutral',\n 'hover:ring-neutral-container',\n 'data-[state=unchecked]:border-outline',\n 'data-[state=indeterminate]:border-neutral data-[state=indeterminate]:bg-neutral',\n 'data-[state=checked]:border-neutral data-[state=checked]:bg-neutral',\n ],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n },\n }\n)\n\nexport type CheckboxInputStylesProps = VariantProps<typeof checkboxInputStyles>\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const labelStyles = cva('grow', {\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, type LabelStylesProps } from './CheckboxLabel.styles'\n\nexport interface CheckboxLabelProps extends LabelProps, LabelStylesProps {\n /**\n * When true, prevents the user from interacting with the checkbox item.\n */\n disabled?: boolean\n}\n\nexport const CheckboxLabel = ({ disabled, ...others }: CheckboxLabelProps) => (\n <Label className={labelStyles({ disabled })} {...others} />\n)\n\nCheckboxLabel.displayName = 'CheckboxLabel'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { ComponentPropsWithoutRef, Ref, useEffect, useMemo, useRef } from 'react'\n\nimport { checkboxGroupStyles, CheckboxGroupStylesProps } from './CheckboxGroup.styles'\nimport { CheckboxGroupContext, CheckboxGroupContextState } from './CheckboxGroupContext'\n\nexport interface CheckboxGroupProps\n extends Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue' | 'onChange'>,\n CheckboxGroupStylesProps,\n Pick<CheckboxGroupContextState, 'intent' | 'name' | 'value' | 'reverse'> {\n /**\n * The initial value of the checkbox group\n */\n defaultValue?: string[]\n /**\n * The callback fired when any children Checkbox is checked or unchecked\n */\n onCheckedChange?: (value: string[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const CheckboxGroup = ({\n name: nameProp,\n value: valueProp,\n defaultValue,\n className,\n intent,\n orientation = 'vertical',\n onCheckedChange: onCheckedChangeProp,\n reverse = false,\n children,\n ref,\n ...others\n}: CheckboxGroupProps) => {\n const [value, setValue] = useCombinedState(valueProp, defaultValue)\n const field = useFormFieldControl()\n const onCheckedChangeRef = useRef(onCheckedChangeProp)\n\n const { id, labelId, description, state, isInvalid, isRequired } = field\n const name = nameProp ?? field.name\n\n const current = useMemo(() => {\n const handleCheckedChange = (checked: boolean, changed: string) => {\n const values = value || []\n const modified = checked ? [...values, changed] : values.filter(val => val !== changed)\n\n setValue(modified)\n\n if (onCheckedChangeRef.current) {\n onCheckedChangeRef.current(modified)\n }\n }\n\n return {\n id,\n name,\n value,\n intent,\n state,\n isInvalid,\n description,\n isRequired,\n reverse,\n onCheckedChange: handleCheckedChange,\n }\n }, [id, name, value, intent, state, isInvalid, description, isRequired, setValue, reverse])\n\n useEffect(() => {\n onCheckedChangeRef.current = onCheckedChangeProp\n }, [onCheckedChangeProp])\n\n return (\n <CheckboxGroupContext.Provider value={current}>\n <div\n ref={ref}\n className={checkboxGroupStyles({ className, orientation })}\n role=\"group\"\n aria-labelledby={labelId}\n aria-describedby={description}\n {...others}\n >\n {children}\n </div>\n </CheckboxGroupContext.Provider>\n )\n}\n\nCheckboxGroup.displayName = 'CheckboxGroup'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const checkboxGroupStyles = cva(['flex'], {\n variants: {\n /**\n * Prop to set the orientation of the checkbox group which could be `vertical` or `horizontal`.\n */\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['gap-xl'],\n },\n },\n})\n\nexport type CheckboxGroupStylesProps = VariantProps<typeof checkboxGroupStyles>\n"],"mappings":";;;;;;;;;;AACA,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAc,OAAO,SAAS,cAAc;;;ACJ5C,SAAS,eAAe,kBAAkB;AA2CnC,IAAM,uBAAuB,cAAkD,CAAC,CAAC;AAEjF,IAAM,mBAAmB,MAAM;AACpC,QAAM,UAAU,WAAW,oBAAoB;AAE/C,SAAO;AACT;;;ACjDA,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,YAAAA,iBAAgB;;;ACFzB,SAAS,gBAAgB;AAUvB;AAPF,IAAM,6BAA6B,SAAS;AAMrC,IAAM,oBAAoB,CAAC,UAChC,oBAAC,8BAA2B,WAAU,8CAA8C,GAAG,OAAO;AAGhG,kBAAkB,cAAc;;;ACbhC,SAAS,oBAAoB;AAC7B,SAAS,WAAyB;AAE3B,IAAM,sBAAsB;AAAA,EACjC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA;AAAA;AAAA;AAAA,MAIR,QAAQ,aAGN;AAAA,QACA,MAAM;AAAA,UACJ;AAAA,UACA;AAAA;AAAA,UAEA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA,SAAS;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA,QAAQ;AAAA,UACN;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA,SAAS;AAAA,UACP;AAAA,UACA;AAAA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AAG,CAAC,mBAAmB,CAAC;AAExB,SACE,gBAAAH,KAAC,qBAAqB,UAArB,EAA8B,OAAO,SACpC,0BAAAA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,oBAAoB,EAAE,WAAW,YAAY,CAAC;AAAA,MACzD,MAAK;AAAA,MACL,mBAAiB;AAAA,MACjB,oBAAkB;AAAA,MACjB,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,cAAc,cAAc;","names":["Checkbox","jsx","Checkbox","cva","jsx","jsx","Checkbox","name","isRequired","isInvalid","id","description","intent","useFormFieldControl","useMemo","useRef","cva","jsx","useFormFieldControl","useRef","useMemo"]}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useFormFieldControl
|
|
3
|
-
} from "./chunk-7PMPYEHJ.mjs";
|
|
4
1
|
import {
|
|
5
2
|
Icon
|
|
6
3
|
} from "./chunk-AESXFMCC.mjs";
|
|
@@ -57,6 +54,7 @@ var InputClearButton = Object.assign(Root, {
|
|
|
57
54
|
Root.displayName = "InputGroup.ClearButton";
|
|
58
55
|
|
|
59
56
|
// src/input/InputGroup.tsx
|
|
57
|
+
import { useFormFieldControl } from "@spark-ui/components/form-field";
|
|
60
58
|
import { useCombinedState } from "@spark-ui/use-combined-state";
|
|
61
59
|
import { useMergeRefs } from "@spark-ui/use-merge-refs";
|
|
62
60
|
import {
|
|
@@ -405,6 +403,9 @@ var InputTrailingIcon = ({ className, ...others }) => /* @__PURE__ */ jsx8(Input
|
|
|
405
403
|
InputTrailingIcon.id = "TrailingIcon";
|
|
406
404
|
InputTrailingIcon.displayName = "InputGroup.TrailingIcon";
|
|
407
405
|
|
|
406
|
+
// src/input/Input.tsx
|
|
407
|
+
import { useFormFieldControl as useFormFieldControl2 } from "@spark-ui/components/form-field";
|
|
408
|
+
|
|
408
409
|
// src/input/Input.styles.ts
|
|
409
410
|
import { cva as cva3 } from "class-variance-authority";
|
|
410
411
|
var inputStyles = cva3(
|
|
@@ -515,7 +516,7 @@ var Root4 = ({
|
|
|
515
516
|
ref,
|
|
516
517
|
...others
|
|
517
518
|
}) => {
|
|
518
|
-
const field =
|
|
519
|
+
const field = useFormFieldControl2();
|
|
519
520
|
const group = useInputGroup();
|
|
520
521
|
const { id, name, isInvalid, isRequired, description } = field;
|
|
521
522
|
const {
|
|
@@ -598,4 +599,4 @@ export {
|
|
|
598
599
|
Input,
|
|
599
600
|
InputGroup2 as InputGroup
|
|
600
601
|
};
|
|
601
|
-
//# sourceMappingURL=chunk-
|
|
602
|
+
//# sourceMappingURL=chunk-7BTJUYP3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/input/InputClearButton.tsx","../src/input/InputGroupContext.ts","../src/input/InputGroup.tsx","../src/input/InputGroup.styles.ts","../src/input/InputLeadingAddon.tsx","../src/input/InputAddon.tsx","../src/input/InputAddon.styles.ts","../src/input/InputLeadingIcon.tsx","../src/input/InputIcon.tsx","../src/input/InputTrailingAddon.tsx","../src/input/InputTrailingIcon.tsx","../src/input/Input.styles.ts","../src/input/Input.tsx","../src/input/index.ts"],"sourcesContent":["import { DeleteOutline } from '@spark-ui/icons/DeleteOutline'\nimport { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, MouseEventHandler, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport interface InputClearButtonProps extends ComponentPropsWithoutRef<'button'> {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nconst Root = ({ className, tabIndex = -1, onClick, ref, ...others }: InputClearButtonProps) => {\n const { onClear, hasTrailingIcon } = useInputGroup()\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = event => {\n if (onClick) {\n onClick(event)\n }\n\n if (onClear) {\n onClear()\n }\n }\n\n return (\n <button\n ref={ref}\n className={cx(\n className,\n 'pointer-events-auto absolute top-1/2 -translate-y-1/2',\n 'inline-flex h-full items-center justify-center outline-hidden',\n 'text-neutral hover:text-neutral-hovered',\n hasTrailingIcon ? 'right-3xl px-sz-12' : 'pl-md pr-lg right-0'\n )}\n tabIndex={tabIndex}\n onClick={handleClick}\n type=\"button\"\n {...others}\n >\n <Icon size=\"sm\">\n <DeleteOutline />\n </Icon>\n </button>\n )\n}\n\nexport const InputClearButton = Object.assign(Root, {\n id: 'ClearButton',\n})\n\nRoot.displayName = 'InputGroup.ClearButton'\n","import { createContext, useContext } from 'react'\n\nexport interface InputGroupContextValue {\n disabled?: boolean\n readOnly?: boolean\n hasLeadingIcon: boolean\n hasTrailingIcon: boolean\n hasLeadingAddon: boolean\n hasTrailingAddon: boolean\n hasClearButton: boolean\n state: null | undefined | 'error' | 'alert' | 'success'\n isStandalone?: boolean\n onClear: () => void\n}\n\nexport const InputGroupContext = createContext<Partial<InputGroupContextValue> | null>(null)\n\nexport const useInputGroup = () => {\n const context = useContext(InputGroupContext)\n\n return context || { isStandalone: true }\n}\n","/* eslint-disable complexity */\n\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport {\n ChangeEventHandler,\n Children,\n cloneElement,\n ComponentPropsWithoutRef,\n DetailedReactHTMLElement,\n FC,\n isValidElement,\n PropsWithChildren,\n ReactElement,\n Ref,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from 'react'\n\nimport { InputProps } from './Input'\nimport { inputGroupStyles, InputGroupStylesProps } from './InputGroup.styles'\nimport { InputGroupContext } from './InputGroupContext'\n\nexport interface InputGroupProps extends ComponentPropsWithoutRef<'div'>, InputGroupStylesProps {\n /**\n * Use `state` prop to assign a specific state to the group, choosing from: `error`, `alert` and `success`. By doing so, the outline styles will be updated.\n */\n state?: 'error' | 'alert' | 'success'\n /**\n * Function handler to be executed after the input has been cleared.\n */\n onClear?: () => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputGroup = ({\n className,\n children: childrenProp,\n state: stateProp,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n onClear,\n ref: forwardedRef,\n ...others\n}: PropsWithChildren<InputGroupProps>) => {\n const getElementId = (element?: ReactElement) => {\n return element ? (element.type as FC & { id?: string }).id : ''\n }\n\n const findElement = (...values: string[]) => {\n return children.find(child => values.includes(getElementId(child) || ''))\n }\n\n const children = Children.toArray(childrenProp).filter(isValidElement)\n const input = findElement('Input') as\n | DetailedReactHTMLElement<InputProps, HTMLInputElement>\n | undefined\n const props = input?.props || {}\n\n const inputRef = useRef<HTMLInputElement>(null!)\n const onClearRef = useRef(onClear)\n const ref = useMergeRefs<HTMLInputElement>(input?.ref, inputRef)\n const [value, onChange] = useCombinedState(\n props.value as string,\n props.defaultValue as string,\n props.onValueChange\n )\n\n // Data derivated from FormField context\n const field = useFormFieldControl()\n const state = field.state ?? stateProp\n const disabled = field.disabled || !!disabledProp\n const readOnly = field.readOnly || !!readOnlyProp\n\n // InputGroup elements (in visual order)\n const leadingAddon = findElement('LeadingAddon')\n const leadingIcon = findElement('LeadingIcon')\n const clearButton = findElement('ClearButton')\n const trailingIcon = findElement('TrailingIcon')\n const trailingAddon = findElement('TrailingAddon')\n\n // Acknowledge which subComponents are used in the compound context\n const hasLeadingAddon = !!leadingAddon\n const hasTrailingAddon = !!trailingAddon\n const hasLeadingIcon = !!leadingIcon\n const hasTrailingIcon = !!trailingIcon\n const hasClearButton = !!value && !!clearButton && !disabled && !readOnly\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = event => {\n if (props.onChange) {\n props.onChange(event)\n }\n\n onChange(event.target.value)\n }\n\n const handleClear = useCallback(() => {\n if (onClearRef.current) {\n onClearRef.current()\n }\n\n onChange('')\n\n inputRef.current.focus()\n }, [onChange])\n\n const current = useMemo(() => {\n return {\n state,\n disabled,\n readOnly,\n hasLeadingIcon,\n hasTrailingIcon,\n hasLeadingAddon,\n hasTrailingAddon,\n hasClearButton,\n onClear: handleClear,\n }\n }, [\n state,\n disabled,\n readOnly,\n hasLeadingIcon,\n hasTrailingIcon,\n hasLeadingAddon,\n hasTrailingAddon,\n hasClearButton,\n handleClear,\n ])\n\n useEffect(() => {\n onClearRef.current = onClear\n }, [onClear])\n\n return (\n <InputGroupContext.Provider value={current}>\n <div\n ref={forwardedRef}\n className={inputGroupStyles({ disabled, readOnly, className })}\n {...others}\n >\n {hasLeadingAddon && leadingAddon}\n\n <div className=\"relative inline-flex w-full\">\n {input &&\n cloneElement(input, {\n ref,\n defaultValue: undefined,\n value: value ?? '',\n onChange: handleChange,\n })}\n\n {leadingIcon}\n\n {hasClearButton && clearButton}\n\n {trailingIcon}\n </div>\n\n {hasTrailingAddon && trailingAddon}\n </div>\n </InputGroupContext.Provider>\n )\n}\n\nInputGroup.displayName = 'InputGroup'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputGroupStyles = cva(['relative inline-flex w-full'], {\n variants: {\n /**\n * When `true`, prevents the user from interacting.\n */\n disabled: {\n true: [\n 'cursor-not-allowed',\n 'relative',\n 'after:absolute',\n 'after:top-0',\n 'after:h-full',\n 'after:w-full',\n 'after:border-sm after:border-outline',\n 'after:rounded-lg',\n ],\n false: 'after:hidden',\n },\n /**\n * Sets the component as interactive or not.\n */\n readOnly: {\n true: [\n 'relative',\n 'after:absolute',\n 'after:top-0',\n 'after:h-full',\n 'after:w-full',\n 'after:border-sm after:border-outline',\n 'after:rounded-lg',\n ],\n false: 'after:hidden',\n },\n },\n})\n\nexport type InputGroupStylesProps = VariantProps<typeof inputGroupStyles>\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { InputAddon, InputAddonProps } from './InputAddon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputLeadingAddonProps = InputAddonProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nconst Root = ({ className, ref, ...others }: InputLeadingAddonProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <div className={cx('rounded-l-lg', isInactive ? 'bg-on-surface/dim-5' : null)}>\n <InputAddon\n ref={ref}\n className={cx(className, 'rounded-r-0! mr-[-1px] rounded-l-lg')}\n {...others}\n />\n </div>\n )\n}\n\nexport const InputLeadingAddon = Object.assign(Root, {\n id: 'LeadingAddon',\n})\n\nRoot.displayName = 'InputGroup.LeadingAddon'\n","import { Children, type ComponentPropsWithoutRef, type PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { inputAddonStyles, type InputAddonStylesProps } from './InputAddon.styles'\nimport { useInputGroup } from './InputGroupContext'\n\nexport interface InputAddonProps\n extends ComponentPropsWithoutRef<'div'>,\n Omit<InputAddonStylesProps, 'intent' | 'disabled'> {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputAddon = ({\n asChild: asChildProp,\n className,\n children,\n ref,\n ...others\n}: PropsWithChildren<InputAddonProps>) => {\n const { state, disabled, readOnly } = useInputGroup()\n\n const isRawText = typeof children === 'string'\n const asChild = !!(isRawText ? false : asChildProp)\n const child = isRawText ? children : Children.only(children)\n const Component = asChild && !isRawText ? Slot : 'div'\n\n const getDesign = (): InputAddonStylesProps['design'] => {\n if (isRawText) return 'text'\n\n return asChild ? 'solid' : 'inline'\n }\n\n const design = getDesign()\n\n return (\n <Component\n ref={ref}\n className={inputAddonStyles({\n className,\n intent: state,\n disabled,\n readOnly,\n asChild,\n design,\n })}\n {...(disabled && { tabIndex: -1 })}\n {...others}\n >\n {child}\n </Component>\n )\n}\n\nInputAddon.displayName = 'InputGroup.Addon'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputAddonStyles = cva(\n [\n 'overflow-hidden',\n 'border-sm',\n 'shrink-0',\n 'h-full',\n 'focus-visible:relative focus-visible:z-raised',\n ],\n {\n variants: {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild: { false: ['flex', 'items-center', 'px-lg'] },\n intent: {\n neutral: 'border-outline',\n error: 'border-error',\n alert: 'border-alert',\n success: 'border-success',\n },\n /**\n * Disable the input addon, preventing user interaction and adding opacity.\n */\n disabled: {\n true: ['pointer-events-none border-outline!'],\n },\n /**\n * Changes input addon styles based on the read only status from the input.\n */\n readOnly: {\n true: ['pointer-events-none'],\n },\n /**\n * Main style of the input addon.\n */\n design: {\n text: '',\n solid: '',\n inline: '',\n },\n },\n compoundVariants: [\n {\n disabled: false,\n readOnly: false,\n design: 'text',\n class: ['bg-surface', 'text-on-surface'],\n },\n {\n disabled: true,\n design: 'text',\n class: ['text-on-surface/dim-3'],\n },\n {\n disabled: true,\n design: ['solid', 'inline'],\n class: ['opacity-dim-3'],\n },\n ],\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputAddonStylesProps = VariantProps<typeof inputAddonStyles>\n","import { cx } from 'class-variance-authority'\n\nimport { InputIcon, InputIconProps } from './InputIcon'\n\nexport type InputLeadingIconProps = InputIconProps\n\nexport const InputLeadingIcon = ({ className, ...others }: InputLeadingIconProps) => (\n <InputIcon className={cx(className, 'left-lg text-body-1')} {...others} />\n)\n\nInputLeadingIcon.id = 'LeadingIcon'\nInputLeadingIcon.displayName = 'InputGroup.LeadingIcon'\n","import { cx } from 'class-variance-authority'\n\nimport { Icon, type IconProps } from '../icon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputIconProps = IconProps\n\nexport const InputIcon = ({ className, intent, children, ...others }: InputIconProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <Icon\n intent={intent}\n className={cx(\n className,\n 'pointer-events-none absolute top-[calc(var(--spacing-sz-44)/2)] -translate-y-1/2',\n intent ? undefined : 'text-neutral peer-focus:text-outline-high',\n isInactive ? 'opacity-dim-3' : undefined\n )}\n {...others}\n >\n {children}\n </Icon>\n )\n}\n\nInputIcon.displayName = 'InputGroup.Icon'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { InputAddon, InputAddonProps } from './InputAddon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputTrailingAddonProps = InputAddonProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nconst Root = ({ className, ref, ...others }: InputTrailingAddonProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <div className={cx('rounded-r-lg', isInactive ? 'bg-on-surface/dim-5' : null)}>\n <InputAddon\n ref={ref}\n className={cx(className, 'rounded-l-0! ml-[-1px] rounded-r-lg')}\n {...others}\n />\n </div>\n )\n}\n\nexport const InputTrailingAddon = Object.assign(Root, {\n id: 'TrailingAddon',\n})\n\nRoot.displayName = 'InputGroup.TrailingAddon'\n","import { cx } from 'class-variance-authority'\n\nimport { InputIcon, InputIconProps } from './InputIcon'\n\nexport type InputTrailingIconProps = InputIconProps\n\nexport const InputTrailingIcon = ({ className, ...others }: InputTrailingIconProps) => (\n <InputIcon className={cx(className, 'right-lg text-body-1')} {...others} />\n)\n\nInputTrailingIcon.id = 'TrailingIcon'\nInputTrailingIcon.displayName = 'InputGroup.TrailingIcon'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputStyles = cva(\n [\n 'relative',\n 'border-sm',\n 'peer',\n 'w-full',\n 'appearance-none outline-hidden',\n 'bg-surface',\n 'text-ellipsis text-body-1 text-on-surface',\n 'caret-neutral',\n 'autofill:shadow-surface autofill:shadow-[inset_0_0_0px_1000px]',\n 'disabled:cursor-not-allowed disabled:border-outline disabled:bg-on-surface/dim-5 disabled:text-on-surface/dim-3',\n 'read-only:cursor-default read-only:pointer-events-none read-only:bg-on-surface/dim-5',\n 'focus:ring-1 focus:ring-inset',\n ],\n {\n variants: {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild: {\n true: ['min-h-sz-44'],\n false: ['h-sz-44'],\n },\n /**\n * Color scheme of the button.\n */\n intent: {\n neutral: [\n 'border-outline',\n 'hover:border-outline-high',\n 'focus:ring-outline-high focus:border-outline-high',\n ],\n success: ['border-success', 'focus:ring-success'],\n alert: ['border-alert', 'focus:ring-alert'],\n error: ['border-error', 'focus:ring-error'],\n },\n /**\n * Sets if there is an addon before the input text.\n */\n hasLeadingAddon: {\n true: ['rounded-l-0'],\n false: ['rounded-l-lg'],\n },\n /**\n * Sets if there is an addon after the input text.\n */\n hasTrailingAddon: {\n true: ['rounded-r-0'],\n false: ['rounded-r-lg'],\n },\n /**\n * Sets if there is an icon before the input text.\n */\n hasLeadingIcon: {\n true: ['pl-3xl'],\n false: ['pl-lg'],\n },\n /**\n * Sets if there is an icon after the input text.\n */\n hasTrailingIcon: { true: '' },\n /**\n * Sets if there is a button to clear the input text.\n */\n hasClearButton: { true: '' },\n },\n compoundVariants: [\n {\n hasTrailingIcon: false,\n hasClearButton: false,\n class: 'pr-lg',\n },\n {\n hasTrailingIcon: true,\n hasClearButton: false,\n class: 'pr-3xl',\n },\n {\n hasTrailingIcon: false,\n hasClearButton: true,\n class: 'pr-3xl',\n },\n {\n hasTrailingIcon: true,\n hasClearButton: true,\n class: 'pr-[calc(var(--spacing-3xl)*2)]',\n },\n ],\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputStylesProps = VariantProps<typeof inputStyles>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { ChangeEventHandler, ComponentPropsWithoutRef, KeyboardEventHandler, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { inputStyles } from './Input.styles'\nimport { useInputGroup } from './InputGroupContext'\n\ntype InputPrimitiveProps = ComponentPropsWithoutRef<'input'>\n\nexport interface InputProps extends InputPrimitiveProps {\n asChild?: boolean\n onValueChange?: (value: string) => void\n ref?: Ref<HTMLInputElement>\n}\n\nconst Root = ({\n className,\n asChild = false,\n onValueChange,\n onChange,\n onKeyDown,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n ref,\n ...others\n}: InputProps) => {\n const field = useFormFieldControl()\n const group = useInputGroup()\n\n const { id, name, isInvalid, isRequired, description } = field\n const {\n hasLeadingAddon,\n hasTrailingAddon,\n hasLeadingIcon,\n hasTrailingIcon,\n hasClearButton,\n onClear,\n } = group\n const Component = asChild ? Slot : 'input'\n const state = field.state || group.state\n const disabled = field.disabled || group.disabled || disabledProp\n const readOnly = field.readOnly || group.readOnly || readOnlyProp\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = event => {\n if (onChange) {\n onChange(event)\n }\n\n if (onValueChange) {\n onValueChange(event.target.value)\n }\n }\n\n const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = event => {\n if (onKeyDown) {\n onKeyDown(event)\n }\n\n if (hasClearButton && onClear && event.key === 'Escape') {\n onClear()\n }\n }\n\n return (\n <Component\n ref={ref}\n id={id}\n name={name}\n className={inputStyles({\n asChild,\n className,\n intent: state,\n hasLeadingAddon: !!hasLeadingAddon,\n hasTrailingAddon: !!hasTrailingAddon,\n hasLeadingIcon: !!hasLeadingIcon,\n hasTrailingIcon: !!hasTrailingIcon,\n hasClearButton: !!hasClearButton,\n })}\n disabled={disabled}\n readOnly={readOnly}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...others}\n />\n )\n}\n\nexport const Input = Object.assign(Root, {\n id: 'Input',\n})\n\nRoot.displayName = 'Input'\n","import { InputClearButton } from './InputClearButton'\nimport { InputGroup as Root } from './InputGroup'\nimport { InputLeadingAddon } from './InputLeadingAddon'\nimport { InputLeadingIcon } from './InputLeadingIcon'\nimport { InputTrailingAddon } from './InputTrailingAddon'\nimport { InputTrailingIcon } from './InputTrailingIcon'\n\nexport * from './Input'\n\nexport const InputGroup: typeof Root & {\n LeadingAddon: typeof InputLeadingAddon\n TrailingAddon: typeof InputTrailingAddon\n LeadingIcon: typeof InputLeadingIcon\n TrailingIcon: typeof InputTrailingIcon\n ClearButton: typeof InputClearButton\n} = Object.assign(Root, {\n LeadingAddon: InputLeadingAddon,\n TrailingAddon: InputTrailingAddon,\n LeadingIcon: InputLeadingIcon,\n TrailingIcon: InputTrailingIcon,\n ClearButton: InputClearButton,\n})\n\nInputGroup.displayName = 'InputGroup'\nInputLeadingAddon.displayName = 'InputGroup.LeadingAddon'\nInputTrailingAddon.displayName = 'InputGroup.TrailingAddon'\nInputLeadingIcon.displayName = 'InputGroup.LeadingIcon'\nInputTrailingIcon.displayName = 'InputGroup.TrailingIcon'\nInputClearButton.displayName = 'InputGroup.ClearButton'\n\nexport { useInputGroup } from './InputGroupContext'\nexport { type InputGroupProps } from './InputGroup'\nexport { type InputLeadingIconProps } from './InputLeadingIcon'\nexport { type InputTrailingIconProps } from './InputTrailingIcon'\nexport { type InputLeadingAddonProps } from './InputLeadingAddon'\nexport { type InputTrailingAddonProps } from './InputTrailingAddon'\nexport { type InputClearButtonProps } from './InputClearButton'\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,UAAU;;;ACDnB,SAAS,eAAe,kBAAkB;AAenC,IAAM,oBAAoB,cAAsD,IAAI;AAEpF,IAAM,gBAAgB,MAAM;AACjC,QAAM,UAAU,WAAW,iBAAiB;AAE5C,SAAO,WAAW,EAAE,cAAc,KAAK;AACzC;;;ADoBQ;AA7BR,IAAM,OAAO,CAAC,EAAE,WAAW,WAAW,IAAI,SAAS,KAAK,GAAG,OAAO,MAA6B;AAC7F,QAAM,EAAE,SAAS,gBAAgB,IAAI,cAAc;AAEnD,QAAM,cAAoD,WAAS;AACjE,QAAI,SAAS;AACX,cAAQ,KAAK;AAAA,IACf;AAEA,QAAI,SAAS;AACX,cAAQ;AAAA,IACV;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,kBAAkB,uBAAuB;AAAA,MAC3C;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,MAAK;AAAA,MACJ,GAAG;AAAA,MAEJ,8BAAC,QAAK,MAAK,MACT,8BAAC,iBAAc,GACjB;AAAA;AAAA,EACF;AAEJ;AAEO,IAAM,mBAAmB,OAAO,OAAO,MAAM;AAA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,eAAS,KAAK;AAAA,IAChB;AAEA,QAAI,eAAe;AACjB,oBAAc,MAAM,OAAO,KAAK;AAAA,IAClC;AAAA,EACF;AAEA,QAAM,gBAAwD,WAAS;AACrE,QAAI,WAAW;AACb,gBAAU,KAAK;AAAA,IACjB;AAEA,QAAI,kBAAkB,WAAW,MAAM,QAAQ,UAAU;AACvD,cAAQ;AAAA,IACV;AAAA,EACF;AAEA,SACE,gBAAAD;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW,YAAY;AAAA,QACrB;AAAA,QACA;AAAA,QACA,QAAQ;AAAA,QACR,iBAAiB,CAAC,CAAC;AAAA,QACnB,kBAAkB,CAAC,CAAC;AAAA,QACpB,gBAAgB,CAAC,CAAC;AAAA,QAClB,iBAAiB,CAAC,CAAC;AAAA,QACnB,gBAAgB,CAAC,CAAC;AAAA,MACpB,CAAC;AAAA,MACD;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,oBAAkB;AAAA,MAClB,gBAAc;AAAA,MACd,UAAU;AAAA,MACV,WAAW;AAAA,MACV,GAAG;AAAA;AAAA,EACN;AAEJ;AAEO,IAAM,QAAQ,OAAO,OAAOC,OAAM;AAAA,EACvC,IAAI;AACN,CAAC;AAEDA,MAAK,cAAc;;;ACrFZ,IAAMC,cAMT,OAAO,OAAO,YAAM;AAAA,EACtB,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AAAA,EACb,cAAc;AAAA,EACd,aAAa;AACf,CAAC;AAEDA,YAAW,cAAc;AACzB,kBAAkB,cAAc;AAChC,mBAAmB,cAAc;AACjC,iBAAiB,cAAc;AAC/B,kBAAkB,cAAc;AAChC,iBAAiB,cAAc;","names":["jsx","cx","Children","cva","jsx","Children","jsx","Root","cx","cx","cx","jsx","cx","jsx","cx","cx","jsx","Root","cx","cx","jsx","cx","cva","jsx","Root","InputGroup"]}
|
|
1
|
+
{"version":3,"sources":["../src/input/InputClearButton.tsx","../src/input/InputGroupContext.ts","../src/input/InputGroup.tsx","../src/input/InputGroup.styles.ts","../src/input/InputLeadingAddon.tsx","../src/input/InputAddon.tsx","../src/input/InputAddon.styles.ts","../src/input/InputLeadingIcon.tsx","../src/input/InputIcon.tsx","../src/input/InputTrailingAddon.tsx","../src/input/InputTrailingIcon.tsx","../src/input/Input.tsx","../src/input/Input.styles.ts","../src/input/index.ts"],"sourcesContent":["import { DeleteOutline } from '@spark-ui/icons/DeleteOutline'\nimport { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, MouseEventHandler, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport interface InputClearButtonProps extends ComponentPropsWithoutRef<'button'> {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nconst Root = ({ className, tabIndex = -1, onClick, ref, ...others }: InputClearButtonProps) => {\n const { onClear, hasTrailingIcon } = useInputGroup()\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = event => {\n if (onClick) {\n onClick(event)\n }\n\n if (onClear) {\n onClear()\n }\n }\n\n return (\n <button\n ref={ref}\n className={cx(\n className,\n 'pointer-events-auto absolute top-1/2 -translate-y-1/2',\n 'inline-flex h-full items-center justify-center outline-hidden',\n 'text-neutral hover:text-neutral-hovered',\n hasTrailingIcon ? 'right-3xl px-sz-12' : 'pl-md pr-lg right-0'\n )}\n tabIndex={tabIndex}\n onClick={handleClick}\n type=\"button\"\n {...others}\n >\n <Icon size=\"sm\">\n <DeleteOutline />\n </Icon>\n </button>\n )\n}\n\nexport const InputClearButton = Object.assign(Root, {\n id: 'ClearButton',\n})\n\nRoot.displayName = 'InputGroup.ClearButton'\n","import { createContext, useContext } from 'react'\n\nexport interface InputGroupContextValue {\n disabled?: boolean\n readOnly?: boolean\n hasLeadingIcon: boolean\n hasTrailingIcon: boolean\n hasLeadingAddon: boolean\n hasTrailingAddon: boolean\n hasClearButton: boolean\n state: null | undefined | 'error' | 'alert' | 'success'\n isStandalone?: boolean\n onClear: () => void\n}\n\nexport const InputGroupContext = createContext<Partial<InputGroupContextValue> | null>(null)\n\nexport const useInputGroup = () => {\n const context = useContext(InputGroupContext)\n\n return context || { isStandalone: true }\n}\n","/* eslint-disable complexity */\n\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport {\n ChangeEventHandler,\n Children,\n cloneElement,\n ComponentPropsWithoutRef,\n DetailedReactHTMLElement,\n FC,\n isValidElement,\n PropsWithChildren,\n ReactElement,\n Ref,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from 'react'\n\nimport { InputProps } from './Input'\nimport { inputGroupStyles, InputGroupStylesProps } from './InputGroup.styles'\nimport { InputGroupContext } from './InputGroupContext'\n\nexport interface InputGroupProps extends ComponentPropsWithoutRef<'div'>, InputGroupStylesProps {\n /**\n * Use `state` prop to assign a specific state to the group, choosing from: `error`, `alert` and `success`. By doing so, the outline styles will be updated.\n */\n state?: 'error' | 'alert' | 'success'\n /**\n * Function handler to be executed after the input has been cleared.\n */\n onClear?: () => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputGroup = ({\n className,\n children: childrenProp,\n state: stateProp,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n onClear,\n ref: forwardedRef,\n ...others\n}: PropsWithChildren<InputGroupProps>) => {\n const getElementId = (element?: ReactElement) => {\n return element ? (element.type as FC & { id?: string }).id : ''\n }\n\n const findElement = (...values: string[]) => {\n return children.find(child => values.includes(getElementId(child) || ''))\n }\n\n const children = Children.toArray(childrenProp).filter(isValidElement)\n const input = findElement('Input') as\n | DetailedReactHTMLElement<InputProps, HTMLInputElement>\n | undefined\n const props = input?.props || {}\n\n const inputRef = useRef<HTMLInputElement>(null!)\n const onClearRef = useRef(onClear)\n const ref = useMergeRefs<HTMLInputElement>(input?.ref, inputRef)\n const [value, onChange] = useCombinedState(\n props.value as string,\n props.defaultValue as string,\n props.onValueChange\n )\n\n // Data derivated from FormField context\n const field = useFormFieldControl()\n const state = field.state ?? stateProp\n const disabled = field.disabled || !!disabledProp\n const readOnly = field.readOnly || !!readOnlyProp\n\n // InputGroup elements (in visual order)\n const leadingAddon = findElement('LeadingAddon')\n const leadingIcon = findElement('LeadingIcon')\n const clearButton = findElement('ClearButton')\n const trailingIcon = findElement('TrailingIcon')\n const trailingAddon = findElement('TrailingAddon')\n\n // Acknowledge which subComponents are used in the compound context\n const hasLeadingAddon = !!leadingAddon\n const hasTrailingAddon = !!trailingAddon\n const hasLeadingIcon = !!leadingIcon\n const hasTrailingIcon = !!trailingIcon\n const hasClearButton = !!value && !!clearButton && !disabled && !readOnly\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = event => {\n if (props.onChange) {\n props.onChange(event)\n }\n\n onChange(event.target.value)\n }\n\n const handleClear = useCallback(() => {\n if (onClearRef.current) {\n onClearRef.current()\n }\n\n onChange('')\n\n inputRef.current.focus()\n }, [onChange])\n\n const current = useMemo(() => {\n return {\n state,\n disabled,\n readOnly,\n hasLeadingIcon,\n hasTrailingIcon,\n hasLeadingAddon,\n hasTrailingAddon,\n hasClearButton,\n onClear: handleClear,\n }\n }, [\n state,\n disabled,\n readOnly,\n hasLeadingIcon,\n hasTrailingIcon,\n hasLeadingAddon,\n hasTrailingAddon,\n hasClearButton,\n handleClear,\n ])\n\n useEffect(() => {\n onClearRef.current = onClear\n }, [onClear])\n\n return (\n <InputGroupContext.Provider value={current}>\n <div\n ref={forwardedRef}\n className={inputGroupStyles({ disabled, readOnly, className })}\n {...others}\n >\n {hasLeadingAddon && leadingAddon}\n\n <div className=\"relative inline-flex w-full\">\n {input &&\n cloneElement(input, {\n ref,\n defaultValue: undefined,\n value: value ?? '',\n onChange: handleChange,\n })}\n\n {leadingIcon}\n\n {hasClearButton && clearButton}\n\n {trailingIcon}\n </div>\n\n {hasTrailingAddon && trailingAddon}\n </div>\n </InputGroupContext.Provider>\n )\n}\n\nInputGroup.displayName = 'InputGroup'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputGroupStyles = cva(['relative inline-flex w-full'], {\n variants: {\n /**\n * When `true`, prevents the user from interacting.\n */\n disabled: {\n true: [\n 'cursor-not-allowed',\n 'relative',\n 'after:absolute',\n 'after:top-0',\n 'after:h-full',\n 'after:w-full',\n 'after:border-sm after:border-outline',\n 'after:rounded-lg',\n ],\n false: 'after:hidden',\n },\n /**\n * Sets the component as interactive or not.\n */\n readOnly: {\n true: [\n 'relative',\n 'after:absolute',\n 'after:top-0',\n 'after:h-full',\n 'after:w-full',\n 'after:border-sm after:border-outline',\n 'after:rounded-lg',\n ],\n false: 'after:hidden',\n },\n },\n})\n\nexport type InputGroupStylesProps = VariantProps<typeof inputGroupStyles>\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { InputAddon, InputAddonProps } from './InputAddon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputLeadingAddonProps = InputAddonProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nconst Root = ({ className, ref, ...others }: InputLeadingAddonProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <div className={cx('rounded-l-lg', isInactive ? 'bg-on-surface/dim-5' : null)}>\n <InputAddon\n ref={ref}\n className={cx(className, 'rounded-r-0! mr-[-1px] rounded-l-lg')}\n {...others}\n />\n </div>\n )\n}\n\nexport const InputLeadingAddon = Object.assign(Root, {\n id: 'LeadingAddon',\n})\n\nRoot.displayName = 'InputGroup.LeadingAddon'\n","import { Children, type ComponentPropsWithoutRef, type PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { inputAddonStyles, type InputAddonStylesProps } from './InputAddon.styles'\nimport { useInputGroup } from './InputGroupContext'\n\nexport interface InputAddonProps\n extends ComponentPropsWithoutRef<'div'>,\n Omit<InputAddonStylesProps, 'intent' | 'disabled'> {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const InputAddon = ({\n asChild: asChildProp,\n className,\n children,\n ref,\n ...others\n}: PropsWithChildren<InputAddonProps>) => {\n const { state, disabled, readOnly } = useInputGroup()\n\n const isRawText = typeof children === 'string'\n const asChild = !!(isRawText ? false : asChildProp)\n const child = isRawText ? children : Children.only(children)\n const Component = asChild && !isRawText ? Slot : 'div'\n\n const getDesign = (): InputAddonStylesProps['design'] => {\n if (isRawText) return 'text'\n\n return asChild ? 'solid' : 'inline'\n }\n\n const design = getDesign()\n\n return (\n <Component\n ref={ref}\n className={inputAddonStyles({\n className,\n intent: state,\n disabled,\n readOnly,\n asChild,\n design,\n })}\n {...(disabled && { tabIndex: -1 })}\n {...others}\n >\n {child}\n </Component>\n )\n}\n\nInputAddon.displayName = 'InputGroup.Addon'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputAddonStyles = cva(\n [\n 'overflow-hidden',\n 'border-sm',\n 'shrink-0',\n 'h-full',\n 'focus-visible:relative focus-visible:z-raised',\n ],\n {\n variants: {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild: { false: ['flex', 'items-center', 'px-lg'] },\n intent: {\n neutral: 'border-outline',\n error: 'border-error',\n alert: 'border-alert',\n success: 'border-success',\n },\n /**\n * Disable the input addon, preventing user interaction and adding opacity.\n */\n disabled: {\n true: ['pointer-events-none border-outline!'],\n },\n /**\n * Changes input addon styles based on the read only status from the input.\n */\n readOnly: {\n true: ['pointer-events-none'],\n },\n /**\n * Main style of the input addon.\n */\n design: {\n text: '',\n solid: '',\n inline: '',\n },\n },\n compoundVariants: [\n {\n disabled: false,\n readOnly: false,\n design: 'text',\n class: ['bg-surface', 'text-on-surface'],\n },\n {\n disabled: true,\n design: 'text',\n class: ['text-on-surface/dim-3'],\n },\n {\n disabled: true,\n design: ['solid', 'inline'],\n class: ['opacity-dim-3'],\n },\n ],\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputAddonStylesProps = VariantProps<typeof inputAddonStyles>\n","import { cx } from 'class-variance-authority'\n\nimport { InputIcon, InputIconProps } from './InputIcon'\n\nexport type InputLeadingIconProps = InputIconProps\n\nexport const InputLeadingIcon = ({ className, ...others }: InputLeadingIconProps) => (\n <InputIcon className={cx(className, 'left-lg text-body-1')} {...others} />\n)\n\nInputLeadingIcon.id = 'LeadingIcon'\nInputLeadingIcon.displayName = 'InputGroup.LeadingIcon'\n","import { cx } from 'class-variance-authority'\n\nimport { Icon, type IconProps } from '../icon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputIconProps = IconProps\n\nexport const InputIcon = ({ className, intent, children, ...others }: InputIconProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <Icon\n intent={intent}\n className={cx(\n className,\n 'pointer-events-none absolute top-[calc(var(--spacing-sz-44)/2)] -translate-y-1/2',\n intent ? undefined : 'text-neutral peer-focus:text-outline-high',\n isInactive ? 'opacity-dim-3' : undefined\n )}\n {...others}\n >\n {children}\n </Icon>\n )\n}\n\nInputIcon.displayName = 'InputGroup.Icon'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { InputAddon, InputAddonProps } from './InputAddon'\nimport { useInputGroup } from './InputGroupContext'\n\nexport type InputTrailingAddonProps = InputAddonProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nconst Root = ({ className, ref, ...others }: InputTrailingAddonProps) => {\n const { disabled, readOnly } = useInputGroup()\n const isInactive = disabled || readOnly\n\n return (\n <div className={cx('rounded-r-lg', isInactive ? 'bg-on-surface/dim-5' : null)}>\n <InputAddon\n ref={ref}\n className={cx(className, 'rounded-l-0! ml-[-1px] rounded-r-lg')}\n {...others}\n />\n </div>\n )\n}\n\nexport const InputTrailingAddon = Object.assign(Root, {\n id: 'TrailingAddon',\n})\n\nRoot.displayName = 'InputGroup.TrailingAddon'\n","import { cx } from 'class-variance-authority'\n\nimport { InputIcon, InputIconProps } from './InputIcon'\n\nexport type InputTrailingIconProps = InputIconProps\n\nexport const InputTrailingIcon = ({ className, ...others }: InputTrailingIconProps) => (\n <InputIcon className={cx(className, 'right-lg text-body-1')} {...others} />\n)\n\nInputTrailingIcon.id = 'TrailingIcon'\nInputTrailingIcon.displayName = 'InputGroup.TrailingIcon'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { ChangeEventHandler, ComponentPropsWithoutRef, KeyboardEventHandler, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { inputStyles } from './Input.styles'\nimport { useInputGroup } from './InputGroupContext'\n\ntype InputPrimitiveProps = ComponentPropsWithoutRef<'input'>\n\nexport interface InputProps extends InputPrimitiveProps {\n asChild?: boolean\n onValueChange?: (value: string) => void\n ref?: Ref<HTMLInputElement>\n}\n\nconst Root = ({\n className,\n asChild = false,\n onValueChange,\n onChange,\n onKeyDown,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n ref,\n ...others\n}: InputProps) => {\n const field = useFormFieldControl()\n const group = useInputGroup()\n\n const { id, name, isInvalid, isRequired, description } = field\n const {\n hasLeadingAddon,\n hasTrailingAddon,\n hasLeadingIcon,\n hasTrailingIcon,\n hasClearButton,\n onClear,\n } = group\n const Component = asChild ? Slot : 'input'\n const state = field.state || group.state\n const disabled = field.disabled || group.disabled || disabledProp\n const readOnly = field.readOnly || group.readOnly || readOnlyProp\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = event => {\n if (onChange) {\n onChange(event)\n }\n\n if (onValueChange) {\n onValueChange(event.target.value)\n }\n }\n\n const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = event => {\n if (onKeyDown) {\n onKeyDown(event)\n }\n\n if (hasClearButton && onClear && event.key === 'Escape') {\n onClear()\n }\n }\n\n return (\n <Component\n ref={ref}\n id={id}\n name={name}\n className={inputStyles({\n asChild,\n className,\n intent: state,\n hasLeadingAddon: !!hasLeadingAddon,\n hasTrailingAddon: !!hasTrailingAddon,\n hasLeadingIcon: !!hasLeadingIcon,\n hasTrailingIcon: !!hasTrailingIcon,\n hasClearButton: !!hasClearButton,\n })}\n disabled={disabled}\n readOnly={readOnly}\n required={isRequired}\n aria-describedby={description}\n aria-invalid={isInvalid}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n {...others}\n />\n )\n}\n\nexport const Input = Object.assign(Root, {\n id: 'Input',\n})\n\nRoot.displayName = 'Input'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const inputStyles = cva(\n [\n 'relative',\n 'border-sm',\n 'peer',\n 'w-full',\n 'appearance-none outline-hidden',\n 'bg-surface',\n 'text-ellipsis text-body-1 text-on-surface',\n 'caret-neutral',\n 'autofill:shadow-surface autofill:shadow-[inset_0_0_0px_1000px]',\n 'disabled:cursor-not-allowed disabled:border-outline disabled:bg-on-surface/dim-5 disabled:text-on-surface/dim-3',\n 'read-only:cursor-default read-only:pointer-events-none read-only:bg-on-surface/dim-5',\n 'focus:ring-1 focus:ring-inset',\n ],\n {\n variants: {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild: {\n true: ['min-h-sz-44'],\n false: ['h-sz-44'],\n },\n /**\n * Color scheme of the button.\n */\n intent: {\n neutral: [\n 'border-outline',\n 'hover:border-outline-high',\n 'focus:ring-outline-high focus:border-outline-high',\n ],\n success: ['border-success', 'focus:ring-success'],\n alert: ['border-alert', 'focus:ring-alert'],\n error: ['border-error', 'focus:ring-error'],\n },\n /**\n * Sets if there is an addon before the input text.\n */\n hasLeadingAddon: {\n true: ['rounded-l-0'],\n false: ['rounded-l-lg'],\n },\n /**\n * Sets if there is an addon after the input text.\n */\n hasTrailingAddon: {\n true: ['rounded-r-0'],\n false: ['rounded-r-lg'],\n },\n /**\n * Sets if there is an icon before the input text.\n */\n hasLeadingIcon: {\n true: ['pl-3xl'],\n false: ['pl-lg'],\n },\n /**\n * Sets if there is an icon after the input text.\n */\n hasTrailingIcon: { true: '' },\n /**\n * Sets if there is a button to clear the input text.\n */\n hasClearButton: { true: '' },\n },\n compoundVariants: [\n {\n hasTrailingIcon: false,\n hasClearButton: false,\n class: 'pr-lg',\n },\n {\n hasTrailingIcon: true,\n hasClearButton: false,\n class: 'pr-3xl',\n },\n {\n hasTrailingIcon: false,\n hasClearButton: true,\n class: 'pr-3xl',\n },\n {\n hasTrailingIcon: true,\n hasClearButton: true,\n class: 'pr-[calc(var(--spacing-3xl)*2)]',\n },\n ],\n defaultVariants: {\n intent: 'neutral',\n },\n }\n)\n\nexport type InputStylesProps = VariantProps<typeof inputStyles>\n","import { InputClearButton } from './InputClearButton'\nimport { InputGroup as Root } from './InputGroup'\nimport { InputLeadingAddon } from './InputLeadingAddon'\nimport { InputLeadingIcon } from './InputLeadingIcon'\nimport { InputTrailingAddon } from './InputTrailingAddon'\nimport { InputTrailingIcon } from './InputTrailingIcon'\n\nexport * from './Input'\n\nexport const InputGroup: typeof Root & {\n LeadingAddon: typeof InputLeadingAddon\n TrailingAddon: typeof InputTrailingAddon\n LeadingIcon: typeof InputLeadingIcon\n TrailingIcon: typeof InputTrailingIcon\n ClearButton: typeof InputClearButton\n} = Object.assign(Root, {\n LeadingAddon: InputLeadingAddon,\n TrailingAddon: InputTrailingAddon,\n LeadingIcon: InputLeadingIcon,\n TrailingIcon: InputTrailingIcon,\n ClearButton: InputClearButton,\n})\n\nInputGroup.displayName = 'InputGroup'\nInputLeadingAddon.displayName = 'InputGroup.LeadingAddon'\nInputTrailingAddon.displayName = 'InputGroup.TrailingAddon'\nInputLeadingIcon.displayName = 'InputGroup.LeadingIcon'\nInputTrailingIcon.displayName = 'InputGroup.TrailingIcon'\nInputClearButton.displayName = 'InputGroup.ClearButton'\n\nexport { useInputGroup } from './InputGroupContext'\nexport { type InputGroupProps } from './InputGroup'\nexport { type InputLeadingIconProps } from './InputLeadingIcon'\nexport { type InputTrailingIconProps } from './InputTrailingIcon'\nexport { type InputLeadingAddonProps } from './InputLeadingAddon'\nexport { type InputTrailingAddonProps } from './InputTrailingAddon'\nexport { type InputClearButtonProps } from './InputClearButton'\n"],"mappings":";;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,UAA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AA,QACnB,kBAAkB,CAAC,CAAC;AAAA,QACpB,gBAAgB,CAAC,CAAC;AAAA,QAClB,iBAAiB,CAAC,CAAC;AAAA,QACnB,gBAAgB,CAAC,CAAC;AAAA,MACpB,CAAC;AAAA,MACD;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,oBAAkB;AAAA,MAClB,gBAAc;AAAA,MACd,UAAU;AAAA,MACV,WAAW;AAAA,MACV,GAAG;AAAA;AAAA,EACN;AAEJ;AAEO,IAAM,QAAQ,OAAO,OAAOC,OAAM;AAAA,EACvC,IAAI;AACN,CAAC;AAEDA,MAAK,cAAc;;;AErFZ,IAAME,cAMT,OAAO,OAAO,YAAM;AAAA,EACtB,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AAAA,EACb,cAAc;AAAA,EACd,aAAa;AACf,CAAC;AAEDA,YAAW,cAAc;AACzB,kBAAkB,cAAc;AAChC,mBAAmB,cAAc;AACjC,iBAAiB,cAAc;AAC/B,kBAAkB,cAAc;AAChC,iBAAiB,cAAc;","names":["jsx","cx","Children","cva","jsx","Children","jsx","Root","cx","cx","cx","jsx","cx","jsx","cx","cx","jsx","Root","cx","cx","jsx","cx","useFormFieldControl","cva","jsx","Root","useFormFieldControl","InputGroup"]}
|