se-design 1.0.84 → 1.0.85-dev.1

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,"file":"index25.js","sources":["../src/components/Dropdown/index.tsx"],"sourcesContent":["import React, { FC, useState, useRef, useEffect, useLayoutEffect } from 'react';\n\nimport { Popover, PopoverHandle } from 'src/components/Popover';\nimport { Icon } from 'components/Icon';\nimport { Checkbox } from '../Checkbox';\nimport { Button } from '../Button';\nimport { InputWithIcon } from '../InputWithIcon';\nimport { useStableId } from '../../utils/useStableId';\nimport { useCombobox } from '../../utils/a11y/useCombobox';\nimport { announce } from '../../utils/a11y/liveAnnouncer/LiveAnnouncer';\n\ntype DropdownValue = {\n [key: string]: any;\n};\n\ntype DropdownProps = {\n label?: string;\n firstOptionAsHeading?: boolean;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n type: 'select' | 'multi-select';\n dropDownOptions?: DropdownValue[];\n defaultText?: string;\n selectBy?: string;\n optionsUniqueBy?: string;\n displaySelected?: boolean;\n defaultSelectedValue?: DropdownValue | DropdownValue[];\n customSelectedValue?: string;\n onOptionClick?: (selectedValue: DropdownValue) => void;\n style?: React.CSSProperties;\n renderOptionChip?: (option: DropdownValue, srcOption: boolean) => React.ReactNode;\n className?: string;\n iconColor?: string;\n disabled?: boolean;\n dropdownClassName?: string;\n hasError?: boolean;\n errorMessage?: string;\n onApply?: (selectedValue: DropdownValue[]) => void;\n onClear?: () => void;\n customDropdownContent?: () => React.ReactNode;\n isBorderless?: boolean;\n dropDownSrcAutomationId?: string;\n dropDownSelectAutomationId?: string;\n dropDownContentAutomationId?: string;\n shouldShowSearch?: boolean;\n showSearchIcon?: boolean;\n searchPlaceholder?: string;\n searchResultEmptyMessage?: string;\n /** Controlled selection — when provided, Dropdown won't manage internal selected state */\n selectedValue?: DropdownValue | DropdownValue[];\n /** Controlled open state — when provided, Dropdown won't manage internal open/close */\n isOpen?: boolean;\n /** Callback when open state changes (fires in both controlled and uncontrolled modes) */\n onOpenChange?: (isOpen: boolean) => void;\n /** Custom trigger element — replaces the default bordered div + chevron */\n renderSrcElement?: (props: { isOpen: boolean; selectedValue: DropdownValue[] }) => React.ReactNode;\n /** Render the dropdown panel in a portal (document.body) to escape overflow:hidden containers */\n isWithPortal?: boolean;\n /** Optional ref that will be populated with the Popover wrapper element on mount.\n * Use with setFocusAnchor() to return focus to the dropdown trigger after a modal closes. */\n popoverElementRef?: React.RefObject<HTMLElement | null>;\n /** Inline styles forwarded to the Popover content (portal or inline). Useful for min-width overrides. */\n popoverContentStyleProperty?: React.CSSProperties;\n};\n\nexport const Dropdown: FC<DropdownProps> = (props) => {\n const isControlledSelection = props.selectedValue !== undefined;\n const isControlledOpen = props.isOpen !== undefined;\n\n const [internalIsOpen, setInternalIsOpen] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [internalSelectedValues, setInternalSelectedValues] = useState<DropdownValue[]>(() =>\n props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : []\n );\n const popoverRef = useRef<HTMLDivElement & PopoverHandle>(null);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const labelId = useStableId(undefined, 'dropdown-label');\n const valueId = useStableId(undefined, 'dropdown-value');\n const listboxId = useStableId(undefined, 'dropdown-listbox');\n\n // Derived state: controlled props take precedence over internal state\n const isDropDownOpen = isControlledOpen ? props.isOpen! : internalIsOpen;\n const selectedDropDownValues = isControlledSelection\n ? (Array.isArray(props.selectedValue) ? props.selectedValue : props.selectedValue ? [props.selectedValue] : [])\n : internalSelectedValues;\n\n const setIsDropDownOpen = (value: boolean) => {\n if (!isControlledOpen) {\n setInternalIsOpen(value);\n }\n props.onOpenChange?.(value);\n };\n\n const setSelectedDropDownValues = (values: DropdownValue[]) => {\n if (!isControlledSelection) {\n setInternalSelectedValues(values);\n }\n };\n\n const {\n selectBy = '',\n optionsUniqueBy = '',\n displaySelected = false,\n dropDownOptions,\n defaultText = 'Select',\n iconColor = 'var(--color-gray-700)',\n disabled = false,\n dropdownClassName = '',\n hasError = false,\n errorMessage = '',\n customDropdownContent = null,\n isBorderless = false,\n shouldShowSearch = false,\n showSearchIcon = true,\n searchPlaceholder = 'Search...',\n searchResultEmptyMessage = 'No results found',\n ariaLabel = '',\n customSelectedValue = '',\n isWithPortal = false,\n firstOptionAsHeading = false\n } = props;\n\n useEffect(() => {\n if (!isControlledSelection) {\n const newValues = props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : [];\n setInternalSelectedValues(newValues);\n }\n }, [props?.defaultSelectedValue, isControlledSelection]);\n\n useEffect(() => {\n if (!isDropDownOpen) {\n setSearchQuery('');\n }\n }, [isDropDownOpen]);\n\n // Focus search input when dropdown opens with search enabled\n useEffect(() => {\n if (isDropDownOpen && shouldShowSearch && searchInputRef.current) {\n requestAnimationFrame(() => searchInputRef.current?.focus());\n }\n }, [isDropDownOpen, shouldShowSearch]);\n\n // Populate caller's popoverElementRef with the Popover wrapper element.\n // Runs after mount so popoverRef.current is set.\n useLayoutEffect(() => {\n if (props.popoverElementRef) {\n props.popoverElementRef.current = popoverRef.current?.element ?? null;\n }\n });\n\n const isMultiSelect = props?.type === 'multi-select';\n\n const getFilteredOptions = () => {\n if (!searchQuery.trim()) {\n return dropDownOptions || [];\n }\n return (dropDownOptions || []).filter((option) => {\n const optionValue = option?.[selectBy]?.toString().toLowerCase() || '';\n return optionValue.includes(searchQuery.toLowerCase());\n });\n };\n\n const handleDropDownOptionClick = (dropDownOption: any) => {\n setSelectedDropDownValues([dropDownOption]);\n setIsDropDownOpen(false);\n props?.onOptionClick?.(dropDownOption);\n // Restore focus to the trigger after portal unmounts.\n // Double rAF ensures this runs after React re-renders AND the focus trap safety net,\n // getting the final say on focus.\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n popoverRef.current?.focusTrigger();\n });\n });\n };\n\n // Use useCombobox hook for keyboard navigation (only for single-select)\n const filteredOptions = getFilteredOptions();\n const {\n listboxProps,\n getOptionProps,\n highlightedIndex,\n setHighlightedIndex,\n containerProps: comboboxContainerProps,\n inputProps: comboboxInputProps,\n isKeyboardFocused: isSingleSelectKeyboardFocused\n } = useCombobox({\n items: isMultiSelect ? [] : filteredOptions, // Only use for single-select\n isOpen: isDropDownOpen && !isMultiSelect,\n onOpenChange: setIsDropDownOpen,\n onSelect: (item: DropdownValue) => {\n handleDropDownOptionClick(item);\n },\n listboxId,\n disabled: isMultiSelect || disabled,\n hasItems: filteredOptions.length > 0\n });\n\n // Second useCombobox for multi-select: provides ARIA props, keyboard navigation, and auto-scroll.\n // Enter/Space are intercepted in multiSelectOnKeyDown to avoid the hook's highlight reset after select.\n const {\n inputProps: multiSelectComboboxInputProps,\n listboxProps: multiSelectListboxProps,\n containerProps: multiSelectContainerProps,\n highlightedIndex: highlightedMultiSelectIndex,\n setHighlightedIndex: setHighlightedMultiSelectIndex,\n isKeyboardFocused: isMultiSelectKeyboardFocused\n } = useCombobox({\n items: isMultiSelect ? filteredOptions : [],\n isOpen: isDropDownOpen && isMultiSelect,\n onOpenChange: setIsDropDownOpen,\n onSelect: () => {},\n listboxId,\n disabled: !isMultiSelect,\n loop: false,\n hasItems: filteredOptions.length > 0,\n closeOnTab: false\n });\n\n useEffect(() => {\n if (isDropDownOpen && filteredOptions.length === 0 && searchQuery.trim()) {\n announce(searchResultEmptyMessage, { assertiveness: 'polite', batchId: 'dropdown-empty-state', delay: 300 });\n }\n }, [filteredOptions.length, isDropDownOpen, searchQuery]);\n\n const getSelectedDropDownValue = (option: DropdownValue, isSrcOption: boolean = false) => {\n if (isMultiSelect) {\n return defaultText;\n }\n\n // if custom selected value is provided, use it instead of the option value\n if (isSrcOption && customSelectedValue) {\n return customSelectedValue;\n }\n\n return option?.[selectBy] || defaultText;\n };\n\n const clearSelectedDropDownValues = () => {\n setSelectedDropDownValues([]);\n props?.onClear?.();\n };\n\n const optionChip = (option: DropdownValue, srcOption: boolean = false) => {\n if (props?.renderOptionChip) {\n return props?.renderOptionChip(option, srcOption);\n }\n\n if (isMultiSelect && selectedDropDownValues?.length > 0) {\n const firstSelectedLabel = selectedDropDownValues[0]?.[selectBy] || '';\n const remainingCount = selectedDropDownValues.length - 1;\n\n // For multiple selections: text takes remaining space, count takes minimum space needed\n return (\n <div className={`option-chip flex items-center w-full`}>\n <div\n className={`${remainingCount > 0 ? 'w-full' : 'flex-1'} truncate`}\n >{`${defaultText}: ${firstSelectedLabel}`}</div>\n {remainingCount > 0 && <div className=\"flex-shrink-0\">+{remainingCount}</div>}\n </div>\n );\n }\n\n const selectedLabel = getSelectedDropDownValue(option, srcOption);\n const hasVisibleLabel = !!props?.label || !!props?.ariaLabelledBy;\n const showPrefix = srcOption && defaultText && option?.[selectBy] && !customSelectedValue && !hasVisibleLabel;\n\n return (\n <p className={`option-chip flex flex-1 items-center justify-between`}>\n {showPrefix ? `${defaultText}: ${selectedLabel}` : selectedLabel}\n </p>\n );\n };\n\n const renderSearchInput = (extraInputProps: Record<string, any>) => (\n <div className=\" w-full relative flex items-center border-b border-[var(--color-gray-300)]\">\n <InputWithIcon\n leftIcon={showSearchIcon ? { name: 'search', position: 'left', style: { color: 'var(--color-gray-500)' } } : undefined}\n value={searchQuery}\n onChange={(value) => setSearchQuery(value)}\n placeholder={searchPlaceholder}\n style={{ margin: 0, gap: 0 }}\n inputStyle={{ width: '100%', border: 'none', outline: 'none' }}\n automationId=\"se-design-dropdown-search\"\n ariaLabel={searchPlaceholder}\n inputRef={searchInputRef}\n inputProps={extraInputProps}\n />\n </div>\n );\n\n const renderSearchBar = () => {\n if (isMultiSelect) {\n return renderSearchInput({\n ...multiSelectComboboxInputProps,\n onKeyDown: (e: React.KeyboardEvent) => multiSelectOnKeyDown(e, true)\n });\n }\n\n // Single-select: wrap onKeyDown to add Escape → focusTrigger (portal-safe)\n return renderSearchInput({\n ...comboboxInputProps,\n onKeyDown: (e: React.KeyboardEvent) => {\n comboboxInputProps.onKeyDown(e);\n if (e.key === 'Escape') {\n requestAnimationFrame(() => popoverRef.current?.focusTrigger());\n }\n }\n });\n };\n\n const dropDownOptionJsx = (dropDownOption: DropdownValue, index: number) => {\n const optionTxt = dropDownOption[selectBy];\n const dropDownSelectedValue = selectedDropDownValues[0]?.[selectBy] || defaultText;\n const selectByUniqueId = optionsUniqueBy?.length\n ? dropDownOption[optionsUniqueBy] == selectedDropDownValues[0]?.[optionsUniqueBy]\n : true;\n const isOptionSelected = displaySelected && optionTxt === dropDownSelectedValue && selectByUniqueId;\n const isHighlighted = highlightedIndex === index;\n const optionProps = !isMultiSelect ? getOptionProps(index, isOptionSelected) : {};\n\n return (\n <div\n key={dropDownOption.id || dropDownOption.value}\n className={`option break-words px-3 py-2 hover:bg-[var(--color-gray-100)] cursor-pointer select-none flex items-center justify-between ${\n isOptionSelected ? 'selected' : ''\n } ${isHighlighted ? `bg-[var(--color-gray-100)]${isSingleSelectKeyboardFocused ? ' outline outline-[length:var(--focus-width)] -outline-offset-2 outline-[var(--focus-color)]' : ''}` : ''}`}\n onClick={() => handleDropDownOptionClick(dropDownOption)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n handleDropDownOptionClick(dropDownOption);\n } else if (e.key === 'Escape') {\n requestAnimationFrame(() => popoverRef.current?.focusTrigger());\n }\n }}\n tabIndex={-1}\n data-automation-id={`dropdown-option-${dropDownOption?.automationId || index}`}\n {...optionProps}\n aria-selected={isOptionSelected ? 'true' : 'false'}\n >\n {optionChip({ ...dropDownOption, isOptionSelected }, false)}\n {isOptionSelected && <Icon name=\"checkmark\" stroke={iconColor} />}\n </div>\n );\n };\n\n const renderDropdownContents = () => {\n return (\n <>\n {props?.label && firstOptionAsHeading && (\n <div\n aria-hidden=\"true\"\n className=\"px-3 pt-2 pb-1 text-[var(--color-gray-650)] text-xs cursor-default select-none\"\n >\n {props.label}\n </div>\n )}\n {shouldShowSearch && renderSearchBar()}\n <div\n className={`dropdown-content dropdown-options${shouldShowSearch ? '' : ' flex flex-col max-h-80 overflow-y-auto'}`}\n {...(shouldShowSearch ? {} : {\n ...listboxProps,\n 'aria-label': `${defaultText} options`,\n style: { outline: 'none' },\n tabIndex: -1,\n 'aria-activedescendant': comboboxInputProps['aria-activedescendant'],\n onKeyDown: (e: React.KeyboardEvent) => {\n comboboxContainerProps.onKeyDownCapture?.(e as React.KeyboardEvent<HTMLElement>);\n if (e.key === ' ') {\n e.preventDefault();\n if (highlightedIndex >= 0 && filteredOptions[highlightedIndex]) {\n handleDropDownOptionClick(filteredOptions[highlightedIndex]);\n }\n return;\n }\n comboboxInputProps.onKeyDown(e);\n },\n onFocus: () => {\n if (highlightedIndex === -1 && filteredOptions.length > 0) {\n setHighlightedIndex(0);\n }\n }\n })}\n >\n {shouldShowSearch ? (\n <div\n className=\"flex flex-col max-h-80 overflow-y-auto\"\n aria-label={`${defaultText} options`}\n {...listboxProps}\n >\n {filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption, index) => dropDownOptionJsx(dropDownOption, index))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-700)] text-sm\">\n {searchResultEmptyMessage}\n </div>\n )}\n </div>\n ) : (\n filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption, index) => dropDownOptionJsx(dropDownOption, index))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-700)] text-sm\">\n {searchResultEmptyMessage}\n </div>\n )\n )}\n </div>\n </>\n );\n };\n\n const handleMultiSelectDropdownOptionClick = (isSelected: boolean, dropDownOption: DropdownValue) => {\n let newSelectedDropDownValues: DropdownValue[] = [];\n if (isSelected) {\n newSelectedDropDownValues = [...selectedDropDownValues, dropDownOption];\n } else {\n newSelectedDropDownValues = selectedDropDownValues?.filter(\n (option) => option[optionsUniqueBy] !== dropDownOption[optionsUniqueBy]\n );\n }\n setSelectedDropDownValues(newSelectedDropDownValues);\n };\n\n const handleApplySelectedDropDownValues = () => {\n popoverRef.current?.togglePopover();\n props?.onApply?.(selectedDropDownValues);\n };\n\n // Wraps the multi-select useCombobox's onKeyDown.\n // - Intercepts Enter/Space to toggle selection without resetting the highlight\n // (the hook resets highlightedIndex to -1 after onSelect, which is wrong for multi-select).\n // - When isSearchInput is true, Space is left for typing.\n // - Adds focusTrigger on Escape (Popover's handler is unreliable for portals).\n const multiSelectOnKeyDown = (e: React.KeyboardEvent, isSearchInput: boolean = false) => {\n if (isSearchInput && e.key === ' ') return;\n\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n if (highlightedMultiSelectIndex >= 0 && highlightedMultiSelectIndex < filteredOptions.length) {\n const option = filteredOptions[highlightedMultiSelectIndex];\n const isSelected = selectedDropDownValues.some(\n (v) => v[optionsUniqueBy] === option[optionsUniqueBy]\n );\n handleMultiSelectDropdownOptionClick(!isSelected, option);\n }\n return;\n }\n\n multiSelectComboboxInputProps.onKeyDown(e);\n\n if (e.key === 'Escape') {\n e.stopPropagation();\n requestAnimationFrame(() => popoverRef.current?.focusTrigger());\n }\n };\n\n const multiSelectDropdownOptionJSX = (dropDownOption: DropdownValue, index: number) => {\n const isOptionSelected = selectedDropDownValues.some(\n (option) => option[optionsUniqueBy] === dropDownOption[optionsUniqueBy]\n );\n const optionId = `${listboxId}-option-${index}`;\n const isHighlighted = highlightedMultiSelectIndex === index;\n\n return (\n <div\n key={dropDownOption.id || dropDownOption.value}\n id={optionId}\n role=\"option\"\n aria-selected={isOptionSelected}\n className={`option px-3 py-2 hover:bg-[var(--color-gray-100)] cursor-pointer select-none flex items-center gap-2 ${\n isHighlighted ? `bg-[var(--color-gray-100)]${isMultiSelectKeyboardFocused ? ' outline outline-[length:var(--focus-width)] -outline-offset-2 outline-[var(--focus-color)]' : ''}` : ''\n }`}\n onClick={() => handleMultiSelectDropdownOptionClick(!isOptionSelected, dropDownOption)}\n data-automation-id={`dropdown-option-${dropDownOption?.automationId || index}`}\n >\n <Checkbox\n tabIndex={-1}\n ariaHidden\n checked={isOptionSelected}\n onChange={() => {}}\n className=\"pointer-events-none\"\n />\n <span className=\"checkbox-label\">{dropDownOption?.label}</span>\n </div>\n );\n };\n\n const renderMultiSelectDropdownContents = () => {\n return (\n <div\n onKeyDown={(e) => {\n // Stop all Tab events from reaching Popover's handlePopoverContentKeyDown (which closes on Tab).\n // Forward Tab: search → Clear → Apply → focus exits → useDismissOnFocusOut closes.\n // Shift+Tab: Apply → Clear → search → trigger.\n if (e.key === 'Tab') {\n e.stopPropagation();\n }\n }}\n >\n {shouldShowSearch && renderSearchBar()}\n <div\n className={`dropdown-content dropdown-options${shouldShowSearch ? '' : ' flex flex-col max-h-80 overflow-y-auto'}`}\n {...(shouldShowSearch ? {} : {\n ...multiSelectListboxProps,\n 'aria-label': `${defaultText} options`,\n 'aria-multiselectable': 'true',\n style: { outline: 'none' },\n tabIndex: -1,\n 'aria-activedescendant': multiSelectComboboxInputProps['aria-activedescendant'],\n onKeyDown: (e: React.KeyboardEvent) => multiSelectOnKeyDown(e, false),\n onFocus: () => {\n if (highlightedMultiSelectIndex === -1 && filteredOptions.length > 0) {\n setHighlightedMultiSelectIndex(0);\n }\n }\n })}\n >\n {shouldShowSearch ? (\n <div\n className=\"flex flex-col max-h-80 overflow-y-auto\"\n {...multiSelectListboxProps}\n aria-label={`${defaultText} options`}\n aria-multiselectable=\"true\"\n >\n {filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption, index) => multiSelectDropdownOptionJSX(dropDownOption, index))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-700)] text-sm\">\n {searchResultEmptyMessage}\n </div>\n )}\n </div>\n ) : (\n filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption, index) => multiSelectDropdownOptionJSX(dropDownOption, index))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-700)] text-sm\">\n {searchResultEmptyMessage}\n </div>\n )\n )}\n </div>\n <div\n className=\"flex items-center justify-end gap-4 p-3 border-t border-[var(--color-gray-200)]\"\n onKeyDown={(e) => {\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Home' || e.key === 'End') {\n // Stop arrow keys from reaching Popover's handleArrowKeyNavigation\n // which would move focus out of the CTA buttons back into options\n e.stopPropagation();\n return;\n }\n if (e.key === 'Tab' && e.shiftKey) {\n e.preventDefault();\n e.stopPropagation();\n if (shouldShowSearch) {\n searchInputRef.current?.focus();\n } else {\n multiSelectListboxProps.ref.current?.focus();\n }\n }\n }}\n >\n <Button label=\"Clear\" type=\"link\" size=\"sm\" onClick={clearSelectedDropDownValues} automationId=\"se-design-dropdown-clear-button\" />\n <Button label=\"Apply\" type=\"primary\" size=\"sm\" onClick={handleApplySelectedDropDownValues} automationId=\"se-design-dropdown-apply-button\" />\n </div>\n </div>\n );\n };\n\n const renderDropdownSelect = () => {\n const borderColor = isDropDownOpen\n ? 'border-[var(--color-blue-500)]'\n : disabled\n ? 'border-[var(--color-gray-300)]'\n : 'border-[var(--color-gray-600)]';\n const errorBorderColor = hasError ? 'border-[var(--color-red-500)]' : '';\n const dropDownSelectClass = `dropdown-src-element bg-[var(--color-white)] flex px-3 py-2 ${\n isBorderless ? 'border-0' : `border rounded-md ${errorBorderColor ? errorBorderColor : borderColor}`\n } flex items-center ${dropdownClassName}`;\n\n return (\n <div className={dropDownSelectClass}>\n <div\n id={valueId}\n className=\"flex-1 min-w-0\"\n data-automation-id={props?.dropDownSelectAutomationId || 'selected-dropdown-value'}\n >\n {optionChip(selectedDropDownValues[0], true)}\n </div>\n <div className=\"flex-shrink-0 ml-2\" aria-hidden=\"true\">\n <Icon\n name={'chevron'}\n rotation={isDropDownOpen ? '180' : '0'}\n className={`transition-transform`}\n stroke={iconColor}\n />\n </div>\n </div>\n );\n };\n\n const getDropdownAriaLabel = () => {\n const selectedLabel = selectedDropDownValues[0]?.[selectBy];\n if (ariaLabel && selectedLabel) {\n return `${ariaLabel}, ${selectedLabel}`;\n }\n return ariaLabel || defaultText || 'Select option';\n };\n\n // Trigger is always a button that reveals a listbox popup (Select/Listbox pattern).\n // For search-enabled dropdowns, the combobox role lives on the search input inside the popup.\n // This matches React Aria (useSelect), Radix (Select), and Headless UI (Listbox) — all use\n // role=\"button\" with real focus on options, separate from their Combobox components.\n const triggerSourceRole = 'button';\n\n // Trigger is always role=\"button\" — combobox ARIA (aria-activedescendant etc.)\n // lives on the search input inside the popup, not on the trigger.\n // Trigger only needs aria-haspopup + aria-expanded (Popover handles) + aria-controls.\n\n return (\n <div\n className={`se-design-dropdown-container${props?.className ? ` ${props?.className}` : ''}`}\n style={props?.style}\n >\n {props?.label ? (\n <div id={labelId} className={`se-design-dropdown-label ${firstOptionAsHeading ? 'sr-only' : 'mb-[3px] text-[var(--color-gray-700)] text-sm'}`}>\n {props?.label}\n </div>\n ) : !props?.ariaLabelledBy && ariaLabel ? (\n <span id={labelId} className=\"sr-only\">{ariaLabel}</span>\n ) : null}\n <div\n style={props?.style}\n className={`${disabled ? 'bg-[var(--color-gray-50)] rounded-md cursor-not-allowed' : ''}`}\n {...(!isMultiSelect ? {\n ...comboboxContainerProps,\n onKeyDownCapture: (e: React.KeyboardEvent<HTMLElement>) => {\n // Handle Escape/Tab BEFORE dismiss — React unmounts the popup after\n // dismiss's setState, so bubble-phase handlers never fire.\n if ((e.key === 'Escape' || e.key === 'Tab') && isDropDownOpen) {\n e.stopPropagation(); // prevent Popover wrapper + parent sidebar from seeing Escape\n popoverRef.current?.focusTrigger();\n }\n comboboxContainerProps.onKeyDownCapture?.(e);\n },\n // Portal content lives in document.body — focus moving into it looks like \"focus out\" to\n // the container's blur handler, causing immediate close. Suppress it; the Popover's own\n // onBlur handler checks both source and portal content and handles dismissal correctly.\n ...(isWithPortal ? { onBlurCapture: undefined } : {})\n } : {\n // Multi-select: only spread focus-tracking handlers for isKeyboardFocused.\n // Dismiss is handled by Popover — don't spread onBlurCapture.\n onPointerMove: multiSelectContainerProps.onPointerMove,\n onPointerDown: multiSelectContainerProps.onPointerDown,\n onPointerUp: multiSelectContainerProps.onPointerUp,\n onFocusCapture: multiSelectContainerProps.onFocusCapture,\n onKeyDownCapture: (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Escape' && isDropDownOpen) {\n e.stopPropagation();\n popoverRef.current?.focusTrigger();\n }\n multiSelectContainerProps.onKeyDownCapture?.(e);\n }\n })}\n >\n <Popover\n ref={popoverRef}\n isPopoverOpen={isDropDownOpen}\n isWithPortal={isWithPortal}\n renderPopoverContents={\n customDropdownContent\n ? customDropdownContent\n : isMultiSelect\n ? renderMultiSelectDropdownContents\n : renderDropdownContents\n }\n contentWidth={'full'}\n popoverContentStyleProperty={props.popoverContentStyleProperty}\n renderPopoverSrcElement={\n props.renderSrcElement\n ? () => props.renderSrcElement!({ isOpen: isDropDownOpen, selectedValue: selectedDropDownValues })\n : renderDropdownSelect\n }\n onPopoverToggle={(value) => {\n setIsDropDownOpen(value);\n if (value && !isMultiSelect && selectedDropDownValues.length > 0) {\n // Highlight the currently selected option when the dropdown opens (APG Select pattern)\n const selectedIndex = filteredOptions.findIndex(\n (option) => optionsUniqueBy\n ? option[optionsUniqueBy] === selectedDropDownValues[0]?.[optionsUniqueBy]\n : option[selectBy] === selectedDropDownValues[0]?.[selectBy]\n );\n if (selectedIndex >= 0) {\n setHighlightedIndex(selectedIndex);\n }\n }\n if (value && !shouldShowSearch) {\n // Focus listbox after Popover's own focus-first-on-open (setTimeout 0ms) has fired.\n // Using nested requestAnimationFrame ensures we run after both the Popover timeout\n // and any pending paint, so the listbox DOM is ready and we get the last word on focus.\n const ref = isMultiSelect ? multiSelectListboxProps.ref : listboxProps.ref;\n requestAnimationFrame(() => requestAnimationFrame(() => ref.current?.focus()));\n }\n // When search is enabled, Popover's focus-first-on-open naturally finds the search input.\n }}\n disabled={disabled}\n automationId={props?.dropDownSrcAutomationId}\n popoverContentAutomationId={props?.dropDownContentAutomationId}\n ariaLabelledBy={\n props?.label || props?.ariaLabelledBy || ariaLabel\n ? [props?.label || (!props?.ariaLabelledBy && ariaLabel) ? labelId : props?.ariaLabelledBy, valueId].filter(Boolean).join(' ')\n : undefined\n }\n ariaLabel={!props?.label && !ariaLabel && !props?.ariaLabelledBy ? getDropdownAriaLabel() : undefined}\n sourceRole={triggerSourceRole}\n {...{ 'aria-haspopup': 'listbox' }}\n {...(isDropDownOpen ? { 'aria-controls': listboxId } : {})}\n />\n </div>\n {hasError && <div className=\"text-[var(--color-red-500)] text-sm\">{errorMessage}</div>}\n </div>\n );\n};\n"],"names":["Dropdown","props","isControlledSelection","selectedValue","undefined","isControlledOpen","isOpen","internalIsOpen","setInternalIsOpen","useState","searchQuery","setSearchQuery","internalSelectedValues","setInternalSelectedValues","defaultSelectedValue","Array","isArray","popoverRef","useRef","searchInputRef","labelId","useStableId","valueId","listboxId","isDropDownOpen","selectedDropDownValues","setIsDropDownOpen","value","onOpenChange","setSelectedDropDownValues","values","selectBy","optionsUniqueBy","displaySelected","dropDownOptions","defaultText","iconColor","disabled","dropdownClassName","hasError","errorMessage","customDropdownContent","isBorderless","shouldShowSearch","showSearchIcon","searchPlaceholder","searchResultEmptyMessage","ariaLabel","customSelectedValue","isWithPortal","firstOptionAsHeading","useEffect","newValues","current","requestAnimationFrame","focus","useLayoutEffect","popoverElementRef","element","isMultiSelect","type","getFilteredOptions","trim","filter","option","toString","toLowerCase","includes","handleDropDownOptionClick","dropDownOption","onOptionClick","focusTrigger","filteredOptions","listboxProps","getOptionProps","highlightedIndex","setHighlightedIndex","containerProps","comboboxContainerProps","inputProps","comboboxInputProps","isKeyboardFocused","isSingleSelectKeyboardFocused","useCombobox","items","onSelect","item","hasItems","length","multiSelectComboboxInputProps","multiSelectListboxProps","multiSelectContainerProps","highlightedMultiSelectIndex","setHighlightedMultiSelectIndex","isMultiSelectKeyboardFocused","loop","closeOnTab","announce","assertiveness","batchId","delay","getSelectedDropDownValue","isSrcOption","clearSelectedDropDownValues","onClear","optionChip","srcOption","renderOptionChip","firstSelectedLabel","remainingCount","React","createElement","className","selectedLabel","hasVisibleLabel","label","ariaLabelledBy","showPrefix","renderSearchInput","extraInputProps","InputWithIcon","leftIcon","name","position","style","color","onChange","placeholder","margin","gap","inputStyle","width","border","outline","automationId","inputRef","renderSearchBar","onKeyDown","e","multiSelectOnKeyDown","key","dropDownOptionJsx","index","optionTxt","dropDownSelectedValue","selectByUniqueId","isOptionSelected","isHighlighted","optionProps","_extends","id","onClick","preventDefault","tabIndex","Icon","stroke","renderDropdownContents","Fragment","onKeyDownCapture","onFocus","map","handleMultiSelectDropdownOptionClick","isSelected","newSelectedDropDownValues","handleApplySelectedDropDownValues","togglePopover","onApply","isSearchInput","some","v","stopPropagation","multiSelectDropdownOptionJSX","optionId","role","Checkbox","ariaHidden","checked","renderMultiSelectDropdownContents","shiftKey","ref","Button","size","renderDropdownSelect","borderColor","errorBorderColor","dropDownSelectClass","dropDownSelectAutomationId","rotation","getDropdownAriaLabel","onPointerMove","onPointerDown","onPointerUp","onFocusCapture","onBlurCapture","Popover","isPopoverOpen","renderPopoverContents","contentWidth","popoverContentStyleProperty","renderPopoverSrcElement","renderSrcElement","onPopoverToggle","selectedIndex","findIndex","dropDownSrcAutomationId","popoverContentAutomationId","dropDownContentAutomationId","Boolean","join","sourceRole"],"mappings":";;;;;;;;;;;;;;;;;;AAiEO,MAAMA,KAA+BC,CAAAA,MAAU;AACpD,QAAMC,IAAwBD,EAAME,kBAAkBC,QAChDC,IAAmBJ,EAAMK,WAAWF,QAEpC,CAACG,GAAgBC,EAAiB,IAAIC,EAAS,EAAK,GACpD,CAACC,GAAaC,CAAc,IAAIF,EAAS,EAAE,GAC3C,CAACG,IAAwBC,CAAyB,IAAIJ,EAA0B,MACpFR,GAAOa,uBACHC,MAAMC,QAAQf,GAAOa,oBAAoB,IACvCb,GAAOa,uBACP,CAACb,EAAMa,oBAAoB,IAC7B,EACN,GACMG,IAAaC,GAAuC,IAAI,GACxDC,IAAiBD,GAAyB,IAAI,GAC9CE,IAA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,EAAa0G;AACvE7H,8BAAsB,MAAMA,sBAAsB,MAAM6H,EAAI9H,SAASE,MAAAA,CAAO,CAAC;AAAA,MAC/E;AAAA,IAEF;AAAA,IACAlB,UAAAA;AAAAA,IACAiG,cAAcrI,GAAO2M;AAAAA,IACrBC,4BAA4B5M,GAAO6M;AAAAA,IACnC1F,gBACEnH,GAAOkH,SAASlH,GAAOmH,kBAAkBrE,IACrC,CAAC9C,GAAOkH,SAAU,CAAClH,GAAOmH,kBAAkBrE,IAAa3B,IAAUnB,GAAOmH,gBAAgB9F,CAAO,EAAEyC,OAAOgJ,OAAO,EAAEC,KAAK,GAAG,IAC3H5M;AAAAA,IAEN2C,WAAW,CAAC9C,GAAOkH,SAAS,CAACpE,KAAa,CAAC9C,GAAOmH,iBAAiBwE,GAAAA,IAAyBxL;AAAAA,IAC5F6M,YArGkB;AAAA,IAsGZ,iBAAiB;AAAA,EAAA,GAClBzL,IAAiB;AAAA,IAAE,iBAAiBD;AAAAA,EAAAA,IAAc,CAAA,CAAE,CAC1D,CACE,GACJgB,KAAYuE,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKC,WAAU;AAAA,EAAA,GAAuCxE,EAAkB,CAClF;AAET;"}
1
+ {"version":3,"file":"index25.js","sources":["../src/components/Dropdown/index.tsx"],"sourcesContent":["import React, { FC, useState, useRef, useEffect, useLayoutEffect } from 'react';\n\nimport { Popover, PopoverHandle } from 'src/components/Popover';\nimport { Icon } from 'components/Icon';\nimport { Checkbox } from '../Checkbox';\nimport { Button } from '../Button';\nimport { InputWithIcon } from '../InputWithIcon';\nimport { useStableId } from '../../utils/useStableId';\nimport { useCombobox } from '../../utils/a11y/useCombobox';\nimport { getFocusableElements } from '../../utils/a11y';\nimport { announce } from '../../utils/a11y/liveAnnouncer/LiveAnnouncer';\n\ntype DropdownValue = {\n [key: string]: any;\n};\n\ntype DropdownProps = {\n label?: string;\n firstOptionAsHeading?: boolean;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n type: 'select' | 'multi-select';\n dropDownOptions?: DropdownValue[];\n defaultText?: string;\n selectBy?: string;\n optionsUniqueBy?: string;\n displaySelected?: boolean;\n defaultSelectedValue?: DropdownValue | DropdownValue[];\n customSelectedValue?: string;\n onOptionClick?: (selectedValue: DropdownValue) => void;\n style?: React.CSSProperties;\n renderOptionChip?: (option: DropdownValue, srcOption: boolean) => React.ReactNode;\n className?: string;\n iconColor?: string;\n disabled?: boolean;\n dropdownClassName?: string;\n hasError?: boolean;\n errorMessage?: string;\n onApply?: (selectedValue: DropdownValue[]) => void;\n onClear?: () => void;\n customDropdownContent?: () => React.ReactNode;\n isBorderless?: boolean;\n dropDownSrcAutomationId?: string;\n dropDownSelectAutomationId?: string;\n dropDownContentAutomationId?: string;\n shouldShowSearch?: boolean;\n showSearchIcon?: boolean;\n searchPlaceholder?: string;\n searchResultEmptyMessage?: string;\n /** Controlled selection — when provided, Dropdown won't manage internal selected state */\n selectedValue?: DropdownValue | DropdownValue[];\n /** Controlled open state — when provided, Dropdown won't manage internal open/close */\n isOpen?: boolean;\n /** Callback when open state changes (fires in both controlled and uncontrolled modes) */\n onOpenChange?: (isOpen: boolean) => void;\n /** Custom trigger element — replaces the default bordered div + chevron */\n renderSrcElement?: (props: { isOpen: boolean; selectedValue: DropdownValue[] }) => React.ReactNode;\n /** Render the dropdown panel in a portal (document.body) to escape overflow:hidden containers */\n isWithPortal?: boolean;\n /** Optional ref that will be populated with the Popover wrapper element on mount.\n * Use with setFocusAnchor() to return focus to the dropdown trigger after a modal closes. */\n popoverElementRef?: React.RefObject<HTMLElement | null>;\n /** Inline styles forwarded to the Popover content (portal or inline). Useful for min-width overrides. */\n popoverContentStyleProperty?: React.CSSProperties;\n};\n\nexport const Dropdown: FC<DropdownProps> = (props) => {\n const isControlledSelection = props.selectedValue !== undefined;\n const isControlledOpen = props.isOpen !== undefined;\n\n const [internalIsOpen, setInternalIsOpen] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [internalSelectedValues, setInternalSelectedValues] = useState<DropdownValue[]>(() =>\n props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : []\n );\n const popoverRef = useRef<HTMLDivElement & PopoverHandle>(null);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const labelId = useStableId(undefined, 'dropdown-label');\n const valueId = useStableId(undefined, 'dropdown-value');\n const listboxId = useStableId(undefined, 'dropdown-listbox');\n\n // Derived state: controlled props take precedence over internal state\n const isDropDownOpen = isControlledOpen ? props.isOpen! : internalIsOpen;\n const selectedDropDownValues = isControlledSelection\n ? (Array.isArray(props.selectedValue) ? props.selectedValue : props.selectedValue ? [props.selectedValue] : [])\n : internalSelectedValues;\n\n const setIsDropDownOpen = (value: boolean) => {\n if (!isControlledOpen) {\n setInternalIsOpen(value);\n }\n props.onOpenChange?.(value);\n };\n\n const setSelectedDropDownValues = (values: DropdownValue[]) => {\n if (!isControlledSelection) {\n setInternalSelectedValues(values);\n }\n };\n\n const {\n selectBy = '',\n optionsUniqueBy = '',\n displaySelected = false,\n dropDownOptions,\n defaultText = 'Select',\n iconColor = 'var(--color-gray-700)',\n disabled = false,\n dropdownClassName = '',\n hasError = false,\n errorMessage = '',\n customDropdownContent = null,\n isBorderless = false,\n shouldShowSearch = false,\n showSearchIcon = true,\n searchPlaceholder = 'Search...',\n searchResultEmptyMessage = 'No results found',\n ariaLabel = '',\n customSelectedValue = '',\n isWithPortal = false,\n firstOptionAsHeading = false\n } = props;\n\n useEffect(() => {\n if (!isControlledSelection) {\n const newValues = props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : [];\n setInternalSelectedValues(newValues);\n }\n }, [props?.defaultSelectedValue, isControlledSelection]);\n\n useEffect(() => {\n if (!isDropDownOpen) {\n setSearchQuery('');\n }\n }, [isDropDownOpen]);\n\n // Focus search input when dropdown opens with search enabled\n useEffect(() => {\n if (isDropDownOpen && shouldShowSearch && searchInputRef.current) {\n requestAnimationFrame(() => searchInputRef.current?.focus());\n }\n }, [isDropDownOpen, shouldShowSearch]);\n\n // Populate caller's popoverElementRef with the Popover wrapper element.\n // Runs after mount so popoverRef.current is set.\n useLayoutEffect(() => {\n if (props.popoverElementRef) {\n props.popoverElementRef.current = popoverRef.current?.element ?? null;\n }\n });\n\n const isMultiSelect = props?.type === 'multi-select';\n\n const getFilteredOptions = () => {\n if (!searchQuery.trim()) {\n return dropDownOptions || [];\n }\n return (dropDownOptions || []).filter((option) => {\n const optionValue = option?.[selectBy]?.toString().toLowerCase() || '';\n return optionValue.includes(searchQuery.toLowerCase());\n });\n };\n\n const handleDropDownOptionClick = (dropDownOption: any) => {\n setSelectedDropDownValues([dropDownOption]);\n setIsDropDownOpen(false);\n props?.onOptionClick?.(dropDownOption);\n // Restore focus to the trigger after portal unmounts.\n // Double rAF ensures this runs after React re-renders AND the focus trap safety net,\n // getting the final say on focus.\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n popoverRef.current?.focusTrigger();\n });\n });\n };\n\n // Use useCombobox hook for keyboard navigation (only for single-select)\n const filteredOptions = getFilteredOptions();\n const {\n listboxProps,\n getOptionProps,\n highlightedIndex,\n setHighlightedIndex,\n containerProps: comboboxContainerProps,\n inputProps: comboboxInputProps,\n isKeyboardFocused: isSingleSelectKeyboardFocused\n } = useCombobox({\n items: isMultiSelect ? [] : filteredOptions, // Only use for single-select\n isOpen: isDropDownOpen && !isMultiSelect,\n onOpenChange: setIsDropDownOpen,\n onSelect: (item: DropdownValue) => {\n handleDropDownOptionClick(item);\n },\n listboxId,\n disabled: isMultiSelect || disabled,\n hasItems: filteredOptions.length > 0\n });\n\n // Second useCombobox for multi-select: provides ARIA props, keyboard navigation, and auto-scroll.\n // Enter/Space are intercepted in multiSelectOnKeyDown to avoid the hook's highlight reset after select.\n const {\n inputProps: multiSelectComboboxInputProps,\n listboxProps: multiSelectListboxProps,\n containerProps: multiSelectContainerProps,\n highlightedIndex: highlightedMultiSelectIndex,\n setHighlightedIndex: setHighlightedMultiSelectIndex,\n isKeyboardFocused: isMultiSelectKeyboardFocused\n } = useCombobox({\n items: isMultiSelect ? filteredOptions : [],\n isOpen: isDropDownOpen && isMultiSelect,\n onOpenChange: setIsDropDownOpen,\n onSelect: () => {},\n listboxId,\n disabled: !isMultiSelect,\n loop: false,\n hasItems: filteredOptions.length > 0,\n closeOnTab: false\n });\n\n useEffect(() => {\n if (isDropDownOpen && filteredOptions.length === 0 && (searchQuery.trim() || dropDownOptions?.length === 0)) {\n announce(searchResultEmptyMessage, { assertiveness: 'polite', batchId: 'dropdown-empty-state', delay: 300 });\n }\n }, [filteredOptions.length, isDropDownOpen, searchQuery, dropDownOptions?.length]);\n\n const getSelectedDropDownValue = (option: DropdownValue, isSrcOption: boolean = false) => {\n if (isMultiSelect) {\n return defaultText;\n }\n\n // if custom selected value is provided, use it instead of the option value\n if (isSrcOption && customSelectedValue) {\n return customSelectedValue;\n }\n\n return option?.[selectBy] || defaultText;\n };\n\n const clearSelectedDropDownValues = () => {\n setSelectedDropDownValues([]);\n props?.onClear?.();\n };\n\n const optionChip = (option: DropdownValue, srcOption: boolean = false) => {\n if (props?.renderOptionChip) {\n return props?.renderOptionChip(option, srcOption);\n }\n\n if (isMultiSelect && selectedDropDownValues?.length > 0) {\n const firstSelectedLabel = selectedDropDownValues[0]?.[selectBy] || '';\n const remainingCount = selectedDropDownValues.length - 1;\n\n // For multiple selections: text takes remaining space, count takes minimum space needed\n return (\n <div className={`option-chip flex items-center w-full`}>\n <div\n className={`${remainingCount > 0 ? 'w-full' : 'flex-1'} truncate`}\n >{`${defaultText}: ${firstSelectedLabel}`}</div>\n {remainingCount > 0 && <div className=\"flex-shrink-0\">+{remainingCount}</div>}\n </div>\n );\n }\n\n const selectedLabel = getSelectedDropDownValue(option, srcOption);\n const hasVisibleLabel = !!props?.label || !!props?.ariaLabelledBy;\n const showPrefix = srcOption && defaultText && option?.[selectBy] && !customSelectedValue && !hasVisibleLabel;\n\n return (\n <p className={`option-chip flex flex-1 items-center justify-between`}>\n {showPrefix ? `${defaultText}: ${selectedLabel}` : selectedLabel}\n </p>\n );\n };\n\n const renderSearchInput = (extraInputProps: Record<string, any>) => (\n <div className=\" w-full relative flex items-center border-b border-[var(--color-gray-300)]\">\n <InputWithIcon\n leftIcon={showSearchIcon ? { name: 'search', position: 'left', style: { color: 'var(--color-gray-500)' } } : undefined}\n value={searchQuery}\n onChange={(value) => setSearchQuery(value)}\n placeholder={searchPlaceholder}\n style={{ margin: 0, gap: 0 }}\n inputStyle={{ width: '100%', border: 'none', outline: 'none' }}\n automationId=\"se-design-dropdown-search\"\n ariaLabel={searchPlaceholder}\n inputRef={searchInputRef}\n inputProps={extraInputProps}\n />\n </div>\n );\n\n const renderSearchBar = () => {\n if (isMultiSelect) {\n return renderSearchInput({\n ...multiSelectComboboxInputProps,\n onKeyDown: (e: React.KeyboardEvent) => multiSelectOnKeyDown(e, true)\n });\n }\n\n // Single-select: wrap onKeyDown to add Escape → focusTrigger (portal-safe)\n return renderSearchInput({\n ...comboboxInputProps,\n onKeyDown: (e: React.KeyboardEvent) => {\n comboboxInputProps.onKeyDown(e);\n if (e.key === 'Escape') {\n requestAnimationFrame(() => popoverRef.current?.focusTrigger());\n }\n }\n });\n };\n\n const dropDownOptionJsx = (dropDownOption: DropdownValue, index: number) => {\n const optionTxt = dropDownOption[selectBy];\n const dropDownSelectedValue = selectedDropDownValues[0]?.[selectBy] || defaultText;\n const selectByUniqueId = optionsUniqueBy?.length\n ? dropDownOption[optionsUniqueBy] == selectedDropDownValues[0]?.[optionsUniqueBy]\n : true;\n const isOptionSelected = displaySelected && optionTxt === dropDownSelectedValue && selectByUniqueId;\n const isHighlighted = highlightedIndex === index;\n const optionProps = !isMultiSelect ? getOptionProps(index, isOptionSelected) : {};\n\n return (\n <div\n key={dropDownOption.id || dropDownOption.value}\n className={`option break-words px-3 py-2 hover:bg-[var(--color-gray-100)] cursor-pointer select-none flex items-center justify-between ${\n isOptionSelected ? 'selected' : ''\n } ${isHighlighted ? `bg-[var(--color-gray-100)]${isSingleSelectKeyboardFocused ? ' outline outline-[length:var(--focus-width)] -outline-offset-2 outline-[var(--focus-color)]' : ''}` : ''}`}\n onClick={() => handleDropDownOptionClick(dropDownOption)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n handleDropDownOptionClick(dropDownOption);\n } else if (e.key === 'Escape') {\n requestAnimationFrame(() => popoverRef.current?.focusTrigger());\n }\n }}\n tabIndex={-1}\n data-automation-id={`dropdown-option-${dropDownOption?.automationId || index}`}\n {...optionProps}\n aria-selected={isOptionSelected ? 'true' : 'false'}\n >\n {optionChip({ ...dropDownOption, isOptionSelected }, false)}\n {isOptionSelected && <Icon name=\"checkmark\" stroke={iconColor} />}\n </div>\n );\n };\n\n const renderDropdownContents = () => {\n return (\n <>\n {props?.label && firstOptionAsHeading && (\n <div\n aria-hidden=\"true\"\n className=\"px-3 pt-2 pb-1 text-[var(--color-gray-650)] text-xs cursor-default select-none\"\n >\n {props.label}\n </div>\n )}\n {shouldShowSearch && renderSearchBar()}\n <div\n className={`dropdown-content dropdown-options${shouldShowSearch ? '' : ' flex flex-col max-h-80 overflow-y-auto'}`}\n {...(shouldShowSearch ? {} : {\n ...listboxProps,\n 'aria-label': `${defaultText} options`,\n style: { outline: 'none' },\n tabIndex: -1,\n 'aria-activedescendant': comboboxInputProps['aria-activedescendant'],\n onKeyDown: (e: React.KeyboardEvent) => {\n comboboxContainerProps.onKeyDownCapture?.(e as React.KeyboardEvent<HTMLElement>);\n if (e.key === ' ') {\n e.preventDefault();\n if (highlightedIndex >= 0 && filteredOptions[highlightedIndex]) {\n handleDropDownOptionClick(filteredOptions[highlightedIndex]);\n }\n return;\n }\n comboboxInputProps.onKeyDown(e);\n },\n onFocus: () => {\n if (highlightedIndex === -1 && filteredOptions.length > 0) {\n setHighlightedIndex(0);\n }\n }\n })}\n >\n {shouldShowSearch ? (\n <div\n className=\"flex flex-col max-h-80 overflow-y-auto\"\n aria-label={`${defaultText} options`}\n {...listboxProps}\n >\n {filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption, index) => dropDownOptionJsx(dropDownOption, index))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-700)] text-sm\">\n {searchResultEmptyMessage}\n </div>\n )}\n </div>\n ) : (\n filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption, index) => dropDownOptionJsx(dropDownOption, index))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-700)] text-sm\">\n {searchResultEmptyMessage}\n </div>\n )\n )}\n </div>\n </>\n );\n };\n\n const handleMultiSelectDropdownOptionClick = (isSelected: boolean, dropDownOption: DropdownValue) => {\n let newSelectedDropDownValues: DropdownValue[] = [];\n if (isSelected) {\n newSelectedDropDownValues = [...selectedDropDownValues, dropDownOption];\n } else {\n newSelectedDropDownValues = selectedDropDownValues?.filter(\n (option) => option[optionsUniqueBy] !== dropDownOption[optionsUniqueBy]\n );\n }\n setSelectedDropDownValues(newSelectedDropDownValues);\n };\n\n const handleApplySelectedDropDownValues = () => {\n popoverRef.current?.togglePopover();\n popoverRef.current?.focusTrigger();\n props?.onApply?.(selectedDropDownValues);\n };\n\n // Wraps the multi-select useCombobox's onKeyDown.\n // - Intercepts Enter/Space to toggle selection without resetting the highlight\n // (the hook resets highlightedIndex to -1 after onSelect, which is wrong for multi-select).\n // - When isSearchInput is true, Space is left for typing.\n // - Adds focusTrigger on Escape (Popover's handler is unreliable for portals).\n const multiSelectOnKeyDown = (e: React.KeyboardEvent, isSearchInput: boolean = false) => {\n if (isSearchInput && e.key === ' ') return;\n\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n if (highlightedMultiSelectIndex >= 0 && highlightedMultiSelectIndex < filteredOptions.length) {\n const option = filteredOptions[highlightedMultiSelectIndex];\n const isSelected = selectedDropDownValues.some(\n (v) => v[optionsUniqueBy] === option[optionsUniqueBy]\n );\n handleMultiSelectDropdownOptionClick(!isSelected, option);\n }\n return;\n }\n\n multiSelectComboboxInputProps.onKeyDown(e);\n\n if (e.key === 'Escape') {\n e.stopPropagation();\n requestAnimationFrame(() => popoverRef.current?.focusTrigger());\n }\n };\n\n const multiSelectDropdownOptionJSX = (dropDownOption: DropdownValue, index: number) => {\n const isOptionSelected = selectedDropDownValues.some(\n (option) => option[optionsUniqueBy] === dropDownOption[optionsUniqueBy]\n );\n const optionId = `${listboxId}-option-${index}`;\n const isHighlighted = highlightedMultiSelectIndex === index;\n\n return (\n <div\n key={dropDownOption.id || dropDownOption.value}\n id={optionId}\n role=\"option\"\n aria-selected={isOptionSelected}\n className={`option px-3 py-2 hover:bg-[var(--color-gray-100)] cursor-pointer select-none flex items-center gap-2 ${\n isHighlighted ? `bg-[var(--color-gray-100)]${isMultiSelectKeyboardFocused ? ' outline outline-[length:var(--focus-width)] -outline-offset-2 outline-[var(--focus-color)]' : ''}` : ''\n }`}\n onClick={() => handleMultiSelectDropdownOptionClick(!isOptionSelected, dropDownOption)}\n data-automation-id={`dropdown-option-${dropDownOption?.automationId || index}`}\n >\n <Checkbox\n tabIndex={-1}\n ariaHidden\n checked={isOptionSelected}\n onChange={() => {}}\n className=\"pointer-events-none\"\n />\n <span className=\"checkbox-label\">{dropDownOption?.label}</span>\n </div>\n );\n };\n\n const renderMultiSelectDropdownContents = () => {\n return (\n <div\n onKeyDown={(e) => {\n // Stop all Tab events from reaching Popover's handlePopoverContentKeyDown (which closes on Tab).\n // Tab flow is managed by the footer onKeyDown: forward Tab from Apply closes and advances\n // focus past trigger; Shift+Tab returns to search/listbox.\n if (e.key === 'Tab') {\n e.stopPropagation();\n }\n }}\n >\n {shouldShowSearch && renderSearchBar()}\n <div\n className={`dropdown-content dropdown-options${shouldShowSearch ? '' : ' flex flex-col max-h-80 overflow-y-auto'}`}\n {...(shouldShowSearch ? {} : {\n ...multiSelectListboxProps,\n 'aria-label': `${defaultText} options`,\n 'aria-multiselectable': 'true',\n style: { outline: 'none' },\n tabIndex: -1,\n 'aria-activedescendant': multiSelectComboboxInputProps['aria-activedescendant'],\n onKeyDown: (e: React.KeyboardEvent) => multiSelectOnKeyDown(e, false),\n onFocus: () => {\n if (highlightedMultiSelectIndex === -1 && filteredOptions.length > 0) {\n setHighlightedMultiSelectIndex(0);\n }\n }\n })}\n >\n {shouldShowSearch ? (\n <div\n className=\"flex flex-col max-h-80 overflow-y-auto\"\n {...multiSelectListboxProps}\n aria-label={`${defaultText} options`}\n aria-multiselectable=\"true\"\n >\n {filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption, index) => multiSelectDropdownOptionJSX(dropDownOption, index))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-700)] text-sm\">\n {searchResultEmptyMessage}\n </div>\n )}\n </div>\n ) : (\n filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption, index) => multiSelectDropdownOptionJSX(dropDownOption, index))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-700)] text-sm\">\n {searchResultEmptyMessage}\n </div>\n )\n )}\n </div>\n <div\n className=\"flex items-center justify-end gap-4 p-3 border-t border-[var(--color-gray-200)]\"\n onKeyDown={(e) => {\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Home' || e.key === 'End') {\n // Stop arrow keys from reaching Popover's handleArrowKeyNavigation\n // which would move focus out of the CTA buttons back into options\n e.stopPropagation();\n return;\n }\n if (e.key === 'Tab' && !e.shiftKey) {\n // Forward Tab from Apply — close dropdown and advance focus past trigger.\n // The wrapper stopPropagation blocks Popover's Tab handler, so we replicate\n // its portal-safe focus advance here (Popover lines 559-569).\n const applyEl = e.currentTarget.querySelector('[data-automation-id=\"se-design-dropdown-apply-button\"]');\n if (document.activeElement === applyEl) {\n e.stopPropagation();\n popoverRef.current?.togglePopover();\n if (isWithPortal) {\n // Portal: manually advance focus past trigger (portal Tab order is wrong)\n e.preventDefault();\n const srcEl = popoverRef.current?.element;\n const focusables = getFocusableElements({ container: document.body, filterHidden: true });\n const idx = srcEl ? focusables.indexOf(srcEl) : -1;\n const next = focusables[idx + 1];\n if (next) (next as HTMLElement).focus();\n else (srcEl as HTMLElement)?.focus();\n }\n // Non-portal: togglePopover closes, browser Tab naturally advances focus\n }\n } else if (e.key === 'Tab' && e.shiftKey) {\n e.preventDefault();\n e.stopPropagation();\n if (shouldShowSearch) {\n searchInputRef.current?.focus();\n } else {\n multiSelectListboxProps.ref.current?.focus();\n }\n }\n }}\n >\n <Button label=\"Clear\" type=\"link\" size=\"sm\" onClick={clearSelectedDropDownValues} automationId=\"se-design-dropdown-clear-button\" />\n <Button label=\"Apply\" type=\"primary\" size=\"sm\" onClick={handleApplySelectedDropDownValues} automationId=\"se-design-dropdown-apply-button\" />\n </div>\n </div>\n );\n };\n\n const renderDropdownSelect = () => {\n const borderColor = isDropDownOpen\n ? 'border-[var(--color-blue-500)]'\n : disabled\n ? 'border-[var(--color-gray-300)]'\n : 'border-[var(--color-gray-600)]';\n const errorBorderColor = hasError ? 'border-[var(--color-red-500)]' : '';\n const dropDownSelectClass = `dropdown-src-element bg-[var(--color-white)] flex px-3 py-2 ${\n isBorderless ? 'border-0' : `border rounded-md ${errorBorderColor ? errorBorderColor : borderColor}`\n } flex items-center ${dropdownClassName}`;\n\n return (\n <div className={dropDownSelectClass}>\n <div\n id={valueId}\n className=\"flex-1 min-w-0\"\n data-automation-id={props?.dropDownSelectAutomationId || 'selected-dropdown-value'}\n >\n {optionChip(selectedDropDownValues[0], true)}\n </div>\n <div className=\"flex-shrink-0 ml-2\" aria-hidden=\"true\">\n <Icon\n name={'chevron'}\n rotation={isDropDownOpen ? '180' : '0'}\n className={`transition-transform`}\n stroke={iconColor}\n />\n </div>\n </div>\n );\n };\n\n const getDropdownAriaLabel = () => {\n const selectedLabel = selectedDropDownValues[0]?.[selectBy];\n if (ariaLabel && selectedLabel) {\n return `${ariaLabel}, ${selectedLabel}`;\n }\n return ariaLabel || defaultText || 'Select option';\n };\n\n // Trigger is always a button that reveals a listbox popup (Select/Listbox pattern).\n // For search-enabled dropdowns, the combobox role lives on the search input inside the popup.\n // This matches React Aria (useSelect), Radix (Select), and Headless UI (Listbox) — all use\n // role=\"button\" with real focus on options, separate from their Combobox components.\n const triggerSourceRole = 'button';\n\n // Trigger is always role=\"button\" — combobox ARIA (aria-activedescendant etc.)\n // lives on the search input inside the popup, not on the trigger.\n // Trigger only needs aria-haspopup + aria-expanded (Popover handles) + aria-controls.\n\n return (\n <div\n className={`se-design-dropdown-container${props?.className ? ` ${props?.className}` : ''}`}\n style={props?.style}\n >\n {props?.label ? (\n <div id={labelId} className={`se-design-dropdown-label ${firstOptionAsHeading ? 'sr-only' : 'mb-[3px] text-[var(--color-gray-700)] text-sm'}`}>\n {props?.label}\n </div>\n ) : !props?.ariaLabelledBy && ariaLabel ? (\n <span id={labelId} className=\"sr-only\">{ariaLabel}</span>\n ) : null}\n <div\n style={props?.style}\n className={`${disabled ? 'bg-[var(--color-gray-50)] rounded-md cursor-not-allowed' : ''}`}\n {...(!isMultiSelect ? {\n ...comboboxContainerProps,\n onKeyDownCapture: (e: React.KeyboardEvent<HTMLElement>) => {\n // Handle Escape/Tab BEFORE dismiss — React unmounts the popup after\n // dismiss's setState, so bubble-phase handlers never fire.\n if ((e.key === 'Escape' || e.key === 'Tab') && isDropDownOpen) {\n e.stopPropagation(); // prevent Popover wrapper + parent sidebar from seeing Escape\n popoverRef.current?.focusTrigger();\n }\n comboboxContainerProps.onKeyDownCapture?.(e);\n },\n // Portal content lives in document.body — focus moving into it looks like \"focus out\" to\n // the container's blur handler, causing immediate close. Suppress it; the Popover's own\n // onBlur handler checks both source and portal content and handles dismissal correctly.\n ...(isWithPortal ? { onBlurCapture: undefined } : {})\n } : {\n // Multi-select: only spread focus-tracking handlers for isKeyboardFocused.\n // Dismiss is handled by Popover — don't spread onBlurCapture.\n onPointerMove: multiSelectContainerProps.onPointerMove,\n onPointerDown: multiSelectContainerProps.onPointerDown,\n onPointerUp: multiSelectContainerProps.onPointerUp,\n onFocusCapture: multiSelectContainerProps.onFocusCapture,\n onKeyDownCapture: (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Escape' && isDropDownOpen) {\n e.stopPropagation();\n popoverRef.current?.focusTrigger();\n }\n // When arrow keys are pressed while focus is still on the wrapper (before\n // focus-on-open completes), redirect focus into the content so the arrow\n // key handler on the listbox/search can process it.\n if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && isDropDownOpen) {\n const target = shouldShowSearch\n ? searchInputRef.current\n : multiSelectListboxProps.ref.current;\n if (target && document.activeElement !== target && !target.contains(document.activeElement as Node)) {\n target.focus();\n }\n }\n multiSelectContainerProps.onKeyDownCapture?.(e);\n }\n })}\n >\n <Popover\n ref={popoverRef}\n isPopoverOpen={isDropDownOpen}\n isWithPortal={isWithPortal}\n renderPopoverContents={\n customDropdownContent\n ? customDropdownContent\n : isMultiSelect\n ? renderMultiSelectDropdownContents\n : renderDropdownContents\n }\n contentWidth={'full'}\n popoverContentStyleProperty={props.popoverContentStyleProperty}\n renderPopoverSrcElement={\n props.renderSrcElement\n ? () => props.renderSrcElement!({ isOpen: isDropDownOpen, selectedValue: selectedDropDownValues })\n : renderDropdownSelect\n }\n onPopoverToggle={(value) => {\n setIsDropDownOpen(value);\n if (value && !isMultiSelect && selectedDropDownValues.length > 0) {\n // Highlight the currently selected option when the dropdown opens (APG Select pattern)\n const selectedIndex = filteredOptions.findIndex(\n (option) => optionsUniqueBy\n ? option[optionsUniqueBy] === selectedDropDownValues[0]?.[optionsUniqueBy]\n : option[selectBy] === selectedDropDownValues[0]?.[selectBy]\n );\n if (selectedIndex >= 0) {\n setHighlightedIndex(selectedIndex);\n }\n }\n if (value && !shouldShowSearch) {\n // Focus listbox after portal mounts and browser paints.\n // Double rAF ensures the portal DOM is ready. Also acts as fallback\n // if the arrow-key redirect in onKeyDownCapture fires first.\n const ref = isMultiSelect ? multiSelectListboxProps.ref : listboxProps.ref;\n requestAnimationFrame(() => requestAnimationFrame(() => ref.current?.focus()));\n }\n // When search is enabled, the useEffect at line 145 focuses the search input via rAF.\n }}\n disabled={disabled}\n automationId={props?.dropDownSrcAutomationId}\n popoverContentAutomationId={props?.dropDownContentAutomationId}\n ariaLabelledBy={\n props?.label || props?.ariaLabelledBy || ariaLabel\n ? [props?.label || (!props?.ariaLabelledBy && ariaLabel) ? labelId : props?.ariaLabelledBy, valueId].filter(Boolean).join(' ')\n : undefined\n }\n ariaLabel={!props?.label && !ariaLabel && !props?.ariaLabelledBy ? getDropdownAriaLabel() : undefined}\n sourceRole={triggerSourceRole}\n {...{ 'aria-haspopup': 'listbox' }}\n {...(isDropDownOpen ? { 'aria-controls': listboxId } : {})}\n />\n </div>\n {hasError && <div className=\"text-[var(--color-red-500)] text-sm\">{errorMessage}</div>}\n </div>\n );\n};\n"],"names":["Dropdown","props","isControlledSelection","selectedValue","undefined","isControlledOpen","isOpen","internalIsOpen","setInternalIsOpen","useState","searchQuery","setSearchQuery","internalSelectedValues","setInternalSelectedValues","defaultSelectedValue","Array","isArray","popoverRef","useRef","searchInputRef","labelId","useStableId","valueId","listboxId","isDropDownOpen","selectedDropDownValues","setIsDropDownOpen","value","onOpenChange","setSelectedDropDownValues","values","selectBy","optionsUniqueBy","displaySelected","dropDownOptions","defaultText","iconColor","disabled","dropdownClassName","hasError","errorMessage","customDropdownContent","isBorderless","shouldShowSearch","showSearchIcon","searchPlaceholder","searchResultEmptyMessage","ariaLabel","customSelectedValue","isWithPortal","firstOptionAsHeading","useEffect","newValues","current","requestAnimationFrame","focus","useLayoutEffect","popoverElementRef","element","isMultiSelect","type","getFilteredOptions","trim","filter","option","toString","toLowerCase","includes","handleDropDownOptionClick","dropDownOption","onOptionClick","focusTrigger","filteredOptions","listboxProps","getOptionProps","highlightedIndex","setHighlightedIndex","containerProps","comboboxContainerProps","inputProps","comboboxInputProps","isKeyboardFocused","isSingleSelectKeyboardFocused","useCombobox","items","onSelect","item","hasItems","length","multiSelectComboboxInputProps","multiSelectListboxProps","multiSelectContainerProps","highlightedMultiSelectIndex","setHighlightedMultiSelectIndex","isMultiSelectKeyboardFocused","loop","closeOnTab","announce","assertiveness","batchId","delay","getSelectedDropDownValue","isSrcOption","clearSelectedDropDownValues","onClear","optionChip","srcOption","renderOptionChip","firstSelectedLabel","remainingCount","React","createElement","className","selectedLabel","hasVisibleLabel","label","ariaLabelledBy","showPrefix","renderSearchInput","extraInputProps","InputWithIcon","leftIcon","name","position","style","color","onChange","placeholder","margin","gap","inputStyle","width","border","outline","automationId","inputRef","renderSearchBar","onKeyDown","e","multiSelectOnKeyDown","key","dropDownOptionJsx","index","optionTxt","dropDownSelectedValue","selectByUniqueId","isOptionSelected","isHighlighted","optionProps","_extends","id","onClick","preventDefault","tabIndex","Icon","stroke","renderDropdownContents","Fragment","onKeyDownCapture","onFocus","map","handleMultiSelectDropdownOptionClick","isSelected","newSelectedDropDownValues","handleApplySelectedDropDownValues","togglePopover","onApply","isSearchInput","some","v","stopPropagation","multiSelectDropdownOptionJSX","optionId","role","Checkbox","ariaHidden","checked","renderMultiSelectDropdownContents","shiftKey","applyEl","currentTarget","querySelector","document","activeElement","srcEl","focusables","getFocusableElements","container","body","filterHidden","idx","indexOf","next","ref","Button","size","renderDropdownSelect","borderColor","errorBorderColor","dropDownSelectClass","dropDownSelectAutomationId","rotation","getDropdownAriaLabel","onPointerMove","onPointerDown","onPointerUp","onFocusCapture","target","contains","onBlurCapture","Popover","isPopoverOpen","renderPopoverContents","contentWidth","popoverContentStyleProperty","renderPopoverSrcElement","renderSrcElement","onPopoverToggle","selectedIndex","findIndex","dropDownSrcAutomationId","popoverContentAutomationId","dropDownContentAutomationId","Boolean","join","sourceRole"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkEO,MAAMA,KAA+BC,CAAAA,MAAU;AACpD,QAAMC,IAAwBD,EAAME,kBAAkBC,QAChDC,IAAmBJ,EAAMK,WAAWF,QAEpC,CAACG,GAAgBC,E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,CAAC;AAAA,MAC/E;AAAA,IAEF;AAAA,IACAlB,UAAAA;AAAAA,IACAiG,cAAcrI,GAAO2N;AAAAA,IACrBC,4BAA4B5N,GAAO6N;AAAAA,IACnC1G,gBACEnH,GAAOkH,SAASlH,GAAOmH,kBAAkBrE,IACrC,CAAC9C,GAAOkH,SAAU,CAAClH,GAAOmH,kBAAkBrE,IAAa3B,IAAUnB,GAAOmH,gBAAgB9F,CAAO,EAAEyC,OAAOgK,OAAO,EAAEC,KAAK,GAAG,IAC3H5N;AAAAA,IAEN2C,WAAW,CAAC9C,GAAOkH,SAAS,CAACpE,KAAa,CAAC9C,GAAOmH,iBAAiBsF,GAAAA,IAAyBtM;AAAAA,IAC5F6N,YAhHkB;AAAA,IAiHZ,iBAAiB;AAAA,EAAA,GAClBzM,IAAiB;AAAA,IAAE,iBAAiBD;AAAAA,EAAAA,IAAc,CAAA,CAAE,CAC1D,CACE,GACJgB,KAAYuE,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKC,WAAU;AAAA,EAAA,GAAuCxE,EAAkB,CAClF;AAET;"}
package/dist/index4.js CHANGED
@@ -1,20 +1,20 @@
1
- import o, { forwardRef as I, useRef as L, useEffect as z } from "react";
2
- import { getA11yNameAttributes as D } from "./index81.js";
3
- import { useAccessiblePress as U } from "./index67.js";
1
+ import o, { forwardRef as F, useRef as G, useEffect as H } from "react";
2
+ import { getA11yNameAttributes as J } from "./index81.js";
3
+ import { useAccessiblePress as K } from "./index67.js";
4
4
  import "./index72.js";
5
- import { announce as q } from "./index75.js";
6
- import { Icon as b } from "./index6.js";
5
+ import { announce as L } from "./index75.js";
6
+ import { Icon as y } from "./index6.js";
7
7
  /* empty css */
8
- function c() {
9
- return c = Object.assign ? Object.assign.bind() : function(n) {
8
+ function u() {
9
+ return u = Object.assign ? Object.assign.bind() : function(n) {
10
10
  for (var s = 1; s < arguments.length; s++) {
11
11
  var r = arguments[s];
12
- for (var e in r) ({}).hasOwnProperty.call(r, e) && (n[e] = r[e]);
12
+ for (var t in r) ({}).hasOwnProperty.call(r, t) && (n[t] = r[t]);
13
13
  }
14
14
  return n;
15
- }, c.apply(null, arguments);
15
+ }, u.apply(null, arguments);
16
16
  }
17
- const a = "focus-outline", F = {
17
+ const a = "focus-outline", M = {
18
18
  primary: "primary-btn disabled-btn pointer-events-none cursor-not-allowed",
19
19
  secondary: "secondary-btn disabled-btn pointer-events-none cursor-not-allowed",
20
20
  ghost: "ghost-btn disabled-btn pointer-events-none cursor-not-allowed",
@@ -26,7 +26,7 @@ const a = "focus-outline", F = {
26
26
  // padding: 8px, 12px
27
27
  lg: "py-3 px-4 large"
28
28
  // padding: 12px, 16px
29
- }, f = {
29
+ }, h = {
30
30
  primary: `primary-btn ${a}`,
31
31
  secondary: `secondary-btn ${a}`,
32
32
  ghost: `ghost-btn ${a}`,
@@ -38,74 +38,83 @@ const a = "focus-outline", F = {
38
38
  // padding: 8px, 12px
39
39
  lg: "py-3 px-4 large"
40
40
  // padding: 12px, 16px
41
- }, G = {
41
+ }, Q = {
42
42
  blue: "theme-blue",
43
43
  red: "theme-red",
44
44
  yellow: "theme-yellow",
45
45
  green: "theme-green",
46
46
  ai: "theme-ai",
47
47
  white: "theme-white"
48
- }, H = /* @__PURE__ */ I(({
48
+ }, S = /* @__PURE__ */ F(({
49
49
  type: n = "primary",
50
50
  theme: s = "blue",
51
51
  size: r = "md",
52
- label: e = "",
53
- iconPosition: u = "left",
54
- disabled: y = !1,
55
- loading: t = !1,
56
- className: h = "",
57
- iconProps: i = {
52
+ label: t = "",
53
+ iconPosition: p = "left",
54
+ disabled: w = !1,
55
+ loading: e = !1,
56
+ loadingLabel: l,
57
+ className: g = "",
58
+ iconProps: m = {
58
59
  name: ""
59
60
  },
60
- automationId: g = "",
61
- autoFocus: w = !1,
62
- ariaLabel: N,
63
- ariaLabelledBy: v,
64
- ariaDescribedBy: x,
65
- isPressed: k,
66
- onClick: C,
67
- onKeyboardActivate: E,
68
- ...$
69
- }, P) => {
70
- const m = n === "unstyled", p = L(t);
71
- z(() => {
72
- t && !p.current && q(e ? `${e}, loading` : "Loading"), p.current = t;
73
- }, [t, e]);
61
+ automationId: v = "",
62
+ autoFocus: N = !1,
63
+ ariaLabel: x,
64
+ ariaLabelledBy: k,
65
+ ariaDescribedBy: C,
66
+ isPressed: E,
67
+ onClick: $,
68
+ onKeyboardActivate: P,
69
+ onPointerDown: R,
70
+ onMouseDown: j,
71
+ onTouchStart: A,
72
+ ...B
73
+ }, O) => {
74
+ const c = n === "unstyled", b = e && l ? l : t, f = G(e);
75
+ H(() => {
76
+ e && !f.current && L(l || (t ? `${t}, loading` : "Loading"), {
77
+ delay: 300
78
+ }), f.current = e;
79
+ }, [e, t, l]);
74
80
  const {
75
- pressProps: R,
81
+ pressProps: _,
76
82
  isDisabled: d
77
- } = U({
78
- disabled: y,
79
- loading: t,
83
+ } = K({
84
+ disabled: w,
85
+ loading: e,
80
86
  isNative: !0,
81
87
  // native <button> => hook does NOT add Enter/Space onKeyDown
82
- pressed: k,
83
- onClick: C,
84
- onKeyboardActivate: E
85
- }), j = !m && n !== "link" ? f[r] : "", A = m ? "" : G[s], B = d ? F[n] : f[n], l = i?.name ? {
86
- ...i,
87
- stroke: d ? "var(--color-gray-600)" : i.stroke
88
- } : void 0, O = ["se-design-button", A, j, B, h, m ? "" : "rounded-[6px] inline-flex gap-1 items-center min-w-fit"].filter(Boolean).join(" "), _ = D({
89
- ariaLabel: N,
90
- ariaLabelledBy: v,
91
- ariaDescribedBy: x
88
+ pressed: E,
89
+ onClick: $,
90
+ onKeyboardActivate: P,
91
+ onPointerDown: R,
92
+ onMouseDown: j,
93
+ onTouchStart: A
94
+ }), I = !c && n !== "link" ? h[r] : "", z = c ? "" : Q[s], D = d ? M[n] : h[n], i = m?.name ? {
95
+ ...m,
96
+ stroke: d ? "var(--color-gray-600)" : m.stroke
97
+ } : void 0, U = ["se-design-button", z, I, D, g, c ? "" : "rounded-[6px] inline-flex gap-1 items-center min-w-fit"].filter(Boolean).join(" "), q = J({
98
+ ariaLabel: x,
99
+ ariaLabelledBy: k,
100
+ ariaDescribedBy: C
92
101
  });
93
- return /* @__PURE__ */ o.createElement("button", c({
94
- ref: P,
102
+ return /* @__PURE__ */ o.createElement("button", u({
103
+ ref: O,
95
104
  type: "button",
96
- className: O,
105
+ className: U,
97
106
  disabled: d,
98
- autoFocus: w,
99
- "data-automation-id": g
100
- }, $, R, _), t && /* @__PURE__ */ o.createElement("div", {
107
+ autoFocus: N,
108
+ "data-automation-id": v
109
+ }, B, _, q), e && /* @__PURE__ */ o.createElement("div", {
101
110
  "aria-hidden": "true",
102
111
  className: "animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full"
103
- }), !t && l?.name && u === "left" && /* @__PURE__ */ o.createElement(b, l), e && /* @__PURE__ */ o.createElement("span", {
112
+ }), !e && i?.name && p === "left" && /* @__PURE__ */ o.createElement(y, i), b && /* @__PURE__ */ o.createElement("span", {
104
113
  className: "button-label [font-weight:inherit]"
105
- }, e), !t && l?.name && u === "right" && /* @__PURE__ */ o.createElement(b, l));
114
+ }, b), !e && i?.name && p === "right" && /* @__PURE__ */ o.createElement(y, i));
106
115
  });
107
- H.displayName = "Button";
116
+ S.displayName = "Button";
108
117
  export {
109
- H as Button
118
+ S as Button
110
119
  };
111
120
  //# sourceMappingURL=index4.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index4.js","sources":["../src/components/Button/index.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef } from 'react';\nimport { Map } from '../../utils/common.types';\nimport { useAccessiblePress, getA11yNameAttributes } from '../../utils/a11y';\nimport { announce } from '../../utils/a11y/liveAnnouncer';\nimport { Icon, IconProps } from '../Icon';\nimport './style.scss';\n\n/**\n * Allows native button attributes (aria-*, data-*, etc.) to be passed through,\n * but keeps our own onClick/disabled/type typing AND aria-label/aria-labelledby/aria-describedby.\n * Note: We omit 'type' because we use it for button variant, not HTML type attribute.\n * The HTML type is always set to 'button' internally.\n */\ntype NativeButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'disabled' | 'type' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-pressed'\n>;\n\nexport interface ButtonProps extends NativeButtonProps {\n /**\n * Type of the button. \n */\n type?: 'primary' | 'secondary' | 'ghost' | 'link' | 'unstyled';\n /**\n * Color pallet of the button\n */\n theme?: 'blue' | 'red' | 'yellow' | 'green' | 'ai' | 'white';\n /**\n * Size of the button\n */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Button contents\n */\n label: string | '';\n /**\n * Icon props\n */\n iconProps?: IconProps;\n /**\n * Icon position\n */\n iconPosition?: 'left' | 'right';\n /**\n * Disabled state\n */\n disabled?: boolean;\n /**\n * Loading state - will disable button and show spinner\n */\n loading?: boolean;\n /**\n * Optional click handler (called for pointer/mouse activations)\n */\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Optional keyboard activation handler\n * Called when button is activated via keyboard (Enter/Space) or assistive technology virtual activation.\n * Use when you want to have different behavior for keyboard and pointer activations.\n * If not provided, onClick will be called for all activations.\n */\n onKeyboardActivate?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Custom class name\n */\n className?: string;\n /**\n * Automation ID for testing\n */\n automationId?: string;\n /**\n * If true, button will be focused on mount.\n * For programmatic focus control, use ref with .focus() instead.\n */\n autoFocus?: boolean;\n /**\n * Accessible name for the button. Use when there's no visible label (e.g., icon-only buttons).\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this button.\n * Preferred over ariaLabel when a visible label exists (keeps SR and visual text in sync).\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) that describe this button.\n * Provides additional context announced after the accessible name.\n */\n ariaDescribedBy?: string;\n /**\n * When true, sets aria-pressed for toggle/pressed state \n */\n isPressed?: boolean;\n}\n\nconst focusClass = 'focus-outline';\nconst disabledClassNames: Map = {\n primary: 'primary-btn disabled-btn pointer-events-none cursor-not-allowed',\n secondary: 'secondary-btn disabled-btn pointer-events-none cursor-not-allowed',\n ghost: 'ghost-btn disabled-btn pointer-events-none cursor-not-allowed',\n link: 'link-btn w-fit disabled-btn pointer-events-none cursor-not-allowed',\n unstyled: 'unstyled-btn disabled-btn pointer-events-none cursor-not-allowed',\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\nconst classNames: Map = {\n primary: `primary-btn ${focusClass}`,\n secondary: `secondary-btn ${focusClass}`,\n ghost: `ghost-btn ${focusClass}`,\n link: `link-btn w-fit ${focusClass}`,\n unstyled: `unstyled-btn ${focusClass}`,\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\n\nconst colorPalletClassNames: Map = {\n blue: 'theme-blue',\n red: 'theme-red',\n yellow: 'theme-yellow',\n green: 'theme-green',\n ai: 'theme-ai',\n white: 'theme-white'\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n type = 'primary',\n theme = 'blue',\n size = 'md',\n label = '',\n iconPosition = 'left',\n disabled = false,\n loading = false,\n className = '',\n iconProps = { name: '' },\n automationId = '',\n autoFocus = false,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n isPressed,\n onClick,\n onKeyboardActivate,\n ...props\n },\n ref\n ) => {\n const isUnstyled = type === 'unstyled';\n const prevLoadingRef = useRef(loading);\n\n useEffect(() => {\n if (loading && !prevLoadingRef.current) {\n announce(label ? `${label}, loading` : 'Loading');\n }\n prevLoadingRef.current = loading;\n }, [loading, label]);\n\n // Use shared hook for activation handling (pointer vs keyboard/virtual click routing)\n const { pressProps, isDisabled } = useAccessiblePress({\n disabled,\n loading,\n isNative: true, // native <button> => hook does NOT add Enter/Space onKeyDown\n pressed: isPressed,\n onClick: onClick as (e: React.MouseEvent<HTMLElement>) => void,\n onKeyboardActivate: onKeyboardActivate as (e: React.MouseEvent<HTMLElement>) => void\n });\n\n // Skip size/color classes for unstyled variant\n const sizeClassName = !isUnstyled && type !== 'link' ? classNames[size] : '';\n const colorPalletClassName = !isUnstyled ? colorPalletClassNames[theme] : '';\n const typeClassName = isDisabled ? disabledClassNames[type] : classNames[type];\n\n // Avoid mutating incoming iconProps\n const computedIconProps: IconProps | undefined = iconProps?.name\n ? {\n ...iconProps,\n stroke: isDisabled ? 'var(--color-gray-600)' : iconProps.stroke\n }\n : undefined;\n\n const buttonClassName = [\n 'se-design-button',\n colorPalletClassName,\n sizeClassName,\n typeClassName,\n className,\n !isUnstyled ? 'rounded-[6px] inline-flex gap-1 items-center min-w-fit' : ''\n ]\n .filter(Boolean)\n .join(' ');\n\n // Compute accessible name/description props with correct precedence\n const accessibleNameProps = getA11yNameAttributes({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy\n });\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={buttonClassName}\n disabled={isDisabled}\n autoFocus={autoFocus}\n data-automation-id={automationId}\n {...props}\n {...(pressProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n {...accessibleNameProps}\n >\n {loading && (\n <div\n aria-hidden=\"true\"\n className=\"animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full\"\n />\n )}\n {!loading && computedIconProps?.name && iconPosition === 'left' && (\n <Icon {...computedIconProps} />\n )}\n {label && <span className=\"button-label [font-weight:inherit]\">{label}</span>}\n {!loading && computedIconProps?.name && iconPosition === 'right' && (\n <Icon {...computedIconProps} />\n )}\n </button>\n );\n }\n);\n\nButton.displayName = 'Button';\n"],"names":["focusClass","disabledClassNames","primary","secondary","ghost","link","unstyled","sm","md","lg","classNames","colorPalletClassNames","blue","red","yellow","green","ai","white","Button","type","theme","size","label","iconPosition","disabled","loading","className","iconProps","name","automationId","autoFocus","ariaLabel","ariaLabelledBy","ariaDescribedBy","isPressed","onClick","onKeyboardActivate","props","ref","isUnstyled","prevLoadingRef","useRef","useEffect","current","announce","pressProps","isDisabled","useAccessiblePress","isNative","pressed","sizeClassName","colorPalletClassName","typeClassName","computedIconProps","stroke","undefined","buttonClassName","filter","Boolean","join","accessibleNameProps","getA11yNameAttributes","React","createElement","_extends","Icon","displayName"],"mappings":";;;;;;;;;;;;;;;;AAgGA,MAAMA,IAAa,iBACbC,IAA0B;AAAA,EAC9BC,SAAS;AAAA,EACTC,WAAW;AAAA,EACXC,OAAO;AAAA,EACPC,MAAM;AAAA,EACNC,UAAU;AAAA,EACVC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GACMC,IAAkB;AAAA,EACtBR,SAAS,eAAeF,CAAU;AAAA,EAClCG,WAAW,iBAAiBH,CAAU;AAAA,EACtCI,OAAO,aAAaJ,CAAU;AAAA,EAC9BK,MAAM,kBAAkBL,CAAU;AAAA,EAClCM,UAAU,gBAAgBN,CAAU;AAAA,EACpCO,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GAEME,IAA6B;AAAA,EACjCC,MAAM;AAAA,EACNC,KAAK;AAAA,EACLC,QAAQ;AAAA,EACRC,OAAO;AAAA,EACPC,IAAI;AAAA,EACJC,OAAO;AACT,GAEaC,sBACX,CACE;AAAA,EACEC,MAAAA,IAAO;AAAA,EACPC,OAAAA,IAAQ;AAAA,EACRC,MAAAA,IAAO;AAAA,EACPC,OAAAA,IAAQ;AAAA,EACRC,cAAAA,IAAe;AAAA,EACfC,UAAAA,IAAW;AAAA,EACXC,SAAAA,IAAU;AAAA,EACVC,WAAAA,IAAY;AAAA,EACZC,WAAAA,IAAY;AAAA,IAAEC,MAAM;AAAA,EAAA;AAAA,EACpBC,cAAAA,IAAe;AAAA,EACfC,WAAAA,IAAY;AAAA,EACZC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EAC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A,sBAAoBD;AAAAA,EAAAA,GAChBQ,GACCQ,GACDe,CAAmB,GAEtBnC,KACCqC,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACE,eAAY;AAAA,IACZrC,WAAU;AAAA,EAAA,CACX,GAEF,CAACD,KAAW4B,GAAmBzB,QAAQL,MAAiB,UACvDuC,gBAAAA,EAAAC,cAACE,GAASZ,CAAoB,GAE/B/B,KAASwC,gBAAAA,EAAAC,cAAA,QAAA;AAAA,IAAMrC,WAAU;AAAA,EAAA,GAAsCJ,CAAY,GAC3E,CAACG,KAAW4B,GAAmBzB,QAAQL,MAAiB,WACvDuC,gBAAAA,EAAAC,cAACE,GAASZ,CAAoB,CAE1B;AAEV,CACF;AAEAnC,EAAOgD,cAAc;"}
1
+ {"version":3,"file":"index4.js","sources":["../src/components/Button/index.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef } from 'react';\nimport { Map } from '../../utils/common.types';\nimport { useAccessiblePress, getA11yNameAttributes } from '../../utils/a11y';\nimport { announce } from '../../utils/a11y/liveAnnouncer';\nimport { Icon, IconProps } from '../Icon';\nimport './style.scss';\n\n/**\n * Allows native button attributes (aria-*, data-*, etc.) to be passed through,\n * but keeps our own onClick/disabled/type typing AND aria-label/aria-labelledby/aria-describedby.\n * Note: We omit 'type' because we use it for button variant, not HTML type attribute.\n * The HTML type is always set to 'button' internally.\n */\ntype NativeButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'disabled' | 'type' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-pressed'\n>;\n\nexport interface ButtonProps extends NativeButtonProps {\n /**\n * Type of the button. \n */\n type?: 'primary' | 'secondary' | 'ghost' | 'link' | 'unstyled';\n /**\n * Color pallet of the button\n */\n theme?: 'blue' | 'red' | 'yellow' | 'green' | 'ai' | 'white';\n /**\n * Size of the button\n */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Button contents\n */\n label: string | '';\n /**\n * Icon props\n */\n iconProps?: IconProps;\n /**\n * Icon position\n */\n iconPosition?: 'left' | 'right';\n /**\n * Disabled state\n */\n disabled?: boolean;\n /**\n * Loading state - will disable button and show spinner\n */\n loading?: boolean;\n /**\n * Custom label shown (both visually and announced to screen readers) when loading is true.\n * When omitted, the original label remains visible and SR announcement is \"${label}, loading\".\n */\n loadingLabel?: string;\n /**\n * Optional click handler (called for pointer/mouse activations)\n */\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Optional keyboard activation handler\n * Called when button is activated via keyboard (Enter/Space) or assistive technology virtual activation.\n * Use when you want to have different behavior for keyboard and pointer activations.\n * If not provided, onClick will be called for all activations.\n */\n onKeyboardActivate?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Custom class name\n */\n className?: string;\n /**\n * Automation ID for testing\n */\n automationId?: string;\n /**\n * If true, button will be focused on mount.\n * For programmatic focus control, use ref with .focus() instead.\n */\n autoFocus?: boolean;\n /**\n * Accessible name for the button. Use when there's no visible label (e.g., icon-only buttons).\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this button.\n * Preferred over ariaLabel when a visible label exists (keeps SR and visual text in sync).\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) that describe this button.\n * Provides additional context announced after the accessible name.\n */\n ariaDescribedBy?: string;\n /**\n * When true, sets aria-pressed for toggle/pressed state \n */\n isPressed?: boolean;\n}\n\nconst focusClass = 'focus-outline';\nconst disabledClassNames: Map = {\n primary: 'primary-btn disabled-btn pointer-events-none cursor-not-allowed',\n secondary: 'secondary-btn disabled-btn pointer-events-none cursor-not-allowed',\n ghost: 'ghost-btn disabled-btn pointer-events-none cursor-not-allowed',\n link: 'link-btn w-fit disabled-btn pointer-events-none cursor-not-allowed',\n unstyled: 'unstyled-btn disabled-btn pointer-events-none cursor-not-allowed',\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\nconst classNames: Map = {\n primary: `primary-btn ${focusClass}`,\n secondary: `secondary-btn ${focusClass}`,\n ghost: `ghost-btn ${focusClass}`,\n link: `link-btn w-fit ${focusClass}`,\n unstyled: `unstyled-btn ${focusClass}`,\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\n\nconst colorPalletClassNames: Map = {\n blue: 'theme-blue',\n red: 'theme-red',\n yellow: 'theme-yellow',\n green: 'theme-green',\n ai: 'theme-ai',\n white: 'theme-white'\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n type = 'primary',\n theme = 'blue',\n size = 'md',\n label = '',\n iconPosition = 'left',\n disabled = false,\n loading = false,\n loadingLabel,\n className = '',\n iconProps = { name: '' },\n automationId = '',\n autoFocus = false,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n isPressed,\n onClick,\n onKeyboardActivate,\n onPointerDown,\n onMouseDown,\n onTouchStart,\n ...props\n },\n ref\n ) => {\n const isUnstyled = type === 'unstyled';\n const visibleLabel = loading && loadingLabel ? loadingLabel : label;\n const prevLoadingRef = useRef(loading);\n\n useEffect(() => {\n if (loading && !prevLoadingRef.current) {\n announce(loadingLabel || (label ? `${label}, loading` : 'Loading'), { delay: 300 });\n }\n prevLoadingRef.current = loading;\n }, [loading, label, loadingLabel]);\n\n // Use shared hook for activation handling (pointer vs keyboard/virtual click routing)\n const { pressProps, isDisabled } = useAccessiblePress({\n disabled,\n loading,\n isNative: true, // native <button> => hook does NOT add Enter/Space onKeyDown\n pressed: isPressed,\n onClick: onClick as (e: React.MouseEvent<HTMLElement>) => void,\n onKeyboardActivate: onKeyboardActivate as (e: React.MouseEvent<HTMLElement>) => void,\n onPointerDown: onPointerDown as (e: React.PointerEvent<HTMLElement>) => void,\n onMouseDown: onMouseDown as (e: React.MouseEvent<HTMLElement>) => void,\n onTouchStart: onTouchStart as (e: React.TouchEvent<HTMLElement>) => void\n });\n\n // Skip size/color classes for unstyled variant\n const sizeClassName = !isUnstyled && type !== 'link' ? classNames[size] : '';\n const colorPalletClassName = !isUnstyled ? colorPalletClassNames[theme] : '';\n const typeClassName = isDisabled ? disabledClassNames[type] : classNames[type];\n\n // Avoid mutating incoming iconProps\n const computedIconProps: IconProps | undefined = iconProps?.name\n ? {\n ...iconProps,\n stroke: isDisabled ? 'var(--color-gray-600)' : iconProps.stroke\n }\n : undefined;\n\n const buttonClassName = [\n 'se-design-button',\n colorPalletClassName,\n sizeClassName,\n typeClassName,\n className,\n !isUnstyled ? 'rounded-[6px] inline-flex gap-1 items-center min-w-fit' : ''\n ]\n .filter(Boolean)\n .join(' ');\n\n // Compute accessible name/description props with correct precedence\n const accessibleNameProps = getA11yNameAttributes({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy\n });\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={buttonClassName}\n disabled={isDisabled}\n autoFocus={autoFocus}\n data-automation-id={automationId}\n {...props}\n {...(pressProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n {...accessibleNameProps}\n >\n {loading && (\n <div\n aria-hidden=\"true\"\n className=\"animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full\"\n />\n )}\n {!loading && computedIconProps?.name && iconPosition === 'left' && (\n <Icon {...computedIconProps} />\n )}\n {visibleLabel && (\n <span className=\"button-label [font-weight:inherit]\">{visibleLabel}</span>\n )}\n {!loading && computedIconProps?.name && iconPosition === 'right' && (\n <Icon {...computedIconProps} />\n )}\n </button>\n );\n }\n);\n\nButton.displayName = 'Button';\n"],"names":["focusClass","disabledClassNames","primary","secondary","ghost","link","unstyled","sm","md","lg","classNames","colorPalletClassNames","blue","red","yellow","green","ai","white","Button","type","theme","size","label","iconPosition","disabled","loading","loadingLabel","className","iconProps","name","automationId","autoFocus","ariaLabel","ariaLabelledBy","ariaDescribedBy","isPressed","onClick","onKeyboardActivate","onPointerDown","onMouseDown","onTouchStart","props","ref","isUnstyled","visibleLabel","prevLoadingRef","useRef","useEffect","current","announce","delay","pressProps","isDisabled","useAccessiblePress","isNative","pressed","sizeClassName","colorPalletClassName","typeClassName","computedIconProps","stroke","undefined","buttonClassName","filter","Boolean","join","accessibleNameProps","getA11yNameAttributes","React","createElement","_extends","Icon","displayName"],"mappings":";;;;;;;;;;;;;;;;AAqGA,MAAMA,IAAa,iBACbC,IAA0B;AAAA,EAC9BC,SAAS;AAAA,EACTC,WAAW;AAAA,EACXC,OAAO;AAAA,EACPC,MAAM;AAAA,EACNC,UAAU;AAAA,EACVC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GACMC,IAAkB;AAAA,EACtBR,SAAS,eAAeF,CAAU;AAAA,EAClCG,WAAW,iBAAiBH,CAAU;AAAA,EACtCI,OAAO,aAAaJ,CAAU;AAAA,EAC9BK,MAAM,kBAAkBL,CAAU;AAAA,EAClCM,UAAU,gBAAgBN,CAAU;AAAA,EACpCO,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GAEME,IAA6B;AAAA,EACjCC,MAAM;AAAA,EACNC,KAAK;AAAA,EACLC,QAAQ;AAAA,EACRC,OAAO;AAAA,EACPC,IAAI;AAAA,EACJC,OAAO;AACT,GAEaC,sBACX,CACE;AAAA,EACEC,MAAAA,IAAO;AAAA,EACPC,OAAAA,IAAQ;AAAA,EACRC,MAAAA,IAAO;AAAA,EACPC,OAAAA,IAAQ;AAAA,EACRC,cAAAA,IAAe;AAAA,EACfC,UAAAA,IAAW;AAAA,EACXC,SAAAA,IAAU;AAAA,EACVC,cAAAA;AAAAA,EACAC,WAAAA,IAAY;AAAA,EACZC,WAAAA,IAAY;AAAA,IAAEC,MAAM;AAAA,EAAA;AAAA,EACpBC,cAAAA,IAAe;AAAA,EACfC,WAAAA,IAAY;AAAA,EACZC,WAA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AAG,GAGLC,IAAsBC,EAAsB;AAAA,IAChDnC,WAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,iBAAAA;AAAAA,EAAAA,CACD;AAED,SACEkC,gBAAAA,EAAAC,cAAA,UAAAC,EAAA;AAAA,IACE5B,KAAAA;AAAAA,IACAvB,MAAK;AAAA,IACLQ,WAAWmC;AAAAA,IACXtC,UAAU4B;AAAAA,IACVrB,WAAAA;AAAAA,IACA,sBAAoBD;AAAAA,EAAAA,GAChBW,GACCU,GACDe,CAAmB,GAEtBzC,KACC2C,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACE,eAAY;AAAA,IACZ1C,WAAU;AAAA,EAAA,CACX,GAEF,CAACF,KAAWkC,GAAmB9B,QAAQN,MAAiB,UACvD6C,gBAAAA,EAAAC,cAACE,GAASZ,CAAoB,GAE/Bf,KACCwB,gBAAAA,EAAAC,cAAA,QAAA;AAAA,IAAM1C,WAAU;AAAA,EAAA,GAAsCiB,CAAmB,GAE1E,CAACnB,KAAWkC,GAAmB9B,QAAQN,MAAiB,WACvD6C,gBAAAA,EAAAC,cAACE,GAASZ,CAAoB,CAE1B;AAEV,CACF;AAEAzC,EAAOsD,cAAc;"}
package/dist/index67.js CHANGED
@@ -1,49 +1,58 @@
1
- import * as t from "react";
2
- import { isVirtualClick as w } from "./index78.js";
3
- function R({
4
- disabled: p = !1,
5
- loading: i = !1,
1
+ import * as s from "react";
2
+ import { isVirtualClick as x } from "./index78.js";
3
+ function I({
4
+ disabled: v = !1,
5
+ loading: l = !1,
6
6
  onClick: u,
7
- onKeyboardActivate: s,
8
- isNative: l = !0,
9
- role: d = "button",
10
- tabIndex: D = 0,
7
+ onKeyboardActivate: n,
8
+ isNative: o = !0,
9
+ role: y = "button",
10
+ tabIndex: C = 0,
11
11
  stopPropagation: c = !1,
12
12
  preventDefault: f = !1,
13
- pressed: P
13
+ pressed: P,
14
+ onPointerDown: k,
15
+ onMouseDown: b,
16
+ onTouchStart: p
14
17
  } = {}) {
15
- const e = p || i, n = t.useRef(!1), o = t.useCallback(() => {
16
- n.current = !0;
17
- }, []), m = t.useCallback((r) => {
18
+ const e = v || l, a = s.useRef(!1), t = s.useCallback(() => {
19
+ a.current = !0;
20
+ }, []), D = s.useCallback((r) => {
18
21
  if (e) return;
19
22
  c && r.stopPropagation(), f && r.preventDefault();
20
- const y = w(r.nativeEvent), C = n.current;
21
- n.current = !1;
22
- const b = y ? "virtual" : C ? "pointer" : "keyboard";
23
- if ((b === "keyboard" || b === "virtual") && s) {
24
- s(r);
23
+ const h = x(r.nativeEvent), w = a.current;
24
+ a.current = !1;
25
+ const m = h ? "virtual" : w ? "pointer" : "keyboard";
26
+ if ((m === "keyboard" || m === "virtual") && n) {
27
+ n(r);
25
28
  return;
26
29
  }
27
30
  u?.(r);
28
- }, [e, u, s, c, f]), v = t.useCallback((r) => {
31
+ }, [e, u, n, c, f]), R = s.useCallback((r) => {
29
32
  e || (r.key === "Enter" || r.key === " ") && (r.preventDefault(), r.currentTarget.click());
30
- }, [e]), k = {
31
- onPointerDown: o,
32
- onMouseDown: o,
33
- onTouchStart: o,
34
- onClick: m,
33
+ }, [e]), d = {
34
+ onPointerDown: k ? (r) => {
35
+ t(), k(r);
36
+ } : t,
37
+ onMouseDown: b ? (r) => {
38
+ t(), b(r);
39
+ } : t,
40
+ onTouchStart: p ? (r) => {
41
+ t(), p(r);
42
+ } : t,
43
+ onClick: D,
35
44
  "aria-disabled": e ? "true" : void 0,
36
- "aria-busy": i ? "true" : void 0,
45
+ "aria-busy": l ? "true" : void 0,
37
46
  "aria-pressed": P
38
47
  };
39
- l || (k.onKeyDown = v);
40
- const a = {
41
- pressProps: k,
48
+ o || (d.onKeyDown = R);
49
+ const i = {
50
+ pressProps: d,
42
51
  isDisabled: e
43
52
  };
44
- return l || (a.role = d, a.tabIndex = e ? -1 : D), a;
53
+ return o || (i.role = y, i.tabIndex = e ? -1 : C), i;
45
54
  }
46
55
  export {
47
- R as useAccessiblePress
56
+ I as useAccessiblePress
48
57
  };
49
58
  //# sourceMappingURL=index67.js.map