@spark-ui/components 10.11.5 → 10.11.7

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/dropdown/DropdownContext.tsx","../../src/dropdown/useDropdown.ts","../../src/dropdown/utils.ts","../../src/dropdown/Dropdown.tsx","../../src/dropdown/DropdownDivider.tsx","../../src/dropdown/DropdownGroup.tsx","../../src/dropdown/DropdownItemsGroupContext.tsx","../../src/dropdown/DropdownItem.tsx","../../src/dropdown/DropdownItemContext.tsx","../../src/dropdown/DropdownItemIndicator.tsx","../../src/dropdown/DropdownItems.tsx","../../src/dropdown/DropdownItemText.tsx","../../src/dropdown/DropdownLabel.tsx","../../src/dropdown/DropdownLeadingIcon.tsx","../../src/dropdown/DropdownPopover.tsx","../../src/dropdown/DropdownPortal.tsx","../../src/dropdown/DropdownTrigger.tsx","../../src/dropdown/DropdownTrigger.styles.tsx","../../src/dropdown/DropdownValue.tsx","../../src/dropdown/index.ts"],"sourcesContent":["import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport {\n createContext,\n Dispatch,\n Fragment,\n PropsWithChildren,\n SetStateAction,\n useContext,\n useEffect,\n useId,\n useState,\n} from 'react'\n\nimport { Popover } from '../popover'\nimport { type DownshiftState, type DropdownItem, type ItemsMap } from './types'\nimport { useDropdown } from './useDropdown'\nimport { getElementByIndex, getItemsFromChildren, hasChildComponent } from './utils'\n\nexport interface DropdownContextState extends DownshiftState {\n itemsMap: ItemsMap\n highlightedItem: DropdownItem | undefined\n hasPopover: boolean\n setHasPopover: Dispatch<SetStateAction<boolean>>\n multiple: boolean\n disabled: boolean\n readOnly: boolean\n state?: 'error' | 'alert' | 'success'\n lastInteractionType: 'mouse' | 'keyboard'\n setLastInteractionType: (type: 'mouse' | 'keyboard') => void\n}\n\nexport type DropdownContextCommonProps = PropsWithChildren<{\n /**\n * The controlled open state of the select. Must be used in conjunction with `onOpenChange`.\n */\n open?: boolean\n /**\n * Event handler called when the open state of the select changes.\n */\n onOpenChange?: (isOpen: boolean) => void\n /**\n * The open state of the select when it is initially rendered. Use when you do not need to control its open state.\n */\n defaultOpen?: boolean\n /**\n * Use `state` prop to assign a specific state to the dropdown, choosing from: `error`, `alert` and `success`. By doing so, the outline styles will be updated.\n */\n state?: 'error' | 'alert' | 'success'\n /**\n * When true, prevents the user from interacting with the dropdown.\n */\n disabled?: boolean\n /**\n * Sets the dropdown as interactive or not.\n */\n readOnly?: boolean\n}>\n\ninterface DropdownPropsSingle {\n /**\n * Prop 'multiple' indicating whether multiple values are allowed.\n */\n multiple?: false\n /**\n * The value of the select when initially rendered. Use when you do not need to control the state of the select.\n */\n defaultValue?: string\n /**\n * The controlled value of the select. Should be used in conjunction with `onValueChange`.\n */\n value?: string\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n}\n\ninterface DropdownPropsMultiple {\n /**\n * Prop 'multiple' indicating whether multiple values are allowed.\n */\n multiple: true\n /**\n * The value of the select when initially rendered. Use when you do not need to control the state of the select.\n */\n defaultValue?: string[]\n /**\n * The controlled value of the select. Should be used in conjunction with `onValueChange`.\n */\n value?: string[]\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string[]) => void\n}\n\nexport type DropdownContextProps = DropdownContextCommonProps &\n (DropdownPropsSingle | DropdownPropsMultiple)\n\nconst DropdownContext = createContext<DropdownContextState | null>(null)\n\nexport const ID_PREFIX = ':dropdown'\n\nexport const DropdownProvider = ({\n children,\n defaultValue,\n value,\n onValueChange,\n open,\n onOpenChange,\n defaultOpen,\n multiple = false,\n disabled: disabledProp = false,\n readOnly: readOnlyProp = false,\n state: stateProp,\n}: DropdownContextProps) => {\n const [itemsMap, setItemsMap] = useState<ItemsMap>(getItemsFromChildren(children))\n const [hasPopover, setHasPopover] = useState<boolean>(\n hasChildComponent(children, 'Dropdown.Popover')\n )\n const [lastInteractionType, setLastInteractionType] = useState<'mouse' | 'keyboard'>('mouse')\n\n const field = useFormFieldControl()\n\n const state = field.state || stateProp\n\n const internalFieldLabelID = `${ID_PREFIX}-label-${useId()}`\n const internalFieldID = `${ID_PREFIX}-input-${useId()}`\n const id = field.id || internalFieldID\n const labelId = field.labelId || internalFieldLabelID\n\n const disabled = field.disabled ?? disabledProp\n const readOnly = field.readOnly ?? readOnlyProp\n\n const dropdownState = useDropdown({\n itemsMap,\n defaultValue,\n value,\n onValueChange,\n open,\n onOpenChange,\n defaultOpen,\n multiple,\n id,\n labelId,\n })\n\n /**\n * Indices in a Map are set when an element is added to the Map.\n * If for some reason, in the Dropdown:\n * - items order changes\n * - items are added\n * - items are removed\n *\n * The Map must be rebuilt from the new children in order to preserve logical indices.\n *\n * Downshift is heavily indices based for keyboard navigation, so it it important.\n */\n useEffect(() => {\n const newMap = getItemsFromChildren(children)\n\n const previousItems = [...itemsMap.values()]\n const newItems = [...newMap.values()]\n\n const hasItemsChanges =\n previousItems.length !== newItems.length ||\n previousItems.some((item, index) => {\n const hasUpdatedValue = item.value !== newItems[index]?.value\n const hasUpdatedText = item.text !== newItems[index]?.text\n\n return hasUpdatedValue || hasUpdatedText\n })\n\n if (hasItemsChanges) {\n setItemsMap(newMap)\n }\n }, [children])\n\n /**\n * Warning:\n * Downshift is expecting the items list to always be rendered, as per a11y guidelines.\n * This is why the `Popover` is always opened in this component, but visually hidden instead from Dropdown.Popover.\n */\n const [WrapperComponent, wrapperProps] = hasPopover ? [Popover, { open: true }] : [Fragment, {}]\n\n return (\n <DropdownContext.Provider\n value={{\n multiple,\n disabled,\n readOnly,\n ...dropdownState,\n itemsMap,\n highlightedItem: getElementByIndex(itemsMap, dropdownState.highlightedIndex),\n hasPopover,\n setHasPopover,\n state,\n lastInteractionType,\n setLastInteractionType,\n }}\n >\n <WrapperComponent {...wrapperProps}>{children}</WrapperComponent>\n </DropdownContext.Provider>\n )\n}\n\nexport const useDropdownContext = () => {\n const context = useContext(DropdownContext)\n\n if (!context) {\n throw Error('useDropdownContext must be used within a Dropdown provider')\n }\n\n return context\n}\n","import { useMultipleSelection, useSelect, UseSelectProps } from 'downshift'\n\nimport { type DropdownItem, type ItemsMap } from './types'\n\ntype OnChangeValueType = string & string[]\n\nexport interface DownshiftProps {\n itemsMap: ItemsMap\n value: string | string[] | undefined\n defaultValue: string | string[] | undefined\n onValueChange: ((value: string) => void) | ((value: string[]) => void) | undefined\n open: boolean | undefined\n onOpenChange: ((isOpen: boolean) => void) | undefined\n defaultOpen: boolean | undefined\n multiple: boolean | undefined\n id: string\n labelId: string\n}\n\n/**\n * This hook abstract the complexity of using downshift with both single and multiple selection.\n */\nexport const useDropdown = ({\n itemsMap,\n defaultValue,\n value,\n onValueChange,\n open,\n onOpenChange,\n defaultOpen,\n multiple,\n id,\n labelId,\n}: DownshiftProps) => {\n const items = [...itemsMap.values()]\n\n const downshiftMultipleSelection = useMultipleSelection<DropdownItem>({\n selectedItems:\n value != null && multiple\n ? items.filter(item =>\n multiple ? (value as string[]).includes(item.value) : value === item.value\n )\n : undefined,\n initialSelectedItems:\n defaultValue != null && multiple\n ? items.filter(item =>\n multiple ? (defaultValue as string[]).includes(item.value) : defaultValue === item.value\n )\n : undefined,\n\n onSelectedItemsChange: ({ selectedItems }) => {\n if (selectedItems != null && multiple) {\n onValueChange?.(selectedItems.map(item => item.value) as OnChangeValueType)\n }\n },\n })\n\n /**\n * Custom state reducer for multiple selection behaviour:\n * - keeps the component opened when the user selects an item\n * - preserves the higlighted index when the user select an item\n * - selected items can be unselected, even the last selected item (as opposed to single selection behaviour)\n */\n const stateReducer: UseSelectProps<DropdownItem>['stateReducer'] = (state, { changes, type }) => {\n if (!multiple) return changes\n\n const { selectedItems, removeSelectedItem, addSelectedItem } = downshiftMultipleSelection\n\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check\n switch (type) {\n case useSelect.stateChangeTypes.ToggleButtonKeyDownEnter:\n case useSelect.stateChangeTypes.ToggleButtonKeyDownSpaceButton:\n case useSelect.stateChangeTypes.ItemClick:\n if (changes.selectedItem != null) {\n const isAlreadySelected = selectedItems.some(\n selectedItem => selectedItem.value === changes.selectedItem?.value\n )\n\n if (isAlreadySelected) removeSelectedItem(changes.selectedItem)\n else addSelectedItem(changes.selectedItem)\n }\n\n return {\n ...changes,\n isOpen: true, // keep the menu open after selection.\n highlightedIndex: state.highlightedIndex, // preserve highlighted index position\n }\n default:\n return changes\n }\n }\n\n const downshift = useSelect<DropdownItem>({\n items,\n isItemDisabled: item => item.disabled,\n itemToString: item => (item ? item.text : ''),\n // a11y attributes\n id,\n labelId,\n // Controlled open state\n isOpen: open, // undefined must be passed for stateful behaviour (uncontrolled)\n onIsOpenChange: ({ isOpen }) => {\n if (isOpen != null) onOpenChange?.(isOpen)\n },\n initialIsOpen: defaultOpen ?? false,\n stateReducer,\n // Controlled mode (single selection)\n selectedItem: value != null && !multiple ? itemsMap.get(value as string) || null : undefined,\n initialSelectedItem:\n (defaultValue != null || value != null) && !multiple\n ? itemsMap.get(defaultValue as string) || null\n : undefined,\n onSelectedItemChange: ({ selectedItem }) => {\n if (selectedItem?.value != null && !multiple) {\n onValueChange?.(selectedItem?.value as OnChangeValueType)\n }\n },\n /**\n * 1. Downshift default behaviour is to scroll into view the highlighted item when the dropdown opens. This behaviour is not stable and scrolls the dropdown to the bottom of the screen.\n */\n scrollIntoView: node => {\n if (node) {\n node.scrollIntoView({ block: 'nearest' })\n }\n\n return undefined\n },\n })\n\n return {\n ...downshift,\n ...downshiftMultipleSelection,\n /** There is a Downshift bug in React 19, it duplicates some selectedItems */\n selectedItems: [...new Set(downshiftMultipleSelection.selectedItems)],\n }\n}\n","import { type FC, isValidElement, type ReactElement, type ReactNode, Children } from 'react'\n\nimport { type ItemProps } from './DropdownItem'\nimport { ItemTextProps } from './DropdownItemText'\nimport { type DropdownItem, type ItemsMap } from './types'\n\nexport function getIndexByKey(map: ItemsMap, targetKey: string) {\n let index = 0\n for (const [key] of map.entries()) {\n if (key === targetKey) {\n return index\n }\n index++\n }\n\n return -1\n}\n\nconst getKeyAtIndex = (map: ItemsMap, index: number) => {\n let i = 0\n for (const key of map.keys()) {\n if (i === index) return key\n i++\n }\n\n return undefined\n}\n\nexport const getElementByIndex = (map: ItemsMap, index: number) => {\n const key = getKeyAtIndex(map, index)\n\n return key !== undefined ? map.get(key) : undefined\n}\n\nconst getElementDisplayName = (element?: ReactElement) => {\n return element ? (element.type as FC & { displayName?: string }).displayName : ''\n}\n\nexport const getOrderedItems = (\n children: ReactNode,\n result: DropdownItem[] = []\n): DropdownItem[] => {\n Children.forEach(children, child => {\n if (!isValidElement(child)) return\n\n if (getElementDisplayName(child) === 'Dropdown.Item') {\n const childProps = child.props as ItemProps\n result.push({\n value: childProps.value,\n disabled: !!childProps.disabled,\n text: getItemText(childProps.children),\n })\n }\n\n if ((child.props as { children: ReactNode }).children) {\n getOrderedItems((child.props as { children: ReactNode }).children, result)\n }\n })\n\n return result\n}\n\n/**\n * If Dropdown.Item children:\n * - is a string, then the string is used.\n * - is JSX markup, then we look for Dropdown.ItemText to get its string value.\n */\nexport const getItemText = (children: ReactNode, itemText = ''): string => {\n if (typeof children === 'string') {\n return children\n }\n\n Children.forEach(children, child => {\n if (!isValidElement(child)) return\n\n if (getElementDisplayName(child) === 'Dropdown.ItemText') {\n itemText = (child.props as ItemTextProps).children\n }\n\n if ((child.props as { children: ReactNode }).children) {\n getItemText((child.props as { children: ReactNode }).children, itemText)\n }\n })\n\n return itemText\n}\n\nexport const getItemsFromChildren = (children: ReactNode): ItemsMap => {\n const newMap: ItemsMap = new Map()\n\n getOrderedItems(children).forEach(itemData => {\n newMap.set(itemData.value, itemData)\n })\n\n return newMap\n}\n\nexport const hasChildComponent = (children: ReactNode, displayName: string): boolean => {\n return Children.toArray(children).some(child => {\n if (!isValidElement(child)) return false\n\n if (getElementDisplayName(child) === displayName) {\n return true\n } else if ((child.props as { children: ReactNode }).children) {\n return hasChildComponent((child.props as { children: ReactNode }).children, displayName)\n }\n\n return false\n })\n}\n","import { type DropdownContextProps, DropdownProvider } from './DropdownContext'\n\nexport type DropdownProps = DropdownContextProps\n\nexport const Dropdown = ({ children, ...props }: DropdownProps) => {\n return <DropdownProvider {...props}>{children}</DropdownProvider>\n}\n\nDropdown.displayName = 'Dropdown'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\ninterface DividerProps {\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Divider = ({ className, ref: forwardedRef }: DividerProps) => {\n return <div ref={forwardedRef} className={cx('my-md border-b-sm border-outline', className)} />\n}\n\nDivider.displayName = 'Dropdown.Divider'\n","import { cx } from 'class-variance-authority'\nimport { ReactNode, Ref } from 'react'\n\nimport { DropdownGroupProvider, useDropdownGroupContext } from './DropdownItemsGroupContext'\n\ninterface GroupProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Group = ({ children, ref: forwardedRef, ...props }: GroupProps) => {\n return (\n <DropdownGroupProvider>\n <GroupContent ref={forwardedRef} {...props}>\n {children}\n </GroupContent>\n </DropdownGroupProvider>\n )\n}\n\nconst GroupContent = ({ children, className, ref: forwardedRef }: GroupProps) => {\n const { labelId } = useDropdownGroupContext()\n\n return (\n <div ref={forwardedRef} role=\"group\" aria-labelledby={labelId} className={cx(className)}>\n {children}\n </div>\n )\n}\n\nGroup.displayName = 'Dropdown.Group'\n","import { createContext, type PropsWithChildren, useContext, useId } from 'react'\n\nimport { ID_PREFIX } from './DropdownContext'\n\nexport interface DropdownContextState {\n labelId: string\n}\n\ntype DropdownContextProps = PropsWithChildren\n\nconst DropdownGroupContext = createContext<DropdownContextState | null>(null)\n\nexport const DropdownGroupProvider = ({ children }: DropdownContextProps) => {\n const labelId = `${ID_PREFIX}-group-label-${useId()}`\n\n return (\n <DropdownGroupContext.Provider value={{ labelId }}>{children}</DropdownGroupContext.Provider>\n )\n}\n\nexport const useDropdownGroupContext = () => {\n const context = useContext(DropdownGroupContext)\n\n if (!context) {\n throw Error('useDropdownGroupContext must be used within a DropdownGroup provider')\n }\n\n return context\n}\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cva, cx } from 'class-variance-authority'\nimport { type HTMLAttributes, type ReactNode, Ref } from 'react'\n\nimport { useDropdownContext } from './DropdownContext'\nimport { DropdownItemProvider, useDropdownItemContext } from './DropdownItemContext'\n\nexport interface ItemProps extends HTMLAttributes<HTMLLIElement> {\n disabled?: boolean\n value: string\n children: ReactNode\n className?: string\n ref?: Ref<HTMLLIElement>\n}\n\nexport const Item = ({ children, ref: forwardedRef, ...props }: ItemProps) => {\n const { value, disabled } = props\n\n return (\n <DropdownItemProvider value={value} disabled={disabled}>\n <ItemContent ref={forwardedRef} {...props}>\n {children}\n </ItemContent>\n </DropdownItemProvider>\n )\n}\n\nconst styles = cva('px-lg py-md text-body-1', {\n variants: {\n selected: {\n true: 'font-bold',\n },\n disabled: {\n true: 'opacity-dim-3 cursor-not-allowed',\n false: 'cursor-pointer',\n },\n highlighted: {\n true: '',\n },\n interactionType: {\n mouse: '',\n keyboard: '',\n },\n },\n compoundVariants: [\n {\n highlighted: true,\n interactionType: 'mouse',\n class: 'bg-surface-hovered',\n },\n {\n highlighted: true,\n interactionType: 'keyboard',\n class: 'u-outline',\n },\n ],\n})\n\nconst ItemContent = ({\n className,\n disabled = false,\n value,\n children,\n ref: forwardedRef,\n}: ItemProps) => {\n const { getItemProps, highlightedItem, lastInteractionType } = useDropdownContext()\n const { textId, index, itemData, isSelected } = useDropdownItemContext()\n\n const isHighlighted = highlightedItem?.value === value\n\n const { ref: downshiftRef, ...downshiftItemProps } = getItemProps({ item: itemData, index })\n const ref = useMergeRefs(forwardedRef, downshiftRef)\n\n return (\n <li\n ref={ref}\n className={cx(\n styles({\n selected: isSelected,\n disabled,\n highlighted: isHighlighted,\n interactionType: lastInteractionType,\n className,\n })\n )}\n key={value}\n {...downshiftItemProps}\n aria-selected={isSelected}\n aria-labelledby={textId}\n >\n {children}\n </li>\n )\n}\n\nItem.displayName = 'Dropdown.Item'\n","import {\n createContext,\n Dispatch,\n type PropsWithChildren,\n SetStateAction,\n useContext,\n useState,\n} from 'react'\n\nimport { useDropdownContext } from './DropdownContext'\nimport { DropdownItem } from './types'\nimport { getIndexByKey, getItemText } from './utils'\n\ntype ItemTextId = string | undefined\n\ninterface DropdownItemContextState {\n textId: ItemTextId\n setTextId: Dispatch<SetStateAction<ItemTextId>>\n isSelected: boolean\n itemData: DropdownItem\n index: number\n disabled: boolean\n}\n\nconst DropdownItemContext = createContext<DropdownItemContextState | null>(null)\n\nexport const DropdownItemProvider = ({\n value,\n disabled = false,\n children,\n}: PropsWithChildren<{ value: string; disabled?: boolean }>) => {\n const { multiple, itemsMap, selectedItem, selectedItems } = useDropdownContext()\n\n const [textId, setTextId] = useState<ItemTextId>(undefined)\n\n const index = getIndexByKey(itemsMap, value)\n const itemData: DropdownItem = { disabled, value, text: getItemText(children) }\n\n const isSelected = multiple\n ? selectedItems.some(selectedItem => selectedItem.value === value)\n : selectedItem?.value === value\n\n return (\n <DropdownItemContext.Provider\n value={{ textId, setTextId, isSelected, itemData, index, disabled }}\n >\n {children}\n </DropdownItemContext.Provider>\n )\n}\n\nexport const useDropdownItemContext = () => {\n const context = useContext(DropdownItemContext)\n\n if (!context) {\n throw Error('useDropdownItemContext must be used within a DropdownItem provider')\n }\n\n return context\n}\n","import { Check } from '@spark-ui/icons/Check'\nimport { cx } from 'class-variance-authority'\nimport { ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useDropdownItemContext } from './DropdownItemContext'\n\nexport interface ItemIndicatorProps {\n children?: ReactNode\n className?: string\n label?: string\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const ItemIndicator = ({\n className,\n children,\n label,\n ref: forwardedRef,\n}: ItemIndicatorProps) => {\n const { disabled, isSelected } = useDropdownItemContext()\n\n const childElement = children || (\n <Icon size=\"sm\">\n <Check aria-label={label} />\n </Icon>\n )\n\n return (\n <span\n ref={forwardedRef}\n className={cx('min-h-sz-16 min-w-sz-16 flex', disabled && 'opacity-dim-3', className)}\n >\n {isSelected && childElement}\n </span>\n )\n}\n\nItemIndicator.displayName = 'Dropdown.ItemIndicator'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { ReactNode, Ref, useLayoutEffect, useRef } from 'react'\n\nimport { useDropdownContext } from './DropdownContext'\n\ninterface ItemsProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLUListElement>\n}\n\n/**\n * BUGFIX\n *\n * 1. The !pointer-events-auto class is needed to prevent a bug\n * which cannot be reproduced when running Storybook locally,\n * in scenarios such as when a Dropdown is nested within a Dialog,\n * the \"props\" object, containing styles computed by Radix\n * may erroneously contain \"pointerEvents = 'none'\", while the Dropdown is open,\n * making it impossible to select a value using a pointer device\n */\n\nexport const Items = ({ children, className, ref: forwardedRef, ...props }: ItemsProps) => {\n const { isOpen, getMenuProps, hasPopover, setLastInteractionType } = useDropdownContext()\n\n const { ref: downshiftRef, ...downshiftMenuProps } = getMenuProps({\n onMouseMove: () => {\n setLastInteractionType('mouse')\n },\n })\n\n const innerRef = useRef<HTMLElement>(null)\n\n const ref = useMergeRefs(forwardedRef, downshiftRef, innerRef)\n\n useLayoutEffect(() => {\n if (!hasPopover) return\n if (!innerRef.current) return\n\n if (innerRef.current.parentElement) {\n innerRef.current.parentElement.style.pointerEvents = isOpen ? '' : 'none'\n innerRef.current.style.pointerEvents = isOpen ? '' : 'none'\n }\n }, [isOpen, hasPopover])\n\n return (\n <ul\n ref={ref}\n className={cx(\n className,\n 'flex flex-col',\n isOpen\n ? 'pointer-events-auto! block' /* 1 */\n : 'pointer-events-none invisible absolute opacity-0',\n hasPopover && 'p-lg'\n )}\n {...props}\n {...downshiftMenuProps}\n /**\n * When used inside a Radix dialog/drawer, the focus trap behaviour of Radix prevent scrolling and hovering inside absolutely positioned elements in the dialog.\n * It does programatically in JS using the `style` attribute.\n *\n * Issue is known but there is no clear fix in sight: https://github.com/radix-ui/primitives/issues/1159\n *\n * A solution would be to make an abstraction of `Dialog.Overlay` instead of using the radix one, but that would mean managing body scroll freeze and scrollbar shifting ourselves.\n *\n */\n data-spark-component=\"dropdown-items\"\n >\n {children}\n </ul>\n )\n}\n\nItems.displayName = 'Dropdown.Items'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useEffect, useId } from 'react'\n\nimport { ID_PREFIX } from './DropdownContext'\nimport { useDropdownItemContext } from './DropdownItemContext'\n\nexport interface ItemTextProps {\n children: string\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const ItemText = ({ children, ref: forwardedRef }: ItemTextProps) => {\n const id = `${ID_PREFIX}-item-text-${useId()}`\n\n const { setTextId } = useDropdownItemContext()\n\n useEffect(() => {\n setTextId(id)\n\n return () => setTextId(undefined)\n })\n\n return (\n <span id={id} className={cx('inline')} ref={forwardedRef}>\n {children}\n </span>\n )\n}\n\nItemText.displayName = 'Dropdown.ItemText'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { useDropdownGroupContext } from './DropdownItemsGroupContext'\n\ninterface LabelProps {\n children: string\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Label = ({ children, className, ref: forwardedRef }: LabelProps) => {\n const { labelId } = useDropdownGroupContext()\n\n return (\n <div\n ref={forwardedRef}\n id={labelId}\n className={cx('px-md py-sm text-body-2 text-neutral italic', className)}\n >\n {children}\n </div>\n )\n}\n\nLabel.displayName = 'Dropdown.Label'\n","import { ReactElement } from 'react'\n\nimport { Icon } from '../icon'\n\nexport const LeadingIcon = ({ children }: { children: ReactElement }) => {\n return (\n <Icon size={'sm'} className=\"shrink-0\">\n {children}\n </Icon>\n )\n}\n\nLeadingIcon.displayName = 'Dropdown.LeadingIcon'\n","import { cx } from 'class-variance-authority'\nimport { ComponentProps, useEffect } from 'react'\n\nimport { Popover as SparkPopover } from '../popover'\nimport { useDropdownContext } from './DropdownContext'\n\nexport const Popover = ({\n children,\n matchTriggerWidth = true,\n sideOffset = 4,\n className,\n elevation = 'dropdown',\n ref: forwardedRef,\n ...props\n}: ComponentProps<typeof SparkPopover.Content>) => {\n const ctx = useDropdownContext()\n\n useEffect(() => {\n ctx.setHasPopover(true)\n\n return () => ctx.setHasPopover(false)\n }, [])\n\n return (\n <SparkPopover.Content\n ref={forwardedRef}\n inset\n asChild\n matchTriggerWidth={matchTriggerWidth}\n elevation={elevation}\n className={cx('relative', className)}\n sideOffset={sideOffset}\n onOpenAutoFocus={e => {\n /**\n * With a combobox pattern, the focus should remain on the trigger at all times.\n * Passing the focus to the dropdown popover would break keyboard navigation.\n */\n e.preventDefault()\n }}\n {...props}\n data-spark-component=\"dropdown-popover\"\n >\n {children}\n </SparkPopover.Content>\n )\n}\n\nPopover.displayName = 'Dropdown.Popover'\n","import { ReactElement } from 'react'\n\nimport { Popover as SparkPopover } from '../popover'\n\nexport const Portal: typeof SparkPopover.Portal = ({ children, ...rest }): ReactElement => (\n <SparkPopover.Portal {...rest}>{children}</SparkPopover.Portal>\n)\n\nPortal.displayName = 'Dropdown.Portal'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { ArrowHorizontalDown } from '@spark-ui/icons/ArrowHorizontalDown'\nimport { cx } from 'class-variance-authority'\nimport { Fragment, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { Popover } from '../popover'\nimport { VisuallyHidden } from '../visually-hidden'\nimport { useDropdownContext } from './DropdownContext'\nimport { styles } from './DropdownTrigger.styles'\n\ninterface TriggerProps {\n 'aria-label'?: string\n children: ReactNode\n className?: string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Trigger = ({\n 'aria-label': ariaLabel,\n children,\n className,\n ref: forwardedRef,\n}: TriggerProps) => {\n const {\n getToggleButtonProps,\n getDropdownProps,\n getLabelProps,\n hasPopover,\n disabled,\n readOnly,\n state,\n setLastInteractionType,\n } = useDropdownContext()\n\n const [WrapperComponent, wrapperProps] = hasPopover\n ? [Popover.Trigger, { asChild: true }]\n : [Fragment, {}]\n\n const { ref: downshiftRef, ...downshiftTriggerProps } = getToggleButtonProps({\n ...getDropdownProps(),\n onKeyDown: () => {\n setLastInteractionType('keyboard')\n },\n })\n\n const isExpanded = downshiftTriggerProps['aria-expanded']\n\n const ref = useMergeRefs(forwardedRef, downshiftRef)\n\n return (\n <>\n {ariaLabel && (\n <VisuallyHidden>\n <label {...getLabelProps()}>{ariaLabel}</label>\n </VisuallyHidden>\n )}\n <WrapperComponent {...wrapperProps}>\n <button\n type=\"button\"\n ref={ref}\n disabled={disabled || readOnly}\n className={styles({ className, state, disabled, readOnly })}\n {...downshiftTriggerProps}\n data-spark-component=\"dropdown-trigger\"\n >\n <span className=\"gap-md flex items-center justify-start\">{children}</span>\n\n <Icon\n className={cx('ml-md shrink-0 rotate-0 transition duration-100 ease-in', {\n 'rotate-180': isExpanded,\n })}\n size=\"sm\"\n >\n <ArrowHorizontalDown />\n </Icon>\n </button>\n </WrapperComponent>\n </>\n )\n}\n\nTrigger.displayName = 'Dropdown.Trigger'\n","import { cva } from 'class-variance-authority'\n\nexport const styles = cva(\n [\n 'flex w-full items-center justify-between',\n 'min-h-sz-44 rounded-lg bg-surface text-on-surface px-lg',\n 'text-body-1',\n // outline styles\n 'ring-1 outline-hidden ring-inset focus:ring-2',\n ],\n {\n variants: {\n state: {\n undefined: 'ring-outline focus:ring-outline-high',\n error: 'ring-error',\n alert: 'ring-alert',\n success: 'ring-success',\n },\n disabled: {\n true: 'disabled:bg-on-surface/dim-5 cursor-not-allowed text-on-surface/dim-3',\n },\n readOnly: {\n true: 'disabled:bg-on-surface/dim-5 cursor-not-allowed text-on-surface/dim-3',\n },\n },\n compoundVariants: [\n {\n disabled: false,\n state: undefined,\n class: 'hover:ring-outline-high',\n },\n ],\n }\n)\n","import { cx } from 'class-variance-authority'\nimport { ReactNode, Ref } from 'react'\n\nimport { useDropdownContext } from './DropdownContext'\n\nexport interface ValueProps {\n children?: ReactNode\n className?: string\n placeholder: string\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const Value = ({ children, className, placeholder, ref: forwardedRef }: ValueProps) => {\n const { selectedItem, multiple, selectedItems } = useDropdownContext()\n\n const hasSelectedItems = !!(multiple ? selectedItems.length : selectedItem)\n const text = multiple ? selectedItems[0]?.text : selectedItem?.text\n const suffix = selectedItems.length > 1 ? `, +${selectedItems.length - 1}` : ''\n\n return (\n <span ref={forwardedRef} className={cx('flex shrink items-center text-left', className)}>\n <span\n className={cx(\n 'line-clamp-1 flex-1 overflow-hidden break-all text-ellipsis',\n !hasSelectedItems && 'text-on-surface/dim-1'\n )}\n >\n {!hasSelectedItems ? placeholder : children || text}\n </span>\n {suffix && <span>{suffix}</span>}\n </span>\n )\n}\n\nValue.displayName = 'Dropdown.Value'\n","import { Dropdown as Root } from './Dropdown'\nimport { DropdownProvider, useDropdownContext } from './DropdownContext'\nimport { Divider } from './DropdownDivider'\nimport { Group } from './DropdownGroup'\nimport { Item } from './DropdownItem'\nimport { ItemIndicator } from './DropdownItemIndicator'\nimport { Items } from './DropdownItems'\nimport { ItemText } from './DropdownItemText'\nimport { Label } from './DropdownLabel'\nimport { LeadingIcon } from './DropdownLeadingIcon'\nimport { Popover } from './DropdownPopover'\nimport { Portal } from './DropdownPortal'\nimport { Trigger } from './DropdownTrigger'\nimport { Value } from './DropdownValue'\n\nexport { useDropdownContext, DropdownProvider }\n\nexport const Dropdown: typeof Root & {\n Group: typeof Group\n Item: typeof Item\n Items: typeof Items\n ItemText: typeof ItemText\n ItemIndicator: typeof ItemIndicator\n Label: typeof Label\n Popover: typeof Popover\n Divider: typeof Divider\n Trigger: typeof Trigger\n Value: typeof Value\n LeadingIcon: typeof LeadingIcon\n Portal: typeof Portal\n} = Object.assign(Root, {\n Group,\n Item,\n Items,\n ItemText,\n ItemIndicator,\n Label,\n Popover,\n Divider,\n Trigger,\n Value,\n LeadingIcon,\n Portal,\n})\n\nDropdown.displayName = 'Dropdown'\nGroup.displayName = 'Dropdown.Group'\nItems.displayName = 'Dropdown.Items'\nItem.displayName = 'Dropdown.Item'\nItemText.displayName = 'Dropdown.ItemText'\nItemIndicator.displayName = 'Dropdown.ItemIndicator'\nLabel.displayName = 'Dropdown.Label'\nPopover.displayName = 'Dropdown.Popover'\nDivider.displayName = 'Dropdown.Divider'\nTrigger.displayName = 'Dropdown.Trigger'\nValue.displayName = 'Dropdown.Value'\nLeadingIcon.displayName = 'Dropdown.LeadingIcon'\nPortal.displayName = 'Dropdown.Portal'\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EAEA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACXP,SAAS,sBAAsB,iBAAiC;AAsBzD,IAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAsB;AACpB,QAAM,QAAQ,CAAC,GAAG,SAAS,OAAO,CAAC;AAEnC,QAAM,6BAA6B,qBAAmC;AAAA,IACpE,eACE,SAAS,QAAQ,WACb,MAAM;AAAA,MAAO,UACX,WAAY,MAAmB,SAAS,KAAK,KAAK,IAAI,UAAU,KAAK;AAAA,IACvE,IACA;AAAA,IACN,sBACE,gBAAgB,QAAQ,WACpB,MAAM;AAAA,MAAO,UACX,WAAY,aAA0B,SAAS,KAAK,KAAK,IAAI,iBAAiB,KAAK;AAAA,IACrF,IACA;AAAA,IAEN,uBAAuB,CAAC,EAAE,cAAc,MAAM;AAC5C,UAAI,iBAAiB,QAAQ,UAAU;AACrC,wBAAgB,cAAc,IAAI,UAAQ,KAAK,KAAK,CAAsB;AAAA,MAC5E;AAAA,IACF;AAAA,EACF,CAAC;AAQD,QAAM,eAA6D,CAAC,OAAO,EAAE,SAAS,KAAK,MAAM;AAC/F,QAAI,CAAC,SAAU,QAAO;AAEtB,UAAM,EAAE,eAAe,oBAAoB,gBAAgB,IAAI;AAG/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cAAc;","names":["jsx","jsx","cx","createContext","useContext","useId","jsx","createContext","useId","useContext","jsx","cx","cx","createContext","useContext","useState","jsx","createContext","useState","selectedItem","useContext","jsx","cx","cx","jsx","cx","useMergeRefs","cx","jsx","useMergeRefs","cx","cx","useEffect","useId","jsx","useId","useEffect","cx","cx","jsx","cx","jsx","cx","useEffect","jsx","Popover","useEffect","cx","jsx","useMergeRefs","cx","Fragment","cva","styles","Fragment","jsx","useMergeRefs","styles","cx","cx","jsx","jsxs","cx","Dropdown","Popover"]}
1
+ {"version":3,"sources":["../../src/dropdown/DropdownContext.tsx","../../src/dropdown/useDropdown.ts","../../src/dropdown/utils.ts","../../src/dropdown/Dropdown.tsx","../../src/dropdown/DropdownDivider.tsx","../../src/dropdown/DropdownGroup.tsx","../../src/dropdown/DropdownItemsGroupContext.tsx","../../src/dropdown/DropdownItem.tsx","../../src/dropdown/DropdownItemContext.tsx","../../src/dropdown/DropdownItemIndicator.tsx","../../src/dropdown/DropdownItems.tsx","../../src/dropdown/DropdownItemText.tsx","../../src/dropdown/DropdownLabel.tsx","../../src/dropdown/DropdownLeadingIcon.tsx","../../src/dropdown/DropdownPopover.tsx","../../src/dropdown/DropdownPortal.tsx","../../src/dropdown/DropdownTrigger.tsx","../../src/dropdown/DropdownTrigger.styles.tsx","../../src/dropdown/DropdownValue.tsx","../../src/dropdown/index.ts"],"sourcesContent":["import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport {\n createContext,\n Dispatch,\n Fragment,\n PropsWithChildren,\n SetStateAction,\n useContext,\n useEffect,\n useId,\n useState,\n} from 'react'\n\nimport { Popover } from '../popover'\nimport { type DownshiftState, type DropdownItem, type ItemsMap } from './types'\nimport { useDropdown } from './useDropdown'\nimport { getElementByIndex, getItemsFromChildren, hasChildComponent } from './utils'\n\nexport interface DropdownContextState extends DownshiftState {\n itemsMap: ItemsMap\n highlightedItem: DropdownItem | undefined\n hasPopover: boolean\n setHasPopover: Dispatch<SetStateAction<boolean>>\n multiple: boolean\n disabled: boolean\n readOnly: boolean\n state?: 'error' | 'alert' | 'success'\n lastInteractionType: 'mouse' | 'keyboard'\n setLastInteractionType: (type: 'mouse' | 'keyboard') => void\n}\n\nexport type DropdownContextCommonProps = PropsWithChildren<{\n /**\n * The controlled open state of the select. Must be used in conjunction with `onOpenChange`.\n */\n open?: boolean\n /**\n * Event handler called when the open state of the select changes.\n */\n onOpenChange?: (isOpen: boolean) => void\n /**\n * The open state of the select when it is initially rendered. Use when you do not need to control its open state.\n */\n defaultOpen?: boolean\n /**\n * Use `state` prop to assign a specific state to the dropdown, choosing from: `error`, `alert` and `success`. By doing so, the outline styles will be updated.\n */\n state?: 'error' | 'alert' | 'success'\n /**\n * When true, prevents the user from interacting with the dropdown.\n */\n disabled?: boolean\n /**\n * Sets the dropdown as interactive or not.\n */\n readOnly?: boolean\n}>\n\ninterface DropdownPropsSingle {\n /**\n * Prop 'multiple' indicating whether multiple values are allowed.\n */\n multiple?: false\n /**\n * The value of the select when initially rendered. Use when you do not need to control the state of the select.\n */\n defaultValue?: string\n /**\n * The controlled value of the select. Should be used in conjunction with `onValueChange`.\n */\n value?: string\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n}\n\ninterface DropdownPropsMultiple {\n /**\n * Prop 'multiple' indicating whether multiple values are allowed.\n */\n multiple: true\n /**\n * The value of the select when initially rendered. Use when you do not need to control the state of the select.\n */\n defaultValue?: string[]\n /**\n * The controlled value of the select. Should be used in conjunction with `onValueChange`.\n */\n value?: string[]\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string[]) => void\n}\n\nexport type DropdownContextProps = DropdownContextCommonProps &\n (DropdownPropsSingle | DropdownPropsMultiple)\n\nconst DropdownContext = createContext<DropdownContextState | null>(null)\n\nexport const ID_PREFIX = ':dropdown'\n\nexport const DropdownProvider = ({\n children,\n defaultValue,\n value,\n onValueChange,\n open,\n onOpenChange,\n defaultOpen,\n multiple = false,\n disabled: disabledProp = false,\n readOnly: readOnlyProp = false,\n state: stateProp,\n}: DropdownContextProps) => {\n const [itemsMap, setItemsMap] = useState<ItemsMap>(getItemsFromChildren(children))\n const [hasPopover, setHasPopover] = useState<boolean>(\n hasChildComponent(children, 'Dropdown.Popover')\n )\n const [lastInteractionType, setLastInteractionType] = useState<'mouse' | 'keyboard'>('mouse')\n\n const field = useFormFieldControl()\n\n const state = field.state || stateProp\n\n const internalFieldLabelID = `${ID_PREFIX}-label-${useId()}`\n const internalFieldID = `${ID_PREFIX}-input-${useId()}`\n const id = field.id || internalFieldID\n const labelId = field.labelId || internalFieldLabelID\n\n const disabled = field.disabled ?? disabledProp\n const readOnly = field.readOnly ?? readOnlyProp\n\n const dropdownState = useDropdown({\n itemsMap,\n defaultValue,\n value,\n onValueChange,\n open,\n onOpenChange,\n defaultOpen,\n multiple,\n id,\n labelId,\n })\n\n /**\n * Indices in a Map are set when an element is added to the Map.\n * If for some reason, in the Dropdown:\n * - items order changes\n * - items are added\n * - items are removed\n *\n * The Map must be rebuilt from the new children in order to preserve logical indices.\n *\n * Downshift is heavily indices based for keyboard navigation, so it it important.\n */\n useEffect(() => {\n const newMap = getItemsFromChildren(children)\n\n const previousItems = [...itemsMap.values()]\n const newItems = [...newMap.values()]\n\n const hasItemsChanges =\n previousItems.length !== newItems.length ||\n previousItems.some((item, index) => {\n const hasUpdatedValue = item.value !== newItems[index]?.value\n const hasUpdatedText = item.text !== newItems[index]?.text\n\n return hasUpdatedValue || hasUpdatedText\n })\n\n if (hasItemsChanges) {\n setItemsMap(newMap)\n }\n }, [children])\n\n /**\n * Warning:\n * Downshift is expecting the items list to always be rendered, as per a11y guidelines.\n * This is why the `Popover` is always opened in this component, but visually hidden instead from Dropdown.Popover.\n */\n const [WrapperComponent, wrapperProps] = hasPopover ? [Popover, { open: true }] : [Fragment, {}]\n\n return (\n <DropdownContext.Provider\n value={{\n multiple,\n disabled,\n readOnly,\n ...dropdownState,\n itemsMap,\n highlightedItem: getElementByIndex(itemsMap, dropdownState.highlightedIndex),\n hasPopover,\n setHasPopover,\n state,\n lastInteractionType,\n setLastInteractionType,\n }}\n >\n <WrapperComponent {...wrapperProps}>{children}</WrapperComponent>\n </DropdownContext.Provider>\n )\n}\n\nexport const useDropdownContext = () => {\n const context = useContext(DropdownContext)\n\n if (!context) {\n throw Error('useDropdownContext must be used within a Dropdown provider')\n }\n\n return context\n}\n","import { useMultipleSelection, useSelect, UseSelectProps } from 'downshift'\n\nimport { type DropdownItem, type ItemsMap } from './types'\n\ntype OnChangeValueType = string & string[]\n\nexport interface DownshiftProps {\n itemsMap: ItemsMap\n value: string | string[] | undefined\n defaultValue: string | string[] | undefined\n onValueChange: ((value: string) => void) | ((value: string[]) => void) | undefined\n open: boolean | undefined\n onOpenChange: ((isOpen: boolean) => void) | undefined\n defaultOpen: boolean | undefined\n multiple: boolean | undefined\n id: string\n labelId: string\n}\n\n/**\n * This hook abstract the complexity of using downshift with both single and multiple selection.\n */\nexport const useDropdown = ({\n itemsMap,\n defaultValue,\n value,\n onValueChange,\n open,\n onOpenChange,\n defaultOpen,\n multiple,\n id,\n labelId,\n}: DownshiftProps) => {\n const items = [...itemsMap.values()]\n\n const downshiftMultipleSelection = useMultipleSelection<DropdownItem>({\n selectedItems:\n value != null && multiple\n ? items.filter(item =>\n multiple ? (value as string[]).includes(item.value) : value === item.value\n )\n : undefined,\n initialSelectedItems:\n defaultValue != null && multiple\n ? items.filter(item =>\n multiple ? (defaultValue as string[]).includes(item.value) : defaultValue === item.value\n )\n : undefined,\n\n onSelectedItemsChange: ({ selectedItems }) => {\n if (selectedItems != null && multiple) {\n onValueChange?.(selectedItems.map(item => item.value) as OnChangeValueType)\n }\n },\n })\n\n /**\n * Custom state reducer for multiple selection behaviour:\n * - keeps the component opened when the user selects an item\n * - preserves the higlighted index when the user select an item\n * - selected items can be unselected, even the last selected item (as opposed to single selection behaviour)\n */\n const stateReducer: UseSelectProps<DropdownItem>['stateReducer'] = (state, { changes, type }) => {\n if (!multiple) return changes\n\n const { selectedItems, removeSelectedItem, addSelectedItem } = downshiftMultipleSelection\n\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check\n switch (type) {\n case useSelect.stateChangeTypes.ToggleButtonKeyDownEnter:\n case useSelect.stateChangeTypes.ToggleButtonKeyDownSpaceButton:\n case useSelect.stateChangeTypes.ItemClick:\n if (changes.selectedItem != null) {\n const isAlreadySelected = selectedItems.some(\n selectedItem => selectedItem.value === changes.selectedItem?.value\n )\n\n if (isAlreadySelected) removeSelectedItem(changes.selectedItem)\n else addSelectedItem(changes.selectedItem)\n }\n\n return {\n ...changes,\n isOpen: true, // keep the menu open after selection.\n highlightedIndex: state.highlightedIndex, // preserve highlighted index position\n }\n default:\n return changes\n }\n }\n\n const downshift = useSelect<DropdownItem>({\n items,\n isItemDisabled: item => item.disabled,\n itemToString: item => (item ? item.text : ''),\n // a11y attributes\n id,\n labelId,\n // Controlled open state\n isOpen: open, // undefined must be passed for stateful behaviour (uncontrolled)\n onIsOpenChange: ({ isOpen }) => {\n if (isOpen != null) onOpenChange?.(isOpen)\n },\n initialIsOpen: defaultOpen ?? false,\n stateReducer,\n // Controlled mode (single selection)\n selectedItem: value != null && !multiple ? itemsMap.get(value as string) || null : undefined,\n initialSelectedItem:\n (defaultValue != null || value != null) && !multiple\n ? itemsMap.get(defaultValue as string) || null\n : undefined,\n onSelectedItemChange: ({ selectedItem }) => {\n if (selectedItem?.value != null && !multiple) {\n onValueChange?.(selectedItem?.value as OnChangeValueType)\n }\n },\n /**\n * 1. Downshift default behaviour is to scroll into view the highlighted item when the dropdown opens. This behaviour is not stable and scrolls the dropdown to the bottom of the screen.\n */\n scrollIntoView: node => {\n if (node) {\n node.scrollIntoView({ block: 'nearest' })\n }\n\n return undefined\n },\n })\n\n return {\n ...downshift,\n ...downshiftMultipleSelection,\n /** There is a Downshift bug in React 19, it duplicates some selectedItems */\n selectedItems: [...new Set(downshiftMultipleSelection.selectedItems)],\n }\n}\n","import { type FC, isValidElement, type ReactElement, type ReactNode, Children } from 'react'\n\nimport { type ItemProps } from './DropdownItem'\nimport { ItemTextProps } from './DropdownItemText'\nimport { type DropdownItem, type ItemsMap } from './types'\n\nexport function getIndexByKey(map: ItemsMap, targetKey: string) {\n let index = 0\n for (const [key] of map.entries()) {\n if (key === targetKey) {\n return index\n }\n index++\n }\n\n return -1\n}\n\nconst getKeyAtIndex = (map: ItemsMap, index: number) => {\n let i = 0\n for (const key of map.keys()) {\n if (i === index) return key\n i++\n }\n\n return undefined\n}\n\nexport const getElementByIndex = (map: ItemsMap, index: number) => {\n const key = getKeyAtIndex(map, index)\n\n return key !== undefined ? map.get(key) : undefined\n}\n\nconst getElementDisplayName = (element?: ReactElement) => {\n return element ? (element.type as FC & { displayName?: string }).displayName : ''\n}\n\nexport const getOrderedItems = (\n children: ReactNode,\n result: DropdownItem[] = []\n): DropdownItem[] => {\n Children.forEach(children, child => {\n if (!isValidElement(child)) return\n\n if (getElementDisplayName(child) === 'Dropdown.Item') {\n const childProps = child.props as ItemProps\n result.push({\n value: childProps.value,\n disabled: !!childProps.disabled,\n text: getItemText(childProps.children),\n })\n }\n\n if ((child.props as { children: ReactNode }).children) {\n getOrderedItems((child.props as { children: ReactNode }).children, result)\n }\n })\n\n return result\n}\n\n/**\n * If Dropdown.Item children:\n * - is a string, then the string is used.\n * - is JSX markup, then we look for Dropdown.ItemText to get its string value.\n */\nexport const getItemText = (children: ReactNode, itemText = ''): string => {\n if (typeof children === 'string') {\n return children\n }\n\n Children.forEach(children, child => {\n if (!isValidElement(child)) return\n\n if (getElementDisplayName(child) === 'Dropdown.ItemText') {\n itemText = (child.props as ItemTextProps).children\n }\n\n if ((child.props as { children: ReactNode }).children) {\n getItemText((child.props as { children: ReactNode }).children, itemText)\n }\n })\n\n return itemText\n}\n\nexport const getItemsFromChildren = (children: ReactNode): ItemsMap => {\n const newMap: ItemsMap = new Map()\n\n getOrderedItems(children).forEach(itemData => {\n newMap.set(itemData.value, itemData)\n })\n\n return newMap\n}\n\nexport const hasChildComponent = (children: ReactNode, displayName: string): boolean => {\n return Children.toArray(children).some(child => {\n if (!isValidElement(child)) return false\n\n if (getElementDisplayName(child) === displayName) {\n return true\n } else if ((child.props as { children: ReactNode }).children) {\n return hasChildComponent((child.props as { children: ReactNode }).children, displayName)\n }\n\n return false\n })\n}\n","import { type DropdownContextProps, DropdownProvider } from './DropdownContext'\n\nexport type DropdownProps = DropdownContextProps\n\nexport const Dropdown = ({ children, ...props }: DropdownProps) => {\n return <DropdownProvider {...props}>{children}</DropdownProvider>\n}\n\nDropdown.displayName = 'Dropdown'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\ninterface DividerProps {\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Divider = ({ className, ref: forwardedRef }: DividerProps) => {\n return <div ref={forwardedRef} className={cx('my-md border-b-sm border-outline', className)} />\n}\n\nDivider.displayName = 'Dropdown.Divider'\n","import { cx } from 'class-variance-authority'\nimport { ReactNode, Ref } from 'react'\n\nimport { DropdownGroupProvider, useDropdownGroupContext } from './DropdownItemsGroupContext'\n\ninterface GroupProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Group = ({ children, ref: forwardedRef, ...props }: GroupProps) => {\n return (\n <DropdownGroupProvider>\n <GroupContent ref={forwardedRef} {...props}>\n {children}\n </GroupContent>\n </DropdownGroupProvider>\n )\n}\n\nconst GroupContent = ({ children, className, ref: forwardedRef }: GroupProps) => {\n const { labelId } = useDropdownGroupContext()\n\n return (\n <div ref={forwardedRef} role=\"group\" aria-labelledby={labelId} className={cx(className)}>\n {children}\n </div>\n )\n}\n\nGroup.displayName = 'Dropdown.Group'\n","import { createContext, type PropsWithChildren, useContext, useId } from 'react'\n\nimport { ID_PREFIX } from './DropdownContext'\n\nexport interface DropdownContextState {\n labelId: string\n}\n\ntype DropdownContextProps = PropsWithChildren\n\nconst DropdownGroupContext = createContext<DropdownContextState | null>(null)\n\nexport const DropdownGroupProvider = ({ children }: DropdownContextProps) => {\n const labelId = `${ID_PREFIX}-group-label-${useId()}`\n\n return (\n <DropdownGroupContext.Provider value={{ labelId }}>{children}</DropdownGroupContext.Provider>\n )\n}\n\nexport const useDropdownGroupContext = () => {\n const context = useContext(DropdownGroupContext)\n\n if (!context) {\n throw Error('useDropdownGroupContext must be used within a DropdownGroup provider')\n }\n\n return context\n}\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cva, cx } from 'class-variance-authority'\nimport { type HTMLAttributes, type ReactNode, Ref } from 'react'\n\nimport { useDropdownContext } from './DropdownContext'\nimport { DropdownItemProvider, useDropdownItemContext } from './DropdownItemContext'\n\nexport interface ItemProps extends HTMLAttributes<HTMLLIElement> {\n disabled?: boolean\n value: string\n children: ReactNode\n className?: string\n ref?: Ref<HTMLLIElement>\n}\n\nexport const Item = ({ children, ref: forwardedRef, ...props }: ItemProps) => {\n const { value, disabled } = props\n\n return (\n <DropdownItemProvider value={value} disabled={disabled}>\n <ItemContent ref={forwardedRef} {...props}>\n {children}\n </ItemContent>\n </DropdownItemProvider>\n )\n}\n\nconst styles = cva('px-lg py-md text-body-1', {\n variants: {\n selected: {\n true: 'font-bold',\n },\n disabled: {\n true: 'opacity-dim-3 cursor-not-allowed',\n false: 'cursor-pointer',\n },\n highlighted: {\n true: '',\n },\n interactionType: {\n mouse: '',\n keyboard: '',\n },\n },\n compoundVariants: [\n {\n highlighted: true,\n interactionType: 'mouse',\n class: 'bg-surface-hovered',\n },\n {\n highlighted: true,\n interactionType: 'keyboard',\n class: 'u-outline',\n },\n ],\n})\n\nconst ItemContent = ({\n className,\n disabled = false,\n value,\n children,\n ref: forwardedRef,\n}: ItemProps) => {\n const { getItemProps, highlightedItem, lastInteractionType } = useDropdownContext()\n const { textId, index, itemData, isSelected } = useDropdownItemContext()\n\n const isHighlighted = highlightedItem?.value === value\n\n const { ref: downshiftRef, ...downshiftItemProps } = getItemProps({ item: itemData, index })\n const ref = useMergeRefs(forwardedRef, downshiftRef)\n\n return (\n <li\n ref={ref}\n className={cx(\n styles({\n selected: isSelected,\n disabled,\n highlighted: isHighlighted,\n interactionType: lastInteractionType,\n className,\n })\n )}\n key={value}\n {...downshiftItemProps}\n aria-selected={isSelected}\n aria-labelledby={textId}\n >\n {children}\n </li>\n )\n}\n\nItem.displayName = 'Dropdown.Item'\n","import {\n createContext,\n Dispatch,\n type PropsWithChildren,\n SetStateAction,\n useContext,\n useState,\n} from 'react'\n\nimport { useDropdownContext } from './DropdownContext'\nimport { DropdownItem } from './types'\nimport { getIndexByKey, getItemText } from './utils'\n\ntype ItemTextId = string | undefined\n\ninterface DropdownItemContextState {\n textId: ItemTextId\n setTextId: Dispatch<SetStateAction<ItemTextId>>\n isSelected: boolean\n itemData: DropdownItem\n index: number\n disabled: boolean\n}\n\nconst DropdownItemContext = createContext<DropdownItemContextState | null>(null)\n\nexport const DropdownItemProvider = ({\n value,\n disabled = false,\n children,\n}: PropsWithChildren<{ value: string; disabled?: boolean }>) => {\n const { multiple, itemsMap, selectedItem, selectedItems } = useDropdownContext()\n\n const [textId, setTextId] = useState<ItemTextId>(undefined)\n\n const index = getIndexByKey(itemsMap, value)\n const itemData: DropdownItem = { disabled, value, text: getItemText(children) }\n\n const isSelected = multiple\n ? selectedItems.some(selectedItem => selectedItem.value === value)\n : selectedItem?.value === value\n\n return (\n <DropdownItemContext.Provider\n value={{ textId, setTextId, isSelected, itemData, index, disabled }}\n >\n {children}\n </DropdownItemContext.Provider>\n )\n}\n\nexport const useDropdownItemContext = () => {\n const context = useContext(DropdownItemContext)\n\n if (!context) {\n throw Error('useDropdownItemContext must be used within a DropdownItem provider')\n }\n\n return context\n}\n","import { Check } from '@spark-ui/icons/Check'\nimport { cx } from 'class-variance-authority'\nimport { ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useDropdownItemContext } from './DropdownItemContext'\n\nexport interface ItemIndicatorProps {\n children?: ReactNode\n className?: string\n label?: string\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const ItemIndicator = ({\n className,\n children,\n label,\n ref: forwardedRef,\n}: ItemIndicatorProps) => {\n const { disabled, isSelected } = useDropdownItemContext()\n\n const childElement = children || (\n <Icon size=\"sm\">\n <Check aria-label={label} />\n </Icon>\n )\n\n return (\n <span\n ref={forwardedRef}\n className={cx('min-h-sz-16 min-w-sz-16 flex', disabled && 'opacity-dim-3', className)}\n >\n {isSelected && childElement}\n </span>\n )\n}\n\nItemIndicator.displayName = 'Dropdown.ItemIndicator'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { ReactNode, Ref, useLayoutEffect, useRef } from 'react'\n\nimport { useDropdownContext } from './DropdownContext'\n\ninterface ItemsProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLUListElement>\n}\n\n/**\n * BUGFIX\n *\n * 1. The !pointer-events-auto class is needed to prevent a bug\n * which cannot be reproduced when running Storybook locally,\n * in scenarios such as when a Dropdown is nested within a Dialog,\n * the \"props\" object, containing styles computed by Radix\n * may erroneously contain \"pointerEvents = 'none'\", while the Dropdown is open,\n * making it impossible to select a value using a pointer device\n */\n\nexport const Items = ({ children, className, ref: forwardedRef, ...props }: ItemsProps) => {\n const { isOpen, getMenuProps, hasPopover, setLastInteractionType } = useDropdownContext()\n\n const { ref: downshiftRef, ...downshiftMenuProps } = getMenuProps({\n onMouseMove: () => {\n setLastInteractionType('mouse')\n },\n })\n\n const innerRef = useRef<HTMLElement>(null)\n\n const ref = useMergeRefs(forwardedRef, downshiftRef, innerRef)\n\n useLayoutEffect(() => {\n if (!hasPopover) return\n if (!innerRef.current) return\n\n if (innerRef.current.parentElement) {\n innerRef.current.parentElement.style.pointerEvents = isOpen ? '' : 'none'\n innerRef.current.style.pointerEvents = isOpen ? '' : 'none'\n }\n }, [isOpen, hasPopover])\n\n return (\n <ul\n ref={ref}\n className={cx(\n className,\n 'flex flex-col',\n isOpen\n ? 'pointer-events-auto! block' /* 1 */\n : 'pointer-events-none invisible absolute opacity-0',\n hasPopover && 'p-lg'\n )}\n {...props}\n {...downshiftMenuProps}\n /**\n * When used inside a Radix dialog/drawer, the focus trap behaviour of Radix prevent scrolling and hovering inside absolutely positioned elements in the dialog.\n * It does programatically in JS using the `style` attribute.\n *\n * Issue is known but there is no clear fix in sight: https://github.com/radix-ui/primitives/issues/1159\n *\n * A solution would be to make an abstraction of `Dialog.Overlay` instead of using the radix one, but that would mean managing body scroll freeze and scrollbar shifting ourselves.\n *\n */\n data-spark-component=\"dropdown-items\"\n >\n {children}\n </ul>\n )\n}\n\nItems.displayName = 'Dropdown.Items'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useEffect, useId } from 'react'\n\nimport { ID_PREFIX } from './DropdownContext'\nimport { useDropdownItemContext } from './DropdownItemContext'\n\nexport interface ItemTextProps {\n children: string\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const ItemText = ({ children, ref: forwardedRef }: ItemTextProps) => {\n const id = `${ID_PREFIX}-item-text-${useId()}`\n\n const { setTextId } = useDropdownItemContext()\n\n useEffect(() => {\n setTextId(id)\n\n return () => setTextId(undefined)\n })\n\n return (\n <span id={id} className={cx('inline')} ref={forwardedRef}>\n {children}\n </span>\n )\n}\n\nItemText.displayName = 'Dropdown.ItemText'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { useDropdownGroupContext } from './DropdownItemsGroupContext'\n\ninterface LabelProps {\n children: string\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Label = ({ children, className, ref: forwardedRef }: LabelProps) => {\n const { labelId } = useDropdownGroupContext()\n\n return (\n <div\n ref={forwardedRef}\n id={labelId}\n className={cx('px-md py-sm text-body-2 text-neutral italic', className)}\n >\n {children}\n </div>\n )\n}\n\nLabel.displayName = 'Dropdown.Label'\n","import { ReactElement } from 'react'\n\nimport { Icon } from '../icon'\n\nexport const LeadingIcon = ({ children }: { children: ReactElement }) => {\n return (\n <Icon size={'sm'} className=\"shrink-0\">\n {children}\n </Icon>\n )\n}\n\nLeadingIcon.displayName = 'Dropdown.LeadingIcon'\n","import { cx } from 'class-variance-authority'\nimport { ComponentProps, useEffect } from 'react'\n\nimport { Popover as SparkPopover } from '../popover'\nimport { useDropdownContext } from './DropdownContext'\n\nexport const Popover = ({\n children,\n matchTriggerWidth = true,\n sideOffset = 4,\n className,\n elevation = 'dropdown',\n ref: forwardedRef,\n ...props\n}: ComponentProps<typeof SparkPopover.Content>) => {\n const ctx = useDropdownContext()\n\n useEffect(() => {\n ctx.setHasPopover(true)\n\n return () => ctx.setHasPopover(false)\n }, [])\n\n return (\n <SparkPopover.Content\n ref={forwardedRef}\n inset\n asChild\n matchTriggerWidth={matchTriggerWidth}\n elevation={elevation}\n className={cx('relative', className)}\n sideOffset={sideOffset}\n onOpenAutoFocus={e => {\n /**\n * With a combobox pattern, the focus should remain on the trigger at all times.\n * Passing the focus to the dropdown popover would break keyboard navigation.\n */\n e.preventDefault()\n }}\n {...props}\n data-spark-component=\"dropdown-popover\"\n >\n {children}\n </SparkPopover.Content>\n )\n}\n\nPopover.displayName = 'Dropdown.Popover'\n","import { ReactElement } from 'react'\n\nimport { Popover as SparkPopover } from '../popover'\n\nexport const Portal: typeof SparkPopover.Portal = ({ children, ...rest }): ReactElement => (\n <SparkPopover.Portal {...rest}>{children}</SparkPopover.Portal>\n)\n\nPortal.displayName = 'Dropdown.Portal'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { ArrowHorizontalDown } from '@spark-ui/icons/ArrowHorizontalDown'\nimport { cx } from 'class-variance-authority'\nimport { Fragment, ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { Popover } from '../popover'\nimport { VisuallyHidden } from '../visually-hidden'\nimport { useDropdownContext } from './DropdownContext'\nimport { styles } from './DropdownTrigger.styles'\n\ninterface TriggerProps {\n 'aria-label'?: string\n children: ReactNode\n className?: string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Trigger = ({\n 'aria-label': ariaLabel,\n children,\n className,\n ref: forwardedRef,\n}: TriggerProps) => {\n const {\n getToggleButtonProps,\n getDropdownProps,\n getLabelProps,\n hasPopover,\n disabled,\n readOnly,\n state,\n setLastInteractionType,\n } = useDropdownContext()\n\n const [WrapperComponent, wrapperProps] = hasPopover\n ? [Popover.Trigger, { asChild: true }]\n : [Fragment, {}]\n\n const { ref: downshiftRef, ...downshiftTriggerProps } = getToggleButtonProps({\n ...getDropdownProps(),\n onKeyDown: () => {\n setLastInteractionType('keyboard')\n },\n })\n\n const isExpanded = downshiftTriggerProps['aria-expanded']\n\n const ref = useMergeRefs(forwardedRef, downshiftRef)\n\n return (\n <>\n {ariaLabel && (\n <VisuallyHidden>\n <label {...getLabelProps()}>{ariaLabel}</label>\n </VisuallyHidden>\n )}\n <WrapperComponent {...wrapperProps}>\n <button\n type=\"button\"\n ref={ref}\n disabled={disabled || readOnly}\n className={styles({ className, state, disabled, readOnly })}\n {...downshiftTriggerProps}\n data-spark-component=\"dropdown-trigger\"\n >\n <span className=\"gap-md flex items-center justify-start\">{children}</span>\n\n <Icon\n className={cx('ml-md shrink-0 rotate-0 transition duration-100 ease-in', {\n 'rotate-180': isExpanded,\n })}\n size=\"sm\"\n >\n <ArrowHorizontalDown />\n </Icon>\n </button>\n </WrapperComponent>\n </>\n )\n}\n\nTrigger.displayName = 'Dropdown.Trigger'\n","import { cva } from 'class-variance-authority'\n\nexport const styles = cva(\n [\n 'flex w-full items-center justify-between',\n 'min-h-sz-44 rounded-lg bg-surface text-on-surface px-lg',\n 'text-body-1',\n // outline styles\n 'ring-1 outline-hidden ring-inset focus:ring-2 focus:ring-focus',\n ],\n {\n variants: {\n state: {\n undefined: 'ring-outline',\n error: 'ring-error',\n alert: 'ring-alert',\n success: 'ring-success',\n },\n disabled: {\n true: 'disabled:bg-on-surface/dim-5 cursor-not-allowed text-on-surface/dim-3',\n },\n readOnly: {\n true: 'disabled:bg-on-surface/dim-5 cursor-not-allowed text-on-surface/dim-3',\n },\n },\n compoundVariants: [\n {\n disabled: false,\n state: undefined,\n class: 'default:hover:ring-outline-high',\n },\n ],\n }\n)\n","import { cx } from 'class-variance-authority'\nimport { ReactNode, Ref } from 'react'\n\nimport { useDropdownContext } from './DropdownContext'\n\nexport interface ValueProps {\n children?: ReactNode\n className?: string\n placeholder: string\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const Value = ({ children, className, placeholder, ref: forwardedRef }: ValueProps) => {\n const { selectedItem, multiple, selectedItems } = useDropdownContext()\n\n const hasSelectedItems = !!(multiple ? selectedItems.length : selectedItem)\n const text = multiple ? selectedItems[0]?.text : selectedItem?.text\n const suffix = selectedItems.length > 1 ? `, +${selectedItems.length - 1}` : ''\n\n return (\n <span ref={forwardedRef} className={cx('flex shrink items-center text-left', className)}>\n <span\n className={cx(\n 'line-clamp-1 flex-1 overflow-hidden break-all text-ellipsis',\n !hasSelectedItems && 'text-on-surface/dim-1'\n )}\n >\n {!hasSelectedItems ? placeholder : children || text}\n </span>\n {suffix && <span>{suffix}</span>}\n </span>\n )\n}\n\nValue.displayName = 'Dropdown.Value'\n","import { Dropdown as Root } from './Dropdown'\nimport { DropdownProvider, useDropdownContext } from './DropdownContext'\nimport { Divider } from './DropdownDivider'\nimport { Group } from './DropdownGroup'\nimport { Item } from './DropdownItem'\nimport { ItemIndicator } from './DropdownItemIndicator'\nimport { Items } from './DropdownItems'\nimport { ItemText } from './DropdownItemText'\nimport { Label } from './DropdownLabel'\nimport { LeadingIcon } from './DropdownLeadingIcon'\nimport { Popover } from './DropdownPopover'\nimport { Portal } from './DropdownPortal'\nimport { Trigger } from './DropdownTrigger'\nimport { Value } from './DropdownValue'\n\nexport { useDropdownContext, DropdownProvider }\n\nexport const Dropdown: typeof Root & {\n Group: typeof Group\n Item: typeof Item\n Items: typeof Items\n ItemText: typeof ItemText\n ItemIndicator: typeof ItemIndicator\n Label: typeof Label\n Popover: typeof Popover\n Divider: typeof Divider\n Trigger: typeof Trigger\n Value: typeof Value\n LeadingIcon: typeof LeadingIcon\n Portal: typeof Portal\n} = Object.assign(Root, {\n Group,\n Item,\n Items,\n ItemText,\n ItemIndicator,\n Label,\n Popover,\n Divider,\n Trigger,\n Value,\n LeadingIcon,\n Portal,\n})\n\nDropdown.displayName = 'Dropdown'\nGroup.displayName = 'Dropdown.Group'\nItems.displayName = 'Dropdown.Items'\nItem.displayName = 'Dropdown.Item'\nItemText.displayName = 'Dropdown.ItemText'\nItemIndicator.displayName = 'Dropdown.ItemIndicator'\nLabel.displayName = 'Dropdown.Label'\nPopover.displayName = 'Dropdown.Popover'\nDivider.displayName = 'Dropdown.Divider'\nTrigger.displayName = 'Dropdown.Trigger'\nValue.displayName = 'Dropdown.Value'\nLeadingIcon.displayName = 'Dropdown.LeadingIcon'\nPortal.displayName = 'Dropdown.Portal'\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EAEA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACXP,SAAS,sBAAsB,iBAAiC;AAsBzD,IAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAsB;AACpB,QAAM,QAAQ,CAAC,GAAG,SAAS,OAAO,CAAC;AAEnC,QAAM,6BAA6B,qBAAmC;AAAA,IACpE,eACE,SAAS,QAAQ,WACb,MAAM;AAAA,MAAO,UACX,WAAY,MAAmB,SAAS,KAAK,KAAK,IAAI,UAAU,KAAK;AAAA,IACvE,IACA;AAAA,IACN,sBACE,gBAAgB,QAAQ,WACpB,MAAM;AAAA,MAAO,UACX,WAAY,aAA0B,SAAS,KAAK,KAAK,IAAI,iBAAiB,KAAK;AAAA,IACrF,IACA;AAAA,IAEN,uBAAuB,CAAC,EAAE,cAAc,MAAM;AAC5C,UAAI,iBAAiB,QAAQ,UAAU;AACrC,wBAAgB,cAAc,IAAI,UA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AAc;AACpB,MAAM,cAAc;AACpB,KAAK,cAAc;AACnB,SAAS,cAAc;AACvB,cAAc,cAAc;AAC5B,MAAM,cAAc;AACpBC,SAAQ,cAAc;AACtB,QAAQ,cAAc;AACtB,QAAQ,cAAc;AACtB,MAAM,cAAc;AACpB,YAAY,cAAc;AAC1B,OAAO,cAAc;","names":["jsx","jsx","cx","createContext","useContext","useId","jsx","createContext","useId","useContext","jsx","cx","cx","createContext","useContext","useState","jsx","createContext","useState","selectedItem","useContext","jsx","cx","cx","jsx","cx","useMergeRefs","cx","jsx","useMergeRefs","cx","cx","useEffect","useId","jsx","useId","useEffect","cx","cx","jsx","cx","jsx","cx","useEffect","jsx","Popover","useEffect","cx","jsx","useMergeRefs","cx","Fragment","cva","styles","Fragment","jsx","useMergeRefs","styles","cx","cx","jsx","jsxs","cx","Dropdown","Popover"]}
@@ -545,7 +545,7 @@ var inputStyles = (0, import_class_variance_authority10.cva)(
545
545
  "autofill:shadow-surface autofill:shadow-[inset_0_0_0px_1000px]",
546
546
  "disabled:cursor-not-allowed disabled:border-outline disabled:bg-on-surface/dim-5 disabled:text-on-surface/dim-3",
547
547
  "read-only:cursor-default read-only:pointer-events-none read-only:bg-on-surface/dim-5",
548
- "focus:ring-1 focus:ring-inset"
548
+ "focus:ring-1 focus:ring-inset focus:ring-focus focus:border-focus"
549
549
  ],
550
550
  {
551
551
  variants: {
@@ -560,14 +560,10 @@ var inputStyles = (0, import_class_variance_authority10.cva)(
560
560
  * Color scheme of the button.
561
561
  */
562
562
  intent: {
563
- neutral: [
564
- "border-outline",
565
- "hover:border-outline-high",
566
- "focus:ring-outline-high focus:border-outline-high"
567
- ],
568
- success: ["border-success", "focus:ring-success"],
569
- alert: ["border-alert", "focus:ring-alert"],
570
- error: ["border-error", "focus:ring-error"]
563
+ neutral: ["border-outline", "default:hover:border-outline-high"],
564
+ success: ["default:border-success"],
565
+ alert: ["default:border-alert"],
566
+ error: ["default:border-error"]
571
567
  },
572
568
  /**
573
569
  * Sets if there is an addon before the input text.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/input/index.ts","../../src/input/InputClearButton.tsx","../../src/icon/Icon.tsx","../../src/slot/Slot.tsx","../../src/visually-hidden/VisuallyHidden.tsx","../../src/icon/Icon.styles.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"],"sourcesContent":["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","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 inline?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nconst Root = ({\n className,\n tabIndex = -1,\n onClick,\n inline = false,\n ref,\n ...others\n}: 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 data-spark-component=\"input-clear-button\"\n className={cx(\n className,\n 'pointer-events-auto absolute',\n inline ? 'h-sz-44 top-0 -translate-y-0' : '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 { 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: typeof RadixSlot.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 { 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 max-lines-per-function */\n\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { useMergeRefs } from '@spark-ui/hooks/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 data-spark-component=\"input-group\"\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 data-spark-component=\"input-addon\"\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 'mx-0',\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 data-spark-component=\"input-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 data-spark-component=\"input\"\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 '[&:-webkit-autofill]:[-webkit-text-fill-color:var(--color-on-surface)]',\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,2BAA8B;AAC9B,IAAAC,mCAAmB;;;ACDnB,IAAAC,gBAA0F;;;ACA1F,sBAAkC;AAClC,mBAOO;AASE;AAPF,IAAM,YAAwC,gBAAAC,KAAU;AAMxD,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,IAAM,iBAAa,qCAAI,CAAC,uBAAuB,GAAG;AAAA,EACvD,UAAU;AAAA;AAAA;AAAA;AAAA,IAIR,YAAQ,oCAcN;AAAA,MACA,SAAS,CAAC,c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ACd,UAAU;AAAA,MACV,WAAW;AAAA,MACV,GAAG;AAAA;AAAA,EACN;AAEJ;AAEO,IAAM,QAAQ,OAAO,OAAOA,OAAM;AAAA,EACvC,IAAI;AACN,CAAC;AAEDA,MAAK,cAAc;;;AhBtFZ,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":["InputGroup","import_class_variance_authority","import_react","RadixSlot","import_jsx_runtime","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_class_variance_authority","import_jsx_runtime","import_class_variance_authority","import_react","import_class_variance_authority","import_jsx_runtime","import_jsx_runtime","Root","import_class_variance_authority","import_class_variance_authority","import_jsx_runtime","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","Root","import_class_variance_authority","import_jsx_runtime","import_form_field","import_class_variance_authority","import_jsx_runtime","Root","InputGroup"]}
1
+ {"version":3,"sources":["../../src/input/index.ts","../../src/input/InputClearButton.tsx","../../src/icon/Icon.tsx","../../src/slot/Slot.tsx","../../src/visually-hidden/VisuallyHidden.tsx","../../src/icon/Icon.styles.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"],"sourcesContent":["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","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 inline?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nconst Root = ({\n className,\n tabIndex = -1,\n onClick,\n inline = false,\n ref,\n ...others\n}: 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 data-spark-component=\"input-clear-button\"\n className={cx(\n className,\n 'pointer-events-auto absolute',\n inline ? 'h-sz-44 top-0 -translate-y-0' : '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 { 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: typeof RadixSlot.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 { 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 max-lines-per-function */\n\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { useMergeRefs } from '@spark-ui/hooks/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 data-spark-component=\"input-group\"\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 data-spark-component=\"input-addon\"\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 'mx-0',\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 data-spark-component=\"input-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 data-spark-component=\"input\"\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 '[&:-webkit-autofill]:[-webkit-text-fill-color:var(--color-on-surface)]',\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 focus:ring-focus focus:border-focus',\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: ['border-outline', 'default:hover:border-outline-high'],\n success: ['default:border-success'],\n alert: ['default:border-alert'],\n error: ['default:border-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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,2BAA8B;AAC9B,IAAAC,mCAAmB;;;ACDnB,IAAAC,gBAA0F;;;ACA1F,sBAAkC;AAClC,mBAOO;AASE;AAPF,IAAM,YAAwC,gBAAAC,KAAU;AAMxD,IAAM,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,MAAiB;AACpD,SAAO,4CAAC,gBAAAA,KAAU,MAAV,EAAe,KAAW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,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;AAAA,IAAC;AAAA;AAAA,MACC,wBAAqB;AAAA,MACrB;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,OAAOA,OAAM;AAAA,EACvC,IAAI;AACN,CAAC;AAEDA,MAAK,cAAc;;;AhBtFZ,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":["InputGroup","import_class_variance_authority","import_react","RadixSlot","import_jsx_runtime","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_class_variance_authority","import_jsx_runtime","import_class_variance_authority","import_react","import_class_variance_authority","import_jsx_runtime","import_jsx_runtime","Root","import_class_variance_authority","import_class_variance_authority","import_jsx_runtime","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","Root","import_class_variance_authority","import_jsx_runtime","import_form_field","import_class_variance_authority","import_jsx_runtime","Root","InputGroup"]}
@@ -2,7 +2,7 @@ import {
2
2
  Input,
3
3
  InputGroup,
4
4
  useInputGroup
5
- } from "../chunk-OQ4ALBBN.mjs";
5
+ } from "../chunk-QAUHPTZ2.mjs";
6
6
  import "../chunk-UMUMFMFB.mjs";
7
7
  import "../chunk-KEGAAGJW.mjs";
8
8
  import "../chunk-6QCEPQ3U.mjs";
@@ -448,7 +448,7 @@ var styles2 = (0, import_class_variance_authority4.cva)(
448
448
  "min-h-sz-44 rounded-lg px-lg",
449
449
  "text-body-1",
450
450
  // outline styles
451
- "ring-1 outline-hidden ring-inset"
451
+ "ring-1 outline-hidden ring-inset focus-within:ring-focus"
452
452
  ],
453
453
  {
454
454
  variants: {
@@ -482,7 +482,7 @@ var styles2 = (0, import_class_variance_authority4.cva)(
482
482
  {
483
483
  disabled: false,
484
484
  state: void 0,
485
- class: "hover:ring-outline-high focus-within:ring-outline-high"
485
+ class: "default:hover:ring-outline-high"
486
486
  }
487
487
  ]
488
488
  }