@chayns-components/core 5.2.8-alpha.0 → 5.2.8

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.
Files changed (59) hide show
  1. package/lib/cjs/components/combobox/ComboBox.constants.js +15 -0
  2. package/lib/cjs/components/combobox/ComboBox.constants.js.map +1 -0
  3. package/lib/cjs/components/combobox/ComboBox.js +27 -76
  4. package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
  5. package/lib/cjs/components/combobox/ComboBox.styles.js +16 -11
  6. package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
  7. package/lib/cjs/components/combobox/ComboBox.types.js +24 -0
  8. package/lib/cjs/components/combobox/ComboBox.types.js.map +1 -1
  9. package/lib/cjs/components/combobox/ComboBox.utils.js +88 -0
  10. package/lib/cjs/components/combobox/ComboBox.utils.js.map +1 -0
  11. package/lib/cjs/components/filter/filter-content/FilterContent.constants.js +8 -0
  12. package/lib/cjs/components/filter/filter-content/FilterContent.constants.js.map +1 -0
  13. package/lib/cjs/components/filter/filter-content/FilterContent.js +6 -27
  14. package/lib/cjs/components/filter/filter-content/FilterContent.js.map +1 -1
  15. package/lib/cjs/components/filter/filter-content/FilterContent.styles.js +10 -24
  16. package/lib/cjs/components/filter/filter-content/FilterContent.styles.js.map +1 -1
  17. package/lib/cjs/components/filter/filter-content/FilterContent.types.js +6 -0
  18. package/lib/cjs/components/filter/filter-content/FilterContent.types.js.map +1 -0
  19. package/lib/cjs/components/filter/filter-content/FilterContent.utils.js +17 -0
  20. package/lib/cjs/components/filter/filter-content/FilterContent.utils.js.map +1 -0
  21. package/lib/cjs/components/skeleton/base-skeleton/BaseSkeleton.styles.js +0 -2
  22. package/lib/cjs/components/skeleton/base-skeleton/BaseSkeleton.styles.js.map +1 -1
  23. package/lib/cjs/types/filter.js +24 -0
  24. package/lib/cjs/types/filter.js.map +1 -1
  25. package/lib/esm/components/combobox/ComboBox.constants.js +9 -0
  26. package/lib/esm/components/combobox/ComboBox.constants.js.map +1 -0
  27. package/lib/esm/components/combobox/ComboBox.js +27 -75
  28. package/lib/esm/components/combobox/ComboBox.js.map +1 -1
  29. package/lib/esm/components/combobox/ComboBox.styles.js +16 -11
  30. package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
  31. package/lib/esm/components/combobox/ComboBox.types.js +29 -0
  32. package/lib/esm/components/combobox/ComboBox.types.js.map +1 -1
  33. package/lib/esm/components/combobox/ComboBox.utils.js +81 -0
  34. package/lib/esm/components/combobox/ComboBox.utils.js.map +1 -0
  35. package/lib/esm/components/filter/filter-content/FilterContent.constants.js +2 -0
  36. package/lib/esm/components/filter/filter-content/FilterContent.constants.js.map +1 -0
  37. package/lib/esm/components/filter/filter-content/FilterContent.js +8 -29
  38. package/lib/esm/components/filter/filter-content/FilterContent.js.map +1 -1
  39. package/lib/esm/components/filter/filter-content/FilterContent.styles.js +9 -23
  40. package/lib/esm/components/filter/filter-content/FilterContent.styles.js.map +1 -1
  41. package/lib/esm/components/filter/filter-content/FilterContent.types.js +2 -0
  42. package/lib/esm/components/filter/filter-content/FilterContent.types.js.map +1 -0
  43. package/lib/esm/components/filter/filter-content/FilterContent.utils.js +10 -0
  44. package/lib/esm/components/filter/filter-content/FilterContent.utils.js.map +1 -0
  45. package/lib/esm/components/skeleton/base-skeleton/BaseSkeleton.styles.js +0 -2
  46. package/lib/esm/components/skeleton/base-skeleton/BaseSkeleton.styles.js.map +1 -1
  47. package/lib/esm/types/filter.js +31 -0
  48. package/lib/esm/types/filter.js.map +1 -1
  49. package/lib/types/components/combobox/ComboBox.constants.d.ts +8 -0
  50. package/lib/types/components/combobox/ComboBox.styles.d.ts +4 -8
  51. package/lib/types/components/combobox/ComboBox.types.d.ts +102 -0
  52. package/lib/types/components/combobox/ComboBox.utils.d.ts +23 -0
  53. package/lib/types/components/filter/filter-content/FilterContent.constants.d.ts +1 -0
  54. package/lib/types/components/filter/filter-content/FilterContent.d.ts +1 -9
  55. package/lib/types/components/filter/filter-content/FilterContent.styles.d.ts +3 -14
  56. package/lib/types/components/filter/filter-content/FilterContent.types.d.ts +30 -0
  57. package/lib/types/components/filter/filter-content/FilterContent.utils.d.ts +3 -0
  58. package/lib/types/types/filter.d.ts +51 -0
  59. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.js","names":["useFunctions","useValues","React","forwardRef","Fragment","useCallback","useContext","useEffect","useImperativeHandle","useMemo","useRef","useState","calculateMaxComboBoxItemWidth","useIsTouch","AreaContext","Icon","ComboBoxItem","StyledComboBox","StyledComboBoxBody","StyledComboBoxClearIconWrapper","StyledComboBoxHeader","StyledComboBoxIconWrapper","StyledComboBoxInput","StyledComboBoxPlaceholder","StyledComboBoxPlaceholderImage","StyledComboBoxPlaceholderText","StyledComboBoxPrefix","StyledComboBoxPrefixAndPlaceholderWrapper","StyledComboBoxTopic","DropdownBodyWrapper","DropdownDirection","useElementSize","ComboBoxSize","ComboBox","bodyWidth","direction","RIGHT","isDisabled","lists","maxHeight","onSelect","placeholder","prefix","container","shouldCaptureEvents","selectedItem","onHide","onShow","shouldShowBigImage","shouldShowClearIcon","shouldShowRoundImage","onInputFocus","prefixMinWidth","size","NORMAL","shouldUseFullWidth","onInputChange","shouldUseCurrentItemWidth","onInputBlur","shouldShowTransparentBackground","inputValue","shouldDropDownUseMaxItemWidth","ref","internalSelectedItem","setInternalSelectedItem","isAnimating","setIsAnimating","minWidth","setMinWidth","undefined","bodyMinWidth","setBodyMinWidth","focusedIndex","setFocusedIndex","isInputFocused","styledComboBoxElementRef","contentRef","parentSize","shouldUseParentElement","functions","values","isTouch","areaProvider","width","shouldChangeColor","shouldDisableActions","combinedLists","flatMap","list","length","some","item","value","contentHeight","flatItems","height","reduce","isBigItem","subtext","trim","handleInputFocus","event","current","handleInputBlur","handleOpen","handleClose","handleSetSelectedItem","itemToSelect","onSelectResult","Promise","then","shouldPreventSelection","handleClear","preventDefault","stopPropagation","handleKeyDown","e","key","children","stepDirection","newIndex","attempts","newElement","shouldSkip","id","startsWith","endsWith","prevElement","tabIndex","focusedElement","focus","element","newSelectedItem","find","String","replace","document","addEventListener","removeEventListener","allItems","maxItemWidth","text","parentWidth","parentElement","getBoundingClientRect","paddingWidth","prefixWidth","prefixTextWidth","Math","max","calculatedWidth","tmpMinWidth","tmpBodyMinWidth","internalSelectedItemWidth","itemWidth","placeholderImageUrl","imageUrl","placeholderIcon","icons","placeholderText","shouldShowRoundPlaceholderImage","selectedItemList","handleHeaderClick","hide","show","comboBoxGroups","map","createElement","groupName","isSelected","$minWidth","$shouldUseFullWidth","$shouldUseCurrentItemWidth","$direction","onClick","$isOpen","$isTouch","$size","$shouldShowTransparentBackground","$isDisabled","$shouldChangeColor","$shouldShowBigImage","$prefixMinWidth","$shouldReduceOpacity","src","$shouldShowRoundImage","disabled","onChange","onBlur","onFocus","suffixElement","$shouldShowBorderLeft","anchorElement","onClose","shouldShowDropdown","minBodyWidth","$maxHeight","className","displayName"],"sources":["../../../../src/components/combobox/ComboBox.tsx"],"sourcesContent":["import { useFunctions, useValues } from 'chayns-api';\nimport React, {\n FocusEventHandler,\n forwardRef,\n Fragment,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { calculateMaxComboBoxItemWidth } from '../../utils/calculate';\nimport { useIsTouch } from '../../utils/environment';\nimport { AreaContext } from '../area-provider/AreaContextProvider';\nimport Icon from '../icon/Icon';\nimport ComboBoxItem from './combobox-item/ComboBoxItem';\nimport {\n StyledComboBox,\n StyledComboBoxBody,\n StyledComboBoxClearIconWrapper,\n StyledComboBoxHeader,\n StyledComboBoxIconWrapper,\n StyledComboBoxInput,\n StyledComboBoxPlaceholder,\n StyledComboBoxPlaceholderImage,\n StyledComboBoxPlaceholderText,\n StyledComboBoxPrefix,\n StyledComboBoxPrefixAndPlaceholderWrapper,\n StyledComboBoxTopic,\n} from './ComboBox.styles';\nimport DropdownBodyWrapper from '../dropdown-body-wrapper/DropdownBodyWrapper';\nimport { DropdownDirection } from '../../types/dropdown';\nimport { useElementSize } from '../../hooks/element';\nimport { ComboBoxProps, ComboBoxRef, ComboBoxSize, IComboBoxItem } from './ComboBox.types';\n\nconst ComboBox = forwardRef<ComboBoxRef, ComboBoxProps>(\n (\n {\n bodyWidth,\n direction = DropdownDirection.RIGHT,\n isDisabled = false,\n lists,\n maxHeight = 280,\n onSelect,\n placeholder,\n prefix,\n container,\n shouldCaptureEvents,\n selectedItem,\n onHide,\n onShow,\n shouldShowBigImage,\n shouldShowClearIcon,\n shouldShowRoundImage,\n onInputFocus,\n prefixMinWidth,\n size = ComboBoxSize.NORMAL,\n shouldUseFullWidth = false,\n onInputChange,\n shouldUseCurrentItemWidth = false,\n onInputBlur,\n shouldShowTransparentBackground = false,\n inputValue,\n shouldDropDownUseMaxItemWidth = false,\n },\n ref,\n ) => {\n const [internalSelectedItem, setInternalSelectedItem] = useState<IComboBoxItem>();\n const [isAnimating, setIsAnimating] = useState(false);\n const [minWidth, setMinWidth] = useState<number | undefined>(undefined);\n const [bodyMinWidth, setBodyMinWidth] = useState(0);\n const [focusedIndex, setFocusedIndex] = useState<number | null>(null);\n\n const isInputFocused = useRef(false);\n\n const styledComboBoxElementRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const parentSize = useElementSize(styledComboBoxElementRef, {\n shouldUseParentElement: true,\n });\n\n const functions = useFunctions();\n const values = useValues();\n\n const isTouch = useIsTouch();\n\n const areaProvider = useContext(AreaContext);\n\n useEffect(() => {\n if (shouldUseFullWidth && parentSize) {\n setMinWidth(parentSize.width);\n }\n }, [parentSize, shouldUseFullWidth]);\n\n const shouldChangeColor = useMemo(\n () => areaProvider.shouldChangeColor ?? false,\n [areaProvider.shouldChangeColor],\n );\n\n const shouldDisableActions = useMemo(() => {\n if (!selectedItem) {\n return false;\n }\n\n const combinedLists = lists.flatMap((list) => list.list);\n\n return (\n combinedLists.length === 1 &&\n combinedLists.some((item) => item.value === selectedItem.value)\n );\n }, [lists, selectedItem]);\n\n const contentHeight = useMemo(() => {\n const flatItems = lists.flatMap((list) => list.list);\n\n let height = flatItems.reduce((value, item) => {\n const isBigItem =\n shouldShowBigImage ||\n (typeof item.subtext === 'string' && item.subtext.trim() !== '');\n\n return value + (isBigItem ? 56 : 38);\n }, 0);\n\n if (lists.length > 1) {\n height += lists.length * 38;\n }\n\n if (maxHeight < height) {\n height = maxHeight;\n }\n\n return height;\n }, [lists, maxHeight, shouldShowBigImage]);\n\n const handleInputFocus: FocusEventHandler<HTMLInputElement> = useCallback(\n (event) => {\n isInputFocused.current = true;\n onInputFocus?.(event);\n },\n [onInputFocus],\n );\n\n const handleInputBlur: FocusEventHandler<HTMLInputElement> = useCallback(\n (event) => {\n isInputFocused.current = false;\n onInputBlur?.(event);\n },\n [onInputBlur],\n );\n\n const handleOpen = useCallback(() => {\n if (typeof onShow === 'function') {\n onShow();\n }\n\n setIsAnimating(true);\n }, [onShow]);\n\n const handleClose = useCallback(() => {\n if (typeof onHide === 'function') {\n onHide();\n }\n\n setIsAnimating(false);\n }, [onHide]);\n\n /**\n * This function sets the selected item\n */\n const handleSetSelectedItem = useCallback(\n (itemToSelect?: IComboBoxItem) => {\n if (typeof onSelect === 'function') {\n const onSelectResult = onSelect(itemToSelect);\n\n if (onSelectResult === false) {\n return;\n }\n\n if (onSelectResult instanceof Promise) {\n void onSelectResult.then((shouldPreventSelection) => {\n if (shouldPreventSelection) return;\n\n setInternalSelectedItem(itemToSelect);\n handleClose();\n });\n\n return;\n }\n }\n\n setInternalSelectedItem(itemToSelect);\n handleClose();\n },\n [handleClose, onSelect],\n );\n\n const handleClear = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n handleSetSelectedItem(undefined);\n },\n [handleSetSelectedItem],\n );\n\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (!isAnimating) return;\n\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n\n const children = contentRef.current?.children;\n\n if (!children || children.length === 0) return;\n\n const stepDirection = e.key === 'ArrowUp' ? -1 : 1;\n\n let newIndex = focusedIndex ?? -1;\n\n let attempts = 0;\n\n do {\n newIndex = (newIndex + stepDirection + children.length) % children.length;\n\n const newElement = children[newIndex] as HTMLDivElement;\n\n let shouldSkip = false;\n\n if (\n newElement.id.startsWith('combobox-group--') ||\n newElement.id.endsWith('--disabled-item')\n ) {\n shouldSkip = true;\n }\n\n if (!shouldSkip) break;\n\n attempts++;\n } while (attempts < children.length);\n\n if (focusedIndex !== null) {\n const prevElement = children[focusedIndex] as HTMLDivElement;\n\n prevElement.tabIndex = -1;\n }\n\n setFocusedIndex(newIndex);\n\n const focusedElement = children[newIndex] as HTMLDivElement;\n\n focusedElement.tabIndex = 0;\n\n focusedElement.focus();\n } else if (e.key === 'Enter' && focusedIndex !== null) {\n const element = contentRef.current?.children[focusedIndex];\n\n if (!element) return;\n\n const { id } = element;\n\n let newSelectedItem: IComboBoxItem | undefined;\n\n lists.some((list) => {\n newSelectedItem = list.list.find(\n ({ value }) => String(value) === id.replace('combobox-item__', ''),\n );\n\n return !!newSelectedItem;\n });\n\n if (newSelectedItem) {\n handleSetSelectedItem(newSelectedItem);\n }\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [focusedIndex, handleSetSelectedItem, isAnimating, lists]);\n\n /**\n * This function calculates the greatest width\n */\n useEffect(() => {\n const allItems = lists.flatMap((list) => list.list);\n\n let maxItemWidth = calculateMaxComboBoxItemWidth({\n list: [\n ...allItems,\n { text: placeholder, value: 'placeholder' },\n ...(selectedItem ? [selectedItem] : []),\n ],\n functions,\n shouldShowBigImage,\n values,\n });\n\n if (shouldDropDownUseMaxItemWidth) {\n maxItemWidth += 20 + 2 + 1; // 20px padding (left and right), 2px border, 1px puffer for rounding errors\n\n setBodyMinWidth(maxItemWidth);\n setMinWidth(maxItemWidth);\n\n return;\n }\n\n const parentWidth =\n styledComboBoxElementRef.current?.parentElement?.getBoundingClientRect().width ?? 0;\n\n const paddingWidth = 20 + 2 + 40 + (shouldShowClearIcon ? 40 : 0) + 1; // padding + border + arrow icon + optional clear icon + 1px puffer for rounding errors\n\n let prefixWidth = 0;\n\n if (prefix) {\n const prefixTextWidth = calculateMaxComboBoxItemWidth({\n list: [{ text: prefix, value: 'prefix' }],\n functions,\n values,\n });\n\n prefixWidth = Math.max(prefixTextWidth + 5, 32);\n }\n\n const calculatedWidth = maxItemWidth + paddingWidth + prefixWidth;\n\n let tmpMinWidth = calculatedWidth;\n let tmpBodyMinWidth = calculatedWidth;\n\n // Full width settings\n if (shouldUseFullWidth) {\n tmpMinWidth = parentWidth;\n\n tmpBodyMinWidth =\n parentWidth < calculatedWidth - 20 ? calculatedWidth - 20 : parentWidth;\n }\n // Current item width settings\n else if (shouldUseCurrentItemWidth && internalSelectedItem) {\n const internalSelectedItemWidth = calculateMaxComboBoxItemWidth({\n list: [internalSelectedItem],\n functions,\n shouldShowBigImage,\n values,\n });\n\n const itemWidth = internalSelectedItemWidth + paddingWidth + prefixWidth;\n\n tmpMinWidth = itemWidth;\n\n tmpBodyMinWidth =\n itemWidth < calculatedWidth - 20 ? calculatedWidth - 20 : itemWidth;\n }\n\n if (tmpMinWidth > parentWidth) {\n tmpMinWidth = parentWidth;\n }\n\n if (tmpBodyMinWidth > parentWidth) {\n tmpBodyMinWidth = parentWidth;\n }\n\n setMinWidth(tmpMinWidth);\n setBodyMinWidth(shouldUseCurrentItemWidth ? tmpMinWidth : tmpBodyMinWidth);\n }, [\n functions,\n internalSelectedItem,\n lists,\n placeholder,\n prefix,\n selectedItem,\n shouldDropDownUseMaxItemWidth,\n shouldShowBigImage,\n shouldShowClearIcon,\n shouldUseCurrentItemWidth,\n shouldUseFullWidth,\n values,\n ]);\n\n /**\n * This function sets the external selected item\n */\n useEffect(() => {\n setIsAnimating(false);\n setInternalSelectedItem(selectedItem);\n }, [selectedItem]);\n\n const placeholderImageUrl = useMemo(() => {\n if (selectedItem) {\n return selectedItem.imageUrl;\n }\n\n if (internalSelectedItem) {\n return internalSelectedItem.imageUrl;\n }\n\n return undefined;\n }, [internalSelectedItem, selectedItem]);\n\n const placeholderIcon = useMemo(() => {\n if (selectedItem) {\n return selectedItem.icons;\n }\n\n if (internalSelectedItem) {\n return internalSelectedItem.icons;\n }\n\n return undefined;\n }, [internalSelectedItem, selectedItem]);\n\n /**\n * This function resets the placeholder\n */\n const placeholderText = useMemo(() => {\n let text = placeholder;\n\n if (selectedItem) {\n text = selectedItem.text;\n } else if (internalSelectedItem) {\n text = internalSelectedItem.text;\n }\n\n return text;\n }, [internalSelectedItem, placeholder, selectedItem]);\n\n const shouldShowRoundPlaceholderImage = useMemo(() => {\n const selectedItemList = lists.find((list) =>\n list.list.some(\n ({ value }) => value === (selectedItem?.value ?? internalSelectedItem?.value),\n ),\n );\n\n return selectedItemList?.shouldShowRoundImage ?? shouldShowRoundImage;\n }, [internalSelectedItem?.value, lists, selectedItem?.value, shouldShowRoundImage]);\n\n /**\n * This function opens the content of the combobox\n */\n const handleHeaderClick = useCallback(() => {\n if (!isDisabled && !isInputFocused.current) {\n if (isAnimating) {\n handleClose();\n } else {\n handleOpen();\n }\n }\n }, [handleClose, handleOpen, isAnimating, isDisabled]);\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleClose,\n show: handleOpen,\n }),\n [handleClose, handleOpen],\n );\n\n const comboBoxGroups = useMemo(\n () =>\n lists.map((list) => (\n <Fragment key={list.groupName ?? 'default-group'}>\n {list.groupName && lists.length > 1 && (\n <StyledComboBoxTopic id={`combobox-group--${list.groupName}`}>\n {list.groupName}\n </StyledComboBoxTopic>\n )}\n {list.list.map((item) => (\n <ComboBoxItem\n key={`item-${item.text}`}\n item={item}\n isSelected={\n selectedItem ? item.value === selectedItem.value : false\n }\n onSelect={handleSetSelectedItem}\n shouldShowBigImage={shouldShowBigImage}\n shouldShowRoundImage={\n list.shouldShowRoundImage ?? shouldShowRoundImage\n }\n />\n ))}\n </Fragment>\n )),\n [handleSetSelectedItem, lists, selectedItem, shouldShowBigImage, shouldShowRoundImage],\n );\n\n return useMemo(\n () => (\n <StyledComboBox\n ref={styledComboBoxElementRef}\n $minWidth={minWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n $shouldUseCurrentItemWidth={shouldUseCurrentItemWidth}\n >\n <StyledComboBoxHeader\n $direction={direction}\n onClick={handleHeaderClick}\n $isOpen={isAnimating}\n $isTouch={isTouch}\n $size={size}\n $shouldShowTransparentBackground={shouldShowTransparentBackground}\n $isDisabled={isDisabled}\n $shouldChangeColor={shouldChangeColor}\n $shouldShowBigImage={shouldShowBigImage}\n >\n <StyledComboBoxPrefixAndPlaceholderWrapper>\n {prefix && (\n <StyledComboBoxPrefix $prefixMinWidth={prefixMinWidth}>\n {prefix}\n </StyledComboBoxPrefix>\n )}\n <StyledComboBoxPlaceholder\n $shouldReduceOpacity={!selectedItem && !internalSelectedItem}\n >\n {placeholderImageUrl && (\n <StyledComboBoxPlaceholderImage\n src={placeholderImageUrl}\n $shouldShowBigImage={shouldShowBigImage}\n $shouldShowRoundImage={shouldShowRoundPlaceholderImage}\n />\n )}\n {placeholderIcon && <Icon icons={placeholderIcon} />}\n {typeof inputValue === 'string' ? (\n <StyledComboBoxInput\n disabled={isDisabled}\n value={inputValue}\n onChange={onInputChange}\n onBlur={handleInputBlur}\n onFocus={handleInputFocus}\n placeholder={placeholderText}\n />\n ) : (\n <StyledComboBoxPlaceholderText>\n {placeholderText}\n </StyledComboBoxPlaceholderText>\n )}\n {internalSelectedItem &&\n internalSelectedItem.suffixElement &&\n internalSelectedItem.suffixElement}\n </StyledComboBoxPlaceholder>\n </StyledComboBoxPrefixAndPlaceholderWrapper>\n {shouldShowClearIcon && internalSelectedItem && (\n <StyledComboBoxClearIconWrapper\n $isDisabled={isDisabled}\n onClick={handleClear}\n >\n <Icon icons={['fa fa-times']} />\n </StyledComboBoxClearIconWrapper>\n )}\n {!shouldDisableActions && (\n <StyledComboBoxIconWrapper\n $isDisabled={isDisabled}\n $size={size}\n $shouldShowBorderLeft={\n shouldShowClearIcon === true &&\n internalSelectedItem !== undefined\n }\n >\n <Icon icons={['fa fa-chevron-down']} isDisabled={isDisabled} />\n </StyledComboBoxIconWrapper>\n )}\n </StyledComboBoxHeader>\n {styledComboBoxElementRef.current && (\n <DropdownBodyWrapper\n anchorElement={styledComboBoxElementRef.current}\n bodyWidth={bodyWidth}\n contentHeight={contentHeight}\n shouldCaptureEvents={shouldCaptureEvents}\n onClose={handleClose}\n direction={direction}\n container={container}\n shouldShowDropdown={isAnimating}\n minBodyWidth={bodyWidth ?? bodyMinWidth}\n maxHeight={maxHeight}\n >\n <StyledComboBoxBody\n $shouldUseCurrentItemWidth={shouldUseCurrentItemWidth}\n $maxHeight={maxHeight}\n $minWidth={bodyWidth ?? bodyMinWidth}\n className=\"chayns-scrollbar\"\n ref={contentRef}\n tabIndex={0}\n >\n {comboBoxGroups}\n </StyledComboBoxBody>\n </DropdownBodyWrapper>\n )}\n </StyledComboBox>\n ),\n [\n minWidth,\n shouldUseFullWidth,\n shouldUseCurrentItemWidth,\n direction,\n handleHeaderClick,\n isAnimating,\n isTouch,\n size,\n shouldShowTransparentBackground,\n isDisabled,\n shouldChangeColor,\n shouldShowBigImage,\n prefix,\n prefixMinWidth,\n selectedItem,\n internalSelectedItem,\n placeholderImageUrl,\n shouldShowRoundPlaceholderImage,\n placeholderIcon,\n inputValue,\n onInputChange,\n handleInputBlur,\n handleInputFocus,\n placeholderText,\n shouldShowClearIcon,\n handleClear,\n shouldDisableActions,\n bodyWidth,\n contentHeight,\n shouldCaptureEvents,\n handleClose,\n container,\n bodyMinWidth,\n maxHeight,\n comboBoxGroups,\n ],\n );\n },\n);\n\nComboBox.displayName = 'ComboBox';\n\nexport default ComboBox;\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,SAAS,QAAQ,YAAY;AACpD,OAAOC,KAAK,IAER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,YAAa;IACxC/B,SAAS,EAAEA;EAAU,gBAErBrC,KAAA,CAAAqK,aAAA,CAACrJ,kBAAkB;IACf0J,0BAA0B,EAAEnH,yBAA0B;IACtD2I,UAAU,EAAE7J,SAAU;IACtBmI,SAAS,EAAExI,SAAS,IAAIoC,YAAa;IACrC+H,SAAS,EAAC,kBAAkB;IAC5BvI,GAAG,EAAEc,UAAW;IAChBoD,QAAQ,EAAE;EAAE,GAEXqC,cACe,CACH,CAEb,CACnB,EACD,CACIlG,QAAQ,EACRZ,kBAAkB,EAClBE,yBAAyB,EACzBtB,SAAS,EACT+H,iBAAiB,EACjBjG,WAAW,EACXgB,OAAO,EACP5B,IAAI,EACJM,+BAA+B,EAC/BtB,UAAU,EACV+C,iBAAiB,EACjBpC,kBAAkB,EAClBN,MAAM,EACNU,cAAc,EACdP,YAAY,EACZkB,oBAAoB,EACpB4F,mBAAmB,EACnBK,+BAA+B,EAC/BH,eAAe,EACfjG,UAAU,EACVJ,aAAa,EACb+C,eAAe,EACfH,gBAAgB,EAChB2D,eAAe,EACf9G,mBAAmB,EACnB+D,WAAW,EACX3B,oBAAoB,EACpBnD,SAAS,EACT2D,aAAa,EACbjD,mBAAmB,EACnB6D,WAAW,EACX9D,SAAS,EACT2B,YAAY,EACZ/B,SAAS,EACT8H,cAAc,CAEtB,CAAC;AACL,CACJ,CAAC;AAEDpI,QAAQ,CAACqK,WAAW,GAAG,UAAU;AAEjC,eAAerK,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"ComboBox.js","names":["useFunctions","useValues","React","forwardRef","Fragment","useCallback","useContext","useEffect","useImperativeHandle","useMemo","useRef","useState","useIsTouch","AreaContext","Icon","ComboBoxItem","StyledComboBox","StyledComboBoxBody","StyledComboBoxClearIconWrapper","StyledComboBoxHeader","StyledComboBoxIconWrapper","StyledComboBoxInput","StyledComboBoxPlaceholder","StyledComboBoxPlaceholderImage","StyledComboBoxPlaceholderText","StyledComboBoxPrefix","StyledComboBoxPrefixAndPlaceholderWrapper","StyledComboBoxTopic","DropdownBodyWrapper","DropdownDirection","useElementSize","ComboBoxSize","getComboBoxWidthResult","ComboBox","bodyWidth","direction","RIGHT","isDisabled","lists","maxHeight","onSelect","placeholder","prefix","container","shouldCaptureEvents","selectedItem","onHide","onShow","shouldShowBigImage","shouldShowClearIcon","shouldShowRoundImage","onInputFocus","prefixMinWidth","size","NORMAL","shouldUseFullWidth","onInputChange","shouldUseCurrentItemWidth","onInputBlur","shouldShowTransparentBackground","inputValue","shouldDropDownUseMaxItemWidth","ref","internalSelectedItem","setInternalSelectedItem","isAnimating","setIsAnimating","minWidth","setMinWidth","undefined","bodyMinWidth","setBodyMinWidth","focusedIndex","setFocusedIndex","isInputFocused","styledComboBoxElementRef","contentRef","parentSize","shouldUseParentElement","functions","values","isTouch","areaProvider","calculatedMinWidth","calculatedBodyMinWidth","parentWidth","width","shouldChangeColor","shouldDisableActions","combinedLists","flatMap","list","length","some","item","value","contentHeight","flatItems","height","reduce","isBigItem","subtext","trim","handleInputFocus","event","current","handleInputBlur","handleOpen","handleClose","handleSetSelectedItem","itemToSelect","onSelectResult","Promise","then","shouldPreventSelection","handleClear","preventDefault","stopPropagation","handleKeyDown","e","key","children","stepDirection","newIndex","attempts","newElement","shouldSkip","id","startsWith","endsWith","prevElement","tabIndex","focusedElement","focus","element","newSelectedItem","find","String","replace","document","addEventListener","removeEventListener","placeholderImageUrl","imageUrl","placeholderIcon","icons","placeholderText","text","shouldShowRoundPlaceholderImage","selectedItemList","handleHeaderClick","hide","show","comboBoxGroups","map","createElement","groupName","isSelected","$minWidth","$shouldUseFullWidth","$direction","onClick","$isOpen","$isTouch","$size","$shouldShowTransparentBackground","$isDisabled","$shouldChangeColor","$shouldShowBigImage","$prefixMinWidth","$shouldReduceOpacity","src","$shouldShowRoundImage","disabled","onChange","onBlur","onFocus","suffixElement","$shouldShowBorderLeft","anchorElement","onClose","shouldShowDropdown","minBodyWidth","$maxHeight","className","displayName"],"sources":["../../../../src/components/combobox/ComboBox.tsx"],"sourcesContent":["import { useFunctions, useValues } from 'chayns-api';\nimport React, {\n FocusEventHandler,\n forwardRef,\n Fragment,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useIsTouch } from '../../utils/environment';\nimport { AreaContext } from '../area-provider/AreaContextProvider';\nimport Icon from '../icon/Icon';\nimport ComboBoxItem from './combobox-item/ComboBoxItem';\nimport {\n StyledComboBox,\n StyledComboBoxBody,\n StyledComboBoxClearIconWrapper,\n StyledComboBoxHeader,\n StyledComboBoxIconWrapper,\n StyledComboBoxInput,\n StyledComboBoxPlaceholder,\n StyledComboBoxPlaceholderImage,\n StyledComboBoxPlaceholderText,\n StyledComboBoxPrefix,\n StyledComboBoxPrefixAndPlaceholderWrapper,\n StyledComboBoxTopic,\n} from './ComboBox.styles';\nimport DropdownBodyWrapper from '../dropdown-body-wrapper/DropdownBodyWrapper';\nimport { DropdownDirection } from '../../types/dropdown';\nimport { useElementSize } from '../../hooks/element';\nimport { ComboBoxProps, ComboBoxRef, ComboBoxSize, IComboBoxItem } from './ComboBox.types';\nimport { getComboBoxWidthResult } from './ComboBox.utils';\n\nconst ComboBox = forwardRef<ComboBoxRef, ComboBoxProps>(\n (\n {\n bodyWidth,\n direction = DropdownDirection.RIGHT,\n isDisabled = false,\n lists,\n maxHeight = 280,\n onSelect,\n placeholder,\n prefix,\n container,\n shouldCaptureEvents,\n selectedItem,\n onHide,\n onShow,\n shouldShowBigImage,\n shouldShowClearIcon,\n shouldShowRoundImage,\n onInputFocus,\n prefixMinWidth,\n size = ComboBoxSize.NORMAL,\n shouldUseFullWidth = false,\n onInputChange,\n shouldUseCurrentItemWidth = false,\n onInputBlur,\n shouldShowTransparentBackground = false,\n inputValue,\n shouldDropDownUseMaxItemWidth = false,\n },\n ref,\n ) => {\n const [internalSelectedItem, setInternalSelectedItem] = useState<IComboBoxItem>();\n const [isAnimating, setIsAnimating] = useState(false);\n const [minWidth, setMinWidth] = useState<number | undefined>(undefined);\n const [bodyMinWidth, setBodyMinWidth] = useState(0);\n const [focusedIndex, setFocusedIndex] = useState<number | null>(null);\n\n const isInputFocused = useRef(false);\n const styledComboBoxElementRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const parentSize = useElementSize(styledComboBoxElementRef, {\n shouldUseParentElement: true,\n });\n\n const functions = useFunctions();\n const values = useValues();\n const isTouch = useIsTouch();\n const areaProvider = useContext(AreaContext);\n\n useEffect(() => {\n if (!parentSize) {\n return;\n }\n\n const { minWidth: calculatedMinWidth, bodyMinWidth: calculatedBodyMinWidth } =\n getComboBoxWidthResult({\n functions,\n internalSelectedItem,\n lists,\n parentWidth: parentSize.width,\n placeholder,\n prefix,\n prefixMinWidth,\n selectedItem,\n shouldDropDownUseMaxItemWidth,\n shouldShowBigImage,\n shouldShowClearIcon,\n shouldUseCurrentItemWidth,\n shouldUseFullWidth,\n values,\n });\n\n setMinWidth(calculatedMinWidth);\n setBodyMinWidth(calculatedBodyMinWidth);\n }, [\n functions,\n internalSelectedItem,\n lists,\n parentSize,\n placeholder,\n prefix,\n prefixMinWidth,\n selectedItem,\n shouldDropDownUseMaxItemWidth,\n shouldShowBigImage,\n shouldShowClearIcon,\n shouldUseCurrentItemWidth,\n shouldUseFullWidth,\n values,\n ]);\n\n const shouldChangeColor = useMemo(\n () => areaProvider.shouldChangeColor ?? false,\n [areaProvider.shouldChangeColor],\n );\n\n const shouldDisableActions = useMemo(() => {\n if (!selectedItem) {\n return false;\n }\n\n const combinedLists = lists.flatMap((list) => list.list);\n\n return (\n combinedLists.length === 1 &&\n combinedLists.some((item) => item.value === selectedItem.value)\n );\n }, [lists, selectedItem]);\n\n const contentHeight = useMemo(() => {\n const flatItems = lists.flatMap((list) => list.list);\n\n let height = flatItems.reduce((value, item) => {\n const isBigItem =\n shouldShowBigImage ||\n (typeof item.subtext === 'string' && item.subtext.trim() !== '');\n\n return value + (isBigItem ? 56 : 38);\n }, 0);\n\n if (lists.length > 1) {\n height += lists.length * 38;\n }\n\n if (maxHeight < height) {\n height = maxHeight;\n }\n\n return height;\n }, [lists, maxHeight, shouldShowBigImage]);\n\n const handleInputFocus: FocusEventHandler<HTMLInputElement> = useCallback(\n (event) => {\n isInputFocused.current = true;\n onInputFocus?.(event);\n },\n [onInputFocus],\n );\n\n const handleInputBlur: FocusEventHandler<HTMLInputElement> = useCallback(\n (event) => {\n isInputFocused.current = false;\n onInputBlur?.(event);\n },\n [onInputBlur],\n );\n\n const handleOpen = useCallback(() => {\n if (typeof onShow === 'function') {\n onShow();\n }\n\n setIsAnimating(true);\n }, [onShow]);\n\n const handleClose = useCallback(() => {\n if (typeof onHide === 'function') {\n onHide();\n }\n\n setIsAnimating(false);\n }, [onHide]);\n\n /**\n * This function sets the selected item\n */\n const handleSetSelectedItem = useCallback(\n (itemToSelect?: IComboBoxItem) => {\n if (typeof onSelect === 'function') {\n const onSelectResult = onSelect(itemToSelect);\n\n if (onSelectResult === false) {\n return;\n }\n\n if (onSelectResult instanceof Promise) {\n void onSelectResult.then((shouldPreventSelection) => {\n if (shouldPreventSelection) return;\n\n setInternalSelectedItem(itemToSelect);\n handleClose();\n });\n\n return;\n }\n }\n\n setInternalSelectedItem(itemToSelect);\n handleClose();\n },\n [handleClose, onSelect],\n );\n\n const handleClear = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n handleSetSelectedItem(undefined);\n },\n [handleSetSelectedItem],\n );\n\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (!isAnimating) return;\n\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n\n const children = contentRef.current?.children;\n\n if (!children || children.length === 0) return;\n\n const stepDirection = e.key === 'ArrowUp' ? -1 : 1;\n\n let newIndex = focusedIndex ?? -1;\n\n let attempts = 0;\n\n do {\n newIndex = (newIndex + stepDirection + children.length) % children.length;\n\n const newElement = children[newIndex] as HTMLDivElement;\n\n let shouldSkip = false;\n\n if (\n newElement.id.startsWith('combobox-group--') ||\n newElement.id.endsWith('--disabled-item')\n ) {\n shouldSkip = true;\n }\n\n if (!shouldSkip) break;\n\n attempts++;\n } while (attempts < children.length);\n\n if (focusedIndex !== null) {\n const prevElement = children[focusedIndex] as HTMLDivElement;\n\n prevElement.tabIndex = -1;\n }\n\n setFocusedIndex(newIndex);\n\n const focusedElement = children[newIndex] as HTMLDivElement;\n\n focusedElement.tabIndex = 0;\n focusedElement.focus();\n } else if (e.key === 'Enter' && focusedIndex !== null) {\n const element = contentRef.current?.children[focusedIndex];\n\n if (!element) return;\n\n const { id } = element;\n\n let newSelectedItem: IComboBoxItem | undefined;\n\n lists.some((list) => {\n newSelectedItem = list.list.find(\n ({ value }) => String(value) === id.replace('combobox-item__', ''),\n );\n\n return !!newSelectedItem;\n });\n\n if (newSelectedItem) {\n handleSetSelectedItem(newSelectedItem);\n }\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [focusedIndex, handleSetSelectedItem, isAnimating, lists]);\n\n /**\n * This function sets the external selected item\n */\n useEffect(() => {\n setIsAnimating(false);\n setInternalSelectedItem(selectedItem);\n }, [selectedItem]);\n\n const placeholderImageUrl = useMemo(() => {\n if (selectedItem) {\n return selectedItem.imageUrl;\n }\n\n if (internalSelectedItem) {\n return internalSelectedItem.imageUrl;\n }\n\n return undefined;\n }, [internalSelectedItem, selectedItem]);\n\n const placeholderIcon = useMemo(() => {\n if (selectedItem) {\n return selectedItem.icons;\n }\n\n if (internalSelectedItem) {\n return internalSelectedItem.icons;\n }\n\n return undefined;\n }, [internalSelectedItem, selectedItem]);\n\n /**\n * This function resets the placeholder\n */\n const placeholderText = useMemo(() => {\n let text = placeholder;\n\n if (selectedItem) {\n text = selectedItem.text;\n } else if (internalSelectedItem) {\n text = internalSelectedItem.text;\n }\n\n return text;\n }, [internalSelectedItem, placeholder, selectedItem]);\n\n const shouldShowRoundPlaceholderImage = useMemo(() => {\n const selectedItemList = lists.find((list) =>\n list.list.some(\n ({ value }) => value === (selectedItem?.value ?? internalSelectedItem?.value),\n ),\n );\n\n return selectedItemList?.shouldShowRoundImage ?? shouldShowRoundImage;\n }, [internalSelectedItem?.value, lists, selectedItem?.value, shouldShowRoundImage]);\n\n /**\n * This function opens the content of the combobox\n */\n const handleHeaderClick = useCallback(() => {\n if (!isDisabled && !isInputFocused.current) {\n if (isAnimating) {\n handleClose();\n } else {\n handleOpen();\n }\n }\n }, [handleClose, handleOpen, isAnimating, isDisabled]);\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleClose,\n show: handleOpen,\n }),\n [handleClose, handleOpen],\n );\n\n const comboBoxGroups = useMemo(\n () =>\n lists.map((list) => (\n <Fragment key={list.groupName ?? 'default-group'}>\n {list.groupName && lists.length > 1 && (\n <StyledComboBoxTopic id={`combobox-group--${list.groupName}`}>\n {list.groupName}\n </StyledComboBoxTopic>\n )}\n {list.list.map((item) => (\n <ComboBoxItem\n key={`item-${item.text}`}\n item={item}\n isSelected={\n selectedItem ? item.value === selectedItem.value : false\n }\n onSelect={handleSetSelectedItem}\n shouldShowBigImage={shouldShowBigImage}\n shouldShowRoundImage={\n list.shouldShowRoundImage ?? shouldShowRoundImage\n }\n />\n ))}\n </Fragment>\n )),\n [handleSetSelectedItem, lists, selectedItem, shouldShowBigImage, shouldShowRoundImage],\n );\n\n return useMemo(\n () => (\n <StyledComboBox\n ref={styledComboBoxElementRef}\n $minWidth={minWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n <StyledComboBoxHeader\n $direction={direction}\n onClick={handleHeaderClick}\n $isOpen={isAnimating}\n $isTouch={isTouch}\n $size={size}\n $shouldShowTransparentBackground={shouldShowTransparentBackground}\n $isDisabled={isDisabled}\n $shouldChangeColor={shouldChangeColor}\n $shouldShowBigImage={shouldShowBigImage}\n >\n <StyledComboBoxPrefixAndPlaceholderWrapper>\n {prefix && (\n <StyledComboBoxPrefix $prefixMinWidth={prefixMinWidth}>\n {prefix}\n </StyledComboBoxPrefix>\n )}\n <StyledComboBoxPlaceholder\n $shouldReduceOpacity={!selectedItem && !internalSelectedItem}\n >\n {placeholderImageUrl && (\n <StyledComboBoxPlaceholderImage\n src={placeholderImageUrl}\n $shouldShowBigImage={shouldShowBigImage}\n $shouldShowRoundImage={shouldShowRoundPlaceholderImage}\n />\n )}\n {placeholderIcon && <Icon icons={placeholderIcon} />}\n {typeof inputValue === 'string' ? (\n <StyledComboBoxInput\n disabled={isDisabled}\n value={inputValue}\n onChange={onInputChange}\n onBlur={handleInputBlur}\n onFocus={handleInputFocus}\n placeholder={placeholderText}\n />\n ) : (\n <StyledComboBoxPlaceholderText>\n {placeholderText}\n </StyledComboBoxPlaceholderText>\n )}\n {internalSelectedItem &&\n internalSelectedItem.suffixElement &&\n internalSelectedItem.suffixElement}\n </StyledComboBoxPlaceholder>\n </StyledComboBoxPrefixAndPlaceholderWrapper>\n {shouldShowClearIcon && internalSelectedItem && (\n <StyledComboBoxClearIconWrapper\n $isDisabled={isDisabled}\n onClick={handleClear}\n >\n <Icon icons={['fa fa-times']} />\n </StyledComboBoxClearIconWrapper>\n )}\n {!shouldDisableActions && (\n <StyledComboBoxIconWrapper\n $isDisabled={isDisabled}\n $size={size}\n $shouldShowBorderLeft={\n shouldShowClearIcon === true &&\n internalSelectedItem !== undefined\n }\n >\n <Icon icons={['fa fa-chevron-down']} isDisabled={isDisabled} />\n </StyledComboBoxIconWrapper>\n )}\n </StyledComboBoxHeader>\n {styledComboBoxElementRef.current && (\n <DropdownBodyWrapper\n anchorElement={styledComboBoxElementRef.current}\n bodyWidth={bodyWidth}\n contentHeight={contentHeight}\n shouldCaptureEvents={shouldCaptureEvents}\n onClose={handleClose}\n direction={direction}\n container={container}\n shouldShowDropdown={isAnimating}\n minBodyWidth={bodyWidth ?? bodyMinWidth}\n maxHeight={maxHeight}\n >\n <StyledComboBoxBody\n $maxHeight={maxHeight}\n $minWidth={bodyWidth ?? bodyMinWidth}\n className=\"chayns-scrollbar\"\n ref={contentRef}\n tabIndex={0}\n >\n {comboBoxGroups}\n </StyledComboBoxBody>\n </DropdownBodyWrapper>\n )}\n </StyledComboBox>\n ),\n [\n bodyMinWidth,\n bodyWidth,\n comboBoxGroups,\n container,\n contentHeight,\n direction,\n handleClear,\n handleClose,\n handleHeaderClick,\n handleInputBlur,\n handleInputFocus,\n inputValue,\n internalSelectedItem,\n isAnimating,\n isDisabled,\n isTouch,\n maxHeight,\n minWidth,\n onInputChange,\n placeholderIcon,\n placeholderImageUrl,\n placeholderText,\n prefix,\n prefixMinWidth,\n selectedItem,\n shouldChangeColor,\n shouldDisableActions,\n shouldCaptureEvents,\n shouldShowBigImage,\n shouldShowClearIcon,\n shouldShowRoundPlaceholderImage,\n shouldShowTransparentBackground,\n shouldUseFullWidth,\n size,\n ],\n );\n },\n);\n\nComboBox.displayName = 'ComboBox';\n\nexport default ComboBox;\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,SAAS,QAAQ,YAAY;AACpD,OAAOC,KAAK,IAERC,UAAU,EACVC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,WAAW,QAAQ,sCAAsC;AAClE,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,YAAY,MAAM,8BAA8B;AACvD,SACIC,cAAc,EACdC,kBAAkB,EAClBC,8BAA8B,EAC9BC,oBAAoB,EACpBC,yBAAyB,EACzBC,mBAAmB,EACnBC,yBAAyB,EACzBC,8BAA8B,EAC9BC,6BAA6B,EAC7BC,oBAAoB,EACpBC,yCAAyC,EACzCC,mBAAmB,QAChB,mBAAmB;AAC1B,OAAOC,mBAAmB,MAAM,8CAA8C;AAC9E,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,cAAc,QA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AAEA,SAAU;IACrBQ,SAAS,EAAEA,SAAU;IACrB0I,kBAAkB,EAAEpH,WAAY;IAChCqH,YAAY,EAAEpJ,SAAS,IAAIoC,YAAa;IACxC/B,SAAS,EAAEA;EAAU,gBAErBrC,KAAA,CAAAyJ,aAAA,CAAC1I,kBAAkB;IACfsK,UAAU,EAAEhJ,SAAU;IACtBuH,SAAS,EAAE5H,SAAS,IAAIoC,YAAa;IACrCkH,SAAS,EAAC,kBAAkB;IAC5B1H,GAAG,EAAEc,UAAW;IAChBuD,QAAQ,EAAE;EAAE,GAEXsB,cACe,CACH,CAEb,CACnB,EACD,CACInF,YAAY,EACZpC,SAAS,EACTuH,cAAc,EACd9G,SAAS,EACTqD,aAAa,EACb7D,SAAS,EACTgF,WAAW,EACXP,WAAW,EACX0C,iBAAiB,EACjB5C,eAAe,EACfH,gBAAgB,EAChB3C,UAAU,EACVG,oBAAoB,EACpBE,WAAW,EACX5B,UAAU,EACV4C,OAAO,EACP1C,SAAS,EACT4B,QAAQ,EACRX,aAAa,EACbwF,eAAe,EACfF,mBAAmB,EACnBI,eAAe,EACfxG,MAAM,EACNU,cAAc,EACdP,YAAY,EACZ0C,iBAAiB,EACjBC,oBAAoB,EACpB5C,mBAAmB,EACnBI,kBAAkB,EAClBC,mBAAmB,EACnBmG,+BAA+B,EAC/BzF,+BAA+B,EAC/BJ,kBAAkB,EAClBF,IAAI,CAEZ,CAAC;AACL,CACJ,CAAC;AAEDpB,QAAQ,CAACwJ,WAAW,GAAG,UAAU;AAEjC,eAAexJ,QAAQ","ignoreList":[]}
@@ -2,36 +2,37 @@ import styled, { css } from 'styled-components';
2
2
  import { DropdownDirection } from '../../types/dropdown';
3
3
  import { ComboBoxSize } from './ComboBox.types';
4
4
  export const StyledComboBox = styled.div`
5
+ min-width: 0;
5
6
  user-select: none;
6
7
  position: relative;
7
8
 
8
9
  ${({
9
10
  $shouldUseFullWidth,
10
- $minWidth,
11
- $shouldUseCurrentItemWidth
11
+ $minWidth
12
12
  }) => {
13
- if (typeof $minWidth !== 'number') {
13
+ if ($shouldUseFullWidth) {
14
14
  return css`
15
- width: fit-content;
15
+ width: 100%;
16
+ max-width: 100%;
17
+ min-width: ${typeof $minWidth === 'number' ? `${$minWidth}px` : '0'};
16
18
  `;
17
19
  }
18
- if ($shouldUseFullWidth) {
20
+ if (typeof $minWidth === 'number') {
19
21
  return css`
22
+ width: fit-content;
23
+ max-width: 100%;
20
24
  min-width: ${$minWidth}px;
21
- width: 100%;
22
25
  `;
23
26
  }
24
- if ($shouldUseCurrentItemWidth) {
25
- return '';
26
- }
27
27
  return css`
28
- min-width: ${$minWidth}px;
29
- max-width: ${$minWidth}px;
28
+ width: fit-content;
29
+ max-width: 100%;
30
30
  `;
31
31
  }}
32
32
  `;
33
33
  export const StyledComboBoxHeader = styled.div`
34
34
  display: flex;
35
+ min-width: 0;
35
36
  border: 1px solid transparent;
36
37
  cursor: ${({
37
38
  $isDisabled
@@ -154,6 +155,7 @@ export const StyledComboBoxInput = styled.input`
154
155
  border: none;
155
156
  background-color: transparent;
156
157
  width: 100%;
158
+ min-width: 0;
157
159
  `;
158
160
  export const StyledComboBoxPlaceholderImage = styled.img`
159
161
  box-shadow: 0 0 0 1px
@@ -217,6 +219,9 @@ export const StyledComboBoxBody = styled.div`
217
219
  display: flex;
218
220
  flex-direction: column;
219
221
  cursor: pointer;
222
+ min-width: ${({
223
+ $minWidth
224
+ }) => $minWidth}px;
220
225
 
221
226
  overflow-x: hidden;
222
227
  overflow-y: auto;
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.styles.js","names":["styled","css","DropdownDirection","ComboBoxSize","StyledComboBox","div","$shouldUseFullWidth","$minWidth","$shouldUseCurrentItemWidth","StyledComboBoxHeader","$isDisabled","$size","SMALL","NORMAL","theme","$shouldShowTransparentBackground","$shouldChangeColor","colorMode","$shouldShowBigImage","$isOpen","$direction","BOTTOM","BOTTOM_LEFT","BOTTOM_RIGHT","includes","$isTouch","StyledComboBoxPlaceholder","text","$shouldReduceOpacity","StyledComboBoxPlaceholderText","StyledComboBoxPrefixAndPlaceholderWrapper","StyledComboBoxPrefix","$prefixMinWidth","StyledComboBoxInput","input","StyledComboBoxPlaceholderImage","img","$shouldShowRoundImage","StyledComboBoxClearIconWrapper","StyledComboBoxIconWrapper","$shouldShowBorderLeft","StyledComboBoxBody","$maxHeight","StyledComboBoxTopic"],"sources":["../../../../src/components/combobox/ComboBox.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { Theme, WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { DropdownDirection } from '../../types/dropdown';\nimport { ComboBoxProps, ComboBoxSize } from './ComboBox.types';\n\ntype StyledComboBoxProps = WithTheme<{\n $minWidth?: number;\n $shouldUseFullWidth: ComboBoxProps['shouldUseFullWidth'];\n $shouldUseCurrentItemWidth: ComboBoxProps['shouldUseCurrentItemWidth'];\n}>;\n\nexport const StyledComboBox = styled.div<StyledComboBoxProps>`\n user-select: none;\n position: relative;\n\n ${({ $shouldUseFullWidth, $minWidth, $shouldUseCurrentItemWidth }) => {\n if (typeof $minWidth !== 'number') {\n return css`\n width: fit-content;\n `;\n }\n\n if ($shouldUseFullWidth) {\n return css`\n min-width: ${$minWidth}px;\n width: 100%;\n `;\n }\n\n if ($shouldUseCurrentItemWidth) {\n return '';\n }\n\n return css`\n min-width: ${$minWidth}px;\n max-width: ${$minWidth}px;\n `;\n }}\n`;\n\ntype StyledComboBoxHeaderProps = WithTheme<{\n $isTouch: boolean;\n $isOpen: boolean;\n $direction: DropdownDirection;\n $isDisabled?: boolean;\n $shouldChangeColor: boolean;\n $shouldShowBigImage: ComboBoxProps['shouldShowBigImage'];\n $shouldShowTransparentBackground: boolean;\n $size: ComboBoxSize;\n}>;\n\nexport const StyledComboBoxHeader = styled.div<StyledComboBoxHeaderProps>`\n display: flex;\n border: 1px solid transparent;\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n justify-content: space-between;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n transition: background-color 0.2s ease-in-out;\n\n ${({ $size }) => {\n switch ($size) {\n case ComboBoxSize.SMALL:\n return css`\n height: 34px;\n `;\n case ComboBoxSize.NORMAL:\n default:\n return css`\n min-height: 42px;\n `;\n }\n }}\n\n ${({ theme, $shouldShowTransparentBackground, $shouldChangeColor }) => {\n if ($shouldShowTransparentBackground) {\n if (theme.colorMode === 'dark') {\n return css`\n border-color: rgba(255, 255, 255, 0.5);\n background-color: transparent;\n `;\n }\n\n return css`\n border-color: rgba(0, 0, 0, 0.5);\n background-color: transparent;\n `;\n }\n\n return css`\n border-color: rgba(160, 160, 160, 0.3);\n background-color: ${theme.colorMode === 'classic' || $shouldChangeColor\n ? theme['000']\n : theme['100']};\n `;\n }}\n\n ${({ $shouldShowBigImage }) =>\n $shouldShowBigImage &&\n css`\n height: 42px;\n `}\n\n ${({ $isOpen, $direction }) => {\n if ($isOpen) {\n return [\n DropdownDirection.BOTTOM,\n DropdownDirection.BOTTOM_LEFT,\n DropdownDirection.BOTTOM_RIGHT,\n ].includes($direction)\n ? css`\n border-top-left-radius: 3px;\n border-top-right-radius: 3px;\n `\n : css`\n border-bottom-left-radius: 3px;\n border-bottom-right-radius: 3px;\n `;\n }\n\n return css`\n border-radius: 3px;\n `;\n }}\n\n ${({ $isTouch, $isDisabled, theme }: StyledComboBoxHeaderProps) =>\n !$isTouch &&\n !$isDisabled &&\n css`\n &:hover {\n background-color: ${theme['secondary-102']};\n }\n `}\n`;\n\ntype StyledComboBoxPlaceholderProps = WithTheme<{ $shouldReduceOpacity: boolean }>;\n\nexport const StyledComboBoxPlaceholder = styled.div<StyledComboBoxPlaceholderProps>`\n align-items: center;\n color: ${({ theme }: StyledComboBoxPlaceholderProps) => theme.text};\n display: flex;\n flex: 1 1 auto;\n gap: 10px;\n min-width: 0;\n opacity: ${({ $shouldReduceOpacity }) => ($shouldReduceOpacity ? 0.5 : 1)};\n`;\n\nexport const StyledComboBoxPlaceholderText = styled.div`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nexport const StyledComboBoxPrefixAndPlaceholderWrapper = styled.div`\n align-items: center;\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n padding: 4px 10px;\n`;\n\ntype StyledComboBoxPrefixProps = {\n $prefixMinWidth?: number;\n};\n\nexport const StyledComboBoxPrefix = styled.div<StyledComboBoxPrefixProps>`\n flex: 0 0 auto;\n min-width: ${({ $prefixMinWidth }) => $prefixMinWidth ?? 0}px;\n padding-right: 5px;\n`;\n\nexport const StyledComboBoxInput = styled.input`\n color: ${({ theme }: { theme: Theme }) => theme.text};\n border: none;\n background-color: transparent;\n width: 100%;\n`;\n\ntype StyledComboBoxPlaceholderImageProps = WithTheme<{\n $shouldShowBigImage: ComboBoxProps['shouldShowBigImage'];\n $shouldShowRoundImage: ComboBoxProps['shouldShowRoundImage'];\n}>;\n\nexport const StyledComboBoxPlaceholderImage = styled.img<StyledComboBoxPlaceholderImageProps>`\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledComboBoxPlaceholderImageProps) => theme['009-rgb']}, 0.15);\n height: ${({ $shouldShowBigImage }) => ($shouldShowBigImage ? '32px' : '22px')};\n width: ${({ $shouldShowBigImage }) => ($shouldShowBigImage ? '32px' : '22px')};\n\n ${({ $shouldShowRoundImage }) =>\n $shouldShowRoundImage &&\n css`\n border-radius: 50%;\n `}\n`;\n\ntype StyledComboBoxClearIconWrapperProps = { $isDisabled: boolean };\n\nexport const StyledComboBoxClearIconWrapper = styled.div<StyledComboBoxClearIconWrapperProps>`\n align-items: center;\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n height: 40px;\n justify-content: center;\n width: 40px;\n`;\n\ntype StyledComboBoxIconWrapperProps = {\n $shouldShowBorderLeft: boolean;\n $isDisabled: boolean;\n $size: ComboBoxSize;\n};\n\nexport const StyledComboBoxIconWrapper = styled.div<StyledComboBoxIconWrapperProps>`\n align-items: center;\n border-left: ${({ $shouldShowBorderLeft }) =>\n $shouldShowBorderLeft ? '1px solid rgba(160, 160, 160, 0.3)' : 'none'};\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n width: 40px;\n\n ${({ $size }) => {\n switch ($size) {\n case ComboBoxSize.SMALL:\n return css`\n height: 30px;\n `;\n case ComboBoxSize.NORMAL:\n default:\n return css`\n height: 40px;\n `;\n }\n }}\n`;\n\ntype StyledComboBoxBodyProps = WithTheme<{\n $shouldUseCurrentItemWidth: boolean;\n $maxHeight: number;\n $minWidth: number;\n}>;\n\nexport const StyledComboBoxBody = styled.div<StyledComboBoxBodyProps>`\n display: flex;\n flex-direction: column;\n cursor: pointer;\n\n overflow-x: hidden;\n overflow-y: auto;\n\n max-height: ${({ $maxHeight }) => $maxHeight}px;\n`;\n\ntype StyledComboBoxTopicProps = WithTheme<unknown>;\n\nexport const StyledComboBoxTopic = styled.div`\n align-items: center;\n background-color: ${({ theme }: StyledComboBoxTopicProps) => theme['secondary-102']};\n color: rgba(${({ theme }: StyledComboBoxTopicProps) => theme['text-rgb']}, 0.65);\n cursor: default;\n display: flex;\n flex: 0 0 auto;\n font-weight: bold;\n min-height: 38px;\n line-height: normal;\n padding: 8px 10px;\n position: sticky;\n top: 0;\n z-index: 10;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAAwBC,YAAY,QAAQ,kBAAkB;AAQ9D,OAAO,MAAMC,cAAc,GAAGJ,MAAM,CAACK,GAAwB;AAC7D;AACA;AACA;AACA,MAAM,CAAC;EAAEC,mBAAmB;EAAEC,SAAS;EAAEC;AAA2B,CAAC,KAAK;EAClE,IAAI,OAAOD,SAAS,KAAK,QAAQ,EAAE;IAC/B,OAAON,GAAG;AACtB;AACA,aAAa;EAC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CAACK,GAAG;AAC7C;AACA,wBAAwB,CAAC;EAAES;AAAgC,CAAC,KAAKA,KAAK,CAAC,eAAe,CAAC;AACvF,kBAAkB,CAAC;EAAEA;AAAgC,CAAC,KAAKA,KAAK,CAAC,UAAU,CAAC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ComboBox.styles.js","names":["styled","css","DropdownDirection","ComboBoxSize","StyledComboBox","div","$shouldUseFullWidth","$minWidth","StyledComboBoxHeader","$isDisabled","$size","SMALL","NORMAL","theme","$shouldShowTransparentBackground","$shouldChangeColor","colorMode","$shouldShowBigImage","$isOpen","$direction","BOTTOM","BOTTOM_LEFT","BOTTOM_RIGHT","includes","$isTouch","StyledComboBoxPlaceholder","text","$shouldReduceOpacity","StyledComboBoxPlaceholderText","StyledComboBoxPrefixAndPlaceholderWrapper","StyledComboBoxPrefix","$prefixMinWidth","StyledComboBoxInput","input","StyledComboBoxPlaceholderImage","img","$shouldShowRoundImage","StyledComboBoxClearIconWrapper","StyledComboBoxIconWrapper","$shouldShowBorderLeft","StyledComboBoxBody","$maxHeight","StyledComboBoxTopic"],"sources":["../../../../src/components/combobox/ComboBox.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { Theme, WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { DropdownDirection } from '../../types/dropdown';\nimport { ComboBoxProps, ComboBoxSize } from './ComboBox.types';\n\ntype StyledComboBoxProps = WithTheme<{\n $minWidth?: number;\n $shouldUseFullWidth: ComboBoxProps['shouldUseFullWidth'];\n}>;\n\nexport const StyledComboBox = styled.div<StyledComboBoxProps>`\n min-width: 0;\n user-select: none;\n position: relative;\n\n ${({ $shouldUseFullWidth, $minWidth }) => {\n if ($shouldUseFullWidth) {\n return css`\n width: 100%;\n max-width: 100%;\n min-width: ${typeof $minWidth === 'number' ? `${$minWidth}px` : '0'};\n `;\n }\n\n if (typeof $minWidth === 'number') {\n return css`\n width: fit-content;\n max-width: 100%;\n min-width: ${$minWidth}px;\n `;\n }\n\n return css`\n width: fit-content;\n max-width: 100%;\n `;\n }}\n`;\n\ntype StyledComboBoxHeaderProps = WithTheme<{\n $isTouch: boolean;\n $isOpen: boolean;\n $direction: DropdownDirection;\n $isDisabled?: boolean;\n $shouldChangeColor: boolean;\n $shouldShowBigImage: ComboBoxProps['shouldShowBigImage'];\n $shouldShowTransparentBackground: boolean;\n $size: ComboBoxSize;\n}>;\n\nexport const StyledComboBoxHeader = styled.div<StyledComboBoxHeaderProps>`\n display: flex;\n min-width: 0;\n border: 1px solid transparent;\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n justify-content: space-between;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n transition: background-color 0.2s ease-in-out;\n\n ${({ $size }) => {\n switch ($size) {\n case ComboBoxSize.SMALL:\n return css`\n height: 34px;\n `;\n case ComboBoxSize.NORMAL:\n default:\n return css`\n min-height: 42px;\n `;\n }\n }}\n\n ${({ theme, $shouldShowTransparentBackground, $shouldChangeColor }) => {\n if ($shouldShowTransparentBackground) {\n if (theme.colorMode === 'dark') {\n return css`\n border-color: rgba(255, 255, 255, 0.5);\n background-color: transparent;\n `;\n }\n\n return css`\n border-color: rgba(0, 0, 0, 0.5);\n background-color: transparent;\n `;\n }\n\n return css`\n border-color: rgba(160, 160, 160, 0.3);\n background-color: ${theme.colorMode === 'classic' || $shouldChangeColor\n ? theme['000']\n : theme['100']};\n `;\n }}\n\n ${({ $shouldShowBigImage }) =>\n $shouldShowBigImage &&\n css`\n height: 42px;\n `}\n\n ${({ $isOpen, $direction }) => {\n if ($isOpen) {\n return [\n DropdownDirection.BOTTOM,\n DropdownDirection.BOTTOM_LEFT,\n DropdownDirection.BOTTOM_RIGHT,\n ].includes($direction)\n ? css`\n border-top-left-radius: 3px;\n border-top-right-radius: 3px;\n `\n : css`\n border-bottom-left-radius: 3px;\n border-bottom-right-radius: 3px;\n `;\n }\n\n return css`\n border-radius: 3px;\n `;\n }}\n\n ${({ $isTouch, $isDisabled, theme }: StyledComboBoxHeaderProps) =>\n !$isTouch &&\n !$isDisabled &&\n css`\n &:hover {\n background-color: ${theme['secondary-102']};\n }\n `}\n`;\n\ntype StyledComboBoxPlaceholderProps = WithTheme<{ $shouldReduceOpacity: boolean }>;\n\nexport const StyledComboBoxPlaceholder = styled.div<StyledComboBoxPlaceholderProps>`\n align-items: center;\n color: ${({ theme }: StyledComboBoxPlaceholderProps) => theme.text};\n display: flex;\n flex: 1 1 auto;\n gap: 10px;\n min-width: 0;\n opacity: ${({ $shouldReduceOpacity }) => ($shouldReduceOpacity ? 0.5 : 1)};\n`;\n\nexport const StyledComboBoxPlaceholderText = styled.div`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nexport const StyledComboBoxPrefixAndPlaceholderWrapper = styled.div`\n align-items: center;\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n padding: 4px 10px;\n`;\n\ntype StyledComboBoxPrefixProps = {\n $prefixMinWidth?: number;\n};\n\nexport const StyledComboBoxPrefix = styled.div<StyledComboBoxPrefixProps>`\n flex: 0 0 auto;\n min-width: ${({ $prefixMinWidth }) => $prefixMinWidth ?? 0}px;\n padding-right: 5px;\n`;\n\nexport const StyledComboBoxInput = styled.input`\n color: ${({ theme }: { theme: Theme }) => theme.text};\n border: none;\n background-color: transparent;\n width: 100%;\n min-width: 0;\n`;\n\ntype StyledComboBoxPlaceholderImageProps = WithTheme<{\n $shouldShowBigImage: ComboBoxProps['shouldShowBigImage'];\n $shouldShowRoundImage: ComboBoxProps['shouldShowRoundImage'];\n}>;\n\nexport const StyledComboBoxPlaceholderImage = styled.img<StyledComboBoxPlaceholderImageProps>`\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledComboBoxPlaceholderImageProps) => theme['009-rgb']}, 0.15);\n height: ${({ $shouldShowBigImage }) => ($shouldShowBigImage ? '32px' : '22px')};\n width: ${({ $shouldShowBigImage }) => ($shouldShowBigImage ? '32px' : '22px')};\n\n ${({ $shouldShowRoundImage }) =>\n $shouldShowRoundImage &&\n css`\n border-radius: 50%;\n `}\n`;\n\ntype StyledComboBoxClearIconWrapperProps = { $isDisabled: boolean };\n\nexport const StyledComboBoxClearIconWrapper = styled.div<StyledComboBoxClearIconWrapperProps>`\n align-items: center;\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n height: 40px;\n justify-content: center;\n width: 40px;\n`;\n\ntype StyledComboBoxIconWrapperProps = {\n $shouldShowBorderLeft: boolean;\n $isDisabled: boolean;\n $size: ComboBoxSize;\n};\n\nexport const StyledComboBoxIconWrapper = styled.div<StyledComboBoxIconWrapperProps>`\n align-items: center;\n border-left: ${({ $shouldShowBorderLeft }) =>\n $shouldShowBorderLeft ? '1px solid rgba(160, 160, 160, 0.3)' : 'none'};\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n width: 40px;\n\n ${({ $size }) => {\n switch ($size) {\n case ComboBoxSize.SMALL:\n return css`\n height: 30px;\n `;\n case ComboBoxSize.NORMAL:\n default:\n return css`\n height: 40px;\n `;\n }\n }}\n`;\n\ntype StyledComboBoxBodyProps = WithTheme<{\n $maxHeight: number;\n $minWidth: number;\n}>;\n\nexport const StyledComboBoxBody = styled.div<StyledComboBoxBodyProps>`\n display: flex;\n flex-direction: column;\n cursor: pointer;\n min-width: ${({ $minWidth }) => $minWidth}px;\n\n overflow-x: hidden;\n overflow-y: auto;\n\n max-height: ${({ $maxHeight }) => $maxHeight}px;\n`;\n\ntype StyledComboBoxTopicProps = WithTheme<unknown>;\n\nexport const StyledComboBoxTopic = styled.div`\n align-items: center;\n background-color: ${({ theme }: StyledComboBoxTopicProps) => theme['secondary-102']};\n color: rgba(${({ theme }: StyledComboBoxTopicProps) => theme['text-rgb']}, 0.65);\n cursor: default;\n display: flex;\n flex: 0 0 auto;\n font-weight: bold;\n min-height: 38px;\n line-height: normal;\n padding: 8px 10px;\n position: sticky;\n top: 0;\n z-index: 10;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAAwBC,YAAY,QAAQ,kBAAkB;AAO9D,OAAO,MAAMC,cAAc,GAAGJ,MAAM,CAACK,GAAwB;AAC7D;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC,mBAAmB;EAAEC;AAAU,CAAC,KAAK;EACtC,IAAID,mBAAmB,EAAE;IACrB,OAAOL,GAAG;AACtB;AACA;AACA,6BAA6B,OAAOM,SAAS,KAAK,QAAQ,GAAG,GAAGA,SAAS,IAAI,GAAG,GAAG;AACnF,aAAa;EACL;EAEA,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;IAC/B,OAAON,GAAG;AACtB;AACA;AACA,6BAA6BM,SAAS;AACtC,aAAa;EACL;EAEA,OAAON,GAAG;AAClB;AACA;AACA,SAAS;AACL,CAAC;AACL,CAAC;AAaD,OAAO,MAAMO,oBAAoB,GAAGR,MAAM,CAACK,GAA8B;AACzE;AACA;AACA;AACA,cAAc,CAAC;EAAEI;AAAY,CAAC,KAAM,CAACA,WAAW,GAAG,SAAS,GAAG,SAAU;AACzE;AACA,eAAe,CAAC;EAAEA;AAAY,CAAC,KAAMA,WAAW,GAAG,GAAG,GAAG,CAAE;AAC3D;AACA;AACA,MAAM,CAAC;EAAEC;AAAM,CAAC,KAAK;EACb,QAAQA,KAAK;IACT,KAAKP,YAAY,CAACQ,KAAK;MACnB,OAAOV,GAAG;AAC1B;AACA,iBAAiB;IACL,KAAKE,YAAY,CAACS,MAAM;IACxB;MACI,OAAOX,GAAG;AAC1B;AACA,iBAAiB;EACT;AACJ,CAAC;AACL;AACA,MAAM,CAAC;EAAEY,KAAK;EAAEC,gCAAgC;EAAEC;AA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,GAAG,SAAS,GAAG,SAAU;AACzE;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAM,CAAC,KAAK;EACb,QAAQA,KAAK;IACT,KAAKP,YAAY,CAACQ,KAAK;MACnB,OAAOV,GAAG;AAC1B;AACA,iBAAiB;IACL,KAAKE,YAAY,CAACS,MAAM;IACxB;MACI,OAAOX,GAAG;AAC1B;AACA,iBAAiB;EACT;AACJ,CAAC;AACL,CAAC;AAOD,OAAO,MAAMuC,kBAAkB,GAAGxC,MAAM,CAACK,GAA4B;AACrE;AACA;AACA;AACA,iBAAiB,CAAC;EAAEE;AAAU,CAAC,KAAKA,SAAS;AAC7C;AACA;AACA;AACA;AACA,kBAAkB,CAAC;EAAEkC;AAAW,CAAC,KAAKA,UAAU;AAChD,CAAC;AAID,OAAO,MAAMC,mBAAmB,GAAG1C,MAAM,CAACK,GAAG;AAC7C;AACA,wBAAwB,CAAC;EAAEQ;AAAgC,CAAC,KAAKA,KAAK,CAAC,eAAe,CAAC;AACvF,kBAAkB,CAAC;EAAEA;AAAgC,CAAC,KAAKA,KAAK,CAAC,UAAU,CAAC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1,6 +1,35 @@
1
+ /**
2
+ * Ref interface for the `ComboBox` component.
3
+ */
4
+
5
+ /**
6
+ * A grouped list definition used by the `ComboBox` component.
7
+ */
8
+
9
+ /**
10
+ * Optional text styling configuration for a combobox item.
11
+ */
12
+
13
+ /**
14
+ * Single selectable item configuration for the `ComboBox` component.
15
+ */
16
+
17
+ /**
18
+ * Available size variants for the `ComboBox` header.
19
+ */
1
20
  export let ComboBoxSize = /*#__PURE__*/function (ComboBoxSize) {
21
+ /**
22
+ * Standard height and spacing.
23
+ */
2
24
  ComboBoxSize["NORMAL"] = "normal";
25
+ /**
26
+ * Compact height and spacing.
27
+ */
3
28
  ComboBoxSize["SMALL"] = "small";
4
29
  return ComboBoxSize;
5
30
  }({});
31
+
32
+ /**
33
+ * Props for the `ComboBox` component.
34
+ */
6
35
  //# sourceMappingURL=ComboBox.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.types.js","names":["ComboBoxSize"],"sources":["../../../../src/components/combobox/ComboBox.types.ts"],"sourcesContent":["import { ChangeEventHandler, CSSProperties, FocusEventHandler, ReactHTML, ReactNode } from 'react';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { DropdownDirection } from '../../types/dropdown';\n\nexport interface ComboBoxRef {\n hide: VoidFunction;\n show: VoidFunction;\n}\n\nexport interface IComboBoxItems {\n groupName?: string;\n list: Array<IComboBoxItem>;\n shouldShowRoundImage?: boolean;\n}\n\nexport interface ComboBoxTextStyles {\n tagName?: keyof ReactHTML;\n styles?: CSSPropertiesWithVars;\n className?: string;\n}\n\nexport interface IComboBoxItem {\n icons?: string[];\n imageBackground?: CSSProperties['background'];\n imageUrl?: string;\n isDisabled?: boolean;\n rightElement?: ReactNode;\n subtext?: string;\n suffixElement?: ReactNode;\n text: string;\n value: string | number;\n textStyles?: ComboBoxTextStyles;\n}\n\nexport enum ComboBoxSize {\n NORMAL = 'normal',\n SMALL = 'small',\n}\n\nexport type ComboBoxProps = {\n /**\n * The width of the body.\n */\n bodyWidth?: number;\n /**\n * The element where the content of the `ComboBox` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * The direction in which the combobox should open.\n */\n direction?: DropdownDirection;\n /**\n * The value of the optional input.\n */\n inputValue?: string;\n /**\n * Whether the combobox should be disabled.\n */\n isDisabled?: boolean;\n /**\n * The list of the items that should be displayed.\n */\n lists: IComboBoxItems[];\n /**\n * The maximum height of the combobox content.\n */\n maxHeight?: number;\n /**\n * Function to be executed when the value of the optional input is changed.\n */\n onInputChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the optional input lost its focus.\n */\n onInputBlur?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the optional input gets its focus.\n */\n onInputFocus?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function that should be executed when an item is selected. If the function returns false, the item will not be selected.\n */\n onSelect?: (comboboxItem?: IComboBoxItem) => Promise<boolean> | boolean | void;\n /**\n * Function to be executed when the content of the `ComboBox` is shown.\n */\n onShow?: () => void;\n /**\n * Function to be executed when the content of the `ComboBox` is hidden.\n */\n onHide?: () => void;\n /**\n * A text that should be displayed when no item is selected.\n */\n placeholder: string;\n /**\n * A prefix that should be displayed before the placeholder.\n */\n prefix?: string;\n /**\n * An item that should be preselected.\n */\n selectedItem?: IComboBoxItem;\n /**\n * If true, the images of the items are displayed in a bigger shape. This prop will automatically be set to true if the subtext of an item is given.\n */\n shouldShowBigImage?: boolean;\n /**\n * If true, a clear icon is displayed at the end of the combo box if an item is selected.\n */\n shouldShowClearIcon?: boolean;\n /**\n * Whether the background should be transparent.\n */\n shouldShowTransparentBackground?: boolean;\n /**\n * If true, the images of the items are displayed in a round shape.\n */\n shouldShowRoundImage?: boolean;\n /**\n * Whether the width of the ComboBox should be the width of the current item.\n */\n shouldUseCurrentItemWidth?: boolean;\n /**\n * Whether the width of the 'ComboBox' should be the width of the parent or of the widest item.\n */\n shouldUseFullWidth?: boolean;\n /**\n * If true, the dropdown will use the maximum width of the items.\n */\n shouldDropDownUseMaxItemWidth?: boolean;\n /**\n * Whether the outside events should be captured.\n */\n shouldCaptureEvents?: boolean;\n /**\n * The size of the ComboBox.\n */\n size?: ComboBoxSize;\n /**\n * Optional min width for the prefix element.\n */\n prefixMinWidth?: number;\n};\n"],"mappings":"AAkCA,WAAYA,YAAY,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"ComboBox.types.js","names":["ComboBoxSize"],"sources":["../../../../src/components/combobox/ComboBox.types.ts"],"sourcesContent":["import { ChangeEventHandler, CSSProperties, FocusEventHandler, ReactHTML, ReactNode } from 'react';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { DropdownDirection } from '../../types/dropdown';\n\n/**\n * Ref interface for the `ComboBox` component.\n */\nexport interface ComboBoxRef {\n /**\n * Hides the dropdown content.\n */\n hide: VoidFunction;\n /**\n * Shows the dropdown content.\n */\n show: VoidFunction;\n}\n\n/**\n * A grouped list definition used by the `ComboBox` component.\n */\nexport interface IComboBoxItems {\n /**\n * Optional group label shown above the list.\n */\n groupName?: string;\n /**\n * The items that should be rendered inside the group.\n */\n list: Array<IComboBoxItem>;\n /**\n * Whether the items in this group should use round images.\n */\n shouldShowRoundImage?: boolean;\n}\n\n/**\n * Optional text styling configuration for a combobox item.\n */\nexport interface ComboBoxTextStyles {\n /**\n * The HTML tag that should be used for the text wrapper.\n */\n tagName?: keyof ReactHTML;\n /**\n * Additional inline styles applied to the text wrapper.\n */\n styles?: CSSPropertiesWithVars;\n /**\n * Additional class name applied to the text wrapper.\n */\n className?: string;\n}\n\n/**\n * Single selectable item configuration for the `ComboBox` component.\n */\nexport interface IComboBoxItem {\n /**\n * Optional icon classes rendered before the text.\n */\n icons?: string[];\n /**\n * Optional background style used for the image placeholder.\n */\n imageBackground?: CSSProperties['background'];\n /**\n * Optional image URL rendered for the item.\n */\n imageUrl?: string;\n /**\n * Whether the item should be disabled.\n */\n isDisabled?: boolean;\n /**\n * Optional element rendered on the right side of the item.\n */\n rightElement?: ReactNode;\n /**\n * Optional secondary text rendered below the main text.\n */\n subtext?: string;\n /**\n * Optional suffix element rendered after the text.\n */\n suffixElement?: ReactNode;\n /**\n * Main label of the item.\n */\n text: string;\n /**\n * Stable item value used for selection and matching.\n */\n value: string | number;\n /**\n * Optional text styling overrides for the item label.\n */\n textStyles?: ComboBoxTextStyles;\n}\n\n/**\n * Available size variants for the `ComboBox` header.\n */\nexport enum ComboBoxSize {\n /**\n * Standard height and spacing.\n */\n NORMAL = 'normal',\n /**\n * Compact height and spacing.\n */\n SMALL = 'small',\n}\n\n/**\n * Props for the `ComboBox` component.\n */\nexport type ComboBoxProps = {\n /**\n * The width of the body.\n * @default undefined\n */\n bodyWidth?: number;\n /**\n * The element where the content of the `ComboBox` should be rendered via React Portal.\n * @default undefined\n */\n container?: Element;\n /**\n * The direction in which the combobox should open.\n * @default DropdownDirection.RIGHT\n */\n direction?: DropdownDirection;\n /**\n * The value of the optional input.\n * @default undefined\n */\n inputValue?: string;\n /**\n * Whether the combobox should be disabled.\n * @default false\n */\n isDisabled?: boolean;\n /**\n * The list of the items that should be displayed.\n */\n lists: IComboBoxItems[];\n /**\n * The maximum height of the combobox content.\n * @default 280\n */\n maxHeight?: number;\n /**\n * Function to be executed when the value of the optional input is changed.\n * @default undefined\n */\n onInputChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the optional input lost its focus.\n * @default undefined\n */\n onInputBlur?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the optional input gets its focus.\n * @default undefined\n */\n onInputFocus?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function that should be executed when an item is selected. If the function returns false, the item will not be selected.\n * @default undefined\n */\n onSelect?: (comboboxItem?: IComboBoxItem) => Promise<boolean> | boolean | void;\n /**\n * Function to be executed when the content of the `ComboBox` is shown.\n * @default undefined\n */\n onShow?: () => void;\n /**\n * Function to be executed when the content of the `ComboBox` is hidden.\n * @default undefined\n */\n onHide?: () => void;\n /**\n * A text that should be displayed when no item is selected.\n */\n placeholder: string;\n /**\n * A prefix that should be displayed before the placeholder.\n * @default undefined\n */\n prefix?: string;\n /**\n * An item that should be preselected.\n * @default undefined\n */\n selectedItem?: IComboBoxItem;\n /**\n * If true, the images of the items are displayed in a bigger shape. This prop will automatically be set to true if the subtext of an item is given.\n * @default false\n */\n shouldShowBigImage?: boolean;\n /**\n * If true, a clear icon is displayed at the end of the combo box if an item is selected.\n * @default false\n */\n shouldShowClearIcon?: boolean;\n /**\n * Whether the background should be transparent.\n * @default false\n */\n shouldShowTransparentBackground?: boolean;\n /**\n * If true, the images of the items are displayed in a round shape.\n * @default false\n */\n shouldShowRoundImage?: boolean;\n /**\n * Whether the width of the ComboBox should be the width of the current item.\n * @default false\n */\n shouldUseCurrentItemWidth?: boolean;\n /**\n * Whether the width of the 'ComboBox' should be the width of the parent or of the widest item.\n * @default false\n */\n shouldUseFullWidth?: boolean;\n /**\n * If true, the dropdown will use the maximum width of the items.\n * @default false\n */\n shouldDropDownUseMaxItemWidth?: boolean;\n /**\n * Whether the outside events should be captured.\n * @default undefined\n */\n shouldCaptureEvents?: boolean;\n /**\n * The size of the ComboBox.\n * @default ComboBoxSize.NORMAL\n */\n size?: ComboBoxSize;\n /**\n * Optional min width for the prefix element.\n * @default undefined\n */\n prefixMinWidth?: number;\n};\n"],"mappings":"AAIA;AACA;AACA;;AAYA;AACA;AACA;;AAgBA;AACA;AACA;;AAgBA;AACA;AACA;;AA4CA;AACA;AACA;AACA,WAAYA,YAAY,0BAAZA,YAAY;EACpB;AACJ;AACA;EAHYA,YAAY;EAKpB;AACJ;AACA;EAPYA,YAAY;EAAA,OAAZA,YAAY;AAAA;;AAWxB;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,81 @@
1
+ import { calculateMaxComboBoxItemWidth } from '../../utils/calculate';
2
+ import { COMBO_BOX_ACTION_ICON_WIDTH_PX, COMBO_BOX_CLEAR_ICON_WIDTH_PX, COMBO_BOX_DROPDOWN_HORIZONTAL_PADDING_PX, COMBO_BOX_PREFIX_GAP_PX, COMBO_BOX_PREFIX_MIN_WIDTH_PX, COMBO_BOX_HEADER_HORIZONTAL_PADDING_PX, COMBO_BOX_HEADER_BORDER_WIDTH_PX, COMBO_BOX_ROUNDING_BUFFER_PX } from './ComboBox.constants';
3
+ const getPrefixWidth = (prefix, prefixMinWidth, functions, values) => {
4
+ if (!prefix) {
5
+ return 0;
6
+ }
7
+ const prefixTextWidth = calculateMaxComboBoxItemWidth({
8
+ list: [{
9
+ text: prefix,
10
+ value: 'prefix'
11
+ }],
12
+ functions,
13
+ values
14
+ });
15
+ return Math.max(prefixTextWidth + COMBO_BOX_PREFIX_GAP_PX, prefixMinWidth ?? COMBO_BOX_PREFIX_MIN_WIDTH_PX);
16
+ };
17
+ const clampToParentWidth = (width, parentWidth) => parentWidth > 0 ? Math.min(width, parentWidth) : width;
18
+ export const getComboBoxWidthResult = ({
19
+ functions,
20
+ internalSelectedItem,
21
+ lists,
22
+ parentWidth,
23
+ placeholder,
24
+ prefix,
25
+ prefixMinWidth,
26
+ selectedItem,
27
+ shouldDropDownUseMaxItemWidth,
28
+ shouldShowBigImage,
29
+ shouldShowClearIcon,
30
+ shouldUseCurrentItemWidth,
31
+ shouldUseFullWidth,
32
+ values
33
+ }) => {
34
+ const allItems = lists.flatMap(list => list.list);
35
+ const effectiveSelectedItem = selectedItem ?? internalSelectedItem;
36
+ const maxItemWidth = calculateMaxComboBoxItemWidth({
37
+ list: [...allItems, {
38
+ text: placeholder,
39
+ value: 'placeholder'
40
+ }, ...(effectiveSelectedItem ? [effectiveSelectedItem] : [])],
41
+ functions,
42
+ shouldShowBigImage,
43
+ values
44
+ });
45
+ const prefixWidth = getPrefixWidth(prefix, prefixMinWidth, functions, values);
46
+ const triggerWidthBase = maxItemWidth + COMBO_BOX_HEADER_HORIZONTAL_PADDING_PX + COMBO_BOX_HEADER_BORDER_WIDTH_PX + COMBO_BOX_ACTION_ICON_WIDTH_PX + (shouldShowClearIcon ? COMBO_BOX_CLEAR_ICON_WIDTH_PX : 0) + COMBO_BOX_ROUNDING_BUFFER_PX + prefixWidth;
47
+ const desiredBodyMinWidth = maxItemWidth + COMBO_BOX_DROPDOWN_HORIZONTAL_PADDING_PX;
48
+ if (shouldDropDownUseMaxItemWidth) {
49
+ const width = clampToParentWidth(desiredBodyMinWidth, parentWidth);
50
+ return {
51
+ minWidth: width,
52
+ bodyMinWidth: width
53
+ };
54
+ }
55
+ if (shouldUseFullWidth) {
56
+ const width = clampToParentWidth(parentWidth, parentWidth);
57
+ return {
58
+ minWidth: width,
59
+ bodyMinWidth: clampToParentWidth(Math.max(desiredBodyMinWidth, width), parentWidth)
60
+ };
61
+ }
62
+ if (shouldUseCurrentItemWidth && effectiveSelectedItem) {
63
+ const selectedItemWidth = calculateMaxComboBoxItemWidth({
64
+ list: [effectiveSelectedItem],
65
+ functions,
66
+ shouldShowBigImage,
67
+ values
68
+ });
69
+ const width = clampToParentWidth(selectedItemWidth + COMBO_BOX_HEADER_HORIZONTAL_PADDING_PX + COMBO_BOX_HEADER_BORDER_WIDTH_PX + COMBO_BOX_ACTION_ICON_WIDTH_PX + (shouldShowClearIcon ? COMBO_BOX_CLEAR_ICON_WIDTH_PX : 0) + COMBO_BOX_ROUNDING_BUFFER_PX + prefixWidth, parentWidth);
70
+ return {
71
+ minWidth: width,
72
+ bodyMinWidth: clampToParentWidth(Math.max(desiredBodyMinWidth, width), parentWidth)
73
+ };
74
+ }
75
+ const width = clampToParentWidth(triggerWidthBase, parentWidth);
76
+ return {
77
+ minWidth: width,
78
+ bodyMinWidth: clampToParentWidth(Math.max(desiredBodyMinWidth, width), parentWidth)
79
+ };
80
+ };
81
+ //# sourceMappingURL=ComboBox.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComboBox.utils.js","names":["calculateMaxComboBoxItemWidth","COMBO_BOX_ACTION_ICON_WIDTH_PX","COMBO_BOX_CLEAR_ICON_WIDTH_PX","COMBO_BOX_DROPDOWN_HORIZONTAL_PADDING_PX","COMBO_BOX_PREFIX_GAP_PX","COMBO_BOX_PREFIX_MIN_WIDTH_PX","COMBO_BOX_HEADER_HORIZONTAL_PADDING_PX","COMBO_BOX_HEADER_BORDER_WIDTH_PX","COMBO_BOX_ROUNDING_BUFFER_PX","getPrefixWidth","prefix","prefixMinWidth","functions","values","prefixTextWidth","list","text","value","Math","max","clampToParentWidth","width","parentWidth","min","getComboBoxWidthResult","internalSelectedItem","lists","placeholder","selectedItem","shouldDropDownUseMaxItemWidth","shouldShowBigImage","shouldShowClearIcon","shouldUseCurrentItemWidth","shouldUseFullWidth","allItems","flatMap","effectiveSelectedItem","maxItemWidth","prefixWidth","triggerWidthBase","desiredBodyMinWidth","minWidth","bodyMinWidth","selectedItemWidth"],"sources":["../../../../src/components/combobox/ComboBox.utils.ts"],"sourcesContent":["import type { ChaynsReactFunctions, ChaynsReactValues } from 'chayns-api';\nimport { calculateMaxComboBoxItemWidth } from '../../utils/calculate';\nimport type { IComboBoxItem, IComboBoxItems } from './ComboBox.types';\nimport {\n COMBO_BOX_ACTION_ICON_WIDTH_PX,\n COMBO_BOX_CLEAR_ICON_WIDTH_PX,\n COMBO_BOX_DROPDOWN_HORIZONTAL_PADDING_PX,\n COMBO_BOX_PREFIX_GAP_PX,\n COMBO_BOX_PREFIX_MIN_WIDTH_PX,\n COMBO_BOX_HEADER_HORIZONTAL_PADDING_PX,\n COMBO_BOX_HEADER_BORDER_WIDTH_PX,\n COMBO_BOX_ROUNDING_BUFFER_PX,\n} from './ComboBox.constants';\n\nexport type ComboBoxWidthOptions = {\n functions: ChaynsReactFunctions;\n internalSelectedItem?: IComboBoxItem;\n lists: IComboBoxItems[];\n parentWidth: number;\n placeholder: string;\n prefix?: string;\n prefixMinWidth?: number;\n selectedItem?: IComboBoxItem;\n shouldDropDownUseMaxItemWidth?: boolean;\n shouldShowBigImage?: boolean;\n shouldShowClearIcon?: boolean;\n shouldUseCurrentItemWidth?: boolean;\n shouldUseFullWidth?: boolean;\n values: ChaynsReactValues;\n};\n\nexport type ComboBoxWidthResult = {\n minWidth?: number;\n bodyMinWidth: number;\n};\n\nconst getPrefixWidth = (\n prefix: ComboBoxWidthOptions['prefix'],\n prefixMinWidth: ComboBoxWidthOptions['prefixMinWidth'],\n functions: ChaynsReactFunctions,\n values: ChaynsReactValues,\n) => {\n if (!prefix) {\n return 0;\n }\n\n const prefixTextWidth = calculateMaxComboBoxItemWidth({\n list: [{ text: prefix, value: 'prefix' }],\n functions,\n values,\n });\n\n return Math.max(\n prefixTextWidth + COMBO_BOX_PREFIX_GAP_PX,\n prefixMinWidth ?? COMBO_BOX_PREFIX_MIN_WIDTH_PX,\n );\n};\n\nconst clampToParentWidth = (width: number, parentWidth: number) =>\n parentWidth > 0 ? Math.min(width, parentWidth) : width;\n\nexport const getComboBoxWidthResult = ({\n functions,\n internalSelectedItem,\n lists,\n parentWidth,\n placeholder,\n prefix,\n prefixMinWidth,\n selectedItem,\n shouldDropDownUseMaxItemWidth,\n shouldShowBigImage,\n shouldShowClearIcon,\n shouldUseCurrentItemWidth,\n shouldUseFullWidth,\n values,\n}: ComboBoxWidthOptions): ComboBoxWidthResult => {\n const allItems = lists.flatMap((list) => list.list);\n const effectiveSelectedItem = selectedItem ?? internalSelectedItem;\n\n const maxItemWidth = calculateMaxComboBoxItemWidth({\n list: [\n ...allItems,\n { text: placeholder, value: 'placeholder' },\n ...(effectiveSelectedItem ? [effectiveSelectedItem] : []),\n ],\n functions,\n shouldShowBigImage,\n values,\n });\n\n const prefixWidth = getPrefixWidth(prefix, prefixMinWidth, functions, values);\n const triggerWidthBase =\n maxItemWidth +\n COMBO_BOX_HEADER_HORIZONTAL_PADDING_PX +\n COMBO_BOX_HEADER_BORDER_WIDTH_PX +\n COMBO_BOX_ACTION_ICON_WIDTH_PX +\n (shouldShowClearIcon ? COMBO_BOX_CLEAR_ICON_WIDTH_PX : 0) +\n COMBO_BOX_ROUNDING_BUFFER_PX +\n prefixWidth;\n\n const desiredBodyMinWidth = maxItemWidth + COMBO_BOX_DROPDOWN_HORIZONTAL_PADDING_PX;\n\n if (shouldDropDownUseMaxItemWidth) {\n const width = clampToParentWidth(desiredBodyMinWidth, parentWidth);\n\n return {\n minWidth: width,\n bodyMinWidth: width,\n };\n }\n\n if (shouldUseFullWidth) {\n const width = clampToParentWidth(parentWidth, parentWidth);\n\n return {\n minWidth: width,\n bodyMinWidth: clampToParentWidth(Math.max(desiredBodyMinWidth, width), parentWidth),\n };\n }\n\n if (shouldUseCurrentItemWidth && effectiveSelectedItem) {\n const selectedItemWidth = calculateMaxComboBoxItemWidth({\n list: [effectiveSelectedItem],\n functions,\n shouldShowBigImage,\n values,\n });\n\n const width = clampToParentWidth(\n selectedItemWidth +\n COMBO_BOX_HEADER_HORIZONTAL_PADDING_PX +\n COMBO_BOX_HEADER_BORDER_WIDTH_PX +\n COMBO_BOX_ACTION_ICON_WIDTH_PX +\n (shouldShowClearIcon ? COMBO_BOX_CLEAR_ICON_WIDTH_PX : 0) +\n COMBO_BOX_ROUNDING_BUFFER_PX +\n prefixWidth,\n parentWidth,\n );\n\n return {\n minWidth: width,\n bodyMinWidth: clampToParentWidth(Math.max(desiredBodyMinWidth, width), parentWidth),\n };\n }\n\n const width = clampToParentWidth(triggerWidthBase, parentWidth);\n\n return {\n minWidth: width,\n bodyMinWidth: clampToParentWidth(Math.max(desiredBodyMinWidth, width), parentWidth),\n };\n};\n"],"mappings":"AACA,SAASA,6BAA6B,QAAQ,uBAAuB;AAErE,SACIC,8BAA8B,EAC9BC,6BAA6B,EAC7BC,wCAAwC,EACxCC,uBAAuB,EACvBC,6BAA6B,EAC7BC,sCAAsC,EACtCC,gCAAgC,EAChCC,4BAA4B,QACzB,sBAAsB;AAwB7B,MAAMC,cAAc,GAAGA,CACnBC,MAAsC,EACtCC,cAAsD,EACtDC,SAA+B,EAC/BC,MAAyB,KACxB;EACD,IAAI,CAACH,MAAM,EAAE;IACT,OAAO,CAAC;EACZ;EAEA,MAAMI,eAAe,GAAGd,6BAA6B,CAAC;IAClDe,IAAI,EAAE,CAAC;MAAEC,IAAI,EAAEN,MAAM;MAAEO,KAAK,EAAE;IAAS,CAAC,CAAC;IACzCL,SAAS;IACTC;EACJ,CAAC,CAAC;EAEF,OAAOK,IAAI,CAACC,GAAG,CACXL,eAAe,GAAGV,uBAAuB,EACzCO,cAAc,IAAIN,6BACtB,CAAC;AACL,CAAC;AAED,MAAMe,kBAAkB,GAAGA,CAACC,KAAa,EAAEC,WAAmB,KAC1DA,WAAW,GAAG,CAAC,GAAGJ,IAAI,CAACK,GAAG,CAACF,KAAK,EAAEC,WAAW,CAAC,GAAGD,KAAK;A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AACE,WAAW,EAAEA,WAAW,CAAC;IAE1D,OAAO;MACHmB,QAAQ,EAAEpB,KAAK;MACfqB,YAAY,EAAEtB,kBAAkB,CAACF,IAAI,CAACC,GAAG,CAACqB,mBAAmB,EAAEnB,KAAK,CAAC,EAAEC,WAAW;IACtF,CAAC;EACL;EAEA,IAAIU,yBAAyB,IAAII,qBAAqB,EAAE;IACpD,MAAMO,iBAAiB,GAAG3C,6BAA6B,CAAC;MACpDe,IAAI,EAAE,CAACqB,qBAAqB,CAAC;MAC7BxB,SAAS;MACTkB,kBAAkB;MAClBjB;IACJ,CAAC,CAAC;IAEF,MAAMQ,KAAK,GAAGD,kBAAkB,CAC5BuB,iBAAiB,GACbrC,sCAAsC,GACtCC,gCAAgC,GAChCN,8BAA8B,IAC7B8B,mBAAmB,GAAG7B,6BAA6B,GAAG,CAAC,CAAC,GACzDM,4BAA4B,GAC5B8B,WAAW,EACfhB,WACJ,CAAC;IAED,OAAO;MACHmB,QAAQ,EAAEpB,KAAK;MACfqB,YAAY,EAAEtB,kBAAkB,CAACF,IAAI,CAACC,GAAG,CAACqB,mBAAmB,EAAEnB,KAAK,CAAC,EAAEC,WAAW;IACtF,CAAC;EACL;EAEA,MAAMD,KAAK,GAAGD,kBAAkB,CAACmB,gBAAgB,EAAEjB,WAAW,CAAC;EAE/D,OAAO;IACHmB,QAAQ,EAAEpB,KAAK;IACfqB,YAAY,EAAEtB,kBAAkB,CAACF,IAAI,CAACC,GAAG,CAACqB,mBAAmB,EAAEnB,KAAK,CAAC,EAAEC,WAAW;EACtF,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export const FILTER_CONTENT_ROW_GAP_PX = 10;
2
+ //# sourceMappingURL=FilterContent.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterContent.constants.js","names":["FILTER_CONTENT_ROW_GAP_PX"],"sources":["../../../../../src/components/filter/filter-content/FilterContent.constants.ts"],"sourcesContent":["export const FILTER_CONTENT_ROW_GAP_PX = 10;\n"],"mappings":"AAAA,OAAO,MAAMA,yBAAyB,GAAG,EAAE","ignoreList":[]}
@@ -1,6 +1,5 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
- import { StyledFilterComboboxInline, StyledFilterComboboxInlineComboboxWrapper, StyledFilterComboboxInlineLabel, StyledFilterComboboxWrapper, StyledFilterContent, StyledFilterSort, StyledFilterSortText } from './FilterContent.styles';
1
+ import React, { useCallback, useEffect, useMemo, useRef } from 'react';
2
+ import { StyledFilterContentControlWrapper, StyledFilterContentLabel, StyledFilterContentLabeledRow, StyledFilterContent } from './FilterContent.styles';
4
3
  import Input from '../../input/Input';
5
4
  import Icon from '../../icon/Icon';
6
5
  import FilterButtons from '../../filter-buttons/FilterButtons';
@@ -8,6 +7,7 @@ import ComboBox from '../../combobox/ComboBox';
8
7
  import Checkbox from '../../checkbox/Checkbox';
9
8
  import { Textstring, TextstringProvider, ttsToITextString } from '@chayns-components/textstring';
10
9
  import textStrings from '../../../constants/textStrings';
10
+ import { getSortComboBoxLists } from './FilterContent.utils';
11
11
  const FilterContent = ({
12
12
  searchConfig,
13
13
  sortConfig,
@@ -16,9 +16,7 @@ const FilterContent = ({
16
16
  comboboxConfig,
17
17
  shouldAutoFocus
18
18
  }) => {
19
- const sortTextRef = useRef(null);
20
19
  const searchRef = useRef(null);
21
- const [sortTextWidth, setSortTextWidth] = useState(0);
22
20
  const ts = textStrings.components.filter.filterContent;
23
21
  const handleSelectSortItem = useCallback(item => {
24
22
  if (!item) {
@@ -35,11 +33,6 @@ const FilterContent = ({
35
33
  });
36
34
  }
37
35
  }, [sortConfig]);
38
- useEffect(() => {
39
- if (sortTextRef.current) {
40
- setSortTextWidth(sortTextRef.current.clientWidth + 20);
41
- }
42
- }, []);
43
36
  useEffect(() => {
44
37
  if (shouldAutoFocus) {
45
38
  searchRef.current?.focus();
@@ -58,34 +51,20 @@ const FilterContent = ({
58
51
  leftElement: /*#__PURE__*/React.createElement(Icon, {
59
52
  icons: ['fa fa-search']
60
53
  })
61
- }), filterButtonConfig && /*#__PURE__*/React.createElement(FilterButtons, filterButtonConfig), sortConfig && /*#__PURE__*/React.createElement(StyledFilterSort, null, /*#__PURE__*/React.createElement(StyledFilterSortText, {
62
- ref: sortTextRef
63
- }, /*#__PURE__*/React.createElement(Textstring, {
54
+ }), filterButtonConfig && /*#__PURE__*/React.createElement(FilterButtons, filterButtonConfig), sortConfig && /*#__PURE__*/React.createElement(StyledFilterContentLabeledRow, null, /*#__PURE__*/React.createElement(StyledFilterContentLabel, null, /*#__PURE__*/React.createElement(Textstring, {
64
55
  textstring: ttsToITextString(ts.sort)
65
- })), /*#__PURE__*/React.createElement(StyledFilterComboboxWrapper, {
66
- $textWidth: sortTextWidth
67
- }, /*#__PURE__*/React.createElement(ComboBox, {
68
- lists: [{
69
- list: sortConfig.items.map(({
70
- text,
71
- id
72
- }) => ({
73
- text,
74
- value: id
75
- }))
76
- }],
56
+ })), /*#__PURE__*/React.createElement(StyledFilterContentControlWrapper, null, /*#__PURE__*/React.createElement(ComboBox, {
57
+ lists: getSortComboBoxLists(sortConfig),
77
58
  placeholder: "",
78
59
  selectedItem: {
79
60
  text: sortConfig.selectedItem.text,
80
61
  value: sortConfig.selectedItem.id
81
62
  },
82
63
  onSelect: handleSelectSortItem
83
- }))), comboboxConfig && /*#__PURE__*/React.createElement(StyledFilterComboboxInline, null, /*#__PURE__*/React.createElement(StyledFilterComboboxInlineLabel, null, comboboxConfig.label), /*#__PURE__*/React.createElement(StyledFilterComboboxInlineComboboxWrapper, null, /*#__PURE__*/React.createElement(ComboBox, _extends({
84
- shouldUseCurrentItemWidth: true
85
- }, comboboxConfig)))), checkboxConfig &&
64
+ }))), comboboxConfig && /*#__PURE__*/React.createElement(StyledFilterContentLabeledRow, null, /*#__PURE__*/React.createElement(StyledFilterContentLabel, null, comboboxConfig.label), /*#__PURE__*/React.createElement(StyledFilterContentControlWrapper, null, /*#__PURE__*/React.createElement(ComboBox, comboboxConfig))), checkboxConfig &&
86
65
  /*#__PURE__*/
87
66
  // eslint-disable-next-line react/jsx-props-no-spreading
88
- React.createElement(Checkbox, checkboxConfig))), [checkboxConfig, comboboxConfig, filterButtonConfig, handleSelectSortItem, searchConfig, sortConfig, sortTextWidth, ts.input.placeholder, ts.sort]);
67
+ React.createElement(Checkbox, checkboxConfig))), [checkboxConfig, comboboxConfig, filterButtonConfig, handleSelectSortItem, searchConfig, sortConfig, ts.input.placeholder, ts.sort]);
89
68
  };
90
69
  FilterContent.displayName = 'FilterContent';
91
70
  export default FilterContent;