@chayns-components/core 5.0.16 → 5.0.18
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/lib/cjs/components/combobox/ComboBox.js +12 -4
- package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
- package/lib/cjs/components/sharing-button/SharingButton.js +3 -2
- package/lib/cjs/components/sharing-button/SharingButton.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.js +12 -4
- package/lib/esm/components/combobox/ComboBox.js.map +1 -1
- package/lib/esm/components/sharing-button/SharingButton.js +3 -2
- package/lib/esm/components/sharing-button/SharingButton.js.map +1 -1
- package/lib/types/components/combobox/ComboBox.d.ts +8 -0
- package/lib/types/components/sharing-button/SharingButton.d.ts +2 -1
- package/package.json +2 -2
|
@@ -33,6 +33,8 @@ const ComboBox = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
33
33
|
prefix,
|
|
34
34
|
container,
|
|
35
35
|
selectedItem,
|
|
36
|
+
onHide,
|
|
37
|
+
onShow,
|
|
36
38
|
shouldShowBigImage,
|
|
37
39
|
shouldShowClearIcon,
|
|
38
40
|
shouldShowRoundImage,
|
|
@@ -101,11 +103,17 @@ const ComboBox = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
101
103
|
onInputBlur === null || onInputBlur === void 0 || onInputBlur(event);
|
|
102
104
|
}, [onInputBlur]);
|
|
103
105
|
const handleOpen = (0, _react.useCallback)(() => {
|
|
106
|
+
if (typeof onShow === 'function') {
|
|
107
|
+
onShow();
|
|
108
|
+
}
|
|
104
109
|
setIsAnimating(true);
|
|
105
|
-
}, []);
|
|
110
|
+
}, [onShow]);
|
|
106
111
|
const handleClose = (0, _react.useCallback)(() => {
|
|
112
|
+
if (typeof onHide === 'function') {
|
|
113
|
+
onHide();
|
|
114
|
+
}
|
|
107
115
|
setIsAnimating(false);
|
|
108
|
-
}, []);
|
|
116
|
+
}, [onHide]);
|
|
109
117
|
|
|
110
118
|
/**
|
|
111
119
|
* This function sets the selected item
|
|
@@ -120,13 +128,13 @@ const ComboBox = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
120
128
|
void onSelectResult.then(shouldPreventSelection => {
|
|
121
129
|
if (shouldPreventSelection) return;
|
|
122
130
|
setInternalSelectedItem(itemToSelect);
|
|
123
|
-
|
|
131
|
+
handleClose();
|
|
124
132
|
});
|
|
125
133
|
return;
|
|
126
134
|
}
|
|
127
135
|
}
|
|
128
136
|
setInternalSelectedItem(itemToSelect);
|
|
129
|
-
|
|
137
|
+
handleClose();
|
|
130
138
|
}, [onSelect]);
|
|
131
139
|
const handleClear = (0, _react.useCallback)(event => {
|
|
132
140
|
event.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox.js","names":["_chaynsApi","require","_react","_interopRequireWildcard","_calculate","_environment","_AreaContextProvider","_Icon","_interopRequireDefault","_ComboBoxItem","_ComboBox","_DropdownBodyWrapper","_dropdown","_element","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ComboBoxSize","exports","ComboBox","forwardRef","bodyWidth","direction","DropdownDirection","RIGHT","isDisabled","lists","maxHeight","onSelect","placeholder","prefix","container","selectedItem","shouldShowBigImage","shouldShowClearIcon","shouldShowRoundImage","onInputFocus","prefixMinWidth","size","NORMAL","shouldUseFullWidth","onInputChange","shouldUseCurrentItemWidth","onInputBlur","shouldShowTransparentBackground","inputValue","shouldDropDownUseMaxItemWidth","ref","internalSelectedItem","setInternalSelectedItem","useState","isAnimating","setIsAnimating","minWidth","setMinWidth","undefined","bodyMinWidth","setBodyMinWidth","focusedIndex","setFocusedIndex","isInputFocused","useRef","styledComboBoxElementRef","contentRef","parentSize","useElementSize","shouldUseParentElement","functions","useFunctions","values","useValues","isTouch","useIsTouch","browser","useDevice","areaProvider","useContext","AreaContext","useEffect","width","shouldChangeColor","useMemo","shouldDisableActions","combinedLists","flatMap","list","length","some","item","value","contentHeight","flatItems","height","reduce","isBigItem","subtext","trim","handleInputFocus","useCallback","event","current","handleInputBlur","handleOpen","handleClose","handleSetSelectedItem","itemToSelect","onSelectResult","Promise","then","shouldPreventSelection","handleClear","preventDefault","stopPropagation","handleKeyDown","key","_contentRef$current","children","stepDirection","newIndex","attempts","newElement","shouldSkip","id","startsWith","endsWith","prevElement","tabIndex","focusedElement","focus","_contentRef$current2","element","newSelectedItem","find","String","replace","document","addEventListener","removeEventListener","_styledComboBoxElemen","allItems","maxItemWidth","calculateMaxComboBoxItemWidth","text","hasImage","imageUrl","hasIcon","icons","parentWidth","parentElement","getBoundingClientRect","paddingWidth","imageWidth","iconWidth","prefixWidth","prefixTextWidth","Math","max","calculatedWidth","tmpMinWidth","tmpBodyMinWidth","internalSelectedItemWidth","itemWidth","placeholderImageUrl","placeholderIcon","placeholderText","shouldShowRoundPlaceholderImage","selectedItemList","handleHeaderClick","useImperativeHandle","hide","show","comboBoxGroups","map","createElement","Fragment","groupName","StyledComboBoxTopic","isSelected","StyledComboBox","$minWidth","$shouldUseFullWidth","$shouldUseCurrentItemWidth","StyledComboBoxHeader","$direction","onClick","$isOpen","$isTouch","$size","$shouldShowTransparentBackground","$isDisabled","$shouldChangeColor","$shouldShowBigImage","StyledComboBoxPrefixAndPlaceholderWrapper","StyledComboBoxPrefix","$prefixMinWidth","StyledComboBoxPlaceholder","$shouldReduceOpacity","StyledComboBoxPlaceholderImage","src","$shouldShowRoundImage","StyledComboBoxInput","disabled","onChange","onBlur","onFocus","StyledComboBoxPlaceholderText","suffixElement","StyledComboBoxClearIconWrapper","StyledComboBoxIconWrapper","$shouldShowBorderLeft","anchorElement","onClose","shouldShowDropdown","minBodyWidth","StyledComboBoxBody","$maxHeight","$browser","name","displayName","_default"],"sources":["../../../../src/components/combobox/ComboBox.tsx"],"sourcesContent":["import { useDevice, useFunctions, useValues } from 'chayns-api';\nimport React, {\n ChangeEventHandler,\n type CSSProperties,\n FocusEventHandler,\n forwardRef,\n Fragment,\n ReactHTML,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { BrowserName } from '../../types/chayns';\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';\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 * 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 * The size of the ComboBox.\n */\n size?: ComboBoxSize;\n /**\n * Optional min width for the prefix element.\n */\n prefixMinWidth?: number;\n};\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 selectedItem,\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 { browser } = useDevice();\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 setIsAnimating(true);\n }, []);\n\n const handleClose = useCallback(() => {\n setIsAnimating(false);\n }, []);\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 setIsAnimating(false);\n });\n\n return;\n }\n }\n\n setInternalSelectedItem(itemToSelect);\n setIsAnimating(false);\n },\n [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 hasImage = [selectedItem, ...allItems].some((item) => item?.imageUrl);\n const hasIcon = [selectedItem, ...allItems].some((item) => item?.icons);\n\n const parentWidth =\n styledComboBoxElementRef.current?.parentElement?.getBoundingClientRect().width ?? 0;\n\n const paddingWidth = 20 + 2 + 40 + 40; // padding + border + arrow icon + optional clear icon\n const imageWidth = hasImage ? 32 : 0; // image width + gap if images present\n const iconWidth = hasIcon ? 40 : 0; // icon width + gap if icons present\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 =\n maxItemWidth + paddingWidth + imageWidth + iconWidth + 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 =\n internalSelectedItemWidth + paddingWidth + imageWidth + iconWidth + 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 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 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 $browser={browser?.name as BrowserName}\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 handleClose,\n container,\n bodyMinWidth,\n maxHeight,\n browser?.name,\n comboBoxGroups,\n ],\n );\n },\n);\n\nComboBox.displayName = 'ComboBox';\n\nexport default ComboBox;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAkBA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAC,sBAAA,CAAAP,OAA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b,CACnB,EACD,CACItH,QAAQ,EACRb,kBAAkB,EAClBE,yBAAyB,EACzBpB,SAAS,EACTiJ,iBAAiB,EACjBpH,WAAW,EACXoB,OAAO,EACPjC,IAAI,EACJM,+BAA+B,EAC/BnB,UAAU,EACVuD,iBAAiB,EACjB/C,kBAAkB,EAClBH,MAAM,EACNO,cAAc,EACdL,YAAY,EACZgB,oBAAoB,EACpBkH,mBAAmB,EACnBG,+BAA+B,EAC/BF,eAAe,EACftH,UAAU,EACVJ,aAAa,EACb4D,eAAe,EACfJ,gBAAgB,EAChBmE,eAAe,EACflI,mBAAmB,EACnB4E,WAAW,EACX5B,oBAAoB,EACpB7D,SAAS,EACTqE,aAAa,EACba,WAAW,EACXxE,SAAS,EACTyB,YAAY,EACZ7B,SAAS,EACT8C,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEgJ,IAAI,EACb9C,cAAc,CAEtB,CAAC;AACL,CACJ,CAAC;AAEDxJ,QAAQ,CAACuM,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAzM,OAAA,CAAAlB,OAAA,GAEnBmB,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ComboBox.js","names":["_chaynsApi","require","_react","_interopRequireWildcard","_calculate","_environment","_AreaContextProvider","_Icon","_interopRequireDefault","_ComboBoxItem","_ComboBox","_DropdownBodyWrapper","_dropdown","_element","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ComboBoxSize","exports","ComboBox","forwardRef","bodyWidth","direction","DropdownDirection","RIGHT","isDisabled","lists","maxHeight","onSelect","placeholder","prefix","container","selectedItem","onHide","onShow","shouldShowBigImage","shouldShowClearIcon","shouldShowRoundImage","onInputFocus","prefixMinWidth","size","NORMAL","shouldUseFullWidth","onInputChange","shouldUseCurrentItemWidth","onInputBlur","shouldShowTransparentBackground","inputValue","shouldDropDownUseMaxItemWidth","ref","internalSelectedItem","setInternalSelectedItem","useState","isAnimating","setIsAnimating","minWidth","setMinWidth","undefined","bodyMinWidth","setBodyMinWidth","focusedIndex","setFocusedIndex","isInputFocused","useRef","styledComboBoxElementRef","contentRef","parentSize","useElementSize","shouldUseParentElement","functions","useFunctions","values","useValues","isTouch","useIsTouch","browser","useDevice","areaProvider","useContext","AreaContext","useEffect","width","shouldChangeColor","useMemo","shouldDisableActions","combinedLists","flatMap","list","length","some","item","value","contentHeight","flatItems","height","reduce","isBigItem","subtext","trim","handleInputFocus","useCallback","event","current","handleInputBlur","handleOpen","handleClose","handleSetSelectedItem","itemToSelect","onSelectResult","Promise","then","shouldPreventSelection","handleClear","preventDefault","stopPropagation","handleKeyDown","key","_contentRef$current","children","stepDirection","newIndex","attempts","newElement","shouldSkip","id","startsWith","endsWith","prevElement","tabIndex","focusedElement","focus","_contentRef$current2","element","newSelectedItem","find","String","replace","document","addEventListener","removeEventListener","_styledComboBoxElemen","allItems","maxItemWidth","calculateMaxComboBoxItemWidth","text","hasImage","imageUrl","hasIcon","icons","parentWidth","parentElement","getBoundingClientRect","paddingWidth","imageWidth","iconWidth","prefixWidth","prefixTextWidth","Math","max","calculatedWidth","tmpMinWidth","tmpBodyMinWidth","internalSelectedItemWidth","itemWidth","placeholderImageUrl","placeholderIcon","placeholderText","shouldShowRoundPlaceholderImage","selectedItemList","handleHeaderClick","useImperativeHandle","hide","show","comboBoxGroups","map","createElement","Fragment","groupName","StyledComboBoxTopic","isSelected","StyledComboBox","$minWidth","$shouldUseFullWidth","$shouldUseCurrentItemWidth","StyledComboBoxHeader","$direction","onClick","$isOpen","$isTouch","$size","$shouldShowTransparentBackground","$isDisabled","$shouldChangeColor","$shouldShowBigImage","StyledComboBoxPrefixAndPlaceholderWrapper","StyledComboBoxPrefix","$prefixMinWidth","StyledComboBoxPlaceholder","$shouldReduceOpacity","StyledComboBoxPlaceholderImage","src","$shouldShowRoundImage","StyledComboBoxInput","disabled","onChange","onBlur","onFocus","StyledComboBoxPlaceholderText","suffixElement","StyledComboBoxClearIconWrapper","StyledComboBoxIconWrapper","$shouldShowBorderLeft","anchorElement","onClose","shouldShowDropdown","minBodyWidth","StyledComboBoxBody","$maxHeight","$browser","name","displayName","_default"],"sources":["../../../../src/components/combobox/ComboBox.tsx"],"sourcesContent":["import { useDevice, useFunctions, useValues } from 'chayns-api';\nimport React, {\n ChangeEventHandler,\n type CSSProperties,\n FocusEventHandler,\n forwardRef,\n Fragment,\n ReactHTML,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { BrowserName } from '../../types/chayns';\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';\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 * The size of the ComboBox.\n */\n size?: ComboBoxSize;\n /**\n * Optional min width for the prefix element.\n */\n prefixMinWidth?: number;\n};\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 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 { browser } = useDevice();\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 [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 hasImage = [selectedItem, ...allItems].some((item) => item?.imageUrl);\n const hasIcon = [selectedItem, ...allItems].some((item) => item?.icons);\n\n const parentWidth =\n styledComboBoxElementRef.current?.parentElement?.getBoundingClientRect().width ?? 0;\n\n const paddingWidth = 20 + 2 + 40 + 40; // padding + border + arrow icon + optional clear icon\n const imageWidth = hasImage ? 32 : 0; // image width + gap if images present\n const iconWidth = hasIcon ? 40 : 0; // icon width + gap if icons present\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 =\n maxItemWidth + paddingWidth + imageWidth + iconWidth + 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 =\n internalSelectedItemWidth + paddingWidth + imageWidth + iconWidth + 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 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 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 $browser={browser?.name as BrowserName}\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 handleClose,\n container,\n bodyMinWidth,\n maxHeight,\n browser?.name,\n comboBoxGroups,\n ],\n );\n },\n);\n\nComboBox.displayName = 'ComboBox';\n\nexport default ComboBox;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAkBA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAcA,IAAAU,oBAAA,GAAAH,sBAAA,CAAAP,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AACA,IAAAY,QAAA,GAAAZ,OAAA;AAAqD,SAAAO,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAX,wBAAAW,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAf,uBAAA,YAAAA,CAAAW,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CA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M,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAA3M,OAAA,CAAAlB,OAAA,GAEnBmB,QAAQ","ignoreList":[]}
|
|
@@ -13,7 +13,8 @@ const SharingButton = ({
|
|
|
13
13
|
link,
|
|
14
14
|
alignment,
|
|
15
15
|
container,
|
|
16
|
-
children
|
|
16
|
+
children,
|
|
17
|
+
isDisabled
|
|
17
18
|
}) => {
|
|
18
19
|
const contextMenuRef = _react.default.useRef(null);
|
|
19
20
|
const [isButtonDisabled, setIsButtonDisabled] = _react.default.useState(false);
|
|
@@ -36,7 +37,7 @@ const SharingButton = ({
|
|
|
36
37
|
onHide: handleOnHide
|
|
37
38
|
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
38
39
|
onClick: handleButtonClick,
|
|
39
|
-
isDisabled: isButtonDisabled
|
|
40
|
+
isDisabled: isButtonDisabled || isDisabled
|
|
40
41
|
}, children)));
|
|
41
42
|
};
|
|
42
43
|
var _default = exports.default = SharingButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharingButton.js","names":["_react","_interopRequireDefault","require","_SharingContextMenu","_SharingButton","_Button","e","__esModule","default","SharingButton","link","alignment","container","children","contextMenuRef","React","useRef","isButtonDisabled","setIsButtonDisabled","useState","handleButtonClick","_contextMenuRef$curre","current","show","handleOnShow","handleOnHide","createElement","StyledSharingButtonContainer","ref","onShow","onHide","onClick","
|
|
1
|
+
{"version":3,"file":"SharingButton.js","names":["_react","_interopRequireDefault","require","_SharingContextMenu","_SharingButton","_Button","e","__esModule","default","SharingButton","link","alignment","container","children","isDisabled","contextMenuRef","React","useRef","isButtonDisabled","setIsButtonDisabled","useState","handleButtonClick","_contextMenuRef$curre","current","show","handleOnShow","handleOnHide","createElement","StyledSharingButtonContainer","ref","onShow","onHide","onClick","_default","exports"],"sources":["../../../../src/components/sharing-button/SharingButton.tsx"],"sourcesContent":["import React, { FunctionComponent, PropsWithChildren } from 'react';\nimport { ContextMenuRef } from '../context-menu/ContextMenu.types';\nimport SharingContextMenu, {\n SharingContextMenuProps,\n} from '../sharing-context-menu/SharingContextMenu';\nimport { StyledSharingButtonContainer } from './SharingButton.styles';\nimport Button from '../button/Button';\nimport { ButtonProps } from '../button/Button.types';\n\nexport type SharingButtonProps = PropsWithChildren<\n Pick<SharingContextMenuProps, 'link' | 'alignment' | 'container'> &\n Pick<ButtonProps, 'isDisabled'>\n>;\n\nconst SharingButton: FunctionComponent<SharingButtonProps> = ({\n link,\n alignment,\n container,\n children,\n isDisabled,\n}) => {\n const contextMenuRef = React.useRef<ContextMenuRef>(null);\n const [isButtonDisabled, setIsButtonDisabled] = React.useState(false);\n\n const handleButtonClick = () => {\n contextMenuRef.current?.show();\n };\n\n const handleOnShow = () => {\n setIsButtonDisabled(true);\n };\n\n const handleOnHide = () => {\n setIsButtonDisabled(false);\n };\n\n return (\n <StyledSharingButtonContainer>\n <SharingContextMenu\n link={link}\n alignment={alignment}\n container={container}\n ref={contextMenuRef}\n onShow={handleOnShow}\n onHide={handleOnHide}\n >\n <Button onClick={handleButtonClick} isDisabled={isButtonDisabled || isDisabled}>\n {children}\n </Button>\n </SharingContextMenu>\n </StyledSharingButtonContainer>\n );\n};\n\nexport default SharingButton;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAGA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAsC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQtC,MAAMG,aAAoD,GAAGA,CAAC;EAC1DC,IAAI;EACJC,SAAS;EACTC,SAAS;EACTC,QAAQ;EACRC;AACJ,CAAC,KAAK;EACF,MAAMC,cAAc,GAAGC,cAAK,CAACC,MAAM,CAAiB,IAAI,CAAC;EACzD,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGH,cAAK,CAACI,QAAQ,CAAC,KAAK,CAAC;EAErE,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;IAAA,IAAAC,qBAAA;IAC5B,CAAAA,qBAAA,GAAAP,cAAc,CAACQ,OAAO,cAAAD,qBAAA,eAAtBA,qBAAA,CAAwBE,IAAI,CAAC,CAAC;EAClC,CAAC;EAED,MAAMC,YAAY,GAAGA,CAAA,KAAM;IACvBN,mBAAmB,CAAC,IAAI,CAAC;EAC7B,CAAC;EAED,MAAMO,YAAY,GAAGA,CAAA,KAAM;IACvBP,mBAAmB,CAAC,KAAK,CAAC;EAC9B,CAAC;EAED,oBACInB,MAAA,CAAAQ,OAAA,CAAAmB,aAAA,CAACvB,cAAA,CAAAwB,4BAA4B,qBACzB5B,MAAA,CAAAQ,OAAA,CAAAmB,aAAA,CAACxB,mBAAA,CAAAK,OAAkB;IACfE,IAAI,EAAEA,IAAK;IACXC,SAAS,EAAEA,SAAU;IACrBC,SAAS,EAAEA,SAAU;IACrBiB,GAAG,EAAEd,cAAe;IACpBe,MAAM,EAAEL,YAAa;IACrBM,MAAM,EAAEL;EAAa,gBAErB1B,MAAA,CAAAQ,OAAA,CAAAmB,aAAA,CAACtB,OAAA,CAAAG,OAAM;IAACwB,OAAO,EAAEX,iBAAkB;IAACP,UAAU,EAAEI,gBAAgB,IAAIJ;EAAW,GAC1ED,QACG,CACQ,CACM,CAAC;AAEvC,CAAC;AAAC,IAAAoB,QAAA,GAAAC,OAAA,CAAA1B,OAAA,GAEaC,aAAa","ignoreList":[]}
|
|
@@ -25,6 +25,8 @@ const ComboBox = /*#__PURE__*/forwardRef(({
|
|
|
25
25
|
prefix,
|
|
26
26
|
container,
|
|
27
27
|
selectedItem,
|
|
28
|
+
onHide,
|
|
29
|
+
onShow,
|
|
28
30
|
shouldShowBigImage,
|
|
29
31
|
shouldShowClearIcon,
|
|
30
32
|
shouldShowRoundImage,
|
|
@@ -93,11 +95,17 @@ const ComboBox = /*#__PURE__*/forwardRef(({
|
|
|
93
95
|
onInputBlur?.(event);
|
|
94
96
|
}, [onInputBlur]);
|
|
95
97
|
const handleOpen = useCallback(() => {
|
|
98
|
+
if (typeof onShow === 'function') {
|
|
99
|
+
onShow();
|
|
100
|
+
}
|
|
96
101
|
setIsAnimating(true);
|
|
97
|
-
}, []);
|
|
102
|
+
}, [onShow]);
|
|
98
103
|
const handleClose = useCallback(() => {
|
|
104
|
+
if (typeof onHide === 'function') {
|
|
105
|
+
onHide();
|
|
106
|
+
}
|
|
99
107
|
setIsAnimating(false);
|
|
100
|
-
}, []);
|
|
108
|
+
}, [onHide]);
|
|
101
109
|
|
|
102
110
|
/**
|
|
103
111
|
* This function sets the selected item
|
|
@@ -112,13 +120,13 @@ const ComboBox = /*#__PURE__*/forwardRef(({
|
|
|
112
120
|
void onSelectResult.then(shouldPreventSelection => {
|
|
113
121
|
if (shouldPreventSelection) return;
|
|
114
122
|
setInternalSelectedItem(itemToSelect);
|
|
115
|
-
|
|
123
|
+
handleClose();
|
|
116
124
|
});
|
|
117
125
|
return;
|
|
118
126
|
}
|
|
119
127
|
}
|
|
120
128
|
setInternalSelectedItem(itemToSelect);
|
|
121
|
-
|
|
129
|
+
handleClose();
|
|
122
130
|
}, [onSelect]);
|
|
123
131
|
const handleClear = useCallback(event => {
|
|
124
132
|
event.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox.js","names":["useDevice","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","selectedItem","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","browser","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","hasImage","imageUrl","hasIcon","icons","parentWidth","parentElement","getBoundingClientRect","paddingWidth","imageWidth","iconWidth","prefixWidth","prefixTextWidth","Math","max","calculatedWidth","tmpMinWidth","tmpBodyMinWidth","internalSelectedItemWidth","itemWidth","placeholderImageUrl","placeholderIcon","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","$browser","name","displayName"],"sources":["../../../../src/components/combobox/ComboBox.tsx"],"sourcesContent":["import { useDevice, useFunctions, useValues } from 'chayns-api';\nimport React, {\n ChangeEventHandler,\n type CSSProperties,\n FocusEventHandler,\n forwardRef,\n Fragment,\n ReactHTML,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { BrowserName } from '../../types/chayns';\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';\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 * 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 * The size of the ComboBox.\n */\n size?: ComboBoxSize;\n /**\n * Optional min width for the prefix element.\n */\n prefixMinWidth?: number;\n};\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 selectedItem,\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 { browser } = useDevice();\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 setIsAnimating(true);\n }, []);\n\n const handleClose = useCallback(() => {\n setIsAnimating(false);\n }, []);\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 setIsAnimating(false);\n });\n\n return;\n }\n }\n\n setInternalSelectedItem(itemToSelect);\n setIsAnimating(false);\n },\n [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 hasImage = [selectedItem, ...allItems].some((item) => item?.imageUrl);\n const hasIcon = [selectedItem, ...allItems].some((item) => item?.icons);\n\n const parentWidth =\n styledComboBoxElementRef.current?.parentElement?.getBoundingClientRect().width ?? 0;\n\n const paddingWidth = 20 + 2 + 40 + 40; // padding + border + arrow icon + optional clear icon\n const imageWidth = hasImage ? 32 : 0; // image width + gap if images present\n const iconWidth = hasIcon ? 40 : 0; // icon width + gap if icons present\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 =\n maxItemWidth + paddingWidth + imageWidth + iconWidth + 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 =\n internalSelectedItemWidth + paddingWidth + imageWidth + iconWidth + 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 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 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 $browser={browser?.name as BrowserName}\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 handleClose,\n container,\n bodyMinWidth,\n maxHeight,\n browser?.name,\n comboBoxGroups,\n ],\n );\n },\n);\n\nComboBox.displayName = 'ComboBox';\n\nexport default ComboBox;\n"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G,UAAU;AAEjC,eAAexK,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ComboBox.js","names":["useDevice","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","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","browser","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","hasImage","imageUrl","hasIcon","icons","parentWidth","parentElement","getBoundingClientRect","paddingWidth","imageWidth","iconWidth","prefixWidth","prefixTextWidth","Math","max","calculatedWidth","tmpMinWidth","tmpBodyMinWidth","internalSelectedItemWidth","itemWidth","placeholderImageUrl","placeholderIcon","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","$browser","name","displayName"],"sources":["../../../../src/components/combobox/ComboBox.tsx"],"sourcesContent":["import { useDevice, useFunctions, useValues } from 'chayns-api';\nimport React, {\n ChangeEventHandler,\n type CSSProperties,\n FocusEventHandler,\n forwardRef,\n Fragment,\n ReactHTML,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { BrowserName } from '../../types/chayns';\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';\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 * The size of the ComboBox.\n */\n size?: ComboBoxSize;\n /**\n * Optional min width for the prefix element.\n */\n prefixMinWidth?: number;\n};\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 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 { browser } = useDevice();\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 [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 hasImage = [selectedItem, ...allItems].some((item) => item?.imageUrl);\n const hasIcon = [selectedItem, ...allItems].some((item) => item?.icons);\n\n const parentWidth =\n styledComboBoxElementRef.current?.parentElement?.getBoundingClientRect().width ?? 0;\n\n const paddingWidth = 20 + 2 + 40 + 40; // padding + border + arrow icon + optional clear icon\n const imageWidth = hasImage ? 32 : 0; // image width + gap if images present\n const iconWidth = hasIcon ? 40 : 0; // icon width + gap if icons present\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 =\n maxItemWidth + paddingWidth + imageWidth + iconWidth + 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 =\n internalSelectedItemWidth + paddingWidth + imageWidth + iconWidth + 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 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 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 $browser={browser?.name as BrowserName}\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 handleClose,\n container,\n bodyMinWidth,\n maxHeight,\n browser?.name,\n comboBoxGroups,\n ],\n );\n },\n);\n\nComboBox.displayName = 'ComboBox';\n\nexport default ComboBox;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,YAAY,EAAEC,SAAS,QAAQ,YAAY;AAC/D,OAAOC,KAAK,IAIRC,UAAU,EACVC,QAAQ,EAGRC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AAGd,SAASC,6BAA6B,QAAQ,uBAAuB;AACrE,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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SAAS,EAAE5I,SAAS,IAAImC,YAAa;IACrCoI,QAAQ,EAAExH,OAAO,EAAEyH,IAAoB;IACvC7I,GAAG,EAAEc,UAAW;IAChBqD,QAAQ,EAAE;EAAE,GAEXyC,cACe,CACH,CAEb,CACnB,EACD,CACIvG,QAAQ,EACRZ,kBAAkB,EAClBE,yBAAyB,EACzBrB,SAAS,EACTmI,iBAAiB,EACjBtG,WAAW,EACXgB,OAAO,EACP5B,IAAI,EACJM,+BAA+B,EAC/BrB,UAAU,EACV+C,iBAAiB,EACjBrC,kBAAkB,EAClBL,MAAM,EACNS,cAAc,EACdP,YAAY,EACZkB,oBAAoB,EACpBmG,mBAAmB,EACnBG,+BAA+B,EAC/BF,eAAe,EACfvG,UAAU,EACVJ,aAAa,EACbgD,eAAe,EACfH,gBAAgB,EAChB+D,eAAe,EACfnH,mBAAmB,EACnBgE,WAAW,EACX3B,oBAAoB,EACpBnD,SAAS,EACT2D,aAAa,EACbY,WAAW,EACX9D,SAAS,EACT0B,YAAY,EACZ9B,SAAS,EACT0C,OAAO,EAAEyH,IAAI,EACbjC,cAAc,CAEtB,CAAC;AACL,CACJ,CAAC;AAEDxI,QAAQ,CAAC0K,WAAW,GAAG,UAAU;AAEjC,eAAe1K,QAAQ","ignoreList":[]}
|
|
@@ -6,7 +6,8 @@ const SharingButton = ({
|
|
|
6
6
|
link,
|
|
7
7
|
alignment,
|
|
8
8
|
container,
|
|
9
|
-
children
|
|
9
|
+
children,
|
|
10
|
+
isDisabled
|
|
10
11
|
}) => {
|
|
11
12
|
const contextMenuRef = React.useRef(null);
|
|
12
13
|
const [isButtonDisabled, setIsButtonDisabled] = React.useState(false);
|
|
@@ -28,7 +29,7 @@ const SharingButton = ({
|
|
|
28
29
|
onHide: handleOnHide
|
|
29
30
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
30
31
|
onClick: handleButtonClick,
|
|
31
|
-
isDisabled: isButtonDisabled
|
|
32
|
+
isDisabled: isButtonDisabled || isDisabled
|
|
32
33
|
}, children)));
|
|
33
34
|
};
|
|
34
35
|
export default SharingButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharingButton.js","names":["React","SharingContextMenu","StyledSharingButtonContainer","Button","SharingButton","link","alignment","container","children","contextMenuRef","useRef","isButtonDisabled","setIsButtonDisabled","useState","handleButtonClick","current","show","handleOnShow","handleOnHide","createElement","ref","onShow","onHide","onClick"
|
|
1
|
+
{"version":3,"file":"SharingButton.js","names":["React","SharingContextMenu","StyledSharingButtonContainer","Button","SharingButton","link","alignment","container","children","isDisabled","contextMenuRef","useRef","isButtonDisabled","setIsButtonDisabled","useState","handleButtonClick","current","show","handleOnShow","handleOnHide","createElement","ref","onShow","onHide","onClick"],"sources":["../../../../src/components/sharing-button/SharingButton.tsx"],"sourcesContent":["import React, { FunctionComponent, PropsWithChildren } from 'react';\nimport { ContextMenuRef } from '../context-menu/ContextMenu.types';\nimport SharingContextMenu, {\n SharingContextMenuProps,\n} from '../sharing-context-menu/SharingContextMenu';\nimport { StyledSharingButtonContainer } from './SharingButton.styles';\nimport Button from '../button/Button';\nimport { ButtonProps } from '../button/Button.types';\n\nexport type SharingButtonProps = PropsWithChildren<\n Pick<SharingContextMenuProps, 'link' | 'alignment' | 'container'> &\n Pick<ButtonProps, 'isDisabled'>\n>;\n\nconst SharingButton: FunctionComponent<SharingButtonProps> = ({\n link,\n alignment,\n container,\n children,\n isDisabled,\n}) => {\n const contextMenuRef = React.useRef<ContextMenuRef>(null);\n const [isButtonDisabled, setIsButtonDisabled] = React.useState(false);\n\n const handleButtonClick = () => {\n contextMenuRef.current?.show();\n };\n\n const handleOnShow = () => {\n setIsButtonDisabled(true);\n };\n\n const handleOnHide = () => {\n setIsButtonDisabled(false);\n };\n\n return (\n <StyledSharingButtonContainer>\n <SharingContextMenu\n link={link}\n alignment={alignment}\n container={container}\n ref={contextMenuRef}\n onShow={handleOnShow}\n onHide={handleOnHide}\n >\n <Button onClick={handleButtonClick} isDisabled={isButtonDisabled || isDisabled}>\n {children}\n </Button>\n </SharingContextMenu>\n </StyledSharingButtonContainer>\n );\n};\n\nexport default SharingButton;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAgD,OAAO;AAEnE,OAAOC,kBAAkB,MAElB,4CAA4C;AACnD,SAASC,4BAA4B,QAAQ,wBAAwB;AACrE,OAAOC,MAAM,MAAM,kBAAkB;AAQrC,MAAMC,aAAoD,GAAGA,CAAC;EAC1DC,IAAI;EACJC,SAAS;EACTC,SAAS;EACTC,QAAQ;EACRC;AACJ,CAAC,KAAK;EACF,MAAMC,cAAc,GAAGV,KAAK,CAACW,MAAM,CAAiB,IAAI,CAAC;EACzD,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGb,KAAK,CAACc,QAAQ,CAAC,KAAK,CAAC;EAErE,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;IAC5BL,cAAc,CAACM,OAAO,EAAEC,IAAI,CAAC,CAAC;EAClC,CAAC;EAED,MAAMC,YAAY,GAAGA,CAAA,KAAM;IACvBL,mBAAmB,CAAC,IAAI,CAAC;EAC7B,CAAC;EAED,MAAMM,YAAY,GAAGA,CAAA,KAAM;IACvBN,mBAAmB,CAAC,KAAK,CAAC;EAC9B,CAAC;EAED,oBACIb,KAAA,CAAAoB,aAAA,CAAClB,4BAA4B,qBACzBF,KAAA,CAAAoB,aAAA,CAACnB,kBAAkB;IACfI,IAAI,EAAEA,IAAK;IACXC,SAAS,EAAEA,SAAU;IACrBC,SAAS,EAAEA,SAAU;IACrBc,GAAG,EAAEX,cAAe;IACpBY,MAAM,EAAEJ,YAAa;IACrBK,MAAM,EAAEJ;EAAa,gBAErBnB,KAAA,CAAAoB,aAAA,CAACjB,MAAM;IAACqB,OAAO,EAAET,iBAAkB;IAACN,UAAU,EAAEG,gBAAgB,IAAIH;EAAW,GAC1ED,QACG,CACQ,CACM,CAAC;AAEvC,CAAC;AAED,eAAeJ,aAAa","ignoreList":[]}
|
|
@@ -76,6 +76,14 @@ export type ComboBoxProps = {
|
|
|
76
76
|
* Function that should be executed when an item is selected. If the function returns false, the item will not be selected.
|
|
77
77
|
*/
|
|
78
78
|
onSelect?: (comboboxItem?: IComboBoxItem) => Promise<boolean> | boolean | void;
|
|
79
|
+
/**
|
|
80
|
+
* Function to be executed when the content of the `ComboBox` is shown.
|
|
81
|
+
*/
|
|
82
|
+
onShow?: () => void;
|
|
83
|
+
/**
|
|
84
|
+
* Function to be executed when the content of the `ComboBox` is hidden.
|
|
85
|
+
*/
|
|
86
|
+
onHide?: () => void;
|
|
79
87
|
/**
|
|
80
88
|
* A text that should be displayed when no item is selected.
|
|
81
89
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent, PropsWithChildren } from 'react';
|
|
2
2
|
import { SharingContextMenuProps } from '../sharing-context-menu/SharingContextMenu';
|
|
3
|
-
|
|
3
|
+
import { ButtonProps } from '../button/Button.types';
|
|
4
|
+
export type SharingButtonProps = PropsWithChildren<Pick<SharingContextMenuProps, 'link' | 'alignment' | 'container'> & Pick<ButtonProps, 'isDisabled'>>;
|
|
4
5
|
declare const SharingButton: FunctionComponent<SharingButtonProps>;
|
|
5
6
|
export default SharingButton;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.18",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "3380d7cf30a12be15e33960526b0ef75caad5c1b"
|
|
90
90
|
}
|