@hitachivantara/uikit-react-lab 4.4.0 → 4.5.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 (88) hide show
  1. package/dist/NavigationSlider/Header/Header.js +79 -0
  2. package/dist/NavigationSlider/Header/Header.js.map +1 -0
  3. package/dist/NavigationSlider/Header/index.js +14 -0
  4. package/dist/NavigationSlider/Header/index.js.map +1 -0
  5. package/dist/NavigationSlider/Header/styles.js +36 -0
  6. package/dist/NavigationSlider/Header/styles.js.map +1 -0
  7. package/dist/NavigationSlider/Navigation/Navigation.js +102 -0
  8. package/dist/NavigationSlider/Navigation/Navigation.js.map +1 -0
  9. package/dist/NavigationSlider/Navigation/index.js +14 -0
  10. package/dist/NavigationSlider/Navigation/index.js.map +1 -0
  11. package/dist/NavigationSlider/Navigation/styles.js +30 -0
  12. package/dist/NavigationSlider/Navigation/styles.js.map +1 -0
  13. package/dist/NavigationSlider/NavigationSlider.d.ts +30 -0
  14. package/dist/NavigationSlider/NavigationSlider.js +139 -0
  15. package/dist/NavigationSlider/NavigationSlider.js.map +1 -0
  16. package/dist/NavigationSlider/index.d.ts +2 -0
  17. package/dist/NavigationSlider/index.js +14 -0
  18. package/dist/NavigationSlider/index.js.map +1 -0
  19. package/dist/NavigationSlider/styles.js +29 -0
  20. package/dist/NavigationSlider/styles.js.map +1 -0
  21. package/dist/NavigationSlider/utils.js +87 -0
  22. package/dist/NavigationSlider/utils.js.map +1 -0
  23. package/dist/VerticalNavigation/VerticalNavigation.js +1 -3
  24. package/dist/VerticalNavigation/VerticalNavigation.js.map +1 -1
  25. package/dist/VerticalNavigation/utils.js +24 -16
  26. package/dist/VerticalNavigation/utils.js.map +1 -1
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.js +9 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/legacy/NavigationSlider/Header/Header.js +72 -0
  31. package/dist/legacy/NavigationSlider/Header/Header.js.map +1 -0
  32. package/dist/legacy/NavigationSlider/Header/index.js +2 -0
  33. package/dist/legacy/NavigationSlider/Header/index.js.map +1 -0
  34. package/dist/legacy/NavigationSlider/Header/styles.js +29 -0
  35. package/dist/legacy/NavigationSlider/Header/styles.js.map +1 -0
  36. package/dist/legacy/NavigationSlider/Navigation/Navigation.js +94 -0
  37. package/dist/legacy/NavigationSlider/Navigation/Navigation.js.map +1 -0
  38. package/dist/legacy/NavigationSlider/Navigation/index.js +2 -0
  39. package/dist/legacy/NavigationSlider/Navigation/index.js.map +1 -0
  40. package/dist/legacy/NavigationSlider/Navigation/styles.js +23 -0
  41. package/dist/legacy/NavigationSlider/Navigation/styles.js.map +1 -0
  42. package/dist/legacy/NavigationSlider/NavigationSlider.d.ts +30 -0
  43. package/dist/legacy/NavigationSlider/NavigationSlider.js +123 -0
  44. package/dist/legacy/NavigationSlider/NavigationSlider.js.map +1 -0
  45. package/dist/legacy/NavigationSlider/index.d.ts +2 -0
  46. package/dist/legacy/NavigationSlider/index.js +2 -0
  47. package/dist/legacy/NavigationSlider/index.js.map +1 -0
  48. package/dist/legacy/NavigationSlider/styles.js +22 -0
  49. package/dist/legacy/NavigationSlider/styles.js.map +1 -0
  50. package/dist/legacy/NavigationSlider/utils.js +78 -0
  51. package/dist/legacy/NavigationSlider/utils.js.map +1 -0
  52. package/dist/legacy/VerticalNavigation/VerticalNavigation.js +2 -4
  53. package/dist/legacy/VerticalNavigation/VerticalNavigation.js.map +1 -1
  54. package/dist/legacy/VerticalNavigation/utils.js +23 -15
  55. package/dist/legacy/VerticalNavigation/utils.js.map +1 -1
  56. package/dist/legacy/index.d.ts +3 -0
  57. package/dist/legacy/index.js +1 -0
  58. package/dist/legacy/index.js.map +1 -1
  59. package/dist/modern/NavigationSlider/Header/Header.js +72 -0
  60. package/dist/modern/NavigationSlider/Header/Header.js.map +1 -0
  61. package/dist/modern/NavigationSlider/Header/index.js +2 -0
  62. package/dist/modern/NavigationSlider/Header/index.js.map +1 -0
  63. package/dist/modern/NavigationSlider/Header/styles.js +25 -0
  64. package/dist/modern/NavigationSlider/Header/styles.js.map +1 -0
  65. package/dist/modern/NavigationSlider/Navigation/Navigation.js +88 -0
  66. package/dist/modern/NavigationSlider/Navigation/Navigation.js.map +1 -0
  67. package/dist/modern/NavigationSlider/Navigation/index.js +2 -0
  68. package/dist/modern/NavigationSlider/Navigation/index.js.map +1 -0
  69. package/dist/modern/NavigationSlider/Navigation/styles.js +21 -0
  70. package/dist/modern/NavigationSlider/Navigation/styles.js.map +1 -0
  71. package/dist/modern/NavigationSlider/NavigationSlider.d.ts +30 -0
  72. package/dist/modern/NavigationSlider/NavigationSlider.js +116 -0
  73. package/dist/modern/NavigationSlider/NavigationSlider.js.map +1 -0
  74. package/dist/modern/NavigationSlider/index.d.ts +2 -0
  75. package/dist/modern/NavigationSlider/index.js +2 -0
  76. package/dist/modern/NavigationSlider/index.js.map +1 -0
  77. package/dist/modern/NavigationSlider/styles.js +18 -0
  78. package/dist/modern/NavigationSlider/styles.js.map +1 -0
  79. package/dist/modern/NavigationSlider/utils.js +70 -0
  80. package/dist/modern/NavigationSlider/utils.js.map +1 -0
  81. package/dist/modern/VerticalNavigation/VerticalNavigation.js +2 -2
  82. package/dist/modern/VerticalNavigation/VerticalNavigation.js.map +1 -1
  83. package/dist/modern/VerticalNavigation/utils.js +23 -7
  84. package/dist/modern/VerticalNavigation/utils.js.map +1 -1
  85. package/dist/modern/index.d.ts +3 -0
  86. package/dist/modern/index.js +1 -0
  87. package/dist/modern/index.js.map +1 -1
  88. package/package.json +2 -2
