@bikdotai/bik-component-library 0.0.868-beta.10 → 0.0.868-beta.12
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/README.md +0 -3
- package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
- package/dist/cjs/components/datePicker/DatePickerWrapper.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +27 -10
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js.map +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +0 -7
- package/dist/esm/components/datePicker/DatePickerWrapper.js +64 -66
- package/dist/esm/components/datePicker/DatePickerWrapper.js.map +1 -1
- package/dist/esm/components/datePicker/index.d.ts +0 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +74 -68
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +9 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +168 -130
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +2 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +145 -104
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +36 -29
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +39 -30
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +3 -16
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +41 -24
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js.map +1 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +3 -16
- package/dist/esm/components/dropdown/hooks/useDropdown.js +159 -149
- package/dist/esm/components/dropdown/hooks/useDropdown.js.map +1 -1
- package/dist/esm/components/dropdown/type.d.ts +17 -0
- package/dist/esm/index.d.ts +0 -3
- package/dist/esm/index.js +675 -716
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/chip-selector/ChipSelector.js +0 -2
- package/dist/cjs/components/chip-selector/ChipSelector.js.map +0 -1
- package/dist/cjs/components/chip-selector/ChipSelector.styled.js +0 -36
- package/dist/cjs/components/chip-selector/ChipSelector.styled.js.map +0 -1
- package/dist/cjs/components/chip-selector/ChipSelectorGroup.js +0 -2
- package/dist/cjs/components/chip-selector/ChipSelectorGroup.js.map +0 -1
- package/dist/cjs/components/combo-box/ComboBox.js +0 -2
- package/dist/cjs/components/combo-box/ComboBox.js.map +0 -1
- package/dist/cjs/components/combo-box/ComboBox.styled.js +0 -33
- package/dist/cjs/components/combo-box/ComboBox.styled.js.map +0 -1
- package/dist/cjs/components/schedule-builder/RefreshSegmentToggle.js +0 -2
- package/dist/cjs/components/schedule-builder/RefreshSegmentToggle.js.map +0 -1
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.js +0 -2
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.js.map +0 -1
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.styled.js +0 -138
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.styled.js.map +0 -1
- package/dist/cjs/components/schedule-builder/ScheduleEndPicker.js +0 -2
- package/dist/cjs/components/schedule-builder/ScheduleEndPicker.js.map +0 -1
- package/dist/cjs/components/schedule-builder/ScheduleFrequencyPicker.js +0 -2
- package/dist/cjs/components/schedule-builder/ScheduleFrequencyPicker.js.map +0 -1
- package/dist/cjs/components/schedule-builder/ScheduleHelper.js +0 -2
- package/dist/cjs/components/schedule-builder/ScheduleHelper.js.map +0 -1
- package/dist/cjs/components/schedule-builder/SendModeSelector.js +0 -2
- package/dist/cjs/components/schedule-builder/SendModeSelector.js.map +0 -1
- package/dist/cjs/components/schedule-builder/StartDateTimePicker.js +0 -2
- package/dist/cjs/components/schedule-builder/StartDateTimePicker.js.map +0 -1
- package/dist/cjs/components/schedule-builder/UpcomingRunsPreview.js +0 -2
- package/dist/cjs/components/schedule-builder/UpcomingRunsPreview.js.map +0 -1
- package/dist/cjs/components/schedule-builder/model.js +0 -2
- package/dist/cjs/components/schedule-builder/model.js.map +0 -1
- package/dist/esm/components/chip-selector/ChipSelector.d.ts +0 -9
- package/dist/esm/components/chip-selector/ChipSelector.js +0 -27
- package/dist/esm/components/chip-selector/ChipSelector.js.map +0 -1
- package/dist/esm/components/chip-selector/ChipSelector.styled.d.ts +0 -10
- package/dist/esm/components/chip-selector/ChipSelector.styled.js +0 -48
- package/dist/esm/components/chip-selector/ChipSelector.styled.js.map +0 -1
- package/dist/esm/components/chip-selector/ChipSelectorGroup.d.ts +0 -10
- package/dist/esm/components/chip-selector/ChipSelectorGroup.js +0 -48
- package/dist/esm/components/chip-selector/ChipSelectorGroup.js.map +0 -1
- package/dist/esm/components/chip-selector/index.d.ts +0 -4
- package/dist/esm/components/chip-selector/model.d.ts +0 -106
- package/dist/esm/components/combo-box/ComboBox.d.ts +0 -15
- package/dist/esm/components/combo-box/ComboBox.js +0 -118
- package/dist/esm/components/combo-box/ComboBox.js.map +0 -1
- package/dist/esm/components/combo-box/ComboBox.styled.d.ts +0 -12
- package/dist/esm/components/combo-box/ComboBox.styled.js +0 -40
- package/dist/esm/components/combo-box/ComboBox.styled.js.map +0 -1
- package/dist/esm/components/combo-box/index.d.ts +0 -3
- package/dist/esm/components/combo-box/model.d.ts +0 -55
- package/dist/esm/components/schedule-builder/RefreshSegmentToggle.d.ts +0 -22
- package/dist/esm/components/schedule-builder/RefreshSegmentToggle.js +0 -31
- package/dist/esm/components/schedule-builder/RefreshSegmentToggle.js.map +0 -1
- package/dist/esm/components/schedule-builder/ScheduleBuilder.d.ts +0 -88
- package/dist/esm/components/schedule-builder/ScheduleBuilder.js +0 -105
- package/dist/esm/components/schedule-builder/ScheduleBuilder.js.map +0 -1
- package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.d.ts +0 -81
- package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.js +0 -168
- package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.js.map +0 -1
- package/dist/esm/components/schedule-builder/ScheduleEndPicker.d.ts +0 -17
- package/dist/esm/components/schedule-builder/ScheduleEndPicker.js +0 -105
- package/dist/esm/components/schedule-builder/ScheduleEndPicker.js.map +0 -1
- package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.d.ts +0 -21
- package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.js +0 -136
- package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.js.map +0 -1
- package/dist/esm/components/schedule-builder/ScheduleHelper.d.ts +0 -110
- package/dist/esm/components/schedule-builder/ScheduleHelper.js +0 -196
- package/dist/esm/components/schedule-builder/ScheduleHelper.js.map +0 -1
- package/dist/esm/components/schedule-builder/SendModeSelector.d.ts +0 -29
- package/dist/esm/components/schedule-builder/SendModeSelector.js +0 -41
- package/dist/esm/components/schedule-builder/SendModeSelector.js.map +0 -1
- package/dist/esm/components/schedule-builder/StartDateTimePicker.d.ts +0 -44
- package/dist/esm/components/schedule-builder/StartDateTimePicker.js +0 -119
- package/dist/esm/components/schedule-builder/StartDateTimePicker.js.map +0 -1
- package/dist/esm/components/schedule-builder/UpcomingRunsPreview.d.ts +0 -19
- package/dist/esm/components/schedule-builder/UpcomingRunsPreview.js +0 -44
- package/dist/esm/components/schedule-builder/UpcomingRunsPreview.js.map +0 -1
- package/dist/esm/components/schedule-builder/index.d.ts +0 -17
- package/dist/esm/components/schedule-builder/model.d.ts +0 -69
- package/dist/esm/components/schedule-builder/model.js +0 -8
- package/dist/esm/components/schedule-builder/model.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpennedDropdown.js","sources":["../../../../../../src/components/dropdown/OpenedDropdown/components/OpennedDropdown.tsx"],"sourcesContent":["import ErrorInfoIcon from '@src/assets/icons/errorInfo.svg';\nimport RetryIcon from '@src/assets/icons/refresh-purple.svg';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { ZeroState } from '@src/components/zeroState/ZeroState';\nimport { useOutside } from '@src/hooks/useOutside';\nimport { COLORS } from '@src/constants/Theme';\nimport { useDropdown } from '../../hooks/useDropdown';\nimport {\n\tDropdownOption,\n\tGroupedOption,\n\tMultiSelectOption,\n\tOpenDropdownProps,\n\tSingleOption,\n} from '../../type';\nimport { Description } from './description/Description';\nimport { FreeFormMenu } from './menu/FreeFormMenu';\nimport { MenuList } from './menu/MenuList';\nimport { SelectAllMenu } from './menu/SelectAllMenu';\nimport MultiSelectDropdownBottomBar from './multiSelect/MultiSelectDropdownBottomBar';\nimport {\n\tMenuListContainer,\n\tOpennedDropdownContainer,\n} from './OpennedDropdown.styled';\nimport { SearchBox } from './searchbox/SearchBox';\nimport { SearchZeroState } from './searchbox/SearchZeroState';\n\n/** CONSTANTS */\nconst defaults = {\n\theight: 304,\n\twidth: 290,\n};\n\nexport const OpenedDropdown: React.FC<OpenDropdownProps> = ({\n\toptions,\n\tisSearchable,\n\tsearchPlaceholder,\n\tstaticMenuHeight,\n\tisMultiSelect,\n\tmaxSelections,\n\twidth,\n\tallowFreeForm,\n\theight,\n\tonClose,\n\tonSelect,\n\tonSearch,\n\tversion,\n\tskipSorting,\n\theaderRef,\n\thideSelectAll,\n\tprimaryButtonText,\n\tonInfiniteScroll,\n\tonMultiSelectClear: onMultiSelectClearProp,\n\tonDropdownItemClick,\n\tbuttonOptions,\n\tisSearchLoading,\n\tisOptionsLoading,\n\toptionsErrorState,\n\tdisableSearchOptions,\n\tdisableSearchedOptionExcept,\n\tuseDefaultCursor,\n\tcontainerStyle = {},\n\tzeroState = undefined,\n\tisDraggable = false,\n\tonOptionsReorder,\n\thideClearButton = false,\n\tshowCheckboxForCustomElement = false,\n\tcheckboxActiveColor,\n\tbrandSelectedRow,\n}) => {\n\t// Sort options with selected at top, unselected at bottom, maintaining order within groups\n\tconst sortOptionsWithSelectedOnTop = useCallback(\n\t\t(opts: DropdownOption[]): DropdownOption[] => {\n\t\t\tif (!isDraggable || !isMultiSelect) return opts;\n\n\t\t\tconst selected: DropdownOption[] = [];\n\t\t\tconst unselected: DropdownOption[] = [];\n\n\t\t\topts.forEach((option) => {\n\t\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t\t// Handle grouped options - maintain grouping\n\t\t\t\t\tunselected.push(option);\n\t\t\t\t} else {\n\t\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\t\tif (singleOption.selected) {\n\t\t\t\t\t\tselected.push(option);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunselected.push(option);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn [...selected, ...unselected];\n\t\t},\n\t\t[isDraggable, isMultiSelect],\n\t);\n\n\tconst [localOptions, setLocalOptions] = useState<DropdownOption[]>(() =>\n\t\tsortOptionsWithSelectedOnTop(options),\n\t);\n\tconst localOptionsRef = useRef<DropdownOption[]>(localOptions);\n\tconst hasReorderedRef = useRef(false);\n\tconst onOptionsReorderRef = useRef(onOptionsReorder);\n\n\tuseEffect(() => {\n\t\tsetLocalOptions(sortOptionsWithSelectedOnTop(options));\n\t}, [options, sortOptionsWithSelectedOnTop]);\n\n\tuseEffect(() => {\n\t\tlocalOptionsRef.current = localOptions;\n\t}, [localOptions]);\n\n\tuseEffect(() => {\n\t\tonOptionsReorderRef.current = onOptionsReorder;\n\t}, [onOptionsReorder]);\n\n\t// Fire onOptionsReorder on unmount (dropdown close from Apply or click-outside)\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tif (hasReorderedRef.current && onOptionsReorderRef.current) {\n\t\t\t\tonOptionsReorderRef.current(localOptionsRef.current);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\tconst handleOptionsReorder = useCallback(\n\t\t(reorderedOptions: DropdownOption[]) => {\n\t\t\tsetLocalOptions(reorderedOptions);\n\t\t\t// For version 2.0 (no Apply button), apply reorder immediately\n\t\t\tif (version === '2.0') {\n\t\t\t\tonOptionsReorder?.(reorderedOptions);\n\t\t\t} else {\n\t\t\t\t// For version 1.0, defer until Apply/close (handled by unmount cleanup)\n\t\t\t\thasReorderedRef.current = true;\n\t\t\t}\n\t\t},\n\t\t[onOptionsReorder, version],\n\t);\n\n\tconst optionsToUse = isDraggable ? localOptions : options;\n\tconst {\n\t\tdropdownOptions,\n\t\tsearch,\n\t\tsearchedString,\n\t\tsearchedOptions,\n\t\tsearchError,\n\t\tretrySearch,\n\t\tonApplyHandler,\n\t\tselectAllHandler,\n\t\tonMultiSelectClear,\n\t\tonFreeFormSelect,\n\t\tonMultiSelectApply,\n\t\tlatestDropdownOptionsRef,\n\t\tgetSelectedOptions,\n\t\tgetCurrentSelectionCount,\n\t} = useDropdown(\n\t\tversion,\n\t\toptionsToUse,\n\t\tonSelect,\n\t\tskipSorting || isDraggable,\n\t\tisMultiSelect,\n\t\tonSearch,\n\t\tdisableSearchOptions,\n\t\tdisableSearchedOptionExcept,\n\t\tmaxSelections,\n\t);\n\tconst [widthState, setWidthState] = useState(width ?? defaults.width);\n\tconst [descriptionInfo, setDescription] = useState<{\n\t\ttitle: string;\n\t\tdescription: string;\n\t} | null>(null);\n\tconst [focusedIndex, setFocusedIndex] = useState<number>(-1);\n\tconst ref = useRef<HTMLDivElement>(null);\n\tconst childRefs = useRef([]);\n\tconst menuListRef = useRef<HTMLDivElement>(null);\n\tuseOutside(\n\t\tref,\n\t\t() => {\n\t\t\tsetDescription(null);\n\t\t\tif (isMultiSelect && version === '2.0') {\n\t\t\t\tconst optionsToSend = getSelectedOptions(\n\t\t\t\t\tlatestDropdownOptionsRef.current,\n\t\t\t\t);\n\t\t\t\tonClose?.(optionsToSend);\n\t\t\t} else {\n\t\t\t\tonClose?.(dropdownOptions);\n\t\t\t}\n\t\t},\n\t\t[headerRef, childRefs],\n\t);\n\n\t// Auto-focus dropdown when it opens for keyboard navigation while preventing scroll to maintain popper positioning\n\tuseEffect(() => {\n\t\tconst timer = setTimeout(() => {\n\t\t\tif (ref.current) {\n\t\t\t\tref.current.focus({ preventScroll: true });\n\t\t\t}\n\t\t}, 0);\n\t\treturn () => clearTimeout(timer);\n\t}, []);\n\n\t// Get flattened selectable options\n\tconst getFlattenedOptions = (opts: DropdownOption[]): SingleOption[] => {\n\t\tconst flattened: SingleOption[] = [];\n\t\topts.forEach((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\tconst groupedOption = option as GroupedOption;\n\t\t\t\tgroupedOption.options.forEach((nestedOption) => {\n\t\t\t\t\tif (!nestedOption.disabled) {\n\t\t\t\t\t\tflattened.push(nestedOption);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\tif (!singleOption.disabled) {\n\t\t\t\t\tflattened.push(singleOption);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn flattened;\n\t};\n\n\t/** Keyboard navigation handler */\n\tuseEffect(() => {\n\t\tconst handleKeyDown = (e: KeyboardEvent) => {\n\t\t\tconst currentOptions =\n\t\t\t\tsearchedString && onSearch ? searchedOptions : dropdownOptions;\n\t\t\tconst flattenedOptions = getFlattenedOptions(currentOptions);\n\n\t\t\tif (flattenedOptions.length === 0) return;\n\n\t\t\tif (e.key === 'ArrowDown') {\n\t\t\t\te.preventDefault();\n\t\t\t\tsetFocusedIndex((prev) => {\n\t\t\t\t\tconst newIndex = prev < flattenedOptions.length - 1 ? prev + 1 : 0;\n\t\t\t\t\t// Scroll to the focused item\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tconst focusedElement = menuListRef.current?.querySelector(\n\t\t\t\t\t\t\t`[data-option-index=\"${newIndex}\"]`,\n\t\t\t\t\t\t) as HTMLElement;\n\t\t\t\t\t\tif (focusedElement) {\n\t\t\t\t\t\t\tfocusedElement.scrollIntoView({\n\t\t\t\t\t\t\t\tblock: 'nearest',\n\t\t\t\t\t\t\t\tbehavior: 'smooth',\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 0);\n\t\t\t\t\treturn newIndex;\n\t\t\t\t});\n\t\t\t} else if (e.key === 'ArrowUp') {\n\t\t\t\te.preventDefault();\n\t\t\t\tsetFocusedIndex((prev) => {\n\t\t\t\t\tconst newIndex = prev > 0 ? prev - 1 : flattenedOptions.length - 1;\n\t\t\t\t\t// Scroll to the focused item\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tconst focusedElement = menuListRef.current?.querySelector(\n\t\t\t\t\t\t\t`[data-option-index=\"${newIndex}\"]`,\n\t\t\t\t\t\t) as HTMLElement;\n\t\t\t\t\t\tif (focusedElement) {\n\t\t\t\t\t\t\tfocusedElement.scrollIntoView({\n\t\t\t\t\t\t\t\tblock: 'nearest',\n\t\t\t\t\t\t\t\tbehavior: 'smooth',\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 0);\n\t\t\t\t\treturn newIndex;\n\t\t\t\t});\n\t\t\t} else if (e.key === 'Enter' && focusedIndex >= 0) {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst focusedOption = flattenedOptions[focusedIndex];\n\t\t\t\tif (focusedOption) {\n\t\t\t\t\t// onApplyHandler handles the selection state and calls onSelect internally\n\t\t\t\t\tonApplyHandler({\n\t\t\t\t\t\t...focusedOption,\n\t\t\t\t\t\tselected: !focusedOption.selected,\n\t\t\t\t\t});\n\t\t\t\t\t// Also trigger onDropdownItemClick if provided\n\t\t\t\t\tif (onDropdownItemClick) {\n\t\t\t\t\t\tonDropdownItemClick(focusedOption);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst dropdownElement = ref.current;\n\t\tif (dropdownElement) {\n\t\t\tdropdownElement.addEventListener('keydown', handleKeyDown);\n\t\t\treturn () => {\n\t\t\t\tdropdownElement.removeEventListener('keydown', handleKeyDown);\n\t\t\t};\n\t\t}\n\t}, [\n\t\tfocusedIndex,\n\t\tsearchedString,\n\t\tsearchedOptions,\n\t\tdropdownOptions,\n\t\tonSearch,\n\t\tonApplyHandler,\n\t\tonDropdownItemClick,\n\t]);\n\n\t// LOCAL CONSTANTS\n\tconst heightToUse = height ?? defaults.height;\n\tconst menuListMaxHeight =\n\t\ttypeof heightToUse === 'number'\n\t\t\t? isSearchable && isMultiSelect\n\t\t\t\t? heightToUse - 96\n\t\t\t\t: (isSearchable && !isMultiSelect) || (!isSearchable && isMultiSelect)\n\t\t\t\t? heightToUse - 48\n\t\t\t\t: heightToUse\n\t\t\t: heightToUse;\n\n\tfunction showDescription(title?: string, description?: string) {\n\t\tif (title && description) {\n\t\t\tsetDescription({\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t});\n\t\t} else {\n\t\t\tsetDescription(null);\n\t\t}\n\t}\n\n\tuseEffect(() => {\n\t\tconst widthToUse = width ?? defaults.width;\n\t\tif (descriptionInfo === null) {\n\t\t\tsetWidthState(widthToUse);\n\t\t} else if (typeof widthToUse === 'number') {\n\t\t\tsetWidthState(widthToUse * 2);\n\t\t} else if (typeof widthToUse === 'string') {\n\t\t\tif (widthToUse.endsWith('px')) {\n\t\t\t\tconst newWidth = parseInt(widthToUse.replace('px', '')) * 2;\n\t\t\t\tsetWidthState(newWidth);\n\t\t\t}\n\t\t}\n\t}, [descriptionInfo]);\n\n\t/**\n\t * This is to show the search result in a stateless way\n\t */\n\n\tconst exactMatchFound: boolean[] = [];\n\n\tconst processOptionsWithMaxSelections = (\n\t\toptionsToProcess: DropdownOption[],\n\t) => {\n\t\tif (!isMultiSelect || (!maxSelections && maxSelections !== 0)) {\n\t\t\treturn optionsToProcess;\n\t\t}\n\n\t\t// Count from the full options list (not the filtered subset) so selections\n\t\t// hidden by a search query are still included in the limit check.\n\t\tconst currentSelectionCount = getCurrentSelectionCount(dropdownOptions);\n\t\tconst maxSelectionsReached = currentSelectionCount >= maxSelections;\n\n\t\tif (!maxSelectionsReached) {\n\t\t\treturn optionsToProcess;\n\t\t}\n\n\t\t// Disable unselected options when max selections is reached\n\t\treturn optionsToProcess.map((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\treturn {\n\t\t\t\t\t...option,\n\t\t\t\t\toptions: (option as GroupedOption).options.map((nestedOption) => ({\n\t\t\t\t\t\t...nestedOption,\n\t\t\t\t\t\tdisabled:\n\t\t\t\t\t\t\tnestedOption.disabled ||\n\t\t\t\t\t\t\t(!nestedOption.selected && maxSelectionsReached),\n\t\t\t\t\t})),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\treturn {\n\t\t\t\t\t...singleOption,\n\t\t\t\t\tdisabled:\n\t\t\t\t\t\tsingleOption.disabled ||\n\t\t\t\t\t\t(!singleOption.selected && maxSelectionsReached),\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\t};\n\n\tconst optionsToShow = processOptionsWithMaxSelections(\n\t\t(searchedString && onSearch ? searchedOptions : dropdownOptions)\n\t\t\t.map((option) => {\n\t\t\t\tif (searchedString && !onSearch) {\n\t\t\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t\t\tconst groupedOption = { ...option } as GroupedOption;\n\t\t\t\t\t\tgroupedOption.options = groupedOption.options.filter((op) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\top.label?.toLowerCase().includes(searchedString.toLowerCase())\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\texactMatchFound.push(\n\t\t\t\t\t\t\t\t\t!searchedString || op.label === searchedString,\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\treturn groupedOption.options.length > 0 ? groupedOption : null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\toption.label\n\t\t\t\t\t\t\t\t?.toLowerCase()\n\t\t\t\t\t\t\t\t.includes(searchedString.toLowerCase()) ||\n\t\t\t\t\t\t\t(option as SingleOption | MultiSelectOption).searchKey\n\t\t\t\t\t\t\t\t?.toLowerCase()\n\t\t\t\t\t\t\t\t.includes(searchedString.toLowerCase())\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\texactMatchFound.push(\n\t\t\t\t\t\t\t\t!searchedString || option.label === searchedString,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn option;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn option;\n\t\t\t})\n\t\t\t.filter((option) => option !== null) as DropdownOption[],\n\t);\n\n\tconst noResultForSearch =\n\t\t!!isSearchable && searchedString && optionsToShow.length === 0;\n\tconst showLoadingState = !searchedString && !!isOptionsLoading;\n\tconst showErrorState =\n\t\t!searchedString && !!optionsErrorState && !showLoadingState;\n\tconst showEmptyState =\n\t\t!searchedString &&\n\t\t!optionsToShow.length &&\n\t\t!showLoadingState &&\n\t\t!showErrorState;\n\tconst showTopLevelZeroState =\n\t\tshowLoadingState || showErrorState || showEmptyState;\n\n\tconst emptyStateTitle = zeroState?.title || 'No results found';\n\tconst emptyStateSubTitle =\n\t\tzeroState?.subTitle ||\n\t\t`Please try again later or contact us at support@bik.ai if you require further assistance.`;\n\tconst errorStateTitle = optionsErrorState?.title || 'Failed to load options';\n\tconst errorStateSubTitle =\n\t\toptionsErrorState?.subTitle ||\n\t\t'Something went wrong while fetching the list. Please try again';\n\tconst defaultErrorActionButton = {\n\t\tbuttonText: 'Try again',\n\t\tbuttonType: 'text' as const,\n\t\tsize: 'small' as const,\n\t\tbuttonTextColor: COLORS.background.inverseLight,\n\t\tcustomIconColor: COLORS.background.inverseLight,\n\t\tLeadingIcon: RetryIcon,\n\t};\n\n\tconst mergedErrorState = {\n\t\tIconHolderStyle: {\n\t\t\tbackground: COLORS.background.negative.light,\n\t\t},\n\t\tIcon: (\n\t\t\t<ErrorInfoIcon color={COLORS.content.negative} width={24} height={24} />\n\t\t),\n\t\t...optionsErrorState,\n\t};\n\tmergedErrorState.actionButton = {\n\t\t...defaultErrorActionButton,\n\t\t...(optionsErrorState?.actionButton ?? {}),\n\t};\n\tconst zeroStateProps = showLoadingState\n\t\t? undefined\n\t\t: showErrorState\n\t\t? mergedErrorState\n\t\t: zeroState;\n\n\treturn (\n\t\t<OpennedDropdownContainer\n\t\t\tversion={version}\n\t\t\tref={ref}\n\t\t\ttabIndex={-1}\n\t\t\tstyle={{\n\t\t\t\t// maxWidth: descriptionInfo ? 800 : 400,\n\t\t\t\twidth: widthState,\n\t\t\t\t...containerStyle,\n\t\t\t\toutline: 'none',\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\twidth: descriptionInfo ? '50%' : '100%',\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\tbackground: 'white',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{!!isSearchable && (\n\t\t\t\t\t<SearchBox\n\t\t\t\t\t\tonSearch={search}\n\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\tplaceholder={searchPlaceholder}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{showTopLevelZeroState ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tdata-testid=\"dropdown-options-zero-state\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\theight: staticMenuHeight ? menuListMaxHeight : heightToUse,\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tbackground: COLORS.background.base,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ZeroState\n\t\t\t\t\t\t\t{...(zeroStateProps ?? {})}\n\t\t\t\t\t\t\tisLoading={showLoadingState}\n\t\t\t\t\t\t\ttitle={showErrorState ? errorStateTitle : emptyStateTitle}\n\t\t\t\t\t\t\tsubTitle={\n\t\t\t\t\t\t\t\tshowErrorState ? errorStateSubTitle : emptyStateSubTitle\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<MenuListContainer\n\t\t\t\t\t\tdata-testid=\"dropdown-menu-list\"\n\t\t\t\t\t\tminHeight={staticMenuHeight ? menuListMaxHeight : undefined}\n\t\t\t\t\t\tmaxHeight={menuListMaxHeight}\n\t\t\t\t\t\tref={menuListRef}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!!isMultiSelect && !noResultForSearch && !hideSelectAll && (\n\t\t\t\t\t\t\t<SelectAllMenu\n\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\toptions={\n\t\t\t\t\t\t\t\t\tsearchedString && onSearch ? searchedOptions : dropdownOptions\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSelect={selectAllHandler}\n\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{!allowFreeForm && noResultForSearch && (\n\t\t\t\t\t\t\t<SearchZeroState\n\t\t\t\t\t\t\t\tisLoading={isSearchLoading}\n\t\t\t\t\t\t\t\terrorMessage={searchError}\n\t\t\t\t\t\t\t\tonRetry={retrySearch}\n\t\t\t\t\t\t\t\theight={menuListMaxHeight as number}\n\t\t\t\t\t\t\t\tsearchedString={searchedString}\n\t\t\t\t\t\t\t\tcontainerWidth={width}\n\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{allowFreeForm &&\n\t\t\t\t\t\t\t(noResultForSearch ||\n\t\t\t\t\t\t\t\t(!!exactMatchFound.length &&\n\t\t\t\t\t\t\t\t\texactMatchFound.every((val) => val === false))) && (\n\t\t\t\t\t\t\t\t<FreeFormMenu\n\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\t\tonSelect={onFreeFormSelect}\n\t\t\t\t\t\t\t\t\tsearchedString={searchedString}\n\t\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<MenuList\n\t\t\t\t\t\t\tonInfiniteScroll={onInfiniteScroll}\n\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\tonSelect={onApplyHandler}\n\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\toptions={optionsToShow}\n\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\tref={childRefs}\n\t\t\t\t\t\t\tfocusedIndex={focusedIndex}\n\t\t\t\t\t\t\tisDraggable={isDraggable}\n\t\t\t\t\t\t\tonOptionsReorder={handleOptionsReorder}\n\t\t\t\t\t\t\tshowCheckboxForCustomElement={showCheckboxForCustomElement}\n\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuListContainer>\n\t\t\t\t)}\n\t\t\t\t{!!isMultiSelect && !showTopLevelZeroState && version !== '2.0' && (\n\t\t\t\t\t<MultiSelectDropdownBottomBar\n\t\t\t\t\t\tonClear={() => {\n\t\t\t\t\t\t\tonMultiSelectClear();\n\t\t\t\t\t\t\tonMultiSelectClearProp?.();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonApply={onMultiSelectApply}\n\t\t\t\t\t\tlist={\n\t\t\t\t\t\t\tsearchedString && onSearch ? searchedOptions : dropdownOptions\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbuttonText={primaryButtonText}\n\t\t\t\t\t\tbuttonOptions={buttonOptions}\n\t\t\t\t\t\thideClearButton={hideClearButton}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{!!descriptionInfo && (\n\t\t\t\t<Description\n\t\t\t\t\ttitle={descriptionInfo.title}\n\t\t\t\t\tdescription={descriptionInfo.description}\n\t\t\t\t\tversion={version}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</OpennedDropdownContainer>\n\t);\n};\n"],"names":["defaults","OpenedDropdown","options","isSearchable","searchPlaceholder","staticMenuHeight","isMultiSelect","maxSelections","width","allowFreeForm","height","onClose","onSelect","onSearch","version","skipSorting","headerRef","hideSelectAll","primaryButtonText","onInfiniteScroll","onMultiSelectClearProp","onDropdownItemClick","buttonOptions","isSearchLoading","isOptionsLoading","optionsErrorState","disableSearchOptions","disableSearchedOptionExcept","useDefaultCursor","containerStyle","zeroState","isDraggable","onOptionsReorder","hideClearButton","showCheckboxForCustomElement","checkboxActiveColor","brandSelectedRow","sortOptionsWithSelectedOnTop","useCallback","opts","selected","unselected","option","localOptions","setLocalOptions","useState","localOptionsRef","useRef","hasReorderedRef","onOptionsReorderRef","useEffect","handleOptionsReorder","reorderedOptions","optionsToUse","dropdownOptions","search","searchedString","searchedOptions","searchError","retrySearch","onApplyHandler","selectAllHandler","onMultiSelectClear","onFreeFormSelect","onMultiSelectApply","latestDropdownOptionsRef","getSelectedOptions","getCurrentSelectionCount","useDropdown","widthState","setWidthState","descriptionInfo","setDescription","focusedIndex","setFocusedIndex","ref","childRefs","menuListRef","useOutside","optionsToSend","timer","getFlattenedOptions","flattened","nestedOption","singleOption","handleKeyDown","e","flattenedOptions","prev","newIndex","focusedElement","focusedOption","dropdownElement","heightToUse","menuListMaxHeight","showDescription","title","description","widthToUse","newWidth","exactMatchFound","optionsToShow","optionsToProcess","maxSelectionsReached","groupedOption","op","noResultForSearch","showLoadingState","showErrorState","showEmptyState","showTopLevelZeroState","emptyStateTitle","emptyStateSubTitle","errorStateTitle","errorStateSubTitle","defaultErrorActionButton","COLORS","RetryIcon","mergedErrorState","jsx","ErrorInfoIcon","zeroStateProps","jsxs","OpennedDropdownContainer","SearchBox","ZeroState","MenuListContainer","SelectAllMenu","SearchZeroState","val","FreeF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Y;AAAA,sBAAA;AAAA,wBACA,kBAAAhH;AAAA,wBACA,qBAAAE;AAAA,wBACA,SAAAP;AAAA,wBACA,UAAU8C;AAAA,wBACV,iBAAAmC;AAAA,wBACA,eAAAzF;AAAA,wBACA,SAAS+F;AAAA,wBACT,kBAAAzE;AAAA,wBACA,KAAKgD;AAAA,wBACL,cAAAH;AAAA,wBACA,aAAA1C;AAAA,wBACA,kBAAkBoB;AAAA,wBAClB,8BAAAjB;AAAA,wBACA,qBAAAC;AAAA,wBACA,kBAAAC;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACD;AAAA,gBAAA;AAAA,cAAA;AAAA,cAGD,CAAC,CAAC9B,KAAiB,CAACwG,MAAyBhG,MAAY,SACzD,gBAAAyG;AAAA,gBAACa;AAAA,gBAAA;AAAA,kBACA,SAAS,MAAM;AACd,oBAAAtE,GAAA,GACA1C,KAAA;AAAA,kBACD;AAAA,kBACA,SAAS4C;AAAA,kBACT,MACCR,KAAkB3C,IAAW4C,IAAkBH;AAAA,kBAEhD,YAAYpC;AAAA,kBACZ,eAAAI;AAAA,kBACA,iBAAAW;AAAA,gBAAA;AAAA,cAAA;AAAA,YACD;AAAA,UAAA;AAAA,QAAA;AAAA,QAGD,CAAC,CAACsC,KACF,gBAAAgD;AAAA,UAACc;AAAA,UAAA;AAAA,YACA,OAAO9D,EAAgB;AAAA,YACvB,aAAaA,EAAgB;AAAA,YAC7B,SAAAzD;AAAA,UAAA;AAAA,QAAA;AAAA,MACD;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
|
|
1
|
+
{"version":3,"file":"OpennedDropdown.js","sources":["../../../../../../src/components/dropdown/OpenedDropdown/components/OpennedDropdown.tsx"],"sourcesContent":["import ErrorInfoIcon from '@src/assets/icons/errorInfo.svg';\nimport RetryIcon from '@src/assets/icons/refresh-purple.svg';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { ZeroState } from '@src/components/zeroState/ZeroState';\nimport { useOutside } from '@src/hooks/useOutside';\nimport { COLORS } from '@src/constants/Theme';\nimport { useDropdown } from '../../hooks/useDropdown';\nimport {\n\tDropdownOption,\n\tGroupedOption,\n\tMultiSelectOption,\n\tOpenDropdownProps,\n\tSingleOption,\n} from '../../type';\nimport { Description } from './description/Description';\nimport { FreeFormMenu } from './menu/FreeFormMenu';\nimport { MenuList } from './menu/MenuList';\nimport { SelectAllMenu } from './menu/SelectAllMenu';\nimport MultiSelectDropdownBottomBar from './multiSelect/MultiSelectDropdownBottomBar';\nimport {\n\tMenuListContainer,\n\tOpennedDropdownContainer,\n} from './OpennedDropdown.styled';\nimport { SearchBox } from './searchbox/SearchBox';\nimport { SearchZeroState } from './searchbox/SearchZeroState';\n\n/** CONSTANTS */\nconst defaults = {\n\theight: 304,\n\twidth: 290,\n};\n\nexport const OpenedDropdown: React.FC<OpenDropdownProps> = ({\n\toptions,\n\tisSearchable,\n\tsearchPlaceholder,\n\tstaticMenuHeight,\n\tisMultiSelect,\n\tmaxSelections,\n\twidth,\n\tallowFreeForm,\n\theight,\n\tonClose,\n\tonSelect,\n\tonSearch,\n\tversion,\n\tskipSorting,\n\theaderRef,\n\thideSelectAll,\n\tprimaryButtonText,\n\tonInfiniteScroll,\n\tonMultiSelectClear: onMultiSelectClearProp,\n\tonDropdownItemClick,\n\tbuttonOptions,\n\tisSearchLoading,\n\tisOptionsLoading,\n\toptionsErrorState,\n\tdisableSearchOptions,\n\tdisableSearchedOptionExcept,\n\tuseDefaultCursor,\n\tcontainerStyle = {},\n\tzeroState = undefined,\n\tisDraggable = false,\n\tonOptionsReorder,\n\thideClearButton = false,\n\tshowCheckboxForCustomElement = false,\n\tcheckboxActiveColor,\n\tbrandSelectedRow,\n\tchildrenLayout,\n\tcollapsibleChildren,\n\thideSelectedCount,\n}) => {\n\t// Sort options with selected at top, unselected at bottom, maintaining order within groups\n\tconst sortOptionsWithSelectedOnTop = useCallback(\n\t\t(opts: DropdownOption[]): DropdownOption[] => {\n\t\t\tif (!isDraggable || !isMultiSelect) return opts;\n\n\t\t\tconst selected: DropdownOption[] = [];\n\t\t\tconst unselected: DropdownOption[] = [];\n\n\t\t\topts.forEach((option) => {\n\t\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t\t// Handle grouped options - maintain grouping\n\t\t\t\t\tunselected.push(option);\n\t\t\t\t} else {\n\t\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\t\tif (singleOption.selected) {\n\t\t\t\t\t\tselected.push(option);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunselected.push(option);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn [...selected, ...unselected];\n\t\t},\n\t\t[isDraggable, isMultiSelect],\n\t);\n\n\tconst [localOptions, setLocalOptions] = useState<DropdownOption[]>(() =>\n\t\tsortOptionsWithSelectedOnTop(options),\n\t);\n\tconst localOptionsRef = useRef<DropdownOption[]>(localOptions);\n\tconst hasReorderedRef = useRef(false);\n\tconst onOptionsReorderRef = useRef(onOptionsReorder);\n\n\tuseEffect(() => {\n\t\tsetLocalOptions(sortOptionsWithSelectedOnTop(options));\n\t}, [options, sortOptionsWithSelectedOnTop]);\n\n\tuseEffect(() => {\n\t\tlocalOptionsRef.current = localOptions;\n\t}, [localOptions]);\n\n\tuseEffect(() => {\n\t\tonOptionsReorderRef.current = onOptionsReorder;\n\t}, [onOptionsReorder]);\n\n\t// Fire onOptionsReorder on unmount (dropdown close from Apply or click-outside)\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tif (hasReorderedRef.current && onOptionsReorderRef.current) {\n\t\t\t\tonOptionsReorderRef.current(localOptionsRef.current);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\tconst handleOptionsReorder = useCallback(\n\t\t(reorderedOptions: DropdownOption[]) => {\n\t\t\tsetLocalOptions(reorderedOptions);\n\t\t\t// For version 2.0 (no Apply button), apply reorder immediately\n\t\t\tif (version === '2.0') {\n\t\t\t\tonOptionsReorder?.(reorderedOptions);\n\t\t\t} else {\n\t\t\t\t// For version 1.0, defer until Apply/close (handled by unmount cleanup)\n\t\t\t\thasReorderedRef.current = true;\n\t\t\t}\n\t\t},\n\t\t[onOptionsReorder, version],\n\t);\n\n\tconst optionsToUse = isDraggable ? localOptions : options;\n\tconst {\n\t\tdropdownOptions,\n\t\tsearch,\n\t\tsearchedString,\n\t\tsearchedOptions,\n\t\tsearchError,\n\t\tretrySearch,\n\t\tonApplyHandler,\n\t\tselectAllHandler,\n\t\tonMultiSelectClear,\n\t\tonFreeFormSelect,\n\t\tonMultiSelectApply,\n\t\tlatestDropdownOptionsRef,\n\t\tgetSelectedOptions,\n\t\tgetCurrentSelectionCount,\n\t} = useDropdown(\n\t\tversion,\n\t\toptionsToUse,\n\t\tonSelect,\n\t\tskipSorting || isDraggable,\n\t\tisMultiSelect,\n\t\tonSearch,\n\t\tdisableSearchOptions,\n\t\tdisableSearchedOptionExcept,\n\t\tmaxSelections,\n\t);\n\tconst [widthState, setWidthState] = useState(width ?? defaults.width);\n\tconst [descriptionInfo, setDescription] = useState<{\n\t\ttitle: string;\n\t\tdescription: string;\n\t} | null>(null);\n\tconst [focusedIndex, setFocusedIndex] = useState<number>(-1);\n\tconst ref = useRef<HTMLDivElement>(null);\n\tconst childRefs = useRef([]);\n\tconst menuListRef = useRef<HTMLDivElement>(null);\n\tuseOutside(\n\t\tref,\n\t\t() => {\n\t\t\tsetDescription(null);\n\t\t\tif (isMultiSelect && version === '2.0') {\n\t\t\t\tconst optionsToSend = getSelectedOptions(\n\t\t\t\t\tlatestDropdownOptionsRef.current,\n\t\t\t\t);\n\t\t\t\tonClose?.(optionsToSend);\n\t\t\t} else {\n\t\t\t\tonClose?.(dropdownOptions);\n\t\t\t}\n\t\t},\n\t\t[headerRef, childRefs],\n\t);\n\n\t// Auto-focus dropdown when it opens for keyboard navigation while preventing scroll to maintain popper positioning\n\tuseEffect(() => {\n\t\tconst timer = setTimeout(() => {\n\t\t\tif (ref.current) {\n\t\t\t\tref.current.focus({ preventScroll: true });\n\t\t\t}\n\t\t}, 0);\n\t\treturn () => clearTimeout(timer);\n\t}, []);\n\n\t// Get flattened selectable options\n\tconst getFlattenedOptions = (opts: DropdownOption[]): SingleOption[] => {\n\t\tconst flattened: SingleOption[] = [];\n\t\topts.forEach((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\tconst groupedOption = option as GroupedOption;\n\t\t\t\tgroupedOption.options.forEach((nestedOption) => {\n\t\t\t\t\tif (!nestedOption.disabled) {\n\t\t\t\t\t\tflattened.push(nestedOption);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\tif (!singleOption.disabled) {\n\t\t\t\t\tflattened.push(singleOption);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn flattened;\n\t};\n\n\t/** Keyboard navigation handler */\n\tuseEffect(() => {\n\t\tconst handleKeyDown = (e: KeyboardEvent) => {\n\t\t\tconst currentOptions =\n\t\t\t\tsearchedString && onSearch ? searchedOptions : dropdownOptions;\n\t\t\tconst flattenedOptions = getFlattenedOptions(currentOptions);\n\n\t\t\tif (flattenedOptions.length === 0) return;\n\n\t\t\tif (e.key === 'ArrowDown') {\n\t\t\t\te.preventDefault();\n\t\t\t\tsetFocusedIndex((prev) => {\n\t\t\t\t\tconst newIndex = prev < flattenedOptions.length - 1 ? prev + 1 : 0;\n\t\t\t\t\t// Scroll to the focused item\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tconst focusedElement = menuListRef.current?.querySelector(\n\t\t\t\t\t\t\t`[data-option-index=\"${newIndex}\"]`,\n\t\t\t\t\t\t) as HTMLElement;\n\t\t\t\t\t\tif (focusedElement) {\n\t\t\t\t\t\t\tfocusedElement.scrollIntoView({\n\t\t\t\t\t\t\t\tblock: 'nearest',\n\t\t\t\t\t\t\t\tbehavior: 'smooth',\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 0);\n\t\t\t\t\treturn newIndex;\n\t\t\t\t});\n\t\t\t} else if (e.key === 'ArrowUp') {\n\t\t\t\te.preventDefault();\n\t\t\t\tsetFocusedIndex((prev) => {\n\t\t\t\t\tconst newIndex = prev > 0 ? prev - 1 : flattenedOptions.length - 1;\n\t\t\t\t\t// Scroll to the focused item\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tconst focusedElement = menuListRef.current?.querySelector(\n\t\t\t\t\t\t\t`[data-option-index=\"${newIndex}\"]`,\n\t\t\t\t\t\t) as HTMLElement;\n\t\t\t\t\t\tif (focusedElement) {\n\t\t\t\t\t\t\tfocusedElement.scrollIntoView({\n\t\t\t\t\t\t\t\tblock: 'nearest',\n\t\t\t\t\t\t\t\tbehavior: 'smooth',\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 0);\n\t\t\t\t\treturn newIndex;\n\t\t\t\t});\n\t\t\t} else if (e.key === 'Enter' && focusedIndex >= 0) {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst focusedOption = flattenedOptions[focusedIndex];\n\t\t\t\tif (focusedOption) {\n\t\t\t\t\t// onApplyHandler handles the selection state and calls onSelect internally\n\t\t\t\t\tonApplyHandler({\n\t\t\t\t\t\t...focusedOption,\n\t\t\t\t\t\tselected: !focusedOption.selected,\n\t\t\t\t\t});\n\t\t\t\t\t// Also trigger onDropdownItemClick if provided\n\t\t\t\t\tif (onDropdownItemClick) {\n\t\t\t\t\t\tonDropdownItemClick(focusedOption);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst dropdownElement = ref.current;\n\t\tif (dropdownElement) {\n\t\t\tdropdownElement.addEventListener('keydown', handleKeyDown);\n\t\t\treturn () => {\n\t\t\t\tdropdownElement.removeEventListener('keydown', handleKeyDown);\n\t\t\t};\n\t\t}\n\t}, [\n\t\tfocusedIndex,\n\t\tsearchedString,\n\t\tsearchedOptions,\n\t\tdropdownOptions,\n\t\tonSearch,\n\t\tonApplyHandler,\n\t\tonDropdownItemClick,\n\t]);\n\n\t// LOCAL CONSTANTS\n\tconst heightToUse = height ?? defaults.height;\n\tconst menuListMaxHeight =\n\t\ttypeof heightToUse === 'number'\n\t\t\t? isSearchable && isMultiSelect\n\t\t\t\t? heightToUse - 96\n\t\t\t\t: (isSearchable && !isMultiSelect) || (!isSearchable && isMultiSelect)\n\t\t\t\t? heightToUse - 48\n\t\t\t\t: heightToUse\n\t\t\t: heightToUse;\n\n\tfunction showDescription(title?: string, description?: string) {\n\t\tif (title && description) {\n\t\t\tsetDescription({\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t});\n\t\t} else {\n\t\t\tsetDescription(null);\n\t\t}\n\t}\n\n\tuseEffect(() => {\n\t\tconst widthToUse = width ?? defaults.width;\n\t\tif (descriptionInfo === null) {\n\t\t\tsetWidthState(widthToUse);\n\t\t} else if (typeof widthToUse === 'number') {\n\t\t\tsetWidthState(widthToUse * 2);\n\t\t} else if (typeof widthToUse === 'string') {\n\t\t\tif (widthToUse.endsWith('px')) {\n\t\t\t\tconst newWidth = parseInt(widthToUse.replace('px', '')) * 2;\n\t\t\t\tsetWidthState(newWidth);\n\t\t\t}\n\t\t}\n\t}, [descriptionInfo]);\n\n\t/**\n\t * This is to show the search result in a stateless way\n\t */\n\n\tconst exactMatchFound: boolean[] = [];\n\n\tconst processOptionsWithMaxSelections = (\n\t\toptionsToProcess: DropdownOption[],\n\t) => {\n\t\tif (!isMultiSelect || (!maxSelections && maxSelections !== 0)) {\n\t\t\treturn optionsToProcess;\n\t\t}\n\n\t\t// Count from the full options list (not the filtered subset) so selections\n\t\t// hidden by a search query are still included in the limit check.\n\t\tconst currentSelectionCount = getCurrentSelectionCount(dropdownOptions);\n\t\tconst maxSelectionsReached = currentSelectionCount >= maxSelections;\n\n\t\tif (!maxSelectionsReached) {\n\t\t\treturn optionsToProcess;\n\t\t}\n\n\t\t// Disable unselected options when max selections is reached\n\t\treturn optionsToProcess.map((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\treturn {\n\t\t\t\t\t...option,\n\t\t\t\t\toptions: (option as GroupedOption).options.map((nestedOption) => ({\n\t\t\t\t\t\t...nestedOption,\n\t\t\t\t\t\tdisabled:\n\t\t\t\t\t\t\tnestedOption.disabled ||\n\t\t\t\t\t\t\t(!nestedOption.selected && maxSelectionsReached),\n\t\t\t\t\t})),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\treturn {\n\t\t\t\t\t...singleOption,\n\t\t\t\t\tdisabled:\n\t\t\t\t\t\tsingleOption.disabled ||\n\t\t\t\t\t\t(!singleOption.selected && maxSelectionsReached),\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\t};\n\n\tconst optionsToShow = processOptionsWithMaxSelections(\n\t\t(searchedString && onSearch ? searchedOptions : dropdownOptions)\n\t\t\t.map((option) => {\n\t\t\t\tif (searchedString && !onSearch) {\n\t\t\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t\t\tconst groupedOption = { ...option } as GroupedOption;\n\t\t\t\t\t\tgroupedOption.options = groupedOption.options.filter((op) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\top.label?.toLowerCase().includes(searchedString.toLowerCase())\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\texactMatchFound.push(\n\t\t\t\t\t\t\t\t\t!searchedString || op.label === searchedString,\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\treturn groupedOption.options.length > 0 ? groupedOption : null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\toption.label\n\t\t\t\t\t\t\t\t?.toLowerCase()\n\t\t\t\t\t\t\t\t.includes(searchedString.toLowerCase()) ||\n\t\t\t\t\t\t\t(option as SingleOption | MultiSelectOption).searchKey\n\t\t\t\t\t\t\t\t?.toLowerCase()\n\t\t\t\t\t\t\t\t.includes(searchedString.toLowerCase())\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\texactMatchFound.push(\n\t\t\t\t\t\t\t\t!searchedString || option.label === searchedString,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn option;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn option;\n\t\t\t})\n\t\t\t.filter((option) => option !== null) as DropdownOption[],\n\t);\n\n\tconst noResultForSearch =\n\t\t!!isSearchable && searchedString && optionsToShow.length === 0;\n\tconst showLoadingState = !searchedString && !!isOptionsLoading;\n\tconst showErrorState =\n\t\t!searchedString && !!optionsErrorState && !showLoadingState;\n\tconst showEmptyState =\n\t\t!searchedString &&\n\t\t!optionsToShow.length &&\n\t\t!showLoadingState &&\n\t\t!showErrorState;\n\tconst showTopLevelZeroState =\n\t\tshowLoadingState || showErrorState || showEmptyState;\n\n\tconst emptyStateTitle = zeroState?.title || 'No results found';\n\tconst emptyStateSubTitle =\n\t\tzeroState?.subTitle ||\n\t\t`Please try again later or contact us at support@bik.ai if you require further assistance.`;\n\tconst errorStateTitle = optionsErrorState?.title || 'Failed to load options';\n\tconst errorStateSubTitle =\n\t\toptionsErrorState?.subTitle ||\n\t\t'Something went wrong while fetching the list. Please try again';\n\tconst defaultErrorActionButton = {\n\t\tbuttonText: 'Try again',\n\t\tbuttonType: 'text' as const,\n\t\tsize: 'small' as const,\n\t\tbuttonTextColor: COLORS.background.inverseLight,\n\t\tcustomIconColor: COLORS.background.inverseLight,\n\t\tLeadingIcon: RetryIcon,\n\t};\n\n\tconst mergedErrorState = {\n\t\tIconHolderStyle: {\n\t\t\tbackground: COLORS.background.negative.light,\n\t\t},\n\t\tIcon: (\n\t\t\t<ErrorInfoIcon color={COLORS.content.negative} width={24} height={24} />\n\t\t),\n\t\t...optionsErrorState,\n\t};\n\tmergedErrorState.actionButton = {\n\t\t...defaultErrorActionButton,\n\t\t...(optionsErrorState?.actionButton ?? {}),\n\t};\n\tconst zeroStateProps = showLoadingState\n\t\t? undefined\n\t\t: showErrorState\n\t\t? mergedErrorState\n\t\t: zeroState;\n\n\treturn (\n\t\t<OpennedDropdownContainer\n\t\t\tversion={version}\n\t\t\tref={ref}\n\t\t\ttabIndex={-1}\n\t\t\tstyle={{\n\t\t\t\t// maxWidth: descriptionInfo ? 800 : 400,\n\t\t\t\twidth: widthState,\n\t\t\t\t...containerStyle,\n\t\t\t\toutline: 'none',\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\twidth: descriptionInfo ? '50%' : '100%',\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\tbackground: 'white',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{!!isSearchable && (\n\t\t\t\t\t<SearchBox\n\t\t\t\t\t\tonSearch={search}\n\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\tplaceholder={searchPlaceholder}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{showTopLevelZeroState ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tdata-testid=\"dropdown-options-zero-state\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\theight: staticMenuHeight ? menuListMaxHeight : heightToUse,\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tbackground: COLORS.background.base,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ZeroState\n\t\t\t\t\t\t\t{...(zeroStateProps ?? {})}\n\t\t\t\t\t\t\tisLoading={showLoadingState}\n\t\t\t\t\t\t\ttitle={showErrorState ? errorStateTitle : emptyStateTitle}\n\t\t\t\t\t\t\tsubTitle={\n\t\t\t\t\t\t\t\tshowErrorState ? errorStateSubTitle : emptyStateSubTitle\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<MenuListContainer\n\t\t\t\t\t\tdata-testid=\"dropdown-menu-list\"\n\t\t\t\t\t\tminHeight={staticMenuHeight ? menuListMaxHeight : undefined}\n\t\t\t\t\t\tmaxHeight={menuListMaxHeight}\n\t\t\t\t\t\tref={menuListRef}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!!isMultiSelect && !noResultForSearch && !hideSelectAll && (\n\t\t\t\t\t\t\t<SelectAllMenu\n\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\toptions={\n\t\t\t\t\t\t\t\t\tsearchedString && onSearch ? searchedOptions : dropdownOptions\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSelect={selectAllHandler}\n\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{!allowFreeForm && noResultForSearch && (\n\t\t\t\t\t\t\t<SearchZeroState\n\t\t\t\t\t\t\t\tisLoading={isSearchLoading}\n\t\t\t\t\t\t\t\terrorMessage={searchError}\n\t\t\t\t\t\t\t\tonRetry={retrySearch}\n\t\t\t\t\t\t\t\theight={menuListMaxHeight as number}\n\t\t\t\t\t\t\t\tsearchedString={searchedString}\n\t\t\t\t\t\t\t\tcontainerWidth={width}\n\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{allowFreeForm &&\n\t\t\t\t\t\t\t(noResultForSearch ||\n\t\t\t\t\t\t\t\t(!!exactMatchFound.length &&\n\t\t\t\t\t\t\t\t\texactMatchFound.every((val) => val === false))) && (\n\t\t\t\t\t\t\t\t<FreeFormMenu\n\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\t\tonSelect={onFreeFormSelect}\n\t\t\t\t\t\t\t\t\tsearchedString={searchedString}\n\t\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<MenuList\n\t\t\t\t\t\t\tonInfiniteScroll={onInfiniteScroll}\n\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\tonSelect={onApplyHandler}\n\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\toptions={optionsToShow}\n\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\tref={childRefs}\n\t\t\t\t\t\t\tfocusedIndex={focusedIndex}\n\t\t\t\t\t\t\tisDraggable={isDraggable}\n\t\t\t\t\t\t\tonOptionsReorder={handleOptionsReorder}\n\t\t\t\t\t\t\tshowCheckboxForCustomElement={showCheckboxForCustomElement}\n\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\tchildrenLayout={childrenLayout}\n\t\t\t\t\t\t\tcollapsibleChildren={collapsibleChildren}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuListContainer>\n\t\t\t\t)}\n\t\t\t\t{!!isMultiSelect && !showTopLevelZeroState && version !== '2.0' && (\n\t\t\t\t\t<MultiSelectDropdownBottomBar\n\t\t\t\t\t\tonClear={() => {\n\t\t\t\t\t\t\tonMultiSelectClear();\n\t\t\t\t\t\t\tonMultiSelectClearProp?.();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonApply={onMultiSelectApply}\n\t\t\t\t\t\tlist={\n\t\t\t\t\t\t\tsearchedString && onSearch ? searchedOptions : dropdownOptions\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbuttonText={primaryButtonText}\n\t\t\t\t\t\tbuttonOptions={buttonOptions}\n\t\t\t\t\t\thideClearButton={hideClearButton}\n\t\t\t\t\t\thideSelectedCount={hideSelectedCount}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{!!descriptionInfo && (\n\t\t\t\t<Description\n\t\t\t\t\ttitle={descriptionInfo.title}\n\t\t\t\t\tdescription={descriptionInfo.description}\n\t\t\t\t\tversion={version}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</OpennedDropdownContainer>\n\t);\n};\n"],"names":["defaults","OpenedDropdown","options","isSearchable","searchPlaceholder","staticMenuHeight","isMultiSelect","maxSelections","width","allowFreeForm","height","onClose","onSelect","onSearch","version","skipSorting","headerRef","hideSelectAll","primaryButtonText","onInfiniteScroll","onMultiSelectClearProp","onDropdownItemClick","buttonOptions","isSearchLoading","isOptionsLoading","optionsErrorState","disableSearchOptions","disableSearchedOptionExcept","useDefaultCursor","containerStyle","zeroState","isDraggable","onOptionsReorder","hideClearButton","showCheckboxForCustomElement","checkboxActiveColor","brandSelectedRow","childrenLayout","collapsibleChildren","hideSelectedCount","sortOptionsWithSelectedOnTop","useCallback","opts","selected","unselected","option","localOptions","setLocalOptions","useState","localOptionsRef","useRef","hasReorderedRef","onOptionsReorderRef","useEffect","handleOptionsReorder","reorderedOptions","optionsToUse","dropdownOptions","search","searchedString","searchedOptions","searchError","retrySearch","onApplyHandler","selectAllHandler","onMultiSelectClear","onFreeFormSelect","onMultiSelectApply","latestDropdownOptionsRef","getSelectedOptions","getCurrentSelectionCount","useDropdown","widthState","setWidthState","descriptionInfo","setDescription","focusedIndex","setFocusedIndex","ref","childRefs","menuListRef","useOutside","optionsToSend","timer","getFlattenedOptions","flattened","nestedOption","singleOption","handleKeyDown","e","flattenedOptions","prev","newIndex","focusedElement","focusedOption","dropdownElement","heightToUse","menuListMaxHeight","showDescription","title","description","widthToUse","newWidth","exactMatchFound","optionsToShow","optionsToProcess","maxSelectionsReached","groupedOption","op","noResultForSearch","showLoadingState","showErrorState","showEmptyState","showTopLevelZeroState","emptyStateTitle","emptyStateSubTitle","errorStateTitle","errorStateSubTitle","defaultErrorActionButton","COLORS","RetryIcon","mergedErrorState","jsx","ErrorInfoIcon","zeroStateProps","jsxs","OpennedDropdownContainer","SearchBox","ZeroState","MenuListContainer","SelectAllMenu","SearchZeroState","val","FreeFormMenu","MenuList","MultiSelectDropdownBottomBar","Description"],"mappings":";;;;;;;;;;;;;;;;AA2BA,MAAMA,IAAW;AAAA,EAChB,QAAQ;AAAA,EACR,OAAO;AACR,GAEaC,KAA8C,CAAC;AAAA,EAC3D,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAoBC;AAAA,EACpB,qBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,6BAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,gBAAAC,KAAiB,CAAA;AAAA,EACjB,WAAAC,IAAY;AAAA,EACZ,aAAAC,IAAc;AAAA,EACd,kBAAAC;AAAA,EACA,iBAAAC,KAAkB;AAAA,EAClB,8BAAAC,KAA+B;AAAA,EAC/B,qBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,mBAAAC;AACD,MAAM;AAEL,QAA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AAA,UAAA;AAAA,YACA,OAAO9D,EAAgB;AAAA,YACvB,aAAaA,EAAgB;AAAA,YAC7B,SAAA5D;AAAA,UAAA;AAAA,QAAA;AAAA,MACD;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
|
|
@@ -19,6 +19,15 @@ interface MenuItemProps {
|
|
|
19
19
|
showCheckboxForCustomElement?: boolean;
|
|
20
20
|
checkboxActiveColor?: string;
|
|
21
21
|
brandSelectedRow?: boolean;
|
|
22
|
+
childrenLayout?: 'flyout' | 'nested';
|
|
23
|
+
/** Indents the row under its parent and draws the elbow connector. */
|
|
24
|
+
isChildRow?: boolean;
|
|
25
|
+
/** Tri-state for a nested parent whose children are only partly selected. */
|
|
26
|
+
isPartiallyChecked?: boolean;
|
|
27
|
+
/** Shows the collapse chevron on a nested parent row. */
|
|
28
|
+
isCollapsible?: boolean;
|
|
29
|
+
isCollapsed?: boolean;
|
|
30
|
+
onToggleCollapse?: () => void;
|
|
22
31
|
}
|
|
23
32
|
export declare const MenuItem: import('react').ForwardRefExoticComponent<MenuItemProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
24
33
|
export {};
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
1
|
+
import { jsx as t, Fragment as m, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import P from "../../../../../assets/icons/chevronDownOutline.svg.js";
|
|
3
|
+
import Q from "../../../../../assets/icons/chevronRight.svg.js";
|
|
4
|
+
import X from "../../../../../assets/icons/chevronUpOutline.svg.js";
|
|
5
|
+
import { forwardRef as Y, useState as Z } from "react";
|
|
6
|
+
import n from "styled-components";
|
|
7
|
+
import { BodyCaption as ee } from "../../../../TypographyStyle.js";
|
|
8
|
+
import { COLORS as i, DEFAULT_THEME as D } from "../../../../../constants/Theme.js";
|
|
9
|
+
import { FreeFormContainer as te } from "./FreeFormMenu.styled.js";
|
|
10
|
+
import { Tooltip as re } from "../../../../tooltips/Tooltip.js";
|
|
11
|
+
import { CheckBox as O } from "../../../../checkBox/CheckBox.js";
|
|
12
|
+
import { ListItem as ne } from "../../../../list-item/ListItem.js";
|
|
13
|
+
const v = n(ne)`
|
|
12
14
|
padding: ${(e) => e.version === "3.0" ? "8px" : e.version === "2.0" ? "8px 12px" : "14px 16px"} !important;
|
|
13
15
|
cursor: pointer;
|
|
14
16
|
margin-top: ${(e) => e.brandSelectedRow ? "0" : e.version === "2.0" ? "2px" : "0"};
|
|
15
|
-
`,
|
|
17
|
+
`, le = n(v)`
|
|
18
|
+
padding: 8px !important;
|
|
19
|
+
margin-top: 0;
|
|
20
|
+
border-radius: 0;
|
|
21
|
+
`, oe = n.div`
|
|
16
22
|
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.12);
|
|
17
23
|
border-radius: ${({ version: e }) => e === "1.0" ? "0" : "8px"};
|
|
18
24
|
padding: ${({ version: e }) => e === "1.0" ? "0" : "4px"};
|
|
19
25
|
min-width: 148px;
|
|
20
|
-
border: ${({ version: e }) => e === "1.0" ? `1px solid ${
|
|
26
|
+
border: ${({ version: e }) => e === "1.0" ? `1px solid ${D.colorsV2.stroke.primary}` : "none"};
|
|
21
27
|
max-height: 248px;
|
|
22
28
|
overflow-y: auto;
|
|
23
|
-
`,
|
|
29
|
+
`, de = n.div`
|
|
24
30
|
display: grid;
|
|
25
31
|
grid-template-columns: repeat(2, 2.86px);
|
|
26
32
|
grid-template-rows: repeat(3, 2.86px);
|
|
@@ -32,191 +38,223 @@ const $ = t(J)`
|
|
|
32
38
|
align-self: center;
|
|
33
39
|
height: fit-content;
|
|
34
40
|
min-height: 18px;
|
|
35
|
-
`,
|
|
41
|
+
`, d = n.div`
|
|
36
42
|
width: 2.86px;
|
|
37
43
|
height: 2.86px;
|
|
38
44
|
border-radius: 50%;
|
|
39
|
-
background-color: ${
|
|
45
|
+
background-color: ${i.content.inactive};
|
|
40
46
|
flex-shrink: 0;
|
|
41
|
-
`,
|
|
47
|
+
`, F = n.div`
|
|
42
48
|
display: flex;
|
|
43
49
|
align-content: center;
|
|
44
50
|
justify-content: center;
|
|
45
51
|
gap: 8px;
|
|
46
|
-
`,
|
|
52
|
+
`, ie = n.span`
|
|
53
|
+
align-self: flex-start;
|
|
54
|
+
flex-shrink: 0;
|
|
55
|
+
width: 11px;
|
|
56
|
+
height: 9px;
|
|
57
|
+
margin-left: 4px;
|
|
58
|
+
border-left: 1px solid ${i.content.placeholder};
|
|
59
|
+
border-bottom: 1px solid ${i.content.placeholder};
|
|
60
|
+
border-bottom-left-radius: 4px;
|
|
61
|
+
`, ae = n.span`
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
`, se = n.div`
|
|
47
66
|
margin-right: -4px;
|
|
48
|
-
`,
|
|
67
|
+
`, ce = n.div`
|
|
49
68
|
display: flex;
|
|
50
69
|
align-items: center;
|
|
51
70
|
flex-direction: column;
|
|
52
71
|
flex: 1;
|
|
53
|
-
`,
|
|
54
|
-
|
|
72
|
+
`, x = ({ onDragStart: e, onDragEnd: a }) => /* @__PURE__ */ p(
|
|
73
|
+
de,
|
|
55
74
|
{
|
|
56
75
|
draggable: !0,
|
|
57
76
|
onDragStart: e,
|
|
58
|
-
onDragEnd:
|
|
77
|
+
onDragEnd: a,
|
|
59
78
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ t(d, {}),
|
|
80
|
+
/* @__PURE__ */ t(d, {}),
|
|
81
|
+
/* @__PURE__ */ t(d, {}),
|
|
82
|
+
/* @__PURE__ */ t(d, {}),
|
|
83
|
+
/* @__PURE__ */ t(d, {}),
|
|
84
|
+
/* @__PURE__ */ t(d, {})
|
|
66
85
|
]
|
|
67
86
|
}
|
|
68
|
-
),
|
|
87
|
+
), Le = Y(
|
|
69
88
|
({
|
|
70
89
|
option: e,
|
|
71
|
-
isMultiSelect:
|
|
72
|
-
showDescription:
|
|
90
|
+
isMultiSelect: a,
|
|
91
|
+
showDescription: b,
|
|
73
92
|
onSelect: H,
|
|
74
|
-
last:
|
|
75
|
-
version:
|
|
76
|
-
onDropdownItemClick:
|
|
77
|
-
useDefaultCursor:
|
|
78
|
-
isFocused:
|
|
79
|
-
dataIndex:
|
|
80
|
-
isDraggable:
|
|
81
|
-
onDragStart:
|
|
82
|
-
onDragOver:
|
|
83
|
-
onDrop:
|
|
84
|
-
onDragEnd:
|
|
85
|
-
isDraggedOver:
|
|
86
|
-
showCheckboxForCustomElement:
|
|
87
|
-
checkboxActiveColor:
|
|
88
|
-
brandSelectedRow:
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
last: M,
|
|
94
|
+
version: l,
|
|
95
|
+
onDropdownItemClick: A,
|
|
96
|
+
useDefaultCursor: B,
|
|
97
|
+
isFocused: E = !1,
|
|
98
|
+
dataIndex: C = -1,
|
|
99
|
+
isDraggable: s = !1,
|
|
100
|
+
onDragStart: f,
|
|
101
|
+
onDragOver: R,
|
|
102
|
+
onDrop: U,
|
|
103
|
+
onDragEnd: h,
|
|
104
|
+
isDraggedOver: I = !1,
|
|
105
|
+
showCheckboxForCustomElement: y = !1,
|
|
106
|
+
checkboxActiveColor: L,
|
|
107
|
+
brandSelectedRow: w,
|
|
108
|
+
childrenLayout: V = "flyout",
|
|
109
|
+
isChildRow: j = !1,
|
|
110
|
+
isPartiallyChecked: $ = !1,
|
|
111
|
+
isCollapsible: z = !1,
|
|
112
|
+
isCollapsed: g = !1,
|
|
113
|
+
onToggleCollapse: N
|
|
114
|
+
}, W) => {
|
|
115
|
+
const [_, k] = Z(
|
|
91
116
|
e.selected
|
|
92
|
-
),
|
|
93
|
-
if (!
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
117
|
+
), o = V === "nested", q = o ? le : v, G = !o && l === "2.0" ? "SMALL" : "DEFAULT", T = (r, c) => {
|
|
118
|
+
if (!r.children || o) {
|
|
119
|
+
u(!r.selected);
|
|
120
|
+
const K = c ? { ...r, parent: c } : r;
|
|
121
|
+
A?.(K);
|
|
97
122
|
}
|
|
98
|
-
},
|
|
99
|
-
e.disabled || H({ ...e, selected:
|
|
100
|
-
},
|
|
101
|
-
e.description ?
|
|
102
|
-
},
|
|
103
|
-
return /* @__PURE__ */
|
|
104
|
-
|
|
123
|
+
}, u = (r) => {
|
|
124
|
+
e.disabled || H({ ...e, selected: r });
|
|
125
|
+
}, J = () => {
|
|
126
|
+
e.description ? b(e.label, e.description) : b();
|
|
127
|
+
}, S = B ? { cursor: "default" } : {};
|
|
128
|
+
return /* @__PURE__ */ t(m, { children: /* @__PURE__ */ t(
|
|
129
|
+
re,
|
|
105
130
|
{
|
|
106
131
|
body: "",
|
|
107
|
-
tooltipContent: e.children ? /* @__PURE__ */
|
|
132
|
+
tooltipContent: e.children && !o ? /* @__PURE__ */ t(
|
|
108
133
|
"div",
|
|
109
134
|
{
|
|
110
135
|
style: {
|
|
111
|
-
backgroundColor:
|
|
136
|
+
backgroundColor: D.colorsV2.surface.standard
|
|
112
137
|
},
|
|
113
|
-
ref:
|
|
114
|
-
onMouseEnter: () =>
|
|
115
|
-
onMouseLeave: () =>
|
|
116
|
-
children: /* @__PURE__ */
|
|
117
|
-
|
|
138
|
+
ref: W,
|
|
139
|
+
onMouseEnter: () => k(!0),
|
|
140
|
+
onMouseLeave: () => k(!1),
|
|
141
|
+
children: /* @__PURE__ */ t(oe, { version: l ?? "2.0", children: e.children.map((r) => /* @__PURE__ */ t(
|
|
142
|
+
v,
|
|
118
143
|
{
|
|
119
|
-
version:
|
|
120
|
-
brandSelectedRow:
|
|
121
|
-
style:
|
|
122
|
-
onClick: (
|
|
123
|
-
|
|
144
|
+
version: l,
|
|
145
|
+
brandSelectedRow: w,
|
|
146
|
+
style: l !== "1.0" && (e?.children ?? []).length - 1 ? { borderBottom: 0 } : {},
|
|
147
|
+
onClick: (c) => {
|
|
148
|
+
c.preventDefault(), T(r, e);
|
|
124
149
|
},
|
|
125
|
-
listItem: { value:
|
|
126
|
-
subText:
|
|
127
|
-
leadingIcon:
|
|
128
|
-
customComponent:
|
|
129
|
-
trailingIcon:
|
|
130
|
-
variant: e.disabled ? "inactive" :
|
|
150
|
+
listItem: { value: r.value, label: r.label },
|
|
151
|
+
subText: r.subText,
|
|
152
|
+
leadingIcon: r.leadingIcon || void 0,
|
|
153
|
+
customComponent: r.customComponent,
|
|
154
|
+
trailingIcon: r.trailingIcon || void 0,
|
|
155
|
+
variant: e.disabled ? "inactive" : r.selected ? "selected" : "default"
|
|
131
156
|
},
|
|
132
|
-
|
|
157
|
+
r.value
|
|
133
158
|
)) })
|
|
134
159
|
}
|
|
135
|
-
) : /* @__PURE__ */
|
|
160
|
+
) : /* @__PURE__ */ t(m, {}),
|
|
136
161
|
placement: "right-start",
|
|
137
162
|
hideArrow: !0,
|
|
138
|
-
children: /* @__PURE__ */
|
|
139
|
-
|
|
163
|
+
children: /* @__PURE__ */ t(
|
|
164
|
+
q,
|
|
140
165
|
{
|
|
141
|
-
version:
|
|
142
|
-
brandSelectedRow:
|
|
143
|
-
style:
|
|
166
|
+
version: l,
|
|
167
|
+
brandSelectedRow: w,
|
|
168
|
+
style: M ? {
|
|
144
169
|
borderBottom: 0,
|
|
145
|
-
...
|
|
146
|
-
...
|
|
147
|
-
borderTop: `2px solid ${
|
|
170
|
+
...S,
|
|
171
|
+
...I ? {
|
|
172
|
+
borderTop: `2px solid ${i.content.brand}`,
|
|
148
173
|
opacity: 0.5
|
|
149
174
|
} : {}
|
|
150
175
|
} : {
|
|
151
|
-
...
|
|
152
|
-
...
|
|
153
|
-
borderTop: `2px solid ${
|
|
176
|
+
...S,
|
|
177
|
+
...I ? {
|
|
178
|
+
borderTop: `2px solid ${i.content.brand}`,
|
|
154
179
|
opacity: 0.5
|
|
155
180
|
} : {}
|
|
156
181
|
},
|
|
157
|
-
onClick: (
|
|
158
|
-
|
|
182
|
+
onClick: (r) => {
|
|
183
|
+
r.preventDefault(), T(e);
|
|
159
184
|
},
|
|
160
|
-
onMouseOver:
|
|
185
|
+
onMouseOver: J,
|
|
161
186
|
listItem: { value: e.value, label: e.label },
|
|
162
187
|
subText: e.subText,
|
|
163
|
-
"data-option-index":
|
|
188
|
+
"data-option-index": C,
|
|
164
189
|
role: "option",
|
|
165
|
-
id: `dropdown-option-${
|
|
190
|
+
id: `dropdown-option-${C}`,
|
|
166
191
|
"aria-selected": !!e.selected,
|
|
167
|
-
onDragOver:
|
|
168
|
-
onDrop:
|
|
169
|
-
leadingIcon:
|
|
170
|
-
|
|
171
|
-
|
|
192
|
+
onDragOver: s ? R : void 0,
|
|
193
|
+
onDrop: s ? U : void 0,
|
|
194
|
+
leadingIcon: a && !(y && e.customComponent) ? /* @__PURE__ */ p(F, { children: [
|
|
195
|
+
j && /* @__PURE__ */ t(ie, {}),
|
|
196
|
+
s && /* @__PURE__ */ t(
|
|
197
|
+
x,
|
|
172
198
|
{
|
|
173
|
-
onDragStart:
|
|
174
|
-
onDragEnd:
|
|
199
|
+
onDragStart: f,
|
|
200
|
+
onDragEnd: h
|
|
175
201
|
}
|
|
176
202
|
),
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
|
|
203
|
+
/* @__PURE__ */ t(
|
|
204
|
+
O,
|
|
179
205
|
{
|
|
180
|
-
size:
|
|
206
|
+
size: G,
|
|
181
207
|
isDisabled: e.disabled ?? !1,
|
|
182
|
-
isChecked: !!e.selected
|
|
183
|
-
|
|
184
|
-
|
|
208
|
+
isChecked: !!e.selected || $,
|
|
209
|
+
isPartiallyChecked: $,
|
|
210
|
+
onValueChange: u,
|
|
211
|
+
activeColor: L
|
|
185
212
|
}
|
|
186
213
|
),
|
|
187
|
-
/* @__PURE__ */
|
|
188
|
-
] }) :
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
|
|
214
|
+
/* @__PURE__ */ t(se, { children: e.leadingIcon })
|
|
215
|
+
] }) : s ? /* @__PURE__ */ p(ce, { children: [
|
|
216
|
+
/* @__PURE__ */ t(
|
|
217
|
+
x,
|
|
191
218
|
{
|
|
192
|
-
onDragStart:
|
|
193
|
-
onDragEnd:
|
|
219
|
+
onDragStart: f,
|
|
220
|
+
onDragEnd: h
|
|
194
221
|
}
|
|
195
222
|
),
|
|
196
|
-
e.leadingIcon && /* @__PURE__ */
|
|
197
|
-
] }) : e.leadingIcon ? /* @__PURE__ */
|
|
198
|
-
customComponent:
|
|
199
|
-
|
|
200
|
-
|
|
223
|
+
e.leadingIcon && /* @__PURE__ */ t("div", { children: e.leadingIcon })
|
|
224
|
+
] }) : e.leadingIcon ? /* @__PURE__ */ t(m, { children: e.leadingIcon }) : void 0,
|
|
225
|
+
customComponent: a && y && e.customComponent ? /* @__PURE__ */ p(F, { children: [
|
|
226
|
+
s && /* @__PURE__ */ t(
|
|
227
|
+
x,
|
|
201
228
|
{
|
|
202
|
-
onDragStart:
|
|
203
|
-
onDragEnd:
|
|
229
|
+
onDragStart: f,
|
|
230
|
+
onDragEnd: h
|
|
204
231
|
}
|
|
205
232
|
),
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
|
|
233
|
+
/* @__PURE__ */ t(
|
|
234
|
+
O,
|
|
208
235
|
{
|
|
209
|
-
size:
|
|
236
|
+
size: l === "2.0" ? "SMALL" : "DEFAULT",
|
|
210
237
|
isDisabled: e.disabled ?? !1,
|
|
211
238
|
isChecked: !!e.selected,
|
|
212
|
-
onValueChange:
|
|
213
|
-
activeColor:
|
|
239
|
+
onValueChange: u,
|
|
240
|
+
activeColor: L
|
|
214
241
|
}
|
|
215
242
|
),
|
|
216
243
|
e.customComponent
|
|
217
244
|
] }) : e.customComponent,
|
|
218
|
-
trailingIcon: e.isFreeForm ? /* @__PURE__ */
|
|
219
|
-
|
|
245
|
+
trailingIcon: e.isFreeForm ? /* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(ee, { style: { color: i.content.secondary }, children: "Freeform" }) }) : e.children && o && z ? /* @__PURE__ */ t(
|
|
246
|
+
ae,
|
|
247
|
+
{
|
|
248
|
+
role: "button",
|
|
249
|
+
"aria-expanded": !g,
|
|
250
|
+
"aria-label": `${g ? "Expand" : "Collapse"} ${e.label}`,
|
|
251
|
+
onClick: (r) => {
|
|
252
|
+
r.preventDefault(), r.stopPropagation(), N?.();
|
|
253
|
+
},
|
|
254
|
+
children: g ? /* @__PURE__ */ t(P, { width: 16, height: 16 }) : /* @__PURE__ */ t(X, { width: 16, height: 16 })
|
|
255
|
+
}
|
|
256
|
+
) : e.children && !o ? /* @__PURE__ */ t(Q, { width: 12, height: 12 }) : e.trailingIcon ? /* @__PURE__ */ t(m, { children: e.trailingIcon }) : void 0,
|
|
257
|
+
variant: e.disabled ? "inactive" : e.selected || !a && _ ? "selected" : E ? "focused" : "default"
|
|
220
258
|
}
|
|
221
259
|
)
|
|
222
260
|
}
|
|
@@ -224,6 +262,6 @@ const $ = t(J)`
|
|
|
224
262
|
}
|
|
225
263
|
);
|
|
226
264
|
export {
|
|
227
|
-
|
|
265
|
+
Le as MenuItem
|
|
228
266
|
};
|
|
229
267
|
//# sourceMappingURL=MenuItem.js.map
|