@hitachivantara/uikit-react-core 5.93.1 → 5.94.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 (50) hide show
  1. package/dist/cjs/Avatar/Avatar.styles.cjs +1 -0
  2. package/dist/cjs/Badge/Badge.cjs +7 -0
  3. package/dist/cjs/Badge/Badge.styles.cjs +1 -1
  4. package/dist/cjs/Banner/BannerContent/BannerContent.styles.cjs +1 -2
  5. package/dist/cjs/BaseDropdown/BaseDropdown.styles.cjs +5 -16
  6. package/dist/cjs/BaseDropdown/BaseDropdownPanel.cjs +1 -0
  7. package/dist/cjs/BaseInput/BaseInput.styles.cjs +1 -1
  8. package/dist/cjs/BulkActions/BulkActions.styles.cjs +1 -1
  9. package/dist/cjs/DropDownMenu/DropDownMenu.styles.cjs +1 -15
  10. package/dist/cjs/DropdownButton/DropdownButton.styles.cjs +1 -8
  11. package/dist/cjs/FormElement/CharCounter/CharCounter.cjs +1 -1
  12. package/dist/cjs/FormElement/Suggestions/Suggestions.styles.cjs +7 -1
  13. package/dist/cjs/IconContainer/IconContainer.cjs +4 -4
  14. package/dist/cjs/Input/Input.cjs +18 -21
  15. package/dist/cjs/Input/Input.styles.cjs +2 -6
  16. package/dist/cjs/Select/Select.styles.cjs +5 -12
  17. package/dist/cjs/TagsInput/TagsInput.cjs +3 -0
  18. package/dist/cjs/TagsInput/TagsInput.styles.cjs +1 -1
  19. package/dist/cjs/TextArea/TextArea.cjs +1 -0
  20. package/dist/cjs/VerticalNavigation/VerticalNavigation.cjs +1 -2
  21. package/dist/cjs/icons.cjs +19 -21
  22. package/dist/cjs/utils/Callout.cjs +4 -2
  23. package/dist/cjs/utils/focusUtils.cjs +2 -0
  24. package/dist/esm/Avatar/Avatar.styles.js +1 -0
  25. package/dist/esm/Badge/Badge.js +8 -1
  26. package/dist/esm/Badge/Badge.styles.js +1 -1
  27. package/dist/esm/Banner/BannerContent/BannerContent.styles.js +1 -2
  28. package/dist/esm/BaseDropdown/BaseDropdown.styles.js +5 -16
  29. package/dist/esm/BaseDropdown/BaseDropdownPanel.js +1 -0
  30. package/dist/esm/BaseInput/BaseInput.styles.js +1 -1
  31. package/dist/esm/BulkActions/BulkActions.styles.js +1 -1
  32. package/dist/esm/DropDownMenu/DropDownMenu.styles.js +1 -15
  33. package/dist/esm/DropdownButton/DropdownButton.styles.js +1 -8
  34. package/dist/esm/FormElement/CharCounter/CharCounter.js +1 -1
  35. package/dist/esm/FormElement/Suggestions/Suggestions.styles.js +7 -1
  36. package/dist/esm/IconContainer/IconContainer.js +4 -4
  37. package/dist/esm/Input/Input.js +19 -22
  38. package/dist/esm/Input/Input.styles.js +2 -6
  39. package/dist/esm/Select/Select.styles.js +5 -12
  40. package/dist/esm/TagsInput/TagsInput.js +3 -0
  41. package/dist/esm/TagsInput/TagsInput.styles.js +1 -1
  42. package/dist/esm/TextArea/TextArea.js +1 -0
  43. package/dist/esm/VerticalNavigation/VerticalNavigation.js +1 -2
  44. package/dist/esm/icons.js +19 -21
  45. package/dist/esm/utils/Callout.js +4 -2
  46. package/dist/esm/utils/focusUtils.js +2 -0
  47. package/dist/types/index.d.ts +62 -95
  48. package/package.json +5 -5
  49. package/dist/cjs/VerticalNavigation/utils/VerticalNavigation.utils.cjs +0 -6
  50. package/dist/esm/VerticalNavigation/utils/VerticalNavigation.utils.js +0 -6
