se-design 1.0.84-dev.0 → 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.
- package/dist/components/Button/index.d.ts +5 -0
- package/dist/index16.js +27 -27
- package/dist/index16.js.map +1 -1
- package/dist/index19.js +121 -128
- package/dist/index19.js.map +1 -1
- package/dist/index25.js +212 -198
- package/dist/index25.js.map +1 -1
- package/dist/index38.js +90 -94
- package/dist/index38.js.map +1 -1
- package/dist/index4.js +66 -57
- package/dist/index4.js.map +1 -1
- package/dist/index67.js +39 -30
- package/dist/index67.js.map +1 -1
- package/package.json +1 -1
package/dist/index25.js.map
CHANGED
|
@@ -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 { useLiveAnnouncer } from '../../utils/a11y/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 { announce } = useLiveAnnouncer();\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","announce","useLiveAnnouncer","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","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,IAA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"],"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,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,IAAUC,EAAYjB,QAAW,gBAAgB,GACjDkB,IAAUD,EAAYjB,QAAW,gBAAgB,GACjDmB,IAAYF,EAAYjB,QAAW,kBAAkB,GAGrDoB,IAAiBnB,IAAmBJ,EAAMK,SAAUC,GACpDkB,IAAyBvB,IAC1Ba,MAAMC,QAAQf,EAAME,aAAa,IAAIF,EAAME,gBAAgBF,EAAME,gBAAgB,CAACF,EAAME,aAAa,IAAI,CAAA,IAC1GS,IAEEc,IAAoBA,CAACC,MAAmB;AAC5C,IAAKtB,KACHG,GAAkBmB,CAAK,GAEzB1B,EAAM2B,eAAeD,CAAK;AAAA,EAC5B,GAEME,IAA4BA,CAACC,MAA4B;AAC7D,IAAK5B,KACHW,EAA0BiB,CAAM;AAAA,EAEpC,GAEM;AAAA,IACJC,UAAAA,IAAW;AAAA,IACXC,iBA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|
|
1
|
+
import a, { forwardRef as be, useState as _, useRef as M, useCallback as F, useEffect as W, useImperativeHandle as Ee } from "react";
|
|
2
|
+
import { Popover as Pe } from "./index19.js";
|
|
3
|
+
import { Icon as Ce } from "./index6.js";
|
|
4
|
+
import { Checkbox as Se } from "./index23.js";
|
|
5
5
|
import { Button as X } from "./index4.js";
|
|
6
|
-
import { getA11yNameAttributes as
|
|
6
|
+
import { getA11yNameAttributes as De } from "./index81.js";
|
|
7
7
|
import "./index72.js";
|
|
8
|
-
import { useCombobox as
|
|
9
|
-
import { useStableId as
|
|
10
|
-
import {
|
|
8
|
+
import { useCombobox as Ne } from "./index68.js";
|
|
9
|
+
import { useStableId as $e } from "./index205.js";
|
|
10
|
+
import { announce as Oe } from "./index75.js";
|
|
11
11
|
/* empty css */
|
|
12
12
|
function g() {
|
|
13
13
|
return g = Object.assign ? Object.assign.bind() : function(h) {
|
|
@@ -18,7 +18,7 @@ function g() {
|
|
|
18
18
|
return h;
|
|
19
19
|
}, g.apply(null, arguments);
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const We = /* @__PURE__ */ be(({
|
|
22
22
|
value: h,
|
|
23
23
|
onChange: i,
|
|
24
24
|
placeholder: k = "Type to search or add custom tags...",
|
|
@@ -32,7 +32,7 @@ const xe = /* @__PURE__ */ Ee(({
|
|
|
32
32
|
automationId: u = "",
|
|
33
33
|
noOptionsMessage: U = "No options found",
|
|
34
34
|
allowCustomTags: j = !0,
|
|
35
|
-
disabled:
|
|
35
|
+
disabled: r = !1,
|
|
36
36
|
type: H = "select",
|
|
37
37
|
showInput: z = !0,
|
|
38
38
|
displayTagBy: B = "label",
|
|
@@ -47,21 +47,21 @@ const xe = /* @__PURE__ */ Ee(({
|
|
|
47
47
|
label: t,
|
|
48
48
|
value: t
|
|
49
49
|
};
|
|
50
|
-
}), [o, f] = _(() => G(h || [])), [l, b] = _(""), [K,
|
|
51
|
-
if (
|
|
50
|
+
}), [o, f] = _(() => G(h || [])), [l, b] = _(""), [K, ae] = _(d), [p, c] = _(!1), re = M(null), S = M(null), D = M(!1), E = H === "multi-select-without-cta", m = H === "multi-select" || E, oe = $e(u, "dropdown-input-tags-listbox"), N = F((e) => {
|
|
51
|
+
if (r) return;
|
|
52
52
|
const t = [...o];
|
|
53
53
|
t.some((n) => n.value === e.value) || (t.push({
|
|
54
54
|
label: e.label,
|
|
55
55
|
value: e.value
|
|
56
56
|
}), f(t), i?.(t.map((n) => n.value))), b(""), c(!1);
|
|
57
|
-
}, [
|
|
57
|
+
}, [r, o, i]), V = F((e, t) => {
|
|
58
58
|
let n = [];
|
|
59
59
|
e ? n = [...o, {
|
|
60
60
|
label: t.label,
|
|
61
61
|
value: t.value
|
|
62
62
|
}] : n = o.filter((s) => s.value !== t.value), f(n), b(""), E && (D.current = !0, i?.(n.map((s) => s.value)));
|
|
63
63
|
}, [o, E, i]), $ = "__add_custom_tag__", q = F((e) => {
|
|
64
|
-
if (!
|
|
64
|
+
if (!r) {
|
|
65
65
|
if (e.value === $) {
|
|
66
66
|
const t = l.trim();
|
|
67
67
|
if (!t) return;
|
|
@@ -74,11 +74,11 @@ const xe = /* @__PURE__ */ Ee(({
|
|
|
74
74
|
}
|
|
75
75
|
if (m) {
|
|
76
76
|
const t = o.some((n) => n.value === e.value);
|
|
77
|
-
|
|
77
|
+
V(!t, e);
|
|
78
78
|
} else
|
|
79
79
|
N(e);
|
|
80
80
|
}
|
|
81
|
-
}, [
|
|
81
|
+
}, [r, m, o, l, i, V, N]), v = K.length > 0 ? K : j && l.trim() ? [{
|
|
82
82
|
id: $,
|
|
83
83
|
label: `Add "${l.trim()}"`,
|
|
84
84
|
value: $
|
|
@@ -86,11 +86,11 @@ const xe = /* @__PURE__ */ Ee(({
|
|
|
86
86
|
containerProps: le,
|
|
87
87
|
inputProps: J,
|
|
88
88
|
listboxProps: se,
|
|
89
|
-
getOptionProps:
|
|
90
|
-
highlightedIndex:
|
|
89
|
+
getOptionProps: O,
|
|
90
|
+
highlightedIndex: A,
|
|
91
91
|
setHighlightedIndex: w,
|
|
92
92
|
isKeyboardFocused: Q
|
|
93
|
-
} =
|
|
93
|
+
} = Ne({
|
|
94
94
|
items: v,
|
|
95
95
|
isOpen: p,
|
|
96
96
|
onOpenChange: c,
|
|
@@ -108,24 +108,20 @@ const xe = /* @__PURE__ */ Ee(({
|
|
|
108
108
|
f(G(h || []));
|
|
109
109
|
}, [h, d, p]), W(() => {
|
|
110
110
|
const e = d.filter((t) => t.label.toLowerCase().includes(l.toLowerCase()) || t.value.toLowerCase().includes(l.toLowerCase()));
|
|
111
|
-
|
|
112
|
-
}, [l, d])
|
|
113
|
-
|
|
114
|
-
announce: ie
|
|
115
|
-
} = Oe();
|
|
116
|
-
W(() => {
|
|
117
|
-
p && v.length === 0 && l.trim() && ie(U, {
|
|
111
|
+
ae(e);
|
|
112
|
+
}, [l, d]), W(() => {
|
|
113
|
+
p && v.length === 0 && l.trim() && Oe(U, {
|
|
118
114
|
assertiveness: "polite",
|
|
119
115
|
batchId: "dropdown-input-tags-empty-state",
|
|
120
116
|
delay: 300
|
|
121
117
|
});
|
|
122
118
|
}, [v.length, p, l]);
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
119
|
+
const ie = (e) => {
|
|
120
|
+
if (r) return;
|
|
125
121
|
const t = o.filter((n, s) => s !== e);
|
|
126
122
|
f(t), (!m || E || m && !p) && i?.(t.map((n) => n.value));
|
|
127
|
-
},
|
|
128
|
-
if (!
|
|
123
|
+
}, ce = (e) => {
|
|
124
|
+
if (!r) {
|
|
129
125
|
if (e.key === "Backspace" && l === "" && o.length > 0) {
|
|
130
126
|
e.preventDefault();
|
|
131
127
|
const t = o.slice(0, -1);
|
|
@@ -143,59 +139,59 @@ const xe = /* @__PURE__ */ Ee(({
|
|
|
143
139
|
}
|
|
144
140
|
J.onKeyDown(e);
|
|
145
141
|
}
|
|
146
|
-
},
|
|
147
|
-
if (
|
|
142
|
+
}, ue = (e) => {
|
|
143
|
+
if (r) return;
|
|
148
144
|
const t = e.target.value;
|
|
149
145
|
b(t), w(-1), t.trim() && !p && c(!0);
|
|
150
|
-
},
|
|
151
|
-
|
|
146
|
+
}, pe = () => {
|
|
147
|
+
r || (l.trim() || d.length > 0) && c(!0);
|
|
148
|
+
}, me = (e) => {
|
|
149
|
+
r || (e.stopPropagation(), S.current?.focus(), !p && (l.trim() || d.length > 0) && c(!0));
|
|
152
150
|
}, fe = (e) => {
|
|
153
|
-
|
|
154
|
-
}, ge = (e) => {
|
|
155
|
-
if (a) {
|
|
151
|
+
if (r) {
|
|
156
152
|
e.preventDefault(), e.stopPropagation();
|
|
157
153
|
return;
|
|
158
154
|
}
|
|
159
155
|
e.target.closest(".input-with-tags-container") && e.stopPropagation();
|
|
160
|
-
},
|
|
161
|
-
|
|
156
|
+
}, ge = () => {
|
|
157
|
+
r || c(!p);
|
|
162
158
|
};
|
|
163
|
-
|
|
164
|
-
toggleDropdown:
|
|
159
|
+
Ee(ne, () => ({
|
|
160
|
+
toggleDropdown: ge
|
|
165
161
|
}), []);
|
|
166
|
-
const
|
|
167
|
-
const P = o.some((C) => C.value === e.value), I =
|
|
168
|
-
return /* @__PURE__ */
|
|
162
|
+
const de = (e, t, n, s) => {
|
|
163
|
+
const P = o.some((C) => C.value === e.value), I = A === t, L = O(t, P);
|
|
164
|
+
return /* @__PURE__ */ a.createElement("div", g({
|
|
169
165
|
key: e.id
|
|
170
|
-
},
|
|
166
|
+
}, L, {
|
|
171
167
|
className: `dropdown-with-input-tags-option ${T(I)}`,
|
|
172
168
|
onClick: () => !s && n(e),
|
|
173
169
|
onMouseEnter: () => w(t),
|
|
174
170
|
"data-automation-id": `${u}-option-${e.id}`
|
|
175
|
-
}), /* @__PURE__ */
|
|
171
|
+
}), /* @__PURE__ */ a.createElement("span", {
|
|
176
172
|
className: "option-label"
|
|
177
|
-
}, e.label), e.value !== e.label && /* @__PURE__ */
|
|
173
|
+
}, e.label), e.value !== e.label && /* @__PURE__ */ a.createElement("span", {
|
|
178
174
|
className: "option-value"
|
|
179
175
|
}, e.value));
|
|
180
|
-
},
|
|
176
|
+
}, he = () => {
|
|
181
177
|
D.current = !0;
|
|
182
178
|
const e = o.map((t) => t.value);
|
|
183
179
|
i?.(e), c(!1);
|
|
184
|
-
},
|
|
180
|
+
}, ve = () => {
|
|
185
181
|
f([]);
|
|
186
|
-
},
|
|
187
|
-
const n = o.some((I) => I.value === e.value), s =
|
|
188
|
-
return /* @__PURE__ */
|
|
182
|
+
}, we = (e, t) => {
|
|
183
|
+
const n = o.some((I) => I.value === e.value), s = A === t, P = O(t, n);
|
|
184
|
+
return /* @__PURE__ */ a.createElement("div", g({
|
|
189
185
|
key: e.id
|
|
190
186
|
}, P, {
|
|
191
187
|
className: `dropdown-with-input-tags-option dropdown-with-input-tags-multi-select-option ${T(s)}`,
|
|
192
188
|
"aria-checked": n,
|
|
193
189
|
onClick: () => {
|
|
194
|
-
|
|
190
|
+
r || (V(!n, e), S.current?.focus());
|
|
195
191
|
},
|
|
196
192
|
onMouseEnter: () => w(t),
|
|
197
193
|
"data-automation-id": `${u}-option-${e.id}`
|
|
198
|
-
}), /* @__PURE__ */
|
|
194
|
+
}), /* @__PURE__ */ a.createElement(Se, {
|
|
199
195
|
automationId: "checkbox",
|
|
200
196
|
className: "checkbox",
|
|
201
197
|
checked: n,
|
|
@@ -204,103 +200,103 @@ const xe = /* @__PURE__ */ Ee(({
|
|
|
204
200
|
label: e.label,
|
|
205
201
|
tabIndex: -1
|
|
206
202
|
}));
|
|
207
|
-
},
|
|
203
|
+
}, ke = () => /* @__PURE__ */ a.createElement("div", {
|
|
208
204
|
className: "dropdown-with-input-tags-ctas-container",
|
|
209
205
|
onKeyDown: (e) => {
|
|
210
206
|
(e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Home" || e.key === "End") && e.stopPropagation();
|
|
211
207
|
}
|
|
212
|
-
}, /* @__PURE__ */
|
|
208
|
+
}, /* @__PURE__ */ a.createElement(X, {
|
|
213
209
|
label: "Clear",
|
|
214
210
|
type: "link",
|
|
215
211
|
size: "sm",
|
|
216
|
-
onClick:
|
|
212
|
+
onClick: ve,
|
|
217
213
|
automationId: `${u}-clear-button`
|
|
218
|
-
}), /* @__PURE__ */
|
|
214
|
+
}), /* @__PURE__ */ a.createElement(X, {
|
|
219
215
|
label: "Apply",
|
|
220
216
|
type: "primary",
|
|
221
217
|
size: "sm",
|
|
222
|
-
onClick:
|
|
218
|
+
onClick: he,
|
|
223
219
|
automationId: `${u}-apply-button`
|
|
224
220
|
}));
|
|
225
|
-
return /* @__PURE__ */
|
|
226
|
-
className: `dropdown-with-input-tags-wrapper ${y} ${
|
|
221
|
+
return /* @__PURE__ */ a.createElement("div", g({
|
|
222
|
+
className: `dropdown-with-input-tags-wrapper ${y} ${r ? "disabled-wrapper" : ""}`,
|
|
227
223
|
"data-automation-id": u
|
|
228
|
-
}, le), R && /* @__PURE__ */
|
|
224
|
+
}, le), R && /* @__PURE__ */ a.createElement("label", {
|
|
229
225
|
id: `${u}-label`,
|
|
230
226
|
className: "dropdown-with-input-tags-label"
|
|
231
|
-
}, R), /* @__PURE__ */
|
|
232
|
-
onClick:
|
|
233
|
-
}, /* @__PURE__ */
|
|
234
|
-
ref:
|
|
227
|
+
}, R), /* @__PURE__ */ a.createElement("div", {
|
|
228
|
+
onClick: fe
|
|
229
|
+
}, /* @__PURE__ */ a.createElement(Pe, {
|
|
230
|
+
ref: re,
|
|
235
231
|
className: "dropdown-with-input-tags-popover",
|
|
236
232
|
contentWidth: "full",
|
|
237
233
|
position: "bottom-left",
|
|
238
|
-
isPopoverOpen: !
|
|
239
|
-
onPopoverToggle:
|
|
234
|
+
isPopoverOpen: !r && p,
|
|
235
|
+
onPopoverToggle: r ? () => {
|
|
240
236
|
} : c,
|
|
241
237
|
disableClickToggle: !0,
|
|
242
238
|
isWithPortal: te,
|
|
243
239
|
renderPopoverContents: ({
|
|
244
240
|
closePopoverCb: e
|
|
245
|
-
}) => /* @__PURE__ */
|
|
241
|
+
}) => /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement("div", g({}, se, {
|
|
246
242
|
className: "dropdown-with-input-tags-content"
|
|
247
243
|
}, m && {
|
|
248
244
|
"aria-multiselectable": "true"
|
|
249
245
|
}), v.length > 0 ? v.map((t, n) => {
|
|
250
246
|
if (t.value === $) {
|
|
251
|
-
const C =
|
|
252
|
-
return /* @__PURE__ */
|
|
247
|
+
const C = A === n, ye = O(n, !1);
|
|
248
|
+
return /* @__PURE__ */ a.createElement("div", g({
|
|
253
249
|
key: t.id
|
|
254
|
-
},
|
|
250
|
+
}, ye, {
|
|
255
251
|
className: `dropdown-with-input-tags-option dropdown-with-input-tags-custom-option ${T(C)}`,
|
|
256
252
|
onClick: () => {
|
|
257
|
-
|
|
253
|
+
r || (q(t), e());
|
|
258
254
|
},
|
|
259
255
|
onMouseEnter: () => w(n)
|
|
260
256
|
}), 'Add "', l.trim(), '"');
|
|
261
257
|
}
|
|
262
258
|
if (m)
|
|
263
|
-
return
|
|
264
|
-
const s = o.some((C) => C.value === t.value), P =
|
|
265
|
-
...
|
|
259
|
+
return we(t, n);
|
|
260
|
+
const s = o.some((C) => C.value === t.value), P = A === n, L = {
|
|
261
|
+
...O(n, s),
|
|
266
262
|
onMouseEnter: () => w(n),
|
|
267
263
|
className: `dropdown-with-input-tags-option ${T(P)}`
|
|
268
264
|
};
|
|
269
|
-
return x ? x(t,
|
|
270
|
-
}) : /* @__PURE__ */
|
|
265
|
+
return x ? x(t, L, N) : de(t, n, N, r);
|
|
266
|
+
}) : /* @__PURE__ */ a.createElement("div", {
|
|
271
267
|
className: "dropdown-with-input-tags-no-options"
|
|
272
|
-
}, /* @__PURE__ */
|
|
268
|
+
}, /* @__PURE__ */ a.createElement("div", {
|
|
273
269
|
className: "dropdown-with-input-tags-no-options-text"
|
|
274
|
-
}, U))), m && !E &&
|
|
275
|
-
renderPopoverSrcElement: () => /* @__PURE__ */
|
|
270
|
+
}, U))), m && !E && ke()),
|
|
271
|
+
renderPopoverSrcElement: () => /* @__PURE__ */ a.createElement("div", {
|
|
276
272
|
className: "dropdown-with-input-tags-input-container"
|
|
277
|
-
}, /* @__PURE__ */
|
|
278
|
-
className: `input-with-tags-container ${
|
|
279
|
-
onClick:
|
|
273
|
+
}, /* @__PURE__ */ a.createElement("div", {
|
|
274
|
+
className: `input-with-tags-container ${r ? "disabled-input-with-tags-container" : ""} ${Q ? "keyboard-focused" : ""}`,
|
|
275
|
+
onClick: me,
|
|
280
276
|
onKeyDown: (e) => {
|
|
281
277
|
e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && S.current?.focus();
|
|
282
278
|
}
|
|
283
|
-
}, o.map((e, t) => /* @__PURE__ */
|
|
279
|
+
}, o.map((e, t) => /* @__PURE__ */ a.createElement("span", {
|
|
284
280
|
key: t,
|
|
285
281
|
className: "tag-in-inputwithtags"
|
|
286
|
-
}, e[B], !
|
|
282
|
+
}, e[B], !r && /* @__PURE__ */ a.createElement(Ce, {
|
|
287
283
|
name: "close",
|
|
288
284
|
className: "close-icon-in-inputwithtags",
|
|
289
285
|
ariaLabel: `Remove tag ${e[B]}`,
|
|
290
|
-
onClick: () =>
|
|
286
|
+
onClick: () => ie(t),
|
|
291
287
|
shouldStopPropagation: !0
|
|
292
|
-
}))), (z || !o.length || m) && /* @__PURE__ */
|
|
288
|
+
}))), (z || !o.length || m) && /* @__PURE__ */ a.createElement("input", g({
|
|
293
289
|
ref: S
|
|
294
290
|
}, J, {
|
|
295
291
|
type: "text",
|
|
296
292
|
value: l,
|
|
297
|
-
onChange:
|
|
298
|
-
onKeyDown:
|
|
299
|
-
onFocus:
|
|
293
|
+
onChange: ue,
|
|
294
|
+
onKeyDown: ce,
|
|
295
|
+
onFocus: pe,
|
|
300
296
|
placeholder: o.length === 0 ? k : "",
|
|
301
297
|
className: `input-with-tags-input${!z && o.length > 0 && !l ? " sr-only" : ""}`,
|
|
302
|
-
disabled:
|
|
303
|
-
},
|
|
298
|
+
disabled: r
|
|
299
|
+
}, De({
|
|
304
300
|
ariaLabel: Y || R || "Search and select options",
|
|
305
301
|
ariaLabelledBy: Z,
|
|
306
302
|
ariaDescribedBy: ee
|
|
@@ -310,6 +306,6 @@ const xe = /* @__PURE__ */ Ee(({
|
|
|
310
306
|
})));
|
|
311
307
|
});
|
|
312
308
|
export {
|
|
313
|
-
|
|
309
|
+
We as DropdownWithInputTags
|
|
314
310
|
};
|
|
315
311
|
//# sourceMappingURL=index38.js.map
|