@hitachivantara/uikit-react-core 5.10.0 → 5.12.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.
- package/dist/cjs/components/ActionsGeneric/ActionsGeneric.cjs.map +1 -1
- package/dist/cjs/components/BaseInput/BaseInput.cjs +18 -1
- package/dist/cjs/components/BaseInput/BaseInput.cjs.map +1 -1
- package/dist/cjs/components/BreadCrumb/BreadCrumb.cjs +3 -3
- package/dist/cjs/components/BreadCrumb/BreadCrumb.cjs.map +1 -1
- package/dist/cjs/components/BreadCrumb/Page/Page.cjs +22 -12
- package/dist/cjs/components/BreadCrumb/Page/Page.cjs.map +1 -1
- package/dist/cjs/components/BreadCrumb/Page/Page.styles.cjs +19 -44
- package/dist/cjs/components/BreadCrumb/Page/Page.styles.cjs.map +1 -1
- package/dist/cjs/components/Calendar/Calendar.cjs +4 -0
- package/dist/cjs/components/Calendar/Calendar.cjs.map +1 -1
- package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.cjs +3 -3
- package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.cjs.map +1 -1
- package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs +23 -16
- package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs.map +1 -1
- package/dist/cjs/components/Calendar/SingleCalendar/CalendarCell.cjs +5 -17
- package/dist/cjs/components/Calendar/SingleCalendar/CalendarCell.cjs.map +1 -1
- package/dist/cjs/components/Calendar/SingleCalendar/SingleCalendar.cjs +3 -1
- package/dist/cjs/components/Calendar/SingleCalendar/SingleCalendar.cjs.map +1 -1
- package/dist/cjs/components/Calendar/utils.cjs +0 -8
- package/dist/cjs/components/Calendar/utils.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/DatePicker.cjs +5 -3
- package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs +4 -3
- package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs.map +1 -1
- package/dist/cjs/components/FileUploader/DropZone/DropZone.cjs +5 -4
- package/dist/cjs/components/FileUploader/DropZone/DropZone.cjs.map +1 -1
- package/dist/cjs/components/FilterGroup/Counter/Counter.cjs +1 -2
- package/dist/cjs/components/FilterGroup/Counter/Counter.cjs.map +1 -1
- package/dist/cjs/components/Pagination/Pagination.styles.cjs +10 -14
- package/dist/cjs/components/Pagination/Pagination.styles.cjs.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.styles.cjs +23 -37
- package/dist/cjs/components/Tooltip/Tooltip.styles.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs +7 -0
- package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/VerticalNavigation.cjs +2 -1
- package/dist/cjs/components/VerticalNavigation/VerticalNavigation.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/VerticalNavigationContext.cjs.map +1 -1
- package/dist/cjs/hooks/useUniqueId.cjs +1 -1
- package/dist/cjs/hooks/useUniqueId.cjs.map +1 -1
- package/dist/cjs/index.cjs +0 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/components/ActionsGeneric/ActionsGeneric.js.map +1 -1
- package/dist/esm/components/BaseInput/BaseInput.js +18 -1
- package/dist/esm/components/BaseInput/BaseInput.js.map +1 -1
- package/dist/esm/components/BreadCrumb/BreadCrumb.js +3 -3
- package/dist/esm/components/BreadCrumb/BreadCrumb.js.map +1 -1
- package/dist/esm/components/BreadCrumb/Page/Page.js +23 -13
- package/dist/esm/components/BreadCrumb/Page/Page.js.map +1 -1
- package/dist/esm/components/BreadCrumb/Page/Page.styles.js +19 -42
- package/dist/esm/components/BreadCrumb/Page/Page.styles.js.map +1 -1
- package/dist/esm/components/Calendar/Calendar.js +4 -0
- package/dist/esm/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.js +4 -4
- package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.js.map +1 -1
- package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js +24 -17
- package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js.map +1 -1
- package/dist/esm/components/Calendar/SingleCalendar/CalendarCell.js +6 -18
- package/dist/esm/components/Calendar/SingleCalendar/CalendarCell.js.map +1 -1
- package/dist/esm/components/Calendar/SingleCalendar/SingleCalendar.js +3 -1
- package/dist/esm/components/Calendar/SingleCalendar/SingleCalendar.js.map +1 -1
- package/dist/esm/components/Calendar/utils.js +1 -9
- package/dist/esm/components/Calendar/utils.js.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js +5 -3
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/DropDownMenu/DropDownMenu.js +4 -3
- package/dist/esm/components/DropDownMenu/DropDownMenu.js.map +1 -1
- package/dist/esm/components/FileUploader/DropZone/DropZone.js +5 -4
- package/dist/esm/components/FileUploader/DropZone/DropZone.js.map +1 -1
- package/dist/esm/components/FilterGroup/Counter/Counter.js +1 -2
- package/dist/esm/components/FilterGroup/Counter/Counter.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.styles.js +10 -14
- package/dist/esm/components/Pagination/Pagination.styles.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.styles.js +24 -38
- package/dist/esm/components/Tooltip/Tooltip.styles.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js +7 -0
- package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/VerticalNavigation.js +2 -1
- package/dist/esm/components/VerticalNavigation/VerticalNavigation.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/VerticalNavigationContext.js.map +1 -1
- package/dist/esm/hooks/useUniqueId.js +2 -2
- package/dist/esm/hooks/useUniqueId.js.map +1 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +40 -44
- package/package.json +2 -2
- package/dist/cjs/hocs/withId.cjs +0 -31
- package/dist/cjs/hocs/withId.cjs.map +0 -1
- package/dist/esm/hocs/withId.js +0 -28
- package/dist/esm/hocs/withId.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation.js","sources":["../../../../../src/components/VerticalNavigation/Navigation/Navigation.tsx"],"sourcesContent":["import {\n useCallback,\n useMemo,\n useContext,\n useEffect,\n useState,\n ComponentProps,\n} from \"react\";\nimport { clsx } from \"clsx\";\nimport uniqueId from \"lodash/uniqueId\";\nimport { setId, wrapperTooltip } from \"@core/utils\";\nimport { useControlled } from \"@core/hooks\";\nimport { HvBaseProps } from \"@core/types\";\nimport {\n HvVerticalNavigationTreeView,\n HvVerticalNavigationTreeViewItem,\n} from \"../TreeView\";\nimport verticalNavigationTreeClasses, {\n HvVerticalNavigationTreeClasses,\n} from \"./navigationClasses\";\nimport { StyledNav } from \"./Navigation.styles\";\nimport { HvVerticalNavigationSlider } from \"..\";\nimport { VerticalNavigationContext } from \"../VerticalNavigationContext\";\nimport { HvVerticalNavigationPopup } from \"../NavigationPopup/NavigationPopup\";\n\nexport type NavigationData<T extends React.ElementType = \"a\"> =\n ComponentProps<T> &\n Record<string, any> & {\n /** The id to be applied to the root element. */\n id: string;\n /** The label to be rendered on the menu item. */\n label: string;\n /** The icon to be rendered. */\n icon?: React.ReactNode;\n /** The Data children subset. */\n data?: NavigationData<T>[];\n /** Whether the item is disabled and not interactive. */\n disabled?: boolean;\n /** Whether the item has a selected state. */\n selectable?: boolean;\n };\n\nconst createListHierarchy = (\n items,\n id,\n classes?: HvVerticalNavigationTreeClasses,\n mouseEnterHandler?: (event, item) => void,\n disableTooltip = false\n) =>\n items.map((item) => {\n const {\n id: itemId,\n label: itemLabel,\n icon,\n data: children,\n selectable,\n disabled,\n href,\n target,\n } = item;\n\n const ItemText = wrapperTooltip(true, itemLabel, itemLabel);\n\n const itemMouseEnterHandler = (event) => {\n mouseEnterHandler?.(event, item);\n };\n\n return (\n <HvVerticalNavigationTreeViewItem\n id={setId(id, itemId)}\n className={classes?.listItem}\n href={href}\n target={target}\n key={itemId}\n nodeId={itemId}\n label={<ItemText />}\n icon={icon}\n payload={item}\n selectable={selectable}\n disabled={disabled}\n onMouseEnter={itemMouseEnterHandler}\n disableTooltip={disableTooltip}\n >\n {children\n ? createListHierarchy(\n children,\n id,\n classes,\n mouseEnterHandler,\n disableTooltip\n )\n : undefined}\n </HvVerticalNavigationTreeViewItem>\n );\n });\n\nconst getAllParents = (items) => {\n const parents = items.filter(\n (item) => item.data != null && item.data.length > 0\n );\n const childParents = parents.flatMap((item) => getAllParents(item.data));\n\n return [...parents, ...childParents];\n};\n\nfunction pathToElement(data, targetId) {\n const path: string[] = [];\n\n if (data != null && data.length > 0) {\n for (let i = 0; i !== data.length; ++i) {\n const item = data[i];\n if (item.id === targetId) {\n path.push(item.id);\n break;\n }\n\n const subPaths = pathToElement(item.data, targetId);\n if (subPaths.length > 0) {\n path.push(item.id);\n path.push(...subPaths);\n break;\n }\n }\n }\n\n return path;\n}\n\nexport const HvVerticalNavigationTree = ({\n id,\n\n className,\n classes,\n\n data,\n\n mode = \"navigation\",\n\n collapsible = false,\n expanded: expandedProp,\n defaultExpanded,\n onToggle,\n\n selected: selectedProp,\n defaultSelected,\n onChange,\n\n ...others\n}: HvVerticalNavigationTreeProps) => {\n const [selected, setSelected] = useControlled(selectedProp, defaultSelected);\n const [expanded, setExpanded] = useControlled(expandedProp, () => {\n if (defaultExpanded === true) {\n // all parent nodes will be expanded by default\n return getAllParents(data).map((item) => item.id);\n }\n\n if (defaultExpanded === false) {\n // all parent nodes will be collapsed by default\n return [];\n }\n\n if (defaultExpanded == null) {\n if (selected != null) {\n // the path to the selected node will be expanded (default behaviour)\n const path = pathToElement(data, selected);\n return path.slice(0, -1);\n }\n\n // nothing is expanded\n return [];\n }\n\n return defaultExpanded;\n });\n\n const {\n isOpen,\n useIcons,\n slider,\n\n parentItem,\n withParentData,\n navigateToChildHandler,\n\n setParentData,\n setParentSelected,\n } = useContext(VerticalNavigationContext);\n\n const [navigationPopup, setNavigationPopup] = useState<{\n // This value is needed to guarantee that the NavigationPopup is fully re-rendered with keeping any previous values\n uniqueKey: string;\n anchorEl: HTMLButtonElement | null;\n fixedMode: boolean;\n data: NavigationData[];\n } | null>(null);\n\n const handleChange = useCallback(\n (event, selectedId, selectedItem) => {\n if (useIcons && !isOpen && selectedItem.data) {\n const currentEventTarget = event.currentTarget;\n setNavigationPopup((prevState) => {\n // We want to close the popup in case the clicked element is the same as the previous one\n return prevState?.anchorEl === currentEventTarget\n ? null\n : {\n uniqueKey: uniqueId(),\n anchorEl: currentEventTarget,\n fixedMode: true,\n data: selectedItem.data,\n };\n });\n\n // We need this stopPropagation or else the Popup will close due to the clickaway being triggered\n event.stopPropagation();\n } else {\n setSelected(selectedId);\n setExpanded((prevState) => {\n if (!isOpen) {\n return [...prevState, ...pathToElement(data, selectedId)];\n }\n return [...prevState];\n });\n setNavigationPopup(null);\n if (onChange) {\n onChange(event, selectedItem);\n }\n }\n },\n [onChange, setSelected]\n );\n\n const treeViewItemMouseEnterHandler = (event, item) => {\n const isCollapsed = useIcons && !isOpen;\n\n if (isCollapsed && item.data && !navigationPopup?.fixedMode) {\n const currentEventTarget = event.currentTarget;\n\n setNavigationPopup?.({\n uniqueKey: uniqueId(),\n anchorEl: currentEventTarget,\n fixedMode: false,\n data: item.data,\n });\n } else if (isCollapsed && !item.data && !navigationPopup?.fixedMode) {\n setNavigationPopup(null);\n }\n };\n\n const handleToggle = useCallback(\n (event, newExpanded) => {\n setExpanded(newExpanded);\n\n if (onToggle) {\n onToggle(event, newExpanded);\n }\n },\n [onToggle, setExpanded]\n );\n\n const children = useMemo(\n () =>\n data &&\n createListHierarchy(\n data,\n id,\n classes,\n treeViewItemMouseEnterHandler,\n navigationPopup?.fixedMode\n ),\n [classes, data, id, navigationPopup, isOpen]\n );\n\n useEffect(() => {\n if (!isOpen) {\n setNavigationPopup?.(null);\n }\n }, [isOpen]);\n\n useEffect(() => {\n if (setParentSelected) setParentSelected(selected);\n }, [selected, setSelected]);\n\n useEffect(() => {\n if (setParentData) setParentData(data);\n }, [data]);\n\n // navigation slider\n const navigateToTargetHandler = (event, selectedItem) => {\n handleChange(event, selectedItem.id, selectedItem);\n };\n\n const handleNavigationPopupClose = () => {\n setNavigationPopup(null);\n };\n\n const handleStyledNavMouseLeave = () => {\n if (useIcons && !isOpen && !navigationPopup?.fixedMode) {\n setNavigationPopup(null);\n }\n };\n\n return (\n <StyledNav\n id={id}\n className={clsx(\n className,\n verticalNavigationTreeClasses.root,\n classes?.root,\n !isOpen &&\n !useIcons &&\n clsx(verticalNavigationTreeClasses.collapsed, classes?.collapsed)\n )}\n onMouseLeave={handleStyledNavMouseLeave}\n {...others}\n >\n {slider ? (\n <HvVerticalNavigationSlider\n data={parentItem.data || withParentData}\n selected={selected}\n onNavigateToTarget={navigateToTargetHandler}\n onNavigateToChild={navigateToChildHandler}\n />\n ) : (\n <HvVerticalNavigationTreeView\n id={setId(id, \"tree\")}\n className={clsx(verticalNavigationTreeClasses.list, classes?.list)}\n selectable\n mode={mode}\n collapsible={collapsible}\n selected={selected}\n onChange={handleChange}\n expanded={expanded}\n onToggle={handleToggle}\n >\n {useIcons && !isOpen && navigationPopup && (\n <HvVerticalNavigationPopup\n id={setId(id, \"navigation-popup\")}\n key={navigationPopup.uniqueKey}\n anchorEl={navigationPopup.anchorEl}\n selected={selected}\n fixedMode={navigationPopup.fixedMode}\n data={navigationPopup.data}\n onClose={handleNavigationPopupClose}\n onChange={handleChange}\n className={clsx(\n verticalNavigationTreeClasses.navigationPopup,\n classes?.navigationPopup\n )}\n />\n )}\n {children}\n </HvVerticalNavigationTreeView>\n )}\n </StyledNav>\n );\n};\n\nexport interface HvVerticalNavigationTreeProps\n extends HvBaseProps<HTMLDivElement, \"onChange\"> {\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.\n */\n classes?: HvVerticalNavigationTreeClasses;\n /**\n * Modus operandi (role) of the widget instance.\n */\n mode?: NavigationMode;\n /**\n * Can non-leaf nodes be collapsed / expanded.\n */\n collapsible?: boolean;\n /**\n * The ID of the selected page.\n */\n selected?: string;\n /**\n * When uncontrolled, defines the initial selected page ID.\n */\n defaultSelected?: string;\n /**\n * Callback fired when a navigation item is selected.\n *\n * @param {object} event The event source of the callback.\n * @param {object} page The data of the selected page.\n */\n onChange?: (event, page) => void;\n /**\n * Expanded nodes' ids.\n */\n expanded?: string[];\n /**\n * When uncontrolled, defines the initial expanded nodes' ids.\n *\n * It also supports `true` for starting with all nodes expanded.\n * With `false` all nodes will be collapsed.\n *\n * By default it expands the needed nodes to display the current selection, if any.\n */\n defaultExpanded?: string[] | boolean;\n /**\n * Callback fired when tree items are expanded/collapsed.\n *\n * @param {object} event The event source of the callback.\n * @param {array} nodeIds The ids of the expanded nodes (old and new).\n */\n onToggle?: (event, nodeIds) => void;\n /**\n * An array containing the data for each menu item.\n *\n * id - the id to be applied to the root element.\n * label - the label to be rendered on the menu item.\n * data - sub-menu items\n * href - the url used for navigation.\n * target - the behavior when opening an url.\n */\n data?: NavigationData[];\n}\n\nexport type NavigationMode = \"treeview\" | \"navigation\" | \"slider\";\n"],"names":["createListHierarchy","items","id","classes","mouseEnterHandler","disableTooltip","map","item","itemId","label","itemLabel","icon","data","children","selectable","disabled","href","target","ItemText","wrapperTooltip","itemMouseEnterHandler","event","HvVerticalNavigationTreeViewItem","setId","className","listItem","nodeId","_jsx","payload","onMouseEnter","undefined","getAllParents","parents","filter","length","childParents","flatMap","pathToElement","targetId","path","i","push","subPaths","HvVerticalNavigationTree","mode","collapsible","expanded","expandedProp","defaultExpanded","onToggle","selected","selectedProp","defaultSelected","onChange","others","setSelected","useControlled","setExpanded","slice","isOpen","useIcons","slider","parentItem","withParentData","navigateToChildHandler","setParentData","setParentSelected","useContext","VerticalNavigationContext","navigationPopup","setNavigationPopup","useState","handleChange","useCallback","selectedId","selectedItem","currentEventTarget","currentTarget","prevState","anchorEl","uniqueKey","uniqueId","fixedMode","stopPropagation","treeViewItemMouseEnterHandler","isCollapsed","handleToggle","newExpanded","useMemo","useEffect","navigateToTargetHandler","handleNavigationPopupClose","handleStyledNavMouseLeave","StyledNav","clsx","verticalNavigationTreeClasses","root","collapsed","onMouseLeave","HvVerticalNavigationSlider","onNavigateToTarget","onNavigateToChild","_jsxs","HvVerticalNavigationTreeView","list","HvVerticalNavigationPopup","onClose"],"mappings":";;;;;;;;;;;;;;AA0CA,MAAMA,sBAAsBA,CAC1BC,OACAC,IACAC,SACAC,mBACAC,iBAAiB,UAEjBJ,MAAMK,IAAKC,CAAS,SAAA;AACZ,QAAA;AAAA,IACJL,IAAIM;AAAAA,IACJC,OAAOC;AAAAA,IACPC;AAAAA,IACAC,MAAMC;AAAAA,IACNC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,EACEV,IAAAA;AAEJ,QAAMW,WAAWC,eAAe,MAAMT,WAAWA,SAAS;AAE1D,QAAMU,wBAAyBC,CAAU,UAAA;AACvCjB,2DAAoBiB,OAAOd;AAAAA,EAAI;AAGjC,6BACGe,kCAAgC;AAAA,IAC/BpB,IAAIqB,MAAMrB,IAAIM,MAAM;AAAA,IACpBgB,WAAWrB,mCAASsB;AAAAA,IACpBT;AAAAA,IACAC;AAAAA,IAEAS,QAAQlB;AAAAA,IACRC,OAAOkB,oBAACT,UAAY,EAAA;AAAA,IACpBP;AAAAA,IACAiB,SAASrB;AAAAA,IACTO;AAAAA,IACAC;AAAAA,IACAc,cAAcT;AAAAA,IACdf;AAAAA,IAA+BQ,UAE9BA,WACGb,oBACEa,UACAX,IACAC,SACAC,mBACAC,cAAc,I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AAA,CAGH;AAEhB;"}
|
|
1
|
+
{"version":3,"file":"Navigation.js","sources":["../../../../../src/components/VerticalNavigation/Navigation/Navigation.tsx"],"sourcesContent":["import {\n useCallback,\n useMemo,\n useContext,\n useEffect,\n useState,\n ComponentProps,\n} from \"react\";\nimport { clsx } from \"clsx\";\nimport uniqueId from \"lodash/uniqueId\";\nimport { setId, wrapperTooltip } from \"@core/utils\";\nimport { useControlled } from \"@core/hooks\";\nimport { HvBaseProps } from \"@core/types\";\nimport {\n HvVerticalNavigationTreeView,\n HvVerticalNavigationTreeViewItem,\n} from \"../TreeView\";\nimport verticalNavigationTreeClasses, {\n HvVerticalNavigationTreeClasses,\n} from \"./navigationClasses\";\nimport { StyledNav } from \"./Navigation.styles\";\nimport { HvVerticalNavigationSlider } from \"..\";\nimport { VerticalNavigationContext } from \"../VerticalNavigationContext\";\nimport { HvVerticalNavigationPopup } from \"../NavigationPopup/NavigationPopup\";\nimport { getParentItemById } from \"../NavigationSlider/utils/NavigationSlider.utils\";\n\nexport type NavigationData<T extends React.ElementType = \"a\"> =\n ComponentProps<T> &\n Record<string, any> & {\n /** The id to be applied to the root element. */\n id: string;\n /** The label to be rendered on the menu item. */\n label: string;\n /** The icon to be rendered. */\n icon?: React.ReactNode;\n /** The Data children subset. */\n data?: NavigationData<T>[];\n /** Whether the item is disabled and not interactive. */\n disabled?: boolean;\n /** Whether the item has a selected state. */\n selectable?: boolean;\n };\n\nconst createListHierarchy = (\n items,\n id,\n classes?: HvVerticalNavigationTreeClasses,\n mouseEnterHandler?: (event, item) => void,\n disableTooltip = false\n) =>\n items.map((item) => {\n const {\n id: itemId,\n label: itemLabel,\n icon,\n data: children,\n selectable,\n disabled,\n href,\n target,\n } = item;\n\n const ItemText = wrapperTooltip(true, itemLabel, itemLabel);\n\n const itemMouseEnterHandler = (event) => {\n mouseEnterHandler?.(event, item);\n };\n\n return (\n <HvVerticalNavigationTreeViewItem\n id={setId(id, itemId)}\n className={classes?.listItem}\n href={href}\n target={target}\n key={itemId}\n nodeId={itemId}\n label={<ItemText />}\n icon={icon}\n payload={item}\n selectable={selectable}\n disabled={disabled}\n onMouseEnter={itemMouseEnterHandler}\n disableTooltip={disableTooltip}\n >\n {children\n ? createListHierarchy(\n children,\n id,\n classes,\n mouseEnterHandler,\n disableTooltip\n )\n : undefined}\n </HvVerticalNavigationTreeViewItem>\n );\n });\n\nconst getAllParents = (items) => {\n const parents = items.filter(\n (item) => item.data != null && item.data.length > 0\n );\n const childParents = parents.flatMap((item) => getAllParents(item.data));\n\n return [...parents, ...childParents];\n};\n\nfunction pathToElement(data, targetId) {\n const path: string[] = [];\n\n if (data != null && data.length > 0) {\n for (let i = 0; i !== data.length; ++i) {\n const item = data[i];\n if (item.id === targetId) {\n path.push(item.id);\n break;\n }\n\n const subPaths = pathToElement(item.data, targetId);\n if (subPaths.length > 0) {\n path.push(item.id);\n path.push(...subPaths);\n break;\n }\n }\n }\n\n return path;\n}\n\nexport const HvVerticalNavigationTree = ({\n id,\n\n className,\n classes,\n\n data,\n\n mode = \"navigation\",\n\n collapsible = false,\n expanded: expandedProp,\n defaultExpanded,\n onToggle,\n\n selected: selectedProp,\n defaultSelected,\n onChange,\n\n ...others\n}: HvVerticalNavigationTreeProps) => {\n const [selected, setSelected] = useControlled(selectedProp, defaultSelected);\n const [expanded, setExpanded] = useControlled(expandedProp, () => {\n if (defaultExpanded === true) {\n // all parent nodes will be expanded by default\n return getAllParents(data).map((item) => item.id);\n }\n\n if (defaultExpanded === false) {\n // all parent nodes will be collapsed by default\n return [];\n }\n\n if (defaultExpanded == null) {\n if (selected != null) {\n // the path to the selected node will be expanded (default behaviour)\n const path = pathToElement(data, selected);\n return path.slice(0, -1);\n }\n\n // nothing is expanded\n return [];\n }\n\n return defaultExpanded;\n });\n\n const {\n isOpen,\n useIcons,\n slider,\n\n parentItem,\n setParentItem,\n withParentData,\n navigateToChildHandler,\n\n setParentData,\n setParentSelected,\n } = useContext(VerticalNavigationContext);\n\n const [navigationPopup, setNavigationPopup] = useState<{\n // This value is needed to guarantee that the NavigationPopup is fully re-rendered with keeping any previous values\n uniqueKey: string;\n anchorEl: HTMLButtonElement | null;\n fixedMode: boolean;\n data: NavigationData[];\n } | null>(null);\n\n const handleChange = useCallback(\n (event, selectedId, selectedItem) => {\n if (useIcons && !isOpen && selectedItem.data) {\n const currentEventTarget = event.currentTarget;\n setNavigationPopup((prevState) => {\n // We want to close the popup in case the clicked element is the same as the previous one\n return prevState?.anchorEl === currentEventTarget\n ? null\n : {\n uniqueKey: uniqueId(),\n anchorEl: currentEventTarget,\n fixedMode: true,\n data: selectedItem.data,\n };\n });\n\n // We need this stopPropagation or else the Popup will close due to the clickaway being triggered\n event.stopPropagation();\n } else {\n setSelected(selectedId);\n setExpanded((prevState) => {\n if (!isOpen) {\n return [...prevState, ...pathToElement(data, selectedId)];\n }\n return [...prevState];\n });\n setNavigationPopup(null);\n if (onChange) {\n onChange(event, selectedItem);\n }\n }\n },\n [onChange, setSelected]\n );\n\n const treeViewItemMouseEnterHandler = (event, item) => {\n const isCollapsed = useIcons && !isOpen;\n\n if (isCollapsed && item.data && !navigationPopup?.fixedMode) {\n const currentEventTarget = event.currentTarget;\n\n setNavigationPopup?.({\n uniqueKey: uniqueId(),\n anchorEl: currentEventTarget,\n fixedMode: false,\n data: item.data,\n });\n } else if (isCollapsed && !item.data && !navigationPopup?.fixedMode) {\n setNavigationPopup(null);\n }\n };\n\n const handleToggle = useCallback(\n (event, newExpanded) => {\n setExpanded(newExpanded);\n\n if (onToggle) {\n onToggle(event, newExpanded);\n }\n },\n [onToggle, setExpanded]\n );\n\n const children = useMemo(\n () =>\n data &&\n createListHierarchy(\n data,\n id,\n classes,\n treeViewItemMouseEnterHandler,\n navigationPopup?.fixedMode\n ),\n [classes, data, id, navigationPopup, isOpen]\n );\n\n useEffect(() => {\n if (!isOpen) {\n setNavigationPopup?.(null);\n }\n }, [isOpen]);\n\n useEffect(() => {\n if (setParentSelected) setParentSelected(selected);\n }, [selected, setSelected]);\n\n useEffect(() => {\n if (setParentData) setParentData(data);\n }, [data]);\n\n useEffect(() => {\n if (\n withParentData &&\n selected &&\n setParentItem &&\n getParentItemById(withParentData, selected)\n ) {\n setParentItem(getParentItemById(withParentData, selected));\n }\n }, [withParentData]);\n\n // navigation slider\n const navigateToTargetHandler = (event, selectedItem) => {\n handleChange(event, selectedItem.id, selectedItem);\n };\n\n const handleNavigationPopupClose = () => {\n setNavigationPopup(null);\n };\n\n const handleStyledNavMouseLeave = () => {\n if (useIcons && !isOpen && !navigationPopup?.fixedMode) {\n setNavigationPopup(null);\n }\n };\n\n return (\n <StyledNav\n id={id}\n className={clsx(\n className,\n verticalNavigationTreeClasses.root,\n classes?.root,\n !isOpen &&\n !useIcons &&\n clsx(verticalNavigationTreeClasses.collapsed, classes?.collapsed)\n )}\n onMouseLeave={handleStyledNavMouseLeave}\n {...others}\n >\n {slider ? (\n <HvVerticalNavigationSlider\n data={parentItem.data || withParentData}\n selected={selected}\n onNavigateToTarget={navigateToTargetHandler}\n onNavigateToChild={navigateToChildHandler}\n />\n ) : (\n <HvVerticalNavigationTreeView\n id={setId(id, \"tree\")}\n className={clsx(verticalNavigationTreeClasses.list, classes?.list)}\n selectable\n mode={mode}\n collapsible={collapsible}\n selected={selected}\n onChange={handleChange}\n expanded={expanded}\n onToggle={handleToggle}\n >\n {useIcons && !isOpen && navigationPopup && (\n <HvVerticalNavigationPopup\n id={setId(id, \"navigation-popup\")}\n key={navigationPopup.uniqueKey}\n anchorEl={navigationPopup.anchorEl}\n selected={selected}\n fixedMode={navigationPopup.fixedMode}\n data={navigationPopup.data}\n onClose={handleNavigationPopupClose}\n onChange={handleChange}\n className={clsx(\n verticalNavigationTreeClasses.navigationPopup,\n classes?.navigationPopup\n )}\n />\n )}\n {children}\n </HvVerticalNavigationTreeView>\n )}\n </StyledNav>\n );\n};\n\nexport interface HvVerticalNavigationTreeProps\n extends HvBaseProps<HTMLDivElement, \"onChange\"> {\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.\n */\n classes?: HvVerticalNavigationTreeClasses;\n /**\n * Modus operandi (role) of the widget instance.\n */\n mode?: NavigationMode;\n /**\n * Can non-leaf nodes be collapsed / expanded.\n */\n collapsible?: boolean;\n /**\n * The ID of the selected page.\n */\n selected?: string;\n /**\n * When uncontrolled, defines the initial selected page ID.\n */\n defaultSelected?: string;\n /**\n * Callback fired when a navigation item is selected.\n *\n * @param {object} event The event source of the callback.\n * @param {object} page The data of the selected page.\n */\n onChange?: (event, page) => void;\n /**\n * Expanded nodes' ids.\n */\n expanded?: string[];\n /**\n * When uncontrolled, defines the initial expanded nodes' ids.\n *\n * It also supports `true` for starting with all nodes expanded.\n * With `false` all nodes will be collapsed.\n *\n * By default it expands the needed nodes to display the current selection, if any.\n */\n defaultExpanded?: string[] | boolean;\n /**\n * Callback fired when tree items are expanded/collapsed.\n *\n * @param {object} event The event source of the callback.\n * @param {array} nodeIds The ids of the expanded nodes (old and new).\n */\n onToggle?: (event, nodeIds) => void;\n /**\n * An array containing the data for each menu item.\n *\n * id - the id to be applied to the root element.\n * label - the label to be rendered on the menu item.\n * data - sub-menu items\n * href - the url used for navigation.\n * target - the behavior when opening an url.\n */\n data?: NavigationData[];\n}\n\nexport type NavigationMode = \"treeview\" | \"navigation\" | \"slider\";\n"],"names":["createListHierarchy","items","id","classes","mouseEnterHandler","disableTooltip","map","item","itemId","label","itemLabel","icon","data","children","selectable","disabled","href","target","ItemText","wrapperTooltip","itemMouseEnterHandler","event","HvVerticalNavigationTreeViewItem","setId","className","listItem","nodeId","_jsx","payload","onMouseEnter","undefined","getAllParents","parents","filter","length","childParents","flatMap","pathToElement","targetId","path","i","push","subPaths","HvVerticalNavigationTree","mode","collapsible","expanded","expandedProp","defaultExpanded","onToggle","selected","selectedProp","defaultSelected","onChange","others","setSelected","useControlled","setExpanded","slice","isOpen","useIcons","slider","parentItem","setParentItem","withParentData","navigateToChildHandler","setParentData","setParentSelected","useContext","VerticalNavigationContext","navigationPopup","setNavigationPopup","useState","handleChange","useCallback","selectedId","selectedItem","currentEventTarget","currentTarget","prevState","anchorEl","uniqueKey","uniqueId","fixedMode","stopPropagation","treeViewItemMouseEnterHandler","isCollapsed","handleToggle","newExpanded","useMemo","useEffect","getParentItemById","navigateToTargetHandler","handleNavigationPopupClose","handleStyledNavMouseLeave","StyledNav","clsx","verticalNavigationTreeClasses","root","collapsed","onMouseLeave","HvVerticalNavigationSlider","onNavigateToTarget","onNavigateToChild","_jsxs","HvVerticalNavigationTreeView","list","HvVerticalNavigationPopup","onClose"],"mappings":";;;;;;;;;;;;;;;AA2CA,MAAMA,sBAAsBA,CAC1BC,OACAC,IACAC,SACAC,mBACAC,iBAAiB,UAEjBJ,MAAMK,IAAKC,CAAS,SAAA;AACZ,QAAA;AAAA,IACJL,IAAIM;AAAAA,IACJC,OAAOC;AAAAA,IACPC;AAAAA,IACAC,MAAMC;AAAAA,IACNC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,EACEV,IAAAA;AAEJ,QAAMW,WAAWC,eAAe,MAAMT,WAAWA,SAAS;AAE1D,QAAMU,wBAAyBC,CAAU,UAAA;AACvCjB,2DAAoBiB,OAAOd;AAAAA,EAAI;AAGjC,6BACGe,kCAAgC;AAAA,IAC/BpB,IAAIqB,MAAMrB,IAAIM,MAAM;AAAA,IACpBgB,WAAWrB,mCAASsB;AAAAA,IACpBT;AAAAA,IACAC;AAAAA,IAEAS,QAAQlB;AAAAA,IACRC,OAAOkB,oBAACT,UAAY,EAAA;AAAA,IACpBP;AAAAA,IACAiB,SAASrB;AAAAA,IACTO;AAAAA,IACAC;AAAAA,IACAc,cAAcT;AAAAA,IACdf;AAAAA,IAA+BQ,UAE9BA,WACGb,oBACEa,UACAX,IACAC,SACAC,mBACAC,cAAc,IAEhByB;AAAAA,KAlBCtB,MAAM;AAqBjB,CAAC;AAEH,MAAMuB,gBAA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AAA,QACVjD,WAAWwE,KACTC,8BAA8B3B,iBAC9BnE,mCAASmE,eAAe;AAAA,MAAA,GATrBA,gBAAgBW,SAAS,GAajCpE,QAAQ;AAAA,IAAA,CAAA;AAAA,EAAA,CAGH;AAEhB;"}
|
|
@@ -41,6 +41,7 @@ const HvVerticalNavigation = ({
|
|
|
41
41
|
headerTitle,
|
|
42
42
|
setHeaderTitle,
|
|
43
43
|
parentItem,
|
|
44
|
+
setParentItem,
|
|
44
45
|
withParentData,
|
|
45
46
|
navigateToChildHandler,
|
|
46
47
|
navigateToParentHandler,
|
|
@@ -49,7 +50,7 @@ const HvVerticalNavigation = ({
|
|
|
49
50
|
parentSelected,
|
|
50
51
|
setParentSelected,
|
|
51
52
|
hasAnyChildWithData
|
|
52
|
-
}), [open, useIcons, slider, headerTitle, setHeaderTitle, parentItem, withParentData, navigateToChildHandler, navigateToParentHandler, hasAnyChildWithData]);
|
|
53
|
+
}), [open, useIcons, slider, headerTitle, setHeaderTitle, parentItem, setParentItem, withParentData, navigateToChildHandler, navigateToParentHandler, hasAnyChildWithData]);
|
|
53
54
|
const content = /* @__PURE__ */ jsx(VerticalNavigationContext.Provider, {
|
|
54
55
|
value,
|
|
55
56
|
children: /* @__PURE__ */ jsx(StyledRoot, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerticalNavigation.js","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","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,SAA2B,CAAE,CAAA;AAEjE,QAAM,CAACC,gBAAgBC,iBAAiB,IAAIF,SAAU;AAEtD,QAAM,CAACG,aAAaC,cAAc,IAAIJ,SAA8B;AAG9DK,QAAAA,iBAAiBC,QACrB,MAAMC,qBAAqBT,UAAU,GACrC,CAACA,UAAU,CAAC;AAGRU,QAAAA,oBAAoBF,QACxB,MAAMG,kBAAkBJ,gBAAgBJ,cAAc,GACtD,CAACI,gBAAgBJ,cAAc,CAAC;AAGlC,QAAM,CAACS,YAAYC,aAAa,IAAIX,SAASQ,iBAAiB;AAExDI,QAAAA,sBAAsBN,QAC1B,MAAMO,wBAAwBf,UAAU,GACxC,CAACA,UAAU,CAAC;AAIZ,YAAA,MAAMM,eAAeM,yCAAYI,KAAK,GACtC,CAACJ,YAAYC,aAAa,CAAC;AAG7B,QAAMI,0BAA0BA,MAAM;AACpCJ,kBAAcF,kBAAkBJ,gBAAgBK,WAAWvB,EAAE,CAAC;AAAA,EAAA;AAG1D6B,QAAAA,yBAAyBA,CAACC,OAAOC,SAAS;AAC9CP,kBAAcQ,sBAAsBd,gBAAgBa,KAAK/B,EAAE,CAAC;AAC5D8B,UAAMG,gBAAiB;AAAA,EAAA;AAGnBC,QAAAA,QAAQf,QACZ,OAAO;AAAA,IACLgB,QAAQ/B;AAAAA,IACRE;AAAAA,IACAD;AAAAA,IACAW;AAAAA,IACAC;AAAAA,IAEAM;AAAAA,
|
|
1
|
+
{"version":3,"file":"VerticalNavigation.js","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 setParentItem,\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 setParentItem,\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","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,SAA2B,CAAE,CAAA;AAEjE,QAAM,CAACC,gBAAgBC,iBAAiB,IAAIF,SAAU;AAEtD,QAAM,CAACG,aAAaC,cAAc,IAAIJ,SAA8B;AAG9DK,QAAAA,iBAAiBC,QACrB,MAAMC,qBAAqBT,UAAU,GACrC,CAACA,UAAU,CAAC;AAGRU,QAAAA,oBAAoBF,QACxB,MAAMG,kBAAkBJ,gBAAgBJ,cAAc,GACtD,CAACI,gBAAgB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ationContext.js","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":";
|
|
1
|
+
{"version":3,"file":"VerticalNavigationContext.js","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 setParentItem?: React.Dispatch<React.SetStateAction<any>>;\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":";AAwBA,MAAMA,4BAA4BC,cAChC;AAAA,EACEC,QAAQ;AAAA,EACRC,UAAU;AAAA,EACVC,QAAQ;AACV,CAAC;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMemo } from "react";
|
|
2
2
|
import uniqueId from "lodash/uniqueId";
|
|
3
|
-
const useUniqueId = (id, idPrefix) =>
|
|
3
|
+
const useUniqueId = (id, idPrefix) => useMemo(() => id || uniqueId(idPrefix), [id, idPrefix]);
|
|
4
4
|
export {
|
|
5
5
|
useUniqueId as default
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniqueId.js","sources":["../../../src/hooks/useUniqueId.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useUniqueId.js","sources":["../../../src/hooks/useUniqueId.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport uniqueId from \"lodash/uniqueId\";\n\nexport default (id?: string, idPrefix?: string) =>\n useMemo(() => id || uniqueId(idPrefix), [id, idPrefix]);\n"],"names":["id","idPrefix","useMemo","uniqueId"],"mappings":";;AAGA,MAAe,cAAA,CAACA,IAAaC,aAC3BC,QAAQ,MAAMF,MAAMG,SAASF,QAAQ,GAAG,CAACD,IAAIC,QAAQ,CAAC;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -281,7 +281,6 @@ import { getFirstAndLastFocus, getFocusableList, getPrevNextFocus } from "./util
|
|
|
281
281
|
import { wrapperTooltip } from "./utils/wrapperTooltip.js";
|
|
282
282
|
import { useSavedState } from "./utils/useSavedState.js";
|
|
283
283
|
import { default as default137 } from "./hocs/withTooltip.js";
|
|
284
|
-
import { default as default138 } from "./hocs/withId.js";
|
|
285
284
|
export {
|
|
286
285
|
CellWithCheckBox,
|
|
287
286
|
CellWithExpandButton,
|
|
@@ -613,7 +612,6 @@ export {
|
|
|
613
612
|
default115 as verticalNavigationTreeClasses,
|
|
614
613
|
default122 as verticalScrollListItemClasses,
|
|
615
614
|
default16 as warningTextClasses,
|
|
616
|
-
default138 as withId,
|
|
617
615
|
default137 as withTooltip,
|
|
618
616
|
wrapperTooltip
|
|
619
617
|
};
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -85,7 +85,6 @@ import { theme } from '@hitachivantara/uikit-styles';
|
|
|
85
85
|
import { themes } from '@hitachivantara/uikit-styles';
|
|
86
86
|
import type { ThHTMLAttributes } from 'react';
|
|
87
87
|
import { TooltipProps } from '@mui/material';
|
|
88
|
-
import { TransitionProps } from '@mui/material/transitions';
|
|
89
88
|
import { UseColumnOrderInstanceProps } from 'react-table';
|
|
90
89
|
import { UseColumnOrderState } from 'react-table';
|
|
91
90
|
import { useEffect } from 'react';
|
|
@@ -137,8 +136,8 @@ declare type Accessor<D extends object> = (originalRow: D, index: number, sub: {
|
|
|
137
136
|
}) => CellValue;
|
|
138
137
|
|
|
139
138
|
export declare const accordionClasses: {
|
|
140
|
-
label: "HvAccordion-label";
|
|
141
139
|
hidden: "HvAccordion-hidden";
|
|
140
|
+
label: "HvAccordion-label";
|
|
142
141
|
container: "HvAccordion-container";
|
|
143
142
|
disabled: "HvAccordion-disabled";
|
|
144
143
|
root: "HvAccordion-root";
|
|
@@ -275,10 +274,10 @@ export declare const baseCheckBoxClasses: {
|
|
|
275
274
|
};
|
|
276
275
|
|
|
277
276
|
export declare const baseDropdownClasses: {
|
|
278
|
-
header: "HvBaseDropdown-header";
|
|
279
277
|
placeholder: "HvBaseDropdown-placeholder";
|
|
280
278
|
arrow: "HvBaseDropdown-arrow";
|
|
281
279
|
anchor: "HvBaseDropdown-anchor";
|
|
280
|
+
header: "HvBaseDropdown-header";
|
|
282
281
|
container: "HvBaseDropdown-container";
|
|
283
282
|
root: "HvBaseDropdown-root";
|
|
284
283
|
rootDisabled: "HvBaseDropdown-rootDisabled";
|
|
@@ -336,8 +335,8 @@ export declare const baseSwitchClasses: {
|
|
|
336
335
|
};
|
|
337
336
|
|
|
338
337
|
export declare const breadCrumbClasses: {
|
|
339
|
-
a: "HvBreadCrumb-a";
|
|
340
338
|
link: "HvBreadCrumb-link";
|
|
339
|
+
a: "HvBreadCrumb-a";
|
|
341
340
|
root: "HvBreadCrumb-root";
|
|
342
341
|
orderedList: "HvBreadCrumb-orderedList";
|
|
343
342
|
currentPage: "HvBreadCrumb-currentPage";
|
|
@@ -435,8 +434,8 @@ export declare const cardMediaClasses: {
|
|
|
435
434
|
};
|
|
436
435
|
|
|
437
436
|
export declare const carouselClasses: {
|
|
438
|
-
main: "HvCarousel-main";
|
|
439
437
|
title: "HvCarousel-title";
|
|
438
|
+
main: "HvCarousel-main";
|
|
440
439
|
dot: "HvCarousel-dot";
|
|
441
440
|
controls: "HvCarousel-controls";
|
|
442
441
|
xs: "HvCarousel-xs";
|
|
@@ -638,9 +637,9 @@ export declare const dotPaginationClasses: {
|
|
|
638
637
|
};
|
|
639
638
|
|
|
640
639
|
export declare const dropdownClasses: {
|
|
641
|
-
label: "HvDropdown-label";
|
|
642
640
|
placeholder: "HvDropdown-placeholder";
|
|
643
641
|
arrow: "HvDropdown-arrow";
|
|
642
|
+
label: "HvDropdown-label";
|
|
644
643
|
error: "HvDropdown-error";
|
|
645
644
|
dropdown: "HvDropdown-dropdown";
|
|
646
645
|
root: "HvDropdown-root";
|
|
@@ -1897,7 +1896,7 @@ export declare interface HvBreadCrumbClasses {
|
|
|
1897
1896
|
a?: string;
|
|
1898
1897
|
}
|
|
1899
1898
|
|
|
1900
|
-
export declare interface HvBreadCrumbPathElement {
|
|
1899
|
+
export declare interface HvBreadCrumbPathElement extends Record<string, any> {
|
|
1901
1900
|
label: string;
|
|
1902
1901
|
path: string;
|
|
1903
1902
|
}
|
|
@@ -1912,7 +1911,7 @@ export declare interface HvBreadCrumbProps extends HvBaseProps<HTMLDivElement, "
|
|
|
1912
1911
|
/** The component used for the link node. Either a string to use a DOM element or a component. */
|
|
1913
1912
|
component?: React.ElementType;
|
|
1914
1913
|
/** Function passed to the component. If defined the component prop is used as the link node. */
|
|
1915
|
-
onClick?: (event:
|
|
1914
|
+
onClick?: (event: MouseEvent_2<HTMLElement>, data: any) => void;
|
|
1916
1915
|
/** Props passed down to the DropDownMenu sub-menu component. */
|
|
1917
1916
|
dropDownMenuProps?: HvDropDownMenuProps;
|
|
1918
1917
|
/** A Jss Object used to override or extend the styles applied to the component. */
|
|
@@ -2046,7 +2045,7 @@ export declare type HvButtonSize = (typeof buttonSize)[number];
|
|
|
2046
2045
|
|
|
2047
2046
|
export declare type HvButtonVariant = (typeof buttonVariant)[number];
|
|
2048
2047
|
|
|
2049
|
-
export declare const HvCalendar: ({ classes, id, locale, value, visibleMonth, visibleYear, rightVisibleMonth, rightVisibleYear, minimumDate, maximumDate, startAdornment, onChange, onInputChange, onVisibleDateChange, ...others }: HvCalendarProps) => JSX_2.Element;
|
|
2048
|
+
export declare const HvCalendar: ({ classes, id, locale, value, visibleMonth, visibleYear, rightVisibleMonth, rightVisibleYear, minimumDate, maximumDate, startAdornment, onChange, onInputChange, onVisibleDateChange, invalidDateLabel, ...others }: HvCalendarProps) => JSX_2.Element;
|
|
2050
2049
|
|
|
2051
2050
|
export declare interface HvCalendarClasses {
|
|
2052
2051
|
root?: string;
|
|
@@ -2058,7 +2057,7 @@ export declare interface HvCalendarClasses {
|
|
|
2058
2057
|
}
|
|
2059
2058
|
|
|
2060
2059
|
export declare const HvCalendarHeader: {
|
|
2061
|
-
({ id, value, locale, classes, onChange, showEndDate, showDayOfWeek, onFocus, ...others }: HvCalendarHeaderProps): JSX_2.Element;
|
|
2060
|
+
({ id, value, locale, classes, onChange, showEndDate, showDayOfWeek, onFocus, invalidDateLabel, ...others }: HvCalendarHeaderProps): JSX_2.Element;
|
|
2062
2061
|
formElementType: string;
|
|
2063
2062
|
};
|
|
2064
2063
|
|
|
@@ -2105,6 +2104,10 @@ export declare interface HvCalendarHeaderProps {
|
|
|
2105
2104
|
* Indicates if header should display the day of week.
|
|
2106
2105
|
*/
|
|
2107
2106
|
showDayOfWeek?: boolean;
|
|
2107
|
+
/**
|
|
2108
|
+
* Label shown when date is invalid.
|
|
2109
|
+
*/
|
|
2110
|
+
invalidDateLabel?: string;
|
|
2108
2111
|
}
|
|
2109
2112
|
|
|
2110
2113
|
export declare interface HvCalendarProps {
|
|
@@ -2172,6 +2175,10 @@ export declare interface HvCalendarProps {
|
|
|
2172
2175
|
* Indicates if header should display the day of week.
|
|
2173
2176
|
*/
|
|
2174
2177
|
showDayOfWeek?: boolean;
|
|
2178
|
+
/**
|
|
2179
|
+
* Label shown when date is invalid.
|
|
2180
|
+
*/
|
|
2181
|
+
invalidDateLabel?: string;
|
|
2175
2182
|
}
|
|
2176
2183
|
|
|
2177
2184
|
/**
|
|
@@ -2919,6 +2926,10 @@ export declare interface HvDatePickerProps extends HvBaseProps<HTMLDivElement, "
|
|
|
2919
2926
|
* Clear button label.
|
|
2920
2927
|
*/
|
|
2921
2928
|
clearLabel?: string;
|
|
2929
|
+
/**
|
|
2930
|
+
* Invalid Date label.
|
|
2931
|
+
*/
|
|
2932
|
+
invalidDateLabel?: string;
|
|
2922
2933
|
};
|
|
2923
2934
|
/**
|
|
2924
2935
|
* The initial value of the input when in single calendar mode.
|
|
@@ -3254,10 +3265,10 @@ declare interface HvDropdownListProps {
|
|
|
3254
3265
|
virtualized?: boolean;
|
|
3255
3266
|
}
|
|
3256
3267
|
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
};
|
|
3268
|
+
/**
|
|
3269
|
+
* 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.
|
|
3270
|
+
*/
|
|
3271
|
+
export declare const HvDropDownMenu: ({ id: idProp, classes, className, icon, placement, dataList, disablePortal, onToggle, onClick, keepOpened, disabled, expanded, defaultExpanded, category, ...others }: HvDropDownMenuProps) => JSX_2.Element;
|
|
3261
3272
|
|
|
3262
3273
|
export declare interface HvDropDownMenuClasses {
|
|
3263
3274
|
/** Styles applied to the root. */
|
|
@@ -7222,6 +7233,7 @@ export declare interface HvToggleButtonProps extends HvBaseProps<HTMLButtonEleme
|
|
|
7222
7233
|
|
|
7223
7234
|
/**
|
|
7224
7235
|
* Tooltips display informative text when users hover over, focus on, or tap an element.
|
|
7236
|
+
* Accessibility-wise, the tooltip automatically labels the `children` content.
|
|
7225
7237
|
*/
|
|
7226
7238
|
export declare const HvTooltip: ForwardRefExoticComponent<Omit<HvTooltipProps, "ref"> & RefAttributes<unknown>>;
|
|
7227
7239
|
|
|
@@ -7250,9 +7262,9 @@ export declare interface HvTooltipClasses {
|
|
|
7250
7262
|
valueWrapper?: string;
|
|
7251
7263
|
}
|
|
7252
7264
|
|
|
7253
|
-
export declare type HvTooltipPlacementType = "
|
|
7265
|
+
export declare type HvTooltipPlacementType = TooltipProps["placement"];
|
|
7254
7266
|
|
|
7255
|
-
export declare interface HvTooltipProps extends Omit<TooltipProps, "classes"
|
|
7267
|
+
export declare interface HvTooltipProps extends Omit<TooltipProps, "classes"> {
|
|
7256
7268
|
/**
|
|
7257
7269
|
* Class names to be applied.
|
|
7258
7270
|
*/
|
|
@@ -7274,20 +7286,12 @@ export declare interface HvTooltipProps extends Omit<TooltipProps, "classes" | "
|
|
|
7274
7286
|
* This property won't impact the enter touch delay (enterTouchDelay).
|
|
7275
7287
|
*/
|
|
7276
7288
|
enterDelay?: number;
|
|
7277
|
-
/**
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
/**
|
|
7282
|
-
|
|
7283
|
-
*/
|
|
7284
|
-
TransitionComponent?: React.JSXElementConstructor<TransitionProps & {
|
|
7285
|
-
children: React.ReactElement<any, any>;
|
|
7286
|
-
}>;
|
|
7287
|
-
/**
|
|
7288
|
-
* Properties applied to the Transition element.
|
|
7289
|
-
*/
|
|
7290
|
-
TransitionProps?: TransitionProps;
|
|
7289
|
+
/** @inheritdoc */
|
|
7290
|
+
title: TooltipProps["title"];
|
|
7291
|
+
/** @inheritdoc */
|
|
7292
|
+
TransitionComponent?: TooltipProps["TransitionComponent"];
|
|
7293
|
+
/** @inheritdoc */
|
|
7294
|
+
TransitionProps?: TooltipProps["TransitionProps"];
|
|
7291
7295
|
/**
|
|
7292
7296
|
* Defines if should use a single or multiline tooltip.
|
|
7293
7297
|
*/
|
|
@@ -8165,9 +8169,9 @@ export declare const listItemClasses: {
|
|
|
8165
8169
|
};
|
|
8166
8170
|
|
|
8167
8171
|
export declare const loadingClasses: {
|
|
8168
|
-
label: "HvLoading-label";
|
|
8169
|
-
small: "HvLoading-small";
|
|
8170
8172
|
hidden: "HvLoading-hidden";
|
|
8173
|
+
small: "HvLoading-small";
|
|
8174
|
+
label: "HvLoading-label";
|
|
8171
8175
|
overlay: "HvLoading-overlay";
|
|
8172
8176
|
blur: "HvLoading-blur";
|
|
8173
8177
|
root: "HvLoading-root";
|
|
@@ -8949,9 +8953,9 @@ export declare const treeViewClasses: {
|
|
|
8949
8953
|
};
|
|
8950
8954
|
|
|
8951
8955
|
export declare const treeViewItemClasses: {
|
|
8952
|
-
link: "HvVerticalNavigationTreeViewItem-link";
|
|
8953
8956
|
content: "HvVerticalNavigationTreeViewItem-content";
|
|
8954
8957
|
unselectable: "HvVerticalNavigationTreeViewItem-unselectable";
|
|
8958
|
+
link: "HvVerticalNavigationTreeViewItem-link";
|
|
8955
8959
|
group: "HvVerticalNavigationTreeViewItem-group";
|
|
8956
8960
|
hide: "HvVerticalNavigationTreeViewItem-hide";
|
|
8957
8961
|
expanded: "HvVerticalNavigationTreeViewItem-expanded";
|
|
@@ -8967,9 +8971,9 @@ export declare const treeViewItemClasses: {
|
|
|
8967
8971
|
};
|
|
8968
8972
|
|
|
8969
8973
|
export declare const typographyClasses: {
|
|
8974
|
+
link: "HvTypography-link";
|
|
8970
8975
|
body: "HvTypography-body";
|
|
8971
8976
|
label: "HvTypography-label";
|
|
8972
|
-
link: "HvTypography-link";
|
|
8973
8977
|
display: "HvTypography-display";
|
|
8974
8978
|
noWrap: "HvTypography-noWrap";
|
|
8975
8979
|
title1: "HvTypography-title1";
|
|
@@ -9309,7 +9313,7 @@ export declare type UseTableStylesProps = (<D extends object = Record<string, un
|
|
|
9309
9313
|
|
|
9310
9314
|
export declare const useTheme: () => HvThemeContextValue;
|
|
9311
9315
|
|
|
9312
|
-
export declare const useUniqueId: (id
|
|
9316
|
+
export declare const useUniqueId: (id?: string, idPrefix?: string) => string;
|
|
9313
9317
|
|
|
9314
9318
|
export declare const useWidth: () => string;
|
|
9315
9319
|
|
|
@@ -9330,6 +9334,7 @@ declare interface VerticalNavigationContextValue {
|
|
|
9330
9334
|
headerTitle?: string;
|
|
9331
9335
|
setHeaderTitle?: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
9332
9336
|
parentItem?: any;
|
|
9337
|
+
setParentItem?: React.Dispatch<React.SetStateAction<any>>;
|
|
9333
9338
|
withParentData?: any;
|
|
9334
9339
|
navigateToChildHandler?: (event: any, item: any) => void;
|
|
9335
9340
|
navigateToParentHandler?: () => void;
|
|
@@ -9378,15 +9383,6 @@ export declare const warningTextClasses: {
|
|
|
9378
9383
|
topBorder: "HvWarningText-topBorder";
|
|
9379
9384
|
};
|
|
9380
9385
|
|
|
9381
|
-
export declare const withId: (Component: any) => {
|
|
9382
|
-
({ id, ...others }: WithIdProps): JSX_2.Element;
|
|
9383
|
-
Naked: any;
|
|
9384
|
-
};
|
|
9385
|
-
|
|
9386
|
-
declare interface WithIdProps extends HvExtraProps {
|
|
9387
|
-
id?: string;
|
|
9388
|
-
}
|
|
9389
|
-
|
|
9390
9386
|
export declare const withTooltip: (Component: React.FunctionComponent, label: string | undefined, placement: HvTooltipPlacementType, hideTooltip?: ((event: React.MouseEvent<HTMLDivElement>) => boolean) | undefined, tooltipProps?: HvTooltipProps, tooltipContainerProps?: HvBaseProps) => (props: any) => JSX_2.Element;
|
|
9391
9387
|
|
|
9392
9388
|
export declare const wrapperTooltip: (hasTooltips: any, Component: any, label: any) => ((props: any) => JSX_2.Element) | (() => any);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Hitachi Vantara UI Kit Team",
|
|
6
6
|
"description": "Core React components for the NEXT Design System.",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"access": "public",
|
|
59
59
|
"directory": "package"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "366f03ead641dde3322efea5166f118a97591c3c",
|
|
62
62
|
"main": "dist/cjs/index.cjs",
|
|
63
63
|
"exports": {
|
|
64
64
|
".": {
|
package/dist/cjs/hocs/withId.cjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const hoistNonReactStatics = require("hoist-non-react-statics");
|
|
5
|
-
const uniqueId = require("lodash/uniqueId");
|
|
6
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
7
|
-
const getComponentName = require("../utils/getComponentName.cjs");
|
|
8
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
9
|
-
const hoistNonReactStatics__default = /* @__PURE__ */ _interopDefault(hoistNonReactStatics);
|
|
10
|
-
const uniqueId__default = /* @__PURE__ */ _interopDefault(uniqueId);
|
|
11
|
-
const pascalToKebab = (string = "") => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
12
|
-
const withId = (Component) => {
|
|
13
|
-
const WithId = ({
|
|
14
|
-
id,
|
|
15
|
-
...others
|
|
16
|
-
}) => {
|
|
17
|
-
const [internalId] = React.useState(id || uniqueId__default.default(`${pascalToKebab(getComponentName.default(Component))}-`));
|
|
18
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Component, {
|
|
19
|
-
id: internalId,
|
|
20
|
-
...others
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
hoistNonReactStatics__default.default(WithId, Component);
|
|
24
|
-
if (process.env.NODE_ENV !== "production") {
|
|
25
|
-
WithId.Naked = Component;
|
|
26
|
-
}
|
|
27
|
-
return WithId;
|
|
28
|
-
};
|
|
29
|
-
const withId$1 = withId;
|
|
30
|
-
exports.default = withId$1;
|
|
31
|
-
//# sourceMappingURL=withId.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withId.cjs","sources":["../../../src/hocs/withId.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\nimport uniqueId from \"lodash/uniqueId\";\nimport { HvExtraProps } from \"@core/types\";\nimport { getComponentName } from \"@core/utils\";\n\nconst pascalToKebab = (string = \"\") =>\n string.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\").toLowerCase();\n\nexport interface WithIdProps extends HvExtraProps {\n id?: string;\n}\n\nconst withId = (Component) => {\n const WithId = ({ id, ...others }: WithIdProps) => {\n const [internalId] = useState(\n id || uniqueId(`${pascalToKebab(getComponentName(Component))}-`)\n );\n\n return <Component id={internalId} {...others} />;\n };\n\n // https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(WithId, Component);\n\n if (process.env.NODE_ENV !== \"production\") {\n WithId.Naked = Component;\n }\n\n return WithId;\n};\n\nexport default withId;\n"],"names":["pascalToKebab","string","replace","toLowerCase","withId","Component","WithId","id","others","internalId","useState","uniqueId","getComponentName","hoistNonReactStatics","process","env","NODE_ENV","Naked"],"mappings":";;;;;;;;;;AAMA,MAAMA,gBAAgBA,CAACC,SAAS,OAC9BA,OAAOC,QAAQ,sBAAsB,OAAO,EAAEC;AAMhD,MAAMC,SAAUC,CAAc,cAAA;AAC5B,QAAMC,SAASA,CAAC;AAAA,IAAEC;AAAAA,IAAI,GAAGC;AAAAA,EAAAA,MAA0B;AACjD,UAAM,CAACC,UAAU,IAAIC,eACnBH,MAAMI,kBAAAA,QAAU,GAAEX,cAAcY,iBAAiBP,QAAAA,SAAS,CAAC,IAAI,CAAC;AAGlE,0CAAQA,WAAS;AAAA,MAACE,IAAIE;AAAAA,MAAW,GAAKD;AAAAA,IAAAA,CAAU;AAAA,EAAA;AAIlDK,wCAAqBP,QAAQD,SAAS;AAElCS,MAAAA,QAAQC,IAAIC,aAAa,cAAc;AACzCV,WAAOW,QAAQZ;AAAAA,EACjB;AAEOC,SAAAA;AACT;AAEA,MAAA,WAAeF;;"}
|
package/dist/esm/hocs/withId.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
3
|
-
import uniqueId from "lodash/uniqueId";
|
|
4
|
-
import { jsx } from "@emotion/react/jsx-runtime";
|
|
5
|
-
import getComponentName from "../utils/getComponentName.js";
|
|
6
|
-
const pascalToKebab = (string = "") => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
7
|
-
const withId = (Component) => {
|
|
8
|
-
const WithId = ({
|
|
9
|
-
id,
|
|
10
|
-
...others
|
|
11
|
-
}) => {
|
|
12
|
-
const [internalId] = useState(id || uniqueId(`${pascalToKebab(getComponentName(Component))}-`));
|
|
13
|
-
return /* @__PURE__ */ jsx(Component, {
|
|
14
|
-
id: internalId,
|
|
15
|
-
...others
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
hoistNonReactStatics(WithId, Component);
|
|
19
|
-
if (process.env.NODE_ENV !== "production") {
|
|
20
|
-
WithId.Naked = Component;
|
|
21
|
-
}
|
|
22
|
-
return WithId;
|
|
23
|
-
};
|
|
24
|
-
const withId$1 = withId;
|
|
25
|
-
export {
|
|
26
|
-
withId$1 as default
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=withId.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withId.js","sources":["../../../src/hocs/withId.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\nimport uniqueId from \"lodash/uniqueId\";\nimport { HvExtraProps } from \"@core/types\";\nimport { getComponentName } from \"@core/utils\";\n\nconst pascalToKebab = (string = \"\") =>\n string.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\").toLowerCase();\n\nexport interface WithIdProps extends HvExtraProps {\n id?: string;\n}\n\nconst withId = (Component) => {\n const WithId = ({ id, ...others }: WithIdProps) => {\n const [internalId] = useState(\n id || uniqueId(`${pascalToKebab(getComponentName(Component))}-`)\n );\n\n return <Component id={internalId} {...others} />;\n };\n\n // https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(WithId, Component);\n\n if (process.env.NODE_ENV !== \"production\") {\n WithId.Naked = Component;\n }\n\n return WithId;\n};\n\nexport default withId;\n"],"names":["pascalToKebab","string","replace","toLowerCase","withId","Component","WithId","id","others","internalId","useState","uniqueId","getComponentName","hoistNonReactStatics","process","env","NODE_ENV","Naked"],"mappings":";;;;;AAMA,MAAMA,gBAAgBA,CAACC,SAAS,OAC9BA,OAAOC,QAAQ,sBAAsB,OAAO,EAAEC;AAMhD,MAAMC,SAAUC,CAAc,cAAA;AAC5B,QAAMC,SAASA,CAAC;AAAA,IAAEC;AAAAA,IAAI,GAAGC;AAAAA,EAAAA,MAA0B;AACjD,UAAM,CAACC,UAAU,IAAIC,SACnBH,MAAMI,SAAU,GAAEX,cAAcY,iBAAiBP,SAAS,CAAC,IAAI,CAAC;AAGlE,+BAAQA,WAAS;AAAA,MAACE,IAAIE;AAAAA,MAAW,GAAKD;AAAAA,IAAAA,CAAU;AAAA,EAAA;AAIlDK,uBAAqBP,QAAQD,SAAS;AAElCS,MAAAA,QAAQC,IAAIC,aAAa,cAAc;AACzCV,WAAOW,QAAQZ;AAAAA,EACjB;AAEOC,SAAAA;AACT;AAEA,MAAA,WAAeF;"}
|