@@ -0,0 +1,123 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { useState, useMemo } from "react";
3
+ import { withStyles } from "@mui/styles";
4
+ import PropTypes from "prop-types";
5
+ import { HvVerticalNavigation as HvVerticalNavigationCore } from "@hitachivantara/uikit-react-core";
6
+ import Header from "./Header";
7
+ import Navigation from "./Navigation";
8
+ import { fillDataWithParentId, getNavigationItemById, getParentItemById } from "./utils";
9
+ import useStyles from "./styles";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ var HvNavigationSlider = function HvNavigationSlider(_ref) {
13
+ var id = _ref.id,
14
+ onNavigationChange = _ref.onNavigationChange,
15
+ data = _ref.data,
16
+ title = _ref.title,
17
+ selected = _ref.selected,
18
+ topPosition = _ref.topPosition,
19
+ panelWidth = _ref.panelWidth;
20
+ var classes = useStyles({
21
+ topPosition: topPosition,
22
+ panelWidth: panelWidth
23
+ })();
24
+ var withParentData = useMemo(function () {
25
+ return fillDataWithParentId(data);
26
+ }, [data]);
27
+ var initialParentItem = useMemo(function () {
28
+ return getParentItemById(withParentData, selected);
29
+ }, [withParentData, selected]);
30
+ var _useState = useState(initialParentItem),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ parentItem = _useState2[0],
33
+ setParentItem = _useState2[1];
34
+ var navigateToParentHandler = function navigateToParentHandler() {
35
+ setParentItem(getParentItemById(withParentData, parentItem.id));
36
+ };
37
+ var navigateToTargetHandler = function navigateToTargetHandler(event, selectedItem) {
38
+ onNavigationChange(event, selectedItem);
39
+ };
40
+ var navigateToChildHandler = function navigateToChildHandler(event, item) {
41
+ setParentItem(getNavigationItemById(withParentData, item.id));
42
+ event.stopPropagation();
43
+ };
44
+ return /*#__PURE__*/_jsx("div", {
45
+ id: id,
46
+ className: classes.container,
47
+ children: /*#__PURE__*/_jsxs(HvVerticalNavigationCore, {
48
+ className: classes.root,
49
+ children: [/*#__PURE__*/_jsx(Header, {
50
+ onBackButtonClick: navigateToParentHandler,
51
+ showBackButton: !!(parentItem !== null && parentItem !== void 0 && parentItem.label),
52
+ title: (parentItem === null || parentItem === void 0 ? void 0 : parentItem.label) || title
53
+ }), /*#__PURE__*/_jsx(Navigation, {
54
+ data: parentItem.data || withParentData,
55
+ selected: selected,
56
+ onNavigateToTarget: navigateToTargetHandler,
57
+ onNavigateToChild: navigateToChildHandler
58
+ })]
59
+ })
60
+ });
61
+ };
62
+ process.env.NODE_ENV !== "production" ? HvNavigationSlider.propTypes = {
63
+ /**
64
+ * Id to be applied to the root node of the panel.
65
+ */
66
+ id: PropTypes.string,
67
+ /**
68
+ * A Jss Object used to override or extend the styles applied.
69
+ */
70
+ classes: PropTypes.shape({
71
+ /**
72
+ * styles object applied to the root
73
+ */
74
+ container: PropTypes.string,
75
+ root: PropTypes.string,
76
+ footer: PropTypes.string
77
+ }).isRequired,
78
+ /**
79
+ * Called when a menu item is clicked.
80
+ */
81
+ onNavigationChange: PropTypes.func,
82
+ /**
83
+ * An array containing the data for each menu item.
84
+ *
85
+ * id - the id to be applied to the root element.
86
+ * label - the label to be rendered on the menu item.
87
+ * data - sub-menu items
88
+ * href - the url used for navigation.
89
+ * target - the behavior when opening an url.
90
+ */
91
+ data: PropTypes.arrayOf(PropTypes.shape({
92
+ id: PropTypes.string.isRequired,
93
+ label: PropTypes.string.isRequired,
94
+ icon: PropTypes.node,
95
+ data: PropTypes.array,
96
+ href: PropTypes.string,
97
+ target: PropTypes.string
98
+ })).isRequired,
99
+ /**
100
+ * The text to be displayed when at the root of the structure.
101
+ */
102
+ title: PropTypes.string,
103
+ /**
104
+ * The ID of the selected page.
105
+ */
106
+ selected: PropTypes.string,
107
+ /**
108
+ * The top value where the panel will be rendered. Default is 44 as it is the height of the Header component.
109
+ */
110
+ topPosition: PropTypes.number,
111
+ /**
112
+ * The width of the panel when expanded. Default value is 300.
113
+ */
114
+ panelWidth: PropTypes.number
115
+ } : void 0;
116
+ HvNavigationSlider.defaultProps = {
117
+ topPosition: 44,
118
+ panelWidth: 300
119
+ };
120
+ export default withStyles(useStyles, {
121
+ name: "HvNavigationSlider"
122
+ })(HvNavigationSlider);
123
+ //# sourceMappingURL=NavigationSlider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationSlider.js","names":["React","useState","useMemo","withStyles","PropTypes","HvVerticalNavigation","HvVerticalNavigationCore","Header","Navigation","fillDataWithParentId","getNavigationItemById","getParentItemById","useStyles","HvNavigationSlider","id","onNavigationChange","data","title","selected","topPosition","panelWidth","classes","withParentData","initialParentItem","parentItem","setParentItem","navigateToParentHandler","navigateToTargetHandler","event","selectedItem","navigateToChildHandler","item","stopPropagation","container","root","label","propTypes","string","shape","footer","isRequired","func","arrayOf","icon","node","array","href","target","number","defaultProps","name"],"sources":["../../../src/NavigationSlider/NavigationSlider.js"],"sourcesContent":["import React, { useState, useMemo } from \"react\";\nimport { withStyles } from \"@mui/styles\";\nimport PropTypes from \"prop-types\";\n\nimport { HvVerticalNavigation as HvVerticalNavigationCore } from \"@hitachivantara/uikit-react-core\";\n\nimport Header from \"./Header\";\nimport Navigation from \"./Navigation\";\nimport { fillDataWithParentId, getNavigationItemById, getParentItemById } from \"./utils\";\n\nimport useStyles from \"./styles\";\n\nconst HvNavigationSlider = ({\n id,\n onNavigationChange,\n data,\n title,\n selected,\n topPosition,\n panelWidth,\n}) => {\n const classes = useStyles({ topPosition, panelWidth })();\n\n const withParentData = useMemo(() => fillDataWithParentId(data), [data]);\n\n const initialParentItem = useMemo(\n () => getParentItemById(withParentData, selected),\n [withParentData, selected]\n );\n\n const [parentItem, setParentItem] = useState(initialParentItem);\n\n const navigateToParentHandler = () => {\n setParentItem(getParentItemById(withParentData, parentItem.id));\n };\n\n const navigateToTargetHandler = (event, selectedItem) => {\n onNavigationChange(event, selectedItem);\n };\n\n const navigateToChildHandler = (event, item) => {\n setParentItem(getNavigationItemById(withParentData, item.id));\n\n event.stopPropagation();\n };\n\n return (\n <div id={id} className={classes.container}>\n <HvVerticalNavigationCore className={classes.root}>\n <Header\n onBackButtonClick={navigateToParentHandler}\n showBackButton={!!parentItem?.label}\n title={parentItem?.label || title}\n />\n\n <Navigation\n data={parentItem.data || withParentData}\n selected={selected}\n onNavigateToTarget={navigateToTargetHandler}\n onNavigateToChild={navigateToChildHandler}\n />\n </HvVerticalNavigationCore>\n </div>\n );\n};\n\nHvNavigationSlider.propTypes = {\n /**\n * Id to be applied to the root node of the panel.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * styles object applied to the root\n */\n container: PropTypes.string,\n root: PropTypes.string,\n footer: PropTypes.string,\n }).isRequired,\n /**\n * Called when a menu item is clicked.\n */\n onNavigationChange: PropTypes.func,\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: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n icon: PropTypes.node,\n data: PropTypes.array,\n href: PropTypes.string,\n target: PropTypes.string,\n })\n ).isRequired,\n /**\n * The text to be displayed when at the root of the structure.\n */\n title: PropTypes.string,\n /**\n * The ID of the selected page.\n */\n selected: PropTypes.string,\n /**\n * The top value where the panel will be rendered. Default is 44 as it is the height of the Header component.\n */\n topPosition: PropTypes.number,\n /**\n * The width of the panel when expanded. Default value is 300.\n */\n panelWidth: PropTypes.number,\n};\n\nHvNavigationSlider.defaultProps = {\n topPosition: 44,\n panelWidth: 300,\n};\n\nexport default withStyles(useStyles, { name: \"HvNavigationSlider\" })(HvNavigationSlider);\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,OAAO,QAAQ,OAAO;AAChD,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,SAAS,MAAM,YAAY;AAElC,SAASC,oBAAoB,IAAIC,wBAAwB,QAAQ,kCAAkC;AAEnG,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,UAAU,MAAM,cAAc;AACrC,SAASC,oBAAoB,EAAEC,qBAAqB,EAAEC,iBAAiB,QAAQ,SAAS;AAExF,OAAOC,SAAS,MAAM,UAAU;AAAC;AAAA;AAEjC,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkB,OAQlB;EAAA,IAPJC,EAAE,QAAFA,EAAE;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ACEvB,KAAK,EAAEb,SAAS,CAACiC,MAAM;EACvB;AACF;AACA;EACEnB,QAAQ,EAAEd,SAAS,CAACiC,MAAM;EAC1B;AACF;AACA;EACElB,WAAW,EAAEf,SAAS,CAAC4C,MAAM;EAC7B;AACF;AACA;EACE5B,UAAU,EAAEhB,SAAS,CAAC4C;AACxB,CAAC;AAEDnC,kBAAkB,CAACoC,YAAY,GAAG;EAChC9B,WAAW,EAAE,EAAE;EACfC,UAAU,EAAE;AACd,CAAC;AAED,eAAejB,UAAU,CAACS,SAAS,EAAE;EAAEsC,IAAI,EAAE;AAAqB,CAAC,CAAC,CAACrC,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from "./NavigationSlider";
2
+ export * from "./NavigationSlider";
@@ -0,0 +1,2 @@
1
+ export { default } from "./NavigationSlider";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/NavigationSlider/index.js"],"sourcesContent":["export { default } from \"./NavigationSlider\";\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,oBAAoB"}
@@ -0,0 +1,22 @@
1
+ import { makeStyles } from "@mui/styles";
2
+ var styles = function styles(props) {
3
+ return makeStyles(function () {
4
+ return {
5
+ container: {
6
+ position: "fixed",
7
+ left: 0,
8
+ top: props.topPosition
9
+ },
10
+ root: {
11
+ width: props.panelWidth,
12
+ height: "calc(100vh - ".concat(props.topPosition, "px)"),
13
+ justifyContent: "flex-start"
14
+ },
15
+ footer: {
16
+ marginTop: "auto"
17
+ }
18
+ };
19
+ });
20
+ };
21
+ export default styles;
22
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","names":["makeStyles","styles","props","container","position","left","top","topPosition","root","width","panelWidth","height","justifyContent","footer","marginTop"],"sources":["../../../src/NavigationSlider/styles.js"],"sourcesContent":["import { makeStyles } from \"@mui/styles\";\n\nconst styles = (props) =>\n makeStyles(() => ({\n container: {\n position: \"fixed\",\n left: 0,\n top: props.topPosition,\n },\n root: {\n width: props.panelWidth,\n height: `calc(100vh - ${props.topPosition}px)`,\n justifyContent: \"flex-start\",\n },\n footer: {\n marginTop: \"auto\",\n },\n }));\n\nexport default styles;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,aAAa;AAExC,IAAMC,MAAM,GAAG,SAATA,MAAM,CAAIC,KAAK;EAAA,OACnBF,UAAU,CAAC;IAAA,OAAO;MAChBG,SAAS,EAAE;QACTC,QAAQ,EAAE,OAAO;QACjBC,IAAI,EAAE,CAAC;QACPC,GAAG,EAAEJ,KAAK,CAACK;MACb,CAAC;MACDC,IAAI,EAAE;QACJC,KAAK,EAAEP,KAAK,CAACQ,UAAU;QACvBC,MAAM,yBAAkBT,KAAK,CAACK,WAAW,QAAK;QAC9CK,cAAc,EAAE;MAClB,CAAC;MACDC,MAAM,EAAE;QACNC,SAAS,EAAE;MACb;IACF,CAAC;EAAA,CAAC,CAAC;AAAA;AAEL,eAAeb,MAAM"}
@@ -0,0 +1,78 @@
1
+ import "core-js/modules/es.object.keys.js";
2
+ import "core-js/modules/es.symbol.js";
3
+ import "core-js/modules/es.array.filter.js";
4
+ import "core-js/modules/es.object.to-string.js";
5
+ import "core-js/modules/es.object.get-own-property-descriptor.js";
6
+ import "core-js/modules/web.dom-collections.for-each.js";
7
+ import "core-js/modules/es.object.get-own-property-descriptors.js";
8
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
+ import "core-js/modules/es.array.map.js";
12
+ /**
13
+ * Recursively searches in a collection the first element where the property matches the specified value.
14
+ *
15
+ * @param collection - Collection where the search will be performed
16
+ * @param childrenPropName - The children property name where the recursive search will be performed
17
+ * @param propName - The name of the property to be used on the search
18
+ * @param propValue - The value of the property to be used on the search
19
+ * @returns The element that matches the requirement or null if none is found
20
+ */
21
+ var searchInCollection = function searchInCollection(collection, childrenPropName, propName, propValue) {
22
+ if (collection[propName] === propValue) {
23
+ return collection;
24
+ }
25
+ var items = collection[childrenPropName] || collection;
26
+ var foundItem = null;
27
+ for (var index = 0; foundItem === null && index < items.length; index += 1) {
28
+ foundItem = searchInCollection(items[index], childrenPropName, propName, propValue);
29
+ }
30
+ return foundItem;
31
+ };
32
+
33
+ /**
34
+ * Returns the navigation item with the specified id.
35
+ *
36
+ * @param navigationItems - The collection of navigation items.
37
+ * @param navigationItemId - The id to be used on the search
38
+ * @returns The navigation item with the specified id.
39
+ */
40
+ var getNavigationItemById = function getNavigationItemById(navigationItems, navigationItemId) {
41
+ return searchInCollection(navigationItems, "data", "id", navigationItemId);
42
+ };
43
+
44
+ /**
45
+ * Returns the parent item for the received item id.
46
+ *
47
+ * @param navigationItems - The collection of navigation items.
48
+ * @param navigationItemId - The id to be used on the search
49
+ * @returns The parent navigation item.
50
+ */
51
+ var getParentItemById = function getParentItemById(navigationItems, navigationItemId) {
52
+ var parentId = getNavigationItemById(navigationItems, navigationItemId).parent;
53
+ return getNavigationItemById(navigationItems, parentId);
54
+ };
55
+
56
+ /**
57
+ * Fills the data structure with the parent id on each one of the nodes.
58
+ *
59
+ * @param navigationItems - The collection of navigation items.
60
+ * @param parentItemId - The parent id to be added.
61
+ * @returns The structure now filled with the parent id.
62
+ */
63
+ var fillDataWithParentId = function fillDataWithParentId(navigationItems, parentItemId) {
64
+ return navigationItems.map(function (item) {
65
+ var _item$data;
66
+ if ((item === null || item === void 0 ? void 0 : (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.length) > 0) {
67
+ return _objectSpread(_objectSpread({}, item), {}, {
68
+ parent: parentItemId,
69
+ data: fillDataWithParentId(item.data, item.id)
70
+ });
71
+ }
72
+ return _objectSpread(_objectSpread({}, item), {}, {
73
+ parent: parentItemId
74
+ });
75
+ });
76
+ };
77
+ export { getNavigationItemById, getParentItemById, fillDataWithParentId };
78
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":["searchInCollection","collection","childrenPropName","propName","propValue","items","foundItem","index","length","getNavigationItemById","navigationItems","navigationItemId","getParentItemById","parentId","parent","fillDataWithParentId","parentItemId","map","item","data","id"],"sources":["../../../src/NavigationSlider/utils.js"],"sourcesContent":["/**\n * Recursively searches in a collection the first element where the property matches the specified value.\n *\n * @param collection - Collection where the search will be performed\n * @param childrenPropName - The children property name where the recursive search will be performed\n * @param propName - The name of the property to be used on the search\n * @param propValue - The value of the property to be used on the search\n * @returns The element that matches the requirement or null if none is found\n */\nconst searchInCollection = (collection, childrenPropName, propName, propValue) => {\n if (collection[propName] === propValue) {\n return collection;\n }\n\n const items = collection[childrenPropName] || collection;\n\n let foundItem = null;\n for (let index = 0; foundItem === null && index < items.length; index += 1) {\n foundItem = searchInCollection(items[index], childrenPropName, propName, propValue);\n }\n return foundItem;\n};\n\n/**\n * Returns the navigation item with the specified id.\n *\n * @param navigationItems - The collection of navigation items.\n * @param navigationItemId - The id to be used on the search\n * @returns The navigation item with the specified id.\n */\nconst getNavigationItemById = (navigationItems, navigationItemId) => {\n return searchInCollection(navigationItems, \"data\", \"id\", navigationItemId);\n};\n\n/**\n * Returns the parent item for the received item id.\n *\n * @param navigationItems - The collection of navigation items.\n * @param navigationItemId - The id to be used on the search\n * @returns The parent navigation item.\n */\nconst getParentItemById = (navigationItems, navigationItemId) => {\n const parentId = getNavigationItemById(navigationItems, navigationItemId).parent;\n return getNavigationItemById(navigationItems, parentId);\n};\n\n/**\n * Fills the data structure with the parent id on each one of the nodes.\n *\n * @param navigationItems - The collection of navigation items.\n * @param parentItemId - The parent id to be added.\n * @returns The structure now filled with the parent id.\n */\nconst fillDataWithParentId = (navigationItems, parentItemId) => {\n return navigationItems.map((item) => {\n if (item?.data?.length > 0) {\n return { ...item, parent: parentItemId, data: fillDataWithParentId(item.data, item.id) };\n }\n return { ...item, parent: parentItemId };\n });\n};\n\nexport { getNavigationItemById, getParentItemById, fillDataWithParentId };\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkB,CAAIC,UAAU,EAAEC,gBAAgB,EAAEC,QAAQ,EAAEC,SAAS,EAAK;EAChF,IAAIH,UAAU,CAACE,QAAQ,CAAC,KAAKC,SAAS,EAAE;IACtC,OAAOH,UAAU;EACnB;EAEA,IAAMI,KAAK,GAAGJ,UAAU,CAACC,gBAAgB,CAAC,IAAID,UAAU;EAExD,IAAIK,SAAS,GAAG,IAAI;EACpB,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAED,SAAS,KAAK,IAAI,IAAIC,KAAK,GAAGF,KAAK,CAACG,MAAM,EAAED,KAAK,IAAI,CAAC,EAAE;IAC1ED,SAAS,GAAGN,kBAAkB,CAACK,KAAK,CAACE,KAAK,CAAC,EAAEL,gBAAgB,EAAEC,QAAQ,EAAEC,SAAS,CAAC;EACrF;EACA,OAAOE,SAAS;AAClB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMG,qBAAqB,GAAG,SAAxBA,qBAAqB,CAAIC,eAAe,EAAEC,gBAAgB,EAAK;EACnE,OAAOX,kBAAkB,CAACU,eAAe,EAAE,MAAM,EAAE,IAAI,EAAEC,gBAAgB,CAAC;AAC5E,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiB,CAAIF,eAAe,EAAEC,gBAAgB,EAAK;EAC/D,IAAME,QAAQ,GAAGJ,qBAAqB,CAACC,eAAe,EAAEC,gBAAgB,CAAC,CAACG,MAAM;EAChF,OAAOL,qBAAqB,CAACC,eAAe,EAAEG,QAAQ,CAAC;AACzD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAME,oBAAoB,GAAG,SAAvBA,oBAAoB,CAAIL,eAAe,EAAEM,YAAY,EAAK;EAC9D,OAAON,eAAe,CAACO,GAAG,CAAC,UAACC,IAAI,EAAK;IAAA;IACnC,IAAI,CAAAA,IAAI,aAAJA,IAAI,qCAAJA,IAAI,CAAEC,IAAI,+CAAV,WAAYX,MAAM,IAAG,CAAC,EAAE;MAC1B,uCAAYU,IAAI;QAAEJ,MAAM,EAAEE,YAAY;QAAEG,IAAI,EAAEJ,oBAAoB,CAACG,IAAI,CAACC,IAAI,EAAED,IAAI,CAACE,EAAE;MAAC;IACxF;IACA,uCAAYF,IAAI;MAAEJ,MAAM,EAAEE;IAAY;EACxC,CAAC,CAAC;AACJ,CAAC;AAED,SAASP,qBAAqB,EAAEG,iBAAiB,EAAEG,oBAAoB"}
@@ -23,7 +23,7 @@ import clsx from "clsx";
23
23
  import { HvVerticalNavigation as HvVerticalNavigationCore, HvVerticalNavigationTree, HvButton, HvContainer } from "@hitachivantara/uikit-react-core";
24
24
  import { Backwards, Forwards } from "@hitachivantara/uikit-react-icons";
25
25
  import useStyles from "./styles";
26
- import { getAllParents, findRootParentById, findItemById } from "./utils";
26
+ import { findRootParentById, findItemById, pathToItem } from "./utils";
27
27
  import { jsx as _jsx } from "react/jsx-runtime";
28
28
  import { jsxs as _jsxs } from "react/jsx-runtime";
29
29
  var HvVerticalNavigation = function HvVerticalNavigation(_ref) {
@@ -49,9 +49,7 @@ var HvVerticalNavigation = function HvVerticalNavigation(_ref) {
49
49
  rest = _objectWithoutProperties(_ref2, _excluded2);
50
50
  return rest;
51
51
  });
52
- var _useState = useState(getAllParents(data).map(function (item) {
53
- return item.id;
54
- })),
52
+ var _useState = useState(pathToItem(data, selected)),
55
53
  _useState2 = _slicedToArray(_useState, 2),
56
54
  expandedItems = _useState2[0],
57
55
  setExpandedItems = _useState2[1];
@@ -1 +1 @@
1
- {"version":3,"file":"VerticalNavigation.js","names":["React","useState","withStyles","PropTypes","clsx","HvVerticalNavigation","HvVerticalNavigationCore","HvVerticalNavigationTree","HvButton","HvContainer","Backwards","Forwards","useStyles","getAllParents","findRootParentById","findItemById","onNavigationChange","onToggleExpanded","data","selected","expanded","topPosition","expandedPanelWidth","collapsedPanelWidth","position","others","classes","noSubData","map","dataToRemove","rest","item","id","expandedItems","setExpandedItems","selectedTopParent","handleVerticalNavigationChange","event","fullItem","length","prevState","handleVerticalNavigationToggle","currentExpandedItems","handleExpandToggle","panel","panelExpanded","panelCollapsed","toggleCollapsePanel","propTypes","func","arrayOf","shape","string","isRequired","label","icon","node","array","href","target","bool","number","oneOf","defaultProps","name"],"sources":["../../../src/VerticalNavigation/VerticalNavigation.js"],"sourcesContent":["import React, { useState } from \"react\";\nimport { withStyles } from \"@mui/styles\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport {\n HvVerticalNavigation as HvVerticalNavigationCore,\n HvVerticalNavigationTree,\n HvButton,\n HvContainer,\n} from \"@hitachivantara/uikit-react-core\";\nimport { Backwards, Forwards } from \"@hitachivantara/uikit-react-icons\";\n\nimport useStyles from \"./styles\";\nimport { getAllParents, findRootParentById, findItemById } from \"./utils\";\n\nconst HvVerticalNavigation = ({\n onNavigationChange,\n onToggleExpanded,\n data,\n selected,\n expanded,\n topPosition,\n expandedPanelWidth,\n collapsedPanelWidth,\n position,\n\n ...others\n}) => {\n const classes = useStyles({ topPosition, expandedPanelWidth, collapsedPanelWidth, position })();\n\n const noSubData = data.map(({ data: dataToRemove, ...rest }) => rest);\n\n const [expandedItems, setExpandedItems] = useState(getAllParents(data).map((item) => item.id));\n\n const selectedTopParent = findRootParentById(data, selected)?.id;\n\n const handleVerticalNavigationChange = (event, item) => {\n // This need to be done because the item recieved on the callback is missing the original data object\n const fullItem = findItemById(data, item.id);\n\n if (!expanded && fullItem.data && fullItem.data.length > 0) {\n setExpandedItems((prevState) => [...prevState, item.id]);\n onToggleExpanded(true);\n } else {\n onNavigationChange?.(event, item);\n }\n };\n\n const handleVerticalNavigationToggle = (event, currentExpandedItems) => {\n setExpandedItems(currentExpandedItems);\n };\n\n const handleExpandToggle = () => {\n onToggleExpanded(!expanded);\n };\n\n return (\n <HvVerticalNavigationCore\n className={clsx(classes.panel, {\n [classes.panelExpanded]: expanded,\n [classes.panelCollapsed]: !expanded,\n })}\n {...others}\n >\n <HvContainer className={`${classes.toggleCollapsePanel}`}>\n <HvButton icon onClick={handleExpandToggle}>\n {expanded ? <Backwards iconSize=\"XS\" /> : <Forwards iconSize=\"XS\" />}\n </HvButton>\n </HvContainer>\n\n <HvVerticalNavigationTree\n collapsible\n expanded={expandedItems}\n data={expanded ? data : noSubData}\n selected={expanded ? selected : selectedTopParent}\n onChange={handleVerticalNavigationChange}\n onToggle={handleVerticalNavigationToggle}\n />\n </HvVerticalNavigationCore>\n );\n};\n\nHvVerticalNavigation.propTypes = {\n /**\n * Called when a menu item is clicked.\n */\n onNavigationChange: PropTypes.func,\n /**\n * Called when the collapse / expand button is clicked.\n */\n onToggleExpanded: PropTypes.func,\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 * icon - the icon component.\n * data - sub-menu items\n * href - the url used for navigation.\n * target - the behavior when opening an url.\n */\n data: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n icon: PropTypes.node,\n data: PropTypes.array,\n href: PropTypes.string,\n target: PropTypes.string,\n })\n ).isRequired,\n /**\n * The ID of the selected page.\n */\n selected: PropTypes.string,\n /**\n * Boolean value stating if the panel should be collapsed or expanded.\n */\n expanded: PropTypes.bool,\n /**\n * The top value where the panel will be rendered. Default is 44 as it is the height of the Header component.\n */\n topPosition: PropTypes.number,\n /**\n * The width of the panel when expanded. Default value is 300.\n */\n expandedPanelWidth: PropTypes.number,\n /**\n * The width of the panel when collapsed. Default vlaue is 52.\n */\n collapsedPanelWidth: PropTypes.number,\n /**\n * Position of the component.\n */\n position: PropTypes.oneOf([\"static\", \"relative\", \"fixed\", \"absolute\", \"sticky\"]),\n};\n\nHvVerticalNavigation.defaultProps = {\n topPosition: 44,\n expandedPanelWidth: 300,\n collapsedPanelWidth: 52,\n position: \"fixed\",\n};\n\nexport default withStyles(useStyles, { name: \"HvVerticalNavigation\" })(HvVerticalNavigation);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,MAAM,MAAM;AAEvB,SACEC,oBAAoB,IAAIC,wBAAwB,EAChDC,wBAAwB,EACxBC,QAAQ,EACRC,WAAW,QACN,kCAAkC;AACzC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,mCAAmC;AAEvE,OAAOC,SAAS,MAAM,UAAU;AAChC,SAASC,aAAa,EAAEC,kBAAkB,EAAEC,YAAY,QAAQ,SAAS;AAAC;AAAA;AAE1E,IAAMV,oBAAoB,GAAG,SAAvBA,oBAAoB,OAYpB;EAAA;EAAA,IAXJW,kBAAkB,QAAlBA,kBAAkB;IAClBC,gBAAgB,QAAhBA,gBAAgB;IAChBC,IAAI,QAAJA,IAAI;IACJC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IACRC,WAAW,QAAXA,WAAW;IACXC,kBAAkB,QAAlBA,kBAAkB;IAClBC,mBAAmB,QAAnBA,mBAAmB;IACnBC,QAAQ,QAARA,QAAQ;IAELC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qD,IAAI;IACpBtC,IAAI,EAAEf,SAAS,CAACsD,KAAK;IACrBC,IAAI,EAAEvD,SAAS,CAACiD,MAAM;IACtBO,MAAM,EAAExD,SAAS,CAACiD;EACpB,CAAC,CAAC,CACH,CAACC,UAAU;EACZ;AACF;AACA;EACElC,QAAQ,EAAEhB,SAAS,CAACiD,MAAM;EAC1B;AACF;AACA;EACEhC,QAAQ,EAAEjB,SAAS,CAACyD,IAAI;EACxB;AACF;AACA;EACEvC,WAAW,EAAElB,SAAS,CAAC0D,MAAM;EAC7B;AACF;AACA;EACEvC,kBAAkB,EAAEnB,SAAS,CAAC0D,MAAM;EACpC;AACF;AACA;EACEtC,mBAAmB,EAAEpB,SAAS,CAAC0D,MAAM;EACrC;AACF;AACA;EACErC,QAAQ,EAAErB,SAAS,CAAC2D,KAAK,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC;AACjF,CAAC;AAEDzD,oBAAoB,CAAC0D,YAAY,GAAG;EAClC1C,WAAW,EAAE,EAAE;EACfC,kBAAkB,EAAE,GAAG;EACvBC,mBAAmB,EAAE,EAAE;EACvBC,QAAQ,EAAE;AACZ,CAAC;AAED,eAAetB,UAAU,CAACU,SAAS,EAAE;EAAEoD,IAAI,EAAE;AAAuB,CAAC,CAAC,CAAC3D,oBAAoB,CAAC"}
1
+ {"version":3,"file":"VerticalNavigation.js","names":["React","useState","withStyles","PropTypes","clsx","HvVerticalNavigation","HvVerticalNavigationCore","HvVerticalNavigationTree","HvButton","HvContainer","Backwards","Forwards","useStyles","findRootParentById","findItemById","pathToItem","onNavigationChange","onToggleExpanded","data","selected","expanded","topPosition","expandedPanelWidth","collapsedPanelWidth","position","others","classes","noSubData","map","dataToRemove","rest","expandedItems","setExpandedItems","selectedTopParent","id","handleVerticalNavigationChange","event","item","fullItem","length","prevState","handleVerticalNavigationToggle","currentExpandedItems","handleExpandToggle","panel","panelExpanded","panelCollapsed","toggleCollapsePanel","propTypes","func","arrayOf","shape","string","isRequired","label","icon","node","array","href","target","bool","number","oneOf","defaultProps","name"],"sources":["../../../src/VerticalNavigation/VerticalNavigation.js"],"sourcesContent":["import React, { useState } from \"react\";\nimport { withStyles } from \"@mui/styles\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport {\n HvVerticalNavigation as HvVerticalNavigationCore,\n HvVerticalNavigationTree,\n HvButton,\n HvContainer,\n} from \"@hitachivantara/uikit-react-core\";\nimport { Backwards, Forwards } from \"@hitachivantara/uikit-react-icons\";\n\nimport useStyles from \"./styles\";\nimport { findRootParentById, findItemById, pathToItem } from \"./utils\";\n\nconst HvVerticalNavigation = ({\n onNavigationChange,\n onToggleExpanded,\n data,\n selected,\n expanded,\n topPosition,\n expandedPanelWidth,\n collapsedPanelWidth,\n position,\n\n ...others\n}) => {\n const classes = useStyles({ topPosition, expandedPanelWidth, collapsedPanelWidth, position })();\n\n const noSubData = data.map(({ data: dataToRemove, ...rest }) => rest);\n\n const [expandedItems, setExpandedItems] = useState(pathToItem(data, selected));\n\n const selectedTopParent = findRootParentById(data, selected)?.id;\n\n const handleVerticalNavigationChange = (event, item) => {\n // This need to be done because the item recieved on the callback is missing the original data object\n const fullItem = findItemById(data, item.id);\n\n if (!expanded && fullItem.data && fullItem.data.length > 0) {\n setExpandedItems((prevState) => [...prevState, item.id]);\n onToggleExpanded(true);\n } else {\n onNavigationChange?.(event, item);\n }\n };\n\n const handleVerticalNavigationToggle = (event, currentExpandedItems) => {\n setExpandedItems(currentExpandedItems);\n };\n\n const handleExpandToggle = () => {\n onToggleExpanded(!expanded);\n };\n\n return (\n <HvVerticalNavigationCore\n className={clsx(classes.panel, {\n [classes.panelExpanded]: expanded,\n [classes.panelCollapsed]: !expanded,\n })}\n {...others}\n >\n <HvContainer className={`${classes.toggleCollapsePanel}`}>\n <HvButton icon onClick={handleExpandToggle}>\n {expanded ? <Backwards iconSize=\"XS\" /> : <Forwards iconSize=\"XS\" />}\n </HvButton>\n </HvContainer>\n\n <HvVerticalNavigationTree\n collapsible\n expanded={expandedItems}\n data={expanded ? data : noSubData}\n selected={expanded ? selected : selectedTopParent}\n onChange={handleVerticalNavigationChange}\n onToggle={handleVerticalNavigationToggle}\n />\n </HvVerticalNavigationCore>\n );\n};\n\nHvVerticalNavigation.propTypes = {\n /**\n * Called when a menu item is clicked.\n */\n onNavigationChange: PropTypes.func,\n /**\n * Called when the collapse / expand button is clicked.\n */\n onToggleExpanded: PropTypes.func,\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 * icon - the icon component.\n * data - sub-menu items\n * href - the url used for navigation.\n * target - the behavior when opening an url.\n */\n data: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n icon: PropTypes.node,\n data: PropTypes.array,\n href: PropTypes.string,\n target: PropTypes.string,\n })\n ).isRequired,\n /**\n * The ID of the selected page.\n */\n selected: PropTypes.string,\n /**\n * Boolean value stating if the panel should be collapsed or expanded.\n */\n expanded: PropTypes.bool,\n /**\n * The top value where the panel will be rendered. Default is 44 as it is the height of the Header component.\n */\n topPosition: PropTypes.number,\n /**\n * The width of the panel when expanded. Default value is 300.\n */\n expandedPanelWidth: PropTypes.number,\n /**\n * The width of the panel when collapsed. Default vlaue is 52.\n */\n collapsedPanelWidth: PropTypes.number,\n /**\n * Position of the component.\n */\n position: PropTypes.oneOf([\"static\", \"relative\", \"fixed\", \"absolute\", \"sticky\"]),\n};\n\nHvVerticalNavigation.defaultProps = {\n topPosition: 44,\n expandedPanelWidth: 300,\n collapsedPanelWidth: 52,\n position: \"fixed\",\n};\n\nexport default withStyles(useStyles, { name: \"HvVerticalNavigation\" })(HvVerticalNavigation);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,SAAS,MAAM,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AAE,GAAG;EACvBC,mBAAmB,EAAE,EAAE;EACvBC,QAAQ,EAAE;AACZ,CAAC;AAED,eAAetB,UAAU,CAACU,SAAS,EAAE;EAAEoD,IAAI,EAAE;AAAuB,CAAC,CAAC,CAAC3D,oBAAoB,CAAC"}
@@ -1,10 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import "core-js/modules/es.object.to-string.js";
3
3
  import "core-js/modules/es.array.find.js";
4
- import "core-js/modules/es.array.filter.js";
5
- import "core-js/modules/es.array.flat-map.js";
6
- import "core-js/modules/es.array.unscopables.flat-map.js";
7
- import "core-js/modules/es.array.concat.js";
8
4
  /**
9
5
  * Receives the navigation data and the id of the item from which we want to get the root parent.
10
6
  *
@@ -53,19 +49,31 @@ var findItemById = function findItemById(data, itemId) {
53
49
  };
54
50
 
55
51
  /**
56
- * Returns all the items that have chilren associated.
52
+ * Returns an array with all the parent item ids up until the target item is reached.
57
53
  *
58
54
  * @param {NavigationItem[]} data - The navigation data structure.
59
- * @returns All the items that have chilren associated.
55
+ * @param {string} itemId - The item id.
56
+ * @returns An array with all the parent item ids
60
57
  */
61
- var getAllParents = function getAllParents(items) {
62
- var parents = items.filter(function (item) {
63
- return item.data != null && item.data.length > 0;
64
- });
65
- var childParents = parents.flatMap(function (item) {
66
- return getAllParents(item.data);
67
- });
68
- return [].concat(_toConsumableArray(parents), _toConsumableArray(childParents));
58
+ var pathToItem = function pathToItem(data, itemId) {
59
+ var path = [];
60
+ if (data != null && data.length > 0) {
61
+ // eslint-disable-next-line no-plusplus
62
+ for (var i = 0; i < data.length; ++i) {
63
+ var item = data[i];
64
+ if (item.id === itemId) {
65
+ path.push(item.id);
66
+ break;
67
+ }
68
+ var subPaths = pathToItem(item.data, itemId);
69
+ if (subPaths.length > 0) {
70
+ path.push(item.id);
71
+ path.push.apply(path, _toConsumableArray(subPaths));
72
+ break;
73
+ }
74
+ }
75
+ }
76
+ return path;
69
77
  };
70
- export { findRootParentById, findItemById, getAllParents };
78
+ export { findRootParentById, findItemById, pathToItem };
71
79
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["findRootParentById","data","itemId","reduce","parent","item","id","found","findItemById","find","length","foundItem","getAllParents","items","parents","filter","childParents","flatMap"],"sources":["../../../src/VerticalNavigation/utils.js"],"sourcesContent":["/**\n * Receives the navigation data and the id of the item from which we want to get the root parent.\n *\n * @param {NavigationItem[]} data - The navigation data structure.\n * @param {string} itemId - The item id.\n * @returns The item that is the root parent of the received item.\n */\nconst findRootParentById = (data, itemId) => {\n return data.reduce((parent, item) => {\n if (parent) {\n return parent;\n }\n\n if (item.id === itemId) {\n return item;\n }\n\n if (item.data) {\n const found = findRootParentById(item.data, itemId);\n if (found) {\n return item;\n }\n }\n return null;\n }, null);\n};\n\n/**\n * Returns the complete item object from the data structure using the item id.\n *\n * @param {NavigationItem[]} data - The navigation data structure.\n * @param {string} itemId - The item id.\n * @returns The complete item object matching the received id.\n */\nconst findItemById = (data, itemId) => {\n return data.find((item) => {\n if (item.id === itemId) {\n return true;\n }\n\n if (item.data && item.data.length > 0) {\n const foundItem = findItemById(item.data, itemId);\n if (foundItem) {\n return true;\n }\n }\n return false;\n });\n};\n\n/**\n * Returns all the items that have chilren associated.\n *\n * @param {NavigationItem[]} data - The navigation data structure.\n * @returns All the items that have chilren associated.\n */\nconst getAllParents = (items) => {\n const parents = items.filter((item) => item.data != null && item.data.length > 0);\n const childParents = parents.flatMap((item) => getAllParents(item.data));\n\n return [...parents, ...childParents];\n};\n\nexport { findRootParentById, findItemById, getAllParents };\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkB,CAAIC,IAAI,EAAEC,MAAM,EAAK;EAC3C,OAAOD,IAAI,CAACE,MAAM,CAAC,UAACC,MAAM,EAAEC,IAAI,EAAK;IACnC,IAAID,MAAM,EAAE;MACV,OAAOA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AACrC,CAAC;AAED,SAAShB,kBAAkB,EAAEQ,YAAY,EAAEI,aAAa"}
1
+ {"version":3,"file":"utils.js","names":["findRootParentById","data","itemId","reduce","parent","item","id","found","findItemById","find","length","foundItem","pathToItem","path","i","push","subPaths"],"sources":["../../../src/VerticalNavigation/utils.js"],"sourcesContent":["/**\n * Receives the navigation data and the id of the item from which we want to get the root parent.\n *\n * @param {NavigationItem[]} data - The navigation data structure.\n * @param {string} itemId - The item id.\n * @returns The item that is the root parent of the received item.\n */\nconst findRootParentById = (data, itemId) => {\n return data.reduce((parent, item) => {\n if (parent) {\n return parent;\n }\n\n if (item.id === itemId) {\n return item;\n }\n\n if (item.data) {\n const found = findRootParentById(item.data, itemId);\n if (found) {\n return item;\n }\n }\n return null;\n }, null);\n};\n\n/**\n * Returns the complete item object from the data structure using the item id.\n *\n * @param {NavigationItem[]} data - The navigation data structure.\n * @param {string} itemId - The item id.\n * @returns The complete item object matching the received id.\n */\nconst findItemById = (data, itemId) => {\n return data.find((item) => {\n if (item.id === itemId) {\n return true;\n }\n\n if (item.data && item.data.length > 0) {\n const foundItem = findItemById(item.data, itemId);\n if (foundItem) {\n return true;\n }\n }\n return false;\n });\n};\n\n/**\n * Returns an array with all the parent item ids up until the target item is reached.\n *\n * @param {NavigationItem[]} data - The navigation data structure.\n * @param {string} itemId - The item id.\n * @returns An array with all the parent item ids\n */\nconst pathToItem = (data, itemId) => {\n const path = [];\n\n if (data != null && data.length > 0) {\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < data.length; ++i) {\n const item = data[i];\n if (item.id === itemId) {\n path.push(item.id);\n break;\n }\n\n const subPaths = pathToItem(item.data, itemId);\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 { findRootParentById, findItemById, pathToItem };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkB,CAAIC,I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,EAAE,EAAEI,CAAC,EAAE;MACpC,IAAMT,IAAI,GAAGJ,IAAI,CAACa,CAAC,CAAC;MACpB,IAAIT,IAAI,CAACC,EAAE,KAAKJ,MAAM,EAAE;QACtBW,IAAI,CAACE,IAAI,CAACV,IAAI,CAACC,EAAE,CAAC;QAClB;MACF;MAEA,IAAMU,QAAQ,GAAGJ,UAAU,CAACP,IAAI,CAACJ,IAAI,EAAEC,MAAM,CAAC;MAC9C,IAAIc,QAAQ,CAACN,MAAM,GAAG,CAAC,EAAE;QACvBG,IAAI,CAACE,IAAI,CAACV,IAAI,CAACC,EAAE,CAAC;QAClBO,IAAI,CAACE,IAAI,OAATF,IAAI,qBAASG,QAAQ,EAAC;QACtB;MACF;IACF;EACF;EAEA,OAAOH,IAAI;AACb,CAAC;AAED,SAASb,kBAAkB,EAAEQ,YAAY,EAAEI,UAAU"}
@@ -27,3 +27,6 @@ export * from "./Wizard";
27
27
 
28
28
  export { default as HvVerticalNavigation } from "./VerticalNavigation";
29
29
  export * from "./VerticalNavigation";
30
+
31
+ export { default as HvNavigationSlider } from "./NavigationSlider";
32
+ export * from "./NavigationSlider";
@@ -10,4 +10,5 @@ export * from "./TimeAgo";
10
10
  export { default as HvWizard } from "./Wizard";
11
11
  export * from "./Wizard";
12
12
  export { default as HvVerticalNavigation } from "./VerticalNavigation";
13
+ export { default as HvNavigationSlider } from "./NavigationSlider";
13
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","HvColorPicker","HvDrawer","HvImageCarousel","HvInlineEditor","HvNavigationAnchors","HvNotificationPanel","HvStepNavigation","HvTimeAgo","HvWizard","HvVerticalNavigation"],"sources":["../../src/index.js"],"sourcesContent":["export { default as HvColorPicker } from \"./ColorPicker\";\nexport { default as HvDrawer } from \"./Drawer\";\nexport { default as HvImageCarousel } from \"./ImageCarousel\";\nexport { default as HvInlineEditor } from \"./InlineEditor\";\nexport { default as HvNavigationAnchors } from \"./NavigationAnchors\";\nexport { default as HvNotificationPanel } from \"./NotificationPanel\";\nexport { default as HvStepNavigation } from \"./StepNavigation\";\nexport { default as HvTimeAgo } from \"./TimeAgo\";\nexport * from \"./TimeAgo\";\nexport { default as HvWizard } from \"./Wizard\";\nexport * from \"./Wizard\";\nexport { default as HvVerticalNavigation } from \"./VerticalNavigation\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,aAAa,QAAQ,eAAe;AACxD,SAASD,OAAO,IAAIE,QAAQ,QAAQ,UAAU;AAC9C,SAASF,OAAO,IAAIG,eAAe,QAAQ,iBAAiB;AAC5D,SAASH,OAAO,IAAII,cAAc,QAAQ,gBAAgB;AAC1D,SAASJ,OAAO,IAAIK,mBAAmB,QAAQ,qBAAqB;AACpE,SAASL,OAAO,IAAIM,mBAAmB,QAAQ,qBAAqB;AACpE,SAASN,OAAO,IAAIO,gBAAgB,QAAQ,kBAAkB;AAC9D,SAASP,OAAO,IAAIQ,SAAS,QAAQ,WAAW;AAChD,cAAc,WAAW;AACzB,SAASR,OAAO,IAAIS,QAAQ,QAAQ,UAAU;AAC9C,cAAc,UAAU;AACxB,SAAST,OAAO,IAAIU,oBAAoB,QAAQ,sBAAsB"}
1
+ {"version":3,"file":"index.js","names":["default","HvColorPicker","HvDrawer","HvImageCarousel","HvInlineEditor","HvNavigationAnchors","HvNotificationPanel","HvStepNavigation","HvTimeAgo","HvWizard","HvVerticalNavigation","HvNavigationSlider"],"sources":["../../src/index.js"],"sourcesContent":["export { default as HvColorPicker } from \"./ColorPicker\";\nexport { default as HvDrawer } from \"./Drawer\";\nexport { default as HvImageCarousel } from \"./ImageCarousel\";\nexport { default as HvInlineEditor } from \"./InlineEditor\";\nexport { default as HvNavigationAnchors } from \"./NavigationAnchors\";\nexport { default as HvNotificationPanel } from \"./NotificationPanel\";\nexport { default as HvStepNavigation } from \"./StepNavigation\";\nexport { default as HvTimeAgo } from \"./TimeAgo\";\nexport * from \"./TimeAgo\";\nexport { default as HvWizard } from \"./Wizard\";\nexport * from \"./Wizard\";\nexport { default as HvVerticalNavigation } from \"./VerticalNavigation\";\nexport { default as HvNavigationSlider } from \"./NavigationSlider\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,aAAa,QAAQ,eAAe;AACxD,SAASD,OAAO,IAAIE,QAAQ,QAAQ,UAAU;AAC9C,SAASF,OAAO,IAAIG,eAAe,QAAQ,iBAAiB;AAC5D,SAASH,OAAO,IAAII,cAAc,QAAQ,gBAAgB;AAC1D,SAASJ,OAAO,IAAIK,mBAAmB,QAAQ,qBAAqB;AACpE,SAASL,OAAO,IAAIM,mBAAmB,QAAQ,qBAAqB;AACpE,SAASN,OAAO,IAAIO,gBAAgB,QAAQ,kBAAkB;AAC9D,SAASP,OAAO,IAAIQ,SAAS,QAAQ,WAAW;AAChD,cAAc,WAAW;AACzB,SAASR,OAAO,IAAIS,QAAQ,QAAQ,UAAU;AAC9C,cAAc,UAAU;AACxB,SAAST,OAAO,IAAIU,oBAAoB,QAAQ,sBAAsB;AACtE,SAASV,OAAO,IAAIW,kBAAkB,QAAQ,oBAAoB"}
@@ -0,0 +1,72 @@
1
+ var _Backwards;
2
+ import React from "react";
3
+ import { withStyles } from "@mui/styles";
4
+ import PropTypes from "prop-types";
5
+ import { HvButton, HvTypography } from "@hitachivantara/uikit-react-core";
6
+ import { Backwards } from "@hitachivantara/uikit-react-icons";
7
+ import useStyles from "./styles";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ const Header = ({
11
+ id,
12
+ title,
13
+ showBackButton,
14
+ headerHeight,
15
+ onBackButtonClick
16
+ }) => {
17
+ const classes = useStyles({
18
+ headerHeight
19
+ })();
20
+ const backButtonClickHandler = () => {
21
+ onBackButtonClick();
22
+ };
23
+ return /*#__PURE__*/_jsxs("div", {
24
+ id: id,
25
+ className: classes.menuContainer,
26
+ children: [/*#__PURE__*/_jsx("div", {
27
+ className: classes.button,
28
+ children: showBackButton && /*#__PURE__*/_jsx(HvButton, {
29
+ icon: true,
30
+ onClick: backButtonClickHandler,
31
+ children: _Backwards || (_Backwards = /*#__PURE__*/_jsx(Backwards, {
32
+ iconSize: "XS"
33
+ }))
34
+ })
35
+ }), /*#__PURE__*/_jsx("div", {
36
+ className: `${classes.title} ${classes.justifyContentCenter}`,
37
+ children: title && /*#__PURE__*/_jsx(HvTypography, {
38
+ variant: "highlightText",
39
+ children: title
40
+ })
41
+ })]
42
+ });
43
+ };
44
+ process.env.NODE_ENV !== "production" ? Header.propTypes = {
45
+ /**
46
+ * Id to be applied to the root node of the panel.
47
+ */
48
+ id: PropTypes.string,
49
+ /**
50
+ * The text to be displayed on the header.
51
+ */
52
+ title: PropTypes.string,
53
+ /**
54
+ * Flag to show / hide the back button.
55
+ */
56
+ showBackButton: PropTypes.bool,
57
+ /**
58
+ * The header height.
59
+ */
60
+ headerHeight: PropTypes.number,
61
+ /**
62
+ * Callback function triggered when the back button is clicked.
63
+ */
64
+ onBackButtonClick: PropTypes.func
65
+ } : void 0;
66
+ Header.defaultProps = {
67
+ headerHeight: 80
68
+ };
69
+ export default withStyles(useStyles, {
70
+ name: "Header"
71
+ })(Header);
72
+ //# sourceMappingURL=Header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Header.js","names":["React","withStyles","PropTypes","HvButton","HvTypography","Backwards","useStyles","Header","id","title","showBackButton","headerHeight","onBackButtonClick","classes","backButtonClickHandler","menuContainer","button","justifyContentCenter","propTypes","string","bool","number","func","defaultProps","name"],"sources":["../../../../src/NavigationSlider/Header/Header.js"],"sourcesContent":["import React from \"react\";\nimport { withStyles } from \"@mui/styles\";\nimport PropTypes from \"prop-types\";\n\nimport { HvButton, HvTypography } from \"@hitachivantara/uikit-react-core\";\nimport { Backwards } from \"@hitachivantara/uikit-react-icons\";\n\nimport useStyles from \"./styles\";\n\nconst Header = ({ id, title, showBackButton, headerHeight, onBackButtonClick }) => {\n const classes = useStyles({ headerHeight })();\n\n const backButtonClickHandler = () => {\n onBackButtonClick();\n };\n\n return (\n <div id={id} className={classes.menuContainer}>\n <div className={classes.button}>\n {showBackButton && (\n <HvButton icon onClick={backButtonClickHandler}>\n <Backwards iconSize=\"XS\" />\n </HvButton>\n )}\n </div>\n\n <div className={`${classes.title} ${classes.justifyContentCenter}`}>\n {title && <HvTypography variant=\"highlightText\">{title}</HvTypography>}\n </div>\n </div>\n );\n};\n\nHeader.propTypes = {\n /**\n * Id to be applied to the root node of the panel.\n */\n id: PropTypes.string,\n /**\n * The text to be displayed on the header.\n */\n title: PropTypes.string,\n /**\n * Flag to show / hide the back button.\n */\n showBackButton: PropTypes.bool,\n /**\n * The header height.\n */\n headerHeight: PropTypes.number,\n /**\n * Callback function triggered when the back button is clicked.\n */\n onBackButtonClick: PropTypes.func,\n};\n\nHeader.defaultProps = {\n headerHeight: 80,\n};\n\nexport default withStyles(useStyles, { name: \"Header\" })(Header);\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,SAAS,MAAM,YAAY;AAElC,SAASC,QAAQ,EAAEC,YAAY,QAAQ,kCAAkC;AACzE,SAASC,SAAS,QAAQ,mCAAmC;AAE7D,OAAOC,SAAS,MAAM,UAAU;AAAC;AAAA;AAEjC,MAAMC,MAAM,GAAG,CAAC;EAAEC,EAAE;EAAEC,KAAK;EAAEC,cAAc;EAAEC,YAAY;EAAEC;AAAkB,CAAC,KAAK;EACjF,MAAMC,OAAO,GAAGP,SAAS,CAAC;IAAEK;EAAa,CAAC,CAAC,EAAE;EAE7C,MAAMG,sBAAsB,GAAG,MAAM;IACnCF,iBAAiB,EAAE;EACrB,CAAC;EAED,oBACE;IAAK,EAAE,EAAEJ,EAAG;IAAC,SAAS,EAAEK,OAAO,CAACE,aAAc;IAAA,wBAC5C;MAAK,SAAS,EAAEF,OAAO,CAACG,MAAO;MAAA,UAC5BN,cAAc,iBACb,KAAC,QAAQ;QAAC,IAAI;QAAC,OAAO,EAAEI,sBAAuB;QAAA,mDAC7C,KAAC,SAAS;UAAC,QAAQ,EAAC;QAAI,EAAG;MAAA;IAE9B,EACG,eAEN;MAAK,SAAS,EAAG,GAAED,OAAO,CAACJ,KAAM,IAAGI,OAAO,CAACI,oBAAqB,EAAE;MAAA,UAChER,KAAK,iBAAI,KAAC,YAAY;QAAC,OAAO,EAAC,eAAe;QAAA,UAAEA;MAAK;IAAgB,EAClE;EAAA,EACF;AAEV,CAAC;AAED,wCAAAF,MAAM,CAACW,SAAS,GAAG;EACjB;AACF;AACA;EACEV,EAAE,EAAEN,SAAS,CAACiB,MAAM;EACpB;AACF;AACA;EACEV,KAAK,EAAEP,SAAS,CAACiB,MAAM;EACvB;AACF;AACA;EACET,cAAc,EAAER,SAAS,CAACkB,IAAI;EAC9B;AACF;AACA;EACET,YAAY,EAAET,SAAS,CAACmB,MAAM;EAC9B;AACF;AACA;EACET,iBAAiB,EAAEV,SAAS,CAACoB;AAC/B,CAAC;AAEDf,MAAM,CAACgB,YAAY,GAAG;EACpBZ,YAAY,EAAE;AAChB,CAAC;AAED,eAAeV,UAAU,CAACK,SAAS,EAAE;EAAEkB,IAAI,EAAE;AAAS,CAAC,CAAC,CAACjB,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from "./Header";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["default"],"sources":["../../../../src/NavigationSlider/Header/index.js"],"sourcesContent":["export { default } from \"./Header\";\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,UAAU"}
@@ -0,0 +1,25 @@
1
+ import { makeStyles } from "@mui/styles";
2
+ const styles = props => makeStyles(theme => ({
3
+ menuContainer: {
4
+ display: "grid",
5
+ gridTemplateColumns: "min-content auto",
6
+ minHeight: props.headerHeight,
7
+ boxShadow: "inset 0 5px 5px -3px rgb(65 65 65 / 12%)"
8
+ },
9
+ button: {
10
+ display: "flex",
11
+ alignItems: "center"
12
+ },
13
+ title: {
14
+ display: "flex",
15
+ alignItems: "center",
16
+ justifyContent: "center",
17
+ minHeight: theme.hv.spacing.sm,
18
+ padding: theme.hvSpacing(0, "xs")
19
+ },
20
+ justifyContentCenter: {
21
+ justifyContent: "center"
22
+ }
23
+ }));
24
+ export default styles;
25
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","names":["makeStyles","styles","props","theme","menuContainer","display","gridTemplateColumns","minHeight","headerHeight","boxShadow","button","alignItems","title","justifyContent","hv","spacing","sm","padding","hvSpacing","justifyContentCenter"],"sources":["../../../../src/NavigationSlider/Header/styles.js"],"sourcesContent":["import { makeStyles } from \"@mui/styles\";\n\nconst styles = (props) =>\n makeStyles((theme) => ({\n menuContainer: {\n display: \"grid\",\n gridTemplateColumns: \"min-content auto\",\n minHeight: props.headerHeight,\n boxShadow: \"inset 0 5px 5px -3px rgb(65 65 65 / 12%)\",\n },\n button: {\n display: \"flex\",\n alignItems: \"center\",\n },\n title: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n minHeight: theme.hv.spacing.sm,\n padding: theme.hvSpacing(0, \"xs\"),\n },\n justifyContentCenter: { justifyContent: \"center\" },\n }));\n\nexport default styles;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,aAAa;AAExC,MAAMC,MAAM,GAAIC,KAAK,IACnBF,UAAU,CAAEG,KAAK,KAAM;EACrBC,aAAa,EAAE;IACbC,OAAO,EAAE,MAAM;IACfC,mBAAmB,EAAE,kBAAkB;IACvCC,SAAS,EAAEL,KAAK,CAACM,YAAY;IAC7BC,SAAS,EAAE;EACb,CAAC;EACDC,MAAM,EAAE;IACNL,OAAO,EAAE,MAAM;IACfM,UAAU,EAAE;EACd,CAAC;EACDC,KAAK,EAAE;IACLP,OAAO,EAAE,MAAM;IACfM,UAAU,EAAE,QAAQ;IACpBE,cAAc,EAAE,QAAQ;IACxBN,SAAS,EAAEJ,KAAK,CAACW,EAAE,CAACC,OAAO,CAACC,EAAE;IAC9BC,OAAO,EAAEd,KAAK,CAACe,SAAS,CAAC,CAAC,EAAE,IAAI;EAClC,CAAC;EACDC,oBAAoB,EAAE;IAAEN,cAAc,EAAE;EAAS;AACnD,CAAC,CAAC,CAAC;AAEL,eAAeZ,MAAM"}