@frontify/fondue 12.1.11 → 12.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"TreeItem.es.js","sources":["../../../../src/components/Tree/TreeItem/TreeItem.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useDndContext, useDndMonitor } from '@dnd-kit/core';\nimport { type AnimateLayoutChanges, useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { noop } from 'lodash-es';\nimport { Children, type MouseEvent, memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport {\n type RegisterNodeChildrenPayload,\n type TreeDragEndEvent,\n type TreeDragMoveEvent,\n type TreeDragStartEvent,\n TreeItemBorderClassMap,\n TreeItemBorderRadiusClassMap,\n TreeItemBorderStyleClassMap,\n TreeItemColorsClassMap,\n type TreeItemProps,\n TreeItemShadowClassMap,\n TreeItemSpacingClassMap,\n type TreeItemStyling,\n} from '@components/Tree/types';\nimport { useDebounce } from '@hooks/useDebounce';\nimport { FOCUS_VISIBLE_STYLE } from '@utilities/focusStyle';\nimport { merge } from '@utilities/merge';\n\nimport { EXPAND_ONHOVER_DELAY, INDENTATION_WIDTH, type Projection } from '../helpers';\nimport { removeFragmentsAndEnrichChildren, useDeepCompareEffect } from '../utils';\n\nimport { DragHandle } from './DragHandle';\nimport { ExpandButton } from './ExpandButton';\nimport { type Overlay } from './TreeItemOverlay';\nimport { useTreeItem } from './useTreeItem';\n\nconst animateLayoutChanges: AnimateLayoutChanges = ({ isSorting, wasDragging }) =>\n isSorting || wasDragging ? false : true;\n\n/** @private */\ntype TreeItemPrivateProps = {\n level?: number;\n levelConstraint?: Nullable<number>;\n parentId?: string;\n isSelected?: boolean;\n isExpanded?: boolean;\n /** onSelect is passed by the Tree component when cloning the TreeItem */\n onSelect?: (id: string) => void;\n /** onClick is the user defined callback to run after the onSelect */\n onClick?: (id: string) => void;\n onExpand?: (id: string) => void;\n onShrink?: (id: string) => void;\n projection?: Nullable<Projection>;\n registerOverlay?: (overlay: Overlay) => void;\n unregisterNodeChildren?: (payload: string) => void;\n registerNodeChildren?: (payload: RegisterNodeChildrenPayload) => void;\n};\n\n/** @private */\nexport type InternalTreeItemProps = TreeItemProps & TreeItemPrivateProps;\n\nexport const TreeItem = memo(\n ({\n id,\n type,\n label,\n onDrop,\n accepts,\n showCaret,\n children,\n parentId,\n level = 0,\n contentComponent,\n onClick,\n onSelect,\n onExpand,\n onShrink,\n registerOverlay,\n registerNodeChildren,\n unregisterNodeChildren,\n draggable = true,\n expandable = true,\n showDragHandlerOnHoverOnly = true,\n dragHandlerPosition = 'left',\n showContentWhileDragging = true,\n itemStyle,\n ignoreItemDoubleClick = false,\n expandOnSelect = false,\n 'data-test-id': dataTestId = 'fondue-tree-item',\n }: InternalTreeItemProps) => {\n const { active, over } = useDndContext();\n const { isSelected, isExpanded, projection } = useTreeItem(id);\n const expandDebounced = useRef<Nullable<string> | undefined>();\n\n const isActive = active?.id === id;\n const activeProjection = isActive && projection !== null && projection !== undefined ? projection : null;\n\n const overAccepts =\n typeof over?.data?.current?.accepts === 'string' ? over.data.current.accepts?.split(', ') : [];\n\n const parentAccepts =\n typeof activeProjection?.accepts === 'string' ? activeProjection.accepts?.split(', ') : [];\n\n const currentType = active?.data.current?.type || '';\n\n const isWithin =\n projection?.previousNode?.depth !== undefined && projection?.depth > projection?.previousNode?.depth;\n const isWithinOneLevel = isWithin && projection.depth - 1 === projection?.previousNode?.depth;\n\n const canDropWithinAndDeeper =\n isWithin &&\n projection?.previousNode?.accepts !== undefined &&\n (projection?.previousNode?.accepts.includes(`${currentType}-deeper`) ||\n projection?.previousNode?.accepts.includes(`${currentType}-within`));\n\n const canDropWithin =\n (isActive &&\n isWithinOneLevel &&\n activeProjection?.previousNode?.accepts !== undefined &&\n activeProjection?.previousNode?.accepts.includes(`${currentType}-within`)) ||\n (activeProjection?.isWithinParent && parentAccepts.includes(`${currentType}-within`));\n\n const canDrop =\n isActive && active?.data.current && ((overAccepts.includes(currentType) && !isWithin) || canDropWithin);\n\n const expandProjectionParent = useDebounce((toExpandId: string) => {\n if (expandDebounced.current === toExpandId) {\n onExpand?.(toExpandId);\n }\n }, EXPAND_ONHOVER_DELAY);\n\n useEffect(() => {\n if (isActive) {\n expandDebounced.current = isWithin ? activeProjection?.previousNode?.id : null;\n }\n\n if (\n isActive &&\n canDropWithinAndDeeper &&\n activeProjection?.parentId &&\n activeProjection.previousNode &&\n activeProjection.parentId === activeProjection.previousNode.id &&\n activeProjection.parentId !== active?.data?.current?.parentId\n ) {\n expandProjectionParent(activeProjection?.parentId);\n }\n }, [\n active?.data,\n activeProjection?.parentId,\n activeProjection?.previousNode,\n expandProjectionParent,\n isActive,\n canDropWithinAndDeeper,\n isWithin,\n ]);\n\n const handleItemDragEnd = useCallback(\n (event: TreeDragEndEvent) => {\n const { over, active } = event;\n\n if (\n !isActive ||\n !activeProjection ||\n (active.id === over?.id && activeProjection?.depth === active.data.current?.level)\n ) {\n return;\n }\n\n if (isActive && over && canDrop && onDrop) {\n onDrop({\n id: active.id,\n parentId: activeProjection.parentId,\n sort: activeProjection.position,\n contentComponent,\n parentType: activeProjection.type,\n });\n }\n },\n [isActive, activeProjection, canDrop, onDrop, contentComponent],\n );\n\n const handleItemDragStart = useCallback(\n (event: TreeDragStartEvent) => {\n if (event.active.id !== id) {\n return;\n }\n\n registerOverlay?.({\n contentComponent,\n children,\n id,\n label,\n level,\n dragHandlerPosition,\n showContentWhileDragging,\n });\n },\n [\n children,\n contentComponent,\n dragHandlerPosition,\n id,\n label,\n level,\n registerOverlay,\n showContentWhileDragging,\n ],\n );\n\n const handleItemDragMove = useCallback(\n (event: TreeDragMoveEvent) => {\n if (event.active.id === id) {\n document.body.style.setProperty('cursor', canDrop ? 'grabbing' : 'no-drop');\n }\n },\n [canDrop, id],\n );\n\n useDndMonitor({\n onDragEnd: handleItemDragEnd,\n onDragStart: handleItemDragStart,\n onDragMove: handleItemDragMove,\n });\n\n const toggleExpand = useCallback(\n (event?: MouseEvent<HTMLButtonElement>) => {\n event?.stopPropagation();\n isExpanded ? onShrink?.(id) : onExpand?.(id);\n },\n [id, isExpanded, onExpand, onShrink],\n );\n\n const handleItemClick = useDebounce(\n (event: MouseEvent<HTMLElement>) => {\n event.stopPropagation();\n if (ignoreItemDoubleClick && event.detail >= 2) {\n return;\n }\n\n if (expandOnSelect) {\n toggleExpand();\n }\n\n onSelect?.(id);\n onClick?.(id);\n },\n ignoreItemDoubleClick ? 300 : 0,\n );\n\n const isParentActive = parentId && active?.id === parentId;\n\n const hasChildren = Children.count(children) > 0;\n\n const { enrichedChildren, childrenIds } = useMemo(() => {\n const enrichedChildren = removeFragmentsAndEnrichChildren(children, { parentId: id, level: level + 1 });\n return {\n enrichedChildren,\n childrenIds: enrichedChildren.map((child) => child.props.id),\n };\n }, [children, id, level]);\n\n const {\n attributes,\n listeners,\n transform,\n transition,\n setDraggableNodeRef,\n setDroppableNodeRef,\n setActivatorNodeRef,\n } = useSortable({\n id,\n disabled: !draggable,\n data: { type, accepts, parentId, level },\n animateLayoutChanges,\n transition: null,\n });\n\n useDeepCompareEffect(() => {\n if (Children.count(enrichedChildren) === 0) {\n unregisterNodeChildren?.(id);\n return;\n }\n\n if (isActive || isParentActive) {\n unregisterNodeChildren?.(id);\n return;\n }\n\n if (isExpanded) {\n registerNodeChildren?.({ id, children: enrichedChildren });\n } else {\n unregisterNodeChildren?.(id);\n }\n }, [isActive, isExpanded, isParentActive, enrichedChildren, id]);\n\n const itemStyleProps = useMemo(() => {\n return {\n spacingY: 'none',\n contentHight: 'single-line',\n shadow: 'none',\n borderRadius: 'small',\n borderWidth: 'none',\n borderStyle: 'none',\n activeColorStyle: 'neutral',\n ...itemStyle,\n } as TreeItemStyling;\n }, [itemStyle]);\n\n const styling = TreeItemColorsClassMap[itemStyleProps.activeColorStyle ?? 'neutral'];\n\n const { liClassName, backgroundClassName } = useMemo(() => {\n return {\n liClassName: merge([\n FOCUS_VISIBLE_STYLE,\n 'tw-box-content tw-relative tw-cursor-default tw-transition-colors tw-outline-none tw-ring-inset tw-group tw-no-underline tw-leading-5',\n !isActive && isSelected ? styling.selectedTextColor : styling.textColor,\n TreeItemSpacingClassMap[itemStyleProps.spacingY ?? 'none'],\n ]),\n backgroundClassName: merge([\n 'tw-block tw-absolute tw-inset-0 tw-transition-colors -tw-z-10',\n itemStyleProps.borderWidth !== 'none'\n ? TreeItemBorderRadiusClassMap[itemStyleProps.borderRadius ?? 'small']\n : '',\n !isActive &&\n (!isSelected || itemStyleProps.activeColorStyle !== 'neutral') &&\n styling.pressedBackgroundColor,\n !isActive && isSelected ? styling.selectedBackgroundColor : styling.backgroundColor,\n ]),\n };\n }, [isActive, isSelected, itemStyleProps, styling]);\n\n const showContent = showContentWhileDragging ? true : !isActive;\n const wrapperContentClassName = merge([\n 'tw-max-w-full tw-grow tw-overflow-hidden',\n isActive && showContentWhileDragging ? 'tw-opacity-75 tw-blur-sm tw-grayscale' : '',\n ]);\n const showChildren = isExpanded && !isActive;\n const showDragHandle = draggable && !isActive;\n const showLabel = label !== undefined && !isActive;\n const showExpandButton = !isActive && expandable && (showCaret === undefined ? hasChildren : showCaret);\n\n let previousItemToBeExpandedFeedback = '';\n if (\n !isActive &&\n !isExpanded &&\n showExpandButton &&\n canDropWithinAndDeeper &&\n projection?.previousNode?.id === id &&\n projection?.depth > projection?.previousNode?.depth\n ) {\n previousItemToBeExpandedFeedback = merge([\n 'tw-border-solid tw-border-box-selected-strong',\n TreeItemBorderRadiusClassMap[itemStyleProps.borderRadius ?? 'small'],\n TreeItemBorderClassMap.small,\n ]);\n }\n\n const containerBorder =\n itemStyleProps.borderWidth !== 'none' && previousItemToBeExpandedFeedback === ''\n ? merge([\n TreeItemBorderClassMap[itemStyleProps.borderWidth ?? 'none'],\n TreeItemBorderRadiusClassMap[itemStyleProps.borderRadius ?? 'small'],\n TreeItemBorderStyleClassMap[itemStyleProps.borderStyle ?? 'none'],\n ])\n : '';\n const containerHeight = itemStyleProps.contentHight === 'single-line' ? 'tw-h-10' : 'tw-h-fit';\n const containerActiveHeight = itemStyleProps.contentHight === 'single-line' ? 'tw-h-12' : 'tw-h-fit';\n\n const containerClassName = merge([\n 'tw-relative tw-z-0 tw-transition-colors tw-flex tw-items-center tw-leading-5 tw-width-fit tw-justify-between',\n TreeItemShadowClassMap[itemStyleProps.shadow ?? 'none'],\n isActive ? 'tw-border-dashed tw-border-2 tw-pr-0' : containerBorder,\n isActive && TreeItemBorderRadiusClassMap[itemStyleProps.borderRadius ?? 'small'],\n isActive ? containerActiveHeight : containerHeight,\n isActive &&\n (canDrop\n ? 'tw-border-box-selected-strong tw-bg-box-selected-hover'\n : 'tw-bg-box-negative-hover tw-border-box-negative-strong-hover'),\n previousItemToBeExpandedFeedback,\n ]);\n\n const depthPadding = activeProjection?.depth ? activeProjection.depth * INDENTATION_WIDTH : undefined;\n const levelPadding = isActive ? 0 : level * INDENTATION_WIDTH;\n\n const liStyle = { paddingLeft: depthPadding ?? levelPadding };\n const backgroundStyle =\n itemStyleProps.borderWidth !== 'none' ? {} : { marginLeft: -1 * (depthPadding ?? levelPadding) };\n\n const style = {\n transform: CSS.Transform.toString(transform),\n transition,\n };\n\n const handlerProps = { ...listeners, ...attributes };\n const dragHandlerProps = dragHandlerPosition !== 'none' ? handlerProps : {};\n const dragHandler =\n dragHandlerPosition !== 'none' ? (\n <DragHandle\n {...dragHandlerProps}\n active={isSelected}\n ref={setActivatorNodeRef}\n disabled={!showDragHandle}\n aria-hidden={!showDragHandle}\n showDragHandlerOnHoverOnly={showDragHandlerOnHoverOnly}\n activeColorStyle={itemStyleProps.activeColorStyle ?? 'neutral'}\n />\n ) : null;\n\n const itemHandlerProps = dragHandlerPosition === 'none' ? { ...handlerProps } : {};\n\n return (\n <li\n {...itemHandlerProps}\n id={id}\n key={id}\n tabIndex={0}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"treeitem\"\n style={liStyle}\n onKeyDown={noop}\n aria-label={label}\n aria-level={level + 1}\n onClick={handleItemClick}\n className={liClassName}\n ref={setDroppableNodeRef}\n data-test-id={dataTestId}\n aria-selected={isSelected}\n aria-expanded={isExpanded}\n data-has-children={hasChildren}\n aria-owns={childrenIds.join(' ')}\n >\n <div ref={setDraggableNodeRef} className={containerClassName} style={style}>\n <span className={backgroundClassName} style={backgroundStyle} aria-hidden={true} />\n {dragHandlerPosition === 'left' && dragHandler}\n\n {expandable && (\n <ExpandButton\n active={transform?.y ? false : isSelected}\n onClick={toggleExpand}\n expanded={showChildren}\n disabled={!showExpandButton}\n aria-hidden={!showExpandButton}\n className={showExpandButton ? 'tw-visible' : 'tw-invisible tw-pointer-events-none'}\n />\n )}\n\n {showLabel && (\n <span className=\"first:tw-ml-3.5 tw-w-full tw-h-full tw-flex tw-items-center\">{label}</span>\n )}\n\n {showContent && <div className={wrapperContentClassName}>{contentComponent}</div>}\n\n {dragHandlerPosition === 'right' && dragHandler}\n </div>\n </li>\n );\n },\n);\n\nTreeItem.displayName = 'FondueTreeItem';\n"],"names":["animateLayoutChanges","isSorting","wasDragging","TreeItem","memo","id","type","label","onDrop","accepts","showCaret","children","parentId","level","contentComponent","onClick","onSelect","onExpand","onShrink","registerOverlay","registerNodeChildren","unregisterNodeChildren","draggable","expandable","showDragHandlerOnHoverOnly","dragHandlerPosition","showContentWhileDragging","itemStyle","ignoreItemDoubleClick","expandOnSelect","dataTestId","active","over","useDndContext","isSelected","isExpanded","projection","useTreeItem","expandDebounced","useRef","isActive","activeProjection","overAccepts","_b","_a","_c","parentAccepts","_d","currentType","_e","isWithin","_f","_g","isWithinOneLevel","_h","canDropWithinAndDeeper","_i","_j","_k","canDropWithin","_l","_m","canDrop","expandProjectionParent","useDebounce","toExpandId","EXPAND_ONHOVER_DELAY","useEffect","handleItemDragEnd","useCallback","event","handleItemDragStart","handleItemDragMove","useDndMonitor","toggleExpand","handleItemClick","isParentActive","hasChildren","Children","enrichedChildren","childrenIds","useMemo","removeFragmentsAndEnrichChildren","child","attributes","listeners","transform","transition","setDraggableNodeRef","setDroppableNodeRef","setActivatorNodeRef","useSortable","useDeepCompareEffect","itemStyleProps","styling","TreeItemColorsClassMap","liClassName","backgroundClassName","merge","FOCUS_VISIBLE_STYLE","TreeItemSpacingClassMap","TreeItemBorderRadiusClassMap","showContent","wrapperContentClassName","showChildren","showDragHandle","showLabel","showExpandButton","previousItemToBeExpandedFeedback","_n","_o","TreeItemBorderClassMap","containerBorder","TreeItemBorderStyleClassMap","containerHeight","containerActiveHeight","containerClassName","TreeItemShadowClassMap","depthPadding","INDENTATION_WIDTH","levelPadding","liStyle","backgroundStyle","style","CSS","handlerProps","dragHandler","jsx","DragHandle","itemHandlerProps","createElement","noop","ExpandButton"],"mappings":";;;;;;;;;;;;;;;;AAkCA,MAAMA,KAA6C,CAAC,EAAE,WAAAC,GAAW,aAAAC,QAC7D,EAAAD,KAAaC,IAwBJC,KAAWC;AAAA,EACpB,CAAC;AAAA,IACG,IAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,kBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,YAAAC,IAAa;AAAA,IACb,4BAAAC,KAA6B;AAAA,IAC7B,qBAAAC,IAAsB;AAAA,IACtB,0BAAAC,IAA2B;AAAA,IAC3B,WAAAC;AAAA,IACA,uBAAAC,IAAwB;AAAA,IACxB,gBAAAC,KAAiB;AAAA,IACjB,gBAAgBC,KAAa;AAAA,EAAA,MACJ;;AACzB,UAA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B,WAAWqG;AAAA,MAAA,GACxC;AAAA,IAAA;AAAA,EAGZ;AACJ;AAEA3H,GAAS,cAAc;"}
1
+ {"version":3,"file":"TreeItem.es.js","sources":["../../../../src/components/Tree/TreeItem/TreeItem.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useDndContext, useDndMonitor } from '@dnd-kit/core';\nimport { type AnimateLayoutChanges, useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport noop from 'lodash-es/noop';\nimport { Children, type MouseEvent, memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport {\n type RegisterNodeChildrenPayload,\n type TreeDragEndEvent,\n type TreeDragMoveEvent,\n type TreeDragStartEvent,\n TreeItemBorderClassMap,\n TreeItemBorderRadiusClassMap,\n TreeItemBorderStyleClassMap,\n TreeItemColorsClassMap,\n type TreeItemProps,\n TreeItemShadowClassMap,\n TreeItemSpacingClassMap,\n type TreeItemStyling,\n} from '@components/Tree/types';\nimport { useDebounce } from '@hooks/useDebounce';\nimport { FOCUS_VISIBLE_STYLE } from '@utilities/focusStyle';\nimport { merge } from '@utilities/merge';\n\nimport { EXPAND_ONHOVER_DELAY, INDENTATION_WIDTH, type Projection } from '../helpers';\nimport { removeFragmentsAndEnrichChildren, useDeepCompareEffect } from '../utils';\n\nimport { DragHandle } from './DragHandle';\nimport { ExpandButton } from './ExpandButton';\nimport { type Overlay } from './TreeItemOverlay';\nimport { useTreeItem } from './useTreeItem';\n\nconst animateLayoutChanges: AnimateLayoutChanges = ({ isSorting, wasDragging }) =>\n isSorting || wasDragging ? false : true;\n\n/** @private */\ntype TreeItemPrivateProps = {\n level?: number;\n levelConstraint?: Nullable<number>;\n parentId?: string;\n isSelected?: boolean;\n isExpanded?: boolean;\n /** onSelect is passed by the Tree component when cloning the TreeItem */\n onSelect?: (id: string) => void;\n /** onClick is the user defined callback to run after the onSelect */\n onClick?: (id: string) => void;\n onExpand?: (id: string) => void;\n onShrink?: (id: string) => void;\n projection?: Nullable<Projection>;\n registerOverlay?: (overlay: Overlay) => void;\n unregisterNodeChildren?: (payload: string) => void;\n registerNodeChildren?: (payload: RegisterNodeChildrenPayload) => void;\n};\n\n/** @private */\nexport type InternalTreeItemProps = TreeItemProps & TreeItemPrivateProps;\n\nexport const TreeItem = memo(\n ({\n id,\n type,\n label,\n onDrop,\n accepts,\n showCaret,\n children,\n parentId,\n level = 0,\n contentComponent,\n onClick,\n onSelect,\n onExpand,\n onShrink,\n registerOverlay,\n registerNodeChildren,\n unregisterNodeChildren,\n draggable = true,\n expandable = true,\n showDragHandlerOnHoverOnly = true,\n dragHandlerPosition = 'left',\n showContentWhileDragging = true,\n itemStyle,\n ignoreItemDoubleClick = false,\n expandOnSelect = false,\n 'data-test-id': dataTestId = 'fondue-tree-item',\n }: InternalTreeItemProps) => {\n const { active, over } = useDndContext();\n const { isSelected, isExpanded, projection } = useTreeItem(id);\n const expandDebounced = useRef<Nullable<string> | undefined>();\n\n const isActive = active?.id === id;\n const activeProjection = isActive && projection !== null && projection !== undefined ? projection : null;\n\n const overAccepts =\n typeof over?.data?.current?.accepts === 'string' ? over.data.current.accepts?.split(', ') : [];\n\n const parentAccepts =\n typeof activeProjection?.accepts === 'string' ? activeProjection.accepts?.split(', ') : [];\n\n const currentType = active?.data.current?.type || '';\n\n const isWithin =\n projection?.previousNode?.depth !== undefined && projection?.depth > projection?.previousNode?.depth;\n const isWithinOneLevel = isWithin && projection.depth - 1 === projection?.previousNode?.depth;\n\n const canDropWithinAndDeeper =\n isWithin &&\n projection?.previousNode?.accepts !== undefined &&\n (projection?.previousNode?.accepts.includes(`${currentType}-deeper`) ||\n projection?.previousNode?.accepts.includes(`${currentType}-within`));\n\n const canDropWithin =\n (isActive &&\n isWithinOneLevel &&\n activeProjection?.previousNode?.accepts !== undefined &&\n activeProjection?.previousNode?.accepts.includes(`${currentType}-within`)) ||\n (activeProjection?.isWithinParent && parentAccepts.includes(`${currentType}-within`));\n\n const canDrop =\n isActive && active?.data.current && ((overAccepts.includes(currentType) && !isWithin) || canDropWithin);\n\n const expandProjectionParent = useDebounce((toExpandId: string) => {\n if (expandDebounced.current === toExpandId) {\n onExpand?.(toExpandId);\n }\n }, EXPAND_ONHOVER_DELAY);\n\n useEffect(() => {\n if (isActive) {\n expandDebounced.current = isWithin ? activeProjection?.previousNode?.id : null;\n }\n\n if (\n isActive &&\n canDropWithinAndDeeper &&\n activeProjection?.parentId &&\n activeProjection.previousNode &&\n activeProjection.parentId === activeProjection.previousNode.id &&\n activeProjection.parentId !== active?.data?.current?.parentId\n ) {\n expandProjectionParent(activeProjection?.parentId);\n }\n }, [\n active?.data,\n activeProjection?.parentId,\n activeProjection?.previousNode,\n expandProjectionParent,\n isActive,\n canDropWithinAndDeeper,\n isWithin,\n ]);\n\n const handleItemDragEnd = useCallback(\n (event: TreeDragEndEvent) => {\n const { over, active } = event;\n\n if (\n !isActive ||\n !activeProjection ||\n (active.id === over?.id && activeProjection?.depth === active.data.current?.level)\n ) {\n return;\n }\n\n if (isActive && over && canDrop && onDrop) {\n onDrop({\n id: active.id,\n parentId: activeProjection.parentId,\n sort: activeProjection.position,\n contentComponent,\n parentType: activeProjection.type,\n });\n }\n },\n [isActive, activeProjection, canDrop, onDrop, contentComponent],\n );\n\n const handleItemDragStart = useCallback(\n (event: TreeDragStartEvent) => {\n if (event.active.id !== id) {\n return;\n }\n\n registerOverlay?.({\n contentComponent,\n children,\n id,\n label,\n level,\n dragHandlerPosition,\n showContentWhileDragging,\n });\n },\n [\n children,\n contentComponent,\n dragHandlerPosition,\n id,\n label,\n level,\n registerOverlay,\n showContentWhileDragging,\n ],\n );\n\n const handleItemDragMove = useCallback(\n (event: TreeDragMoveEvent) => {\n if (event.active.id === id) {\n document.body.style.setProperty('cursor', canDrop ? 'grabbing' : 'no-drop');\n }\n },\n [canDrop, id],\n );\n\n useDndMonitor({\n onDragEnd: handleItemDragEnd,\n onDragStart: handleItemDragStart,\n onDragMove: handleItemDragMove,\n });\n\n const toggleExpand = useCallback(\n (event?: MouseEvent<HTMLButtonElement>) => {\n event?.stopPropagation();\n isExpanded ? onShrink?.(id) : onExpand?.(id);\n },\n [id, isExpanded, onExpand, onShrink],\n );\n\n const handleItemClick = useDebounce(\n (event: MouseEvent<HTMLElement>) => {\n event.stopPropagation();\n if (ignoreItemDoubleClick && event.detail >= 2) {\n return;\n }\n\n if (expandOnSelect) {\n toggleExpand();\n }\n\n onSelect?.(id);\n onClick?.(id);\n },\n ignoreItemDoubleClick ? 300 : 0,\n );\n\n const isParentActive = parentId && active?.id === parentId;\n\n const hasChildren = Children.count(children) > 0;\n\n const { enrichedChildren, childrenIds } = useMemo(() => {\n const enrichedChildren = removeFragmentsAndEnrichChildren(children, { parentId: id, level: level + 1 });\n return {\n enrichedChildren,\n childrenIds: enrichedChildren.map((child) => child.props.id),\n };\n }, [children, id, level]);\n\n const {\n attributes,\n listeners,\n transform,\n transition,\n setDraggableNodeRef,\n setDroppableNodeRef,\n setActivatorNodeRef,\n } = useSortable({\n id,\n disabled: !draggable,\n data: { type, accepts, parentId, level },\n animateLayoutChanges,\n transition: null,\n });\n\n useDeepCompareEffect(() => {\n if (Children.count(enrichedChildren) === 0) {\n unregisterNodeChildren?.(id);\n return;\n }\n\n if (isActive || isParentActive) {\n unregisterNodeChildren?.(id);\n return;\n }\n\n if (isExpanded) {\n registerNodeChildren?.({ id, children: enrichedChildren });\n } else {\n unregisterNodeChildren?.(id);\n }\n }, [isActive, isExpanded, isParentActive, enrichedChildren, id]);\n\n const itemStyleProps = useMemo(() => {\n return {\n spacingY: 'none',\n contentHight: 'single-line',\n shadow: 'none',\n borderRadius: 'small',\n borderWidth: 'none',\n borderStyle: 'none',\n activeColorStyle: 'neutral',\n ...itemStyle,\n } as TreeItemStyling;\n }, [itemStyle]);\n\n const styling = TreeItemColorsClassMap[itemStyleProps.activeColorStyle ?? 'neutral'];\n\n const { liClassName, backgroundClassName } = useMemo(() => {\n return {\n liClassName: merge([\n FOCUS_VISIBLE_STYLE,\n 'tw-box-content tw-relative tw-cursor-default tw-transition-colors tw-outline-none tw-ring-inset tw-group tw-no-underline tw-leading-5',\n !isActive && isSelected ? styling.selectedTextColor : styling.textColor,\n TreeItemSpacingClassMap[itemStyleProps.spacingY ?? 'none'],\n ]),\n backgroundClassName: merge([\n 'tw-block tw-absolute tw-inset-0 tw-transition-colors -tw-z-10',\n itemStyleProps.borderWidth !== 'none'\n ? TreeItemBorderRadiusClassMap[itemStyleProps.borderRadius ?? 'small']\n : '',\n !isActive &&\n (!isSelected || itemStyleProps.activeColorStyle !== 'neutral') &&\n styling.pressedBackgroundColor,\n !isActive && isSelected ? styling.selectedBackgroundColor : styling.backgroundColor,\n ]),\n };\n }, [isActive, isSelected, itemStyleProps, styling]);\n\n const showContent = showContentWhileDragging ? true : !isActive;\n const wrapperContentClassName = merge([\n 'tw-max-w-full tw-grow tw-overflow-hidden',\n isActive && showContentWhileDragging ? 'tw-opacity-75 tw-blur-sm tw-grayscale' : '',\n ]);\n const showChildren = isExpanded && !isActive;\n const showDragHandle = draggable && !isActive;\n const showLabel = label !== undefined && !isActive;\n const showExpandButton = !isActive && expandable && (showCaret === undefined ? hasChildren : showCaret);\n\n let previousItemToBeExpandedFeedback = '';\n if (\n !isActive &&\n !isExpanded &&\n showExpandButton &&\n canDropWithinAndDeeper &&\n projection?.previousNode?.id === id &&\n projection?.depth > projection?.previousNode?.depth\n ) {\n previousItemToBeExpandedFeedback = merge([\n 'tw-border-solid tw-border-box-selected-strong',\n TreeItemBorderRadiusClassMap[itemStyleProps.borderRadius ?? 'small'],\n TreeItemBorderClassMap.small,\n ]);\n }\n\n const containerBorder =\n itemStyleProps.borderWidth !== 'none' && previousItemToBeExpandedFeedback === ''\n ? merge([\n TreeItemBorderClassMap[itemStyleProps.borderWidth ?? 'none'],\n TreeItemBorderRadiusClassMap[itemStyleProps.borderRadius ?? 'small'],\n TreeItemBorderStyleClassMap[itemStyleProps.borderStyle ?? 'none'],\n ])\n : '';\n const containerHeight = itemStyleProps.contentHight === 'single-line' ? 'tw-h-10' : 'tw-h-fit';\n const containerActiveHeight = itemStyleProps.contentHight === 'single-line' ? 'tw-h-12' : 'tw-h-fit';\n\n const containerClassName = merge([\n 'tw-relative tw-z-0 tw-transition-colors tw-flex tw-items-center tw-leading-5 tw-width-fit tw-justify-between',\n TreeItemShadowClassMap[itemStyleProps.shadow ?? 'none'],\n isActive ? 'tw-border-dashed tw-border-2 tw-pr-0' : containerBorder,\n isActive && TreeItemBorderRadiusClassMap[itemStyleProps.borderRadius ?? 'small'],\n isActive ? containerActiveHeight : containerHeight,\n isActive &&\n (canDrop\n ? 'tw-border-box-selected-strong tw-bg-box-selected-hover'\n : 'tw-bg-box-negative-hover tw-border-box-negative-strong-hover'),\n previousItemToBeExpandedFeedback,\n ]);\n\n const depthPadding = activeProjection?.depth ? activeProjection.depth * INDENTATION_WIDTH : undefined;\n const levelPadding = isActive ? 0 : level * INDENTATION_WIDTH;\n\n const liStyle = { paddingLeft: depthPadding ?? levelPadding };\n const backgroundStyle =\n itemStyleProps.borderWidth !== 'none' ? {} : { marginLeft: -1 * (depthPadding ?? levelPadding) };\n\n const style = {\n transform: CSS.Transform.toString(transform),\n transition,\n };\n\n const handlerProps = { ...listeners, ...attributes };\n const dragHandlerProps = dragHandlerPosition !== 'none' ? handlerProps : {};\n const dragHandler =\n dragHandlerPosition !== 'none' ? (\n <DragHandle\n {...dragHandlerProps}\n active={isSelected}\n ref={setActivatorNodeRef}\n disabled={!showDragHandle}\n aria-hidden={!showDragHandle}\n showDragHandlerOnHoverOnly={showDragHandlerOnHoverOnly}\n activeColorStyle={itemStyleProps.activeColorStyle ?? 'neutral'}\n />\n ) : null;\n\n const itemHandlerProps = dragHandlerPosition === 'none' ? { ...handlerProps } : {};\n\n return (\n <li\n {...itemHandlerProps}\n id={id}\n key={id}\n tabIndex={0}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"treeitem\"\n style={liStyle}\n onKeyDown={noop}\n aria-label={label}\n aria-level={level + 1}\n onClick={handleItemClick}\n className={liClassName}\n ref={setDroppableNodeRef}\n data-test-id={dataTestId}\n aria-selected={isSelected}\n aria-expanded={isExpanded}\n data-has-children={hasChildren}\n aria-owns={childrenIds.join(' ')}\n >\n <div ref={setDraggableNodeRef} className={containerClassName} style={style}>\n <span className={backgroundClassName} style={backgroundStyle} aria-hidden={true} />\n {dragHandlerPosition === 'left' && dragHandler}\n\n {expandable && (\n <ExpandButton\n active={transform?.y ? false : isSelected}\n onClick={toggleExpand}\n expanded={showChildren}\n disabled={!showExpandButton}\n aria-hidden={!showExpandButton}\n className={showExpandButton ? 'tw-visible' : 'tw-invisible tw-pointer-events-none'}\n />\n )}\n\n {showLabel && (\n <span className=\"first:tw-ml-3.5 tw-w-full tw-h-full tw-flex tw-items-center\">{label}</span>\n )}\n\n {showContent && <div className={wrapperContentClassName}>{contentComponent}</div>}\n\n {dragHandlerPosition === 'right' && dragHandler}\n </div>\n </li>\n );\n },\n);\n\nTreeItem.displayName = 'FondueTreeItem';\n"],"names":["animateLayoutChanges","isSorting","wasDragging","TreeItem","memo","id","type","label","onDrop","accepts","showCaret","children","parentId","level","contentComponent","onClick","onSelect","onExpand","onShrink","registerOverlay","registerNodeChildren","unregisterNodeChildren","draggable","expandable","showDragHandlerOnHoverOnly","dragHandlerPosition","showContentWhileDragging","itemStyle","ignoreItemDoubleClick","expandOnSelect","dataTestId","active","over","useDndContext","isSelected","isExpanded","projection","useTreeItem","expandDebounced","useRef","isActive","activeProjection","overAccepts","_b","_a","_c","parentAccepts","_d","currentType","_e","isWithin","_f","_g","isWithinOneLevel","_h","canDropWithinAndDeeper","_i","_j","_k","canDropWithin","_l","_m","canDrop","expandProjectionParent","useDebounce","toExpandId","EXPAND_ONHOVER_DELAY","useEffect","handleItemDragEnd","useCallback","event","handleItemDragStart","handleItemDragMove","useDndMonitor","toggleExpand","handleItemClick","isParentActive","hasChildren","Children","enrichedChildren","childrenIds","useMemo","removeFragmentsAndEnrichChildren","child","attributes","listeners","transform","transition","setDraggableNodeRef","setDroppableNodeRef","setActivatorNodeRef","useSortable","useDeepCompareEffect","itemStyleProps","styling","TreeItemColorsClassMap","liClassName","backgroundClassName","merge","FOCUS_VISIBLE_STYLE","TreeItemSpacingClassMap","TreeItemBorderRadiusClassMap","showContent","wrapperContentClassName","showChildren","showDragHandle","showLabel","showExpandButton","previousItemToBeExpandedFeedback","_n","_o","TreeItemBorderClassMap","containerBorder","TreeItemBorderStyleClassMap","containerHeight","containerActiveHeight","containerClassName","TreeItemShadowClassMap","depthPadding","INDENTATION_WIDTH","levelPadding","liStyle","backgroundStyle","style","CSS","handlerProps","dragHandler","jsx","DragHandle","itemHandlerProps","createElement","noop","ExpandButton"],"mappings":";;;;;;;;;;;;;;;;AAkCA,MAAMA,KAA6C,CAAC,EAAE,WAAAC,GAAW,aAAAC,QAC7D,EAAAD,KAAaC,IAwBJC,KAAWC;AAAA,EACpB,CAAC;AAAA,IACG,IAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,kBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,YAAAC,IAAa;AAAA,IACb,4BAAAC,KAA6B;AAAA,IAC7B,qBAAAC,IAAsB;AAAA,IACtB,0BAAAC,IAA2B;AAAA,IAC3B,WAAAC;AAAA,IACA,uBAAAC,IAAwB;AAAA,IACxB,gBAAAC,KAAiB;AAAA,IACjB,gBAAgBC,KAAa;AAAA,EAAA,MACJ;;AACzB,UAAM,EAAE,QAAAC,GAAQ,MAAAC,EAAK,IA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A;AAAA,EAGZ;AACJ;AAEA3H,GAAS,cAAc;"}
@@ -1,16 +1,16 @@
1
1
  import { jsx as t, jsxs as $ } from "react/jsx-runtime";
