@hitachivantara/uikit-react-core 5.9.1 → 5.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs +20 -26
  2. package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs.map +1 -1
  3. package/dist/cjs/components/DropDownMenu/DropDownMenu.styles.cjs +27 -75
  4. package/dist/cjs/components/DropDownMenu/DropDownMenu.styles.cjs.map +1 -1
  5. package/dist/cjs/components/DropDownMenu/dropDownMenuClasses.cjs +1 -1
  6. package/dist/cjs/components/DropDownMenu/dropDownMenuClasses.cjs.map +1 -1
  7. package/dist/cjs/components/Table/TableCell/TableCell.cjs +4 -4
  8. package/dist/cjs/components/Table/TableCell/TableCell.cjs.map +1 -1
  9. package/dist/cjs/components/Table/TableCell/TableCell.styles.cjs +2 -14
  10. package/dist/cjs/components/Table/TableCell/TableCell.styles.cjs.map +1 -1
  11. package/dist/cjs/components/Table/TableRow/TableRow.cjs +6 -6
  12. package/dist/cjs/components/Table/TableRow/TableRow.cjs.map +1 -1
  13. package/dist/cjs/components/Table/utils/utils.cjs +0 -5
  14. package/dist/cjs/components/Table/utils/utils.cjs.map +1 -1
  15. package/dist/cjs/components/VerticalNavigation/Actions/Actions.cjs +2 -2
  16. package/dist/cjs/components/VerticalNavigation/Actions/Actions.cjs.map +1 -1
  17. package/dist/cjs/components/VerticalNavigation/Header/Header.cjs +2 -2
  18. package/dist/cjs/components/VerticalNavigation/Header/Header.cjs.map +1 -1
  19. package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs +8 -8
  20. package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs.map +1 -1
  21. package/dist/cjs/components/VerticalNavigation/NavigationPopup/NavigationPopup.cjs +1 -0
  22. package/dist/cjs/components/VerticalNavigation/NavigationPopup/NavigationPopup.cjs.map +1 -1
  23. package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.cjs +5 -5
  24. package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.cjs.map +1 -1
  25. package/dist/cjs/components/VerticalNavigation/VerticalNavigation.cjs +6 -3
  26. package/dist/cjs/components/VerticalNavigation/VerticalNavigation.cjs.map +1 -1
  27. package/dist/cjs/components/VerticalNavigation/VerticalNavigationContext.cjs +1 -1
  28. package/dist/cjs/components/VerticalNavigation/VerticalNavigationContext.cjs.map +1 -1
  29. package/dist/cjs/index.cjs +2 -1
  30. package/dist/cjs/index.cjs.map +1 -1
  31. package/dist/cjs/utils/checkValidHexColorValue.cjs +9 -0
  32. package/dist/cjs/utils/checkValidHexColorValue.cjs.map +1 -0
  33. package/dist/esm/components/DropDownMenu/DropDownMenu.js +21 -27
  34. package/dist/esm/components/DropDownMenu/DropDownMenu.js.map +1 -1
  35. package/dist/esm/components/DropDownMenu/DropDownMenu.styles.js +27 -73
  36. package/dist/esm/components/DropDownMenu/DropDownMenu.styles.js.map +1 -1
  37. package/dist/esm/components/DropDownMenu/dropDownMenuClasses.js +1 -1
  38. package/dist/esm/components/DropDownMenu/dropDownMenuClasses.js.map +1 -1
  39. package/dist/esm/components/Table/TableCell/TableCell.js +2 -2
  40. package/dist/esm/components/Table/TableCell/TableCell.js.map +1 -1
  41. package/dist/esm/components/Table/TableCell/TableCell.styles.js +2 -14
  42. package/dist/esm/components/Table/TableCell/TableCell.styles.js.map +1 -1
  43. package/dist/esm/components/Table/TableRow/TableRow.js +2 -2
  44. package/dist/esm/components/Table/TableRow/TableRow.js.map +1 -1
  45. package/dist/esm/components/Table/utils/utils.js +0 -5
  46. package/dist/esm/components/Table/utils/utils.js.map +1 -1
  47. package/dist/esm/components/VerticalNavigation/Actions/Actions.js +2 -2
  48. package/dist/esm/components/VerticalNavigation/Actions/Actions.js.map +1 -1
  49. package/dist/esm/components/VerticalNavigation/Header/Header.js +2 -2
  50. package/dist/esm/components/VerticalNavigation/Header/Header.js.map +1 -1
  51. package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js +8 -8
  52. package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js.map +1 -1
  53. package/dist/esm/components/VerticalNavigation/NavigationPopup/NavigationPopup.js +1 -0
  54. package/dist/esm/components/VerticalNavigation/NavigationPopup/NavigationPopup.js.map +1 -1
  55. package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.js +5 -5
  56. package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.js.map +1 -1
  57. package/dist/esm/components/VerticalNavigation/VerticalNavigation.js +6 -3
  58. package/dist/esm/components/VerticalNavigation/VerticalNavigation.js.map +1 -1
  59. package/dist/esm/components/VerticalNavigation/VerticalNavigationContext.js +1 -1
  60. package/dist/esm/components/VerticalNavigation/VerticalNavigationContext.js.map +1 -1
  61. package/dist/esm/index.js +7 -6
  62. package/dist/esm/index.js.map +1 -1
  63. package/dist/esm/utils/checkValidHexColorValue.js +9 -0
  64. package/dist/esm/utils/checkValidHexColorValue.js.map +1 -0
  65. package/dist/types/index.d.ts +15 -3
  66. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"TreeViewItem.cjs","sources":["../../../../../src/components/VerticalNavigation/TreeView/TreeViewItem.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { clsx } from \"clsx\";\nimport { DropDownXS, DropUpXS } from \"@hitachivantara/uikit-react-icons\";\nimport { useForkRef } from \"@core/hooks\";\nimport { setId } from \"@core/utils\";\nimport treeViewItemClasses, {\n HvVerticalNavigationTreeViewItemClasses,\n} from \"./treeViewItemClasses\";\nimport { StyledContent, StyledGroup, StyledNode } from \"./TreeViewItem.styles\";\nimport { DescendantProvider, useDescendant } from \"./descendants\";\nimport {\n TreeViewControlContext,\n TreeViewStateContext,\n} from \"./TreeViewContext\";\nimport { VerticalNavigationContext } from \"..\";\nimport { IconWrapper } from \"./IconWrapper\";\n\nexport interface HvVerticalNavigationTreeViewItemProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * A Jss Object used to override or extend the styles applied to the Radio button.\n */\n classes?: HvVerticalNavigationTreeViewItemClasses;\n /**\n * Is the node disabled.\n */\n disabled?: boolean;\n /**\n * Can the node be selected.\n */\n selectable?: boolean;\n /**\n * The id of the node.\n */\n nodeId?: string;\n /**\n * The icon to display next to the node's label.\n */\n icon?: React.ReactNode;\n /**\n * The item label.\n */\n label?: React.ReactNode;\n /**\n * The url for the link.\n */\n href?: string;\n /**\n * The behavior when opening a link.\n */\n target?: string;\n /**\n * The node payload.\n */\n payload?: any;\n /**\n * @ignore\n */\n onClick?: any;\n /**\n * @ignore\n */\n onMouseDown?: any;\n /**\n * @ignore\n */\n onFocus?: any;\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n /**\n * @ignore\n */\n onMouseEnter?: any;\n /**\n * Disables the appearence of a tooltip on hovering an element ( Only applicable when the in collapsed mode)\n */\n disableTooltip?: boolean;\n}\n\nconst preventSelection = (event, disabled) => {\n if (event.shiftKey || event.ctrlKey || event.metaKey || disabled) {\n // Prevent text selection\n event.preventDefault();\n }\n};\n\nexport const HvVerticalNavigationTreeViewItem = forwardRef(\n (props: HvVerticalNavigationTreeViewItemProps, ref) => {\n const {\n id: idProp,\n className,\n classes,\n\n disabled: disabledProp = false,\n\n selectable: selectableProp,\n\n nodeId,\n icon = null,\n label,\n href,\n target,\n payload,\n\n onClick,\n onMouseDown,\n onFocus,\n\n children,\n\n disableTooltip,\n\n ...others\n } = props;\n\n const treeViewControlContext = useContext(TreeViewControlContext);\n const { isExpanded, isSelected, isFocused, isDisabled, isChildSelected } =\n useContext(TreeViewStateContext);\n\n const {\n treeId,\n mode,\n collapsible,\n toggleExpansion,\n multiSelect,\n selectNode,\n selectRange,\n disabledItemsFocusable,\n registerNode,\n unregisterNode,\n mapFirstChar,\n unMapFirstChar,\n focus,\n } = treeViewControlContext;\n\n const treeviewMode = mode === \"treeview\";\n\n let id: string | null = null;\n\n if (idProp != null) {\n id = idProp;\n } else if (treeId && nodeId) {\n id = `${treeId}-${nodeId}`;\n }\n\n const [treeitemElement, setTreeitemElement] = useState(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const handleRef = useForkRef(setTreeitemElement, ref);\n\n const descendant = useMemo(\n () => ({\n element: treeitemElement,\n id: nodeId,\n }),\n [nodeId, treeitemElement]\n );\n\n const { isOpen, collapsedMode } = useContext(VerticalNavigationContext);\n\n const { index, parentId, level } = useDescendant(descendant);\n\n const expandable = collapsible && Array.isArray(children);\n const expanded = isExpanded ? isExpanded(nodeId) : false;\n const focused = isFocused ? isFocused(nodeId) : false;\n const selected = isSelected ? isSelected(nodeId) : false;\n const disabled = isDisabled ? isDisabled(nodeId) : false;\n\n const selectable =\n selectableProp != null\n ? selectableProp\n : !collapsible || !expandable || !isOpen;\n\n useEffect(() => {\n // On the first render a node's index will be -1. We want to wait for the real index.\n if (registerNode && unregisterNode && index !== -1) {\n registerNode({\n id: nodeId,\n idAttribute: id,\n index,\n parentId,\n selectable,\n expandable,\n disabled: disabledProp,\n onFocus,\n payload,\n });\n\n return () => {\n unregisterNode(nodeId);\n };\n }\n\n return undefined;\n }, [\n registerNode,\n unregisterNode,\n parentId,\n index,\n nodeId,\n expandable,\n disabledProp,\n id,\n selectable,\n onFocus,\n payload,\n ]);\n\n useEffect(() => {\n if (\n mapFirstChar &&\n unMapFirstChar &&\n label &&\n contentRef.current?.textContent\n ) {\n mapFirstChar(\n nodeId,\n contentRef.current?.textContent.substring(0, 1).toLowerCase()\n );\n\n return () => {\n unMapFirstChar(nodeId);\n };\n }\n return undefined;\n }, [mapFirstChar, unMapFirstChar, nodeId, label]);\n\n let ariaSelected;\n if (multiSelect) {\n ariaSelected = selected;\n } else if (selected) {\n /* single-selection trees unset aria-selected on un-selected items.\n *\n * If the tree does not support multiple selection, aria-selected\n * is set to true for the selected node and it is not present on any other node in the tree.\n * Source: https://www.w3.org/TR/wai-aria-practices/#TreeView\n */\n ariaSelected = true;\n }\n\n const handleFocus = useCallback(\n (event) => {\n // DOM focus stays on the tree which manages focus with aria-activedescendant\n if (event.target === event.currentTarget) {\n (event.target.ownerDocument || document)\n .getElementById(treeId)\n .focus({ preventScroll: true });\n }\n\n const unfocusable = !disabledItemsFocusable && disabled;\n if (\n !focused &&\n event.currentTarget === event.target &&\n !unfocusable &&\n focus\n ) {\n focus(event, nodeId);\n }\n },\n [disabled, disabledItemsFocusable, focus, focused, nodeId, treeId]\n );\n\n const handleExpansion = useCallback(\n (event) => {\n if (!disabled) {\n if (treeviewMode && !focused && focus) {\n focus(event, nodeId);\n }\n\n const multiple =\n multiSelect && (event.shiftKey || event.ctrlKey || event.metaKey);\n\n // If already expanded and trying to toggle selection don't close\n if (\n expandable &&\n isOpen &&\n !(multiple && isExpanded && isExpanded(nodeId))\n ) {\n if (toggleExpansion) toggleExpansion(event, nodeId);\n }\n }\n },\n [\n disabled,\n expandable,\n focus,\n focused,\n isExpanded,\n multiSelect,\n nodeId,\n toggleExpansion,\n treeviewMode,\n ]\n );\n\n const handleSelection = useCallback(\n (event) => {\n if (selectable && !disabled) {\n if (treeviewMode && !focused && focus) {\n focus(event, nodeId);\n }\n\n const multiple =\n multiSelect && (event.shiftKey || event.ctrlKey || event.metaKey);\n\n if (multiple) {\n if (event.shiftKey) {\n if (selectRange) return selectRange(event, { end: nodeId });\n } else if (selectNode) return selectNode(event, nodeId, true);\n } else if (selectNode) return selectNode(event, nodeId);\n } else {\n return false;\n }\n },\n [\n disabled,\n focus,\n focused,\n multiSelect,\n nodeId,\n selectNode,\n selectRange,\n selectable,\n treeviewMode,\n ]\n );\n\n const handleMouseDown = useCallback(\n (event) => {\n preventSelection(event, disabled);\n\n if (onMouseDown) {\n onMouseDown(event);\n }\n },\n [disabled, onMouseDown]\n );\n\n const handleClick = useCallback(\n (event) => {\n if (!disabled) {\n if (expandable && isOpen) {\n handleExpansion(event);\n }\n\n if (selectable) {\n handleSelection(event);\n }\n }\n\n if (onClick) {\n onClick(event);\n }\n },\n [\n disabled,\n expandable,\n handleExpansion,\n handleSelection,\n onClick,\n selectable,\n ]\n );\n\n const handleKeyDown = useCallback(\n (event) => {\n let isEventHandled = false;\n const { key } = event;\n\n if (\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.currentTarget !== event.target\n ) {\n return;\n }\n if (contentRef.current === event.currentTarget) {\n if (key === \"Enter\" || key === \" \") {\n if (expandable && isOpen) {\n isEventHandled = handleExpansion(event) as unknown as boolean;\n }\n\n if (selectable) {\n isEventHandled = handleSelection(event) as boolean;\n }\n }\n\n if (isEventHandled) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n },\n [expandable, handleExpansion, handleSelection, selectable]\n );\n\n const renderedContent = useMemo(\n () => (\n <StyledContent\n id={setId(id, \"button\")}\n component={href ? \"a\" : \"div\"}\n href={href}\n target={target}\n ref={contentRef}\n className={clsx(\n treeViewItemClasses.content,\n classes?.content,\n href != null && clsx(treeViewItemClasses.link, classes?.link),\n !isOpen && clsx(treeViewItemClasses.minimized, classes?.minimized)\n )}\n variant=\"body\"\n disabled={disabled}\n onClick={handleClick}\n onMouseDown={handleMouseDown}\n style={{\n paddingLeft:\n (expandable || icon != null || !isOpen ? 0 : 10) +\n level * (collapsible ? 32 : 10),\n }}\n role={href ? undefined : \"button\"}\n {...(treeviewMode\n ? {\n tabIndex: -1,\n onFocus: handleFocus,\n }\n : {\n tabIndex: selectable || expandable ? 0 : -1,\n onKeyDown: handleKeyDown,\n \"aria-current\":\n (selectable && selected) ||\n (!isOpen && isChildSelected?.(nodeId))\n ? href\n ? \"page\"\n : true\n : undefined,\n \"aria-expanded\": expandable ? expanded : undefined,\n \"aria-controls\": expandable ? setId(id, \"group\") : undefined,\n \"aria-label\": payload?.label,\n })}\n >\n {isOpen && expandable && (expanded ? <DropUpXS /> : <DropDownXS />)}\n\n <IconWrapper\n icon={icon}\n label={payload?.label}\n hasChildren={Boolean(children)}\n showAvatar={\n !icon && level === 0 && !isOpen && collapsedMode === \"icon\"\n }\n isOpen={isOpen}\n disableTooltip={disableTooltip}\n />\n\n {isOpen && label}\n </StyledContent>\n ),\n [\n id,\n href,\n target,\n classes?.content,\n treeViewItemClasses.content,\n classes?.link,\n treeViewItemClasses.link,\n classes?.minimized,\n treeViewItemClasses.minimized,\n disabled,\n handleClick,\n handleMouseDown,\n expandable,\n icon,\n level,\n collapsible,\n treeviewMode,\n handleFocus,\n selectable,\n handleKeyDown,\n selected,\n expanded,\n label,\n disableTooltip,\n ]\n );\n\n const renderedChildren = useMemo(\n () =>\n children && (\n <StyledGroup\n id={setId(id, \"group\")}\n className={clsx(treeViewItemClasses.group, classes?.group)}\n role={treeviewMode ? \"group\" : undefined}\n >\n {children}\n </StyledGroup>\n ),\n [children, treeViewItemClasses.group, classes?.group, id, treeviewMode]\n );\n\n return (\n <StyledNode\n ref={handleRef}\n id={id ?? undefined}\n className={clsx(\n treeViewItemClasses?.node,\n classes?.node,\n className,\n disabled && clsx(treeViewItemClasses.disabled, classes?.disabled),\n expandable &&\n clsx(treeViewItemClasses.expandable, classes?.expandable),\n expandable &&\n !expanded &&\n clsx(treeViewItemClasses.collapsed, classes?.collapsed),\n expandable &&\n expanded &&\n clsx(treeViewItemClasses.expanded, classes?.expanded),\n selectable &&\n !disabled &&\n clsx(treeViewItemClasses.selectable, classes?.selectable),\n !disabled &&\n !selectable &&\n clsx(treeViewItemClasses.unselectable, classes?.unselectable),\n !disabled &&\n selectable &&\n selected &&\n clsx(treeViewItemClasses.selected, classes?.selected),\n !disabled &&\n selectable &&\n !selected &&\n clsx(treeViewItemClasses.unselected, classes?.unselected),\n focused && clsx(treeViewItemClasses.focused, classes?.focused),\n !isOpen &&\n collapsedMode === \"simple\" &&\n clsx(treeViewItemClasses.hide, classes?.hide),\n !isOpen &&\n collapsedMode === \"icon\" &&\n isChildSelected &&\n isChildSelected(nodeId) &&\n clsx(treeViewItemClasses.selected, classes?.selected)\n )}\n data-hasicon={icon != null ? true : undefined}\n {...(mode === \"treeview\" && {\n role: \"treeitem\",\n \"aria-selected\": ariaSelected,\n \"aria-expanded\": expandable ? expanded : undefined,\n \"aria-disabled\": disabled ? true : undefined,\n })}\n {...others}\n >\n {renderedContent}\n {isOpen && (\n <DescendantProvider id={nodeId} level={level + 1}>\n {renderedChildren}\n </DescendantProvider>\n )}\n </StyledNode>\n );\n }\n);\n"],"names":["preventSelection","event","disabled","shiftKey","ctrlKey","metaKey","preventDefault","HvVerticalNavigationTreeViewItem","forwardRef","props","ref","id","idProp","className","classes","disabledProp","selectable","selectableProp","nodeId","icon","label","href","target","payload","onClick","onMouseDown","onFocus","children","disableTooltip","others","treeViewControlContext","useContext","TreeViewControlContext","isExpanded","isSelected","isFocused","isDisabled","isChildSelected","TreeViewStateContext","treeId","mode","collapsible","toggleExpansion","multiSelect","selectNode","selectRange","disabledItemsFocusable","registerNode","unregisterNode","mapFirstChar","unMapFirstChar","focus","treeviewMode","treeitemElement","setTreeitemElement","useState","contentRef","useRef","handleRef","useForkRef","descendant","useMemo","element","isOpen","collapsedMode","VerticalNavigationContext","index","parentId","level","useDescendant","expandable","Array","isArray","expanded","focused","selected","useEffect","idAttribute","undefined","current","textContent","substring","toLowerCase","ariaSelected","handleFocus","useCallback","currentTarget","ownerDocument","document","getElementById","preventScroll","unfocusable","handleExpansion","multiple","handleSelection","end","handleMouseDown","handleClick","handleKeyDown","isEventHandled","key","altKey","stopPropagation","renderedContent","_jsxs","StyledContent","setId","component","clsx","treeViewItemClasses","content","link","minimized","variant","style","paddingLeft","role","tabIndex","onKeyDown","DropUpXS","DropDownXS","IconWrapper","hasChildren","Boolean","showAvatar","renderedChildren","StyledGroup","group","StyledNode","node","collapsed","unselectable","unselected","hide","DescendantProvider"],"mappings":";;;;;;;;;;;;;;AAgGA,MAAMA,mBAAmBA,CAACC,OAAOC,aAAa;AAC5C,MAAID,MAAME,YAAYF,MAAMG,WAAWH,MAAMI,WAAWH,UAAU;AAEh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kB;AAAA,MAAC3H,IAAIO;AAAAA,MAAQkD,OAAOA,QAAQ;AAAA,MAAEzC,UAC9CkG;AAAAA,IAAAA,CAEJ,CAAA;AAAA,EAAA,CACU;AAEjB,CAAC;;"}
