@hitachivantara/uikit-react-core 5.71.0 → 5.72.1

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 (82) hide show
  1. package/dist/cjs/DropdownButton/DropdownButton.cjs +1 -8
  2. package/dist/cjs/DropdownButton/DropdownButton.styles.cjs +0 -3
  3. package/dist/cjs/Header/Actions/Actions.cjs +4 -3
  4. package/dist/cjs/Header/Brand/Brand.cjs +4 -3
  5. package/dist/cjs/Header/Navigation/MenuItem/MenuItem.cjs +13 -28
  6. package/dist/cjs/Header/Navigation/MenuItem/MenuItem.styles.cjs +11 -43
  7. package/dist/cjs/Header/Navigation/Navigation.cjs +4 -3
  8. package/dist/cjs/SimpleGrid/SimpleGrid.cjs +2 -2
  9. package/dist/cjs/SimpleGrid/SimpleGrid.styles.cjs +17 -22
  10. package/dist/cjs/Typography/Typography.cjs +2 -1
  11. package/dist/cjs/Typography/Typography.styles.cjs +23 -24
  12. package/dist/cjs/VerticalNavigation/Actions/Action.cjs +4 -18
  13. package/dist/cjs/VerticalNavigation/Actions/Action.styles.cjs +4 -17
  14. package/dist/cjs/VerticalNavigation/Actions/Actions.styles.cjs +3 -5
  15. package/dist/cjs/VerticalNavigation/Header/Header.styles.cjs +7 -2
  16. package/dist/cjs/VerticalNavigation/Navigation/Navigation.cjs +3 -3
  17. package/dist/cjs/VerticalNavigation/Navigation/Navigation.styles.cjs +0 -2
  18. package/dist/cjs/VerticalNavigation/NavigationSlider/NavigationSlider.cjs +1 -1
  19. package/dist/cjs/VerticalNavigation/NavigationSlider/NavigationSlider.styles.cjs +7 -1
  20. package/dist/cjs/VerticalNavigation/TreeView/TreeView.styles.cjs +0 -2
  21. package/dist/cjs/VerticalNavigation/TreeView/TreeViewItem.cjs +32 -21
  22. package/dist/cjs/VerticalNavigation/TreeView/TreeViewItem.styles.cjs +4 -0
  23. package/dist/cjs/VerticalNavigation/VerticalNavigation.cjs +12 -18
  24. package/dist/cjs/VerticalNavigation/VerticalNavigation.styles.cjs +1 -1
  25. package/dist/esm/DropdownButton/DropdownButton.js +1 -8
  26. package/dist/esm/DropdownButton/DropdownButton.js.map +1 -1
  27. package/dist/esm/DropdownButton/DropdownButton.styles.js +0 -3
  28. package/dist/esm/DropdownButton/DropdownButton.styles.js.map +1 -1
  29. package/dist/esm/Header/Actions/Actions.js +4 -3
  30. package/dist/esm/Header/Actions/Actions.js.map +1 -1
  31. package/dist/esm/Header/Brand/Brand.js +4 -3
  32. package/dist/esm/Header/Brand/Brand.js.map +1 -1
  33. package/dist/esm/Header/Navigation/MenuItem/MenuItem.js +13 -28
  34. package/dist/esm/Header/Navigation/MenuItem/MenuItem.js.map +1 -1
  35. package/dist/esm/Header/Navigation/MenuItem/MenuItem.styles.js +11 -43
  36. package/dist/esm/Header/Navigation/MenuItem/MenuItem.styles.js.map +1 -1
  37. package/dist/esm/Header/Navigation/Navigation.js +4 -3
  38. package/dist/esm/Header/Navigation/Navigation.js.map +1 -1
  39. package/dist/esm/SimpleGrid/SimpleGrid.js +2 -2
  40. package/dist/esm/SimpleGrid/SimpleGrid.js.map +1 -1
  41. package/dist/esm/SimpleGrid/SimpleGrid.styles.js +17 -22
  42. package/dist/esm/SimpleGrid/SimpleGrid.styles.js.map +1 -1
  43. package/dist/esm/Typography/Typography.js +2 -1
  44. package/dist/esm/Typography/Typography.js.map +1 -1
  45. package/dist/esm/Typography/Typography.styles.js +23 -24
  46. package/dist/esm/Typography/Typography.styles.js.map +1 -1
  47. package/dist/esm/VerticalNavigation/Actions/Action.js +5 -19
  48. package/dist/esm/VerticalNavigation/Actions/Action.js.map +1 -1
  49. package/dist/esm/VerticalNavigation/Actions/Action.styles.js +4 -17
  50. package/dist/esm/VerticalNavigation/Actions/Action.styles.js.map +1 -1
  51. package/dist/esm/VerticalNavigation/Actions/Actions.styles.js +3 -5
  52. package/dist/esm/VerticalNavigation/Actions/Actions.styles.js.map +1 -1
  53. package/dist/esm/VerticalNavigation/Header/Header.styles.js +7 -2
  54. package/dist/esm/VerticalNavigation/Header/Header.styles.js.map +1 -1
  55. package/dist/esm/VerticalNavigation/Navigation/Navigation.js +1 -1
  56. package/dist/esm/VerticalNavigation/Navigation/Navigation.js.map +1 -1
  57. package/dist/esm/VerticalNavigation/Navigation/Navigation.styles.js +0 -2
  58. package/dist/esm/VerticalNavigation/Navigation/Navigation.styles.js.map +1 -1
  59. package/dist/esm/VerticalNavigation/NavigationSlider/NavigationSlider.js +1 -1
  60. package/dist/esm/VerticalNavigation/NavigationSlider/NavigationSlider.js.map +1 -1
  61. package/dist/esm/VerticalNavigation/NavigationSlider/NavigationSlider.styles.js +7 -1
  62. package/dist/esm/VerticalNavigation/NavigationSlider/NavigationSlider.styles.js.map +1 -1
  63. package/dist/esm/VerticalNavigation/NavigationSlider/utils.js.map +1 -0
  64. package/dist/esm/VerticalNavigation/TreeView/TreeView.styles.js +0 -2
  65. package/dist/esm/VerticalNavigation/TreeView/TreeView.styles.js.map +1 -1
  66. package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js +33 -22
  67. package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js.map +1 -1
  68. package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.styles.js +4 -0
  69. package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.styles.js.map +1 -1
  70. package/dist/esm/VerticalNavigation/VerticalNavigation.js +9 -15
  71. package/dist/esm/VerticalNavigation/VerticalNavigation.js.map +1 -1
  72. package/dist/esm/VerticalNavigation/VerticalNavigation.styles.js +1 -1
  73. package/dist/esm/VerticalNavigation/VerticalNavigation.styles.js.map +1 -1
  74. package/dist/esm/VerticalNavigation/VerticalNavigationContext.js.map +1 -1
  75. package/dist/types/index.d.ts +31 -40
  76. package/package.json +6 -6
  77. package/dist/cjs/VerticalNavigation/TreeView/IconWrapper/IconWrapper.cjs +0 -20
  78. package/dist/esm/VerticalNavigation/NavigationSlider/utils/NavigationSlider.utils.js.map +0 -1
  79. package/dist/esm/VerticalNavigation/TreeView/IconWrapper/IconWrapper.js +0 -20
  80. package/dist/esm/VerticalNavigation/TreeView/IconWrapper/IconWrapper.js.map +0 -1
  81. /package/dist/cjs/VerticalNavigation/NavigationSlider/{utils/NavigationSlider.utils.cjs → utils.cjs} +0 -0
  82. /package/dist/esm/VerticalNavigation/NavigationSlider/{utils/NavigationSlider.utils.js → utils.js} +0 -0
@@ -10,9 +10,9 @@ const setId = require("../../utils/setId.cjs");
10
10
  const VerticalNavigationContext = require("../VerticalNavigationContext.cjs");
11
11
  const TreeViewContext = require("./TreeViewContext.cjs");
12
12
  const TreeViewItem_styles = require("./TreeViewItem.styles.cjs");
13
- const IconWrapper = require("./IconWrapper/IconWrapper.cjs");
14
13
  const Tooltip = require("../../Tooltip/Tooltip.cjs");
15
14
  const Typography = require("../../Typography/Typography.cjs");
15
+ const Avatar = require("../../Avatar/Avatar.cjs");
16
16
  const OverflowTooltip = require("../../OverflowTooltip/OverflowTooltip.cjs");