2
- import { memo as q, useRef as D, useCallback as G, useEffect as J, Children as M, useMemo as x } from "react";
3
- import { Checkbox as Q, CheckboxEmphasis as V, CheckboxSize as X, CheckboxState as Z } from "../../Checkbox/Checkbox.es.js";
4
- import { getMultiselectLiClassName as S, getMultiselectBackgroundClassName as ee, getMultiselectContainerClassName as te } from "../helpers/multiselectTreeItemstyling.es.js";
5
- import { ExpandButton as ae } from "./ExpandButton.es.js";
6
- import { useMultiselectTreeItem as se } from "./useMultiselectTreeItem.es.js";
7
- import { Container as oe } from "../../Container/Container.es.js";
8
- import { getMultiselectCheckBoxState as re } from "../helpers/multiselect.es.js";
9
- import le from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.es.js";
2
+ import q from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.es.js";
3
+ import { memo as D, useRef as G, useCallback as J, useEffect as Q, Children as M, useMemo as x } from "react";
4
+ import { Checkbox as V, CheckboxEmphasis as X, CheckboxSize as Z, CheckboxState as S } from "../../Checkbox/Checkbox.es.js";
5
+ import { getMultiselectLiClassName as ee, getMultiselectBackgroundClassName as te, getMultiselectContainerClassName as ae } from "../helpers/multiselectTreeItemstyling.es.js";
6
+ import { ExpandButton as se } from "./ExpandButton.es.js";
7
+ import { useMultiselectTreeItem as oe } from "./useMultiselectTreeItem.es.js";
8
+ import { Container as re } from "../../Container/Container.es.js";
9
+ import { getMultiselectCheckBoxState as le } from "../helpers/multiselect.es.js";
10
10
  import { removeFragmentsAndEnrichChildren as ne } from "../utils/removeFragmentsAndEnrichChildren.es.js";