1
+ {"version":3,"file":"TreeViewItem.cjs","sources":["../../../../../src/components/VerticalNavigation/TreeView/TreeViewItem.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { clsx } from \"clsx\";\nimport { DropDownXS, DropUpXS } from \"@hitachivantara/uikit-react-icons\";\nimport { useForkRef } from \"@core/hooks\";\nimport { setId } from \"@core/utils\";\nimport treeViewItemClasses, {\n HvVerticalNavigationTreeViewItemClasses,\n} from \"./treeViewItemClasses\";\nimport { StyledContent, StyledGroup, StyledNode } from \"./TreeViewItem.styles\";\nimport { DescendantProvider, useDescendant } from \"./descendants\";\nimport {\n TreeViewControlContext,\n TreeViewStateContext,\n} from \"./TreeViewContext\";\nimport { VerticalNavigationContext } from \"..\";\nimport { IconWrapper } from \"./IconWrapper\";\n\nexport interface HvVerticalNavigationTreeViewItemProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * A Jss Object used to override or extend the styles applied to the Radio button.\n */\n classes?: HvVerticalNavigationTreeViewItemClasses;\n /**\n * Is the node disabled.\n */\n disabled?: boolean;\n /**\n * Can the node be selected.\n */\n selectable?: boolean;\n /**\n * The id of the node.\n */\n nodeId?: string;\n /**\n * The icon to display next to the node's label.\n */\n icon?: React.ReactNode;\n /**\n * The item label.\n */\n label?: React.ReactNode;\n /**\n * The url for the link.\n */\n href?: string;\n /**\n * The behavior when opening a link.\n */\n target?: string;\n /**\n * The node payload.\n */\n payload?: any;\n /**\n * @ignore\n */\n onClick?: any;\n /**\n * @ignore\n */\n onMouseDown?: any;\n /**\n * @ignore\n */\n onFocus?: any;\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n /**\n * @ignore\n */\n onMouseEnter?: any;\n /**\n * Disables the appearence of a tooltip on hovering an element ( Only applicable when the in collapsed mode)\n */\n disableTooltip?: boolean;\n}\n\nconst preventSelection = (event, disabled) => {\n if (event.shiftKey || event.ctrlKey || event.metaKey || disabled) {\n // Prevent text selection\n event.preventDefault();\n }\n};\n\nexport const HvVerticalNavigationTreeViewItem = forwardRef(\n (props: HvVerticalNavigationTreeViewItemProps, ref) => {\n const {\n id: idProp,\n className,\n classes,\n\n disabled: disabledProp = false,\n\n selectable: selectableProp,\n\n nodeId,\n icon = null,\n label,\n href,\n target,\n payload,\n\n onClick,\n onMouseDown,\n onFocus,\n\n children,\n\n disableTooltip,\n\n ...others\n } = props;\n\n const treeViewControlContext = useContext(TreeViewControlContext);\n const { isExpanded, isSelected, isFocused, isDisabled, isChildSelected } =\n useContext(TreeViewStateContext);\n\n const {\n treeId,\n mode,\n collapsible,\n toggleExpansion,\n multiSelect,\n selectNode,\n selectRange,\n disabledItemsFocusable,\n registerNode,\n unregisterNode,\n mapFirstChar,\n unMapFirstChar,\n focus,\n } = treeViewControlContext;\n\n const treeviewMode = mode === \"treeview\";\n\n let id: string | null = null;\n\n if (idProp != null) {\n id = idProp;\n } else if (treeId && nodeId) {\n id = `${treeId}-${nodeId}`;\n }\n\n const [treeitemElement, setTreeitemElement] = useState(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const handleRef = useForkRef(setTreeitemElement, ref);\n\n const descendant = useMemo(\n () => ({\n element: treeitemElement,\n id: nodeId,\n }),\n [nodeId, treeitemElement]\n );\n\n const { isOpen, useIcons } = useContext(VerticalNavigationContext);\n\n const { index, parentId, level } = useDescendant(descendant);\n\n const expandable = collapsible && Array.isArray(children);\n const expanded = isExpanded ? isExpanded(nodeId) : false;\n const focused = isFocused ? isFocused(nodeId) : false;\n const selected = isSelected ? isSelected(nodeId) : false;\n const disabled = isDisabled ? isDisabled(nodeId) : false;\n\n const selectable =\n selectableProp != null\n ? selectableProp\n : !collapsible || !expandable || !isOpen;\n\n useEffect(() => {\n // On the first render a node's index will be -1. We want to wait for the real index.\n if (registerNode && unregisterNode && index !== -1) {\n registerNode({\n id: nodeId,\n idAttribute: id,\n index,\n parentId,\n selectable,\n expandable,\n disabled: disabledProp,\n onFocus,\n payload,\n });\n\n return () => {\n unregisterNode(nodeId);\n };\n }\n\n return undefined;\n }, [\n registerNode,\n unregisterNode,\n parentId,\n index,\n nodeId,\n expandable,\n disabledProp,\n id,\n selectable,\n onFocus,\n payload,\n ]);\n\n useEffect(() => {\n if (\n mapFirstChar &&\n unMapFirstChar &&\n label &&\n contentRef.current?.textContent\n ) {\n mapFirstChar(\n nodeId,\n contentRef.current?.textContent.substring(0, 1).toLowerCase()\n );\n\n return () => {\n unMapFirstChar(nodeId);\n };\n }\n return undefined;\n }, [mapFirstChar, unMapFirstChar, nodeId, label]);\n\n let ariaSelected;\n if (multiSelect) {\n ariaSelected = selected;\n } else if (selected) {\n /* single-selection trees unset aria-selected on un-selected items.\n *\n * If the tree does not support multiple selection, aria-selected\n * is set to true for the selected node and it is not present on any other node in the tree.\n * Source: https://www.w3.org/TR/wai-aria-practices/#TreeView\n */\n ariaSelected = true;\n }\n\n const handleFocus = useCallback(\n (event) => {\n // DOM focus stays on the tree which manages focus with aria-activedescendant\n if (event.target === event.currentTarget) {\n (event.target.ownerDocument || document)\n .getElementById(treeId)\n .focus({ preventScroll: true });\n }\n\n const unfocusable = !disabledItemsFocusable && disabled;\n if (\n !focused &&\n event.currentTarget === event.target &&\n !unfocusable &&\n focus\n ) {\n focus(event, nodeId);\n }\n },\n [disabled, disabledItemsFocusable, focus, focused, nodeId, treeId]\n );\n\n const handleExpansion = useCallback(\n (event) => {\n if (!disabled) {\n if (treeviewMode && !focused && focus) {\n focus(event, nodeId);\n }\n\n const multiple =\n multiSelect && (event.shiftKey || event.ctrlKey || event.metaKey);\n\n // If already expanded and trying to toggle selection don't close\n if (\n expandable &&\n isOpen &&\n !(multiple && isExpanded && isExpanded(nodeId))\n ) {\n if (toggleExpansion) toggleExpansion(event, nodeId);\n }\n }\n },\n [\n disabled,\n expandable,\n focus,\n focused,\n isExpanded,\n multiSelect,\n nodeId,\n toggleExpansion,\n treeviewMode,\n ]\n );\n\n const handleSelection = useCallback(\n (event) => {\n if (selectable && !disabled) {\n if (treeviewMode && !focused && focus) {\n focus(event, nodeId);\n }\n\n const multiple =\n multiSelect && (event.shiftKey || event.ctrlKey || event.metaKey);\n\n if (multiple) {\n if (event.shiftKey) {\n if (selectRange) return selectRange(event, { end: nodeId });\n } else if (selectNode) return selectNode(event, nodeId, true);\n } else if (selectNode) return selectNode(event, nodeId);\n } else {\n return false;\n }\n },\n [\n disabled,\n focus,\n focused,\n multiSelect,\n nodeId,\n selectNode,\n selectRange,\n selectable,\n treeviewMode,\n ]\n );\n\n const handleMouseDown = useCallback(\n (event) => {\n preventSelection(event, disabled);\n\n if (onMouseDown) {\n onMouseDown(event);\n }\n },\n [disabled, onMouseDown]\n );\n\n const handleClick = useCallback(\n (event) => {\n if (!disabled) {\n if (expandable && isOpen) {\n handleExpansion(event);\n }\n\n if (selectable) {\n handleSelection(event);\n }\n }\n\n if (onClick) {\n onClick(event);\n }\n },\n [\n disabled,\n expandable,\n handleExpansion,\n handleSelection,\n onClick,\n selectable,\n ]\n );\n\n const handleKeyDown = useCallback(\n (event) => {\n let isEventHandled = false;\n const { key } = event;\n\n if (\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.currentTarget !== event.target\n ) {\n return;\n }\n if (contentRef.current === event.currentTarget) {\n if (key === \"Enter\" || key === \" \") {\n if (expandable && isOpen) {\n isEventHandled = handleExpansion(event) as unknown as boolean;\n }\n\n if (selectable) {\n isEventHandled = handleSelection(event) as boolean;\n }\n }\n\n if (isEventHandled) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n },\n [expandable, handleExpansion, handleSelection, selectable]\n );\n\n const renderedContent = useMemo(\n () => (\n <StyledContent\n id={setId(id, \"button\")}\n component={href ? \"a\" : \"div\"}\n href={href}\n target={target}\n ref={contentRef}\n className={clsx(\n treeViewItemClasses.content,\n classes?.content,\n href != null && clsx(treeViewItemClasses.link, classes?.link),\n !isOpen && clsx(treeViewItemClasses.minimized, classes?.minimized)\n )}\n variant=\"body\"\n disabled={disabled}\n onClick={handleClick}\n onMouseDown={handleMouseDown}\n style={{\n paddingLeft:\n (expandable || useIcons || !isOpen ? 0 : 10) +\n level * (collapsible ? 32 : 10),\n }}\n role={href ? undefined : \"button\"}\n {...(treeviewMode\n ? {\n tabIndex: -1,\n onFocus: handleFocus,\n }\n : {\n tabIndex: selectable || expandable ? 0 : -1,\n onKeyDown: handleKeyDown,\n \"aria-current\":\n (selectable && selected) ||\n (!isOpen && isChildSelected?.(nodeId))\n ? href\n ? \"page\"\n : true\n : undefined,\n \"aria-expanded\": expandable ? expanded : undefined,\n \"aria-controls\": expandable ? setId(id, \"group\") : undefined,\n \"aria-label\": payload?.label,\n })}\n >\n {isOpen && expandable && (expanded ? <DropUpXS /> : <DropDownXS />)}\n\n <IconWrapper\n icon={useIcons && icon}\n label={payload?.label}\n hasChildren={Boolean(children)}\n showAvatar={!icon && useIcons}\n isOpen={isOpen}\n disableTooltip={disableTooltip}\n />\n\n {isOpen && label}\n </StyledContent>\n ),\n [\n id,\n href,\n target,\n classes?.content,\n treeViewItemClasses.content,\n classes?.link,\n treeViewItemClasses.link,\n classes?.minimized,\n treeViewItemClasses.minimized,\n disabled,\n handleClick,\n handleMouseDown,\n expandable,\n icon,\n level,\n collapsible,\n treeviewMode,\n handleFocus,\n selectable,\n handleKeyDown,\n selected,\n expanded,\n label,\n disableTooltip,\n ]\n );\n\n const renderedChildren = useMemo(\n () =>\n children && (\n <StyledGroup\n id={setId(id, \"group\")}\n className={clsx(treeViewItemClasses.group, classes?.group)}\n role={treeviewMode ? \"group\" : undefined}\n >\n {children}\n </StyledGroup>\n ),\n [children, treeViewItemClasses.group, classes?.group, id, treeviewMode]\n );\n\n return (\n <StyledNode\n ref={handleRef}\n id={id ?? undefined}\n className={clsx(\n treeViewItemClasses?.node,\n classes?.node,\n className,\n disabled && clsx(treeViewItemClasses.disabled, classes?.disabled),\n expandable &&\n clsx(treeViewItemClasses.expandable, classes?.expandable),\n expandable &&\n !expanded &&\n clsx(treeViewItemClasses.collapsed, classes?.collapsed),\n expandable &&\n expanded &&\n clsx(treeViewItemClasses.expanded, classes?.expanded),\n selectable &&\n !disabled &&\n clsx(treeViewItemClasses.selectable, classes?.selectable),\n !disabled &&\n !selectable &&\n clsx(treeViewItemClasses.unselectable, classes?.unselectable),\n !disabled &&\n selectable &&\n selected &&\n clsx(treeViewItemClasses.selected, classes?.selected),\n !disabled &&\n selectable &&\n !selected &&\n clsx(treeViewItemClasses.unselected, classes?.unselected),\n focused && clsx(treeViewItemClasses.focused, classes?.focused),\n !isOpen && !useIcons && clsx(treeViewItemClasses.hide, classes?.hide),\n !isOpen &&\n useIcons &&\n isChildSelected &&\n isChildSelected(nodeId) &&\n clsx(treeViewItemClasses.selected, classes?.selected)\n )}\n data-hasicon={icon != null ? true : undefined}\n {...(mode === \"treeview\" && {\n role: \"treeitem\",\n \"aria-selected\": ariaSelected,\n \"aria-expanded\": expandable ? expanded : undefined,\n \"aria-disabled\": disabled ? true : undefined,\n })}\n {...others}\n >\n {renderedContent}\n {isOpen && (\n <DescendantProvider id={nodeId} level={level + 1}>\n {renderedChildren}\n </DescendantProvider>\n )}\n </StyledNode>\n );\n }\n);\n"],"names":["preventSelection","event","disabled","shiftKey","ctrlKey","metaKey","preventDefault","HvVerticalNavigationTreeViewItem","forwardRef","props","ref","id","idProp","className","classes","disabledProp","selectable","selectableProp","nodeId","icon","label","href","target","payload","onClick","onMouseDown","onFocus","children","disableTooltip","others","treeViewControlContext","useContext","TreeViewControlContext","isExpanded","isSelected","isFocused","isDisabled","isChildSelected","TreeViewStateContext","treeId","mode","collapsible","toggleExpansion","multiSelect","selectNode","selectRange","disabledItemsFocusable","registerNode","unregisterNode","mapFirstChar","unMapFirstChar","focus","treeviewMode","treeitemElement","setTreeitemElement","useState","contentRef","useRef","handleRef","useForkRef","descendant","useMemo","element","isOpen","useIcons","VerticalNavigationContext","index","parentId","level","useDescendant","expandable","Array","isArray","expanded","focused","selected","useEffect","idAttribute","undefined","current","textContent","substring","toLowerCase","ariaSelected","handleFocus","useCallback","currentTarget","ownerDocument","document","getElementById","preventScroll","unfocusable","handleExpansion","multiple","handleSelection","end","handleMouseDown","handleClick","handleKeyDown","isEventHandled","key","altKey","stopPropagation","renderedContent","_jsxs","StyledContent","setId","component","clsx","treeViewItemClasses","content","link","minimized","variant","style","paddingLeft","role","tabIndex","onKeyDown","DropUpXS","DropDownXS","IconWrapper","hasChildren","Boolean","showAvatar","renderedChildren","StyledGroup","group","StyledNode","node","collapsed","unselectable","unselected","hide","DescendantProvider"],"mappings":";;;;;;;;;;;;;;AAgGA,MAAMA,mBAAmBA,CAACC,OAAOC,aAAa;AAC5C,MAAID,MAAME,YAAYF,MAAMG,WAAWH,MAAMI,WAAWH,UAAU;AAEhED,UAAMK,eAAgB;AAAA,EACxB;AACF;AAEO,MAAMC,mCAAmCC,MAAAA,WAC9C,CAACC,OAA8CC,QAAQ;;AAC/C,QAAA;AAAA,IACJC,IAAIC;AAAAA,IACJC;AAAAA,IACAC;AAAAA,IAEAZ,UAAUa,eAAe;AAAA,IAEzBC,YAAYC;AAAAA,IAEZC;AAAAA,IACAC,OAAO;AAAA,IACPC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IAEAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IAEAC;AAAAA,IAEAC;AAAAA,IAEA,GAAGC;AAAAA,EACDpB,IAAAA;AAEEqB,QAAAA,yBAAyBC,iBAAWC,gBAAAA,sBAAsB;AAC1D,QAAA;AAAA,IAAEC;AAAAA,IAAYC;AAAAA,IAAYC;AAAAA,IAAWC;AAAAA,IAAYC;AAAAA,EAAAA,IACrDN,MAAAA,WAAWO,gBAAAA,oBAAoB;A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YACDiC,KAAKC,KAAAA,4BAAoBuB,YAAYtH,mCAASsH,UAAU,GAC1D1D,WAAWkC,KAAKC,KAAAA,4BAAoBnC,SAAS5D,mCAAS4D,OAAO,GAC7D,CAACX,UAAU,CAACC,YAAY4C,UAAKC,oBAAAA,QAAoBwB,MAAMvH,mCAASuH,IAAI,GACpE,CAACtE,UACCC,YACA3B,mBACAA,gBAAgBnB,MAAM,KACtB0F,UAAKC,4BAAoBlC,UAAU7D,mCAAS6D,QAAQ,CAAC;AAAA,IAEzD,gBAAcxD,QAAQ,OAAO,OAAO2D;AAAAA,IAAU,GACzCtC,SAAS,cAAc;AAAA,MAC1B4E,MAAM;AAAA,MACN,iBAAiBjC;AAAAA,MACjB,iBAAiBb,aAAaG,WAAWK;AAAAA,MACzC,iBAAiB5E,WAAW,OAAO4E;AAAAA,IACrC;AAAA,IAAC,GACGjD;AAAAA,IAAMF,WAET4E,iBACAxC,yCACEuE,YAAAA,oBAAkB;AAAA,MAAC3H,IAAIO;AAAAA,MAAQkD,OAAOA,QAAQ;AAAA,MAAEzC,UAC9CkG;AAAAA,IAAAA,CAEJ,CAAA;AAAA,EAAA,CACU;AAEjB,CAAC;;"}
@@ -14,10 +14,13 @@ const HvVerticalNavigation = ({
14
14
  classes,
15
15
  children,
16
16
  open = true,
17
- collapsedMode = "simple",
18
17
  slider = false,
18
+ useIcons = false,
19
19
  ...others
20
20
  }) => {
21
+ if (others.collapsedMode) {
22
+ console.warn("`collaspedMode` is deprecated. Please use 'useIcons'.");
23
+ }
21
24
  const [parentData, setParentData] = React.useState([]);
22
25
  const [parentSelected, setParentSelected] = React.useState();
23
26
  const [headerTitle, setHeaderTitle] = React.useState();
@@ -35,7 +38,7 @@ const HvVerticalNavigation = ({
35
38
  };
36
39
  const value = React.useMemo(() => ({
37
40
  isOpen: open,
38
- collapsedMode,
41
+ useIcons,
39
42
  slider,
40
43
  headerTitle,
41
44
  setHeaderTitle,
@@ -48,7 +51,7 @@ const HvVerticalNavigation = ({
48
51
  parentSelected,
49
52
  setParentSelected,
50
53
  hasAnyChildWithData
51
- }), [open, collapsedMode, slider, headerTitle, setHeaderTitle, parentItem, withParentData, navigateToChildHandler, navigateToParentHandler, hasAnyChildWithData]);
54
+ }), [open, useIcons, slider, headerTitle, setHeaderTitle, parentItem, withParentData, navigateToChildHandler, navigateToParentHandler, hasAnyChildWithData]);
52
55
  const content = /* @__PURE__ */ jsxRuntime.jsx(VerticalNavigationContext.VerticalNavigationContext.Provider, {
53
56
  value,
54
57
  children: /* @__PURE__ */ jsxRuntime.jsx(VerticalNavigation_styles.StyledRoot, {
@@ -1 +1 @@
1
- {"version":3,"file":"VerticalNavigation.cjs","sources":["../../../../src/components/VerticalNavigation/VerticalNavigation.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { StyledRoot } from \"./VerticalNavigation.styles\";\nimport verticalNavigationClasses, {\n HvVerticalNavigationClasses,\n} from \"./verticalNavigationClasses\";\nimport { NavigationData, VerticalNavigationContext } from \".\";\nimport {\n fillDataWithParentId,\n getNavigationItemById,\n getParentItemById,\n} from \"./NavigationSlider/utils\";\nimport { hasChildNavigationItems } from \"./utils/VerticalNavigation.utils\";\n\nexport interface HvVerticalNavigationProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * A Jss Object used to override or extend the styles applied to the component.\n */\n classes?: HvVerticalNavigationClasses;\n /**\n * Current State of the Vertical Navigation Collapse\n */\n open?: boolean;\n /**\n * Collpased Mode for the Vertical Navigation, the default value is \"simple\".\n */\n collapsedMode?: HvVerticalNavigationMode;\n /**\n * Boolean to determine if treeview is in slider mode (for mobile navigation), the default value is false.\n */\n slider?: boolean;\n /**\n * The content inside the actions container.\n */\n children?: React.ReactNode;\n}\n\n/**\n * Navigation enables users to move through an app to complete tasks.\n *\n * It is recommended to use vertical navigation when your application requires global navigation that is displayed on the left.\n * While vertical navigation menus generally consume more space than their horizontal counterparts, they have become more popular as desktop monitors move to wide-screen formats.\n *\n * Although both the hierarchically organized data and the visual style resemble a treeview-like structure, the [Treeview Design Pattern](https://w3c.github.io/aria-practices/#TreeView)\n * isn't necessarily the most appropriate.\n *\n * The tree role provides complex functionality that is not needed for typical site navigation, and changes the most common keyboard navigation using TAB.\n *\n * The [Disclosure Design Pattern](https://w3c.github.io/aria-practices/#disclosure) is more suited for typical site navigation, with expandable groups of links.\n * However it can be tedious to TAB through all navigation items to reach the actions panel.\n *\n * Both modes are available via the `mode` property and each app should choose the most appropriate.\n */\nexport const HvVerticalNavigation = ({\n id,\n className,\n classes,\n\n children,\n\n open = true,\n\n collapsedMode = \"simple\",\n\n slider = false,\n\n ...others\n}: HvVerticalNavigationProps) => {\n const [parentData, setParentData] = useState<NavigationData[]>([]);\n\n const [parentSelected, setParentSelected] = useState();\n\n const [headerTitle, setHeaderTitle] = useState<string | undefined>();\n\n // navigationSlider\n const withParentData = useMemo(\n () => fillDataWithParentId(parentData),\n [parentData]\n );\n\n const initialParentItem = useMemo(\n () => getParentItemById(withParentData, parentSelected),\n [withParentData, parentSelected]\n );\n\n const [parentItem, setParentItem] = useState(initialParentItem);\n\n const hasAnyChildWithData = useMemo(\n () => hasChildNavigationItems(parentData),\n [parentData]\n );\n\n useEffect(\n () => setHeaderTitle(parentItem?.label),\n [parentItem, setParentItem]\n );\n\n const navigateToParentHandler = () => {\n setParentItem(getParentItemById(withParentData, parentItem.id));\n };\n\n const navigateToChildHandler = (event, item) => {\n setParentItem(getNavigationItemById(withParentData, item.id));\n event.stopPropagation();\n };\n\n const value = useMemo(\n () => ({\n isOpen: open,\n collapsedMode,\n slider,\n headerTitle,\n setHeaderTitle,\n\n parentItem,\n withParentData,\n navigateToChildHandler,\n navigateToParentHandler,\n\n parentData,\n setParentData,\n parentSelected,\n setParentSelected,\n hasAnyChildWithData,\n }),\n [\n open,\n collapsedMode,\n slider,\n headerTitle,\n setHeaderTitle,\n parentItem,\n withParentData,\n navigateToChildHandler,\n navigateToParentHandler,\n hasAnyChildWithData,\n ]\n );\n\n const content = (\n <VerticalNavigationContext.Provider value={value}>\n <StyledRoot\n id={id}\n className={clsx(\n className,\n verticalNavigationClasses.root,\n classes?.root,\n !open && verticalNavigationClasses.collapsed,\n slider && verticalNavigationClasses.slider,\n classes?.collapsed\n )}\n hasAnyChildWithData={hasAnyChildWithData}\n {...others}\n >\n {children}\n </StyledRoot>\n </VerticalNavigationContext.Provider>\n );\n\n return content;\n};\n\nexport type HvVerticalNavigationMode = \"icon\" | \"simple\";\n\nexport type HvVerticalNavigationPosition =\n | \"static\"\n | \"relative\"\n | \"fixed\"\n | \"absolute\";\n"],"names":["HvVerticalNavigation","id","className","classes","children","open","collapsedMode","slider","others","parentData","setParentData","useState","parentSelected","setParentSelected","headerTitle","setHeaderTitle","withParentData","useMemo","fillDataWithParentId","initialParentItem","getParentItemById","parentItem","setParentItem","hasAnyChildWithData","hasChildNavigationItems","useEffect","label","navigateToParentHandler","navigateToChildHandler","event","item","getNavigationItemById","stopPropagation","value","isOpen","content","VerticalNavigationContext","Provider","StyledRoot","clsx","verticalNavigationClasses","root","collapsed"],"mappings":";;;;;;;;;;AA6DO,MAAMA,uBAAuBA,CAAC;AAAA,EACnCC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EAEAC;AAAAA,EAEAC,OAAO;AAAA,EAEPC,gBAAgB;AAAA,EAEhBC,SAAS;AAAA,EAET,GAAGC;AACsB,MAAM;AAC/B,QAAM,CAACC,YAAYC,aAAa,IAAIC,MAAAA,SAA2B,CAAE,CAAA;AAEjE,QAAM,CAACC,gBAAgBC,iBAAiB,IAAIF,MAAU,SAAA;AAEtD,QAAM,CAACG,aAAaC,cAAc,IAAIJ,MAA8B,SAAA;AAG9DK,QAAAA,iBAAiBC,MAAAA,QACrB,MAAMC,uBAAAA,qBAAqBT,UAAU,GACrC,CAACA,UAAU,CAAC;AAGRU,QAAAA,oBAAoBF,cACxB,MAAMG,yCAAkBJ,gBA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AA,EAAA,CAGd;AAEM+B,SAAAA;AACT;;"}
1
+ {"version":3,"file":"VerticalNavigation.cjs","sources":["../../../../src/components/VerticalNavigation/VerticalNavigation.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { StyledRoot } from \"./VerticalNavigation.styles\";\nimport verticalNavigationClasses, {\n HvVerticalNavigationClasses,\n} from \"./verticalNavigationClasses\";\nimport { NavigationData, VerticalNavigationContext } from \".\";\nimport {\n fillDataWithParentId,\n getNavigationItemById,\n getParentItemById,\n} from \"./NavigationSlider/utils\";\nimport { hasChildNavigationItems } from \"./utils/VerticalNavigation.utils\";\n\nexport interface HvVerticalNavigationProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * A Jss Object used to override or extend the styles applied to the component.\n */\n classes?: HvVerticalNavigationClasses;\n /**\n * Current State of the Vertical Navigation Collapse\n */\n open?: boolean;\n /**\n * Collpased Mode for the Vertical Navigation, the default value is \"simple\".\n *\n * @deprecated - `useIcons` property should be used instead.\n */\n collapsedMode?: HvVerticalNavigationMode;\n /**\n * Boolean to determine if treeview is in slider mode (for mobile navigation), the default value is false.\n */\n slider?: boolean;\n /**\n * The content inside the actions container.\n */\n children?: React.ReactNode;\n /**\n * Boolean to determine if icons should be displayed in the navigation menu.\n * When `true` a icon will always be displayed, if no icon is provided the first letter of the label will be\n * displayed inside an Avatar component.\n * When `false` no icons will be shown, even if an icon is provided.\n */\n useIcons?: boolean;\n}\n\n/**\n * Navigation enables users to move through an app to complete tasks.\n *\n * It is recommended to use vertical navigation when your application requires global navigation that is displayed on the left.\n * While vertical navigation menus generally consume more space than their horizontal counterparts, they have become more popular as desktop monitors move to wide-screen formats.\n *\n * Although both the hierarchically organized data and the visual style resemble a treeview-like structure, the [Treeview Design Pattern](https://w3c.github.io/aria-practices/#TreeView)\n * isn't necessarily the most appropriate.\n *\n * The tree role provides complex functionality that is not needed for typical site navigation, and changes the most common keyboard navigation using TAB.\n *\n * The [Disclosure Design Pattern](https://w3c.github.io/aria-practices/#disclosure) is more suited for typical site navigation, with expandable groups of links.\n * However it can be tedious to TAB through all navigation items to reach the actions panel.\n *\n * Both modes are available via the `mode` property and each app should choose the most appropriate.\n */\nexport const HvVerticalNavigation = ({\n id,\n className,\n classes,\n\n children,\n\n open = true,\n\n slider = false,\n\n useIcons = false,\n\n ...others\n}: HvVerticalNavigationProps) => {\n if (others.collapsedMode) {\n console.warn(\"`collaspedMode` is deprecated. Please use 'useIcons'.\");\n }\n const [parentData, setParentData] = useState<NavigationData[]>([]);\n\n const [parentSelected, setParentSelected] = useState();\n\n const [headerTitle, setHeaderTitle] = useState<string | undefined>();\n\n // navigationSlider\n const withParentData = useMemo(\n () => fillDataWithParentId(parentData),\n [parentData]\n );\n\n const initialParentItem = useMemo(\n () => getParentItemById(withParentData, parentSelected),\n [withParentData, parentSelected]\n );\n\n const [parentItem, setParentItem] = useState(initialParentItem);\n\n const hasAnyChildWithData = useMemo(\n () => hasChildNavigationItems(parentData),\n [parentData]\n );\n\n useEffect(\n () => setHeaderTitle(parentItem?.label),\n [parentItem, setParentItem]\n );\n\n const navigateToParentHandler = () => {\n setParentItem(getParentItemById(withParentData, parentItem.id));\n };\n\n const navigateToChildHandler = (event, item) => {\n setParentItem(getNavigationItemById(withParentData, item.id));\n event.stopPropagation();\n };\n\n const value = useMemo(\n () => ({\n isOpen: open,\n useIcons,\n slider,\n headerTitle,\n setHeaderTitle,\n\n parentItem,\n withParentData,\n navigateToChildHandler,\n navigateToParentHandler,\n\n parentData,\n setParentData,\n parentSelected,\n setParentSelected,\n hasAnyChildWithData,\n }),\n [\n open,\n useIcons,\n slider,\n headerTitle,\n setHeaderTitle,\n parentItem,\n withParentData,\n navigateToChildHandler,\n navigateToParentHandler,\n hasAnyChildWithData,\n ]\n );\n\n const content = (\n <VerticalNavigationContext.Provider value={value}>\n <StyledRoot\n id={id}\n className={clsx(\n className,\n verticalNavigationClasses.root,\n classes?.root,\n !open && verticalNavigationClasses.collapsed,\n slider && verticalNavigationClasses.slider,\n classes?.collapsed\n )}\n hasAnyChildWithData={hasAnyChildWithData}\n {...others}\n >\n {children}\n </StyledRoot>\n </VerticalNavigationContext.Provider>\n );\n\n return content;\n};\n\nexport type HvVerticalNavigationMode = \"icon\" | \"simple\";\n\nexport type HvVerticalNavigationPosition =\n | \"static\"\n | \"relative\"\n | \"fixed\"\n | \"absolute\";\n"],"names":["HvVerticalNavigation","id","className","classes","children","open","slider","useIcons","others","collapsedMode","console","warn","parentData","setParentData","useState","parentSelected","setParentSelected","headerTitle","setHeaderTitle","withParentData","useMemo","fillDataWithParentId","initialParentItem","getParentItemById","parentItem","setParentItem","hasAnyChildWithData","hasChildNavigationItems","useEffect","label","navigateToParentHandler","navigateToChildHandler","event","item","getNavigationItemById","stopPropagation","value","isOpen","content","VerticalNavigationContext","Provider","StyledRoot","clsx","verticalNavigationClasses","root","collapsed"],"mappings":";;;;;;;;;;AAsEO,MAAMA,uBAAuBA,CAAC;AAAA,EACnCC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EAEAC;AAAAA,EAEAC,OAAO;AAAA,EAEPC,SAAS;AAAA,EAETC,WAAW;AAAA,EAEX,GAAGC;AACsB,MAAM;AAC/B,MAAIA,OAAOC,eAAe;AACxBC,YAAQC,KAAK,uDAAuD;AAAA,EACtE;AACA,QAAM,CAACC,YAAYC,aAAa,IAAIC,MAAAA,SAA2B,CAAE,CAAA;AAEjE,QAAM,CAACC,gBAAgBC,iBAAiB,IAAIF,MAAU,SAAA;AAEtD,QAAM,CAACG,aAAaC,cAAc,IAAIJ,MAA8B,SAAA;AAG9DK,QAAAA,iBAAiBC,MAAAA,QACrB,MAAMC,uBAAAA,qBAAqBT,UAAU,GACrC,CAACA,UAAU,CAAC;AAGRU,QAAAA,oBAAoBF,cACxB,MAAMG,yCAAkBJ,gBAAgBJ,cAAc,GACtD,CAACI,gBAAgBJ,cAAc,CAAC;A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3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
4
  const VerticalNavigationContext = React.createContext({
5
5
  isOpen: true,
6
- collapsedMode: "simple",
6
+ useIcons: false,
7
7
  slider: false
8
8
  });
9
9
  exports.VerticalNavigationContext = VerticalNavigationContext;
@@ -1 +1 @@
1
- {"version":3,"file":"VerticalNavigationContext.cjs","sources":["../../../../src/components/VerticalNavigation/VerticalNavigationContext.tsx"],"sourcesContent":["import { createContext } from \"react\";\nimport { NavigationData, HvVerticalNavigationMode } from \".\";\n\ninterface VerticalNavigationContextValue {\n isOpen: boolean;\n collapsedMode: HvVerticalNavigationMode;\n slider?: boolean;\n headerTitle?: string;\n setHeaderTitle?: React.Dispatch<React.SetStateAction<string | undefined>>;\n\n parentItem?;\n withParentData?;\n navigateToChildHandler?: (event, item) => void;\n navigateToParentHandler?: () => void;\n\n parentData?: NavigationData[];\n setParentData?: React.Dispatch<React.SetStateAction<any>>;\n parentSelected?;\n setParentSelected?: React.Dispatch<React.SetStateAction<any>>;\n\n hasAnyChildWithData?: boolean;\n}\n\nconst VerticalNavigationContext = createContext<VerticalNavigationContextValue>(\n {\n isOpen: true,\n collapsedMode: \"simple\",\n slider: false,\n }\n);\n\nexport { VerticalNavigationContext };\n"],"names":["VerticalNavigationContext","createContext","isOpen","collapsedMode","slider"],"mappings":";;;AAuBA,MAAMA,4BAA4BC,MAAAA,cAChC;AAAA,EACEC,QAAQ;AAAA,EACRC,eAAe;AAAA,EACfC,QAAQ;AACV,CAAC;;"}
1
+ {"version":3,"file":"VerticalNavigationContext.cjs","sources":["../../../../src/components/VerticalNavigation/VerticalNavigationContext.tsx"],"sourcesContent":["import { createContext } from \"react\";\nimport { NavigationData } from \".\";\n\ninterface VerticalNavigationContextValue {\n isOpen: boolean;\n useIcons: boolean;\n slider?: boolean;\n headerTitle?: string;\n setHeaderTitle?: React.Dispatch<React.SetStateAction<string | undefined>>;\n\n parentItem?;\n withParentData?;\n navigateToChildHandler?: (event, item) => void;\n navigateToParentHandler?: () => void;\n\n parentData?: NavigationData[];\n setParentData?: React.Dispatch<React.SetStateAction<any>>;\n parentSelected?;\n setParentSelected?: React.Dispatch<React.SetStateAction<any>>;\n\n hasAnyChildWithData?: boolean;\n}\n\nconst VerticalNavigationContext = createContext<VerticalNavigationContextValue>(\n {\n isOpen: true,\n useIcons: false,\n slider: false,\n }\n);\n\nexport { VerticalNavigationContext };\n"],"names":["VerticalNavigationContext","createContext","isOpen","useIcons","slider"],"mappings":";;;AAuBA,MAAMA,4BAA4BC,MAAAA,cAChC;AAAA,EACEC,QAAQ;AAAA,EACRC,UAAU;AAAA,EACVC,QAAQ;AACV,CAAC;;"}
@@ -271,6 +271,7 @@ const hexToRgbA = require("./utils/hexToRgbA.cjs");
271
271
  const browser = require("./utils/browser.cjs");
272
272
  const multiSelectionEventHandler = require("./utils/multiSelectionEventHandler.cjs");
273
273
  const getComponentName = require("./utils/getComponentName.cjs");
274
+ const checkValidHexColorValue = require("./utils/checkValidHexColorValue.cjs");
274
275
  const focusUtils = require("./utils/focusUtils.cjs");
275
276
  const keyboardCodes = require("./utils/keyboardUtils/keyboardCodes.cjs");
276
277
  const keyCheck = require("./utils/keyboardUtils/keyCheck.cjs");
@@ -543,7 +544,6 @@ exports.HvSwitchColumnCell = SwitchColumnCell.default;
543
544
  exports.hvNodeFallback = fallbacks.hvNodeFallback;
544
545
  exports.hvNumberFallback = fallbacks.hvNumberFallback;
545
546
  exports.hvStringFallback = fallbacks.hvStringFallback;
546
- exports.checkValidHexColorValue = utils.checkValidHexColorValue;
547
547
  exports.getBorderStyles = utils.getBorderStyles;
548
548
  exports.loginClasses = loginClasses.default;
549
549
  exports.HvLogin = Login.HvLogin;
@@ -619,6 +619,7 @@ exports.hexToRgbA = hexToRgbA.default;
619
619
  exports.isBrowser = browser.default;
620
620
  exports.multiSelectionEventHandler = multiSelectionEventHandler.default;
621
621
  exports.getComponentName = getComponentName.default;
622
+ exports.checkValidHexColorValue = checkValidHexColorValue.default;
622
623
  exports.outlineStyles = focusUtils.outlineStyles;
623
624
  exports.keyboardCodes = keyboardCodes.keyboardCodes;
624
625
  exports.getKeyCodeFromEvent = keyCheck.getKeyCodeFromEvent;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const checkValidHexColorValue = (value) => {
4
+ const reg = /^#([0-9a-f]{3}){1,2}$/i;
5
+ return value ? reg.test(value) : false;
6
+ };
7
+ const checkValidHexColorValue$1 = checkValidHexColorValue;
8
+ exports.default = checkValidHexColorValue$1;
9
+ //# sourceMappingURL=checkValidHexColorValue.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkValidHexColorValue.cjs","sources":["../../../src/utils/checkValidHexColorValue.ts"],"sourcesContent":["const checkValidHexColorValue = (value?: string): boolean => {\n const reg = /^#([0-9a-f]{3}){1,2}$/i;\n return value ? reg.test(value) : false;\n};\n\nexport default checkValidHexColorValue;\n"],"names":["checkValidHexColorValue","value","reg","test"],"mappings":";;AAAA,MAAMA,0BAA0BA,CAACC,UAA4B;AAC3D,QAAMC,MAAM;AACZ,SAAOD,QAAQC,IAAIC,KAAKF,KAAK,IAAI;AACnC;AAEA,MAAA,4BAAeD;;"}
@@ -1,17 +1,18 @@
1
- import { clsx } from "clsx";
2
1
  import { useMemo } from "react";
3
2
  import { ClassNames } from "@emotion/react";
4
3
  import { theme } from "@hitachivantara/uikit-styles";
5
4
  import { MoreOptionsVertical } from "@hitachivantara/uikit-react-icons";
6
5
  import withId from "../../hocs/withId.js";
7
- import { StyledButton, StyledBaseDropDown, StyledPanel } from "./DropDownMenu.styles.js";
6
+ import { styles } from "./DropDownMenu.styles.js";
8
7
  import dropDownMenuClasses from "./dropDownMenuClasses.js";
9
8
  import { jsx } from "@emotion/react/jsx-runtime";
10
9
  import { getPrevNextFocus } from "../../utils/focusableElementFinder.js";
10
+ import { HvBaseDropdown } from "../BaseDropdown/BaseDropdown.js";
11
+ import { HvPanel } from "../Panel/Panel.js";
11
12
  import { HvList } from "../List/List.js";
12
13
  import { useControlled } from "../../hooks/useControlled.js";
13
14
  import { setId } from "../../utils/setId.js";
14
- import { outlineStyles } from "../../utils/focusUtils.js";
15
+ import { HvButton } from "../Button/Button.js";
15
16
  import { isKeypress } from "../../utils/keyboardUtils/keyCheck.js";
16
17
  import { keyboardCodes } from "../../utils/keyboardUtils/keyboardCodes.js";
17
18
  const HvDropDownMenu = ({
@@ -51,19 +52,6 @@ const HvDropDownMenu = ({
51
52
  var _a;
52
53
  (_a = containerRef == null ? void 0 : containerRef.getElementsByTagName("li")[0]) == null ? void 0 : _a.focus();
53
54
  };
54
- const headerComponent = /* @__PURE__ */ jsx(StyledButton, {
55
- icon: true,
56
- variant: category,
57
- id: setId(id, "icon-button"),
58
- className: clsx(dropDownMenuClasses.icon, classes == null ? void 0 : classes.icon, open && clsx(dropDownMenuClasses.iconSelected, classes == null ? void 0 : classes.iconSelected)),
59
- "aria-expanded": open,
60
- disabled,
61
- "aria-label": "Dropdown menu",
62
- $open: open,
63
- children: icon || /* @__PURE__ */ jsx(MoreOptionsVertical, {
64
- color: disabled ? "secondary_60" : void 0
65
- })
66
- });
67
55
  const condensed = useMemo(() => dataList.every((el) => !el.icon), [dataList]);
68
56
  const popperStyle = {
69
57
  style: {
@@ -76,21 +64,26 @@ const HvDropDownMenu = ({
76
64
  children: ({
77
65
  css,
78
66
  cx
79
- }) => /* @__PURE__ */ jsx(StyledBaseDropDown, {
67
+ }) => /* @__PURE__ */ jsx(HvBaseDropdown, {
80
68
  id,
81
- className: cx(dropDownMenuClasses.container, className, classes == null ? void 0 : classes.container),
69
+ className: cx(dropDownMenuClasses.container, css(styles.container), className, classes == null ? void 0 : classes.container),
82
70
  classes: {
83
- root: cx(dropDownMenuClasses.root, css({
84
- display: "inline-block",
85
- width: "auto",
86
- "&.focus-visible $icon": {
87
- ...outlineStyles
88
- }
89
- }), classes == null ? void 0 : classes.root),
71
+ root: cx(dropDownMenuClasses.root, css(styles.root), classes == null ? void 0 : classes.root),
90
72
  container: cx(dropDownMenuClasses.baseContainer, classes == null ? void 0 : classes.baseContainer)
91
73
  },
92
74
  expanded: open && !disabled,
93
- component: headerComponent,
75
+ component: /* @__PURE__ */ jsx(HvButton, {
76
+ icon: true,
77
+ variant: category,
78
+ id: setId(id, "icon-button"),
79
+ className: cx(dropDownMenuClasses.icon, open && dropDownMenuClasses.iconSelected, css(styles.icon), open && css(styles.iconSelected), classes == null ? void 0 : classes.icon, open && (classes == null ? void 0 : classes.iconSelected)),
80
+ "aria-expanded": open,
81
+ disabled,
82
+ "aria-label": "Dropdown menu",
83
+ children: icon || /* @__PURE__ */ jsx(MoreOptionsVertical, {
84
+ color: disabled ? "secondary_60" : void 0
85
+ })
86
+ }),
94
87
  "aria-haspopup": "menu",
95
88
  placement,
96
89
  variableWidth: true,
@@ -103,7 +96,8 @@ const HvDropDownMenu = ({
103
96
  onContainerCreation: setFocusToContent,
104
97
  popperProps: popperStyle,
105
98
  ...others,
106
- children: /* @__PURE__ */ jsx(StyledPanel, {
99
+ children: /* @__PURE__ */ jsx(HvPanel, {
100
+ className: cx(dropDownMenuClasses.menuListRoot, css(styles.menuListRoot), classes == null ? void 0 : classes.menuListRoot),
107
101
  children: /* @__PURE__ */ jsx(HvList, {
108
102
  id: listId,
109
103
  values: dataList,
@@ -1 +1 @@
1
- {"version":3,"file":"DropDownMenu.js","sources":["../../../../src/components/DropDownMenu/DropDownMenu.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useMemo } from \"react\";\nimport { ClassNames } from \"@emotion/react\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { MoreOptionsVertical } from \"@hitachivantara/uikit-react-icons\";\nimport { useControlled } from \"@core/hooks\";\nimport { HvBaseProps } from \"@core/types\";\nimport withId from \"@core/hocs/withId\";\nimport {\n isKeypress,\n keyboardCodes,\n outlineStyles,\n setId,\n getPrevNextFocus,\n} from \"@core/utils\";\n\nimport {\n HvBaseDropdownProps,\n HvButtonVariant,\n HvList,\n HvListValue,\n} from \"@core/components\";\nimport {\n StyledBaseDropDown,\n StyledButton,\n StyledPanel,\n} from \"./DropDownMenu.styles\";\nimport dropDownMenuClasses, {\n HvDropDownMenuClasses,\n} from \"./dropDownMenuClasses\";\n\nexport interface HvDropDownMenuProps\n extends HvBaseProps<HTMLDivElement, \"onClick\"> {\n /** Icon. */\n icon?: React.ReactElement;\n /**\n * A list containing the elements to be rendered.\n *\n * - label: The label of the element to be rendered.\n * - selected: The selection state of the element.\n * - disabled: The disabled state of the element.\n * - icon: The icon node to be rendered on the left.\n * - showNavIcon: If true renders the navigation icon on the right.\n */\n dataList: HvListValue[];\n /** Placement of the dropdown. */\n placement?: \"left\" | \"right\";\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Function executed on toggle of the dropdown. Should receive the open status. */\n onToggle?: (event: Event, open: boolean) => void;\n /** Function executed in each onClick. Should received the clicked element. */\n onClick?: (\n event: React.ChangeEvent<HTMLLIElement>,\n value: HvListValue\n ) => void;\n /** Keep the Dropdown Menu opened after clicking one option */\n keepOpened?: boolean;\n /** Defines if the component is disabled. */\n disabled?: boolean;\n /** If true it should be displayed open. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** The variant to be used in the header. */\n category?: HvButtonVariant;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDropDownMenuClasses;\n}\n\n/**\n * A drop-down menu is a graphical control element, similar to a list box, that allows the user to choose a value from a list.\n */\nconst HvDropDownMenu = ({\n id,\n classes,\n className,\n icon,\n placement = \"right\",\n dataList,\n disablePortal = false,\n onToggle,\n onClick,\n keepOpened = true,\n disabled = false,\n expanded,\n defaultExpanded = false,\n category = \"secondaryGhost\",\n ...others\n}: HvDropDownMenuProps) => {\n const [open, setOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const focusNodes = getPrevNextFocus(setId(id, \"icon-button\"));\n\n const listId = setId(id, \"list\");\n\n const handleClose = (event) => {\n // this will only run if uncontrolled\n setOpen(false);\n onToggle?.(event, false);\n };\n\n // If the ESCAPE key is pressed inside the list, the close handler must be called.\n const handleKeyDown = (event) => {\n if (isKeypress(event, keyboardCodes.Tab)) {\n const node = event.shiftKey ? focusNodes.prevFocus : focusNodes.nextFocus;\n if (node) setTimeout(() => node.focus(), 0);\n handleClose(event);\n }\n event.preventDefault();\n };\n\n const setFocusToContent = (containerRef) => {\n containerRef?.getElementsByTagName(\"li\")[0]?.focus();\n };\n\n const headerComponent = (\n <StyledButton\n icon\n variant={category}\n id={setId(id, \"icon-button\")}\n className={clsx(\n dropDownMenuClasses.icon,\n classes?.icon,\n open && clsx(dropDownMenuClasses.iconSelected, classes?.iconSelected)\n )}\n aria-expanded={open}\n disabled={disabled}\n aria-label=\"Dropdown menu\"\n $open={open}\n >\n {icon || (\n <MoreOptionsVertical color={disabled ? \"secondary_60\" : undefined} />\n )}\n </StyledButton>\n );\n\n const condensed = useMemo(() => dataList.every((el) => !el.icon), [dataList]);\n const popperStyle: HvBaseDropdownProps[\"popperProps\"] = {\n style: {\n zIndex: theme.zIndices.tooltip,\n width: \"auto\",\n position: \"relative\",\n },\n };\n\n return (\n <ClassNames>\n {({ css, cx }) => (\n <StyledBaseDropDown\n id={id}\n className={cx(\n dropDownMenuClasses.container,\n className,\n classes?.container\n )}\n classes={{\n root: cx(\n dropDownMenuClasses.root,\n css({\n display: \"inline-block\",\n width: \"auto\",\n \"&.focus-visible $icon\": {\n ...outlineStyles,\n },\n }),\n classes?.root\n ),\n container: cx(\n dropDownMenuClasses.baseContainer,\n classes?.baseContainer\n ),\n }}\n expanded={open && !disabled}\n component={headerComponent}\n aria-haspopup=\"menu\"\n placement={placement}\n variableWidth\n disablePortal={disablePortal}\n onToggle={(e, s) => {\n // this will only run if uncontrolled\n setOpen(s);\n onToggle?.(e, s);\n }}\n disabled={disabled}\n onContainerCreation={setFocusToContent}\n popperProps={popperStyle}\n {...others}\n >\n <StyledPanel>\n <HvList\n id={listId}\n values={dataList}\n selectable={false}\n condensed={condensed}\n onClick={(event, item) => {\n if (!keepOpened) handleClose(event);\n onClick?.(event, item);\n }}\n onKeyDown={handleKeyDown}\n classes={{\n root: cx(dropDownMenuClasses.menuList, classes?.menuList),\n }}\n />\n </StyledPanel>\n </StyledBaseDropDown>\n )}\n </ClassNames>\n );\n};\n\nexport default withId(HvDropDownMenu);\n"],"names":["HvDropDownMenu","id","classes","className","icon","placement","dataList","disablePortal","onToggle","onClick","keepOpened","disabled","expanded","defaultExpanded","category","others","open","setOpen","useControlled","Boolean","focusNodes","getPrevNextFocus","setId","listId","handleClose","event","handleKeyDown","isKeypress","keyboardCodes","Tab","node","shiftKey","prevFocus","nextFocus","setTimeout","focus","preventDefault","setFocusToContent","containerRef","getElementsByTagName","headerComponent","StyledButton","variant","clsx","dropDownMenuClasses","iconSelected","$open","children","_jsx","MoreOptionsVertical","color","undefined","condensed","useMemo","every","el","popperStyle","style","zIndex","theme","zIndices","tooltip","width","position","ClassNames","css","cx","StyledBaseDropDown","container","root","display","outlineStyles","baseContainer","component","variableWidth","e","s","onContainerCreation","popperProps","StyledPanel","HvList","values","selectable","item","onK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AAAA,UACL/E,IAAIsB;AAAAA,UACJ0D,QAAQ3E;AAAAA,UACR4E,YAAY;AAAA,UACZ9B;AAAAA,UACA3C,SAASA,CAACgB,OAAO0D,SAAS;AACxB,gBAAI,CAACzE;AAAYc,0BAAYC,KAAK;AAClChB,+CAAUgB,OAAO0D;AAAAA,UACnB;AAAA,UACAC,WAAW1D;AAAAA,UACXxB,SAAS;AAAA,YACPmE,MAAMH,GAAGtB,oBAAoByC,UAAUnF,mCAASmF,QAAQ;AAAA,UAC1D;AAAA,QAAA,CAAE;AAAA,MAAA,CACF;AAAA,IAAA,CACU;AAAA,EAAA,CAGP;AAEjB;AAEA,MAAeC,mBAAAA,OAAOtF,cAAc;"}
1
+ {"version":3,"file":"DropDownMenu.js","sources":["../../../../src/components/DropDownMenu/DropDownMenu.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { ClassNames } from \"@emotion/react\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { MoreOptionsVertical } from \"@hitachivantara/uikit-react-icons\";\nimport { useControlled } from \"@core/hooks\";\nimport { HvBaseProps } from \"@core/types\";\nimport withId from \"@core/hocs/withId\";\nimport {\n isKeypress,\n keyboardCodes,\n setId,\n getPrevNextFocus,\n} from \"@core/utils\";\nimport {\n HvBaseDropdown,\n HvBaseDropdownProps,\n HvButton,\n HvButtonVariant,\n HvList,\n HvListValue,\n HvPanel,\n} from \"@core/components\";\nimport { styles } from \"./DropDownMenu.styles\";\nimport dropDownMenuClasses, {\n HvDropDownMenuClasses,\n} from \"./dropDownMenuClasses\";\n\nexport interface HvDropDownMenuProps\n extends HvBaseProps<HTMLDivElement, \"onClick\"> {\n /** Icon. */\n icon?: React.ReactElement;\n /**\n * A list containing the elements to be rendered.\n *\n * - label: The label of the element to be rendered.\n * - selected: The selection state of the element.\n * - disabled: The disabled state of the element.\n * - icon: The icon node to be rendered on the left.\n * - showNavIcon: If true renders the navigation icon on the right.\n */\n dataList: HvListValue[];\n /** Placement of the dropdown. */\n placement?: \"left\" | \"right\";\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Function executed on toggle of the dropdown. Should receive the open status. */\n onToggle?: (event: Event, open: boolean) => void;\n /** Function executed in each onClick. Should received the clicked element. */\n onClick?: (\n event: React.ChangeEvent<HTMLLIElement>,\n value: HvListValue\n ) => void;\n /** Keep the Dropdown Menu opened after clicking one option */\n keepOpened?: boolean;\n /** Defines if the component is disabled. */\n disabled?: boolean;\n /** If true it should be displayed open. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** The variant to be used in the header. */\n category?: HvButtonVariant;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDropDownMenuClasses;\n}\n\n/**\n * A drop-down menu is a graphical control element, similar to a list box, that allows the user to choose a value from a list.\n */\nconst HvDropDownMenu = ({\n id,\n classes,\n className,\n icon,\n placement = \"right\",\n dataList,\n disablePortal = false,\n onToggle,\n onClick,\n keepOpened = true,\n disabled = false,\n expanded,\n defaultExpanded = false,\n category = \"secondaryGhost\",\n ...others\n}: HvDropDownMenuProps) => {\n const [open, setOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const focusNodes = getPrevNextFocus(setId(id, \"icon-button\"));\n\n const listId = setId(id, \"list\");\n\n const handleClose = (event) => {\n // this will only run if uncontrolled\n setOpen(false);\n onToggle?.(event, false);\n };\n\n // If the ESCAPE key is pressed inside the list, the close handler must be called.\n const handleKeyDown = (event) => {\n if (isKeypress(event, keyboardCodes.Tab)) {\n const node = event.shiftKey ? focusNodes.prevFocus : focusNodes.nextFocus;\n if (node) setTimeout(() => node.focus(), 0);\n handleClose(event);\n }\n event.preventDefault();\n };\n\n const setFocusToContent = (containerRef) => {\n containerRef?.getElementsByTagName(\"li\")[0]?.focus();\n };\n\n const condensed = useMemo(() => dataList.every((el) => !el.icon), [dataList]);\n const popperStyle: HvBaseDropdownProps[\"popperProps\"] = {\n style: {\n zIndex: theme.zIndices.tooltip,\n width: \"auto\",\n position: \"relative\",\n },\n };\n\n return (\n <ClassNames>\n {({ css, cx }) => (\n <HvBaseDropdown\n id={id}\n className={cx(\n dropDownMenuClasses.container,\n css(styles.container),\n className,\n classes?.container\n )}\n classes={{\n root: cx(dropDownMenuClasses.root, css(styles.root), classes?.root),\n container: cx(\n dropDownMenuClasses.baseContainer,\n classes?.baseContainer\n ),\n }}\n expanded={open && !disabled}\n component={\n <HvButton\n icon\n variant={category}\n id={setId(id, \"icon-button\")}\n className={cx(\n dropDownMenuClasses.icon,\n open && dropDownMenuClasses.iconSelected,\n css(styles.icon),\n open && css(styles.iconSelected),\n classes?.icon,\n open && classes?.iconSelected\n )}\n aria-expanded={open}\n disabled={disabled}\n aria-label=\"Dropdown menu\"\n >\n {icon || (\n <MoreOptionsVertical\n color={disabled ? \"secondary_60\" : undefined}\n />\n )}\n </HvButton>\n }\n aria-haspopup=\"menu\"\n placement={placement}\n variableWidth\n disablePortal={disablePortal}\n onToggle={(e, s) => {\n // this will only run if uncontrolled\n setOpen(s);\n onToggle?.(e, s);\n }}\n disabled={disabled}\n onContainerCreation={setFocusToContent}\n popperProps={popperStyle}\n {...others}\n >\n <HvPanel\n className={cx(\n dropDownMenuClasses.menuListRoot,\n css(styles.menuListRoot),\n classes?.menuListRoot\n )}\n >\n <HvList\n id={listId}\n values={dataList}\n selectable={false}\n condensed={condensed}\n onClick={(event, item) => {\n if (!keepOpened) handleClose(event);\n onClick?.(event, item);\n }}\n onKeyDown={handleKeyDown}\n classes={{\n root: cx(dropDownMenuClasses.menuList, classes?.menuList),\n }}\n />\n </HvPanel>\n </HvBaseDropdown>\n )}\n </ClassNames>\n );\n};\n\nexport default withId(HvDropDownMenu);\n"],"names":["HvDropDownMenu","id","classes","className","icon","placement","dataList","disablePortal","onToggle","onClick","keepOpened","disabled","expanded","defaultExpanded","category","others","open","setOpen","useControlled","Boolean","focusNodes","getPrevNextFocus","setId","listId","handleClose","event","handleKeyDown","isKeypress","keyboardCodes","Tab","node","shiftKey","prevFocus","nextFocus","setTimeout","focus","preventDefault","setFocusToContent","containerRef","getElementsByTagName","condensed","useMemo","every","el","popperStyle","style","zIndex","theme","zIndices","tooltip","width","position","ClassNames","children","css","cx","HvBaseDropdown","dropDownMenuClasses","container","styles","root","baseContainer","component","HvButton","variant","iconSelected","_jsx","MoreOptionsVertical","color","undefined","variableWidth","e","s","onContainerCreation","popperProps","HvPanel","menuListRoot","HvList","values","selectable","item","onKeyDown","menuList","withId"],"mappings":";;;;;;;;;;;;;;;;;AAqEA,MAAMA,iBAAiBA,CAAC;AAAA,EACtBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,YAAY;AAAA,EACZC;AAAAA,EACAC,gBAAgB;AAAA,EAChBC;AAAAA,EACAC;AAAAA,EACAC,aAAa;AAAA,EACbC,WAAW;AAAA,EACXC;AAAAA,EACAC,kBAAkB;AAAA,EAClBC,WAAW;AAAA,EACX,GAAGC;AACgB,MAAM;AACnB,QAAA,CAACC,MAAMC,OAAO,IAAIC,cAAcN,UAAUO,QAAQN,eAAe,CAAC;AACxE,QAAMO,aAAaC,iBAAiBC,MAAMrB,IAAI,aAAa,CAAC;AAEtDsB,QAAAA,SAASD,MAAMrB,IAAI,MAAM;AAE/B,QAAMuB,cAAeC,CAAU,UAAA;AAE7BR,YAAQ,KAAK;AACbT,yCAAWiB,OAAO;AAAA,EAAK;AAIzB,QAAMC,gBAAiBD,CAAU,UAAA;AAC/B,QAAIE,WAAWF,OAAOG,cAAcC,GAAG,GAAG;AACxC,YAAMC,OAAOL,MAAMM,WAAWX,WAAWY,YAAYZ,WAAWa;AAC5DH,UAAAA;AAAMI,mBAAW,MAAMJ,KAAKK,MAAK,GAAI,CAAC;AAC1CX,kBAAYC,KAAK;AAAA,IACnB;AACAA,UAAMW,eAAgB;AAAA,EAAA;AAGxB,QAAMC,oBAAqBC,CAAiB,iBAAA;;AAC1CA,uDAAcC,qBAAqB,MAAM,OAAzCD,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AAA,MACAC,UAAUA,CAAC+D,GAAGC,MAAM;AAElBvD,gBAAQuD,CAAC;AACThE,6CAAW+D,GAAGC;AAAAA,MAChB;AAAA,MACA7D;AAAAA,MACA8D,qBAAqBpC;AAAAA,MACrBqC,aAAa9B;AAAAA,MAAY,GACrB7B;AAAAA,MAAMsC,8BAETsB,SAAO;AAAA,QACNxE,WAAWoD,GACTE,oBAAoBmB,cACpBtB,IAAIK,OAAOiB,YAAY,GACvB1E,mCAAS0E,YAAY;AAAA,QACrBvB,8BAEDwB,QAAM;AAAA,UACL5E,IAAIsB;AAAAA,UACJuD,QAAQxE;AAAAA,UACRyE,YAAY;AAAA,UACZvC;AAAAA,UACA/B,SAASA,CAACgB,OAAOuD,SAAS;AACxB,gBAAI,CAACtE;AAAYc,0BAAYC,KAAK;AAClChB,+CAAUgB,OAAOuD;AAAAA,UACnB;AAAA,UACAC,WAAWvD;AAAAA,UACXxB,SAAS;AAAA,YACP0D,MAAML,GAAGE,oBAAoByB,UAAUhF,mCAASgF,QAAQ;AAAA,UAC1D;AAAA,QAAA,CAAE;AAAA,MAAA,CACF;AAAA,IAAA,CACM;AAAA,EAAA,CAGH;AAEjB;AAEA,MAAeC,mBAAAA,OAAOnF,cAAc;"}
@@ -1,63 +1,26 @@
1
- import _styled from "@emotion/styled/base";
2
- import { transientOptions } from "../../utils/transientOptions.js";
3
1
  import { theme } from "@hitachivantara/uikit-styles";
4
- import { forwardRef } from "react";
5
- import { jsx } from "@emotion/react/jsx-runtime";
6
- import { HvBaseDropdown } from "../BaseDropdown/BaseDropdown.js";
7
- import { HvPanel } from "../Panel/Panel.js";
8
- import { HvButton } from "../Button/Button.js";
9
- function _EMOTION_STRINGIFIED_CSS_ERROR__() {
10
- return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
11
- }
12
- function _extends() {
13
- _extends = Object.assign ? Object.assign.bind() : function(target) {
14
- for (var i = 1; i < arguments.length; i++) {
15
- var source = arguments[i];
16
- for (var key in source) {
17
- if (Object.prototype.hasOwnProperty.call(source, key)) {
18
- target[key] = source[key];
19
- }
20
- }
2
+ import dropDownMenuClasses from "./dropDownMenuClasses.js";
3
+ import { outlineStyles } from "../../utils/focusUtils.js";
4
+ const styles = {
5
+ container: {
6
+ width: 32
7
+ },
8
+ root: {
9
+ display: "inline-block",
10
+ width: "auto",
11
+ [`&.focus-visible .${dropDownMenuClasses.icon}`]: {
12
+ ...outlineStyles
21
13
  }
22
- return target;
23
- };
24
- return _extends.apply(this, arguments);
25
- }
26
- const StyledBaseDropDown = /* @__PURE__ */ _styled((props) => /* @__PURE__ */ jsx(HvBaseDropdown, {
27
- ...props
28
- }), process.env.NODE_ENV === "production" ? {
29
- target: "e13q7myz2"
30
- } : {
31
- target: "e13q7myz2",
32
- label: "StyledBaseDropDown"
33
- })(process.env.NODE_ENV === "production" ? {
34
- name: "1p2i2oq",
35
- styles: "width:32px"
36
- } : {
37
- name: "1p2i2oq",
38
- styles: "width:32px",
39
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2NvcmUvc3JjL2NvbXBvbmVudHMvRHJvcERvd25NZW51L0Ryb3BEb3duTWVudS5zdHlsZXMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNrQyIsImZpbGUiOiIvaG9tZS9ydW5uZXIvd29yay9odi11aWtpdC1yZWFjdC9odi11aWtpdC1yZWFjdC9wYWNrYWdlcy9jb3JlL3NyYy9jb21wb25lbnRzL0Ryb3BEb3duTWVudS9Ecm9wRG93bk1lbnUuc3R5bGVzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSBcIkBlbW90aW9uL3N0eWxlZFwiO1xuaW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uZHJvcERvd25NZW51LmJvcmRlclJhZGl1cyxcbiAgYm9yZGVyOiB0aGVtZS5kcm9wRG93bk1lbnUuYm9yZGVyQ2xvc2VkLFxuXG4gIC4uLigkb3BlbiAmJiB7XG4gICAgYmFja2dyb3VuZENvbG9yOiB0aGVtZS5jb2xvcnMuYXRtbzEsXG4gICAgYm94U2hhZG93OiB0aGVtZS5jb2xvcnMuc2hhZG93LFxuXG4gICAgXCImOmhvdmVyXCI6IHtcbiAgICAgIGJhY2tncm91bmRDb2xvcjogdGhlbWUuY29sb3JzLmF0bW8xLFxuICAgIH0sXG5cbiAgICBcIiYgc3ZnIC5jb2xvcjBcIjoge1xuICAgICAgZmlsbDogdGhlbWUuY29sb3JzLnNlY29uZGFyeSxcbiAgICB9LFxuXG4gICAgYm9yZGVyUmFkaXVzOiBgJHt0aGVtZS5yYWRpaS5iYXNlfSAke3RoZW1lLnJhZGlpLmJhc2V9IDBweCAwcHhgLFxuICAgIGJvcmRlcjogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlck9wZW5lZCxcbiAgfSksXG59KSk7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQYW5lbCA9IHN0eWxlZCgocHJvcHM6IEh2UGFuZWxQcm9wcykgPT4gKFxuICA8SHZQYW5lbCB7Li4ucHJvcHN9IC8+XG4pKSh7XG4gIGJvcmRlcjogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlck9wZW5lZCxcbiAgYm9yZGVyUmFkaXVzOiB0aGVtZS5kcm9wRG93bk1lbnUuYm9yZGVyUmFkaXVzLFxufSk7XG4iXX0= */",
40
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
41
- });
42
- const StyledButton = /* @__PURE__ */ _styled(forwardRef((props, ref) => {
43
- return /* @__PURE__ */ jsx(HvButton, {
44
- ...props,
45
- ref
46
- });
47
- }), process.env.NODE_ENV === "production" ? _extends({}, {
48
- target: "e13q7myz1"
49
- }, transientOptions) : _extends({}, {
50
- target: "e13q7myz1",
51
- label: "StyledButton"
52
- }, transientOptions))(({
53
- $open
54
- }) => ({
55
- position: "relative",
56
- boxSizing: "content-box",
57
- padding: 0,
58
- borderRadius: theme.dropDownMenu.borderRadius,
59
- border: theme.dropDownMenu.borderClosed,
60
- ...$open && {
14
+ },
15
+ icon: {
16
+ position: "relative",
17
+ width: 32,
18
+ boxSizing: "border-box",
19
+ padding: 0,
20
+ borderRadius: theme.dropDownMenu.borderRadius,
21
+ border: theme.dropDownMenu.borderClosed
22
+ },
23
+ iconSelected: {
61
24
  backgroundColor: theme.colors.atmo1,
62
25
  boxShadow: theme.colors.shadow,
63
26
  "&:hover": {
@@ -68,22 +31,13 @@ const StyledButton = /* @__PURE__ */ _styled(forwardRef((props, ref) => {
68
31
  },
69
32
  borderRadius: `${theme.radii.base} ${theme.radii.base} 0px 0px`,
70
33
  border: theme.dropDownMenu.borderOpened
34
+ },
35
+ menuListRoot: {
36
+ border: theme.dropDownMenu.borderOpened,
37
+ borderRadius: theme.dropDownMenu.borderRadius
71
38
  }
72
- }), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2NvcmUvc3JjL2NvbXBvbmVudHMvRHJvcERvd25NZW51L0Ryb3BEb3duTWVudS5zdHlsZXMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW9CNEIiLCJmaWxlIjoiL2hvbWUvcnVubmVyL3dvcmsvaHYtdWlraXQtcmVhY3QvaHYtdWlraXQtcmVhY3QvcGFja2FnZXMvY29yZS9zcmMvY29tcG9uZW50cy9Ecm9wRG93bk1lbnUvRHJvcERvd25NZW51LnN0eWxlcy50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gXCJAZW1vdGlvbi9zdHlsZWRcI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oZW1lLmRyb3BEb3duTWVudS5ib3JkZXJSYWRpdXMsXG4gIGJvcmRlcjogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlckNsb3NlZCxcblxuICAuLi4oJG9wZW4gJiYge1xuICAgIGJhY2tncm91bmRDb2xvcjogdGhlbWUuY29sb3JzLmF0bW8xLFxuICAgIGJveFNoYWRvdzogdGhlbWUuY29sb3JzLnNoYWRvdyxcblxuICAgIFwiJjpob3ZlclwiOiB7XG4gICAgICBiYWNrZ3JvdW5kQ29sb3I6IHRoZW1lLmNvbG9ycy5hdG1vMSxcbiAgICB9LFxuXG4gICAgXCImIHN2ZyAuY29sb3IwXCI6IHtcbiAgICAgIGZpbGw6IHRoZW1lLmNvbG9ycy5zZWNvbmRhcnksXG4gICAgfSxcblxuICAgIGJvcmRlclJhZGl1czogYCR7dGhlbWUucmFkaWkuYmFzZX0gJHt0aGVtZS5yYWRpaS5iYXNlfSAwcHggMHB4YCxcbiAgICBib3JkZXI6IHRoZW1lLmRyb3BEb3duTWVudS5ib3JkZXJPcGVuZWQsXG4gIH0pLFxufSkpO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkUGFuZWwgPSBzdHlsZWQoKHByb3BzOiBIdlBhbmVsUHJvcHMpID0+IChcbiAgPEh2UGFuZWwgey4uLnByb3BzfSAvPlxuKSkoe1xuICBib3JkZXI6IHRoZW1lLmRyb3BEb3duTWVudS5ib3JkZXJPcGVuZWQsXG4gIGJvcmRlclJhZGl1czogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlclJhZGl1cyxcbn0pO1xuIl19 */");
73
- const StyledPanel = /* @__PURE__ */ _styled((props) => /* @__PURE__ */ jsx(HvPanel, {
74
- ...props
75
- }), process.env.NODE_ENV === "production" ? {
76
- target: "e13q7myz0"
77
- } : {
78
- target: "e13q7myz0",
79
- label: "StyledPanel"
80
- })({
81
- border: theme.dropDownMenu.borderOpened,
82
- borderRadius: theme.dropDownMenu.borderRadius
83
- }, process.env.NODE_ENV === "production" ?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G4gIH0pLFxufSkpO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkUGFuZWwgPSBzdHlsZWQoKHByb3BzOiBIdlBhbmVsUHJvcHMpID0+IChcbiAgPEh2UGFuZWwgey4uLnByb3BzfSAvPlxuKSkoe1xuICBib3JkZXI6IHRoZW1lLmRyb3BEb3duTWVudS5ib3JkZXJPcGVuZWQsXG4gIGJvcmRlclJhZGl1czogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlclJhZGl1cyxcbn0pO1xuIl19 */");
39
+ };
84
40
  export {
85
- StyledBaseDropDown,
86
- StyledButton,
87
- StyledPanel
41
+ styles
88
42
  };
89
43
  //# sourceMappingURL=DropDownMenu.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropDownMenu.styles.js","sources":["../../../../src/components/DropDownMenu/DropDownMenu.styles.tsx"],"sourcesContent":["import styled from \"@emotion/styled\";\nimport {\n HvBaseDropdown,\n HvBaseDropdownProps,\n HvButton,\n HvButtonProps,\n HvPanel,\n HvPanelProps,\n} from \"@core/components\";\nimport { transientOptions } from \"@core/utils/transientOptions\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { forwardRef } from \"react\";\nimport { PolymorphicRef } from \"@core/types\";\n\nexport const StyledBaseDropDown = styled((props: HvBaseDropdownProps) => (\n <HvBaseDropdown {...props} />\n))({\n width: 32,\n});\n\nexport const StyledButton = styled(\n forwardRef((props: HvButtonProps, ref?: PolymorphicRef<\"button\">) => {\n return <HvButton {...props} ref={ref} />;\n }),\n transientOptions\n)(({ $open }: { $open: boolean }) => ({\n position: \"relative\",\n boxSizing: \"content-box\",\n padding: 0,\n\n borderRadius: theme.dropDownMenu.borderRadius,\n border: theme.dropDownMenu.borderClosed,\n\n ...($open && {\n backgroundColor: theme.colors.atmo1,\n boxShadow: theme.colors.shadow,\n\n \"&:hover\": {\n backgroundColor: theme.colors.atmo1,\n },\n\n \"& svg .color0\": {\n fill: theme.colors.secondary,\n },\n\n borderRadius: `${theme.radii.base} ${theme.radii.base} 0px 0px`,\n border: theme.dropDownMenu.borderOpened,\n }),\n}));\n\nexport const StyledPanel = styled((props: HvPanelProps) => (\n <HvPanel {...props} />\n))({\n border: theme.dropDownMenu.borderOpened,\n borderRadius: theme.dropDownMenu.borderRadius,\n});\n"],"names":["StyledBaseDropDown","_styled","props","HvBaseDropdown","process","env","NODE_ENV","target","label","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","StyledButton","forwardRef","ref","HvButton","_extends","transientOptions","$open","position","boxSizing","padding","borderRadius","theme","dropDownMenu","border","borderClosed","backgroundColor","colors","atmo1","boxShadow","shadow","fill","secondary","radii","base","borderOpened","StyledPanel","HvPanel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAcO,MAAMA,qBAAqBC,wBAAO,CAACC,8BACvCC,gBAAc;AAAA,EAAA,GAAKD;AAAK,CAAA,GAC1BE,QAAAC,IAAAC,aAAA,eAAA;AAAA,EAAAC,QAAA;AAAA,IAAA;AAAA,EAAAA,QAAA;AAAA,EAAAC,OAAA;AAAA,CAAA,EAACJ,QAAAC,IAAAC,aAAA,eAAA;AAAA,EAAAG,MAAA;AAAA,EAAAC,QAAA;AAAA,IAAA;AAAA,EAAAD,MAAA;AAAA,EAAAC,QAAA;AAAA,EAAAC,KAAA;AAAA,EAAAC,UAAAC;AAAA,CAEA;AAEK,MAAMC,eAAeb,wBAC1Bc,WAAW,CAACb,OAAsBc,QAAmC;AACnE,6BAAQC,UAAQ;AAAA,IAAA,GAAKf;AAAAA,IAAOc;AAAAA,EAAAA,CAAY;AAC1C,CAAC,GAACZ,QAAAC,IAAAC,4BAAAY,SAAA,IAAA;AAAA,EAAAX,QAAA;AAAA,GACFY,gBAAgB,IAAAD,SAAA,IAAA;AAAA,EAAAX,QAAA;AAAA,EAAAC,OAAA;AAAA,GAAhBW,gBAAgB,CACjB,EAAC,CAAC;AAAA,EAAEC;AAA0B,OAAO;AAAA,EACpCC,UAAU;AAAA,EACVC,WAAW;AAAA,EACXC,SAAS;AAAA,EAETC,cAAcC,MAAMC,aAAaF;AAAAA,EACjCG,QAAQF,MAAMC,aAAaE;AAAAA,EAE3B,GAAIR,SAAS;AAAA,IACXS,iBAAiBJ,MAAMK,OAAOC;AAAAA,IAC9BC,WAAWP,MAAMK,OAAOG;AAAAA,IAExB,WAAW;AAAA,MACTJ,iBAAiBJ,MAAMK,OAAOC;AAAAA,IAChC;AAAA,IAEA,iBAAiB;AAAA,MACfG,MAAMT,MAAMK,OAAOK;AAAAA,IACrB;AAAA,IAEAX,cAAe,GAAEC,MAAMW,MAAMC,QAAQZ,MAAMW,MAAMC;AAAAA,IACjDV,QAAQF,MAAMC,aAAaY;AAAAA,EAC7B;AACF,IAAElC,QAAAC,IAAAC,aAAC,eAAA,KAAA,i8EAAA;AAEI,MAAMiC,cAActC,wBAAO,CAACC,8BAChCsC,SAAO;AAAA,EAAA,GAAKtC;AAAK,CAAA,GACnBE,QAAAC,IAAAC,aAAA,eAAA;AAAA,EAAAC,QAAA;AAAA,IAAA;AAAA,EAAAA,QAAA;AAAA,EAAAC,OAAA;AAAA,CAAA,EAAE;AAAA,EACDmB,QAAQF,MAAMC,aAAaY;AAAAA,EAC3Bd,cAAcC,MAAMC,aAAaF;AACnC,GAACpB,QAAAC,IAAAC,aAAC,eAAA,KAAA,i8EAAA;"}
1
+ {"version":3,"file":"DropDownMenu.styles.js","sources":["../../../../src/components/DropDownMenu/DropDownMenu.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\nimport { outlineStyles } from \"@core/utils\";\nimport { CSSInterpolation } from \"@emotion/serialize\";\nimport dropDownMenuClasses, {\n HvDropDownMenuClasses,\n} from \"./dropDownMenuClasses\";\n\nexport const styles: Partial<\n Record<keyof HvDropDownMenuClasses, CSSInterpolation>\n> = {\n container: {\n width: 32,\n },\n root: {\n display: \"inline-block\",\n width: \"auto\",\n [`&.focus-visible .${dropDownMenuClasses.icon}`]: {\n ...outlineStyles,\n },\n },\n icon: {\n position: \"relative\",\n width: 32,\n boxSizing: \"border-box\",\n padding: 0,\n borderRadius: theme.dropDownMenu.borderRadius,\n border: theme.dropDownMenu.borderClosed,\n },\n iconSelected: {\n backgroundColor: theme.colors.atmo1,\n boxShadow: theme.colors.shadow,\n\n \"&:hover\": {\n backgroundColor: theme.colors.atmo1,\n },\n\n \"& svg .color0\": {\n fill: theme.colors.secondary,\n },\n\n borderRadius: `${theme.radii.base} ${theme.radii.base} 0px 0px`,\n border: theme.dropDownMenu.borderOpened,\n },\n menuListRoot: {\n border: theme.dropDownMenu.borderOpened,\n borderRadius: theme.dropDownMenu.borderRadius,\n },\n};\n"],"names":["styles","container","width","root","display","dropDownMenuClasses","icon","outlineStyles","position","boxSizing","padding","borderRadius","theme","dropDownMenu","border","borderClosed","iconSelected","backgroundColor","colors","atmo1","boxShadow","shadow","fill","secondary","radii","base","borderOpened","menuListRoot"],"mappings":";;;AAOO,MAAMA,SAET;AAAA,EACFC,WAAW;AAAA,IACTC,OAAO;AAAA,EACT;AAAA,EACAC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTF,OAAO;AAAA,IACP,CAAE,oBAAmBG,oBAAoBC,MAAM,GAAG;AAAA,MAChD,GAAGC;AAAAA,IACL;AAAA,EACF;AAAA,EACAD,MAAM;AAAA,IACJE,UAAU;AAAA,IACVN,OAAO;AAAA,IACPO,WAAW;AAAA,IACXC,SAAS;AAAA,IACTC,cAAcC,MAAMC,aAAaF;AAAAA,IACjCG,QAAQF,MAAMC,aAAaE;AAAAA,EAC7B;AAAA,EACAC,cAAc;AAAA,IACZC,iBAAiBL,MAAMM,OAAOC;AAAAA,IAC9BC,WAAWR,MAAMM,OAAOG;AAAAA,IAExB,WAAW;AAAA,MACTJ,iBAAiBL,MAAMM,OAAOC;AAAAA,IAChC;AAAA,IAEA,iBAAiB;AAAA,MACfG,MAAMV,MAAMM,OAAOK;AAAAA,IACrB;AAAA,IAEAZ,cAAe,GAAEC,MAAMY,MAAMC,QAAQb,MAAMY,MAAMC;AAAAA,IACjDX,QAAQF,MAAMC,aAAaa;AAAAA,EAC7B;AAAA,EACAC,cAAc;AAAA,IACZb,QAAQF,MAAMC,aAAaa;AAAAA,IAC3Bf,cAAcC,MAAMC,aAAaF;AAAAA,EACnC;AACF;"}
@@ -1,5 +1,5 @@
1
1
  import { getClasses } from "../../utils/classes.js";
2
- const classKeys = ["root", "container", "baseContainer", "icon", "iconSelected", "menuList"];
2
+ const classKeys = ["root", "container", "baseContainer", "icon", "iconSelected", "menuList", "menuListRoot"];
3
3
  const dropDownMenuClasses = getClasses(classKeys, "HvDropDownMenu");
4
4
  const dropDownMenuClasses$1 = dropDownMenuClasses;
5
5
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"dropDownMenuClasses.js","sources":["../../../../src/components/DropDownMenu/dropDownMenuClasses.ts"],"sourcesContent":["import { getClasses } from \"@core/utils\";\n\nexport interface HvDropDownMenuClasses {\n /** Styles applied to the root. */\n root?: string;\n /** Styles applied to the container. */\n container?: string;\n /** Styles applied to the BaseDropdown container. */\n baseContainer?: string;\n /** Styles applied to the icon. */\n icon?: string;\n /** Styles applied to the icon when selected. */\n iconSelected?: string;\n /** Styles applied to the list. */\n menuList?: string;\n}\n\nconst classKeys: (keyof HvDropDownMenuClasses)[] = [\n \"root\",\n \"container\",\n \"baseContainer\",\n \"icon\",\n \"iconSelected\",\n \"menuList\",\n];\n\nconst dropDownMenuClasses = getClasses(classKeys, \"HvDropDownMenu\");\n\nexport default dropDownMenuClasses;\n"],"names":["classKeys","dropDownMenuClasses","getClasses"],"mappings":";AAiBA,MAAMA,YAA6C,CACjD,QACA,aACA,iBACA,QACA,gBACA,UAAU;AAGZ,MAAMC,sBAAsBC,WAAWF,WAAW,gBAAgB;AAElE,MAAA,wBAAeC;"}
1
+ {"version":3,"file":"dropDownMenuClasses.js","sources":["../../../../src/components/DropDownMenu/dropDownMenuClasses.ts"],"sourcesContent":["import { getClasses } from \"@core/utils\";\n\nexport interface HvDropDownMenuClasses {\n /** Styles applied to the root. */\n root?: string;\n /** Styles applied to the container. */\n container?: string;\n /** Styles applied to the BaseDropdown container. */\n baseContainer?: string;\n /** Styles applied to the icon. */\n icon?: string;\n /** Styles applied to the icon when selected. */\n iconSelected?: string;\n /** Styles applied to the list root. */\n menuListRoot?: string;\n /** Styles applied to the list. */\n menuList?: string;\n}\n\nconst classKeys: (keyof HvDropDownMenuClasses)[] = [\n \"root\",\n \"container\",\n \"baseContainer\",\n \"icon\",\n \"iconSelected\",\n \"menuList\",\n \"menuListRoot\",\n];\n\nconst dropDownMenuClasses = getClasses(classKeys, \"HvDropDownMenu\");\n\nexport default dropDownMenuClasses;\n"],"names":["classKeys","dropDownMenuClasses","getClasses"],"mappings":";AAmBA,MAAMA,YAA6C,CACjD,QACA,aACA,iBACA,QACA,gBACA,YACA,cAAc;AAGhB,MAAMC,sBAAsBC,WAAWF,WAAW,gBAAgB;AAElE,MAAA,wBAAeC;"}