17
17
  const preventSelection = (event, disabled) => {
18
18
  if (event.shiftKey || event.ctrlKey || event.metaKey || disabled) {
@@ -271,10 +271,12 @@ const HvVerticalNavigationTreeViewItem = React.forwardRef(
271
271
  component: isLink ? "a" : "div",
272
272
  ...isLink ? buttonLinkProps : null,
273
273
  ref: contentRef,
274
- className: cx(classes.content, {
275
- [classes.link]: isLink,
276
- [classes.minimized]: !isOpen
277
- }),
274
+ classes: {
275
+ root: cx(classes.content, {
276
+ [classes.link]: isLink,
277
+ [classes.minimized]: !isOpen
278
+ })
279
+ },
278
280
  variant: "body",
279
281
  disabled,
280
282
  onClick: handleClick,
@@ -295,22 +297,25 @@ const HvVerticalNavigationTreeViewItem = React.forwardRef(
295
297
  "aria-label": payload?.label
296
298
  },
297
299
  children: [
298
- /* @__PURE__ */ jsxRuntime.jsx(
299
- IconWrapper.IconWrapper,
300
+ /* @__PURE__ */ jsxRuntime.jsxs(
301
+ "div",
300
302
  {
301
- icon: useIcons && icon,
302
- label: payload?.label,
303
- hasChildren,
304
- showAvatar: !icon && useIcons,
305
- isOpen,
306
- hasAnyChildWithData,
307
- style: uikitReactUtils.mergeStyles(
308
- {},
309
- {
310
- "--icon-margin-left": hasAnyChildWithData ? "auto" : "unset"
311
- }
312
- ),
313
- className: classes.icon
303
+ className: classes.icon,
304
+ style: uikitReactUtils.mergeStyles(void 0, {
305
+ "--icon-margin-left": hasAnyChildWithData ? "auto" : "unset"
306
+ }),
307
+ children: [
308
+ !icon && useIcons ? /* @__PURE__ */ jsxRuntime.jsx(
309
+ Avatar.HvAvatar,
310
+ {
311
+ variant: "square",
312
+ size: "xs",
313
+ backgroundColor: "secondary_80",
314
+ children: payload?.label?.substring(0, 1)
315
+ }
316
+ ) : useIcons && icon,
317
+ hasChildren && !isOpen ? /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Forwards, { iconSize: "XS" }) : hasAnyChildWithData && !isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", {})
318
+ ]
314
319
  }
315
320
  ),
316
321
  isOpen && /* @__PURE__ */ jsxRuntime.jsx(
@@ -323,7 +328,13 @@ const HvVerticalNavigationTreeViewItem = React.forwardRef(
323
328
  children: /* @__PURE__ */ jsxRuntime.jsx(OverflowTooltip.HvOverflowTooltip, { data: label })
324
329
  }
325
330
  ),
326
- isOpen && expandable && (expanded ? /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.DropUpXS, {}) : /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.DropDownXS, {}))
331
+ isOpen && expandable && /* @__PURE__ */ jsxRuntime.jsx(
332
+ uikitReactIcons.DropDownXS,
333
+ {
334
+ color: "currentcolor",
335
+ style: { rotate: expanded ? "180deg" : void 0 }
336
+ }
337
+ )
327
338
  ]
328
339
  }
329
340
  ) });