11
11
  import { useDeepCompareEffect as ce } from "../utils/useDeepCompareEffect.es.js";
12
12
  import { INDENTATION_WIDTH as me } from "../helpers/constants.es.js";
13
- const ie = q(
13
+ const ie = D(
14
14
  ({
15
15
  id: e,
16
16
  label: c,
@@ -30,13 +30,13 @@ const ie = q(
30
30
  itemStyle: g,
31
31
  "data-test-id": W = "fondue-tree-item"
32
32
  }) => {
33
- const B = D(null), { isSelected: o, isExpanded: r, isPartialSelected: E, isParentSelected: N } = se(e), j = G(
33
+ const B = G(null), { isSelected: o, isExpanded: r, isPartialSelected: E, isParentSelected: N } = oe(e), j = J(
34
34
  (l) => {
35
35
  l == null || l.stopPropagation(), r ? p == null || p(e) : i == null || i(e);
36
36
  },
37
37
  [e, r, i, p]
38
38
  );
39
- J(() => {
39
+ Q(() => {
40
40
  N && !o && a && a(e, !0);
41
41
  }, [e, a, N, o, L]);
42
42
  const I = M.count(u) > 0, { enrichedChildren: C, childrenIds: A } = x(() => {
@@ -66,23 +66,23 @@ const ie = q(
66
66
  activeColorStyle: "neutral",
67
67
  ...g
68
68
  }), [g]), { liClassName: H, backgroundClassName: P } = x(() => ({
69
- liClassName: S(n, s),
70
- backgroundClassName: ee(n, o, s)
71
- }), [n, s, o]), R = "tw-max-w-full tw-grow", z = r, F = c !== void 0, w = b && (T ?? I), O = te(n), k = m * me, K = { paddingLeft: k }, U = n.borderWidth !== "none" ? {} : { marginLeft: -1 * k }, Y = s ? () => {
72
- } : () => a == null ? void 0 : a(e, !1), y = h !== "none" ? /* @__PURE__ */ t(oe, { maxWidth: "16px", maxHeight: "16px", children: /* @__PURE__ */ t(
73
- Q,
69
+ liClassName: ee(n, s),
70
+ backgroundClassName: te(n, o, s)
71
+ }), [n, s, o]), R = "tw-max-w-full tw-grow", z = r, F = c !== void 0, w = b && (T ?? I), O = ae(n), k = m * me, K = { paddingLeft: k }, U = n.borderWidth !== "none" ? {} : { marginLeft: -1 * k }, Y = s ? () => {
72
+ } : () => a == null ? void 0 : a(e, !1), y = h !== "none" ? /* @__PURE__ */ t(re, { maxWidth: "16px", maxHeight: "16px", children: /* @__PURE__ */ t(
73
+ V,
74
74
  {
75
75
  id: `checkbox-${e}`,
76
76
  ref: B,
77
77
  disabled: s,
78
78
  "aria-label": c ?? "",
79
- emphasis: V.Weak,
79
+ emphasis: X.Weak,
80
80
  helperText: "",
81
81
  hideLabel: !0,
82
82
  label: "",
83
83
  onChange: Y,
84
- size: X.Default,
85
- state: s ? Z.Unchecked : re(o, E),
84
+ size: Z.Default,
85
+ state: s ? S.Unchecked : le(o, E),
86
86
  tooltip: [],
87
87
  value: e
88
88
  }
@@ -94,7 +94,7 @@ const ie = q(
94
94
  tabIndex: 0,
95
95
  role: "treeitem",
96
96
  style: K,
97
- onKeyDown: le,
97
+ onKeyDown: q,
98
98
  "aria-label": c,
99
99
  "aria-level": m + 1,
100
100
  className: H,
@@ -107,7 +107,7 @@ const ie = q(
107
107
  /* @__PURE__ */ t("span", { className: P, style: U, "aria-hidden": !0 }),
108
108
  h === "left" && y,
109
109
  b && /* @__PURE__ */ t(
110
- ae,
110
+ se,
111
111
  {
112
112
  onClick: j,
113
113
  expanded: z,
@@ -1 +1 @@
1
- {"version":3,"file":"TreeItemMultiselect.es.js","sources":["../../../../src/components/Tree/TreeItem/TreeItemMultiselect.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { noop } from 'lodash-es';\nimport { Children, type MouseEvent, memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { Checkbox, CheckboxEmphasis, CheckboxSize, CheckboxState } from '@components/Checkbox/Checkbox';\nimport { Container } from '@components/Container';\nimport {\n type RegisterNodeChildrenPayload,\n type TreeItemMultiselectProps,\n type TreeItemStyling,\n} from '@components/Tree/types';\n\nimport { INDENTATION_WIDTH, getMultiselectCheckBoxState } from '../helpers';\nimport {\n getMultiselectBackgroundClassName,\n getMultiselectContainerClassName,\n getMultiselectLiClassName,\n} from '../helpers/multiselectTreeItemstyling';\nimport { removeFragmentsAndEnrichChildren, useDeepCompareEffect } from '../utils';\n\nimport { ExpandButton } from './ExpandButton';\nimport { useMultiselectTreeItem } from './useMultiselectTreeItem';\n\n/** @private */\ntype TreeItemPrivateProps = {\n parentId?: string;\n level?: number;\n /** onSelect is passed by the Tree component when cloning the TreeItem */\n onSelect?: (id: string, ignoreRemoveSelected: boolean) => void;\n onExpand?: (id: string) => void;\n onShrink?: (id: string) => void;\n unregisterNodeChildren?: (payload: string) => void;\n registerNodeChildren?: (payload: RegisterNodeChildrenPayload) => void;\n};\n\n/** @private */\nexport type InternalTreeItemMultiSelectProps = TreeItemMultiselectProps & TreeItemPrivateProps;\n\nexport const TreeItemMultiselect = memo(\n ({\n id,\n label,\n showCaret,\n children,\n level = 0,\n contentComponent,\n parentId,\n onSelect,\n onExpand,\n onShrink,\n registerNodeChildren,\n unregisterNodeChildren,\n isDisabled = false,\n expandable = true,\n checkBoxPosition = 'left',\n itemStyle,\n 'data-test-id': dataTestId = 'fondue-tree-item',\n }: InternalTreeItemMultiSelectProps) => {\n const setActiveNodeRef = useRef<HTMLInputElement | null>(null);\n const { isSelected, isExpanded, isPartialSelected, isParentSelected } = useMultiselectTreeItem(id);\n\n const toggleExpand = useCallback(\n (event?: MouseEvent<HTMLButtonElement>) => {\n event?.stopPropagation();\n isExpanded ? onShrink?.(id) : onExpand?.(id);\n },\n [id, isExpanded, onExpand, onShrink],\n );\n\n useEffect(() => {\n if (isParentSelected && !isSelected && onSelect) {\n onSelect(id, true);\n }\n }, [id, onSelect, isParentSelected, isSelected, parentId]);\n\n const hasChildren = Children.count(children) > 0;\n\n const { enrichedChildren, childrenIds } = useMemo(() => {\n const enrichedChildren = removeFragmentsAndEnrichChildren(children, {\n parentId: id,\n level: level + 1,\n });\n\n return {\n enrichedChildren,\n childrenIds: enrichedChildren.map((child) => child.props.id),\n };\n }, [children, id, level]);\n\n useDeepCompareEffect(() => {\n if (Children.count(enrichedChildren) === 0 || !isExpanded) {\n unregisterNodeChildren?.(id);\n return;\n }\n\n registerNodeChildren?.({ id, children: enrichedChildren });\n }, [isExpanded, enrichedChildren, id]);\n\n const itemStyleProps = useMemo(() => {\n return {\n spacingY: 'none',\n contentHight: 'single-line',\n shadow: 'none',\n borderRadius: 'small',\n borderWidth: 'none',\n borderStyle: 'none',\n activeColorStyle: 'neutral',\n ...itemStyle,\n } as TreeItemStyling;\n }, [itemStyle]);\n\n const { liClassName, backgroundClassName } = useMemo(() => {\n return {\n liClassName: getMultiselectLiClassName(itemStyleProps, isDisabled),\n backgroundClassName: getMultiselectBackgroundClassName(itemStyleProps, isSelected, isDisabled),\n };\n }, [itemStyleProps, isDisabled, isSelected]);\n\n const wrapperContentClassName = 'tw-max-w-full\ttw-grow';\n const showChildren = isExpanded;\n const showLabel = label !== undefined;\n const showExpandButton = expandable && (showCaret ?? hasChildren);\n\n const containerClassName = getMultiselectContainerClassName(itemStyleProps);\n\n const levelPadding = level * INDENTATION_WIDTH;\n const liStyle = { paddingLeft: levelPadding };\n const backgroundStyle = itemStyleProps.borderWidth !== 'none' ? {} : { marginLeft: -1 * levelPadding };\n\n const checkBoxOnSelect = isDisabled ? () => {} : () => onSelect?.(id, false);\n const checkBox =\n checkBoxPosition !== 'none' ? (\n <Container maxWidth=\"16px\" maxHeight=\"16px\">\n <Checkbox\n id={`checkbox-${id}`}\n ref={setActiveNodeRef}\n disabled={isDisabled}\n aria-label={label ?? ''}\n emphasis={CheckboxEmphasis.Weak}\n helperText=\"\"\n hideLabel\n label=\"\"\n onChange={checkBoxOnSelect}\n size={CheckboxSize.Default}\n state={\n isDisabled\n ? CheckboxState.Unchecked\n : getMultiselectCheckBoxState(isSelected, isPartialSelected)\n }\n tooltip={[]}\n value={id}\n />\n </Container>\n ) : null;\n\n return (\n <li\n id={id}\n key={id}\n tabIndex={0}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"treeitem\"\n style={liStyle}\n onKeyDown={noop}\n aria-label={label}\n aria-level={level + 1}\n className={liClassName}\n data-test-id={dataTestId}\n aria-selected={isSelected}\n aria-expanded={isExpanded}\n data-has-children={hasChildren}\n aria-owns={childrenIds.join(' ')}\n >\n <div className={containerClassName}>\n <span className={backgroundClassName} style={backgroundStyle} aria-hidden={true} />\n {checkBoxPosition === 'left' && checkBox}\n\n {expandable && (\n <ExpandButton\n onClick={toggleExpand}\n expanded={showChildren}\n disabled={!showExpandButton}\n aria-hidden={!showExpandButton}\n className={showExpandButton ? 'tw-visible' : 'tw-invisible tw-pointer-events-none'}\n />\n )}\n\n {showLabel && <span className=\"first:tw-ml-3.5 tw-h-full tw-flex tw-items-center\">{label}</span>}\n\n <div className={wrapperContentClassName}>{contentComponent}</div>\n\n {checkBoxPosition === 'right' && checkBox}\n </div>\n </li>\n );\n },\n);\n\nTreeItemMultiselect.displayName = 'FondueTreeItemMultiselect';\n"],"names":["TreeItemMultiselect","memo","id","label","showCaret","children","level","contentComponent","parentId","onSelect","onExpand","onShrink","registerNodeChildren","unregisterNodeChildren","isDisabled","expandable","checkBoxPosition","itemStyle","dataTestId","setActiveNodeRef","useRef","isSelected","isExpanded","isPartialSelected","isParentSelected","useMultiselectTreeItem","toggleExpand","useCallback","event","useEffect","hasChildren","Children","enrichedChildren","childrenIds","useMemo","removeFragmentsAndEnrichChildren","child","useDeepCompareEffect","itemStyleProps","liClassName","backgroundClassName","getMultiselectLiClassName","getMultiselectBackgroundClassName","wrapperContentClassName","showChildren","showLabel","showExpandButton","containerClassName","getMultiselectContainerClassName","levelPadding","INDENTATION_WIDTH","liStyle","backgroundStyle","checkBoxOnSelect","checkBox","jsx","Container","Checkbox","CheckboxEmphasis","CheckboxSize","CheckboxState","getMultiselectCheckBoxState","noop","jsxs","ExpandButton"],"mappings":";;;;;;;;;;;;AAuCO,MAAMA,KAAsBC;AAAA,EAC/B,CAAC;AAAA,IACG,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,kBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,YA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AA,IACA;AAGJ,WAAA,gBAAAqD;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,IAAArD;AAAA,QAEA,UAAU;AAAA,QAEV,MAAK;AAAA,QACL,OAAOiD;AAAA,QACP,WAAWW;AAAA,QACX,cAAY3D;AAAA,QACZ,cAAYG,IAAQ;AAAA,QACpB,WAAWiC;AAAA,QACX,gBAAcrB;AAAA,QACd,iBAAeG;AAAA,QACf,iBAAeC;AAAA,QACf,qBAAmBQ;AAAA,QACnB,aAAWG,EAAY,KAAK,GAAG;AAAA,QAE/B,UAAA,gBAAA8B,EAAC,OAAI,EAAA,WAAWhB,GACZ,UAAA;AAAA,UAAA,gBAAAQ,EAAC,UAAK,WAAWf,GAAqB,OAAOY,GAAiB,eAAa,IAAM;AAAA,UAChFpC,MAAqB,UAAUsC;AAAA,UAE/BvC,KACG,gBAAAwC;AAAA,YAACS;AAAA,YAAA;AAAA,cACG,SAAStC;AAAA,cACT,UAAUkB;AAAA,cACV,UAAU,CAACE;AAAA,cACX,eAAa,CAACA;AAAA,cACd,WAAWA,IAAmB,eAAe;AAAA,YAAA;AAAA,UACjD;AAAA,UAGHD,KAAa,gBAAAU,EAAC,QAAK,EAAA,WAAU,qDAAqD,UAAMpD,GAAA;AAAA,UAExF,gBAAAoD,EAAA,OAAA,EAAI,WAAWZ,GAA0B,UAAiBpC,GAAA;AAAA,UAE1DS,MAAqB,WAAWsC;AAAA,QAAA,GACrC;AAAA,MAAA;AAAA,MAlCKpD;AAAA,IAAA;AAAA,EAqCjB;AACJ;AAEAF,GAAoB,cAAc;"}
1
+ {"version":3,"file":"TreeItemMultiselect.es.js","sources":["../../../../src/components/Tree/TreeItem/TreeItemMultiselect.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport noop from 'lodash-es/noop';\nimport { Children, type MouseEvent, memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { Checkbox, CheckboxEmphasis, CheckboxSize, CheckboxState } from '@components/Checkbox/Checkbox';\nimport { Container } from '@components/Container';\nimport {\n type RegisterNodeChildrenPayload,\n type TreeItemMultiselectProps,\n type TreeItemStyling,\n} from '@components/Tree/types';\n\nimport { INDENTATION_WIDTH, getMultiselectCheckBoxState } from '../helpers';\nimport {\n getMultiselectBackgroundClassName,\n getMultiselectContainerClassName,\n getMultiselectLiClassName,\n} from '../helpers/multiselectTreeItemstyling';\nimport { removeFragmentsAndEnrichChildren, useDeepCompareEffect } from '../utils';\n\nimport { ExpandButton } from './ExpandButton';\nimport { useMultiselectTreeItem } from './useMultiselectTreeItem';\n\n/** @private */\ntype TreeItemPrivateProps = {\n parentId?: string;\n level?: number;\n /** onSelect is passed by the Tree component when cloning the TreeItem */\n onSelect?: (id: string, ignoreRemoveSelected: boolean) => void;\n onExpand?: (id: string) => void;\n onShrink?: (id: string) => void;\n unregisterNodeChildren?: (payload: string) => void;\n registerNodeChildren?: (payload: RegisterNodeChildrenPayload) => void;\n};\n\n/** @private */\nexport type InternalTreeItemMultiSelectProps = TreeItemMultiselectProps & TreeItemPrivateProps;\n\nexport const TreeItemMultiselect = memo(\n ({\n id,\n label,\n showCaret,\n children,\n level = 0,\n contentComponent,\n parentId,\n onSelect,\n onExpand,\n onShrink,\n registerNodeChildren,\n unregisterNodeChildren,\n isDisabled = false,\n expandable = true,\n checkBoxPosition = 'left',\n itemStyle,\n 'data-test-id': dataTestId = 'fondue-tree-item',\n }: InternalTreeItemMultiSelectProps) => {\n const setActiveNodeRef = useRef<HTMLInputElement | null>(null);\n const { isSelected, isExpanded, isPartialSelected, isParentSelected } = useMultiselectTreeItem(id);\n\n const toggleExpand = useCallback(\n (event?: MouseEvent<HTMLButtonElement>) => {\n event?.stopPropagation();\n isExpanded ? onShrink?.(id) : onExpand?.(id);\n },\n [id, isExpanded, onExpand, onShrink],\n );\n\n useEffect(() => {\n if (isParentSelected && !isSelected && onSelect) {\n onSelect(id, true);\n }\n }, [id, onSelect, isParentSelected, isSelected, parentId]);\n\n const hasChildren = Children.count(children) > 0;\n\n const { enrichedChildren, childrenIds } = useMemo(() => {\n const enrichedChildren = removeFragmentsAndEnrichChildren(children, {\n parentId: id,\n level: level + 1,\n });\n\n return {\n enrichedChildren,\n childrenIds: enrichedChildren.map((child) => child.props.id),\n };\n }, [children, id, level]);\n\n useDeepCompareEffect(() => {\n if (Children.count(enrichedChildren) === 0 || !isExpanded) {\n unregisterNodeChildren?.(id);\n return;\n }\n\n registerNodeChildren?.({ id, children: enrichedChildren });\n }, [isExpanded, enrichedChildren, id]);\n\n const itemStyleProps = useMemo(() => {\n return {\n spacingY: 'none',\n contentHight: 'single-line',\n shadow: 'none',\n borderRadius: 'small',\n borderWidth: 'none',\n borderStyle: 'none',\n activeColorStyle: 'neutral',\n ...itemStyle,\n } as TreeItemStyling;\n }, [itemStyle]);\n\n const { liClassName, backgroundClassName } = useMemo(() => {\n return {\n liClassName: getMultiselectLiClassName(itemStyleProps, isDisabled),\n backgroundClassName: getMultiselectBackgroundClassName(itemStyleProps, isSelected, isDisabled),\n };\n }, [itemStyleProps, isDisabled, isSelected]);\n\n const wrapperContentClassName = 'tw-max-w-full\ttw-grow';\n const showChildren = isExpanded;\n const showLabel = label !== undefined;\n const showExpandButton = expandable && (showCaret ?? hasChildren);\n\n const containerClassName = getMultiselectContainerClassName(itemStyleProps);\n\n const levelPadding = level * INDENTATION_WIDTH;\n const liStyle = { paddingLeft: levelPadding };\n const backgroundStyle = itemStyleProps.borderWidth !== 'none' ? {} : { marginLeft: -1 * levelPadding };\n\n const checkBoxOnSelect = isDisabled ? () => {} : () => onSelect?.(id, false);\n const checkBox =\n checkBoxPosition !== 'none' ? (\n <Container maxWidth=\"16px\" maxHeight=\"16px\">\n <Checkbox\n id={`checkbox-${id}`}\n ref={setActiveNodeRef}\n disabled={isDisabled}\n aria-label={label ?? ''}\n emphasis={CheckboxEmphasis.Weak}\n helperText=\"\"\n hideLabel\n label=\"\"\n onChange={checkBoxOnSelect}\n size={CheckboxSize.Default}\n state={\n isDisabled\n ? CheckboxState.Unchecked\n : getMultiselectCheckBoxState(isSelected, isPartialSelected)\n }\n tooltip={[]}\n value={id}\n />\n </Container>\n ) : null;\n\n return (\n <li\n id={id}\n key={id}\n tabIndex={0}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"treeitem\"\n style={liStyle}\n onKeyDown={noop}\n aria-label={label}\n aria-level={level + 1}\n className={liClassName}\n data-test-id={dataTestId}\n aria-selected={isSelected}\n aria-expanded={isExpanded}\n data-has-children={hasChildren}\n aria-owns={childrenIds.join(' ')}\n >\n <div className={containerClassName}>\n <span className={backgroundClassName} style={backgroundStyle} aria-hidden={true} />\n {checkBoxPosition === 'left' && checkBox}\n\n {expandable && (\n <ExpandButton\n onClick={toggleExpand}\n expanded={showChildren}\n disabled={!showExpandButton}\n aria-hidden={!showExpandButton}\n className={showExpandButton ? 'tw-visible' : 'tw-invisible tw-pointer-events-none'}\n />\n )}\n\n {showLabel && <span className=\"first:tw-ml-3.5 tw-h-full tw-flex tw-items-center\">{label}</span>}\n\n <div className={wrapperContentClassName}>{contentComponent}</div>\n\n {checkBoxPosition === 'right' && checkBox}\n </div>\n </li>\n );\n },\n);\n\nTreeItemMultiselect.displayName = 'FondueTreeItemMultiselect';\n"],"names":["TreeItemMultiselect","memo","id","label","showCaret","children","level","contentComponent","parentId","onSelect","onExpand","onShrink","registerNodeChildren","unregisterNodeChildren","isDisabled","expandable","checkBoxPosition","itemStyle","dataTestId","setActiveNodeRef","useRef","isSelected","isExpanded","isPartialSelected","isParentSelected","useMultiselectTreeItem","toggleExpand","useCallback","event","useEffect","hasChildren","Children","enrichedChildren","childrenIds","useMemo","removeFragmentsAndEnrichChildren","child","useDeepCompareEffect","itemStyleProps","liClassName","backgroundClassName","getMultiselectLiClassName","getMultiselectBackgroundClassName","wrapperContentClassName","showChildren","showLabel","showExpandButton","containerClassName","getMultiselectContainerClassName","levelPadding","INDENTATION_WIDTH","liStyle","backgroundStyle","checkBoxOnSelect","checkBox","jsx","Container","Checkbox","CheckboxEmphasis","CheckboxSize","CheckboxState","getMultiselectCheckBoxState","noop","jsxs","ExpandButton"],"mappings":";;;;;;;;;;;;AAuCO,MAAMA,KAAsBC;AAAA,EAC/B,CAAC;AAAA,IACG,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,kBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,YAAAC,IAAa;AAAA,IACb,kBAAAC,IAAmB;AAAA,IACnB,WAAAC;AAAA,IACA,gBAAgBC,IAAa;AAAA,EAAA,MACO;AAC9B,UAAAC,IAAmBC,EAAgC,IAAI,GACvD,EAAE,YAAAC,GAAY,YAAAC,GAAY,mBAAAC,GAAmB,kBAAAC,MAAqBC,GAAuBvB,CAAE,GAE3FwB,IAAeC;AAAA,MACjB,CAACC,MAA0C;AACvC,QAAAA,KAAA,QAAAA,EAAO,mBACPN,IAAaX,KAAA,QAAAA,EAAWT,KAAMQ,KAAA,QAAAA,EAAWR;AAAA,MAC7C;AAAA,MACA,CAACA,GAAIoB,GAAYZ,GAAUC,CAAQ;AAAA,IAAA;AAGvC,IAAAkB,EAAU,MAAM;AACR,MAAAL,KAAoB,CAACH,KAAcZ,KACnCA,EAASP,GAAI,EAAI;AAAA,IACrB,GACD,CAACA,GAAIO,GAAUe,GAAkBH,GAAYb,CAAQ,CAAC;AAEzD,UAAMsB,IAAcC,EAAS,MAAM1B,CAAQ,IAAI,GAEzC,EAAE,kBAAA2B,GAAkB,aAAAC,EAAY,IAAIC,EAAQ,MAAM;AAC9CF,YAAAA,IAAmBG,GAAiC9B,GAAU;AAAA,QAChE,UAAUH;AAAA,QACV,OAAOI,IAAQ;AAAA,MAAA,CAClB;AAEM,aAAA;AA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AAA,UAE1DS,MAAqB,WAAWsC;AAAA,QAAA,GACrC;AAAA,MAAA;AAAA,MAlCKpD;AAAA,IAAA;AAAA,EAqCjB;AACJ;AAEAF,GAAoB,cAAc;"}
@@ -1,5 +1,5 @@
1
- import { getReactNodeIdsInFlatArray as l, removeReactNodesFromFlatArray as h, getReactNodesInFlatArray as I } from "./nodes.es.js";
2
1
  import a from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEqualWith.es.js";
2
+ import { getReactNodeIdsInFlatArray as l, removeReactNodesFromFlatArray as h, getReactNodesInFlatArray as I } from "./nodes.es.js";
3
3
  const x = (t, r) => r && (t.key === "Meta" || t.ctrlKey), m = (t, r) => t.findIndex((o) => o.props.id === r), F = (t, r) => t.filter((o) => o.props.parentId === r).map((o) => o.props.id), N = (t, r, o) => {
4
4
  const s = l(t, r), e = s.length > 0 ? h(t, s) : t, n = m(e, r);
5
5
  return n === -1 ? t : [...e.slice(0, n + 1), ...o, ...e.slice(n + 1)];
@@ -1 +1 @@
1
- {"version":3,"file":"reducer.es.js","sources":["../../../../src/components/Tree/helpers/reducer.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { isEqualWith } from 'lodash-es';\nimport { type ReactElement } from 'react';\n\nimport { type InternalTreeItemProps } from '../TreeItem';\n\nimport { getReactNodeIdsInFlatArray, getReactNodesInFlatArray, removeReactNodesFromFlatArray } from './nodes';\n\nexport const shouldUpdateTreeState = (event: globalThis.KeyboardEvent, multiselect: boolean) => {\n return multiselect && (event.key === 'Meta' || event.ctrlKey);\n};\n\nexport const findIndexById = (nodes: ReactElement<InternalTreeItemProps>[], id: string) => {\n return nodes.findIndex((node) => node.props.id === id);\n};\n\nexport const getNodeChildrenIds = (nodes: ReactElement<InternalTreeItemProps>[], id: string) => {\n return nodes.filter((node) => node.props.parentId === id).map((node) => node.props.id);\n};\n\nexport const updateNodeWithNewChildren = (\n nodes: ReactElement<InternalTreeItemProps>[],\n parentId: string,\n children: ReactElement[],\n) => {\n const nodeIds = getReactNodeIdsInFlatArray(nodes, parentId);\n const cleanNodes = nodeIds.length > 0 ? removeReactNodesFromFlatArray(nodes, nodeIds) : nodes;\n const parentIndex = findIndexById(cleanNodes, parentId);\n if (parentIndex === -1) {\n return nodes;\n }\n\n return [...cleanNodes.slice(0, parentIndex + 1), ...children, ...cleanNodes.slice(parentIndex + 1)];\n};\n\nexport const getCurrentChildrenForNewNodesIfExpanded = (\n currentNodes: ReactElement[],\n expandedIds: Set<string>,\n newNodes: ReactElement[],\n) => {\n const updatedTreeNode: ReactElement[] = [];\n for (const node of newNodes) {\n updatedTreeNode.push(node);\n\n if (!expandedIds.has(node.props.id)) {\n continue;\n }\n\n for (const child of getReactNodesInFlatArray(currentNodes, node.props.id)) {\n updatedTreeNode.push(child);\n }\n }\n\n return updatedTreeNode;\n};\n\nexport const currentNodesChanged = (\n currentChildrenIds: string[],\n currentNodes: ReactElement<InternalTreeItemProps>[],\n newNodes: ReactElement<InternalTreeItemProps>[],\n) => {\n for (const nodeId of currentChildrenIds) {\n const newNode = newNodes.find((n) => n.props.id === nodeId);\n const newContentComponent = newNode?.props?.contentComponent as Partial<ReactElement>;\n\n const currentNode = currentNodes.find((n) => n.props.id === nodeId);\n const currentContentComponent = currentNode?.props?.contentComponent as Partial<ReactElement>;\n\n if (\n (!currentContentComponent || !newContentComponent) &&\n !isEqualWith(currentNode?.props, newNode?.props, isEqualCustomizer)\n ) {\n return true;\n }\n\n if (!isEqualWith(currentContentComponent?.props, newContentComponent?.props, isEqualCustomizer)) {\n return true;\n }\n }\n return false;\n};\n\nconst isEqualCustomizer = (nodeProp: unknown, othernodeProp: unknown): boolean | undefined => {\n if (typeof nodeProp === 'function' || typeof othernodeProp === 'function') {\n return true;\n }\n};\n"],"names":["shouldUpdateTreeState","event","multiselect","findIndexById","nodes","id","node","getNodeChildrenIds","updateNodeWithNewChildren","parentId","children","nodeIds","getReactNodeIdsInFlatArray","cleanNodes","removeReactNodesFromFlatArray","parentIndex","getCurrentChildrenForNewNodesIfExpanded","currentNodes","expandedIds","newNodes","updatedTreeNode","child","getReactNodesInFlatArray","currentNodesChanged","currentChildrenIds","nodeId","newNode","n","newContentComponent","_a","currentNode","currentContentComponent","_b","isEqualWith","isEqualCustomizer","nodeProp","othernodeProp"],"mappings":";;AASa,MAAAA,IAAwB,CAACC,GAAiCC,MAC5DA,MAAgBD,EAAM,QAAQ,UAAUA,EAAM,UAG5CE,IAAgB,CAACC,GAA8CC,MACjED,EAAM,UAAU,CAACE,MAASA,EAAK,MAAM,OAAOD,CAAE,GAG5CE,IAAqB,CAACH,GAA8CC,MACtED,EAAM,OAAO,CAACE,MAASA,EAAK,MAAM,aAAaD,CAAE,EAAE,IAAI,CAACC,MAASA,EAAK,MAAM,EAAE,GAG5EE,IAA4B,CACrCJ,GACAK,GACAC,MACC;AACK,QAAAC,IAAUC,EAA2BR,GAAOK,CAAQ,GACpDI,IAAaF,EAAQ,SAAS,IAAIG,EAA8BV,GAAOO,CAAO,IAAIP,GAClFW,IAAcZ,EAAcU,GAAYJ,CAAQ;AACtD,SAAIM,MAAgB,KACTX,IAGJ,CAAC,GAAGS,EAAW,MAAM,GAAGE,IAAc,CAAC,GAAG,GAAGL,GAAU,GAAGG,EAAW,MAAME,IAAc,CAAC,CAAC;AACtG,GAEaC,IAA0C,CACnDC,GACAC,GACAC,MACC;AACD,QAAMC,IAAkC,CAAA;AACxC,aAAWd,KAAQa;AAGf,QAFAC,EAAgB,KAAKd,CAAI,GAErB,EAACY,EAAY,IAAIZ,EAAK,MAAM,EAAE;AAIlC,iBAAWe,KAASC,EAAyBL,GAAcX,EAAK,MAAM,EAAE;AACpE,QAAAc,EAAgB,KAAKC,CAAK;AAI3B,SAAAD;AACX,GAEaG,IAAsB,CAC/BC,GACAP,GACAE,MACC;;AACD,aAAWM,KAAUD,GAAoB;AAC/B,UAAAE,IAAUP,EAAS,KAAK,CAACQ,MAAMA,EAAE,MAAM,OAAOF,CAAM,GACpDG,KAAsBC,IAAAH,KAAA,gBAAAA,EAAS,UAAT,gBAAAG,EAAgB,kBAEtCC,IAAcb,EAAa,KAAK,CAACU,MAAMA,EAAE,MAAM,OAAOF,CAAM,GAC5DM,KAA0BC,IAAAF,KAAA,gBAAAA,EAAa,UAAb,gBAAAE,EAAoB;AASpD,SANK,CAACD,KAA2B,CAACH,MAC9B,CAACK,EAAYH,KAAA,gBAAAA,EAAa,OAAOJ,KAAA,gBAAAA,EAAS,OAAOQ,CAAiB,KAKlE,CAACD,EAAYF,KAAA,gBAAAA,EAAyB,OAAOH,KAAA,gBAAAA,EAAqB,OAAOM,CAAiB;AACnF,aAAA;AAAA,EAEf;AACO,SAAA;AACX,GAEMA,IAAoB,CAACC,GAAmBC,MAAgD;AAC1F,MAAI,OAAOD,KAAa,cAAc,OAAOC,KAAkB;AACpD,WAAA;AAEf;"}
1
+ {"version":3,"file":"reducer.es.js","sources":["../../../../src/components/Tree/helpers/reducer.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport isEqualWith from 'lodash-es/isEqualWith';\nimport { type ReactElement } from 'react';\n\nimport { type InternalTreeItemProps } from '../TreeItem';\n\nimport { getReactNodeIdsInFlatArray, getReactNodesInFlatArray, removeReactNodesFromFlatArray } from './nodes';\n\nexport const shouldUpdateTreeState = (event: globalThis.KeyboardEvent, multiselect: boolean) => {\n return multiselect && (event.key === 'Meta' || event.ctrlKey);\n};\n\nexport const findIndexById = (nodes: ReactElement<InternalTreeItemProps>[], id: string) => {\n return nodes.findIndex((node) => node.props.id === id);\n};\n\nexport const getNodeChildrenIds = (nodes: ReactElement<InternalTreeItemProps>[], id: string) => {\n return nodes.filter((node) => node.props.parentId === id).map((node) => node.props.id);\n};\n\nexport const updateNodeWithNewChildren = (\n nodes: ReactElement<InternalTreeItemProps>[],\n parentId: string,\n children: ReactElement[],\n) => {\n const nodeIds = getReactNodeIdsInFlatArray(nodes, parentId);\n const cleanNodes = nodeIds.length > 0 ? removeReactNodesFromFlatArray(nodes, nodeIds) : nodes;\n const parentIndex = findIndexById(cleanNodes, parentId);\n if (parentIndex === -1) {\n return nodes;\n }\n\n return [...cleanNodes.slice(0, parentIndex + 1), ...children, ...cleanNodes.slice(parentIndex + 1)];\n};\n\nexport const getCurrentChildrenForNewNodesIfExpanded = (\n currentNodes: ReactElement[],\n expandedIds: Set<string>,\n newNodes: ReactElement[],\n) => {\n const updatedTreeNode: ReactElement[] = [];\n for (const node of newNodes) {\n updatedTreeNode.push(node);\n\n if (!expandedIds.has(node.props.id)) {\n continue;\n }\n\n for (const child of getReactNodesInFlatArray(currentNodes, node.props.id)) {\n updatedTreeNode.push(child);\n }\n }\n\n return updatedTreeNode;\n};\n\nexport const currentNodesChanged = (\n currentChildrenIds: string[],\n currentNodes: ReactElement<InternalTreeItemProps>[],\n newNodes: ReactElement<InternalTreeItemProps>[],\n) => {\n for (const nodeId of currentChildrenIds) {\n const newNode = newNodes.find((n) => n.props.id === nodeId);\n const newContentComponent = newNode?.props?.contentComponent as Partial<ReactElement>;\n\n const currentNode = currentNodes.find((n) => n.props.id === nodeId);\n const currentContentComponent = currentNode?.props?.contentComponent as Partial<ReactElement>;\n\n if (\n (!currentContentComponent || !newContentComponent) &&\n !isEqualWith(currentNode?.props, newNode?.props, isEqualCustomizer)\n ) {\n return true;\n }\n\n if (!isEqualWith(currentContentComponent?.props, newContentComponent?.props, isEqualCustomizer)) {\n return true;\n }\n }\n return false;\n};\n\nconst isEqualCustomizer = (nodeProp: unknown, othernodeProp: unknown): boolean | undefined => {\n if (typeof nodeProp === 'function' || typeof othernodeProp === 'function') {\n return true;\n }\n};\n"],"names":["shouldUpdateTreeState","event","multiselect","findIndexById","nodes","id","node","getNodeChildrenIds","updateNodeWithNewChildren","parentId","children","nodeIds","getReactNodeIdsInFlatArray","cleanNodes","removeReactNodesFromFlatArray","parentIndex","getCurrentChildrenForNewNodesIfExpanded","currentNodes","expandedIds","newNodes","updatedTreeNode","child","getReactNodesInFlatArray","currentNodesChanged","currentChildrenIds","nodeId","newNode","n","newContentComponent","_a","currentNode","currentContentComponent","_b","isEqualWith","isEqualCustomizer","nodeProp","othernodeProp"],"mappings":";;AASa,MAAAA,IAAwB,CAACC,GAAiCC,MAC5DA,MAAgBD,EAAM,QAAQ,UAAUA,EAAM,UAG5CE,IAAgB,CAACC,GAA8CC,MACjED,EAAM,UAAU,CAACE,MAASA,EAAK,MAAM,OAAOD,CAAE,GAG5CE,IAAqB,CAACH,GAA8CC,MACtED,EAAM,OAAO,CAACE,MAASA,EAAK,MAAM,aAAaD,CAAE,EAAE,IAAI,CAACC,MAASA,EAAK,MAAM,EAAE,GAG5EE,IAA4B,CACrCJ,GACAK,GACAC,MACC;AACK,QAAAC,IAAUC,EAA2BR,GAAOK,CAAQ,GACpDI,IAAaF,EAAQ,SAAS,IAAIG,EAA8BV,GAAOO,CAAO,IAAIP,GAClFW,IAAcZ,EAAcU,GAAYJ,CAAQ;AACtD,SAAIM,MAAgB,KACTX,IAGJ,CAAC,GAAGS,EAAW,MAAM,GAAGE,IAAc,CAAC,GAAG,GAAGL,GAAU,GAAGG,EAAW,MAAME,IAAc,CAAC,CAAC;AACtG,GAEaC,IAA0C,CACnDC,GACAC,GACAC,MACC;AACD,QAAMC,IAAkC,CAAA;AACxC,aAAWd,KAAQa;AAGf,QAFAC,EAAgB,KAAKd,CAAI,GAErB,EAACY,EAAY,IAAIZ,EAAK,MAAM,EAAE;AAIlC,iBAAWe,KAASC,EAAyBL,GAAcX,EAAK,MAAM,EAAE;AACpE,QAAAc,EAAgB,KAAKC,CAAK;AAI3B,SAAAD;AACX,GAEaG,IAAsB,CAC/BC,GACAP,GACAE,MACC;;AACD,aAAWM,KAAUD,GAAoB;AAC/B,UAAAE,IAAUP,EAAS,KAAK,CAACQ,MAAMA,EAAE,MAAM,OAAOF,CAAM,GACpDG,KAAsBC,IAAAH,KAAA,gBAAAA,EAAS,UAAT,gBAAAG,EAAgB,kBAEtCC,IAAcb,E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