@hitachivantara/uikit-react-core 6.4.2 → 6.4.3

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.
@@ -1,11 +1,12 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useState, useContext, useRef, useMemo } from "react";
3
- import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
3
+ import { useDefaultProps, useTheme } from "@hitachivantara/uikit-react-utils";
4
4
  import { HvIcon } from "../../icons.js";
5
5
  import { setId } from "../../utils/setId.js";
6
6
  import { HvFilterGroupContext } from "../FilterGroupContext.js";
7
7
  import { useClasses } from "./FilterContent.styles.js";
8
8
  import { staticClasses } from "./FilterContent.styles.js";
9
+ import { HvHeaderButton } from "./HeaderButton.js";
9
10
  import { HvFilterGroupLeftPanel } from "../LeftPanel/LeftPanel.js";
10
11
  import { HvFilterGroupRightPanel } from "../RightPanel/RightPanel.js";
11
12
  import { HvTypography } from "../../Typography/Typography.js";
@@ -32,11 +33,13 @@ const HvFilterGroupContent = forwardRef(function HvFilterGroupContent2(props, re
32
33
  height,
33
34
  leftEmptyElement,
34
35
  rightEmptyElement,
36
+ iconOnly,
35
37
  classes: classesProp,
36
38
  ...others
37
39
  } = useDefaultProps("HvFilterGroupContent", props);
38
- const { classes } = useClasses(classesProp);
39
40
  const [filterGroupOpen, setFilterGroupOpen] = useState(false);
41
+ const { classes } = useClasses(classesProp);
42
+ const { activeTheme } = useTheme();
40
43
  const {
41
44
  defaultValue,
42
45
  filterValues,
@@ -90,13 +93,13 @@ const HvFilterGroupContent = forwardRef(function HvFilterGroupContent2(props, re
90
93
  disabled,
91
94
  disablePortal,
92
95
  variableWidth: true,
93
- placement: horizontalPlacement,
94
96
  expanded: filterGroupOpen,
97
+ placement: horizontalPlacement,
95
98
  onToggle: handleToggle,
96
99
  onClickOutside: onCancelHandler,
97
100
  onContainerCreation: focusOnContainer,
98
- placeholder: Header,
99
- adornment: /* @__PURE__ */ jsx(HvFilterGroupCounter, {}),
101
+ placeholder: activeTheme?.name === "pentahoPlus" ? void 0 : Header,
102
+ adornment: activeTheme?.name === "pentahoPlus" ? void 0 : /* @__PURE__ */ jsx(HvFilterGroupCounter, {}),
100
103
  popperProps: {
101
104
  modifiers: [{ name: "preventOverflow", enabled: escapeWithReference }]
102
105
  },
@@ -106,6 +109,12 @@ const HvFilterGroupContent = forwardRef(function HvFilterGroupContent2(props, re
106
109
  "aria-invalid": status === "invalid" ? true : void 0,
107
110
  "aria-errormessage": status === "invalid" ? setId(id, "error") : void 0,
108
111
  "aria-describedby": [description && setId(id, "description"), ariaDescribedBy].join(" ").trim() || void 0,
112
+ ...activeTheme?.name === "pentahoPlus" && {
113
+ headerComponent: HvHeaderButton,
114
+ iconOnly,
115
+ title: labels?.placeholder,
116
+ count: filterValues?.flat().length ?? 0
117
+ },
109
118
  ...others,
110
119
  children: [
111
120
  /* @__PURE__ */ jsx("div", { ref: focusTarget, tabIndex: -1 }),
@@ -0,0 +1,104 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { useDefaultProps, createClasses } from "@hitachivantara/uikit-react-utils";
4
+ import { theme } from "@hitachivantara/uikit-styles";
5
+ import { HvIcon } from "../../icons.js";
6
+ import { HvBadge } from "../../Badge/Badge.js";
7
+ import { HvIconButton } from "../../IconButton/IconButton.js";
8
+ import { HvButton } from "../../Button/Button.js";
9
+ import { HvTypography } from "../../Typography/Typography.js";
10
+ const { useClasses } = createClasses("HvHeaderButton", {
11
+ iconOnly: {
12
+ "& > .HvBadge-badge": {
13
+ minWidth: "unset !important",
14
+ minHeight: "unset !important"
15
+ }
16
+ },
17
+ button: {
18
+ border: `1px solid ${theme.colors.primaryDimmed}`,
19
+ borderRadius: theme.radii.full
20
+ },
21
+ headerContent: {
22
+ display: "flex",
23
+ alignItems: "center",
24
+ gap: theme.space.xxs
25
+ },
26
+ badgeRoot: {
27
+ width: 0,
28
+ marginRight: theme.space.sm
29
+ },
30
+ badge: {
31
+ position: "relative"
32
+ },
33
+ badgeIconOnly: {
34
+ "&&>div:last-of-type": {
35
+ minWidth: "unset",
36
+ minHeight: "unset"
37
+ }
38
+ },
39
+ badgeIcon: {
40
+ minHeight: 0,
41
+ minWidth: 0
42
+ }
43
+ });
44
+ const HvHeaderButton = forwardRef((props, ref) => {
45
+ const {
46
+ onClick,
47
+ iconOnly,
48
+ count = 0,
49
+ disabled,
50
+ title = "Filter",
51
+ classes: classesProp,
52
+ ...others
53
+ } = useDefaultProps("HvHeaderButton", props);
54
+ const { classes } = useClasses(classesProp, false);
55
+ return iconOnly ? /* @__PURE__ */ jsx(
56
+ HvBadge,
57
+ {
58
+ ref,
59
+ label: count,
60
+ showCount: true,
61
+ className: classes.badgeIconOnly,
62
+ icon: /* @__PURE__ */ jsx(
63
+ HvIconButton,
64
+ {
65
+ onClick,
66
+ title,
67
+ disabled,
68
+ className: classes.button,
69
+ ...others,
70
+ children: /* @__PURE__ */ jsx(HvIcon, { name: "Filters" })
71
+ }
72
+ )
73
+ }
74
+ ) : /* @__PURE__ */ jsx(
75
+ HvButton,
76
+ {
77
+ ref,
78
+ disabled,
79
+ variant: "secondarySubtle",
80
+ onClick,
81
+ startIcon: /* @__PURE__ */ jsx(HvIcon, { name: "Filters" }),
82
+ ...others,
83
+ role: "combobox",
84
+ children: /* @__PURE__ */ jsxs("div", { className: classes.headerContent, children: [
85
+ /* @__PURE__ */ jsx(HvTypography, { variant: "label", children: title }),
86
+ /* @__PURE__ */ jsx(
87
+ HvBadge,
88
+ {
89
+ showCount: true,
90
+ label: count,
91
+ classes: {
92
+ root: classes.badgeRoot,
93
+ badge: classes.badge,
94
+ badgeIcon: classes.badgeIcon
95
+ }
96
+ }
97
+ )
98
+ ] })
99
+ }
100
+ );
101
+ });
102
+ export {
103
+ HvHeaderButton
104
+ };
@@ -1,5 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useContext } from "react";
3
+ import { useTheme } from "@hitachivantara/uikit-react-utils";
4
+ import { HvIcon } from "../../icons.js";
3
5
  import { HvFilterGroupContext } from "../FilterGroupContext.js";
4
6
  import { useClasses } from "./LeftPanel.styles.js";
5
7
  import { staticClasses } from "./LeftPanel.styles.js";
@@ -14,6 +16,7 @@ const HvFilterGroupLeftPanel = ({
14
16
  classes: classesProp
15
17
  }) => {
16
18
  const { classes } = useClasses(classesProp);
19
+ const { activeTheme } = useTheme();
17
20
  const { filterOptions, activeGroup, setActiveGroup } = useContext(HvFilterGroupContext);
18
21
  return /* @__PURE__ */ jsx(HvPanel, { className, children: filterOptions.length > 0 ? /* @__PURE__ */ jsx(HvListContainer, { condensed: true, interactive: true, children: filterOptions.map((group, index) => /* @__PURE__ */ jsx(
19
22
  HvListItem,
@@ -21,7 +24,7 @@ const HvFilterGroupLeftPanel = ({
21
24
  className: classes.listItem,
22
25
  onClick: () => setActiveGroup(index),
23
26
  selected: filterOptions[activeGroup].id === group.id,
24
- endAdornment: /* @__PURE__ */ jsx(HvFilterGroupCounter, { groupId: group.id }),
27
+ endAdornment: activeTheme?.name === "pentahoPlus" ? /* @__PURE__ */ jsx(HvIcon, { name: "CaretRight" }) : /* @__PURE__ */ jsx(HvFilterGroupCounter, { groupId: group.id }),
25
28
  children: /* @__PURE__ */ jsx(HvOverflowTooltip, { data: group.name })
26
29
  },
27
30
  group.id || group.name
package/dist/index.d.ts CHANGED
@@ -3269,6 +3269,7 @@ declare interface HvFilterGroupContentProps extends Omit<HvBaseDropdownProps, "o
3269
3269
  leftEmptyElement?: React.ReactNode;
3270
3270
  rightEmptyElement?: React.ReactNode;
3271
3271
  disabled?: boolean;
3272
+ iconOnly?: boolean;
3272
3273
  classes?: HvFilterGroupContentClasses;
3273
3274
  }
3274
3275
 
@@ -8964,7 +8965,7 @@ declare const useClasses_53: (classesProp?: Partial<Record<"body" | "expanded" |
8964
8965
  readonly cx: (...args: any) => string;
8965
8966
  };
8966
8967
 
8967
- declare const useClasses_54: (classesProp?: Partial<Record<"body" | "resizer" | "footer" | "head" | "root" | "resizable" | "sorted" | "alignLeft" | "alignCenter" | "alignRight" | "alignJustify" | "variantNone" | "variantCheckbox" | "variantActions" | "variantExpand" | "variantList" | "stickyColumn" | "stickyColumnMostLeft" | "stickyColumnLeastRight" | "groupColumnMostLeft" | "groupColumnMostRight" | "resizing" | "headerContent" | "headerText" | "headerParagraph" | "sortableHeaderText" | "sortable" | "sortButton" | "sortIcon" | "alignFlexLeft" | "alignFlexRight" | "alignFlexCenter" | "alignFlexJustify", string>>, addStatic?: boolean) => {
8968
+ declare const useClasses_54: (classesProp?: Partial<Record<"body" | "resizer" | "footer" | "head" | "root" | "resizable" | "headerContent" | "sorted" | "alignLeft" | "alignCenter" | "alignRight" | "alignJustify" | "variantNone" | "variantCheckbox" | "variantActions" | "variantExpand" | "variantList" | "stickyColumn" | "stickyColumnMostLeft" | "stickyColumnLeastRight" | "groupColumnMostLeft" | "groupColumnMostRight" | "resizing" | "headerText" | "headerParagraph" | "sortableHeaderText" | "sortable" | "sortButton" | "sortIcon" | "alignFlexLeft" | "alignFlexRight" | "alignFlexCenter" | "alignFlexJustify", string>>, addStatic?: boolean) => {
8968
8969
  readonly classes: {
8969
8970
  root: string;
8970
8971
  head: string;
@@ -60,7 +60,8 @@ const pentaho = mergeTheme(pentaho$1, {
60
60
  Start: "M205.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L131.31,128ZM51.31,128l74.35-74.34a8,8,0,0,0-11.32-11.32l-80,80a8,8,0,0,0,0,11.32l80,80a8,8,0,0,0,11.32-11.32Z",
61
61
  Backwards: "M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z",
62
62
  Forwards: "M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z",
63
- End: "M141.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L124.69,128,50.34,53.66A8,8,0,0,1,61.66,42.34l80,80A8,8,0,0,1,141.66,133.66Zm80-11.32-80-80a8,8,0,0,0-11.32,11.32L204.69,128l-74.35,74.34a8,8,0,0,0,11.32,11.32l80-80A8,8,0,0,0,221.66,122.34Z"
63
+ End: "M141.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L124.69,128,50.34,53.66A8,8,0,0,1,61.66,42.34l80,80A8,8,0,0,1,141.66,133.66Zm80-11.32-80-80a8,8,0,0,0-11.32,11.32L204.69,128l-74.35,74.34a8,8,0,0,0,11.32,11.32l80-80A8,8,0,0,0,221.66,122.34Z",
64
+ Filters: "M230.6,49.53A15.81,15.81,0,0,0,216,40H40A16,16,0,0,0,28.19,66.76l.08.09L96,139.17V216a16,16,0,0,0,24.87,13.32l32-21.34A16,16,0,0,0,160,194.66V139.17l67.74-72.32.08-.09A15.8,15.8,0,0,0,230.6,49.53ZM40,56h0Zm106.18,74.58A8,8,0,0,0,144,136v58.66L112,216V136a8,8,0,0,0-2.16-5.47L40,56H216Z"
64
65
  },
65
66
  components: {
66
67
  HvAvatar: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/uikit-react-core",
3
- "version": "6.4.2",
3
+ "version": "6.4.3",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "Hitachi Vantara UI Kit Team",
@@ -61,7 +61,7 @@
61
61
  "access": "public",
62
62
  "directory": "package"
63
63
  },
64
- "gitHead": "3f10053759d187946255aede1c25203f4fea7940",
64
+ "gitHead": "fe1e806628c08552c969d2b99d3d2e977be12b21",
65
65
  "exports": {
66
66
  ".": {
67
67
  "types": "./dist/index.d.ts",