@@ -42,6 +42,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses(
42
42
  width: "100%",
43
43
  display: "flex",
44
44
  justifyContent: "flex-start",
45
+ color: "inherit",
45
46
  alignItems: "center",
46
47
  height: "32px",
47
48
  borderLeft: `4px solid transparent`,
@@ -127,6 +128,9 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses(
127
128
  },
128
129
  icon: {
129
130
  display: "flex",
131
+ "& .color0": {
132
+ fill: "currentColor"
133
+ },
130
134
  "> div:first-of-type": {
131
135
  marginLeft: "var(--icon-margin-left)"
132
136
  },
@@ -3,11 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
6
+ const utils = require("./NavigationSlider/utils.cjs");
6
7
  const VerticalNavigation_utils = require("./utils/VerticalNavigation.utils.cjs");
7
8
  const VerticalNavigation_styles = require("./VerticalNavigation.styles.cjs");
8
9
  const VerticalNavigationContext = require("./VerticalNavigationContext.cjs");
9
- const NavigationSlider_utils = require("./NavigationSlider/utils/NavigationSlider.utils.cjs");
10
- const HvVerticalNavigation = (props) => {
10
+ const HvVerticalNavigation = React.forwardRef((props, ref) => {
11
11
  const {
12
12
  id,
13
13
  className,
@@ -21,13 +21,12 @@ const HvVerticalNavigation = (props) => {
21
21
  const { classes, cx } = VerticalNavigation_styles.useClasses(classesProp);
22
22
  const [parentData, setParentData] = React.useState([]);
23
23
  const [parentSelected, setParentSelected] = React.useState();
24
- const [headerTitle, setHeaderTitle] = React.useState();
25
24
  const withParentData = React.useMemo(
26
- () => NavigationSlider_utils.fillDataWithParentId(parentData),
25
+ () => utils.fillDataWithParentId(parentData),
27
26
  [parentData]
28
27
  );
29
28
  const initialParentItem = React.useMemo(
30
- () => NavigationSlider_utils.getParentItemById(withParentData, parentSelected),
29
+ () => utils.getParentItemById(withParentData, parentSelected),
31
30
  [withParentData, parentSelected]
32
31
  );
33
32
  const [parentItem, setParentItem] = React.useState(initialParentItem);
@@ -35,19 +34,16 @@ const HvVerticalNavigation = (props) => {
35
34
  () => VerticalNavigation_utils.hasChildNavigationItems(parentData),
36
35
  [parentData]
37
36
  );
38
- React.useEffect(
39
- () => setHeaderTitle(parentItem?.label),
40
- [parentItem, setParentItem]
41
- );
37
+ const headerTitle = React.useMemo(() => parentItem?.label, [parentItem]);
42
38
  const navigateToParentHandler = React.useCallback(() => {
43
- setParentItem(NavigationSlider_utils.getParentItemById(withParentData, parentItem.id));
44
- }, [parentItem, setParentItem, withParentData]);
39
+ setParentItem(utils.getParentItemById(withParentData, parentItem.id));
40
+ }, [parentItem, withParentData]);
45
41
  const navigateToChildHandler = React.useCallback(
46
42
  (event, item) => {
47
- setParentItem(NavigationSlider_utils.getNavigationItemById(withParentData, item.id));
43
+ setParentItem(utils.getNavigationItemById(withParentData, item.id));
48
44
  event.stopPropagation();
49
45
  },
50
- [setParentItem, withParentData]
46
+ [withParentData]
51
47
  );
52
48
  const value = React.useMemo(
53
49
  () => ({
@@ -55,7 +51,6 @@ const HvVerticalNavigation = (props) => {
55
51
  useIcons,
56
52
  slider,
57
53
  headerTitle,
58
- setHeaderTitle,
59
54
  parentItem,
60
55
  setParentItem,
61
56
  withParentData,
@@ -72,7 +67,6 @@ const HvVerticalNavigation = (props) => {
72
67
  useIcons,
73
68
  slider,
74
69
  headerTitle,
75
- setHeaderTitle,
76
70
  parentItem,
77
71
  setParentItem,
78
72
  withParentData,
@@ -83,10 +77,11 @@ const HvVerticalNavigation = (props) => {
83
77
  parentSelected
84
78
  ]
85
79
  );
86
- const content = /* @__PURE__ */ jsxRuntime.jsx(VerticalNavigationContext.VerticalNavigationContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(
80
+ return /* @__PURE__ */ jsxRuntime.jsx(VerticalNavigationContext.VerticalNavigationContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(
87
81
  "div",
88
82
  {
89
83
  id,
84
+ ref,
90
85
  className: cx(
91
86
  classes.root,
92
87
  {
@@ -100,7 +95,6 @@ const HvVerticalNavigation = (props) => {
100
95
  children
101
96
  }
102
97
  ) });
103
- return content;
104
- };
98
+ });
105
99
  exports.verticalNavigationClasses = VerticalNavigation_styles.staticClasses;
106
100
  exports.HvVerticalNavigation = HvVerticalNavigation;
@@ -10,7 +10,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses(
10
10
  flexDirection: "column",
11
11
  justifyContent: "flex-start",
12
12
  width: "220px",
13
- background: uikitStyles.theme.colors.atmo1,
13
+ backgroundColor: uikitStyles.theme.colors.atmo1,
14
14
  boxShadow: uikitStyles.theme.colors.shadow,
15
15
  clipPath: "inset(0px -12px 0px 0px)",
16
16
  "& > :only-child": {
@@ -19,14 +19,7 @@ const HvDropdownButton = forwardRef((props, ref) => {
19
19
  ...others
20
20
  } = useDefaultProps("HvDropdownButton", props);
21
21
  const { classes, cx } = useClasses(classesProp);
22
- const endIcon = icon ? void 0 : /* @__PURE__ */ jsx(
23
- DropDownXS,
24
- {
25
- iconSize: "XS",
26
- style: { rotate: open ? "180deg" : void 0 },
27
- className: classes.arrow
28
- }
29
- );
22
+ const endIcon = icon ? void 0 : /* @__PURE__ */ jsx(DropDownXS, { iconSize: "XS", style: { rotate: open ? "180deg" : void 0 } });
30
23
  return /* @__PURE__ */ jsx(
31
24
  HvButton,
32
25
  {
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.js","sources":["../../../src/DropdownButton/DropdownButton.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { Placement } from \"@popperjs/core\";\nimport { DropDownXS } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvButton, HvButtonProps } from \"../Button\";\nimport { staticClasses, useClasses } from \"./DropdownButton.styles\";\n\nexport { staticClasses as dropdownButtonClasses };\n\nexport type HvDropdownButtonClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDropdownButtonProps\n extends Omit<HvButtonProps, \"startAdornment\" | \"endAdornment\" | \"classes\"> {\n /** Whether the button is in read only mode when used as a form element. */\n readOnly?: boolean;\n /** Whether the content triggered by the button is opened or not. */\n open?: boolean;\n /** Placement of the content triggered by the button. @default bottom */\n placement?: Placement;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvDropdownButtonClasses;\n}\n\n/**\n * IMPORTANT: This component is not ready to be exported to external users.\n *\n * Implements the DS dropdown button pattern.\n */\nexport const HvDropdownButton = forwardRef<\n HTMLButtonElement,\n HvDropdownButtonProps\n>((props, ref) => {\n const {\n className,\n classes: classesProp,\n placement = \"bottom\",\n disabled,\n open,\n icon,\n readOnly,\n children,\n variant,\n ...others\n } = useDefaultProps(\"HvDropdownButton\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const endIcon = icon ? undefined : (\n <DropDownXS\n iconSize=\"XS\"\n style={{ rotate: open ? \"180deg\" : undefined }}\n className={classes.arrow}\n />\n );\n\n return (\n <HvButton\n ref={ref}\n icon={icon}\n disabled={disabled || readOnly}\n className={cx(\n classes.root,\n {\n [classes.open]: open,\n [classes.openUp]: open && placement.includes(\"top\"),\n [classes.openDown]: open && placement.includes(\"bottom\"),\n [classes.disabled]: disabled,\n [classes.readOnly]: readOnly,\n },\n className,\n )}\n classes={{ endIcon: classes.arrowContainer }}\n endIcon={endIcon}\n variant={open ? \"secondarySubtle\" : variant}\n {...others}\n >\n <div className={cx({ [classes.selection]: !icon })}>\n {children && typeof children === \"string\" ? (\n <div className={classes.placeholder}>{children}</div>\n ) : (\n children\n )}\n </div>\n </HvButton>\n );\n});\n"],"names":[],"mappings":";;;;;;;AAgCO,MAAM,mBAAmB,WAG9B,CAAC,OAAO,QAAQ;AACV,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,oBAAoB,KAAK;AAE7C,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAExC,QAAA,UAAU,OAAO,SACrB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAS;AAAA,MACT,OAAO,EAAE,QAAQ,OAAO,WAAW,OAAU;AAAA,MAC7C,WAAW,QAAQ;AAAA,IAAA;AAAA,EAAA;AAKrB,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,UAAU,YAAY;AAAA,MACtB,WAAW;AAAA,QACT,QAAQ;AAAA,QACR;AAAA,UACE,CAAC,QAAQ,IAAI,GAAG;AAAA,UAChB,CAAC,QAAQ,MAAM,GAAG,QAAQ,UAAU,SAAS,KAAK;AAAA,UAClD,CAAC,QAAQ,QAAQ,GAAG,QAAQ,UAAU,SAAS,QAAQ;AAAA,UACvD,CAAC,QAAQ,QAAQ,GAAG;AAAA,UACpB,CAAC,QAAQ,QAAQ,GAAG;AAAA,QACtB;AAAA,QACA;AAAA,MACF;AAAA,MACA,SAAS,EAAE,SAAS,QAAQ,eAAe;AAAA,MAC3C;AAAA,MACA,SAAS,OAAO,oBAAoB;AAAA,MACnC,GAAG;AAAA,MAEJ,UAAA,oBAAC,OAAI,EAAA,WAAW,GAAG,EAAE,CAAC,QAAQ,SAAS,GAAG,CAAC,KAAK,CAAC,GAC9C,UAAY,YAAA,OAAO,aAAa,WAC9B,oBAAA,OAAA,EAAI,WAAW,QAAQ,aAAc,UAAS,IAE/C,SAEJ,CAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
1
+ {"version":3,"file":"DropdownButton.js","sources":["../../../src/DropdownButton/DropdownButton.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { Placement } from \"@popperjs/core\";\nimport { DropDownXS } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvButton, HvButtonProps } from \"../Button\";\nimport { staticClasses, useClasses } from \"./DropdownButton.styles\";\n\nexport { staticClasses as dropdownButtonClasses };\n\nexport type HvDropdownButtonClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDropdownButtonProps\n extends Omit<HvButtonProps, \"startAdornment\" | \"endAdornment\" | \"classes\"> {\n /** Whether the button is in read only mode when used as a form element. */\n readOnly?: boolean;\n /** Whether the content triggered by the button is opened or not. */\n open?: boolean;\n /** Placement of the content triggered by the button. @default bottom */\n placement?: Placement;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvDropdownButtonClasses;\n}\n\n/**\n * IMPORTANT: This component is not ready to be exported to external users.\n *\n * Implements the DS dropdown button pattern.\n */\nexport const HvDropdownButton = forwardRef<\n HTMLButtonElement,\n HvDropdownButtonProps\n>((props, ref) => {\n const {\n className,\n classes: classesProp,\n placement = \"bottom\",\n disabled,\n open,\n icon,\n readOnly,\n children,\n variant,\n ...others\n } = useDefaultProps(\"HvDropdownButton\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const endIcon = icon ? undefined : (\n <DropDownXS iconSize=\"XS\" style={{ rotate: open ? \"180deg\" : undefined }} />\n );\n\n return (\n <HvButton\n ref={ref}\n icon={icon}\n disabled={disabled || readOnly}\n className={cx(\n classes.root,\n {\n [classes.open]: open,\n [classes.openUp]: open && placement.includes(\"top\"),\n [classes.openDown]: open && placement.includes(\"bottom\"),\n [classes.disabled]: disabled,\n [classes.readOnly]: readOnly,\n },\n className,\n )}\n classes={{ endIcon: classes.arrowContainer }}\n endIcon={endIcon}\n variant={open ? \"secondarySubtle\" : variant}\n {...others}\n >\n <div className={cx({ [classes.selection]: !icon })}>\n {children && typeof children === \"string\" ? (\n <div className={classes.placeholder}>{children}</div>\n ) : (\n children\n )}\n </div>\n </HvButton>\n );\n});\n"],"names":[],"mappings":";;;;;;;AAgCO,MAAM,mBAAmB,WAG9B,CAAC,OAAO,QAAQ;AACV,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,oBAAoB,KAAK;AAE7C,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAE9C,QAAM,UAAU,OAAO,SACrB,oBAAC,YAAW,EAAA,UAAS,MAAK,OAAO,EAAE,QAAQ,OAAO,WAAW,OAAa,EAAA,CAAA;AAI1E,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,UAAU,YAAY;AAAA,MACtB,WAAW;AAAA,QACT,QAAQ;AAAA,QACR;AAAA,UACE,CAAC,QAAQ,IAAI,GAAG;AAAA,UAChB,CAAC,QAAQ,MAAM,GAAG,QAAQ,UAAU,SAAS,KAAK;AAAA,UAClD,CAAC,QAAQ,QAAQ,GAAG,QAAQ,UAAU,SAAS,QAAQ;AAAA,UACvD,CAAC,QAAQ,QAAQ,GAAG;AAAA,UACpB,CAAC,QAAQ,QAAQ,GAAG;AAAA,QACtB;AAAA,QACA;AAAA,MACF;AAAA,MACA,SAAS,EAAE,SAAS,QAAQ,eAAe;AAAA,MAC3C;AAAA,MACA,SAAS,OAAO,oBAAoB;AAAA,MACnC,GAAG;AAAA,MAEJ,UAAA,oBAAC,OAAI,EAAA,WAAW,GAAG,EAAE,CAAC,QAAQ,SAAS,GAAG,CAAC,KAAK,CAAC,GAC9C,UAAY,YAAA,OAAO,aAAa,WAC9B,oBAAA,OAAA,EAAI,WAAW,QAAQ,aAAc,UAAS,IAE/C,SAEJ,CAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
@@ -54,9 +54,6 @@ const { staticClasses, useClasses } = createClasses("HvDropdownButton", {
54
54
  placeholder: {},
55
55
  arrowContainer: {
56
56
  marginRight: theme.spacing(-2)
57
- },
58
- arrow: {
59
- transition: "rotate 0.2s ease"
60
57
  }
61
58
  });
62
59
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.styles.js","sources":["../../../src/DropdownButton/DropdownButton.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { buttonClasses } from \"../Button\";\n\nconst disabledStyle = {\n backgroundColor: theme.colors.atmo3,\n borderColor: theme.colors.atmo3,\n [`&.${buttonClasses.subtle}`]: {\n backgroundColor: theme.colors.atmo3,\n borderColor: theme.colors.atmo3,\n \"&:hover\": { backgroundColor: theme.colors.atmo3 },\n },\n [`&.${buttonClasses.ghost}`]: {\n backgroundColor: theme.colors.atmo3,\n borderColor: theme.colors.atmo3,\n \"&:hover\": { backgroundColor: theme.colors.atmo3 },\n },\n};\n\nexport const { staticClasses, useClasses } = createClasses(\"HvDropdownButton\", {\n root: {\n userSelect: \"none\",\n position: \"relative\",\n\n [`&:not(.${buttonClasses.icon})`]: {\n width: \"100%\",\n minWidth: \"unset\",\n justifyContent: \"flex-start\",\n paddingLeft: theme.space.xs,\n },\n },\n disabled: {\n ...disabledStyle,\n },\n readOnly: {\n userSelect: \"text\",\n ...disabledStyle,\n },\n open: {\n backgroundColor: theme.colors.atmo1,\n },\n openUp: {\n borderRadius: `0px 0px ${theme.radii.base} ${theme.radii.base}`,\n },\n openDown: {\n borderRadius: `${theme.radii.base} ${theme.radii.base} 0px 0px`,\n },\n selection: {\n color: \"inherit\",\n flex: 1,\n textAlign: \"start\",\n overflow: \"auto\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n placeholder: {},\n arrowContainer: {\n marginRight: theme.spacing(-2),\n },\n arrow: {\n transition: \"rotate 0.2s ease\",\n },\n});\n"],"names":["buttonClasses"],"mappings":";;;;AAKA,MAAM,gBAAgB;AAAA,EACpB,iBAAiB,MAAM,OAAO;AAAA,EAC9B,aAAa,MAAM,OAAO;AAAA,EAC1B,CAAC,KAAKA,gBAAc,MAAM,EAAE,GAAG;AAAA,IAC7B,iBAAiB,MAAM,OAAO;AAAA,IAC9B,aAAa,MAAM,OAAO;AAAA,IAC1B,WAAW,EAAE,iBAAiB,MAAM,OAAO,MAAM;AAAA,EACnD;AAAA,EACA,CAAC,KAAKA,gBAAc,KAAK,EAAE,GAAG;AAAA,IAC5B,iBAAiB,MAAM,OAAO;AAAA,IAC9B,aAAa,MAAM,OAAO;AAAA,IAC1B,WAAW,EAAE,iBAAiB,MAAM,OAAO,MAAM;AAAA,EACnD;AACF;AAEO,MAAM,EAAE,eAAe,eAAe,cAAc,oBAAoB;AAAA,EAC7E,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,UAAU;AAAA,IAEV,CAAC,UAAUA,gBAAc,IAAI,GAAG,GAAG;AAAA,MACjC,OAAO;AAAA,MACP,UAAU;AAAA,MACV,gBAAgB;AAAA,MAChB,aAAa,MAAM,MAAM;AAAA,IAC3B;AAAA,EACF;AAAA,EACA,UAAU;AAAA,IACR,GAAG;AAAA,EACL;AAAA,EACA,UAAU;AAAA,IACR,YAAY;AAAA,IACZ,GAAG;AAAA,EACL;AAAA,EACA,MAAM;AAAA,IACJ,iBAAiB,MAAM,OAAO;AAAA,EAChC;AAAA,EACA,QAAQ;AAAA,IACN,cAAc,WAAW,MAAM,MAAM,IAAI,IAAI,MAAM,MAAM,IAAI;AAAA,EAC/D;AAAA,EACA,UAAU;AAAA,IACR,cAAc,GAAG,MAAM,MAAM,IAAI,IAAI,MAAM,MAAM,IAAI;AAAA,EACvD;AAAA,EACA,WAAW;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAW;AAAA,IACX,UAAU;AAAA,IACV,cAAc;AAAA,IACd,YAAY;AAAA,EACd;AAAA,EACA,aAAa,CAAC;AAAA,EACd,gBAAgB;AAAA,IACd,aAAa,MAAM,QAAQ,EAAE;AAAA,EAC/B;AAAA,EACA,OAAO;AAAA,IACL,YAAY;AAAA,EACd;AACF,CAAC;"}
1
+ {"version":3,"file":"DropdownButton.styles.js","sources":["../../../src/DropdownButton/DropdownButton.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { buttonClasses } from \"../Button\";\n\nconst disabledStyle = {\n backgroundColor: theme.colors.atmo3,\n borderColor: theme.colors.atmo3,\n [`&.${buttonClasses.subtle}`]: {\n backgroundColor: theme.colors.atmo3,\n borderColor: theme.colors.atmo3,\n \"&:hover\": { backgroundColor: theme.colors.atmo3 },\n },\n [`&.${buttonClasses.ghost}`]: {\n backgroundColor: theme.colors.atmo3,\n borderColor: theme.colors.atmo3,\n \"&:hover\": { backgroundColor: theme.colors.atmo3 },\n },\n};\n\nexport const { staticClasses, useClasses } = createClasses(\"HvDropdownButton\", {\n root: {\n userSelect: \"none\",\n position: \"relative\",\n\n [`&:not(.${buttonClasses.icon})`]: {\n width: \"100%\",\n minWidth: \"unset\",\n justifyContent: \"flex-start\",\n paddingLeft: theme.space.xs,\n },\n },\n disabled: {\n ...disabledStyle,\n },\n readOnly: {\n userSelect: \"text\",\n ...disabledStyle,\n },\n open: {\n backgroundColor: theme.colors.atmo1,\n },\n openUp: {\n borderRadius: `0px 0px ${theme.radii.base} ${theme.radii.base}`,\n },\n openDown: {\n borderRadius: `${theme.radii.base} ${theme.radii.base} 0px 0px`,\n },\n selection: {\n color: \"inherit\",\n flex: 1,\n textAlign: \"start\",\n overflow: \"auto\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n placeholder: {},\n arrowContainer: {\n marginRight: theme.spacing(-2),\n },\n});\n"],"names":["buttonClasses"],"mappings":";;;;AAKA,MAAM,gBAAgB;AAAA,EACpB,iBAAiB,MAAM,OAAO;AAAA,EAC9B,aAAa,MAAM,OAAO;AAAA,EAC1B,CAAC,KAAKA,gBAAc,MAAM,EAAE,GAAG;AAAA,IAC7B,iBAAiB,MAAM,OAAO;AAAA,IAC9B,aAAa,MAAM,OAAO;AAAA,IAC1B,WAAW,EAAE,iBAAiB,MAAM,OAAO,MAAM;AAAA,EACnD;AAAA,EACA,CAAC,KAAKA,gBAAc,KAAK,EAAE,GAAG;AAAA,IAC5B,iBAAiB,MAAM,OAAO;AAAA,IAC9B,aAAa,MAAM,OAAO;AAAA,IAC1B,WAAW,EAAE,iBAAiB,MAAM,OAAO,MAAM;AAAA,EACnD;AACF;AAEO,MAAM,EAAE,eAAe,eAAe,cAAc,oBAAoB;AAAA,EAC7E,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,UAAU;AAAA,IAEV,CAAC,UAAUA,gBAAc,IAAI,GAAG,GAAG;AAAA,MACjC,OAAO;AAAA,MACP,UAAU;AAAA,MACV,gBAAgB;AAAA,MAChB,aAAa,MAAM,MAAM;AAAA,IAC3B;AAAA,EACF;AAAA,EACA,UAAU;AAAA,IACR,GAAG;AAAA,EACL;AAAA,EACA,UAAU;AAAA,IACR,YAAY;AAAA,IACZ,GAAG;AAAA,EACL;AAAA,EACA,MAAM;AAAA,IACJ,iBAAiB,MAAM,OAAO;AAAA,EAChC;AAAA,EACA,QAAQ;AAAA,IACN,cAAc,WAAW,MAAM,MAAM,IAAI,IAAI,MAAM,MAAM,IAAI;AAAA,EAC/D;AAAA,EACA,UAAU;AAAA,IACR,cAAc,GAAG,MAAM,MAAM,IAAI,IAAI,MAAM,MAAM,IAAI;AAAA,EACvD;AAAA,EACA,WAAW;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAW;AAAA,IACX,UAAU;AAAA,IACV,cAAc;AAAA,IACd,YAAY;AAAA,EACd;AAAA,EACA,aAAa,CAAC;AAAA,EACd,gBAAgB;AAAA,IACd,aAAa,MAAM,QAAQ,EAAE;AAAA,EAC/B;AACF,CAAC;"}
@@ -1,8 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
2
3
  import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
3
4
  import { useClasses } from "./Actions.styles.js";
4
5
  import { staticClasses } from "./Actions.styles.js";
5
- const HvHeaderActions = (props) => {
6
+ const HvHeaderActions = forwardRef((props, ref) => {
6
7
  const {
7
8
  classes: classesProp,
8
9
  className,
@@ -10,8 +11,8 @@ const HvHeaderActions = (props) => {
10
11
  ...others
11
12
  } = useDefaultProps("HvHeaderActions", props);
12
13
  const { classes, cx } = useClasses(classesProp);
13
- return /* @__PURE__ */ jsx("div", { className: cx(classes.root, className), ...others, children });
14
- };
14
+ return /* @__PURE__ */ jsx("div", { ref, className: cx(classes.root, className), ...others, children });
15
+ });
15
16
  export {
16
17
  HvHeaderActions,
17
18
  staticClasses as headerActionsClasses
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../src/Header/Actions/Actions.tsx"],"sourcesContent":["import {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport { staticClasses, useClasses } from \"./Actions.styles\";\n\nexport { staticClasses as headerActionsClasses };\n\nexport type HvHeaderActionsClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvHeaderActionsProps extends HvBaseProps {\n classes?: HvHeaderActionsClasses;\n}\n\nexport const HvHeaderActions = (props: HvHeaderActionsProps) => {\n const {\n classes: classesProp,\n className,\n children,\n ...others\n } = useDefaultProps(\"HvHeaderActions\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <div className={cx(classes.root, className)} {...others}>\n {children}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AAgBa,MAAA,kBAAkB,CAAC,UAAgC;AACxD,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,mBAAmB,KAAK;AAE5C,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAG5C,SAAA,oBAAC,OAAI,EAAA,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QAC9C,SACH,CAAA;AAEJ;"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../src/Header/Actions/Actions.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport { staticClasses, useClasses } from \"./Actions.styles\";\n\nexport { staticClasses as headerActionsClasses };\n\nexport type HvHeaderActionsClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvHeaderActionsProps extends HvBaseProps {\n classes?: HvHeaderActionsClasses;\n}\n\nexport const HvHeaderActions = forwardRef<\n React.ElementRef<\"div\">,\n HvHeaderActionsProps\n>((props, ref) => {\n const {\n classes: classesProp,\n className,\n children,\n ...others\n } = useDefaultProps(\"HvHeaderActions\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <div ref={ref} className={cx(classes.root, className)} {...others}>\n {children}\n </div>\n );\n});\n"],"names":[],"mappings":";;;;;AAiBO,MAAM,kBAAkB,WAG7B,CAAC,OAAO,QAAQ;AACV,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,mBAAmB,KAAK;AAE5C,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAG5C,SAAA,oBAAC,OAAI,EAAA,KAAU,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QACxD,SACH,CAAA;AAEJ,CAAC;"}
@@ -1,9 +1,10 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
2
3
  import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
3
4
  import { useClasses } from "./Brand.styles.js";
4
5
  import { staticClasses } from "./Brand.styles.js";
5
6
  import { HvTypography } from "../../Typography/Typography.js";
6
- const HvHeaderBrand = (props) => {
7
+ const HvHeaderBrand = forwardRef((props, ref) => {
7
8
  const {
8
9
  classes: classesProp,
9
10
  logo,
@@ -12,12 +13,12 @@ const HvHeaderBrand = (props) => {
12
13
  ...others
13
14
  } = useDefaultProps("HvHeaderBrand", props);
14
15
  const { classes, cx } = useClasses(classesProp);
15
- return /* @__PURE__ */ jsxs("div", { className: cx(classes.root, className), ...others, children: [
16
+ return /* @__PURE__ */ jsxs("div", { ref, className: cx(classes.root, className), ...others, children: [
16
17
  logo,
17
18
  logo && name && /* @__PURE__ */ jsx("div", { className: classes.separator }),
18
19
  name && /* @__PURE__ */ jsx(HvTypography, { className: classes.brandName, variant: "label", children: name })
19
20
  ] });
20
- };
21
+ });
21
22
  export {
22
23
  HvHeaderBrand,
23
24
  staticClasses as headerBrandClasses
@@ -1 +1 @@
1
- {"version":3,"file":"Brand.js","sources":["../../../../src/Header/Brand/Brand.tsx"],"sourcesContent":["import {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport { HvTypography } from \"../../Typography\";\nimport { staticClasses, useClasses } from \"./Brand.styles\";\n\nexport { staticClasses as headerBrandClasses };\n\nexport type HvHeaderBrandClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvHeaderBrandProps extends HvBaseProps {\n logo?: React.ReactNode;\n name?: string;\n classes?: HvHeaderBrandClasses;\n}\n\n/**\n * Header component is used to render a header bar with logo and brand name, navigation and actions.\n */\nexport const HvHeaderBrand = (props: HvHeaderBrandProps) => {\n const {\n classes: classesProp,\n logo,\n name,\n className,\n ...others\n } = useDefaultProps(\"HvHeaderBrand\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <div className={cx(classes.root, className)} {...others}>\n {logo}\n {logo && name && <div className={classes.separator} />}\n {name && (\n <HvTypography className={classes.brandName} variant=\"label\">\n {name}\n </HvTypography>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AAsBa,MAAA,gBAAgB,CAAC,UAA8B;AACpD,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,iBAAiB,KAAK;AAE1C,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAG5C,SAAA,qBAAC,SAAI,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QAC9C,UAAA;AAAA,IAAA;AAAA,IACA,QAAQ,QAAQ,oBAAC,OAAI,EAAA,WAAW,QAAQ,WAAW;AAAA,IACnD,4BACE,cAAa,EAAA,WAAW,QAAQ,WAAW,SAAQ,SACjD,UACH,KAAA,CAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"Brand.js","sources":["../../../../src/Header/Brand/Brand.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport { HvTypography } from \"../../Typography\";\nimport { staticClasses, useClasses } from \"./Brand.styles\";\n\nexport { staticClasses as headerBrandClasses };\n\nexport type HvHeaderBrandClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvHeaderBrandProps extends HvBaseProps {\n logo?: React.ReactNode;\n name?: string;\n classes?: HvHeaderBrandClasses;\n}\n\n/**\n * Header component is used to render a header bar with logo and brand name, navigation and actions.\n */\nexport const HvHeaderBrand = forwardRef<\n React.ElementRef<\"div\">,\n HvHeaderBrandProps\n>((props, ref) => {\n const {\n classes: classesProp,\n logo,\n name,\n className,\n ...others\n } = useDefaultProps(\"HvHeaderBrand\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <div ref={ref} className={cx(classes.root, className)} {...others}>\n {logo}\n {logo && name && <div className={classes.separator} />}\n {name && (\n <HvTypography className={classes.brandName} variant=\"label\">\n {name}\n </HvTypography>\n )}\n </div>\n );\n});\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,gBAAgB,WAG3B,CAAC,OAAO,QAAQ;AACV,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,iBAAiB,KAAK;AAE1C,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAG5C,SAAA,qBAAC,OAAI,EAAA,KAAU,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QACxD,UAAA;AAAA,IAAA;AAAA,IACA,QAAQ,QAAQ,oBAAC,OAAI,EAAA,WAAW,QAAQ,WAAW;AAAA,IACnD,4BACE,cAAa,EAAA,WAAW,QAAQ,WAAW,SAAQ,SACjD,UACH,KAAA,CAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CAAC;"}
@@ -58,11 +58,6 @@ const HvHeaderMenuItem = (props) => {
58
58
  const handleFocus = (event) => {
59
59
  dispatch?.({ type: "setItemFocused", itemFocused: event.currentTarget });
60
60
  };
61
- const itemProps = {
62
- onClick: actionHandler,
63
- onKeyDown: actionHandler,
64
- onFocus: handleFocus
65
- };
66
61
  const label = /* @__PURE__ */ jsx(
67
62
  HvTypography,
68
63
  {
@@ -79,6 +74,8 @@ const HvHeaderMenuItem = (props) => {
79
74
  itemHref = href;
80
75
  itemTarget = target;
81
76
  }
77
+ const ItemComponent = itemHref ? "a" : "div";
78
+ const itemProps = itemHref ? { href: itemHref, target: itemTarget, "aria-label": item.label } : { role: "button", tabIndex: 0 };
82
79
  return /* @__PURE__ */ jsxs(
83
80
  "li",
84
81
  {
@@ -93,31 +90,20 @@ const HvHeaderMenuItem = (props) => {
93
90
  className
94
91
  ),
95
92
  children: [
96
- itemHref ? /* @__PURE__ */ jsx(
97
- "a",
93
+ /* @__PURE__ */ jsx(
94
+ ItemComponent,
98
95
  {
99
- className: classes.link,
100
- href: itemHref,
101
- target: itemTarget,
102
- ...itemProps,
96
+ className: cx(classes.item, {
97
+ [classes.link]: itemHref,
98
+ [classes.button]: !itemHref
99
+ }),
100
+ onFocus: handleFocus,
101
+ onClick: actionHandler,
102
+ onKeyDown: actionHandler,
103
103
  "aria-current": isCurrent,
104
- "aria-label": item.label,
104
+ ...itemProps,
105
105
  children: label
106
106
  }
107
- ) : (
108
- // keeping this code path for backwards compatibility, but
109
- // shouldn't really be used as it's not accessible
110
- /* @__PURE__ */ jsx(
111
- "div",
112
- {
113
- className: classes.button,
114
- role: "button",
115
- ...itemProps,
116
- tabIndex: 0,
117
- "aria-current": isCurrent,
118
- children: label
119
- }
120
- )
121
107
  ),
122
108
  hasSubLevel && currentLevel < levels && currentLevel < 2 && /* @__PURE__ */ jsx(Bar, { data, type: "menu", children: data.map((itm) => /* @__PURE__ */ jsx(
123
109
  HvHeaderMenuItem,
@@ -131,8 +117,7 @@ const HvHeaderMenuItem = (props) => {
131
117
  itm.id
132
118
  )) })
133
119
  ]
134
- },
135
- item.label
120
+ }
136
121
  );
137
122
  };
138
123
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.js","sources":["../../../../../src/Header/Navigation/MenuItem/MenuItem.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../../types/generic\";\nimport { HvTypography } from \"../../../Typography\";\nimport { isKey } from \"../../../utils/keyboardUtils\";\nimport { Bar } from \"../MenuBar/Bar\";\nimport { HvHeaderNavigationItemProp } from \"../useSelectionPath\";\nimport { FocusContext } from \"../utils/FocusContext\";\nimport { SelectionContext } from \"../utils/SelectionContext\";\nimport { staticClasses, useClasses } from \"./MenuItem.styles\";\n\nexport { staticClasses as headerMenuItemClasses };\n\nexport type HvHeaderMenuItemClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvHeaderMenuItemProps\n extends HvBaseProps<HTMLDivElement, \"onClick\"> {\n item: HvHeaderNavigationItemProp;\n type?: string;\n onClick?: (\n event: React.MouseEvent,\n selection: HvHeaderNavigationItemProp,\n ) => void;\n levels: number;\n currentLevel: number;\n classes?: HvHeaderMenuItemClasses;\n}\n\n// Traverse the tree of items and return the first href it finds\nconst traverseItem = (\n node: HvHeaderNavigationItemProp,\n): { href?: string; target?: string } => {\n let href: string | undefined;\n let target: string | undefined;\n\n if (node?.href) {\n href = node?.href;\n target = node?.target;\n } else if (node?.data != null && node?.data?.length > 0) {\n let i = 0;\n while (href == null && i < node.data.length) {\n const childNavItem = traverseItem(node?.data[i]);\n if (childNavItem?.href != null) {\n href = childNavItem?.href;\n target = childNavItem?.target;\n break;\n }\n\n i += 1;\n }\n }\n\n return { href, target };\n};\n\nexport const HvHeaderMenuItem = (props: HvHeaderMenuItemProps) => {\n const {\n id,\n item,\n type,\n onClick,\n levels,\n currentLevel,\n classes: classesProp,\n className,\n } = useDefaultProps(\"HvHeaderMenuItem\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const selectionPath = useContext(SelectionContext);\n\n const { dispatch } = useContext(FocusContext);\n\n const { data } = item;\n\n const hasSubLevel = data?.length;\n\n const isMenu = type === \"menu\";\n\n const isSelected = selectionPath?.[isMenu ? 1 : 0] === item.id;\n\n // true: if the item is part of the selection path but is not the current page the user is seeing, i.e has more sub levels\n // page: used when the selected item is actually the current page the user is seeing\n const isCurrent = isSelected ? (hasSubLevel ? true : \"page\") : undefined;\n\n const actionHandler = (event: any) => {\n if (\n event.type === \"click\" ||\n isKey(event, \"Enter\") ||\n isKey(event, \"Space\")\n ) {\n if (event.type === \"click\") {\n event.currentTarget.blur();\n }\n\n onClick?.(event, item);\n }\n };\n\n const handleFocus = (event: React.FocusEvent) => {\n dispatch?.({ type: \"setItemFocused\", itemFocused: event.currentTarget });\n };\n\n const itemProps = {\n onClick: actionHandler,\n onKeyDown: actionHandler,\n onFocus: handleFocus,\n };\n\n const label = (\n <HvTypography\n component=\"span\"\n variant={isSelected ? \"label\" : \"body\"}\n data-text={item.label}\n >\n {item.label}\n </HvTypography>\n );\n\n let itemHref = item?.href;\n let itemTarget = item?.target;\n\n // apps should configure the href even on parent items without content\n // so the fallback logic is theirs, but if not we'll do our best to find a link\n if (item?.href == null) {\n const { href, target } = traverseItem(item);\n itemHref = href;\n itemTarget = target;\n }\n\n return (\n <li\n id={id}\n key={item.label}\n className={cx(\n classes.root,\n {\n [classes.menu]: isMenu,\n [classes.menubar]: !isMenu,\n [classes.selected]: !!isSelected,\n },\n className,\n )}\n >\n {itemHref ? (\n <a\n className={classes.link}\n href={itemHref}\n target={itemTarget}\n {...itemProps}\n aria-current={isCurrent}\n // Fix for a possible bug in playwright where, even though hidden from screen readers and not appearing in the accessibility\n // tree, due to the styling duplication (span::after - using 'data-text'), locators have to double the name.\n aria-label={item.label}\n >\n {label}\n </a>\n ) : (\n // keeping this code path for backwards compatibility, but\n // shouldn't really be used as it's not accessible\n <div\n className={classes.button}\n role=\"button\"\n {...itemProps}\n tabIndex={0}\n aria-current={isCurrent}\n >\n {label}\n </div>\n )}\n {/* Limits levels to no more than 2. More than that is not expected and not in DS. */}\n {hasSubLevel && currentLevel < levels && currentLevel < 2 && (\n <Bar data={data} type=\"menu\">\n {data.map((itm: HvHeaderNavigationItemProp) => (\n <HvHeaderMenuItem\n key={itm.id}\n item={itm}\n type=\"menu\"\n onClick={onClick}\n levels={levels}\n currentLevel={currentLevel + 1}\n />\n ))}\n </Bar>\n )}\n </li>\n );\n};\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"MenuItem.js","sources":["../../../../../src/Header/Navigation/MenuItem/MenuItem.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../../types/generic\";\nimport { HvTypography } from \"../../../Typography\";\nimport { isKey } from \"../../../utils/keyboardUtils\";\nimport { Bar } from \"../MenuBar/Bar\";\nimport { HvHeaderNavigationItemProp } from \"../useSelectionPath\";\nimport { FocusContext } from \"../utils/FocusContext\";\nimport { SelectionContext } from \"../utils/SelectionContext\";\nimport { staticClasses, useClasses } from \"./MenuItem.styles\";\n\nexport { staticClasses as headerMenuItemClasses };\n\nexport type HvHeaderMenuItemClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvHeaderMenuItemProps\n extends HvBaseProps<HTMLDivElement, \"onClick\"> {\n item: HvHeaderNavigationItemProp;\n type?: string;\n onClick?: (\n event: React.MouseEvent,\n selection: HvHeaderNavigationItemProp,\n ) => void;\n levels: number;\n currentLevel: number;\n classes?: HvHeaderMenuItemClasses;\n}\n\n// Traverse the tree of items and return the first href it finds\nconst traverseItem = (\n node: HvHeaderNavigationItemProp,\n): { href?: string; target?: string } => {\n let href: string | undefined;\n let target: string | undefined;\n\n if (node?.href) {\n href = node?.href;\n target = node?.target;\n } else if (node?.data != null && node?.data?.length > 0) {\n let i = 0;\n while (href == null && i < node.data.length) {\n const childNavItem = traverseItem(node?.data[i]);\n if (childNavItem?.href != null) {\n href = childNavItem?.href;\n target = childNavItem?.target;\n break;\n }\n\n i += 1;\n }\n }\n\n return { href, target };\n};\n\nexport const HvHeaderMenuItem = (props: HvHeaderMenuItemProps) => {\n const {\n id,\n item,\n type,\n onClick,\n levels,\n currentLevel,\n classes: classesProp,\n className,\n } = useDefaultProps(\"HvHeaderMenuItem\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const selectionPath = useContext(SelectionContext);\n\n const { dispatch } = useContext(FocusContext);\n\n const { data } = item;\n\n const hasSubLevel = data?.length;\n\n const isMenu = type === \"menu\";\n\n const isSelected = selectionPath?.[isMenu ? 1 : 0] === item.id;\n\n // true: if the item is part of the selection path but is not the current page the user is seeing, i.e has more sub levels\n // page: used when the selected item is actually the current page the user is seeing\n const isCurrent = isSelected ? (hasSubLevel ? true : \"page\") : undefined;\n\n const actionHandler = (event: any) => {\n if (\n event.type === \"click\" ||\n isKey(event, \"Enter\") ||\n isKey(event, \"Space\")\n ) {\n if (event.type === \"click\") {\n event.currentTarget.blur();\n }\n\n onClick?.(event, item);\n }\n };\n\n const handleFocus = (event: React.FocusEvent) => {\n dispatch?.({ type: \"setItemFocused\", itemFocused: event.currentTarget });\n };\n\n const label = (\n <HvTypography\n component=\"span\"\n variant={isSelected ? \"label\" : \"body\"}\n data-text={item.label}\n >\n {item.label}\n </HvTypography>\n );\n\n let itemHref = item?.href;\n let itemTarget = item?.target;\n\n // apps should configure the href even on parent items without content\n // so the fallback logic is theirs, but if not we'll do our best to find a link\n if (item?.href == null) {\n const { href, target } = traverseItem(item);\n itemHref = href;\n itemTarget = target;\n }\n\n // TODO: change to \"a\" only in v6, as buttons aren't accessible links. Allow custom `ItemComponent` to be passed\n const ItemComponent = itemHref ? \"a\" : \"div\";\n // TODO: allow any custom props to be passed\n const itemProps = itemHref\n ? { href: itemHref, target: itemTarget, \"aria-label\": item.label }\n : { role: \"button\", tabIndex: 0 };\n\n return (\n <li\n id={id}\n className={cx(\n classes.root,\n {\n [classes.menu]: isMenu,\n [classes.menubar]: !isMenu,\n [classes.selected]: !!isSelected,\n },\n className,\n )}\n >\n <ItemComponent\n className={cx(classes.item, {\n [classes.link]: itemHref,\n [classes.button]: !itemHref,\n })}\n onFocus={handleFocus}\n onClick={actionHandler}\n onKeyDown={actionHandler}\n aria-current={isCurrent}\n {...itemProps}\n >\n {label}\n </ItemComponent>\n {/* Limits levels to no more than 2. More than that is not expected and not in DS. */}\n {hasSubLevel && currentLevel < levels && currentLevel < 2 && (\n <Bar data={data} type=\"menu\">\n {data.map((itm) => (\n <HvHeaderMenuItem\n key={itm.id}\n item={itm}\n type=\"menu\"\n onClick={onClick}\n levels={levels}\n currentLevel={currentLevel + 1}\n />\n ))}\n </Bar>\n )}\n </li>\n );\n};\n"],"names":[],"mappings":"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"}
@@ -19,6 +19,7 @@ const item = {
19
19
  },
20
20
  "& span": {
21
21
  display: "inline-flex",
22
+ color: "inherit",
22
23
  flexDirection: "column",
23
24
  alignItems: "center",
24
25
  justifyContent: "space-between"
@@ -41,57 +42,24 @@ const { staticClasses, useClasses } = createClasses(
41
42
  {
42
43
  root: {
43
44
  display: "inline",
44
- "&:hover": {
45
- backgroundColor: theme.colors.containerBackgroundHover
46
- },
47
- "&:focus-within": {
45
+ height: "100%",
46
+ borderBottom: "4px solid transparent",
47
+ ":hover, :focus-within": {
48
48
  backgroundColor: theme.colors.containerBackgroundHover
49
49
  }
50
50
  },
51
- menu: {
52
- marginTop: 0,
53
- paddingBottom: "4px",
54
- paddingTop: "4px",
55
- height: "100%",
56
- borderTop: "none",
57
- borderBottom: `4px solid ${theme.colors.atmo2}`
58
- },
59
- menubar: {
60
- marginTop: "0px",
61
- paddingBottom: "4px",
62
- paddingTop: "4px",
63
- height: "100%",
64
- borderTop: `0px solid ${theme.colors.atmo1}`,
65
- borderBottom: `${"4px"} solid ${theme.colors.atmo1}`
66
- },
51
+ menu: {},
52
+ menubar: {},
67
53
  selected: {
68
- "&$menu": {
69
- marginTop: 0,
70
- paddingBottom: 0,
71
- borderTop: "none",
72
- borderBottom: `4px solid ${theme.colors.secondary}`,
73
- paddingTop: "4px",
74
- height: "100%",
75
- "& > * > span": {
76
- color: theme.colors.secondary
77
- }
78
- },
79
- "&$menubar": {
80
- marginTop: 0,
81
- paddingBottom: 0,
82
- borderTop: "none",
83
- borderBottom: `4px solid ${theme.colors.secondary}`,
84
- paddingTop: "4px",
85
- height: "100%"
86
- }
54
+ borderColor: theme.colors.secondary,
55
+ color: theme.colors.secondary
87
56
  },
57
+ item,
88
58
  link: {
89
- textDecoration: "none",
90
- ...item
59
+ textDecoration: "none"
91
60
  },
92
61
  button: {
93
- color: "inherit",
94
- ...item
62
+ color: "inherit"
95
63
  }
96
64
  }
97
65
  );
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.styles.js","sources":["../../../../../src/Header/Navigation/MenuItem/MenuItem.styles.tsx"],"sourcesContent":["import type { CSSInterpolation } from \"@emotion/serialize\";\nimport { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../../../utils/focusUtils\";\n\nconst item: CSSInterpolation = {\n border: \"none\",\n cursor: \"pointer\",\n padding: `${theme.space.xs} ${theme.space.sm}`,\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n \"&:active\": {\n outline: \"none\",\n },\n \"&:focus\": {\n outline: \"none\",\n },\n \"&:focus-visible\": {\n ...outlineStyles,\n },\n \"& span\": {\n display: \"inline-flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n },\n \"& span::after\": {\n content: \"attr(data-text)\",\n height: 0,\n visibility: \"hidden\",\n overflow: \"hidden\",\n userSelect: \"none\",\n pointerEvents: \"none\",\n fontWeight: theme.fontWeights.semibold,\n\n \"@media speech\": {\n display: \"none\",\n },\n },\n};\n\n// TODO - rename to HvHeaderMenuItem (the actual component's name) in v6\nexport const { staticClasses, useClasses } = createClasses(\n \"HvHeader-MenuItem\",\n {\n root: {\n display: \"inline\",\n \"&:hover\": {\n backgroundColor: theme.colors.containerBackgroundHover,\n },\n \"&:focus-within\": {\n backgroundColor: theme.colors.containerBackgroundHover,\n },\n },\n menu: {\n marginTop: 0,\n paddingBottom: \"4px\",\n paddingTop: \"4px\",\n height: \"100%\",\n borderTop: \"none\",\n borderBottom: `4px solid ${theme.colors.atmo2}`,\n },\n menubar: {\n marginTop: \"0px\",\n paddingBottom: \"4px\",\n paddingTop: \"4px\",\n height: \"100%\",\n borderTop: `0px solid ${theme.colors.atmo1}`,\n borderBottom: `${\"4px\"} solid ${theme.colors.atmo1}`,\n },\n selected: {\n \"&$menu\": {\n marginTop: 0,\n paddingBottom: 0,\n borderTop: \"none\",\n borderBottom: `4px solid ${theme.colors.secondary}`,\n paddingTop: \"4px\",\n height: \"100%\",\n \"& > * > span\": {\n color: theme.colors.secondary,\n },\n },\n \"&$menubar\": {\n marginTop: 0,\n paddingBottom: 0,\n borderTop: \"none\",\n borderBottom: `4px solid ${theme.colors.secondary}`,\n paddingTop: \"4px\",\n height: \"100%\",\n },\n },\n link: {\n textDecoration: \"none\",\n ...item,\n } as CSSInterpolation,\n button: {\n color: \"inherit\",\n ...item,\n } as CSSInterpolation,\n },\n);\n"],"names":[],"mappings":";;;AAMA,MAAM,OAAyB;AAAA,EAC7B,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS,GAAG,MAAM,MAAM,EAAE,IAAI,MAAM,MAAM,EAAE;AAAA,EAC5C,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,YAAY;AAAA,IACV,SAAS;AAAA,EACX;AAAA,EACA,WAAW;AAAA,IACT,SAAS;AAAA,EACX;AAAA,EACA,mBAAmB;AAAA,IACjB,GAAG;AAAA,EACL;AAAA,EACA,UAAU;AAAA,IACR,SAAS;AAAA,IACT,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,gBAAgB;AAAA,EAClB;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,YAAY,MAAM,YAAY;AAAA,IAE9B,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAGa,MAAA,EAAE,eAAe,WAAA,IAAe;AAAA,EAC3C;AAAA,EACA;AAAA,IACE,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,WAAW;AAAA,QACT,iBAAiB,MAAM,OAAO;AAAA,MAChC;AAAA,MACA,kBAAkB;AAAA,QAChB,iBAAiB,MAAM,OAAO;AAAA,MAChC;AAAA,IACF;AAAA,IACA,MAAM;AAAA,MACJ,WAAW;AAAA,MACX,eAAe;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,cAAc,aAAa,MAAM,OAAO,KAAK;AAAA,IAC/C;AAAA,IACA,SAAS;AAAA,MACP,WAAW;AAAA,MACX,eAAe;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW,aAAa,MAAM,OAAO,KAAK;AAAA,MAC1C,cAAc,GAAG,KAAK,UAAU,MAAM,OAAO,KAAK;AAAA,IACpD;AAAA,IACA,UAAU;AAAA,MACR,UAAU;AAAA,QACR,WAAW;AAAA,QACX,eAAe;AAAA,QACf,WAAW;AAAA,QACX,cAAc,aAAa,MAAM,OAAO,SAAS;AAAA,QACjD,YAAY;AAAA,QACZ,QAAQ;AAAA,QACR,gBAAgB;AAAA,UACd,OAAO,MAAM,OAAO;AAAA,QACtB;AAAA,MACF;AAAA,MACA,aAAa;AAAA,QACX,WAAW;AAAA,QACX,eAAe;AAAA,QACf,WAAW;AAAA,QACX,cAAc,aAAa,MAAM,OAAO,SAAS;AAAA,QACjD,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IACA,MAAM;AAAA,MACJ,gBAAgB;AAAA,MAChB,GAAG;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,MACN,OAAO;AAAA,MACP,GAAG;AAAA,IACL;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"MenuItem.styles.js","sources":["../../../../../src/Header/Navigation/MenuItem/MenuItem.styles.tsx"],"sourcesContent":["import type { CSSInterpolation } from \"@emotion/serialize\";\nimport { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../../../utils/focusUtils\";\n\nconst item: CSSInterpolation = {\n border: \"none\",\n cursor: \"pointer\",\n padding: `${theme.space.xs} ${theme.space.sm}`,\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n \"&:active\": {\n outline: \"none\",\n },\n \"&:focus\": {\n outline: \"none\",\n },\n \"&:focus-visible\": {\n ...outlineStyles,\n },\n \"& span\": {\n display: \"inline-flex\",\n color: \"inherit\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n },\n \"& span::after\": {\n content: \"attr(data-text)\",\n height: 0,\n visibility: \"hidden\",\n overflow: \"hidden\",\n userSelect: \"none\",\n pointerEvents: \"none\",\n fontWeight: theme.fontWeights.semibold,\n\n \"@media speech\": {\n display: \"none\",\n },\n },\n};\n\n// TODO - rename to HvHeaderMenuItem (the actual component's name) in v6\nexport const { staticClasses, useClasses } = createClasses(\n \"HvHeader-MenuItem\",\n {\n root: {\n display: \"inline\",\n height: \"100%\",\n borderBottom: \"4px solid transparent\",\n\n \":hover, :focus-within\": {\n backgroundColor: theme.colors.containerBackgroundHover,\n },\n },\n menu: {},\n menubar: {},\n selected: {\n borderColor: theme.colors.secondary,\n color: theme.colors.secondary,\n },\n item,\n link: {\n textDecoration: \"none\",\n },\n button: {\n color: \"inherit\",\n },\n },\n);\n"],"names":[],"mappings":";;;AAMA,MAAM,OAAyB;AAAA,EAC7B,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS,GAAG,MAAM,MAAM,EAAE,IAAI,MAAM,MAAM,EAAE;AAAA,EAC5C,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,YAAY;AAAA,IACV,SAAS;AAAA,EACX;AAAA,EACA,WAAW;AAAA,IACT,SAAS;AAAA,EACX;AAAA,EACA,mBAAmB;AAAA,IACjB,GAAG;AAAA,EACL;AAAA,EACA,UAAU;AAAA,IACR,SAAS;AAAA,IACT,OAAO;AAAA,IACP,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,gBAAgB;AAAA,EAClB;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,YAAY,MAAM,YAAY;AAAA,IAE9B,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAGa,MAAA,EAAE,eAAe,WAAA,IAAe;AAAA,EAC3C;AAAA,EACA;AAAA,IACE,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,cAAc;AAAA,MAEd,yBAAyB;AAAA,QACvB,iBAAiB,MAAM,OAAO;AAAA,MAChC;AAAA,IACF;AAAA,IACA,MAAM,CAAC;AAAA,IACP,SAAS,CAAC;AAAA,IACV,UAAU;AAAA,MACR,aAAa,MAAM,OAAO;AAAA,MAC1B,OAAO,MAAM,OAAO;AAAA,IACtB;AAAA,IACA;AAAA,IACA,MAAM;AAAA,MACJ,gBAAgB;AAAA,IAClB;AAAA,IACA,QAAQ;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AACF;"}
@@ -1,4 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
2
3
  import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
3
4
  import { useClasses } from "./Navigation.styles.js";
4
5
  import { staticClasses } from "./Navigation.styles.js";
@@ -6,7 +7,7 @@ import { useSelectionPath } from "./useSelectionPath.js";
6
7
  import { FocusProvider } from "./utils/FocusContext.js";
7
8
  import { SelectionContext } from "./utils/SelectionContext.js";
8
9
  import { HvHeaderMenuBar } from "./MenuBar/MenuBar.js";
9
- const HvHeaderNavigation = (props) => {
10
+ const HvHeaderNavigation = forwardRef((props, ref) => {
10
11
  const {
11
12
  data,
12
13
  selected,
@@ -22,7 +23,7 @@ const HvHeaderNavigation = (props) => {
22
23
  event.preventDefault();
23
24
  onClick?.(event, selection);
24
25
  };
25
- return /* @__PURE__ */ jsx(SelectionContext.Provider, { value: selectionPath, children: /* @__PURE__ */ jsx(FocusProvider, { children: /* @__PURE__ */ jsx("nav", { className: cx(classes.root, className), ...others, children: /* @__PURE__ */ jsx(
26
+ return /* @__PURE__ */ jsx(SelectionContext.Provider, { value: selectionPath, children: /* @__PURE__ */ jsx(FocusProvider, { children: /* @__PURE__ */ jsx("nav", { ref, className: cx(classes.root, className), ...others, children: /* @__PURE__ */ jsx(
26
27
  HvHeaderMenuBar,
27
28
  {
28
29
  data,
@@ -32,7 +33,7 @@ const HvHeaderNavigation = (props) => {
32
33
  currentLevel: 1
33
34
  }
34
35
  ) }) }) });
35
- };
36
+ });
36
37
  export {
37
38
  HvHeaderNavigation,
38
39
  staticClasses as headerNavigationClasses
@@ -1 +1 @@
1
- {"version":3,"file":"Navigation.js","sources":["../../../../src/Header/Navigation/Navigation.tsx"],"sourcesContent":["import {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport { HvHeaderMenuBar, HvHeaderMenuBarProps } from \"./MenuBar\";\nimport { staticClasses, useClasses } from \"./Navigation.styles\";\nimport {\n HvHeaderNavigationItemProp,\n useSelectionPath,\n} from \"./useSelectionPath\";\nimport { FocusProvider } from \"./utils/FocusContext\";\nimport { SelectionContext } from \"./utils/SelectionContext\";\n\nexport { staticClasses as headerNavigationClasses };\n\nexport type HvHeaderNavigationClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvHeaderNavigationProps\n extends HvBaseProps<HTMLDivElement, \"onClick\"> {\n data: HvHeaderNavigationItemProp[];\n selected?: string;\n onClick?: (\n event: React.MouseEvent,\n selection: HvHeaderNavigationItemProp,\n ) => void;\n classes?: HvHeaderNavigationClasses;\n /**\n * The number of levels to show: the first level (1) or the first and second level (2).\n *\n * Defaults to `2`.\n * */\n levels?: 1 | 2;\n}\n\nexport const HvHeaderNavigation = (props: HvHeaderNavigationProps) => {\n const {\n data,\n selected,\n onClick,\n className,\n classes: classesProp,\n levels = 2,\n ...others\n } = useDefaultProps(\"HvHeaderNavigation\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const selectionPath = useSelectionPath(data, selected);\n\n const handleClick: HvHeaderMenuBarProps[\"onClick\"] = (event, selection) => {\n event.preventDefault();\n\n onClick?.(event, selection);\n };\n\n return (\n <SelectionContext.Provider value={selectionPath}>\n <FocusProvider>\n <nav className={cx(classes.root, className)} {...others}>\n <HvHeaderMenuBar\n data={data}\n type=\"menubar\"\n onClick={handleClick}\n levels={levels}\n currentLevel={1}\n />\n </nav>\n </FocusProvider>\n </SelectionContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAoCa,MAAA,qBAAqB,CAAC,UAAmC;AAC9D,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,SAAS;AAAA,IACT,GAAG;AAAA,EAAA,IACD,gBAAgB,sBAAsB,KAAK;AAE/C,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAExC,QAAA,gBAAgB,iBAAiB,MAAM,QAAQ;AAE/C,QAAA,cAA+C,CAAC,OAAO,cAAc;AACzE,UAAM,eAAe;AAErB,cAAU,OAAO,SAAS;AAAA,EAAA;AAG5B,6BACG,iBAAiB,UAAjB,EAA0B,OAAO,eAChC,UAAC,oBAAA,eAAA,EACC,UAAC,oBAAA,OAAA,EAAI,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QAC/C,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,SAAS;AAAA,MACT;AAAA,MACA,cAAc;AAAA,IAAA;AAAA,EAAA,GAElB,GACF,EACF,CAAA;AAEJ;"}
1
+ {"version":3,"file":"Navigation.js","sources":["../../../../src/Header/Navigation/Navigation.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../../types/generic\";\nimport { HvHeaderMenuBar, HvHeaderMenuBarProps } from \"./MenuBar\";\nimport { staticClasses, useClasses } from \"./Navigation.styles\";\nimport {\n HvHeaderNavigationItemProp,\n useSelectionPath,\n} from \"./useSelectionPath\";\nimport { FocusProvider } from \"./utils/FocusContext\";\nimport { SelectionContext } from \"./utils/SelectionContext\";\n\nexport { staticClasses as headerNavigationClasses };\n\nexport type HvHeaderNavigationClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvHeaderNavigationProps\n extends HvBaseProps<HTMLDivElement, \"onClick\"> {\n data: HvHeaderNavigationItemProp[];\n selected?: string;\n onClick?: (\n event: React.MouseEvent,\n selection: HvHeaderNavigationItemProp,\n ) => void;\n classes?: HvHeaderNavigationClasses;\n /**\n * The number of levels to show: the first level (1) or the first and second level (2).\n *\n * Defaults to `2`.\n * */\n levels?: 1 | 2;\n}\n\nexport const HvHeaderNavigation = forwardRef<\n React.ElementRef<\"nav\">,\n HvHeaderNavigationProps\n>((props, ref) => {\n const {\n data,\n selected,\n onClick,\n className,\n classes: classesProp,\n levels = 2,\n ...others\n } = useDefaultProps(\"HvHeaderNavigation\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const selectionPath = useSelectionPath(data, selected);\n\n const handleClick: HvHeaderMenuBarProps[\"onClick\"] = (event, selection) => {\n event.preventDefault();\n\n onClick?.(event, selection);\n };\n\n return (\n <SelectionContext.Provider value={selectionPath}>\n <FocusProvider>\n <nav ref={ref} className={cx(classes.root, className)} {...others}>\n <HvHeaderMenuBar\n data={data}\n type=\"menubar\"\n onClick={handleClick}\n levels={levels}\n currentLevel={1}\n />\n </nav>\n </FocusProvider>\n </SelectionContext.Provider>\n );\n});\n"],"names":[],"mappings":";;;;;;;;;AAqCO,MAAM,qBAAqB,WAGhC,CAAC,OAAO,QAAQ;AACV,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,SAAS;AAAA,IACT,GAAG;AAAA,EAAA,IACD,gBAAgB,sBAAsB,KAAK;AAE/C,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAExC,QAAA,gBAAgB,iBAAiB,MAAM,QAAQ;AAE/C,QAAA,cAA+C,CAAC,OAAO,cAAc;AACzE,UAAM,eAAe;AAErB,cAAU,OAAO,SAAS;AAAA,EAAA;AAG5B,6BACG,iBAAiB,UAAjB,EAA0B,OAAO,eAChC,8BAAC,eACC,EAAA,UAAA,oBAAC,OAAI,EAAA,KAAU,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QACzD,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,SAAS;AAAA,MACT;AAAA,MACA,cAAc;AAAA,IAAA;AAAA,EAAA,GAElB,GACF,EACF,CAAA;AAEJ,CAAC;"}
@@ -6,14 +6,14 @@ const HvSimpleGrid = (props) => {
6
6
  const {
7
7
  children,
8
8
  breakpoints,
9
- spacing = "sm",
9
+ spacing,
10
10
  cols,
11
11
  className,
12
12
  classes: classesProp,
13
13
  ...others
14
14
  } = useDefaultProps("HvSimpleGrid", props);
15
15
  const { classes, cx, css } = useClasses(classesProp);
16
- const containerStyle = getContainerStyle({ breakpoints, spacing, cols });
16
+ const containerStyle = getContainerStyle(breakpoints, spacing, cols);
17
17
  return /* @__PURE__ */ jsx(
18
18
  "div",
19
19
  {