@chayns-components/core 5.0.0-beta.1170 → 5.0.0-beta.1172

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.
@@ -14,10 +14,10 @@ var _ListItemBody = _interopRequireDefault(require("./list-item-body/ListItemBod
14
14
  var _ListItemHead = _interopRequireDefault(require("./list-item-head/ListItemHead"));
15
15
  var _ListItem = require("./ListItem.styles");
16
16
  var _Tooltip = _interopRequireDefault(require("../../tooltip/Tooltip"));
17
- var _reactResizeDetector = require("react-resize-detector");
18
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
18
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
20
19
  const ListItem = ({
20
+ backgroundColor,
21
21
  careOfLocationId,
22
22
  children,
23
23
  cornerImage,
@@ -62,9 +62,7 @@ const ListItem = ({
62
62
  } = (0, _react2.useContext)(_Accordion.AccordionContext);
63
63
  const areaProvider = (0, _react2.useContext)(_AreaContextProvider.AreaContext);
64
64
  const isInitialRenderRef = (0, _react2.useRef)(true);
65
- const {
66
- ref: listItemRef
67
- } = (0, _reactResizeDetector.useResizeDetector)();
65
+ const listItemRef = (0, _react2.useRef)(null);
68
66
  const uuid = (0, _uuid.useUuid)();
69
67
  const isExpandable = children !== undefined;
70
68
  const isItemOpen = isOpen ?? openItemUuid === uuid;
@@ -153,6 +151,7 @@ const ListItem = ({
153
151
  key: `list-item-${uuid}`,
154
152
  ref: listItemRef,
155
153
  layout: shouldPreventLayoutAnimation ? undefined : 'position',
154
+ $backgroundColor: backgroundColor,
156
155
  $isClickable: isClickable,
157
156
  $isInAccordion: typeof isParentAccordionWrapped === 'boolean' && !shouldDisablePadding,
158
157
  $isOpen: isItemOpen,
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.js","names":["_react","require","_react2","_interopRequireWildcard","_uuid","_Accordion","_AreaContextProvider","_List","_ListItemBody","_interopRequireDefault","_ListItemHead","_ListItem","_Tooltip","_reactResizeDetector","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ListItem","careOfLocationId","children","cornerImage","hoverItem","icons","imageBackground","images","isDefaultOpen","isOpen","isTitleGreyed","leftElements","onClick","onClose","onLongPress","onOpen","rightElements","shouldShowTooltipOnTitleOverflow","shouldForceBackground","shouldForceBottomLine","shouldForceHover","shouldHideBottomLine","shouldOpenImageOnClick","shouldHideImageOrIconBackground","shouldHideIndicator","shouldPreventLayoutAnimation","shouldRenderClosed","shouldShowRoundImageOrIcon","shouldShowSeparatorBelow","subtitle","title","titleElement","incrementExpandableItemCount","isAnyItemExpandable","isWrapped","openItemUuid","updateOpenItemUuid","useContext","ListContext","isParentAccordionWrapped","AccordionContext","areaProvider","AreaContext","isInitialRenderRef","useRef","ref","listItemRef","useResizeDetector","uuid","useUuid","isExpandable","undefined","isItemOpen","onCloseRef","onOpenRef","shouldEnableTooltip","setShouldEnableTooltip","useState","shouldDisablePadding","useMemo","shouldDisableListItemPadding","useEffect","current","handleHeadClick","useCallback","event","shouldOnlyOpen","isClickable","headContent","createElement","StyledMotionListItem","animate","height","opacity","className","exit","initial","key","layout","$isClickable","$isInAccordion","$isOpen","$isWrapped","$shouldForceBackground","$shouldForceBottomLine","$shouldHideBottomLine","$shouldHideIndicator","$shouldShowSeparatorBelow","shouldUseFullWidth","isDisabled","item","StyledListItemTooltip","style","cursor","AnimatePresence","id","shouldHideBody","displayName","_default","exports"],"sources":["../../../../../src/components/list/list-item/ListItem.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n CSSProperties,\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IListItemRightElements } from '../../../types/list';\nimport { AccordionContext } from '../../accordion/Accordion';\nimport AreaContextProvider, { AreaContext } from '../../area-provider/AreaContextProvider';\nimport { ListContext } from '../List';\nimport ListItemBody from './list-item-body/ListItemBody';\nimport ListItemHead from './list-item-head/ListItemHead';\nimport { StyledListItemTooltip, StyledMotionListItem } from './ListItem.styles';\nimport Tooltip from '../../tooltip/Tooltip';\nimport { useResizeDetector } from 'react-resize-detector';\n\nexport type ListItemElements = [ReactNode, ...ReactNode[]];\n\nexport type ListItemProps = {\n /**\n * DEPRECATED: Use `cornerImage` instead.\n */\n careOfLocationId?: number;\n /**\n * The content of the `ListItem` body. When the `ListItem` has children,\n * it can be opened and also gets an icon as an indicator automatically.\n */\n children?: ReactNode;\n /**\n * The image that is displayed in the bottom right corner of the grouped image of list item.\n */\n cornerImage?: string;\n /**\n * Element that is displayed when hovering over the `ListItem` on the right\n * side. On mobile devices, this element is not displayed.\n */\n hoverItem?: ReactNode;\n /**\n * The FontAwesome or tobit icons to render like an image on the left side\n * of the header. Multiple icons are stacked. See the `Icon` component\n * documentation for more information.\n */\n icons?: string[];\n /**\n * The background of the image. This is only used if images are passed.\n */\n imageBackground?: CSSProperties['background'];\n /**\n * A list of image URLs that are displayed on the left side of the header.\n * If multiple URLs are passed, the image is assembled from the first three\n * image URLs as a puzzle.\n */\n images?: string[];\n /**\n * This can be used to automatically expand the `ListItem` during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This overrides the internal opening state of the item and makes it controlled.\n */\n isOpen?: boolean;\n /**\n * Whether the ListItem locks disabled but has full functionality.\n */\n isTitleGreyed?: boolean;\n /**\n * Elements that are displayed on the left side of the header. If multiple\n * elements are specified, they are displayed one aside the other.\n */\n leftElements?: ListItemElements;\n /**\n * Function to be executed when the header of the `ListItem` was clicked\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is closed.\n */\n onClose?: VoidFunction;\n /**\n * Function to be executed when the header of the `ListItem` is pressed for\n * 400 milliseconds.\n */\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is opened.\n */\n onOpen?: VoidFunction;\n /**\n * Elements that are displayed on the right side of the header. If multiple\n * elements are specified, they are displayed one below the other.\n */\n rightElements?: IListItemRightElements;\n /**\n * This will force the background color of the ListItem to be used even if it is closed and not hovered.\n */\n shouldForceBackground?: boolean;\n /**\n * Whether the line should be forced, e.g., so that it is also displayed if the item is the last element in the list.\n */\n shouldForceBottomLine?: boolean;\n /**\n * Whether the hover item should be forced.\n */\n shouldForceHover?: boolean;\n /**\n * Whether the bottom line should be hidden.\n */\n shouldHideBottomLine?: boolean;\n /**\n * Whether the background and border of the shape on which the image or icon of the element is displayed should be\n * hidden.\n */\n shouldHideImageOrIconBackground?: boolean;\n /**\n * If the `ListItem` is expandable, the indicator is displayed on the left\n * side of the header. If this property is set to true, the indicator is\n * hidden.\n */\n shouldHideIndicator?: boolean;\n /**\n * Whether the image should be opened on click.\n */\n shouldOpenImageOnClick?: boolean;\n /**\n * Whether the layout animation should be prevented. This is useful when the\n * `ListItem` is used in a list with a lot of items and the layout animation\n * is not desired.\n */\n shouldPreventLayoutAnimation?: boolean;\n /**\n * This will render the ListItem closed on the first render.\n */\n shouldRenderClosed?: boolean;\n /**\n * Whether the image or icon should be displayed in a round shape. This should always be used for images of persons.\n */\n shouldShowRoundImageOrIcon?: boolean;\n /**\n * Whether a separator should be displayed below this item. In this case, the border is displayed thicker than normal.\n */\n shouldShowSeparatorBelow?: boolean;\n /**\n * Whether a Tooltip should be displayed on hover, if the title is cut.\n */\n shouldShowTooltipOnTitleOverflow?: boolean;\n /**\n * Subtitle of the `ListItem` displayed in the head below the title\n */\n subtitle?: ReactNode;\n /**\n * Title of the `ListItem` displayed in the head\n */\n title: ReactNode;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n};\n\nconst ListItem: FC<ListItemProps> = ({\n careOfLocationId,\n children,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isDefaultOpen,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onClose,\n onLongPress,\n onOpen,\n rightElements,\n shouldShowTooltipOnTitleOverflow = false,\n shouldForceBackground = false,\n shouldForceBottomLine = false,\n shouldForceHover = false,\n shouldHideBottomLine = false,\n shouldOpenImageOnClick = false,\n shouldHideImageOrIconBackground,\n shouldHideIndicator = false,\n shouldPreventLayoutAnimation = false,\n shouldRenderClosed = false,\n shouldShowRoundImageOrIcon,\n shouldShowSeparatorBelow = false,\n subtitle,\n title,\n titleElement,\n}) => {\n const {\n incrementExpandableItemCount,\n isAnyItemExpandable,\n isWrapped,\n openItemUuid,\n updateOpenItemUuid,\n } = useContext(ListContext);\n\n const { isWrapped: isParentAccordionWrapped } = useContext(AccordionContext);\n\n const areaProvider = useContext(AreaContext);\n\n const isInitialRenderRef = useRef(true);\n\n const { ref: listItemRef } = useResizeDetector();\n\n const uuid = useUuid();\n\n const isExpandable = children !== undefined;\n const isItemOpen = isOpen ?? openItemUuid === uuid;\n\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n\n const [shouldEnableTooltip, setShouldEnableTooltip] = useState(false);\n\n const shouldDisablePadding = useMemo(\n () => areaProvider.shouldDisableListItemPadding ?? false,\n [areaProvider.shouldDisableListItemPadding],\n );\n\n useEffect(() => {\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isItemOpen) {\n if (typeof onOpenRef.current === 'function') {\n onOpenRef.current();\n }\n } else if (typeof onCloseRef.current === 'function') {\n onCloseRef.current();\n }\n }, [isItemOpen]);\n\n const handleHeadClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (isExpandable) {\n updateOpenItemUuid(uuid);\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n },\n [isExpandable, onClick, updateOpenItemUuid, uuid],\n );\n\n useEffect(() => {\n if (isExpandable && !shouldHideIndicator) {\n // The incrementExpandableItemCount function returns an cleanup\n // function to decrement expandableItemCount if component unmounts\n return incrementExpandableItemCount();\n }\n\n return undefined;\n }, [incrementExpandableItemCount, isExpandable, shouldHideIndicator]);\n\n useEffect(() => {\n if (isDefaultOpen) {\n updateOpenItemUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenItemUuid, uuid]);\n\n const isClickable = typeof onClick === 'function' || isExpandable;\n\n const headContent = useMemo(\n () => (\n <ListItemHead\n hoverItem={hoverItem}\n careOfLocationId={careOfLocationId}\n cornerImage={cornerImage}\n icons={icons}\n imageBackground={imageBackground}\n images={images}\n isAnyItemExpandable={isAnyItemExpandable}\n isExpandable={isExpandable}\n isOpen={isItemOpen}\n isTitleGreyed={isTitleGreyed}\n leftElements={leftElements}\n onClick={isClickable ? handleHeadClick : undefined}\n onLongPress={onLongPress}\n shouldForceHover={shouldForceHover}\n rightElements={rightElements}\n shouldHideImageOrIconBackground={shouldHideImageOrIconBackground}\n shouldHideIndicator={shouldHideIndicator}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldShowRoundImageOrIcon={shouldShowRoundImageOrIcon}\n subtitle={subtitle}\n title={title}\n titleElement={titleElement}\n setShouldEnableTooltip={setShouldEnableTooltip}\n />\n ),\n [\n careOfLocationId,\n cornerImage,\n handleHeadClick,\n hoverItem,\n icons,\n imageBackground,\n images,\n isAnyItemExpandable,\n isClickable,\n isExpandable,\n isItemOpen,\n isTitleGreyed,\n leftElements,\n onLongPress,\n rightElements,\n shouldForceHover,\n shouldHideImageOrIconBackground,\n shouldHideIndicator,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n subtitle,\n title,\n titleElement,\n ],\n );\n\n return (\n <StyledMotionListItem\n animate={{ height: 'auto', opacity: 1 }}\n className=\"beta-chayns-list-item\"\n exit={{ height: 0, opacity: 0 }}\n initial={{ height: 0, opacity: 0 }}\n key={`list-item-${uuid}`}\n ref={listItemRef}\n layout={shouldPreventLayoutAnimation ? undefined : 'position'}\n $isClickable={isClickable}\n $isInAccordion={typeof isParentAccordionWrapped === 'boolean' && !shouldDisablePadding}\n $isOpen={isItemOpen}\n $isWrapped={isWrapped}\n $shouldForceBackground={shouldForceBackground}\n $shouldForceBottomLine={shouldForceBottomLine}\n $shouldHideBottomLine={shouldHideBottomLine}\n $shouldHideIndicator={shouldHideIndicator}\n $shouldShowSeparatorBelow={shouldShowSeparatorBelow}\n >\n <Tooltip\n shouldUseFullWidth\n isDisabled={!shouldShowTooltipOnTitleOverflow || !shouldEnableTooltip}\n item={\n <StyledListItemTooltip\n style={{ cursor: 'default' }}\n key={`list-item-tooltip-${uuid}`}\n >\n {title}\n </StyledListItemTooltip>\n }\n >\n {headContent}\n </Tooltip>\n <AnimatePresence initial={false}>\n {isExpandable && (isItemOpen || shouldRenderClosed) && (\n <ListItemBody\n id={uuid}\n key={`listItemBody-${uuid}`}\n shouldHideBody={shouldRenderClosed && !isItemOpen}\n >\n <AreaContextProvider>{children}</AreaContextProvider>\n </ListItemBody>\n )}\n </AnimatePresence>\n </StyledMotionListItem>\n );\n};\n\nListItem.displayName = 'ListItem';\n\nexport default ListItem;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AAaA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAH,uBAAA,CAAAF,OAAA;AACA,IAAAM,KAAA,GAAAN,O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OAAA,CAAAsF,aAAA,CAAC1F,QAAA,CAAAI,OAAO;IACJyG,kBAAkB;IAClBC,UAAU,EAAE,CAACxE,gCAAgC,IAAI,CAACsC,mBAAoB;IACtEmC,IAAI,eACAzH,OAAA,CAAAc,OAAA,CAAAsF,aAAA,CAAC3F,SAAA,CAAAiH,qBAAqB;MAClBC,KAAK,EAAE;QAAEC,MAAM,EAAE;MAAU,CAAE;MAC7BhB,GAAG,EAAE,qBAAqB7B,IAAI;IAAG,GAEhClB,KACkB;EAC1B,GAEAsC,WACI,CAAC,eACVnG,OAAA,CAAAc,OAAA,CAAAsF,aAAA,CAACtG,MAAA,CAAA+H,eAAe;IAAClB,OAAO,EAAE;EAAM,GAC3B1B,YAAY,KAAKE,UAAU,IAAI1B,kBAAkB,CAAC,iBAC/CzD,OAAA,CAAAc,OAAA,CAAAsF,aAAA,CAAC9F,aAAA,CAAAQ,OAAY;IACTgH,EAAE,EAAE/C,IAAK;IACT6B,GAAG,EAAE,gBAAgB7B,IAAI,EAAG;IAC5BgD,cAAc,EAAEtE,kBAAkB,IAAI,CAAC0B;EAAW,gBAElDnF,OAAA,CAAAc,OAAA,CAAAsF,aAAA,CAAChG,oBAAA,CAAAU,OAAmB,QAAEmB,QAA8B,CAC1C,CAEL,CACC,CAAC;AAE/B,CAAC;AAEDF,QAAQ,CAACiG,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAApH,OAAA,GAEnBiB,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"ListItem.js","names":["_react","require","_react2","_interopRequireWildcard","_uuid","_Accordion","_AreaContextProvider","_List","_ListItemBody","_interopRequireDefault","_ListItemHead","_ListItem","_Tooltip","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ListItem","backgroundColor","careOfLocationId","children","cornerImage","hoverItem","icons","imageBackground","images","isDefaultOpen","isOpen","isTitleGreyed","leftElements","onClick","onClose","onLongPress","onOpen","rightElements","shouldShowTooltipOnTitleOverflow","shouldForceBackground","shouldForceBottomLine","shouldForceHover","shouldHideBottomLine","shouldOpenImageOnClick","shouldHideImageOrIconBackground","shouldHideIndicator","shouldPreventLayoutAnimation","shouldRenderClosed","shouldShowRoundImageOrIcon","shouldShowSeparatorBelow","subtitle","title","titleElement","incrementExpandableItemCount","isAnyItemExpandable","isWrapped","openItemUuid","updateOpenItemUuid","useContext","ListContext","isParentAccordionWrapped","AccordionContext","areaProvider","AreaContext","isInitialRenderRef","useRef","listItemRef","uuid","useUuid","isExpandable","undefined","isItemOpen","onCloseRef","onOpenRef","shouldEnableTooltip","setShouldEnableTooltip","useState","shouldDisablePadding","useMemo","shouldDisableListItemPadding","useEffect","current","handleHeadClick","useCallback","event","shouldOnlyOpen","isClickable","headContent","createElement","StyledMotionListItem","animate","height","opacity","className","exit","initial","key","ref","layout","$backgroundColor","$isClickable","$isInAccordion","$isOpen","$isWrapped","$shouldForceBackground","$shouldForceBottomLine","$shouldHideBottomLine","$shouldHideIndicator","$shouldShowSeparatorBelow","shouldUseFullWidth","isDisabled","item","StyledListItemTooltip","style","cursor","AnimatePresence","id","shouldHideBody","displayName","_default","exports"],"sources":["../../../../../src/components/list/list-item/ListItem.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n CSSProperties,\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IListItemRightElements } from '../../../types/list';\nimport { AccordionContext } from '../../accordion/Accordion';\nimport AreaContextProvider, { AreaContext } from '../../area-provider/AreaContextProvider';\nimport { ListContext } from '../List';\nimport ListItemBody from './list-item-body/ListItemBody';\nimport ListItemHead from './list-item-head/ListItemHead';\nimport { StyledListItemTooltip, StyledMotionListItem } from './ListItem.styles';\nimport Tooltip from '../../tooltip/Tooltip';\n\nexport type ListItemElements = [ReactNode, ...ReactNode[]];\n\nexport type ListItemProps = {\n /**\n * The background color of the `ListItem`.\n */\n backgroundColor?: CSSProperties['backgroundColor'];\n /**\n * DEPRECATED: Use `cornerImage` instead.\n */\n careOfLocationId?: number;\n /**\n * The content of the `ListItem` body. When the `ListItem` has children,\n * it can be opened and also gets an icon as an indicator automatically.\n */\n children?: ReactNode;\n /**\n * The image that is displayed in the bottom right corner of the grouped image of list item.\n */\n cornerImage?: string;\n /**\n * Element that is displayed when hovering over the `ListItem` on the right\n * side. On mobile devices, this element is not displayed.\n */\n hoverItem?: ReactNode;\n /**\n * The FontAwesome or tobit icons to render like an image on the left side\n * of the header. Multiple icons are stacked. See the `Icon` component\n * documentation for more information.\n */\n icons?: string[];\n /**\n * The background of the image. This is only used if images are passed.\n */\n imageBackground?: CSSProperties['background'];\n /**\n * A list of image URLs that are displayed on the left side of the header.\n * If multiple URLs are passed, the image is assembled from the first three\n * image URLs as a puzzle.\n */\n images?: string[];\n /**\n * This can be used to automatically expand the `ListItem` during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This overrides the internal opening state of the item and makes it controlled.\n */\n isOpen?: boolean;\n /**\n * Whether the ListItem locks disabled but has full functionality.\n */\n isTitleGreyed?: boolean;\n /**\n * Elements that are displayed on the left side of the header. If multiple\n * elements are specified, they are displayed one aside the other.\n */\n leftElements?: ListItemElements;\n /**\n * Function to be executed when the header of the `ListItem` was clicked\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is closed.\n */\n onClose?: VoidFunction;\n /**\n * Function to be executed when the header of the `ListItem` is pressed for\n * 400 milliseconds.\n */\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is opened.\n */\n onOpen?: VoidFunction;\n /**\n * Elements that are displayed on the right side of the header. If multiple\n * elements are specified, they are displayed one below the other.\n */\n rightElements?: IListItemRightElements;\n /**\n * This will force the background color of the ListItem to be used even if it is closed and not hovered.\n */\n shouldForceBackground?: boolean;\n /**\n * Whether the line should be forced, e.g., so that it is also displayed if the item is the last element in the list.\n */\n shouldForceBottomLine?: boolean;\n /**\n * Whether the hover item should be forced.\n */\n shouldForceHover?: boolean;\n /**\n * Whether the bottom line should be hidden.\n */\n shouldHideBottomLine?: boolean;\n /**\n * Whether the background and border of the shape on which the image or icon of the element is displayed should be\n * hidden.\n */\n shouldHideImageOrIconBackground?: boolean;\n /**\n * If the `ListItem` is expandable, the indicator is displayed on the left\n * side of the header. If this property is set to true, the indicator is\n * hidden.\n */\n shouldHideIndicator?: boolean;\n /**\n * Whether the image should be opened on click.\n */\n shouldOpenImageOnClick?: boolean;\n /**\n * Whether the layout animation should be prevented. This is useful when the\n * `ListItem` is used in a list with a lot of items and the layout animation\n * is not desired.\n */\n shouldPreventLayoutAnimation?: boolean;\n /**\n * This will render the ListItem closed on the first render.\n */\n shouldRenderClosed?: boolean;\n /**\n * Whether the image or icon should be displayed in a round shape. This should always be used for images of persons.\n */\n shouldShowRoundImageOrIcon?: boolean;\n /**\n * Whether a separator should be displayed below this item. In this case, the border is displayed thicker than normal.\n */\n shouldShowSeparatorBelow?: boolean;\n /**\n * Whether a Tooltip should be displayed on hover, if the title is cut.\n */\n shouldShowTooltipOnTitleOverflow?: boolean;\n /**\n * Subtitle of the `ListItem` displayed in the head below the title\n */\n subtitle?: ReactNode;\n /**\n * Title of the `ListItem` displayed in the head\n */\n title: ReactNode;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n};\n\nconst ListItem: FC<ListItemProps> = ({\n backgroundColor,\n careOfLocationId,\n children,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isDefaultOpen,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onClose,\n onLongPress,\n onOpen,\n rightElements,\n shouldShowTooltipOnTitleOverflow = false,\n shouldForceBackground = false,\n shouldForceBottomLine = false,\n shouldForceHover = false,\n shouldHideBottomLine = false,\n shouldOpenImageOnClick = false,\n shouldHideImageOrIconBackground,\n shouldHideIndicator = false,\n shouldPreventLayoutAnimation = false,\n shouldRenderClosed = false,\n shouldShowRoundImageOrIcon,\n shouldShowSeparatorBelow = false,\n subtitle,\n title,\n titleElement,\n}) => {\n const {\n incrementExpandableItemCount,\n isAnyItemExpandable,\n isWrapped,\n openItemUuid,\n updateOpenItemUuid,\n } = useContext(ListContext);\n\n const { isWrapped: isParentAccordionWrapped } = useContext(AccordionContext);\n\n const areaProvider = useContext(AreaContext);\n\n const isInitialRenderRef = useRef(true);\n\n const listItemRef = useRef<HTMLDivElement>(null);\n\n const uuid = useUuid();\n\n const isExpandable = children !== undefined;\n const isItemOpen = isOpen ?? openItemUuid === uuid;\n\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n\n const [shouldEnableTooltip, setShouldEnableTooltip] = useState(false);\n\n const shouldDisablePadding = useMemo(\n () => areaProvider.shouldDisableListItemPadding ?? false,\n [areaProvider.shouldDisableListItemPadding],\n );\n\n useEffect(() => {\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isItemOpen) {\n if (typeof onOpenRef.current === 'function') {\n onOpenRef.current();\n }\n } else if (typeof onCloseRef.current === 'function') {\n onCloseRef.current();\n }\n }, [isItemOpen]);\n\n const handleHeadClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (isExpandable) {\n updateOpenItemUuid(uuid);\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n },\n [isExpandable, onClick, updateOpenItemUuid, uuid],\n );\n\n useEffect(() => {\n if (isExpandable && !shouldHideIndicator) {\n // The incrementExpandableItemCount function returns an cleanup\n // function to decrement expandableItemCount if component unmounts\n return incrementExpandableItemCount();\n }\n\n return undefined;\n }, [incrementExpandableItemCount, isExpandable, shouldHideIndicator]);\n\n useEffect(() => {\n if (isDefaultOpen) {\n updateOpenItemUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenItemUuid, uuid]);\n\n const isClickable = typeof onClick === 'function' || isExpandable;\n\n const headContent = useMemo(\n () => (\n <ListItemHead\n hoverItem={hoverItem}\n careOfLocationId={careOfLocationId}\n cornerImage={cornerImage}\n icons={icons}\n imageBackground={imageBackground}\n images={images}\n isAnyItemExpandable={isAnyItemExpandable}\n isExpandable={isExpandable}\n isOpen={isItemOpen}\n isTitleGreyed={isTitleGreyed}\n leftElements={leftElements}\n onClick={isClickable ? handleHeadClick : undefined}\n onLongPress={onLongPress}\n shouldForceHover={shouldForceHover}\n rightElements={rightElements}\n shouldHideImageOrIconBackground={shouldHideImageOrIconBackground}\n shouldHideIndicator={shouldHideIndicator}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldShowRoundImageOrIcon={shouldShowRoundImageOrIcon}\n subtitle={subtitle}\n title={title}\n titleElement={titleElement}\n setShouldEnableTooltip={setShouldEnableTooltip}\n />\n ),\n [\n careOfLocationId,\n cornerImage,\n handleHeadClick,\n hoverItem,\n icons,\n imageBackground,\n images,\n isAnyItemExpandable,\n isClickable,\n isExpandable,\n isItemOpen,\n isTitleGreyed,\n leftElements,\n onLongPress,\n rightElements,\n shouldForceHover,\n shouldHideImageOrIconBackground,\n shouldHideIndicator,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n subtitle,\n title,\n titleElement,\n ],\n );\n\n return (\n <StyledMotionListItem\n animate={{ height: 'auto', opacity: 1 }}\n className=\"beta-chayns-list-item\"\n exit={{ height: 0, opacity: 0 }}\n initial={{ height: 0, opacity: 0 }}\n key={`list-item-${uuid}`}\n ref={listItemRef}\n layout={shouldPreventLayoutAnimation ? undefined : 'position'}\n $backgroundColor={backgroundColor}\n $isClickable={isClickable}\n $isInAccordion={typeof isParentAccordionWrapped === 'boolean' && !shouldDisablePadding}\n $isOpen={isItemOpen}\n $isWrapped={isWrapped}\n $shouldForceBackground={shouldForceBackground}\n $shouldForceBottomLine={shouldForceBottomLine}\n $shouldHideBottomLine={shouldHideBottomLine}\n $shouldHideIndicator={shouldHideIndicator}\n $shouldShowSeparatorBelow={shouldShowSeparatorBelow}\n >\n <Tooltip\n shouldUseFullWidth\n isDisabled={!shouldShowTooltipOnTitleOverflow || !shouldEnableTooltip}\n item={\n <StyledListItemTooltip\n style={{ cursor: 'default' }}\n key={`list-item-tooltip-${uuid}`}\n >\n {title}\n </StyledListItemTooltip>\n }\n >\n {headContent}\n </Tooltip>\n <AnimatePresence initial={false}>\n {isExpandable && (isItemOpen || shouldRenderClosed) && (\n <ListItemBody\n id={uuid}\n key={`listItemBody-${uuid}`}\n shouldHideBody={shouldRenderClosed && !isItemOpen}\n >\n <AreaContextProvider>{children}</AreaContextProvider>\n </ListItemBody>\n )}\n </AnimatePresence>\n </StyledMotionListItem>\n );\n};\n\nListItem.displayName = 'ListItem';\n\nexport default ListItem;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AAaA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAH,uBAAA,CAAAF,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,aAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAH,sBAAA,CAAAR,OAAA;AAA4C,SAAAQ,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAd,uBAAA,YAAAA,CAAAU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,GAC3B1B,YAAY,KAAKE,UAAU,IAAIxB,kBAAkB,CAAC,iBAC/CzD,OAAA,CAAAa,OAAA,CAAAqF,aAAA,CAAC5F,aAAA,CAAAO,OAAY;IACTiH,EAAE,EAAEjD,IAAK;IACT6B,GAAG,EAAE,gBAAgB7B,IAAI,EAAG;IAC5BkD,cAAc,EAAEtE,kBAAkB,IAAI,CAACwB;EAAW,gBAElDjF,OAAA,CAAAa,OAAA,CAAAqF,aAAA,CAAC9F,oBAAA,CAAAS,OAAmB,QAAEoB,QAA8B,CAC1C,CAEL,CACC,CAAC;AAE/B,CAAC;AAEDH,QAAQ,CAACkG,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArH,OAAA,GAEnBiB,QAAQ","ignoreList":[]}
@@ -26,6 +26,15 @@ const StyledMotionListItem = exports.StyledMotionListItem = (0, _styledComponent
26
26
  }) => (!$isInAccordion && $isOpen || $shouldForceBackground) && (0, _styledComponents.css)`
27
27
  background-color: rgba(${theme['100-rgb']}, ${theme.cardBackgroundOpacity});
28
28
  `}
29
+
30
+ ${({
31
+ $backgroundColor,
32
+ $isInAccordion,
33
+ $isOpen,
34
+ $shouldForceBackground
35
+ }) => $backgroundColor && (!$isInAccordion && $isOpen || $shouldForceBackground) && (0, _styledComponents.css)`
36
+ background-color: ${$backgroundColor} !important;
37
+ `}
29
38
 
30
39
  ${({
31
40
  $isClickable,
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionListItem","exports","styled","motion","div","$isInAccordion","$shouldHideIndicator","css","$isOpen","$shouldForceBackground","theme","cardBackgroundOpacity","$isClickable","$isWrapped","$shouldHideBottomLine","$shouldForceBottomLine","$shouldShowSeparatorBelow","accordionLines","undefined","StyledListItemTooltip"],"sources":["../../../../../src/components/list/list-item/ListItem.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledListItemProps = WithTheme<{\n $isClickable: boolean;\n $isInAccordion: boolean;\n $isOpen: boolean;\n $isWrapped: boolean;\n $shouldForceBackground?: boolean;\n $shouldForceBottomLine?: boolean;\n $shouldHideBottomLine: boolean;\n $shouldHideIndicator: boolean;\n $shouldShowSeparatorBelow: boolean;\n}>;\n\nexport const StyledMotionListItem = styled(motion.div)<StyledListItemProps>`\n overflow: hidden;\n transition: background-color 0.3s ease;\n\n ${({ $isInAccordion, $shouldHideIndicator }: StyledListItemProps) =>\n $isInAccordion &&\n css`\n padding-left: ${$shouldHideIndicator ? '16px' : '8px'};\n `}\n\n ${({ $isInAccordion, $isOpen, $shouldForceBackground, theme }) =>\n ((!$isInAccordion && $isOpen) || $shouldForceBackground) &&\n css`\n background-color: rgba(${theme['100-rgb']}, ${theme.cardBackgroundOpacity});\n `}\n\n ${({ $isClickable, $isInAccordion, theme }) =>\n $isClickable &&\n !$isInAccordion &&\n css`\n &&:hover {\n background-color: rgba(${theme['100-rgb']}, ${theme.cardBackgroundOpacity});\n }\n `}\n \n ${({\n $isInAccordion,\n $isOpen,\n $isWrapped,\n $shouldHideBottomLine,\n $shouldForceBottomLine,\n $shouldShowSeparatorBelow,\n theme,\n }: StyledListItemProps) => {\n if (\n $shouldShowSeparatorBelow ||\n ((!$isOpen || $isWrapped || $isInAccordion) &&\n theme.accordionLines &&\n !$shouldHideBottomLine)\n ) {\n if ($shouldForceBottomLine) {\n return css`\n border-bottom: ${$shouldShowSeparatorBelow ? '4px' : '1px'} solid\n rgba(${theme['headline-rgb']}, 0.5);\n `;\n }\n\n return css`\n &&:not(:last-child) {\n border-bottom: ${$shouldShowSeparatorBelow ? '4px' : '1px'} solid\n rgba(${theme['headline-rgb']}, 0.5);\n }\n `;\n }\n\n return undefined;\n }}\n\n ${({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AAW,CAAC,KACbA,UAAU,IACV,IAAAN,qBAAG;AACX;AACA,SAAS;AACT,CAAC;AAEM,MAAMY,qBAAqB,GAAAlB,OAAA,CAAAkB,qBAAA,GAAGjB,yBAAM,CAACE,GAAG;AAC/C;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ListItem.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionListItem","exports","styled","motion","div","$isInAccordion","$shouldHideIndicator","css","$isOpen","$shouldForceBackground","theme","cardBackgroundOpacity","$backgroundColor","$isClickable","$isWrapped","$shouldHideBottomLine","$shouldForceBottomLine","$shouldShowSeparatorBelow","accordionLines","undefined","StyledListItemTooltip"],"sources":["../../../../../src/components/list/list-item/ListItem.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { CSSProperties } from 'react';\n\ntype StyledListItemProps = WithTheme<{\n $backgroundColor?: CSSProperties['backgroundColor'];\n $isClickable: boolean;\n $isInAccordion: boolean;\n $isOpen: boolean;\n $isWrapped: boolean;\n $shouldForceBackground?: boolean;\n $shouldForceBottomLine?: boolean;\n $shouldHideBottomLine: boolean;\n $shouldHideIndicator: boolean;\n $shouldShowSeparatorBelow: boolean;\n}>;\n\nexport const StyledMotionListItem = styled(motion.div)<StyledListItemProps>`\n overflow: hidden;\n transition: background-color 0.3s ease;\n\n ${({ $isInAccordion, $shouldHideIndicator }: StyledListItemProps) =>\n $isInAccordion &&\n css`\n padding-left: ${$shouldHideIndicator ? '16px' : '8px'};\n `}\n\n ${({ $isInAccordion, $isOpen, $shouldForceBackground, theme }) =>\n ((!$isInAccordion && $isOpen) || $shouldForceBackground) &&\n css`\n background-color: rgba(${theme['100-rgb']}, ${theme.cardBackgroundOpacity});\n `}\n \n ${({ $backgroundColor, $isInAccordion, $isOpen, $shouldForceBackground }) =>\n $backgroundColor &&\n ((!$isInAccordion && $isOpen) || $shouldForceBackground) &&\n css`\n background-color: ${$backgroundColor} !important;\n `}\n\n ${({ $isClickable, $isInAccordion, theme }) =>\n $isClickable &&\n !$isInAccordion &&\n css`\n &&:hover {\n background-color: rgba(${theme['100-rgb']}, ${theme.cardBackgroundOpacity});\n }\n `}\n \n ${({\n $isInAccordion,\n $isOpen,\n $isWrapped,\n $shouldHideBottomLine,\n $shouldForceBottomLine,\n $shouldShowSeparatorBelow,\n theme,\n }: StyledListItemProps) => {\n if (\n $shouldShowSeparatorBelow ||\n ((!$isOpen || $isWrapped || $isInAccordion) &&\n theme.accordionLines &&\n !$shouldHideBottomLine)\n ) {\n if ($shouldForceBottomLine) {\n return css`\n border-bottom: ${$shouldShowSeparatorBelow ? '4px' : '1px'} solid\n rgba(${theme['headline-rgb']}, 0.5);\n `;\n }\n\n return css`\n &&:not(:last-child) {\n border-bottom: ${$shouldShowSeparatorBelow ? '4px' : '1px'} solid\n rgba(${theme['headline-rgb']}, 0.5);\n }\n `;\n }\n\n return undefined;\n }}\n\n ${({ $isWrapped }) =>\n $isWrapped &&\n css`\n padding-left: 26px;\n `}\n`;\n\nexport const StyledListItemTooltip = styled.div`\n padding: 6px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAgD,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAA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ACP,cAAc,IAAIG,OAAO,IAAKC,sBAAsB,CAAC,IACxD,IAAAF,qBAAG;AACX,gCAAgCK,gBAAgB;AAChD,SAAS;AACT;AACA,MAAM,CAAC;EAAEC,YAAY;EAAER,cAAc;EAAEK;AAAM,CAAC,KACtCG,YAAY,IACZ,CAACR,cAAc,IACf,IAAAE,qBAAG;AACX;AACA,yCAAyCG,KAAK,CAAC,SAAS,CAAC,KAAKA,KAAK,CAACC,qBAAqB;AACzF;AACA,SAAS;AACT;AACA,MAAM,CAAC;EACCN,cAAc;EACdG,OAAO;EACPM,UAAU;EACVC,qBAAqB;EACrBC,sBAAsB;EACtBC,yBAAyB;EACzBP;AACiB,CAAC,KAAK;EACvB,IACIO,yBAAyB,IACxB,CAAC,CAACT,OAAO,IAAIM,UAAU,IAAIT,cAAc,KACtCK,KAAK,CAACQ,cAAc,IACpB,CAACH,qBAAsB,EAC7B;IACE,IAAIC,sBAAsB,EAAE;MACxB,OAAO,IAAAT,qBAAG;AAC1B,qCAAqCU,yBAAyB,GAAG,KAAK,GAAG,KAAK;AAC9E,+BAA+BP,KAAK,CAAC,cAAc,CAAC;AACpD,iBAAiB;IACL;IAEA,OAAO,IAAAH,qBAAG;AACtB;AACA,qCAAqCU,yBAAyB,GAAG,KAAK,GAAG,KAAK;AAC9E,+BAA+BP,KAAK,CAAC,cAAc,CAAC;AACpD;AACA,aAAa;EACL;EAEA,OAAOS,SAAS;AACpB,CAAC;AACL;AACA,MAAM,CAAC;EAAEL;AAAW,CAAC,KACbA,UAAU,IACV,IAAAP,qBAAG;AACX;AACA,SAAS;AACT,CAAC;AAEM,MAAMa,qBAAqB,GAAAnB,OAAA,CAAAmB,qBAAA,GAAGlB,yBAAM,CAACE,GAAG;AAC/C;AACA,CAAC","ignoreList":[]}
@@ -40,59 +40,35 @@ const ListItemHead = ({
40
40
  setShouldEnableTooltip
41
41
  }) => {
42
42
  const [shouldShowHoverItem, setShouldShowHoverItem] = (0, _react.useState)(false);
43
- const [openTitleWidth, setOpenTitleWidth] = (0, _react.useState)(0);
44
- const [headHeight, setHeadHeight] = (0, _react.useState)({
45
- closed: 64,
46
- open: 64
47
- });
48
43
  const [, setIsFirstRender] = (0, _react.useState)(false);
49
44
  const longPressTimeoutRef = (0, _react.useRef)();
50
45
  const shouldShowSubtitleRow = subtitle || typeof subtitle === 'string';
51
- const handleShowTooltipResize = (0, _react.useCallback)(ref => {
52
- if (ref.current) {
53
- const el = ref.current;
54
- setShouldEnableTooltip(el.scrollWidth > el.clientWidth);
55
- }
46
+ const {
47
+ ref: subTitleRef,
48
+ height: subTitleHeight = 0
49
+ } = (0, _reactResizeDetector.useResizeDetector)();
50
+ const shouldShowMultilineTitle = (0, _react.useMemo)(() => !subtitle, [subtitle]);
51
+ const handleShowTooltipResize = (0, _react.useCallback)(data => {
52
+ var _data$entry;
53
+ const el = (_data$entry = data.entry) === null || _data$entry === void 0 ? void 0 : _data$entry.target;
54
+ if (!el) return;
55
+ setShouldEnableTooltip(el.scrollWidth > el.clientWidth);
56
56
  }, [setShouldEnableTooltip]);
57
57
  const {
58
58
  ref: titleRef,
59
- height: titleHeight,
60
- width: titleWidth
59
+ height: titleHeight = 0,
60
+ width: titleWidth = 0
61
61
  } = (0, _reactResizeDetector.useResizeDetector)({
62
- onResize: () => handleShowTooltipResize(titleRef)
62
+ onResize: handleShowTooltipResize
63
63
  });
64
64
  const {
65
65
  ref: ellipsisTitleRef,
66
- height: ellipsisTitleHeight
67
- } = (0, _reactResizeDetector.useResizeDetector)({
68
- onResize: () => handleShowTooltipResize(ellipsisTitleRef)
69
- });
70
- const {
71
- ref: subTitleRef,
72
- height: subTitleHeight
73
- } = (0, _reactResizeDetector.useResizeDetector)();
74
- const {
75
- ref: listItemRef
66
+ height: ellipsisTitleHeight = 0,
67
+ width: ellipsisTitleWidth = 0
76
68
  } = (0, _reactResizeDetector.useResizeDetector)({
77
- onResize: () => {
78
- setOpenTitleWidth(titleWidth ?? 0);
79
- let closedHeight = (ellipsisTitleHeight ?? 0) + 24;
80
- let openHeight = (titleHeight ?? 0) + 24;
81
- if (shouldShowSubtitleRow) {
82
- if (subTitleHeight) {
83
- closedHeight += (ellipsisTitleHeight ?? 0) + 4;
84
- openHeight += subTitleHeight + 4;
85
- }
86
- }
87
- setHeadHeight({
88
- closed: closedHeight,
89
- open: openHeight
90
- });
91
- },
92
- refreshMode: 'debounce',
93
- refreshRate: 100
69
+ onResize: handleShowTooltipResize
94
70
  });
95
- const shouldShowMultilineTitle = (0, _react.useMemo)(() => !subtitle, [subtitle]);
71
+ const height = (0, _react.useMemo)(() => (isOpen ? titleHeight : ellipsisTitleHeight) + (shouldShowSubtitleRow ? subTitleHeight + 4 : 0), [ellipsisTitleHeight, isOpen, shouldShowSubtitleRow, subTitleHeight, titleHeight]);
96
72
 
97
73
  // This is used to trigger a rerender, so the head height can be calculated
98
74
  (0, _react.useEffect)(() => {
@@ -150,7 +126,7 @@ const ListItemHead = ({
150
126
  }, [careOfLocationId, cornerImage, icons, imageBackground, images, shouldHideImageOrIconBackground, shouldOpenImageOnClick, shouldShowRoundImageOrIcon]);
151
127
  return /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHead, {
152
128
  animate: {
153
- height: isOpen ? headHeight.open : headHeight.closed,
129
+ height,
154
130
  opacity: isTitleGreyed ? 0.5 : 1
155
131
  },
156
132
  initial: false,
@@ -177,12 +153,12 @@ const ListItemHead = ({
177
153
  }, isExpandable && !shouldHideIndicator && /*#__PURE__*/_react.default.createElement(_Icon.default, {
178
154
  icons: ['fa fa-chevron-right']
179
155
  })), leftElements, iconOrImageElement), /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHeadContent, {
180
- ref: listItemRef,
181
156
  $isIconOrImageGiven: iconOrImageElement !== undefined,
182
157
  $isOpen: isOpen
183
158
  }, /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHeadTitle, null, /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHeadTitleContent, null, isOpen ? /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHeadTitleText, {
159
+ key: "title",
184
160
  ref: titleRef,
185
- $width: openTitleWidth,
161
+ $width: titleWidth,
186
162
  $shouldShowMultilineTitle: shouldShowMultilineTitle,
187
163
  initial: {
188
164
  opacity: 0
@@ -197,9 +173,10 @@ const ListItemHead = ({
197
173
  duration: 0.4
198
174
  }
199
175
  }, title) : /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHeadTitleText, {
176
+ key: "ellipsisTitle",
200
177
  $isEllipsis: true,
201
178
  ref: ellipsisTitleRef,
202
- $width: openTitleWidth,
179
+ $width: ellipsisTitleWidth,
203
180
  $shouldShowMultilineTitle: shouldShowMultilineTitle,
204
181
  initial: {
205
182
  opacity: 0
@@ -1 +1 @@
1
- {"version":3,"file":"ListItemHead.js","names":["_react","_interopRequireWildcard","require","_accordion","_Icon","_interopRequireDefault","_ListItemIcon","_ListItemImage","_ListItemRightElements","_ListItemHead","_reactResizeDetector","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ListItemHead","careOfLocationId","cornerImage","hoverItem","icons","imageBackground","images","isAnyItemExpandable","isExpandable","isOpen","isTitleGreyed","leftElements","onClick","onLongPress","rightElements","shouldHideImageOrIconBackground","shouldHideIndicator","shouldOpenImageOnClick","shouldShowRoundImageOrIcon","subtitle","shouldForceHover","title","titleElement","setShouldEnableTooltip","shouldShowHoverItem","setShouldShowHoverItem","useState","openTitleWidth","setOpenTitleWidth","headHeight","setHeadHeight","closed","open","setIsFirstRender","longPressTimeoutRef","useRef","shouldShowSubtitleRow","handleShowTooltipResize","useCallback","ref","current","el","scrollWidth","clientWidth","titleRef","height","titleHeight","width","titleWidth","useResizeDetector","onResize","ellipsisTitleRef","ellipsisTitleHeight","subTitleRef","subTitleHeight","listItemRef","closedHeight","openHeight","refreshMode","refreshRate","shouldShowMultilineTitle","useMemo","useEffect","handleMouseEnter","handleMouseLeave","handleTouchStart","event","window","setTimeout","handleTouchEnd","clearTimeout","shouldPreventRightElementClick","bottom","getElementClickEvent","center","top","iconOrImageElement","createElement","shouldHideBackground","shouldShowRoundIcon","shouldShowRoundImage","undefined","StyledListItemHead","animate","opacity","initial","transition","duration","type","className","$isClickable","$isAnyItemExpandable","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd","StyledListItemHeadLeftWrapper","StyledMotionListItemHeadIndicator","rotate","StyledListItemHeadContent","$isIconOrImageGiven","$isOpen","StyledListItemHeadTitle","StyledListItemHeadTitleContent","StyledListItemHeadTitleText","$width","$shouldShowMultilineTitle","exit","$isEllipsis","StyledListItemHeadTitleElement","StyledListItemHeadSubtitle","StyledListItemHeadSubtitleText","StyledMotionListItemHeadHoverItemWrapper","marginLeft","StyledMotionListItemHeadHoverItem","displayName","_default","exports"],"sources":["../../../../../../src/components/list/list-item/list-item-head/ListItemHead.tsx"],"sourcesContent":["import React, {\n CSSProperties,\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { IListItemRightElements } from '../../../../types/list';\nimport { getElementClickEvent } from '../../../../utils/accordion';\nimport Icon from '../../../icon/Icon';\nimport ListItemIcon from './list-item-icon/ListItemIcon';\nimport ListItemImage from './list-item-image/ListItemImage';\nimport ListItemRightElements from './list-item-right-elements/ListItemRightElements';\nimport {\n StyledListItemHead,\n StyledListItemHeadContent,\n StyledListItemHeadLeftWrapper,\n StyledListItemHeadSubtitle,\n StyledListItemHeadSubtitleText,\n StyledListItemHeadTitle,\n StyledListItemHeadTitleContent,\n StyledListItemHeadTitleElement,\n StyledListItemHeadTitleText,\n StyledMotionListItemHeadHoverItem,\n StyledMotionListItemHeadHoverItemWrapper,\n StyledMotionListItemHeadIndicator,\n} from './ListItemHead.styles';\nimport { useResizeDetector } from 'react-resize-detector';\nimport { OnRefChangeType } from 'react-resize-detector/build/types';\n\ninterface HeadHeight {\n closed: number;\n open: number;\n}\n\ntype ListItemHeadProps = {\n careOfLocationId?: number;\n cornerImage?: string;\n hoverItem?: ReactNode;\n icons?: string[];\n imageBackground?: CSSProperties['background'];\n images?: string[];\n isAnyItemExpandable: boolean;\n isExpandable: boolean;\n isOpen: boolean;\n isTitleGreyed?: boolean;\n leftElements?: ReactNode;\n onClick?: MouseEventHandler<HTMLDivElement>;\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n rightElements?: IListItemRightElements;\n shouldHideImageOrIconBackground?: boolean;\n shouldHideIndicator?: boolean;\n shouldOpenImageOnClick: boolean;\n shouldShowRoundImageOrIcon?: boolean;\n subtitle?: ReactNode;\n title: ReactNode;\n titleElement?: ReactNode;\n shouldForceHover?: boolean;\n setShouldEnableTooltip: (value: boolean) => void;\n};\n\nconst ListItemHead: FC<ListItemHeadProps> = ({\n careOfLocationId,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isAnyItemExpandable,\n isExpandable,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onLongPress,\n rightElements,\n shouldHideImageOrIconBackground,\n shouldHideIndicator,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n subtitle,\n shouldForceHover,\n title,\n titleElement,\n setShouldEnableTooltip,\n}) => {\n const [shouldShowHoverItem, setShouldShowHoverItem] = useState(false);\n const [openTitleWidth, setOpenTitleWidth] = useState(0);\n const [headHeight, setHeadHeight] = useState<HeadHeight>({ closed: 64, open: 64 });\n const [, setIsFirstRender] = useState(false);\n\n const longPressTimeoutRef = useRef<number>();\n\n const shouldShowSubtitleRow = subtitle || typeof subtitle === 'string';\n\n const handleShowTooltipResize = useCallback(\n (ref: OnRefChangeType<HTMLDivElement>) => {\n if (ref.current) {\n const el = ref.current;\n setShouldEnableTooltip(el.scrollWidth > el.clientWidth);\n }\n },\n [setShouldEnableTooltip],\n );\n\n const {\n ref: titleRef,\n height: titleHeight,\n width: titleWidth,\n } = useResizeDetector<HTMLDivElement>({\n onResize: () => handleShowTooltipResize(titleRef),\n });\n\n const { ref: ellipsisTitleRef, height: ellipsisTitleHeight } =\n useResizeDetector<HTMLDivElement>({\n onResize: () => handleShowTooltipResize(ellipsisTitleRef),\n });\n\n const { ref: subTitleRef, height: subTitleHeight } = useResizeDetector();\n\n const { ref: listItemRef } = useResizeDetector({\n onResize: () => {\n setOpenTitleWidth(titleWidth ?? 0);\n\n let closedHeight = (ellipsisTitleHeight ?? 0) + 24;\n let openHeight = (titleHeight ?? 0) + 24;\n\n if (shouldShowSubtitleRow) {\n if (subTitleHeight) {\n closedHeight += (ellipsisTitleHeight ?? 0) + 4;\n openHeight += subTitleHeight + 4;\n }\n }\n\n setHeadHeight({ closed: closedHeight, open: openHeight });\n },\n refreshMode: 'debounce',\n refreshRate: 100,\n });\n\n const shouldShowMultilineTitle = useMemo(() => !subtitle, [subtitle]);\n\n // This is used to trigger a rerender, so the head height can be calculated\n useEffect(() => {\n setIsFirstRender(true);\n }, []);\n\n const handleMouseEnter = useCallback(() => setShouldShowHoverItem(true), []);\n\n const handleMouseLeave = useCallback(() => setShouldShowHoverItem(false), []);\n\n const handleTouchStart = useCallback<TouchEventHandler<HTMLDivElement>>(\n (event) => {\n longPressTimeoutRef.current = window.setTimeout(() => {\n if (typeof onLongPress === 'function') {\n onLongPress(event);\n }\n }, 400);\n },\n [onLongPress],\n );\n\n const handleTouchEnd = useCallback(() => {\n clearTimeout(longPressTimeoutRef.current);\n }, []);\n\n const shouldPreventRightElementClick = useMemo(() => {\n if (!rightElements) return false;\n\n if (\n typeof rightElements === 'object' &&\n ('bottom' in rightElements || 'center' in rightElements || 'top' in rightElements)\n ) {\n if (rightElements.bottom && getElementClickEvent(rightElements.bottom)) {\n return true;\n }\n\n if (rightElements.center && getElementClickEvent(rightElements.center)) {\n return true;\n }\n\n if (rightElements.top && getElementClickEvent(rightElements.top)) {\n return true;\n }\n } else {\n return getElementClickEvent(rightElements as ReactNode);\n }\n\n return false;\n }, [rightElements]);\n\n const iconOrImageElement = useMemo(() => {\n if (icons) {\n return (\n <ListItemIcon\n icons={icons}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundIcon={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n if (images) {\n return (\n <ListItemImage\n imageBackground={imageBackground}\n careOfLocationId={careOfLocationId}\n cornerImage={cornerImage}\n images={images}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundImage={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n return undefined;\n }, [\n careOfLocationId,\n cornerImage,\n icons,\n imageBackground,\n images,\n shouldHideImageOrIconBackground,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n ]);\n\n return (\n <StyledListItemHead\n animate={{\n height: isOpen ? headHeight.open : headHeight.closed,\n opacity: isTitleGreyed ? 0.5 : 1,\n }}\n initial={false}\n transition={{ duration: 0.2, type: 'tween' }}\n className=\"beta-chayns-list-item-head\"\n $isClickable={typeof onClick === 'function' || isExpandable}\n $isAnyItemExpandable={isAnyItemExpandable}\n onClick={onClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onTouchStart={typeof onLongPress === 'function' ? handleTouchStart : undefined}\n onTouchEnd={typeof onLongPress === 'function' ? handleTouchEnd : undefined}\n >\n <StyledListItemHeadLeftWrapper>\n {isAnyItemExpandable && (\n <StyledMotionListItemHeadIndicator\n animate={{ rotate: isOpen ? 90 : 0 }}\n initial={false}\n transition={{ type: 'tween' }}\n >\n {isExpandable && !shouldHideIndicator && (\n <Icon icons={['fa fa-chevron-right']} />\n )}\n </StyledMotionListItemHeadIndicator>\n )}\n {leftElements}\n {iconOrImageElement}\n </StyledListItemHeadLeftWrapper>\n <StyledListItemHeadContent\n ref={listItemRef}\n $isIconOrImageGiven={iconOrImageElement !== undefined}\n $isOpen={isOpen}\n >\n <StyledListItemHeadTitle>\n <StyledListItemHeadTitleContent>\n {isOpen ? (\n <StyledListItemHeadTitleText\n ref={titleRef}\n $width={openTitleWidth}\n $shouldShowMultilineTitle={shouldShowMultilineTitle}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.4 }}\n >\n {title}\n </StyledListItemHeadTitleText>\n ) : (\n <StyledListItemHeadTitleText\n $isEllipsis\n ref={ellipsisTitleRef}\n $width={openTitleWidth}\n $shouldShowMultilineTitle={shouldShowMultilineTitle}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.3 }}\n >\n {title}\n </StyledListItemHeadTitleText>\n )}\n <StyledListItemHeadTitleElement>\n {titleElement}\n </StyledListItemHeadTitleElement>\n </StyledListItemHeadTitleContent>\n </StyledListItemHeadTitle>\n {shouldShowSubtitleRow && (\n <StyledListItemHeadSubtitle ref={subTitleRef}>\n <StyledListItemHeadSubtitleText $isOpen={isOpen}>\n {subtitle}\n </StyledListItemHeadSubtitleText>\n </StyledListItemHeadSubtitle>\n )}\n </StyledListItemHeadContent>\n {rightElements && (\n <ListItemRightElements\n rightElements={rightElements}\n shouldPreventRightElementClick={shouldPreventRightElementClick}\n />\n )}\n {hoverItem && (\n <StyledMotionListItemHeadHoverItemWrapper\n className=\"beta-chayns-list-item-hover-item\"\n animate={{\n marginLeft: shouldForceHover || shouldShowHoverItem ? 8 : 0,\n opacity: shouldForceHover || shouldShowHoverItem ? 1 : 0,\n width: shouldForceHover || shouldShowHoverItem ? 'auto' : 0,\n }}\n initial={false}\n transition={{ duration: 0.15, type: 'tween' }}\n >\n <StyledMotionListItemHeadHoverItem>\n {hoverItem}\n </StyledMotionListItemHeadHoverItem>\n </StyledMotionListItemHeadHoverItemWrapper>\n )}\n </StyledListItemHead>\n );\n};\n\nListItemHead.displayName = 'ListItemHead';\n\nexport default ListItemHead;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAaA,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CAAC,EAC3BL,aAAa,iBACV5C,MAAA,CAAAa,OAAA,CAAA8F,aAAA,CAACnG,sBAAA,CAAAK,OAAqB;IAClB+B,aAAa,EAAEA,aAAc;IAC7ByD,8BAA8B,EAAEA;EAA+B,CAClE,CACJ,EACApE,SAAS,iBACNjC,MAAA,CAAAa,OAAA,CAAA8F,aAAA,CAAClG,aAAA,CAAAqI,wCAAwC;IACrCvB,SAAS,EAAC,kCAAkC;IAC5CN,OAAO,EAAE;MACL8B,UAAU,EAAE7F,gBAAgB,IAAII,mBAAmB,GAAG,CAAC,GAAG,CAAC;MAC3D4D,OAAO,EAAEhE,gBAAgB,IAAII,mBAAmB,GAAG,CAAC,GAAG,CAAC;MACxDuB,KAAK,EAAE3B,gBAAgB,IAAII,mBAAmB,GAAG,MAAM,GAAG;IAC9D,CAAE;IACF6D,OAAO,EAAE,KAAM;IACfC,UAAU,EAAE;MAAEC,QAAQ,EAAE,IAAI;MAAEC,IAAI,EAAE;IAAQ;EAAE,gBAE9CtH,MAAA,CAAAa,OAAA,CAAA8F,aAAA,CAAClG,aAAA,CAAAuI,iCAAiC,QAC7B/G,SAC8B,CACG,CAE9B,CAAC;AAE7B,CAAC;AAEDH,YAAY,CAACmH,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAtI,OAAA,GAE3BiB,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"ListItemHead.js","names":["_react","_interopRequireWildcard","require","_accordion","_Icon","_interopRequireDefault","_ListItemIcon","_ListItemImage","_ListItemRightElements","_ListItemHead","_reactResizeDetector","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ListItemHead","careOfLocationId","cornerImage","hoverItem","icons","imageBackground","images","isAnyItemExpandable","isExpandable","isOpen","isTitleGreyed","leftElements","onClick","onLongPress","rightElements","shouldHideImageOrIconBackground","shouldHideIndicator","shouldOpenImageOnClick","shouldShowRoundImageOrIcon","subtitle","shouldForceHover","title","titleElement","setShouldEnableTooltip","shouldShowHoverItem","setShouldShowHoverItem","useState","setIsFirstRender","longPressTimeoutRef","useRef","shouldShowSubtitleRow","ref","subTitleRef","height","subTitleHeight","useResizeDetector","shouldShowMultilineTitle","useMemo","handleShowTooltipResize","useCallback","data","_data$entry","el","entry","target","scrollWidth","clientWidth","titleRef","titleHeight","width","titleWidth","onResize","ellipsisTitleRef","ellipsisTitleHeight","ellipsisTitleWidth","useEffect","handleMouseEnter","handleMouseLeave","handleTouchStart","event","current","window","setTimeout","handleTouchEnd","clearTimeout","shouldPreventRightElementClick","bottom","getElementClickEvent","center","top","iconOrImageElement","createElement","shouldHideBackground","shouldShowRoundIcon","shouldShowRoundImage","undefined","StyledListItemHead","animate","opacity","initial","transition","duration","type","className","$isClickable","$isAnyItemExpandable","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd","StyledListItemHeadLeftWrapper","StyledMotionListItemHeadIndicator","rotate","StyledListItemHeadContent","$isIconOrImageGiven","$isOpen","StyledListItemHeadTitle","StyledListItemHeadTitleContent","StyledListItemHeadTitleText","key","$width","$shouldShowMultilineTitle","exit","$isEllipsis","StyledListItemHeadTitleElement","StyledListItemHeadSubtitle","StyledListItemHeadSubtitleText","StyledMotionListItemHeadHoverItemWrapper","marginLeft","StyledMotionListItemHeadHoverItem","displayName","_default","exports"],"sources":["../../../../../../src/components/list/list-item/list-item-head/ListItemHead.tsx"],"sourcesContent":["import React, {\n CSSProperties,\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { IListItemRightElements } from '../../../../types/list';\nimport { getElementClickEvent } from '../../../../utils/accordion';\nimport Icon from '../../../icon/Icon';\nimport ListItemIcon from './list-item-icon/ListItemIcon';\nimport ListItemImage from './list-item-image/ListItemImage';\nimport ListItemRightElements from './list-item-right-elements/ListItemRightElements';\nimport {\n StyledListItemHead,\n StyledListItemHeadContent,\n StyledListItemHeadLeftWrapper,\n StyledListItemHeadSubtitle,\n StyledListItemHeadSubtitleText,\n StyledListItemHeadTitle,\n StyledListItemHeadTitleContent,\n StyledListItemHeadTitleElement,\n StyledListItemHeadTitleText,\n StyledMotionListItemHeadHoverItem,\n StyledMotionListItemHeadHoverItemWrapper,\n StyledMotionListItemHeadIndicator,\n} from './ListItemHead.styles';\nimport { ResizePayload, useResizeDetector } from 'react-resize-detector';\nimport { OnRefChangeType } from 'react-resize-detector/build/types';\n\ninterface HeadHeight {\n closed: number;\n open: number;\n}\n\ntype ListItemHeadProps = {\n careOfLocationId?: number;\n cornerImage?: string;\n hoverItem?: ReactNode;\n icons?: string[];\n imageBackground?: CSSProperties['background'];\n images?: string[];\n isAnyItemExpandable: boolean;\n isExpandable: boolean;\n isOpen: boolean;\n isTitleGreyed?: boolean;\n leftElements?: ReactNode;\n onClick?: MouseEventHandler<HTMLDivElement>;\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n rightElements?: IListItemRightElements;\n shouldHideImageOrIconBackground?: boolean;\n shouldHideIndicator?: boolean;\n shouldOpenImageOnClick: boolean;\n shouldShowRoundImageOrIcon?: boolean;\n subtitle?: ReactNode;\n title: ReactNode;\n titleElement?: ReactNode;\n shouldForceHover?: boolean;\n setShouldEnableTooltip: (value: boolean) => void;\n};\n\nconst ListItemHead: FC<ListItemHeadProps> = ({\n careOfLocationId,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isAnyItemExpandable,\n isExpandable,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onLongPress,\n rightElements,\n shouldHideImageOrIconBackground,\n shouldHideIndicator,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n subtitle,\n shouldForceHover,\n title,\n titleElement,\n setShouldEnableTooltip,\n}) => {\n const [shouldShowHoverItem, setShouldShowHoverItem] = useState(false);\n const [, setIsFirstRender] = useState(false);\n\n const longPressTimeoutRef = useRef<number>();\n\n const shouldShowSubtitleRow = subtitle || typeof subtitle === 'string';\n\n const { ref: subTitleRef, height: subTitleHeight = 0 } = useResizeDetector();\n\n const shouldShowMultilineTitle = useMemo(() => !subtitle, [subtitle]);\n\n const handleShowTooltipResize = useCallback(\n (data: ResizePayload) => {\n const el = data.entry?.target;\n if (!el) return;\n setShouldEnableTooltip(el.scrollWidth > el.clientWidth);\n },\n [setShouldEnableTooltip],\n );\n\n const {\n ref: titleRef,\n height: titleHeight = 0,\n width: titleWidth = 0,\n } = useResizeDetector<HTMLDivElement>({\n onResize: handleShowTooltipResize,\n });\n\n const {\n ref: ellipsisTitleRef,\n height: ellipsisTitleHeight = 0,\n width: ellipsisTitleWidth = 0,\n } = useResizeDetector<HTMLDivElement>({\n onResize: handleShowTooltipResize,\n });\n\n const height = useMemo(\n () =>\n (isOpen ? titleHeight : ellipsisTitleHeight) +\n (shouldShowSubtitleRow ? subTitleHeight + 4 : 0),\n [ellipsisTitleHeight, isOpen, shouldShowSubtitleRow, subTitleHeight, titleHeight],\n );\n\n // This is used to trigger a rerender, so the head height can be calculated\n useEffect(() => {\n setIsFirstRender(true);\n }, []);\n\n const handleMouseEnter = useCallback(() => setShouldShowHoverItem(true), []);\n\n const handleMouseLeave = useCallback(() => setShouldShowHoverItem(false), []);\n\n const handleTouchStart = useCallback<TouchEventHandler<HTMLDivElement>>(\n (event) => {\n longPressTimeoutRef.current = window.setTimeout(() => {\n if (typeof onLongPress === 'function') {\n onLongPress(event);\n }\n }, 400);\n },\n [onLongPress],\n );\n\n const handleTouchEnd = useCallback(() => {\n clearTimeout(longPressTimeoutRef.current);\n }, []);\n\n const shouldPreventRightElementClick = useMemo(() => {\n if (!rightElements) return false;\n\n if (\n typeof rightElements === 'object' &&\n ('bottom' in rightElements || 'center' in rightElements || 'top' in rightElements)\n ) {\n if (rightElements.bottom && getElementClickEvent(rightElements.bottom)) {\n return true;\n }\n\n if (rightElements.center && getElementClickEvent(rightElements.center)) {\n return true;\n }\n\n if (rightElements.top && getElementClickEvent(rightElements.top)) {\n return true;\n }\n } else {\n return getElementClickEvent(rightElements as ReactNode);\n }\n\n return false;\n }, [rightElements]);\n\n const iconOrImageElement = useMemo(() => {\n if (icons) {\n return (\n <ListItemIcon\n icons={icons}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundIcon={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n if (images) {\n return (\n <ListItemImage\n imageBackground={imageBackground}\n careOfLocationId={careOfLocationId}\n cornerImage={cornerImage}\n images={images}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundImage={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n return undefined;\n }, [\n careOfLocationId,\n cornerImage,\n icons,\n imageBackground,\n images,\n shouldHideImageOrIconBackground,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n ]);\n\n return (\n <StyledListItemHead\n animate={{\n height,\n opacity: isTitleGreyed ? 0.5 : 1,\n }}\n initial={false}\n transition={{ duration: 0.2, type: 'tween' }}\n className=\"beta-chayns-list-item-head\"\n $isClickable={typeof onClick === 'function' || isExpandable}\n $isAnyItemExpandable={isAnyItemExpandable}\n onClick={onClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onTouchStart={typeof onLongPress === 'function' ? handleTouchStart : undefined}\n onTouchEnd={typeof onLongPress === 'function' ? handleTouchEnd : undefined}\n >\n <StyledListItemHeadLeftWrapper>\n {isAnyItemExpandable && (\n <StyledMotionListItemHeadIndicator\n animate={{ rotate: isOpen ? 90 : 0 }}\n initial={false}\n transition={{ type: 'tween' }}\n >\n {isExpandable && !shouldHideIndicator && (\n <Icon icons={['fa fa-chevron-right']} />\n )}\n </StyledMotionListItemHeadIndicator>\n )}\n {leftElements}\n {iconOrImageElement}\n </StyledListItemHeadLeftWrapper>\n <StyledListItemHeadContent\n $isIconOrImageGiven={iconOrImageElement !== undefined}\n $isOpen={isOpen}\n >\n <StyledListItemHeadTitle>\n <StyledListItemHeadTitleContent>\n {isOpen ? (\n <StyledListItemHeadTitleText\n key=\"title\"\n ref={titleRef}\n $width={titleWidth}\n $shouldShowMultilineTitle={shouldShowMultilineTitle}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.4 }}\n >\n {title}\n </StyledListItemHeadTitleText>\n ) : (\n <StyledListItemHeadTitleText\n key=\"ellipsisTitle\"\n $isEllipsis\n ref={ellipsisTitleRef}\n $width={ellipsisTitleWidth}\n $shouldShowMultilineTitle={shouldShowMultilineTitle}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.3 }}\n >\n {title}\n </StyledListItemHeadTitleText>\n )}\n <StyledListItemHeadTitleElement>\n {titleElement}\n </StyledListItemHeadTitleElement>\n </StyledListItemHeadTitleContent>\n </StyledListItemHeadTitle>\n {shouldShowSubtitleRow && (\n <StyledListItemHeadSubtitle ref={subTitleRef}>\n <StyledListItemHeadSubtitleText $isOpen={isOpen}>\n {subtitle}\n </StyledListItemHeadSubtitleText>\n </StyledListItemHeadSubtitle>\n )}\n </StyledListItemHeadContent>\n {rightElements && (\n <ListItemRightElements\n rightElements={rightElements}\n shouldPreventRightElementClick={shouldPreventRightElementClick}\n />\n )}\n {hoverItem && (\n <StyledMotionListItemHeadHoverItemWrapper\n className=\"beta-chayns-list-item-hover-item\"\n animate={{\n marginLeft: shouldForceHover || shouldShowHoverItem ? 8 : 0,\n opacity: shouldForceHover || shouldShowHoverItem ? 1 : 0,\n width: shouldForceHover || shouldShowHoverItem ? 'auto' : 0,\n }}\n initial={false}\n transition={{ duration: 0.15, type: 'tween' }}\n >\n <StyledMotionListItemHeadHoverItem>\n {hoverItem}\n </StyledMotionListItemHeadHoverItem>\n </StyledMotionListItemHeadHoverItemWrapper>\n )}\n </StyledListItemHead>\n );\n};\n\nListItemHead.displayName = 'ListItemHead';\n\nexport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,gBAAgB,IAAII,mBAAmB,GAAG,MAAM,GAAG;IAC9D,CAAE;IACFuD,OAAO,EAAE,KAAM;IACfC,UAAU,EAAE;MAAEC,QAAQ,EAAE,IAAI;MAAEC,IAAI,EAAE;IAAQ;EAAE,gBAE9ChH,MAAA,CAAAa,OAAA,CAAAwF,aAAA,CAAC5F,aAAA,CAAAkI,iCAAiC,QAC7B1G,SAC8B,CACG,CAE9B,CAAC;AAE7B,CAAC;AAEDH,YAAY,CAAC8G,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjI,OAAA,GAE3BiB,YAAY","ignoreList":[]}
@@ -8,8 +8,8 @@ import ListItemBody from './list-item-body/ListItemBody';
8
8
  import ListItemHead from './list-item-head/ListItemHead';
9
9
  import { StyledListItemTooltip, StyledMotionListItem } from './ListItem.styles';
10
10
  import Tooltip from '../../tooltip/Tooltip';
11
- import { useResizeDetector } from 'react-resize-detector';
12
11
  const ListItem = ({
12
+ backgroundColor,
13
13
  careOfLocationId,
14
14
  children,
15
15
  cornerImage,
@@ -54,9 +54,7 @@ const ListItem = ({
54
54
  } = useContext(AccordionContext);
55
55
  const areaProvider = useContext(AreaContext);
56
56
  const isInitialRenderRef = useRef(true);
57
- const {
58
- ref: listItemRef
59
- } = useResizeDetector();
57
+ const listItemRef = useRef(null);
60
58
  const uuid = useUuid();
61
59
  const isExpandable = children !== undefined;
62
60
  const isItemOpen = isOpen ?? openItemUuid === uuid;
@@ -145,6 +143,7 @@ const ListItem = ({
145
143
  key: `list-item-${uuid}`,
146
144
  ref: listItemRef,
147
145
  layout: shouldPreventLayoutAnimation ? undefined : 'position',
146
+ $backgroundColor: backgroundColor,
148
147
  $isClickable: isClickable,
149
148
  $isInAccordion: typeof isParentAccordionWrapped === 'boolean' && !shouldDisablePadding,
150
149
  $isOpen: isItemOpen,
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.js","names":["AnimatePresence","React","useCallback","useContext","useEffect","useMemo","useRef","useState","useUuid","AccordionContext","AreaContextProvider","AreaContext","ListContext","ListItemBody","ListItemHead","StyledListItemTooltip","StyledMotionListItem","Tooltip","useResizeDetector","ListItem","careOfLocationId","children","cornerImage","hoverItem","icons","imageBackground","images","isDefaultOpen","isOpen","isTitleGreyed","leftElements","onClick","onClose","onLongPress","onOpen","rightElements","shouldShowTooltipOnTitleOverflow","shouldForceBackground","shouldForceBottomLine","shouldForceHover","shouldHideBottomLine","shouldOpenImageOnClick","shouldHideImageOrIconBackground","shouldHideIndicator","shouldPreventLayoutAnimation","shouldRenderClosed","shouldShowRoundImageOrIcon","shouldShowSeparatorBelow","subtitle","title","titleElement","incrementExpandableItemCount","isAnyItemExpandable","isWrapped","openItemUuid","updateOpenItemUuid","isParentAccordionWrapped","areaProvider","isInitialRenderRef","ref","listItemRef","uuid","isExpandable","undefined","isItemOpen","onCloseRef","onOpenRef","shouldEnableTooltip","setShouldEnableTooltip","shouldDisablePadding","shouldDisableListItemPadding","current","handleHeadClick","event","shouldOnlyOpen","isClickable","headContent","createElement","animate","height","opacity","className","exit","initial","key","layout","$isClickable","$isInAccordion","$isOpen","$isWrapped","$shouldForceBackground","$shouldForceBottomLine","$shouldHideBottomLine","$shouldHideIndicator","$shouldShowSeparatorBelow","shouldUseFullWidth","isDisabled","item","style","cursor","id","shouldHideBody","displayName"],"sources":["../../../../../src/components/list/list-item/ListItem.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n CSSProperties,\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IListItemRightElements } from '../../../types/list';\nimport { AccordionContext } from '../../accordion/Accordion';\nimport AreaContextProvider, { AreaContext } from '../../area-provider/AreaContextProvider';\nimport { ListContext } from '../List';\nimport ListItemBody from './list-item-body/ListItemBody';\nimport ListItemHead from './list-item-head/ListItemHead';\nimport { StyledListItemTooltip, StyledMotionListItem } from './ListItem.styles';\nimport Tooltip from '../../tooltip/Tooltip';\nimport { useResizeDetector } from 'react-resize-detector';\n\nexport type ListItemElements = [ReactNode, ...ReactNode[]];\n\nexport type ListItemProps = {\n /**\n * DEPRECATED: Use `cornerImage` instead.\n */\n careOfLocationId?: number;\n /**\n * The content of the `ListItem` body. When the `ListItem` has children,\n * it can be opened and also gets an icon as an indicator automatically.\n */\n children?: ReactNode;\n /**\n * The image that is displayed in the bottom right corner of the grouped image of list item.\n */\n cornerImage?: string;\n /**\n * Element that is displayed when hovering over the `ListItem` on the right\n * side. On mobile devices, this element is not displayed.\n */\n hoverItem?: ReactNode;\n /**\n * The FontAwesome or tobit icons to render like an image on the left side\n * of the header. Multiple icons are stacked. See the `Icon` component\n * documentation for more information.\n */\n icons?: string[];\n /**\n * The background of the image. This is only used if images are passed.\n */\n imageBackground?: CSSProperties['background'];\n /**\n * A list of image URLs that are displayed on the left side of the header.\n * If multiple URLs are passed, the image is assembled from the first three\n * image URLs as a puzzle.\n */\n images?: string[];\n /**\n * This can be used to automatically expand the `ListItem` during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This overrides the internal opening state of the item and makes it controlled.\n */\n isOpen?: boolean;\n /**\n * Whether the ListItem locks disabled but has full functionality.\n */\n isTitleGreyed?: boolean;\n /**\n * Elements that are displayed on the left side of the header. If multiple\n * elements are specified, they are displayed one aside the other.\n */\n leftElements?: ListItemElements;\n /**\n * Function to be executed when the header of the `ListItem` was clicked\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is closed.\n */\n onClose?: VoidFunction;\n /**\n * Function to be executed when the header of the `ListItem` is pressed for\n * 400 milliseconds.\n */\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is opened.\n */\n onOpen?: VoidFunction;\n /**\n * Elements that are displayed on the right side of the header. If multiple\n * elements are specified, they are displayed one below the other.\n */\n rightElements?: IListItemRightElements;\n /**\n * This will force the background color of the ListItem to be used even if it is closed and not hovered.\n */\n shouldForceBackground?: boolean;\n /**\n * Whether the line should be forced, e.g., so that it is also displayed if the item is the last element in the list.\n */\n shouldForceBottomLine?: boolean;\n /**\n * Whether the hover item should be forced.\n */\n shouldForceHover?: boolean;\n /**\n * Whether the bottom line should be hidden.\n */\n shouldHideBottomLine?: boolean;\n /**\n * Whether the background and border of the shape on which the image or icon of the element is displayed should be\n * hidden.\n */\n shouldHideImageOrIconBackground?: boolean;\n /**\n * If the `ListItem` is expandable, the indicator is displayed on the left\n * side of the header. If this property is set to true, the indicator is\n * hidden.\n */\n shouldHideIndicator?: boolean;\n /**\n * Whether the image should be opened on click.\n */\n shouldOpenImageOnClick?: boolean;\n /**\n * Whether the layout animation should be prevented. This is useful when the\n * `ListItem` is used in a list with a lot of items and the layout animation\n * is not desired.\n */\n shouldPreventLayoutAnimation?: boolean;\n /**\n * This will render the ListItem closed on the first render.\n */\n shouldRenderClosed?: boolean;\n /**\n * Whether the image or icon should be displayed in a round shape. This should always be used for images of persons.\n */\n shouldShowRoundImageOrIcon?: boolean;\n /**\n * Whether a separator should be displayed below this item. In this case, the border is displayed thicker than normal.\n */\n shouldShowSeparatorBelow?: boolean;\n /**\n * Whether a Tooltip should be displayed on hover, if the title is cut.\n */\n shouldShowTooltipOnTitleOverflow?: boolean;\n /**\n * Subtitle of the `ListItem` displayed in the head below the title\n */\n subtitle?: ReactNode;\n /**\n * Title of the `ListItem` displayed in the head\n */\n title: ReactNode;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n};\n\nconst ListItem: FC<ListItemProps> = ({\n careOfLocationId,\n children,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isDefaultOpen,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onClose,\n onLongPress,\n onOpen,\n rightElements,\n shouldShowTooltipOnTitleOverflow = false,\n shouldForceBackground = false,\n shouldForceBottomLine = false,\n shouldForceHover = false,\n shouldHideBottomLine = false,\n shouldOpenImageOnClick = false,\n shouldHideImageOrIconBackground,\n shouldHideIndicator = false,\n shouldPreventLayoutAnimation = false,\n shouldRenderClosed = false,\n shouldShowRoundImageOrIcon,\n shouldShowSeparatorBelow = false,\n subtitle,\n title,\n titleElement,\n}) => {\n const {\n incrementExpandableItemCount,\n isAnyItemExpandable,\n isWrapped,\n openItemUuid,\n updateOpenItemUuid,\n } = useContext(ListContext);\n\n const { isWrapped: isParentAccordionWrapped } = useContext(AccordionContext);\n\n const areaProvider = useContext(AreaContext);\n\n const isInitialRenderRef = useRef(true);\n\n const { ref: listItemRef } = useResizeDetector();\n\n const uuid = useUuid();\n\n const isExpandable = children !== undefined;\n const isItemOpen = isOpen ?? openItemUuid === uuid;\n\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n\n const [shouldEnableTooltip, setShouldEnableTooltip] = useState(false);\n\n const shouldDisablePadding = useMemo(\n () => areaProvider.shouldDisableListItemPadding ?? false,\n [areaProvider.shouldDisableListItemPadding],\n );\n\n useEffect(() => {\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isItemOpen) {\n if (typeof onOpenRef.current === 'function') {\n onOpenRef.current();\n }\n } else if (typeof onCloseRef.current === 'function') {\n onCloseRef.current();\n }\n }, [isItemOpen]);\n\n const handleHeadClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (isExpandable) {\n updateOpenItemUuid(uuid);\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n },\n [isExpandable, onClick, updateOpenItemUuid, uuid],\n );\n\n useEffect(() => {\n if (isExpandable && !shouldHideIndicator) {\n // The incrementExpandableItemCount function returns an cleanup\n // function to decrement expandableItemCount if component unmounts\n return incrementExpandableItemCount();\n }\n\n return undefined;\n }, [incrementExpandableItemCount, isExpandable, shouldHideIndicator]);\n\n useEffect(() => {\n if (isDefaultOpen) {\n updateOpenItemUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenItemUuid, uuid]);\n\n const isClickable = typeof onClick === 'function' || isExpandable;\n\n const headContent = useMemo(\n () => (\n <ListItemHead\n hoverItem={hoverItem}\n careOfLocationId={careOfLocationId}\n cornerImage={cornerImage}\n icons={icons}\n imageBackground={imageBackground}\n images={images}\n isAnyItemExpandable={isAnyItemExpandable}\n isExpandable={isExpandable}\n isOpen={isItemOpen}\n isTitleGreyed={isTitleGreyed}\n leftElements={leftElements}\n onClick={isClickable ? handleHeadClick : undefined}\n onLongPress={onLongPress}\n shouldForceHover={shouldForceHover}\n rightElements={rightElements}\n shouldHideImageOrIconBackground={shouldHideImageOrIconBackground}\n shouldHideIndicator={shouldHideIndicator}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldShowRoundImageOrIcon={shouldShowRoundImageOrIcon}\n subtitle={subtitle}\n title={title}\n titleElement={titleElement}\n setShouldEnableTooltip={setShouldEnableTooltip}\n />\n ),\n [\n careOfLocationId,\n cornerImage,\n handleHeadClick,\n hoverItem,\n icons,\n imageBackground,\n images,\n isAnyItemExpandable,\n isClickable,\n isExpandable,\n isItemOpen,\n isTitleGreyed,\n leftElements,\n onLongPress,\n rightElements,\n shouldForceHover,\n shouldHideImageOrIconBackground,\n shouldHideIndicator,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n subtitle,\n title,\n titleElement,\n ],\n );\n\n return (\n <StyledMotionListItem\n animate={{ height: 'auto', opacity: 1 }}\n className=\"beta-chayns-list-item\"\n exit={{ height: 0, opacity: 0 }}\n initial={{ height: 0, opacity: 0 }}\n key={`list-item-${uuid}`}\n ref={listItemRef}\n layout={shouldPreventLayoutAnimation ? undefined : 'position'}\n $isClickable={isClickable}\n $isInAccordion={typeof isParentAccordionWrapped === 'boolean' && !shouldDisablePadding}\n $isOpen={isItemOpen}\n $isWrapped={isWrapped}\n $shouldForceBackground={shouldForceBackground}\n $shouldForceBottomLine={shouldForceBottomLine}\n $shouldHideBottomLine={shouldHideBottomLine}\n $shouldHideIndicator={shouldHideIndicator}\n $shouldShowSeparatorBelow={shouldShowSeparatorBelow}\n >\n <Tooltip\n shouldUseFullWidth\n isDisabled={!shouldShowTooltipOnTitleOverflow || !shouldEnableTooltip}\n item={\n <StyledListItemTooltip\n style={{ cursor: 'default' }}\n key={`list-item-tooltip-${uuid}`}\n >\n {title}\n </StyledListItemTooltip>\n }\n >\n {headContent}\n </Tooltip>\n <AnimatePresence initial={false}>\n {isExpandable && (isItemOpen || shouldRenderClosed) && (\n <ListItemBody\n id={uuid}\n key={`listItemBody-${uuid}`}\n shouldHideBody={shouldRenderClosed && !isItemOpen}\n >\n <AreaContextProvider>{children}</AreaContextProvider>\n </ListItemBody>\n )}\n </AnimatePresence>\n </StyledMotionListItem>\n );\n};\n\nListItem.displayName = 'ListItem';\n\nexport default ListItem;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAMRC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,OAAO,QAAQ,qBAAqB;AAE7C,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,OAAOC,mBAAmB,IAAIC,WAAW,QAAQ,yCAAyC;AAC1F,SAASC,WAAW,QAAQ,SAAS;AACrC,OAAOC,YAAY,MAAM,+BAA+B;AACxD,OAAOC,YAAY,MAAM,+BAA+B;AACxD,SAASC,qBAAqB,EAAEC,oBAAoB,QAAQ,mBAAmB;AAC/E,OAAOC,OAAO,MAAM,uBAAuB;AAC3C,SAASC,iBAAiB,QAAQ,uBAAuB;AAiJzD,MAAMC,QAA2B,GAAGA,CAAC;EACjCC,gBAAgB;EAChBC,QAAQ;EACRC,WAAW;EACXC,SAAS;EACTC,KAAK;EACLC,eAAe;EACfC,MAAM;EACNC,aAAa;EACbC,MAAM;EACN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E;EAAM,GAC3BrB,YAAY,KAAKE,UAAU,IAAInB,kBAAkB,CAAC,iBAC/C5C,KAAA,CAAA4E,aAAA,CAAChE,YAAY;IACTuF,EAAE,EAAEvC,IAAK;IACTuB,GAAG,EAAE,gBAAgBvB,IAAI,EAAG;IAC5BwC,cAAc,EAAExD,kBAAkB,IAAI,CAACmB;EAAW,gBAElD/D,KAAA,CAAA4E,aAAA,CAACnE,mBAAmB,QAAEW,QAA8B,CAC1C,CAEL,CACC,CAAC;AAE/B,CAAC;AAEDF,QAAQ,CAACmF,WAAW,GAAG,UAAU;AAEjC,eAAenF,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"ListItem.js","names":["AnimatePresence","React","useCallback","useContext","useEffect","useMemo","useRef","useState","useUuid","AccordionContext","AreaContextProvider","AreaContext","ListContext","ListItemBody","ListItemHead","StyledListItemTooltip","StyledMotionListItem","Tooltip","ListItem","backgroundColor","careOfLocationId","children","cornerImage","hoverItem","icons","imageBackground","images","isDefaultOpen","isOpen","isTitleGreyed","leftElements","onClick","onClose","onLongPress","onOpen","rightElements","shouldShowTooltipOnTitleOverflow","shouldForceBackground","shouldForceBottomLine","shouldForceHover","shouldHideBottomLine","shouldOpenImageOnClick","shouldHideImageOrIconBackground","shouldHideIndicator","shouldPreventLayoutAnimation","shouldRenderClosed","shouldShowRoundImageOrIcon","shouldShowSeparatorBelow","subtitle","title","titleElement","incrementExpandableItemCount","isAnyItemExpandable","isWrapped","openItemUuid","updateOpenItemUuid","isParentAccordionWrapped","areaProvider","isInitialRenderRef","listItemRef","uuid","isExpandable","undefined","isItemOpen","onCloseRef","onOpenRef","shouldEnableTooltip","setShouldEnableTooltip","shouldDisablePadding","shouldDisableListItemPadding","current","handleHeadClick","event","shouldOnlyOpen","isClickable","headContent","createElement","animate","height","opacity","className","exit","initial","key","ref","layout","$backgroundColor","$isClickable","$isInAccordion","$isOpen","$isWrapped","$shouldForceBackground","$shouldForceBottomLine","$shouldHideBottomLine","$shouldHideIndicator","$shouldShowSeparatorBelow","shouldUseFullWidth","isDisabled","item","style","cursor","id","shouldHideBody","displayName"],"sources":["../../../../../src/components/list/list-item/ListItem.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n CSSProperties,\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IListItemRightElements } from '../../../types/list';\nimport { AccordionContext } from '../../accordion/Accordion';\nimport AreaContextProvider, { AreaContext } from '../../area-provider/AreaContextProvider';\nimport { ListContext } from '../List';\nimport ListItemBody from './list-item-body/ListItemBody';\nimport ListItemHead from './list-item-head/ListItemHead';\nimport { StyledListItemTooltip, StyledMotionListItem } from './ListItem.styles';\nimport Tooltip from '../../tooltip/Tooltip';\n\nexport type ListItemElements = [ReactNode, ...ReactNode[]];\n\nexport type ListItemProps = {\n /**\n * The background color of the `ListItem`.\n */\n backgroundColor?: CSSProperties['backgroundColor'];\n /**\n * DEPRECATED: Use `cornerImage` instead.\n */\n careOfLocationId?: number;\n /**\n * The content of the `ListItem` body. When the `ListItem` has children,\n * it can be opened and also gets an icon as an indicator automatically.\n */\n children?: ReactNode;\n /**\n * The image that is displayed in the bottom right corner of the grouped image of list item.\n */\n cornerImage?: string;\n /**\n * Element that is displayed when hovering over the `ListItem` on the right\n * side. On mobile devices, this element is not displayed.\n */\n hoverItem?: ReactNode;\n /**\n * The FontAwesome or tobit icons to render like an image on the left side\n * of the header. Multiple icons are stacked. See the `Icon` component\n * documentation for more information.\n */\n icons?: string[];\n /**\n * The background of the image. This is only used if images are passed.\n */\n imageBackground?: CSSProperties['background'];\n /**\n * A list of image URLs that are displayed on the left side of the header.\n * If multiple URLs are passed, the image is assembled from the first three\n * image URLs as a puzzle.\n */\n images?: string[];\n /**\n * This can be used to automatically expand the `ListItem` during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This overrides the internal opening state of the item and makes it controlled.\n */\n isOpen?: boolean;\n /**\n * Whether the ListItem locks disabled but has full functionality.\n */\n isTitleGreyed?: boolean;\n /**\n * Elements that are displayed on the left side of the header. If multiple\n * elements are specified, they are displayed one aside the other.\n */\n leftElements?: ListItemElements;\n /**\n * Function to be executed when the header of the `ListItem` was clicked\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is closed.\n */\n onClose?: VoidFunction;\n /**\n * Function to be executed when the header of the `ListItem` is pressed for\n * 400 milliseconds.\n */\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is opened.\n */\n onOpen?: VoidFunction;\n /**\n * Elements that are displayed on the right side of the header. If multiple\n * elements are specified, they are displayed one below the other.\n */\n rightElements?: IListItemRightElements;\n /**\n * This will force the background color of the ListItem to be used even if it is closed and not hovered.\n */\n shouldForceBackground?: boolean;\n /**\n * Whether the line should be forced, e.g., so that it is also displayed if the item is the last element in the list.\n */\n shouldForceBottomLine?: boolean;\n /**\n * Whether the hover item should be forced.\n */\n shouldForceHover?: boolean;\n /**\n * Whether the bottom line should be hidden.\n */\n shouldHideBottomLine?: boolean;\n /**\n * Whether the background and border of the shape on which the image or icon of the element is displayed should be\n * hidden.\n */\n shouldHideImageOrIconBackground?: boolean;\n /**\n * If the `ListItem` is expandable, the indicator is displayed on the left\n * side of the header. If this property is set to true, the indicator is\n * hidden.\n */\n shouldHideIndicator?: boolean;\n /**\n * Whether the image should be opened on click.\n */\n shouldOpenImageOnClick?: boolean;\n /**\n * Whether the layout animation should be prevented. This is useful when the\n * `ListItem` is used in a list with a lot of items and the layout animation\n * is not desired.\n */\n shouldPreventLayoutAnimation?: boolean;\n /**\n * This will render the ListItem closed on the first render.\n */\n shouldRenderClosed?: boolean;\n /**\n * Whether the image or icon should be displayed in a round shape. This should always be used for images of persons.\n */\n shouldShowRoundImageOrIcon?: boolean;\n /**\n * Whether a separator should be displayed below this item. In this case, the border is displayed thicker than normal.\n */\n shouldShowSeparatorBelow?: boolean;\n /**\n * Whether a Tooltip should be displayed on hover, if the title is cut.\n */\n shouldShowTooltipOnTitleOverflow?: boolean;\n /**\n * Subtitle of the `ListItem` displayed in the head below the title\n */\n subtitle?: ReactNode;\n /**\n * Title of the `ListItem` displayed in the head\n */\n title: ReactNode;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n};\n\nconst ListItem: FC<ListItemProps> = ({\n backgroundColor,\n careOfLocationId,\n children,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isDefaultOpen,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onClose,\n onLongPress,\n onOpen,\n rightElements,\n shouldShowTooltipOnTitleOverflow = false,\n shouldForceBackground = false,\n shouldForceBottomLine = false,\n shouldForceHover = false,\n shouldHideBottomLine = false,\n shouldOpenImageOnClick = false,\n shouldHideImageOrIconBackground,\n shouldHideIndicator = false,\n shouldPreventLayoutAnimation = false,\n shouldRenderClosed = false,\n shouldShowRoundImageOrIcon,\n shouldShowSeparatorBelow = false,\n subtitle,\n title,\n titleElement,\n}) => {\n const {\n incrementExpandableItemCount,\n isAnyItemExpandable,\n isWrapped,\n openItemUuid,\n updateOpenItemUuid,\n } = useContext(ListContext);\n\n const { isWrapped: isParentAccordionWrapped } = useContext(AccordionContext);\n\n const areaProvider = useContext(AreaContext);\n\n const isInitialRenderRef = useRef(true);\n\n const listItemRef = useRef<HTMLDivElement>(null);\n\n const uuid = useUuid();\n\n const isExpandable = children !== undefined;\n const isItemOpen = isOpen ?? openItemUuid === uuid;\n\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n\n const [shouldEnableTooltip, setShouldEnableTooltip] = useState(false);\n\n const shouldDisablePadding = useMemo(\n () => areaProvider.shouldDisableListItemPadding ?? false,\n [areaProvider.shouldDisableListItemPadding],\n );\n\n useEffect(() => {\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isItemOpen) {\n if (typeof onOpenRef.current === 'function') {\n onOpenRef.current();\n }\n } else if (typeof onCloseRef.current === 'function') {\n onCloseRef.current();\n }\n }, [isItemOpen]);\n\n const handleHeadClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (isExpandable) {\n updateOpenItemUuid(uuid);\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n },\n [isExpandable, onClick, updateOpenItemUuid, uuid],\n );\n\n useEffect(() => {\n if (isExpandable && !shouldHideIndicator) {\n // The incrementExpandableItemCount function returns an cleanup\n // function to decrement expandableItemCount if component unmounts\n return incrementExpandableItemCount();\n }\n\n return undefined;\n }, [incrementExpandableItemCount, isExpandable, shouldHideIndicator]);\n\n useEffect(() => {\n if (isDefaultOpen) {\n updateOpenItemUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenItemUuid, uuid]);\n\n const isClickable = typeof onClick === 'function' || isExpandable;\n\n const headContent = useMemo(\n () => (\n <ListItemHead\n hoverItem={hoverItem}\n careOfLocationId={careOfLocationId}\n cornerImage={cornerImage}\n icons={icons}\n imageBackground={imageBackground}\n images={images}\n isAnyItemExpandable={isAnyItemExpandable}\n isExpandable={isExpandable}\n isOpen={isItemOpen}\n isTitleGreyed={isTitleGreyed}\n leftElements={leftElements}\n onClick={isClickable ? handleHeadClick : undefined}\n onLongPress={onLongPress}\n shouldForceHover={shouldForceHover}\n rightElements={rightElements}\n shouldHideImageOrIconBackground={shouldHideImageOrIconBackground}\n shouldHideIndicator={shouldHideIndicator}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldShowRoundImageOrIcon={shouldShowRoundImageOrIcon}\n subtitle={subtitle}\n title={title}\n titleElement={titleElement}\n setShouldEnableTooltip={setShouldEnableTooltip}\n />\n ),\n [\n careOfLocationId,\n cornerImage,\n handleHeadClick,\n hoverItem,\n icons,\n imageBackground,\n images,\n isAnyItemExpandable,\n isClickable,\n isExpandable,\n isItemOpen,\n isTitleGreyed,\n leftElements,\n onLongPress,\n rightElements,\n shouldForceHover,\n shouldHideImageOrIconBackground,\n shouldHideIndicator,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n subtitle,\n title,\n titleElement,\n ],\n );\n\n return (\n <StyledMotionListItem\n animate={{ height: 'auto', opacity: 1 }}\n className=\"beta-chayns-list-item\"\n exit={{ height: 0, opacity: 0 }}\n initial={{ height: 0, opacity: 0 }}\n key={`list-item-${uuid}`}\n ref={listItemRef}\n layout={shouldPreventLayoutAnimation ? undefined : 'position'}\n $backgroundColor={backgroundColor}\n $isClickable={isClickable}\n $isInAccordion={typeof isParentAccordionWrapped === 'boolean' && !shouldDisablePadding}\n $isOpen={isItemOpen}\n $isWrapped={isWrapped}\n $shouldForceBackground={shouldForceBackground}\n $shouldForceBottomLine={shouldForceBottomLine}\n $shouldHideBottomLine={shouldHideBottomLine}\n $shouldHideIndicator={shouldHideIndicator}\n $shouldShowSeparatorBelow={shouldShowSeparatorBelow}\n >\n <Tooltip\n shouldUseFullWidth\n isDisabled={!shouldShowTooltipOnTitleOverflow || !shouldEnableTooltip}\n item={\n <StyledListItemTooltip\n style={{ cursor: 'default' }}\n key={`list-item-tooltip-${uuid}`}\n >\n {title}\n </StyledListItemTooltip>\n }\n >\n {headContent}\n </Tooltip>\n <AnimatePresence initial={false}>\n {isExpandable && (isItemOpen || shouldRenderClosed) && (\n <ListItemBody\n id={uuid}\n key={`listItemBody-${uuid}`}\n shouldHideBody={shouldRenderClosed && !isItemOpen}\n >\n <AreaContextProvider>{children}</AreaContextProvider>\n </ListItemBody>\n )}\n </AnimatePresence>\n </StyledMotionListItem>\n );\n};\n\nListItem.displayName = 'ListItem';\n\nexport default ListItem;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAMRC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,O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B,EAAEtD,qBAAsB;IAC9CuD,sBAAsB,EAAEtD,qBAAsB;IAC9CuD,qBAAqB,EAAErD,oBAAqB;IAC5CsD,oBAAoB,EAAEnD,mBAAoB;IAC1CoD,yBAAyB,EAAEhD;EAAyB,gBAEpD9C,KAAA,CAAA2E,aAAA,CAAC3D,OAAO;IACJ+E,kBAAkB;IAClBC,UAAU,EAAE,CAAC7D,gCAAgC,IAAI,CAAC8B,mBAAoB;IACtEgC,IAAI,eACAjG,KAAA,CAAA2E,aAAA,CAAC7D,qBAAqB;MAClBoF,KAAK,EAAE;QAAEC,MAAM,EAAE;MAAU,CAAE;MAC7BjB,GAAG,EAAE,qBAAqBvB,IAAI;IAAG,GAEhCX,KACkB;EAC1B,GAEA0B,WACI,CAAC,eACV1E,KAAA,CAAA2E,aAAA,CAAC5E,eAAe;IAACkF,OAAO,EAAE;EAAM,GAC3BrB,YAAY,KAAKE,UAAU,IAAIlB,kBAAkB,CAAC,iBAC/C5C,KAAA,CAAA2E,aAAA,CAAC/D,YAAY;IACTwF,EAAE,EAAEzC,IAAK;IACTuB,GAAG,EAAE,gBAAgBvB,IAAI,EAAG;IAC5B0C,cAAc,EAAEzD,kBAAkB,IAAI,CAACkB;EAAW,gBAElD9D,KAAA,CAAA2E,aAAA,CAAClE,mBAAmB,QAAEW,QAA8B,CAC1C,CAEL,CACC,CAAC;AAE/B,CAAC;AAEDH,QAAQ,CAACqF,WAAW,GAAG,UAAU;AAEjC,eAAerF,QAAQ","ignoreList":[]}
@@ -19,6 +19,15 @@ export const StyledMotionListItem = styled(motion.div)`
19
19
  }) => (!$isInAccordion && $isOpen || $shouldForceBackground) && css`
20
20
  background-color: rgba(${theme['100-rgb']}, ${theme.cardBackgroundOpacity});
21
21
  `}
22
+
23
+ ${({
24
+ $backgroundColor,
25
+ $isInAccordion,
26
+ $isOpen,
27
+ $shouldForceBackground
28
+ }) => $backgroundColor && (!$isInAccordion && $isOpen || $shouldForceBackground) && css`
29
+ background-color: ${$backgroundColor} !important;
30
+ `}
22
31
 
23
32
  ${({
24
33
  $isClickable,
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.styles.js","names":["motion","styled","css","StyledMotionListItem","div","$isInAccordion","$shouldHideIndicator","$isOpen","$shouldForceBackground","theme","cardBackgroundOpacity","$isClickable","$isWrapped","$shouldHideBottomLine","$shouldForceBottomLine","$shouldShowSeparatorBelow","accordionLines","undefined","StyledListItemTooltip"],"sources":["../../../../../src/components/list/list-item/ListItem.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledListItemProps = WithTheme<{\n $isClickable: boolean;\n $isInAccordion: boolean;\n $isOpen: boolean;\n $isWrapped: boolean;\n $shouldForceBackground?: boolean;\n $shouldForceBottomLine?: boolean;\n $shouldHideBottomLine: boolean;\n $shouldHideIndicator: boolean;\n $shouldShowSeparatorBelow: boolean;\n}>;\n\nexport const StyledMotionListItem = styled(motion.div)<StyledListItemProps>`\n overflow: hidden;\n transition: background-color 0.3s ease;\n\n ${({ $isInAccordion, $shouldHideIndicator }: StyledListItemProps) =>\n $isInAccordion &&\n css`\n padding-left: ${$shouldHideIndicator ? '16px' : '8px'};\n `}\n\n ${({ $isInAccordion, $isOpen, $shouldForceBackground, theme }) =>\n ((!$isInAccordion && $isOpen) || $shouldForceBackground) &&\n css`\n background-color: rgba(${theme['100-rgb']}, ${theme.cardBackgroundOpacity});\n `}\n\n ${({ $isClickable, $isInAccordion, theme }) =>\n $isClickable &&\n !$isInAccordion &&\n css`\n &&:hover {\n background-color: rgba(${theme['100-rgb']}, ${theme.cardBackgroundOpacity});\n }\n `}\n \n ${({\n $isInAccordion,\n $isOpen,\n $isWrapped,\n $shouldHideBottomLine,\n $shouldForceBottomLine,\n $shouldShowSeparatorBelow,\n theme,\n }: StyledListItemProps) => {\n if (\n $shouldShowSeparatorBelow ||\n ((!$isOpen || $isWrapped || $isInAccordion) &&\n theme.accordionLines &&\n !$shouldHideBottomLine)\n ) {\n if ($shouldForceBottomLine) {\n return css`\n border-bottom: ${$shouldShowSeparatorBelow ? '4px' : '1px'} solid\n rgba(${theme['headline-rgb']}, 0.5);\n `;\n }\n\n return css`\n &&:not(:last-child) {\n border-bottom: ${$shouldShowSeparatorBelow ? '4px' : '1px'} solid\n rgba(${theme['headline-rgb']}, 0.5);\n }\n `;\n }\n\n return undefined;\n }}\n\n ${({ $isWrapped }) =>\n $isWrapped &&\n css`\n padding-left: 26px;\n `}\n`;\n\nexport const StyledListItemTooltip = styled.div`\n padding: 6px;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAe/C,OAAO,MAAMC,oBAAoB,GAAGF,MAAM,CAACD,MAAM,CAACI,GAAG,CAAsB;AAC3E;AACA;AACA;AACA,MAAM,CAAC;EAAEC,cAAc;EAAEC;AAA0C,CAAC,KAC5DD,cAAc,IACdH,GAAG;AACX,4BAA4BI,oBAAoB,GAAG,MAAM,GAAG,KAAK;AACjE,SAAS;AACT;AACA,MAAM,CAAC;EAAED,cAAc;EAAEE,OAAO;EAAEC,sBAAsB;EAAEC;AAAM,CAAC,KACzD,CAAE,CAACJ,cAAc,IAAIE,OAAO,IAAKC,sBAAsB,KACvDN,GAAG;AACX,qCAAqCO,KAAK,CAAC,SAAS,CAAC,KAAKA,KAAK,CAACC,qBAAqB;AACrF,SAAS;AACT;AACA,MAAM,CAAC;EAAEC,YAAY;EAAEN,cAAc;EAAEI;AAAM,CAAC,KACtCE,YAAY,IACZ,CAACN,cAAc,IACfH,GAAG;AACX;AACA,yCAAyCO,KAAK,CAAC,SAAS,CAAC,KAAKA,KAAK,CAACC,qBAAqB;AACzF;AACA,SAAS;AACT;AACA,MAAM,CAAC;EACCL,cAAc;EACdE,OAAO;EACPK,UAAU;EACVC,qBAAqB;EACrBC,sBAAsB;EACtBC,yBAAyB;EACzBN;AACiB,CAAC,KAAK;EACvB,IACIM,yBAAyB,IACxB,CAAC,CAACR,OAAO,IAAIK,UAAU,IAAIP,cAAc,KACtCI,KAAK,CAACO,cAAc,IACpB,CAACH,qBAAsB,EAC7B;IACE,IAAIC,sBAAsB,EAAE;MACxB,OAAOZ,GAAG;AAC1B,qCAAqCa,yBAAyB,GAAG,KAAK,GAAG,KAAK;AAC9E,+BAA+BN,KAAK,CAAC,cAAc,CAAC;AACpD,iBAAiB;IACL;IAEA,OAAOP,GAAG;AACtB;AACA,qCAAqCa,yBAAyB,GAAG,KAAK,GAAG,KAAK;AAC9E,+BAA+BN,KAAK,CAAC,cAAc,CAAC;AACpD;AACA,aAAa;EACL;EAEA,OAAOQ,SAAS;AACpB,CAAC;AACL;AACA,MAAM,CAAC;EAAEL;AAAW,CAAC,KACbA,UAAU,IACVV,GAAG;AACX;AACA,SAAS;AACT,CAAC;AAED,OAAO,MAAMgB,qBAAqB,GAAGjB,MAAM,CAACG,GAAG;AAC/C;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ListItem.styles.js","names":["motion","styled","css","StyledMotionListItem","div","$isInAccordion","$shouldHideIndicator","$isOpen","$shouldForceBackground","theme","cardBackgroundOpacity","$backgroundColor","$isClickable","$isWrapped","$shouldHideBottomLine","$shouldForceBottomLine","$shouldShowSeparatorBelow","accordionLines","undefined","StyledListItemTooltip"],"sources":["../../../../../src/components/list/list-item/ListItem.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { CSSProperties } from 'react';\n\ntype StyledListItemProps = WithTheme<{\n $backgroundColor?: CSSProperties['backgroundColor'];\n $isClickable: boolean;\n $isInAccordion: boolean;\n $isOpen: boolean;\n $isWrapped: boolean;\n $shouldForceBackground?: boolean;\n $shouldForceBottomLine?: boolean;\n $shouldHideBottomLine: boolean;\n $shouldHideIndicator: boolean;\n $shouldShowSeparatorBelow: boolean;\n}>;\n\nexport const StyledMotionListItem = styled(motion.div)<StyledListItemProps>`\n overflow: hidden;\n transition: background-color 0.3s ease;\n\n ${({ $isInAccordion, $shouldHideIndicator }: StyledListItemProps) =>\n $isInAccordion &&\n css`\n padding-left: ${$shouldHideIndicator ? '16px' : '8px'};\n `}\n\n ${({ $isInAccordion, $isOpen, $shouldForceBackground, theme }) =>\n ((!$isInAccordion && $isOpen) || $shouldForceBackground) &&\n css`\n background-color: rgba(${theme['100-rgb']}, ${theme.cardBackgroundOpacity});\n `}\n \n ${({ $backgroundColor, $isInAccordion, $isOpen, $shouldForceBackground }) =>\n $backgroundColor &&\n ((!$isInAccordion && $isOpen) || $shouldForceBackground) &&\n css`\n background-color: ${$backgroundColor} !important;\n `}\n\n ${({ $isClickable, $isInAccordion, theme }) =>\n $isClickable &&\n !$isInAccordion &&\n css`\n &&:hover {\n background-color: rgba(${theme['100-rgb']}, ${theme.cardBackgroundOpacity});\n }\n `}\n \n ${({\n $isInAccordion,\n $isOpen,\n $isWrapped,\n $shouldHideBottomLine,\n $shouldForceBottomLine,\n $shouldShowSeparatorBelow,\n theme,\n }: StyledListItemProps) => {\n if (\n $shouldShowSeparatorBelow ||\n ((!$isOpen || $isWrapped || $isInAccordion) &&\n theme.accordionLines &&\n !$shouldHideBottomLine)\n ) {\n if ($shouldForceBottomLine) {\n return css`\n border-bottom: ${$shouldShowSeparatorBelow ? '4px' : '1px'} solid\n rgba(${theme['headline-rgb']}, 0.5);\n `;\n }\n\n return css`\n &&:not(:last-child) {\n border-bottom: ${$shouldShowSeparatorBelow ? '4px' : '1px'} solid\n rgba(${theme['headline-rgb']}, 0.5);\n }\n `;\n }\n\n return undefined;\n }}\n\n ${({ $isWrapped }) =>\n $isWrapped &&\n css`\n padding-left: 26px;\n `}\n`;\n\nexport const StyledListItemTooltip = styled.div`\n padding: 6px;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAA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+BP,KAAK,CAAC,cAAc,CAAC;AACpD,iBAAiB;IACL;IAEA,OAAOP,GAAG;AACtB;AACA,qCAAqCc,yBAAyB,GAAG,KAAK,GAAG,KAAK;AAC9E,+BAA+BP,KAAK,CAAC,cAAc,CAAC;AACpD;AACA,aAAa;EACL;EAEA,OAAOS,SAAS;AACpB,CAAC;AACL;AACA,MAAM,CAAC;EAAEL;AAAW,CAAC,KACbA,UAAU,IACVX,GAAG;AACX;AACA,SAAS;AACT,CAAC;AAED,OAAO,MAAMiB,qBAAqB,GAAGlB,MAAM,CAACG,GAAG;AAC/C;AACA,CAAC","ignoreList":[]}
@@ -32,59 +32,34 @@ const ListItemHead = ({
32
32
  setShouldEnableTooltip
33
33
  }) => {
34
34
  const [shouldShowHoverItem, setShouldShowHoverItem] = useState(false);
35
- const [openTitleWidth, setOpenTitleWidth] = useState(0);
36
- const [headHeight, setHeadHeight] = useState({
37
- closed: 64,
38
- open: 64
39
- });
40
35
  const [, setIsFirstRender] = useState(false);
41
36
  const longPressTimeoutRef = useRef();
42
37
  const shouldShowSubtitleRow = subtitle || typeof subtitle === 'string';
43
- const handleShowTooltipResize = useCallback(ref => {
44
- if (ref.current) {
45
- const el = ref.current;
46
- setShouldEnableTooltip(el.scrollWidth > el.clientWidth);
47
- }
38
+ const {
39
+ ref: subTitleRef,
40
+ height: subTitleHeight = 0
41
+ } = useResizeDetector();
42
+ const shouldShowMultilineTitle = useMemo(() => !subtitle, [subtitle]);
43
+ const handleShowTooltipResize = useCallback(data => {
44
+ const el = data.entry?.target;
45
+ if (!el) return;
46
+ setShouldEnableTooltip(el.scrollWidth > el.clientWidth);
48
47
  }, [setShouldEnableTooltip]);
49
48
  const {
50
49
  ref: titleRef,
51
- height: titleHeight,
52
- width: titleWidth
50
+ height: titleHeight = 0,
51
+ width: titleWidth = 0
53
52
  } = useResizeDetector({
54
- onResize: () => handleShowTooltipResize(titleRef)
53
+ onResize: handleShowTooltipResize
55
54
  });
56
55
  const {
57
56
  ref: ellipsisTitleRef,
58
- height: ellipsisTitleHeight
59
- } = useResizeDetector({
60
- onResize: () => handleShowTooltipResize(ellipsisTitleRef)
61
- });
62
- const {
63
- ref: subTitleRef,
64
- height: subTitleHeight
65
- } = useResizeDetector();
66
- const {
67
- ref: listItemRef
57
+ height: ellipsisTitleHeight = 0,
58
+ width: ellipsisTitleWidth = 0
68
59
  } = useResizeDetector({
69
- onResize: () => {
70
- setOpenTitleWidth(titleWidth ?? 0);
71
- let closedHeight = (ellipsisTitleHeight ?? 0) + 24;
72
- let openHeight = (titleHeight ?? 0) + 24;
73
- if (shouldShowSubtitleRow) {
74
- if (subTitleHeight) {
75
- closedHeight += (ellipsisTitleHeight ?? 0) + 4;
76
- openHeight += subTitleHeight + 4;
77
- }
78
- }
79
- setHeadHeight({
80
- closed: closedHeight,
81
- open: openHeight
82
- });
83
- },
84
- refreshMode: 'debounce',
85
- refreshRate: 100
60
+ onResize: handleShowTooltipResize
86
61
  });
87
- const shouldShowMultilineTitle = useMemo(() => !subtitle, [subtitle]);
62
+ const height = useMemo(() => (isOpen ? titleHeight : ellipsisTitleHeight) + (shouldShowSubtitleRow ? subTitleHeight + 4 : 0), [ellipsisTitleHeight, isOpen, shouldShowSubtitleRow, subTitleHeight, titleHeight]);
88
63
 
89
64
  // This is used to trigger a rerender, so the head height can be calculated
90
65
  useEffect(() => {
@@ -142,7 +117,7 @@ const ListItemHead = ({
142
117
  }, [careOfLocationId, cornerImage, icons, imageBackground, images, shouldHideImageOrIconBackground, shouldOpenImageOnClick, shouldShowRoundImageOrIcon]);
143
118
  return /*#__PURE__*/React.createElement(StyledListItemHead, {
144
119
  animate: {
145
- height: isOpen ? headHeight.open : headHeight.closed,
120
+ height,
146
121
  opacity: isTitleGreyed ? 0.5 : 1
147
122
  },
148
123
  initial: false,
@@ -169,12 +144,12 @@ const ListItemHead = ({
169
144
  }, isExpandable && !shouldHideIndicator && /*#__PURE__*/React.createElement(Icon, {
170
145
  icons: ['fa fa-chevron-right']
171
146
  })), leftElements, iconOrImageElement), /*#__PURE__*/React.createElement(StyledListItemHeadContent, {
172
- ref: listItemRef,
173
147
  $isIconOrImageGiven: iconOrImageElement !== undefined,
174
148
  $isOpen: isOpen
175
149
  }, /*#__PURE__*/React.createElement(StyledListItemHeadTitle, null, /*#__PURE__*/React.createElement(StyledListItemHeadTitleContent, null, isOpen ? /*#__PURE__*/React.createElement(StyledListItemHeadTitleText, {
150
+ key: "title",
176
151
  ref: titleRef,
177
- $width: openTitleWidth,
152
+ $width: titleWidth,
178
153
  $shouldShowMultilineTitle: shouldShowMultilineTitle,
179
154
  initial: {
180
155
  opacity: 0
@@ -189,9 +164,10 @@ const ListItemHead = ({
189
164
  duration: 0.4
190
165
  }
191
166
  }, title) : /*#__PURE__*/React.createElement(StyledListItemHeadTitleText, {
167
+ key: "ellipsisTitle",
192
168
  $isEllipsis: true,
193
169
  ref: ellipsisTitleRef,
194
- $width: openTitleWidth,
170
+ $width: ellipsisTitleWidth,
195
171
  $shouldShowMultilineTitle: shouldShowMultilineTitle,
196
172
  initial: {
197
173
  opacity: 0
@@ -1 +1 @@
1
- {"version":3,"file":"ListItemHead.js","names":["React","useCallback","useEffect","useMemo","useRef","useState","getElementClickEvent","Icon","ListItemIcon","ListItemImage","ListItemRightElements","StyledListItemHead","StyledListItemHeadContent","StyledListItemHeadLeftWrapper","StyledListItemHeadSubtitle","StyledListItemHeadSubtitleText","StyledListItemHeadTitle","StyledListItemHeadTitleContent","StyledListItemHeadTitleElement","StyledListItemHeadTitleText","StyledMotionListItemHeadHoverItem","StyledMotionListItemHeadHoverItemWrapper","StyledMotionListItemHeadIndicator","useResizeDetector","ListItemHead","careOfLocationId","cornerImage","hoverItem","icons","imageBackground","images","isAnyItemExpandable","isExpandable","isOpen","isTitleGreyed","leftElements","onClick","onLongPress","rightElements","shouldHideImageOrIconBackground","shouldHideIndicator","shouldOpenImageOnClick","shouldShowRoundImageOrIcon","subtitle","shouldForceHover","title","titleElement","setShouldEnableTooltip","shouldShowHoverItem","setShouldShowHoverItem","openTitleWidth","setOpenTitleWidth","headHeight","setHeadHeight","closed","open","setIsFirstRender","longPressTimeoutRef","shouldShowSubtitleRow","handleShowTooltipResize","ref","current","el","scrollWidth","clientWidth","titleRef","height","titleHeight","width","titleWidth","onResize","ellipsisTitleRef","ellipsisTitleHeight","subTitleRef","subTitleHeight","listItemRef","closedHeight","openHeight","refreshMode","refreshRate","shouldShowMultilineTitle","handleMouseEnter","handleMouseLeave","handleTouchStart","event","window","setTimeout","handleTouchEnd","clearTimeout","shouldPreventRightElementClick","bottom","center","top","iconOrImageElement","createElement","shouldHideBackground","shouldShowRoundIcon","shouldShowRoundImage","undefined","animate","opacity","initial","transition","duration","type","className","$isClickable","$isAnyItemExpandable","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd","rotate","$isIconOrImageGiven","$isOpen","$width","$shouldShowMultilineTitle","exit","$isEllipsis","marginLeft","displayName"],"sources":["../../../../../../src/components/list/list-item/list-item-head/ListItemHead.tsx"],"sourcesContent":["import React, {\n CSSProperties,\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { IListItemRightElements } from '../../../../types/list';\nimport { getElementClickEvent } from '../../../../utils/accordion';\nimport Icon from '../../../icon/Icon';\nimport ListItemIcon from './list-item-icon/ListItemIcon';\nimport ListItemImage from './list-item-image/ListItemImage';\nimport ListItemRightElements from './list-item-right-elements/ListItemRightElements';\nimport {\n StyledListItemHead,\n StyledListItemHeadContent,\n StyledListItemHeadLeftWrapper,\n StyledListItemHeadSubtitle,\n StyledListItemHeadSubtitleText,\n StyledListItemHeadTitle,\n StyledListItemHeadTitleContent,\n StyledListItemHeadTitleElement,\n StyledListItemHeadTitleText,\n StyledMotionListItemHeadHoverItem,\n StyledMotionListItemHeadHoverItemWrapper,\n StyledMotionListItemHeadIndicator,\n} from './ListItemHead.styles';\nimport { useResizeDetector } from 'react-resize-detector';\nimport { OnRefChangeType } from 'react-resize-detector/build/types';\n\ninterface HeadHeight {\n closed: number;\n open: number;\n}\n\ntype ListItemHeadProps = {\n careOfLocationId?: number;\n cornerImage?: string;\n hoverItem?: ReactNode;\n icons?: string[];\n imageBackground?: CSSProperties['background'];\n images?: string[];\n isAnyItemExpandable: boolean;\n isExpandable: boolean;\n isOpen: boolean;\n isTitleGreyed?: boolean;\n leftElements?: ReactNode;\n onClick?: MouseEventHandler<HTMLDivElement>;\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n rightElements?: IListItemRightElements;\n shouldHideImageOrIconBackground?: boolean;\n shouldHideIndicator?: boolean;\n shouldOpenImageOnClick: boolean;\n shouldShowRoundImageOrIcon?: boolean;\n subtitle?: ReactNode;\n title: ReactNode;\n titleElement?: ReactNode;\n shouldForceHover?: boolean;\n setShouldEnableTooltip: (value: boolean) => void;\n};\n\nconst ListItemHead: FC<ListItemHeadProps> = ({\n careOfLocationId,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isAnyItemExpandable,\n isExpandable,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onLongPress,\n rightElements,\n shouldHideImageOrIconBackground,\n shouldHideIndicator,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n subtitle,\n shouldForceHover,\n title,\n titleElement,\n setShouldEnableTooltip,\n}) => {\n const [shouldShowHoverItem, setShouldShowHoverItem] = useState(false);\n const [openTitleWidth, setOpenTitleWidth] = useState(0);\n const [headHeight, setHeadHeight] = useState<HeadHeight>({ closed: 64, open: 64 });\n const [, setIsFirstRender] = useState(false);\n\n const longPressTimeoutRef = useRef<number>();\n\n const shouldShowSubtitleRow = subtitle || typeof subtitle === 'string';\n\n const handleShowTooltipResize = useCallback(\n (ref: OnRefChangeType<HTMLDivElement>) => {\n if (ref.current) {\n const el = ref.current;\n setShouldEnableTooltip(el.scrollWidth > el.clientWidth);\n }\n },\n [setShouldEnableTooltip],\n );\n\n const {\n ref: titleRef,\n height: titleHeight,\n width: titleWidth,\n } = useResizeDetector<HTMLDivElement>({\n onResize: () => handleShowTooltipResize(titleRef),\n });\n\n const { ref: ellipsisTitleRef, height: ellipsisTitleHeight } =\n useResizeDetector<HTMLDivElement>({\n onResize: () => handleShowTooltipResize(ellipsisTitleRef),\n });\n\n const { ref: subTitleRef, height: subTitleHeight } = useResizeDetector();\n\n const { ref: listItemRef } = useResizeDetector({\n onResize: () => {\n setOpenTitleWidth(titleWidth ?? 0);\n\n let closedHeight = (ellipsisTitleHeight ?? 0) + 24;\n let openHeight = (titleHeight ?? 0) + 24;\n\n if (shouldShowSubtitleRow) {\n if (subTitleHeight) {\n closedHeight += (ellipsisTitleHeight ?? 0) + 4;\n openHeight += subTitleHeight + 4;\n }\n }\n\n setHeadHeight({ closed: closedHeight, open: openHeight });\n },\n refreshMode: 'debounce',\n refreshRate: 100,\n });\n\n const shouldShowMultilineTitle = useMemo(() => !subtitle, [subtitle]);\n\n // This is used to trigger a rerender, so the head height can be calculated\n useEffect(() => {\n setIsFirstRender(true);\n }, []);\n\n const handleMouseEnter = useCallback(() => setShouldShowHoverItem(true), []);\n\n const handleMouseLeave = useCallback(() => setShouldShowHoverItem(false), []);\n\n const handleTouchStart = useCallback<TouchEventHandler<HTMLDivElement>>(\n (event) => {\n longPressTimeoutRef.current = window.setTimeout(() => {\n if (typeof onLongPress === 'function') {\n onLongPress(event);\n }\n }, 400);\n },\n [onLongPress],\n );\n\n const handleTouchEnd = useCallback(() => {\n clearTimeout(longPressTimeoutRef.current);\n }, []);\n\n const shouldPreventRightElementClick = useMemo(() => {\n if (!rightElements) return false;\n\n if (\n typeof rightElements === 'object' &&\n ('bottom' in rightElements || 'center' in rightElements || 'top' in rightElements)\n ) {\n if (rightElements.bottom && getElementClickEvent(rightElements.bottom)) {\n return true;\n }\n\n if (rightElements.center && getElementClickEvent(rightElements.center)) {\n return true;\n }\n\n if (rightElements.top && getElementClickEvent(rightElements.top)) {\n return true;\n }\n } else {\n return getElementClickEvent(rightElements as ReactNode);\n }\n\n return false;\n }, [rightElements]);\n\n const iconOrImageElement = useMemo(() => {\n if (icons) {\n return (\n <ListItemIcon\n icons={icons}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundIcon={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n if (images) {\n return (\n <ListItemImage\n imageBackground={imageBackground}\n careOfLocationId={careOfLocationId}\n cornerImage={cornerImage}\n images={images}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundImage={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n return undefined;\n }, [\n careOfLocationId,\n cornerImage,\n icons,\n imageBackground,\n images,\n shouldHideImageOrIconBackground,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n ]);\n\n return (\n <StyledListItemHead\n animate={{\n height: isOpen ? headHeight.open : headHeight.closed,\n opacity: isTitleGreyed ? 0.5 : 1,\n }}\n initial={false}\n transition={{ duration: 0.2, type: 'tween' }}\n className=\"beta-chayns-list-item-head\"\n $isClickable={typeof onClick === 'function' || isExpandable}\n $isAnyItemExpandable={isAnyItemExpandable}\n onClick={onClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onTouchStart={typeof onLongPress === 'function' ? handleTouchStart : undefined}\n onTouchEnd={typeof onLongPress === 'function' ? handleTouchEnd : undefined}\n >\n <StyledListItemHeadLeftWrapper>\n {isAnyItemExpandable && (\n <StyledMotionListItemHeadIndicator\n animate={{ rotate: isOpen ? 90 : 0 }}\n initial={false}\n transition={{ type: 'tween' }}\n >\n {isExpandable && !shouldHideIndicator && (\n <Icon icons={['fa fa-chevron-right']} />\n )}\n </StyledMotionListItemHeadIndicator>\n )}\n {leftElements}\n {iconOrImageElement}\n </StyledListItemHeadLeftWrapper>\n <StyledListItemHeadContent\n ref={listItemRef}\n $isIconOrImageGiven={iconOrImageElement !== undefined}\n $isOpen={isOpen}\n >\n <StyledListItemHeadTitle>\n <StyledListItemHeadTitleContent>\n {isOpen ? (\n <StyledListItemHeadTitleText\n ref={titleRef}\n $width={openTitleWidth}\n $shouldShowMultilineTitle={shouldShowMultilineTitle}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.4 }}\n >\n {title}\n </StyledListItemHeadTitleText>\n ) : (\n <StyledListItemHeadTitleText\n $isEllipsis\n ref={ellipsisTitleRef}\n $width={openTitleWidth}\n $shouldShowMultilineTitle={shouldShowMultilineTitle}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.3 }}\n >\n {title}\n </StyledListItemHeadTitleText>\n )}\n <StyledListItemHeadTitleElement>\n {titleElement}\n </StyledListItemHeadTitleElement>\n </StyledListItemHeadTitleContent>\n </StyledListItemHeadTitle>\n {shouldShowSubtitleRow && (\n <StyledListItemHeadSubtitle ref={subTitleRef}>\n <StyledListItemHeadSubtitleText $isOpen={isOpen}>\n {subtitle}\n </StyledListItemHeadSubtitleText>\n </StyledListItemHeadSubtitle>\n )}\n </StyledListItemHeadContent>\n {rightElements && (\n <ListItemRightElements\n rightElements={rightElements}\n shouldPreventRightElementClick={shouldPreventRightElementClick}\n />\n )}\n {hoverItem && (\n <StyledMotionListItemHeadHoverItemWrapper\n className=\"beta-chayns-list-item-hover-item\"\n animate={{\n marginLeft: shouldForceHover || shouldShowHoverItem ? 8 : 0,\n opacity: shouldForceHover || shouldShowHoverItem ? 1 : 0,\n width: shouldForceHover || shouldShowHoverItem ? 'auto' : 0,\n }}\n initial={false}\n transition={{ duration: 0.15, type: 'tween' }}\n >\n <StyledMotionListItemHeadHoverItem>\n {hoverItem}\n </StyledMotionListItemHeadHoverItem>\n </StyledMotionListItemHeadHoverItemWrapper>\n )}\n </StyledListItemHead>\n );\n};\n\nListItemHead.displayName = 'ListItemHead';\n\nexport default ListItemHead;\n"],"mappings":"AAAA,OAAO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BmD,8BAA8B,EAAEA;EAA+B,CAClE,CACJ,EACA9D,SAAS,iBACN3B,KAAA,CAAA8F,aAAA,CAACzE,wCAAwC;IACrCoF,SAAS,EAAC,kCAAkC;IAC5CN,OAAO,EAAE;MACLoB,UAAU,EAAE3E,gBAAgB,IAAII,mBAAmB,GAAG,CAAC,GAAG,CAAC;MAC3DoD,OAAO,EAAExD,gBAAgB,IAAII,mBAAmB,GAAG,CAAC,GAAG,CAAC;MACxDoB,KAAK,EAAExB,gBAAgB,IAAII,mBAAmB,GAAG,MAAM,GAAG;IAC9D,CAAE;IACFqD,OAAO,EAAE,KAAM;IACfC,UAAU,EAAE;MAAEC,QAAQ,EAAE,IAAI;MAAEC,IAAI,EAAE;IAAQ;EAAE,gBAE9CxG,KAAA,CAAA8F,aAAA,CAAC1E,iCAAiC,QAC7BO,SAC8B,CACG,CAE9B,CAAC;AAE7B,CAAC;AAEDH,YAAY,CAACgG,WAAW,GAAG,cAAc;AAEzC,eAAehG,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"ListItemHead.js","names":["React","useCallback","useEffect","useMemo","useRef","useState","getElementClickEvent","Icon","ListItemIcon","ListItemImage","ListItemRightElements","StyledListItemHead","StyledListItemHeadContent","StyledListItemHeadLeftWrapper","StyledListItemHeadSubtitle","StyledListItemHeadSubtitleText","StyledListItemHeadTitle","StyledListItemHeadTitleContent","StyledListItemHeadTitleElement","StyledListItemHeadTitleText","StyledMotionListItemHeadHoverItem","StyledMotionListItemHeadHoverItemWrapper","StyledMotionListItemHeadIndicator","useResizeDetector","ListItemHead","careOfLocationId","cornerImage","hoverItem","icons","imageBackground","images","isAnyItemExpandable","isExpandable","isOpen","isTitleGreyed","leftElements","onClick","onLongPress","rightElements","shouldHideImageOrIconBackground","shouldHideIndicator","shouldOpenImageOnClick","shouldShowRoundImageOrIcon","subtitle","shouldForceHover","title","titleElement","setShouldEnableTooltip","shouldShowHoverItem","setShouldShowHoverItem","setIsFirstRender","longPressTimeoutRef","shouldShowSubtitleRow","ref","subTitleRef","height","subTitleHeight","shouldShowMultilineTitle","handleShowTooltipResize","data","el","entry","target","scrollWidth","clientWidth","titleRef","titleHeight","width","titleWidth","onResize","ellipsisTitleRef","ellipsisTitleHeight","ellipsisTitleWidth","handleMouseEnter","handleMouseLeave","handleTouchStart","event","current","window","setTimeout","handleTouchEnd","clearTimeout","shouldPreventRightElementClick","bottom","center","top","iconOrImageElement","createElement","shouldHideBackground","shouldShowRoundIcon","shouldShowRoundImage","undefined","animate","opacity","initial","transition","duration","type","className","$isClickable","$isAnyItemExpandable","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd","rotate","$isIconOrImageGiven","$isOpen","key","$width","$shouldShowMultilineTitle","exit","$isEllipsis","marginLeft","displayName"],"sources":["../../../../../../src/components/list/list-item/list-item-head/ListItemHead.tsx"],"sourcesContent":["import React, {\n CSSProperties,\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { IListItemRightElements } from '../../../../types/list';\nimport { getElementClickEvent } from '../../../../utils/accordion';\nimport Icon from '../../../icon/Icon';\nimport ListItemIcon from './list-item-icon/ListItemIcon';\nimport ListItemImage from './list-item-image/ListItemImage';\nimport ListItemRightElements from './list-item-right-elements/ListItemRightElements';\nimport {\n StyledListItemHead,\n StyledListItemHeadContent,\n StyledListItemHeadLeftWrapper,\n StyledListItemHeadSubtitle,\n StyledListItemHeadSubtitleText,\n StyledListItemHeadTitle,\n StyledListItemHeadTitleContent,\n StyledListItemHeadTitleElement,\n StyledListItemHeadTitleText,\n StyledMotionListItemHeadHoverItem,\n StyledMotionListItemHeadHoverItemWrapper,\n StyledMotionListItemHeadIndicator,\n} from './ListItemHead.styles';\nimport { ResizePayload, useResizeDetector } from 'react-resize-detector';\nimport { OnRefChangeType } from 'react-resize-detector/build/types';\n\ninterface HeadHeight {\n closed: number;\n open: number;\n}\n\ntype ListItemHeadProps = {\n careOfLocationId?: number;\n cornerImage?: string;\n hoverItem?: ReactNode;\n icons?: string[];\n imageBackground?: CSSProperties['background'];\n images?: string[];\n isAnyItemExpandable: boolean;\n isExpandable: boolean;\n isOpen: boolean;\n isTitleGreyed?: boolean;\n leftElements?: ReactNode;\n onClick?: MouseEventHandler<HTMLDivElement>;\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n rightElements?: IListItemRightElements;\n shouldHideImageOrIconBackground?: boolean;\n shouldHideIndicator?: boolean;\n shouldOpenImageOnClick: boolean;\n shouldShowRoundImageOrIcon?: boolean;\n subtitle?: ReactNode;\n title: ReactNode;\n titleElement?: ReactNode;\n shouldForceHover?: boolean;\n setShouldEnableTooltip: (value: boolean) => void;\n};\n\nconst ListItemHead: FC<ListItemHeadProps> = ({\n careOfLocationId,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isAnyItemExpandable,\n isExpandable,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onLongPress,\n rightElements,\n shouldHideImageOrIconBackground,\n shouldHideIndicator,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n subtitle,\n shouldForceHover,\n title,\n titleElement,\n setShouldEnableTooltip,\n}) => {\n const [shouldShowHoverItem, setShouldShowHoverItem] = useState(false);\n const [, setIsFirstRender] = useState(false);\n\n const longPressTimeoutRef = useRef<number>();\n\n const shouldShowSubtitleRow = subtitle || typeof subtitle === 'string';\n\n const { ref: subTitleRef, height: subTitleHeight = 0 } = useResizeDetector();\n\n const shouldShowMultilineTitle = useMemo(() => !subtitle, [subtitle]);\n\n const handleShowTooltipResize = useCallback(\n (data: ResizePayload) => {\n const el = data.entry?.target;\n if (!el) return;\n setShouldEnableTooltip(el.scrollWidth > el.clientWidth);\n },\n [setShouldEnableTooltip],\n );\n\n const {\n ref: titleRef,\n height: titleHeight = 0,\n width: titleWidth = 0,\n } = useResizeDetector<HTMLDivElement>({\n onResize: handleShowTooltipResize,\n });\n\n const {\n ref: ellipsisTitleRef,\n height: ellipsisTitleHeight = 0,\n width: ellipsisTitleWidth = 0,\n } = useResizeDetector<HTMLDivElement>({\n onResize: handleShowTooltipResize,\n });\n\n const height = useMemo(\n () =>\n (isOpen ? titleHeight : ellipsisTitleHeight) +\n (shouldShowSubtitleRow ? subTitleHeight + 4 : 0),\n [ellipsisTitleHeight, isOpen, shouldShowSubtitleRow, subTitleHeight, titleHeight],\n );\n\n // This is used to trigger a rerender, so the head height can be calculated\n useEffect(() => {\n setIsFirstRender(true);\n }, []);\n\n const handleMouseEnter = useCallback(() => setShouldShowHoverItem(true), []);\n\n const handleMouseLeave = useCallback(() => setShouldShowHoverItem(false), []);\n\n const handleTouchStart = useCallback<TouchEventHandler<HTMLDivElement>>(\n (event) => {\n longPressTimeoutRef.current = window.setTimeout(() => {\n if (typeof onLongPress === 'function') {\n onLongPress(event);\n }\n }, 400);\n },\n [onLongPress],\n );\n\n const handleTouchEnd = useCallback(() => {\n clearTimeout(longPressTimeoutRef.current);\n }, []);\n\n const shouldPreventRightElementClick = useMemo(() => {\n if (!rightElements) return false;\n\n if (\n typeof rightElements === 'object' &&\n ('bottom' in rightElements || 'center' in rightElements || 'top' in rightElements)\n ) {\n if (rightElements.bottom && getElementClickEvent(rightElements.bottom)) {\n return true;\n }\n\n if (rightElements.center && getElementClickEvent(rightElements.center)) {\n return true;\n }\n\n if (rightElements.top && getElementClickEvent(rightElements.top)) {\n return true;\n }\n } else {\n return getElementClickEvent(rightElements as ReactNode);\n }\n\n return false;\n }, [rightElements]);\n\n const iconOrImageElement = useMemo(() => {\n if (icons) {\n return (\n <ListItemIcon\n icons={icons}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundIcon={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n if (images) {\n return (\n <ListItemImage\n imageBackground={imageBackground}\n careOfLocationId={careOfLocationId}\n cornerImage={cornerImage}\n images={images}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundImage={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n return undefined;\n }, [\n careOfLocationId,\n cornerImage,\n icons,\n imageBackground,\n images,\n shouldHideImageOrIconBackground,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n ]);\n\n return (\n <StyledListItemHead\n animate={{\n height,\n opacity: isTitleGreyed ? 0.5 : 1,\n }}\n initial={false}\n transition={{ duration: 0.2, type: 'tween' }}\n className=\"beta-chayns-list-item-head\"\n $isClickable={typeof onClick === 'function' || isExpandable}\n $isAnyItemExpandable={isAnyItemExpandable}\n onClick={onClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onTouchStart={typeof onLongPress === 'function' ? handleTouchStart : undefined}\n onTouchEnd={typeof onLongPress === 'function' ? handleTouchEnd : undefined}\n >\n <StyledListItemHeadLeftWrapper>\n {isAnyItemExpandable && (\n <StyledMotionListItemHeadIndicator\n animate={{ rotate: isOpen ? 90 : 0 }}\n initial={false}\n transition={{ type: 'tween' }}\n >\n {isExpandable && !shouldHideIndicator && (\n <Icon icons={['fa fa-chevron-right']} />\n )}\n </StyledMotionListItemHeadIndicator>\n )}\n {leftElements}\n {iconOrImageElement}\n </StyledListItemHeadLeftWrapper>\n <StyledListItemHeadContent\n $isIconOrImageGiven={iconOrImageElement !== undefined}\n $isOpen={isOpen}\n >\n <StyledListItemHeadTitle>\n <StyledListItemHeadTitleContent>\n {isOpen ? (\n <StyledListItemHeadTitleText\n key=\"title\"\n ref={titleRef}\n $width={titleWidth}\n $shouldShowMultilineTitle={shouldShowMultilineTitle}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.4 }}\n >\n {title}\n </StyledListItemHeadTitleText>\n ) : (\n <StyledListItemHeadTitleText\n key=\"ellipsisTitle\"\n $isEllipsis\n ref={ellipsisTitleRef}\n $width={ellipsisTitleWidth}\n $shouldShowMultilineTitle={shouldShowMultilineTitle}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.3 }}\n >\n {title}\n </StyledListItemHeadTitleText>\n )}\n <StyledListItemHeadTitleElement>\n {titleElement}\n </StyledListItemHeadTitleElement>\n </StyledListItemHeadTitleContent>\n </StyledListItemHeadTitle>\n {shouldShowSubtitleRow && (\n <StyledListItemHeadSubtitle ref={subTitleRef}>\n <StyledListItemHeadSubtitleText $isOpen={isOpen}>\n {subtitle}\n </StyledListItemHeadSubtitleText>\n </StyledListItemHeadSubtitle>\n )}\n </StyledListItemHeadContent>\n {rightElements && (\n <ListItemRightElements\n rightElements={rightElements}\n shouldPreventRightElementClick={shouldPreventRightElementClick}\n />\n )}\n {hoverItem && (\n <StyledMotionListItemHeadHoverItemWrapper\n className=\"beta-chayns-list-item-hover-item\"\n animate={{\n marginLeft: shouldForceHover || shouldShowHoverItem ? 8 : 0,\n opacity: shouldForceHover || shouldShowHoverItem ? 1 : 0,\n width: shouldForceHover || shouldShowHoverItem ? 'auto' : 0,\n }}\n initial={false}\n transition={{ duration: 0.15, type: 'tween' }}\n >\n <StyledMotionListItemHeadHoverItem>\n {hoverItem}\n </StyledMotionListItemHeadHoverItem>\n </StyledMotionListItemHeadHoverItemWrapper>\n )}\n </StyledListItemHead>\n );\n};\n\nListItemHead.displayName = 'ListItemHead';\n\nexport default ListItemHead;\n"],"mappings":"AAAA,OAAOA,KAAK,IAMRC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AAEd,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,OAAOC,IAAI,MAAM,oBAAoB;AACrC,OAAOC,YAAY,MAAM,+BAA+B;AACxD,OAAOC,aAAa,MAAM,iCAAiC;AAC3D,OAAOC,qBAAqB,MAAM,kDAAkD;AACpF,SACIC,kBAAkB,EAClBC,yBAAyB,EACzBC,6BAA6B,EAC7BC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,uB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EACzBM,qBAAqB,iBAClBpD,KAAA,CAAAuF,aAAA,CAACzE,0BAA0B;IAACuC,GAAG,EAAEC;EAAY,gBACzCtD,KAAA,CAAAuF,aAAA,CAACxE,8BAA8B;IAAC4F,OAAO,EAAE1E;EAAO,GAC3CU,QAC2B,CACR,CAET,CAAC,EAC3BL,aAAa,iBACVtC,KAAA,CAAAuF,aAAA,CAAC7E,qBAAqB;IAClB4B,aAAa,EAAEA,aAAc;IAC7B4C,8BAA8B,EAAEA;EAA+B,CAClE,CACJ,EACAvD,SAAS,iBACN3B,KAAA,CAAAuF,aAAA,CAAClE,wCAAwC;IACrC6E,SAAS,EAAC,kCAAkC;IAC5CN,OAAO,EAAE;MACLqB,UAAU,EAAErE,gBAAgB,IAAII,mBAAmB,GAAG,CAAC,GAAG,CAAC;MAC3D6C,OAAO,EAAEjD,gBAAgB,IAAII,mBAAmB,GAAG,CAAC,GAAG,CAAC;MACxDmB,KAAK,EAAEvB,gBAAgB,IAAII,mBAAmB,GAAG,MAAM,GAAG;IAC9D,CAAE;IACF8C,OAAO,EAAE,KAAM;IACfC,UAAU,EAAE;MAAEC,QAAQ,EAAE,IAAI;MAAEC,IAAI,EAAE;IAAQ;EAAE,gBAE9CjG,KAAA,CAAAuF,aAAA,CAACnE,iCAAiC,QAC7BO,SAC8B,CACG,CAE9B,CAAC;AAE7B,CAAC;AAEDH,YAAY,CAAC0F,WAAW,GAAG,cAAc;AAEzC,eAAe1F,YAAY","ignoreList":[]}
@@ -2,6 +2,10 @@ import { CSSProperties, FC, MouseEventHandler, ReactNode, TouchEventHandler } fr
2
2
  import type { IListItemRightElements } from '../../../types/list';
3
3
  export type ListItemElements = [ReactNode, ...ReactNode[]];
4
4
  export type ListItemProps = {
5
+ /**
6
+ * The background color of the `ListItem`.
7
+ */
8
+ backgroundColor?: CSSProperties['backgroundColor'];
5
9
  /**
6
10
  * DEPRECATED: Use `cornerImage` instead.
7
11
  */
@@ -1,5 +1,7 @@
1
1
  import type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';
2
+ import { CSSProperties } from 'react';
2
3
  type StyledListItemProps = WithTheme<{
4
+ $backgroundColor?: CSSProperties['backgroundColor'];
3
5
  $isClickable: boolean;
4
6
  $isInAccordion: boolean;
5
7
  $isOpen: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/core",
3
- "version": "5.0.0-beta.1170",
3
+ "version": "5.0.0-beta.1172",
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": "e0f2b7c00356b8d25b46e6d04c5c7cf8d09427c5"
89
+ "gitHead": "4abcf4f5b772650aa118f15d7f28a2abe7a84f25"
90
90
  }