@@ -9,21 +9,7 @@ const { staticClasses, useClasses } = createClasses("HvDropDownMenu", {
9
9
  },
10
10
  /** @deprecated use `classes.root` instead */
11
11
  container: {},
12
- baseContainer: {
13
- "--r": theme.radii.base,
14
- "&[data-popper-placement=bottom-end] .HvBaseDropdown-panel": {
15
- borderRadius: "var(--r) 0 var(--r) var(--r)"
16
- },
17
- "&[data-popper-placement=bottom-start] .HvBaseDropdown-panel": {
18
- borderRadius: "0 var(--r) var(--r) var(--r)"
19
- },
20
- "&[data-popper-placement=top-start] .HvBaseDropdown-panel": {
21
- borderRadius: "var(--r) var(--r) var(--r) 0"
22
- },
23
- "&[data-popper-placement=top-end] .HvBaseDropdown-panel": {
24
- borderRadius: "var(--r) var(--r) 0 var(--r)"
25
- }
26
- },
12
+ baseContainer: {},
27
13
  /** @deprecated use `classes.root` instead */
28
14
  icon: {},
29
15
  iconSelected: {
@@ -28,14 +28,7 @@ const { staticClasses, useClasses } = createClasses("HvDropdownButton", {
28
28
  ...disabledStyle
29
29
  },
30
30
  open: {
31
- "--r": theme.radii.base,
32
- backgroundColor: theme.colors.bgContainer,
33
- "&[data-popper-placement*='top']": {
34
- borderRadius: "0px 0px var(--r) var(--r)"
35
- },
36
- "&[data-popper-placement*='bottom']": {
37
- borderRadius: "var(--r) var(--r) 0px 0px"
38
- }
31
+ backgroundColor: theme.colors.bgContainer
39
32
  },
40
33
  selection: {
41
34
  color: "inherit",
@@ -15,7 +15,7 @@ const HvCharCounter = (props) => {
15
15
  className,
16
16
  id: idProp,
17
17
  disabled: disabledProp,
18
- disableGutter = false,
18
+ disableGutter,
19
19
  ...others
20
20
  } = useDefaultProps("HvCharCounter", props);
21
21
  const { classes, cx } = useClasses(classesProp);
@@ -5,6 +5,7 @@ const { staticClasses, useClasses } = createClasses("HvSuggestions", {
5
5
  list: {
6
6
  backgroundColor: theme.colors.bgContainer,
7
7
  border: `1px solid ${theme.colors.text}`,
8
+ borderRadius: theme.radii.round,
8
9
  boxShadow: theme.colors.shadow,
9
10
  padding: theme.space.xs,
10
11
  width: "100%"
@@ -14,7 +15,12 @@ const { staticClasses, useClasses } = createClasses("HvSuggestions", {
14
15
  position: "absolute",
15
16
  zIndex: theme.zIndices.tooltip,
16
17
  ":not($portal)": {
17
- transform: "translate3d(0, -1px, 0) !important"
18
+ "&[data-popper-placement*='top']": {
19
+ transform: "translate3d(0, -28px, 0) !important"
20
+ },
21
+ "&[data-popper-placement*='bottom']": {
22
+ transform: "translate3d(0, 2px, 0) !important"
23
+ }
18
24
  }
19
25
  },
20
26
  portal: {}
@@ -7,7 +7,7 @@ const { staticClasses, useClasses } = createClasses("HvIconContainer", {
7
7
  display: "inline-flex",
8
8
  flex: "0 0 auto",
9
9
  // ensure icon doesn't flex grow/shrink
10
- fontSize: `var(--icsize, 16px)`,
10
+ fontSize: `var(--isize, 16px)`,
11
11
  // default size of 16px
12
12
  transition: "rotate 0.2s ease",
13
13
  justifyContent: "center",
@@ -39,21 +39,21 @@ const HvIconContainer = forwardRef(function HvIconContainer2(props, ref) {
39
39
  classes: classesProp,
40
40
  style,
41
41
  color,
42
- size: sizeProp = "S",
42
+ size = "S",
43
43
  rotate,
44
44
  children,
45
45
  ...others
46
46
  } = useDefaultProps("HvIconContainer", props);
47
47
  const { cx, classes } = useClasses(classesProp);
48
- const size = mapSizes(sizeProp);
49
48
  return /* @__PURE__ */ jsx(
50
49
  "div",
51
50
  {
52
51
  ref,
53
52
  className: cx(classes.root, className, {
54
- [classes[size]]: size
53
+ [classes[mapSizes(size)]]: size
55
54
  }),
56
55
  style: mergeStyles(style, {
56
+ "--isize": typeof size === "number" ? `${size}px` : void 0,
57
57
  color: getColor(color),
58
58
  rotate: rotate ? "180deg" : void 0,
59
59
  ...style
@@ -1,4 +1,4 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useRef, useState, useMemo, useCallback, useEffect } from "react";
3
3
  import { useForkRef } from "@mui/material/utils";
4
4
  import { useDefaultProps, useTheme } from "@hitachivantara/uikit-react-utils";
@@ -443,27 +443,24 @@ const HvInput = fixedForwardRef(function HvInput2(props, ref) {
443
443
  ...others
444
444
  }
445
445
  ),
446
- canShowSuggestions && /* @__PURE__ */ jsxs(Fragment, { children: [
447
- hasSuggestions && /* @__PURE__ */ jsx("div", { role: "presentation", className: classes.inputExtension }),
448
- /* @__PURE__ */ jsx(
449
- HvSuggestions,
450
- {
451
- id: setId(elementId, "suggestions"),
452
- classes: {
453
- root: classes.suggestionsContainer,
454
- list: classes.suggestionList
455
- },
456
- expanded: hasSuggestions,
457
- anchorEl: inputRef.current?.parentElement,
458
- onClose: suggestionClearHandler,
459
- onKeyDown: onSuggestionKeyDown,
460
- onSuggestionSelected: suggestionSelectedHandler,
461
- suggestionValues,
462
- enablePortal,
463
- popperProps: { ref: suggestionsRef }
464
- }
465
- )
466
- ] }),
446
+ canShowSuggestions && /* @__PURE__ */ jsx(
447
+ HvSuggestions,
448
+ {
449
+ id: setId(elementId, "suggestions"),
450
+ classes: {
451
+ root: classes.suggestionsContainer,
452
+ list: classes.suggestionList
453
+ },
454
+ expanded: hasSuggestions,
455
+ anchorEl: inputRef.current?.parentElement,
456
+ onClose: suggestionClearHandler,
457
+ onKeyDown: onSuggestionKeyDown,
458
+ onSuggestionSelected: suggestionSelectedHandler,
459
+ suggestionValues,
460
+ enablePortal,
461
+ popperProps: { ref: suggestionsRef }
462
+ }
463
+ ),
467
464
  canShowError && /* @__PURE__ */ jsx(
468
465
  HvWarningText,
469
466
  {
@@ -1,5 +1,4 @@
1
1
  import { createClasses } from "@hitachivantara/uikit-react-utils";
2
- import { theme } from "@hitachivantara/uikit-styles";
3
2
  import { staticClasses as staticClasses$1 } from "../FormElement/Suggestions/Suggestions.styles.js";
4
3
  import "../FormElement/Suggestions/Suggestions.js";
5
4
  const { staticClasses, useClasses } = createClasses("HvInput", {
@@ -29,11 +28,8 @@ const { staticClasses, useClasses } = createClasses("HvInput", {
29
28
  width: "100%"
30
29
  }
31
30
  },
32
- inputExtension: {
33
- height: theme.space.xs,
34
- backgroundColor: theme.colors.bgContainer,
35
- boxShadow: `0px 8px 0px ${theme.colors.bgContainer}, 0px 0px 9px 0px rgba(65,65,65,.12)`
36
- },
31
+ /** @deprecated unused. use `classes.suggestionsContainer ::before` instead */
32
+ inputExtension: {},
37
33
  input: {},
38
34
  inputRoot: {
39
35
  ":is(:hover,:focus-within) $iconClear": {
@@ -9,22 +9,15 @@ const { staticClasses, useClasses } = createClasses("HvSelect", {
9
9
  },
10
10
  disabled: {},
11
11
  readOnly: {},
12
- invalid: {
13
- borderColor: theme.form.errorColor
14
- },
12
+ invalid: {},
15
13
  labelContainer: {},
16
14
  label: {},
17
15
  description: {},
18
- select: {},
16
+ select: {
17
+ "&&$invalid": { borderColor: theme.form.errorColor }
18
+ },
19
19
  popper: {
20
- zIndex: theme.zIndices.popover,
21
- "--r": theme.radii.base,
22
- "&[data-popper-placement*='top'] $panel": {
23
- borderRadius: `var(--r) var(--r) 0 0`
24
- },
25
- "&[data-popper-placement*='bottom'] $panel": {
26
- borderRadius: `0 0 var(--r) var(--r)`
27
- }
20
+ zIndex: theme.zIndices.popover
28
21
  },
29
22
  panel: {
30
23
  maxHeight: 400,
@@ -40,6 +40,7 @@ const HvTagsInput = forwardRef(
40
40
  onBlur,
41
41
  onFocus,
42
42
  placeholder,
43
+ startAdornment,
43
44
  endAdornment,
44
45
  hideCounter,
45
46
  middleCountLabel = "/",
@@ -316,6 +317,7 @@ const HvTagsInput = forwardRef(
316
317
  children: hasCounter && /* @__PURE__ */ jsx(
317
318
  HvCharCounter,
318
319
  {
320
+ disableGutter: true,
319
321
  id: setId(elementId, "charCounter"),
320
322
  className: classes.characterCounter,
321
323
  separator: middleCountLabel,
@@ -358,6 +360,7 @@ const HvTagsInput = forwardRef(
358
360
  `${label2}-${i}`
359
361
  );
360
362
  }),
363
+ !disabled && !readOnly && startAdornment,
361
364
  !disabled && !readOnly && /* @__PURE__ */ jsx(
362
365
  "input",
363
366
  {
@@ -54,7 +54,7 @@ const { staticClasses, useClasses } = createClasses("HvTagsInput", {
54
54
  backgroundColor: theme.colors.bgContainer,
55
55
  borderWidth: 1,
56
56
  borderColor: theme.colors.textSubtle,
57
- borderRadius: theme.radii.base,
57
+ borderRadius: theme.radii.round,
58
58
  "&:hover": {
59
59
  borderColor: theme.colors.primary
60
60
  },
@@ -213,6 +213,7 @@ const HvTextArea = forwardRef(function HvTextArea2(props, ref) {
213
213
  children: hasCounter && /* @__PURE__ */ jsx(
214
214
  HvCharCounter,
215
215
  {
216
+ disableGutter: true,
216
217
  id: setId(elementId, "charCounter"),
217
218
  className: classes.characterCounter,
218
219
  separator: middleCountLabel,
@@ -2,7 +2,6 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useState, useMemo, useCallback } from "react";
3
3
  import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
4
4
  import { fillDataWithParentId, getParentItemById, getNavigationItemById } from "./NavigationSlider/utils.js";
5
- import { hasChildNavigationItems } from "./utils/VerticalNavigation.utils.js";
6
5
  import { useClasses } from "./VerticalNavigation.styles.js";
7
6
  import { staticClasses } from "./VerticalNavigation.styles.js";
8
7
  import { VerticalNavigationContext } from "./VerticalNavigationContext.js";
@@ -30,7 +29,7 @@ const HvVerticalNavigation = forwardRef(function HvVerticalNavigation2(props, re
30
29
  );
31
30
  const [parentItem, setParentItem] = useState(initialParentItem);
32
31
  const hasAnyChildWithData = useMemo(
33
- () => hasChildNavigationItems(parentData),
32
+ () => parentData.some((item) => item.data && item.data.length > 0),
34
33
  [parentData]
35
34
  );
36
35
  const headerTitle = useMemo(() => parentItem?.label, [parentItem]);
package/dist/esm/icons.js CHANGED
@@ -19,8 +19,8 @@ const SvgBase = styled("svg")({
19
19
  flexShrink: 0,
20
20
  transition: "rotate 0.2s ease"
21
21
  });
22
- const Svg = styled(SvgBase)(({ size, color, compact, rotate }) => ({
23
- rotate: rotate ? "180deg" : void 0,
22
+ const Svg = styled(SvgBase)(({ size, color, compact, rotation }) => ({
23
+ rotate: rotation ? "180deg" : void 0,
24
24
  margin: compact ? 0 : size === "xs" ? 10 : 8,
25
25
  color: getColor(color) ?? "inherit",
26
26
  fontSize: svgSizeMap[size] ?? size ?? svgSizeMap.sm
@@ -63,31 +63,29 @@ const defaultIconPathMap = {
63
63
  Remove: "M0 7.5h16v1H0z"
64
64
  };
65
65
  function HvIconInternal(props, ref) {
66
- const { name, title, "aria-label": ariaLabel, children, ...others } = props;
66
+ const { name, title, "aria-label": ariaLabel, rotate, ...others } = props;
67
67
  const { activeTheme } = useTheme();
68
68
  const iconsPathMap = useMemo(
69
69
  () => ({ ...defaultIconPathMap, ...activeTheme?.icons }),
70
70
  [activeTheme?.icons]
71
71
  );
72
72
  const isDefaultIcon = iconsPathMap[name] === defaultIconPathMap[name];
73
- return (
74
- // @ts-expect-error `rotate` is fine
75
- /* @__PURE__ */ jsxs(
76
- Svg,
77
- {
78
- ref,
79
- "data-name": name,
80
- viewBox: !isDefaultIcon && activeTheme?.icons?.viewBox || "0 0 16 16",
81
- focusable: false,
82
- "aria-label": ariaLabel,
83
- role: title || ariaLabel ? "img" : "none",
84
- ...others,
85
- children: [
86
- title ? /* @__PURE__ */ jsx("title", { children: title }) : null,
87
- /* @__PURE__ */ jsx("path", { d: iconsPathMap[name] })
88
- ]
89
- }
90
- )
73
+ return /* @__PURE__ */ jsxs(
74
+ Svg,
75
+ {
76
+ ref,
77
+ "data-name": name,
78
+ rotation: rotate,
79
+ viewBox: !isDefaultIcon && activeTheme?.icons?.viewBox || "0 0 16 16",
80
+ focusable: false,
81
+ "aria-label": ariaLabel,
82
+ role: title || ariaLabel ? "img" : "none",
83
+ ...others,
84
+ children: [
85
+ title ? /* @__PURE__ */ jsx("title", { children: title }) : null,
86
+ /* @__PURE__ */ jsx("path", { d: iconsPathMap[name] })
87
+ ]
88
+ }
91
89
  );
92
90
  }
93
91
  const HvIcon = memo(forwardRef(HvIconInternal));
@@ -12,7 +12,8 @@ const { useClasses } = createClasses("HvCallout", {
12
12
  position: "relative",
13
13
  boxShadow: "none",
14
14
  flexWrap: "nowrap",
15
- padding: 0
15
+ padding: 0,
16
+ borderRadius: theme.radii.round
16
17
  },
17
18
  success: {
18
19
  backgroundColor: theme.colors.positiveDimmed
@@ -44,7 +45,8 @@ const { useClasses } = createClasses("HvCallout", {
44
45
  wordBreak: "break-word"
45
46
  },
46
47
  messageIcon: {
47
- lineHeight: 0
48
+ lineHeight: 0,
49
+ flexShrink: 0
48
50
  },
49
51
  messageTitle: {
50
52
  display: "block",
@@ -1,4 +1,6 @@
1
1
  const outlineStyles = {
2
+ outline: "none",
3
+ // remove the default outlines
2
4
  boxShadow: "0 0 0 1px #52A8EC, 0 0 0 4px rgba(29,155,209,.3)"
3
5
  };
4
6
  export {