@hitachivantara/uikit-react-core 6.7.0 → 6.8.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.
@@ -23,7 +23,7 @@ const HvBaseDropdown = forwardRef(function BaseDropdown(props, ref) {
23
23
  adornment,
24
24
  expanded,
25
25
  popperProps,
26
- variableWidth,
26
+ variableWidth = false,
27
27
  placement: placementProp = "right",
28
28
  dropdownHeaderProps,
29
29
  defaultExpanded,
@@ -75,7 +75,10 @@ const { useClasses, staticClasses } = createClasses("HvBaseDropdown", {
75
75
  display: "block",
76
76
  color: theme.colors.textSubtle
77
77
  },
78
- panel: {}
78
+ panel: {
79
+ padding: 0
80
+ // TODO(major): re-add padding as most elements need it
81
+ }
79
82
  });
80
83
  export {
81
84
  staticClasses,
@@ -16,8 +16,7 @@ const { useClasses } = createClasses(name, {
16
16
  width: "auto"
17
17
  },
18
18
  panel: {
19
- padding: 0,
20
- // TODO(major): remove padding as most elements need it
19
+ padding: theme.space.xs,
21
20
  border: `1px solid ${theme.colors.text}`
22
21
  }
23
22
  });
@@ -27,7 +26,7 @@ const HvDropdownPanel = (props) => {
27
26
  className,
28
27
  containerId,
29
28
  children,
30
- variableWidth,
29
+ variableWidth = true,
31
30
  anchorEl,
32
31
  disablePortal,
33
32
  modifiers: modifiersProp,
@@ -1,9 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useContext, useRef } from "react";
3
- import ClickAwayListener from "@mui/material/ClickAwayListener";
4
- import Popper from "@mui/material/Popper";
5
3
  import { useForkRef } from "@mui/material/utils";
6
- import { useDefaultProps, useTheme } from "@hitachivantara/uikit-react-utils";
4
+ import { useDefaultProps, useTheme, mergeStyles } from "@hitachivantara/uikit-react-utils";
5
+ import { HvDropdownPanel } from "../../BaseDropdown/BaseDropdownPanel.js";
7
6
  import { getContainerElement } from "../../utils/document.js";
8
7
  import { setId } from "../../utils/setId.js";
9
8
  import { HvFormElementContext } from "../context.js";
@@ -38,13 +37,13 @@ const HvSuggestions = forwardRef(function HvSuggestions2(props, extRef) {
38
37
  ref: forkedRef,
39
38
  className: cx(classes.root, className),
40
39
  ...others,
41
- children: /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: onClose, children: /* @__PURE__ */ jsx(
42
- Popper,
40
+ children: /* @__PURE__ */ jsx(
41
+ HvDropdownPanel,
43
42
  {
44
- style: {
45
- // @ts-ignore
46
- "--popper-width": enablePortal ? `${anchorEl?.clientWidth}px` : "100%"
47
- },
43
+ onClickAway: onClose,
44
+ style: mergeStyles(void 0, {
45
+ "--popper-width": enablePortal && `${anchorEl?.clientWidth}px`
46
+ }),
48
47
  open: openProp,
49
48
  disablePortal: !enablePortal,
50
49
  container: enablePortal ? getContainerElement(rootId) : void 0,
@@ -52,6 +51,7 @@ const HvSuggestions = forwardRef(function HvSuggestions2(props, extRef) {
52
51
  className: cx(classes.popper, {
53
52
  [classes.portal]: enablePortal
54
53
  }),
54
+ classes: { panel: classes.panel },
55
55
  ...popperProps,
56
56
  children: /* @__PURE__ */ jsx(
57
57
  HvSelectionList,
@@ -59,11 +59,13 @@ const HvSuggestions = forwardRef(function HvSuggestions2(props, extRef) {
59
59
  className: classes.list,
60
60
  id: setId(id, "list"),
61
61
  onChange: onSuggestionSelected,
62
+ onMouseDown: (evt) => evt.preventDefault(),
63
+ onPointerDown: (evt) => evt.preventDefault(),
62
64
  children: suggestionValues?.map((item) => /* @__PURE__ */ jsx(HvListItem, { value: item, disabled: item.disabled, children: item.label }, item.id))
63
65
  }
64
66
  )
65
67
  }
66
- ) })
68
+ )
67
69
  }
68
70
  );
69
71
  });
@@ -1,27 +1,14 @@
1
1
  import { createClasses } from "@hitachivantara/uikit-react-utils";
2
- import { theme } from "@hitachivantara/uikit-styles";
3
2
  const { staticClasses, useClasses } = createClasses("HvSuggestions", {
4
- root: { position: "relative" },
3
+ root: {
4
+ position: "relative"
5
+ },
6
+ panel: {},
5
7
  list: {
6
- backgroundColor: theme.colors.bgContainer,
7
- border: `1px solid ${theme.colors.text}`,
8
- borderRadius: theme.radii.round,
9
- boxShadow: theme.colors.shadow,
10
- padding: theme.space.xs,
11
8
  width: "100%"
12
9
  },
13
10
  popper: {
14
- width: "var(--popper-width)",
15
- position: "absolute",
16
- zIndex: theme.zIndices.tooltip,
17
- ":not($portal)": {
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
- }
24
- }
11
+ width: "var(--popper-width, 100%)"
25
12
  },
26
13
  portal: {}
27
14
  });
@@ -46,7 +46,7 @@ const useTreeViewNodes = ({
46
46
  [instance]
47
47
  );
48
48
  const getChildrenIds = useEventCallback(
49
- (nodeId) => Object.values(nodeMap.current).filter((node) => node.parentId === nodeId).sort((a, b) => a.index - b.index).map((child) => child.id)
49
+ (nodeId) => Object.values(nodeMap.current).filter((node) => node.parentId === nodeId).toSorted((a, b) => a.index - b.index).map((child) => child.id)
50
50
  );
51
51
  const getNavigableChildrenIds = (nodeId) => {
52
52
  let childrenIds = instance.getChildrenIds(nodeId);
@@ -1,22 +1,24 @@
1
1
  import * as React from "react";
2
2
  const useTreeViewModels = (plugins, props) => {
3
3
  const modelsRef = React.useRef({});
4
- const [modelsState, setModelsState] = React.useState(() => {
5
- const initialState = {};
6
- plugins.forEach((plugin) => {
7
- if (plugin.models) {
8
- Object.entries(plugin.models).forEach(([modelName, model]) => {
9
- modelsRef.current[modelName] = {
10
- controlledProp: model.controlledProp,
11
- defaultProp: model.defaultProp,
12
- isControlled: props[model.controlledProp] !== void 0
13
- };
14
- initialState[modelName] = props[model.defaultProp];
15
- });
16
- }
17
- });
18
- return initialState;
19
- });
4
+ const [modelsState, setModelsState] = React.useState(
5
+ () => {
6
+ const initialState = {};
7
+ plugins.forEach((plugin) => {
8
+ if (plugin.models) {
9
+ Object.entries(plugin.models).forEach(([modelName, model]) => {
10
+ modelsRef.current[modelName] = {
11
+ controlledProp: model.controlledProp,
12
+ defaultProp: model.defaultProp,
13
+ isControlled: props[model.controlledProp] !== void 0
14
+ };
15
+ initialState[modelName] = props[model.defaultProp];
16
+ });
17
+ }
18
+ });
19
+ return initialState;
20
+ }
21
+ );
20
22
  const models = Object.fromEntries(
21
23
  Object.entries(modelsRef.current).map(([modelName, model]) => {
22
24
  const value = model.isControlled ? props[model.controlledProp] : modelsState[modelName];
package/dist/index.d.ts CHANGED
@@ -1364,7 +1364,7 @@ export declare interface HvBaseCheckBoxProps extends Omit<CheckboxProps, "onChan
1364
1364
 
1365
1365
  export declare const HvBaseDropdown: ForwardRefExoticComponent<Omit<HvBaseDropdownProps, "ref"> & RefAttributes<HTMLDivElement>>;
1366
1366
 
1367
- export declare type HvBaseDropdownClasses = ExtractNames<typeof useClasses_19>;
1367
+ export declare type HvBaseDropdownClasses = ExtractNames<typeof useClasses_18>;
1368
1368
 
1369
1369
  export declare interface HvBaseDropdownProps extends HvBaseProps<HTMLDivElement, "onToggle"> {
1370
1370
  /**
@@ -1462,7 +1462,7 @@ export declare interface HvBaseDropdownProps extends HvBaseProps<HTMLDivElement,
1462
1462
  */
1463
1463
  export declare const HvBaseInput: ForwardRefExoticComponent<HvBaseInputProps & RefAttributes<HTMLInputElement>>;
1464
1464
 
1465
- export declare type HvBaseInputClasses = ExtractNames<typeof useClasses_18>;
1465
+ export declare type HvBaseInputClasses = ExtractNames<typeof useClasses_20>;
1466
1466
 
1467
1467
  export declare interface HvBaseInputProps extends Omit<InputBaseProps, "onChange" | "classes" | "ref" | "color" | "size" | "inputProps"> {
1468
1468
  /** The input name. */
@@ -2929,7 +2929,7 @@ export declare const HvDropdownPanel: (props: HvDropdownPanelProps) => JSX_2.Ele
2929
2929
 
2930
2930
  export declare interface HvDropdownPanelProps extends Omit<PopperProps, "children">, Pick<HvBaseDropdownProps, "disablePortal" | "children"> {
2931
2931
  variableWidth?: boolean;
2932
- classes?: ExtractNames<typeof useClasses_20>;
2932
+ classes?: ExtractNames<typeof useClasses_19>;
2933
2933
  containerId?: string;
2934
2934
  onToggle?: (event: any) => void;
2935
2935
  onFirstUpdate?: OptionsGeneric<any>["onFirstUpdate"];
@@ -5672,7 +5672,7 @@ export declare interface HvSuggestionsProps extends HvBaseProps {
5672
5672
  /** Function called when a suggestion is selected */
5673
5673
  onSuggestionSelected?: (event: React.MouseEvent, value: HvSuggestion) => void;
5674
5674
  /** Function called when suggestion list is closed */
5675
- onClose?: ClickAwayListenerProps["onClickAway"];
5675
+ onClose?: HvDropdownPanelProps["onClickAway"];
5676
5676
  /** A Jss Object used to override or extend the styles applied to the component. */
5677
5677
  classes?: HvSuggestionsClasses;
5678
5678
  /**
@@ -5682,7 +5682,7 @@ export declare interface HvSuggestionsProps extends HvBaseProps {
5682
5682
  * */
5683
5683
  enablePortal?: boolean;
5684
5684
  /** Props passed to the underlying MUI Popper component */
5685
- popperProps?: Partial<PopperProps>;
5685
+ popperProps?: Partial<HvDropdownPanelProps>;
5686
5686
  }
5687
5687
 
5688
5688
  /**
@@ -7507,6 +7507,7 @@ declare type StringKey<D> = Extract<keyof D, string>;
7507
7507
 
7508
7508
  export declare const suggestionsClasses: {
7509
7509
  root: string;
7510
+ panel: string;
7510
7511
  list: string;
7511
7512
  popper: string;
7512
7513
  portal: string;
@@ -8367,9 +8368,10 @@ declare const useClasses_16: (classesProp?: Partial<Record<"vertical" | "horizon
8367
8368
  readonly cx: (...args: any) => string;
8368
8369
  };
8369
8370
 
8370
- declare const useClasses_17: (classesProp?: Partial<Record<"list" | "root" | "popper" | "portal", string>>, addStatic?: boolean) => {
8371
+ declare const useClasses_17: (classesProp?: Partial<Record<"list" | "root" | "panel" | "popper" | "portal", string>>, addStatic?: boolean) => {
8371
8372
  readonly classes: {
8372
8373
  root: string;
8374
+ panel: string;
8373
8375
  list: string;
8374
8376
  popper: string;
8375
8377
  portal: string;
@@ -8378,25 +8380,7 @@ declare const useClasses_17: (classesProp?: Partial<Record<"list" | "root" | "po
8378
8380
  readonly cx: (...args: any) => string;
8379
8381
  };
8380
8382
 
8381
- declare const useClasses_18: (classesProp?: Partial<Record<"disabled" | "input" | "readOnly" | "root" | "invalid" | "focused" | "multiline" | "resizable" | "inputDisabled" | "inputReadOnly" | "inputResizable", string>>, addStatic?: boolean) => {
8382
- readonly classes: {
8383
- root: string;
8384
- disabled: string;
8385
- invalid: string;
8386
- multiline: string;
8387
- resizable: string;
8388
- readOnly: string;
8389
- focused: string;
8390
- input: string;
8391
- inputDisabled: string;
8392
- inputReadOnly: string;
8393
- inputResizable: string;
8394
- };
8395
- readonly css: any;
8396
- readonly cx: (...args: any) => string;
8397
- };
8398
-
8399
- declare const useClasses_19: (classesProp?: Partial<Record<"container" | "header" | "anchor" | "placeholder" | "root" | "rootDisabled" | "headerOpen" | "headerDisabled" | "headerReadOnly" | "arrowContainer" | "arrow" | "selection" | "selectionDisabled" | "panel", string>>, addStatic?: boolean) => {
8383
+ declare const useClasses_18: (classesProp?: Partial<Record<"container" | "header" | "anchor" | "placeholder" | "root" | "rootDisabled" | "headerOpen" | "headerDisabled" | "headerReadOnly" | "arrowContainer" | "arrow" | "selection" | "selectionDisabled" | "panel", string>>, addStatic?: boolean) => {
8400
8384
  readonly classes: {
8401
8385
  root: string;
8402
8386
  rootDisabled: string;
@@ -8417,6 +8401,15 @@ declare const useClasses_19: (classesProp?: Partial<Record<"container" | "header
8417
8401
  readonly cx: (...args: any) => string;
8418
8402
  };
8419
8403
 
8404
+ declare const useClasses_19: (classesProp?: Partial<Record<"container" | "panel", string>>, addStatic?: boolean) => {
8405
+ readonly classes: {
8406
+ container: string;
8407
+ panel: string;
8408
+ };
8409
+ readonly css: any;
8410
+ readonly cx: (...args: any) => string;
8411
+ };
8412
+
8420
8413
  declare const useClasses_2: (classesProp?: Partial<Record<"disabled" | "root" | "isLink" | "noWrap", string>>, addStatic?: boolean) => {
8421
8414
  readonly classes: {
8422
8415
  root: string;
@@ -8428,10 +8421,19 @@ declare const useClasses_2: (classesProp?: Partial<Record<"disabled" | "root" |
8428
8421
  readonly cx: (...args: any) => string;
8429
8422
  };
8430
8423
 
8431
- declare const useClasses_20: (classesProp?: Partial<Record<"container" | "panel", string>>, addStatic?: boolean) => {
8424
+ declare const useClasses_20: (classesProp?: Partial<Record<"disabled" | "input" | "readOnly" | "root" | "invalid" | "focused" | "multiline" | "resizable" | "inputDisabled" | "inputReadOnly" | "inputResizable", string>>, addStatic?: boolean) => {
8432
8425
  readonly classes: {
8433
- container: string;
8434
- panel: string;
8426
+ root: string;
8427
+ disabled: string;
8428
+ invalid: string;
8429
+ multiline: string;
8430
+ resizable: string;
8431
+ readOnly: string;
8432
+ focused: string;
8433
+ input: string;
8434
+ inputDisabled: string;
8435
+ inputReadOnly: string;
8436
+ inputResizable: string;
8435
8437
  };
8436
8438
  readonly css: any;
8437
8439
  readonly cx: (...args: any) => string;
@@ -173,6 +173,16 @@ const next = mergeTheme(next$1, {
173
173
  }
174
174
  }
175
175
  },
176
+ HvSuggestions: {
177
+ classes: {
178
+ panel: {
179
+ margin: theme.spacing("xxs", 0),
180
+ "&&": {
181
+ borderRadius: theme.radii.round
182
+ }
183
+ }
184
+ }
185
+ },
176
186
  HvSnackbarContent: {
177
187
  classes: {
178
188
  root: {
@@ -42,12 +42,17 @@ const notificationMap = {
42
42
  const inputColors = {
43
43
  bg: ld("#FFFFFF", "#020617")
44
44
  };
45
+ const shadows = {
46
+ container: theme.colors.shadow,
47
+ elevated: `0 16px 16px 0 ${theme.alpha(slate[900], 0.1)}, 0 10px 10px 0 ${theme.alpha(slate[900], 0.08)}, 0 6px 6px 0 ${theme.alpha(slate[900], 0.06)}, 0 3px 3px 0 ${theme.alpha(slate[900], 0.04)}, 0 1px 1px 0 ${theme.alpha(slate[900], 0.02)}`,
48
+ modal: `0 32px 32px 0 ${theme.alpha(slate[900], 0.1)}, 0 20px 20px 0 ${theme.alpha(slate[900], 0.08)}, 0 12px 12px 0 ${theme.alpha(slate[900], 0.06)}, 0 5px 5px 0 ${theme.alpha(slate[900], 0.04)}, 0 1px 1px 0 ${theme.alpha(slate[900], 0.02)}`
49
+ };
45
50
  const popperStyles = {
46
51
  margin: theme.spacing("xxs", 0),
47
52
  backgroundColor: theme.colors.bgContainer,
48
53
  border: `1px solid ${theme.colors.borderSubtle}`,
49
54
  borderRadius: theme.radii.large,
50
- boxShadow: `0px 0px 6px 0px rgba(65, 65, 65, 0.08)`
55
+ boxShadow: shadows.container
51
56
  };
52
57
  const pentaho = mergeTheme(pentaho$1, {
53
58
  icons: {
@@ -314,13 +319,6 @@ const pentaho = mergeTheme(pentaho$1, {
314
319
  }
315
320
  }
316
321
  },
317
- HvSuggestions: {
318
- classes: {
319
- list: {
320
- ...popperStyles
321
- }
322
- }
323
- },
324
322
  HvTagsInput: {
325
323
  classes: {
326
324
  tagsList: {
@@ -577,7 +575,8 @@ const pentaho = mergeTheme(pentaho$1, {
577
575
  HvDialog: {
578
576
  classes: {
579
577
  paper: {
580
- borderRadius: theme.radii.large
578
+ borderRadius: theme.radii.large,
579
+ boxShadow: shadows.modal
581
580
  },
582
581
  statusBar: {
583
582
  border: "none",
@@ -755,6 +754,7 @@ const pentaho = mergeTheme(pentaho$1, {
755
754
  classes: {
756
755
  root: {
757
756
  outlineColor: theme.colors.borderSubtle,
757
+ boxShadow: theme.colors.shadow,
758
758
  "--rb": theme.radii.large,
759
759
  // default non-semantic card
760
760
  "&[data-color=sema0]": {
@@ -961,7 +961,8 @@ const pentaho = mergeTheme(pentaho$1, {
961
961
  HvTooltip: {
962
962
  classes: {
963
963
  tooltip: {
964
- padding: theme.spacing("xs", "sm")
964
+ padding: theme.spacing("xs", "sm"),
965
+ boxShadow: shadows.elevated
965
966
  }
966
967
  }
967
968
  },
@@ -1130,7 +1131,8 @@ const pentaho = mergeTheme(pentaho$1, {
1130
1131
  classes: {
1131
1132
  root: {
1132
1133
  width: 525,
1133
- minHeight: "unset"
1134
+ minHeight: "unset",
1135
+ boxShadow: theme.colors.shadow
1134
1136
  },
1135
1137
  messageText: {
1136
1138
  paddingLeft: 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/uikit-react-core",
3
- "version": "6.7.0",
3
+ "version": "6.8.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "Hitachi Vantara UI Kit Team",
@@ -33,9 +33,9 @@
33
33
  "dependencies": {
34
34
  "@emotion/cache": "^11.11.0",
35
35
  "@emotion/serialize": "^1.1.2",
36
- "@hitachivantara/uikit-react-shared": "^6.0.3",
37
- "@hitachivantara/uikit-react-utils": "^6.2.1",
38
- "@hitachivantara/uikit-styles": "^6.0.3",
36
+ "@hitachivantara/uikit-react-shared": "^6.0.4",
37
+ "@hitachivantara/uikit-react-utils": "^6.2.2",
38
+ "@hitachivantara/uikit-styles": "^6.1.0",
39
39
  "@internationalized/date": "^3.2.0",
40
40
  "@mui/base": "7.0.0-beta.4",
41
41
  "@popperjs/core": "^2.11.8",
@@ -61,7 +61,7 @@
61
61
  "access": "public",
62
62
  "directory": "package"
63
63
  },
64
- "gitHead": "1d7f5a386ac0f94271bb66501d76f39e3146d614",
64
+ "gitHead": "f79885f320f5cdf5b438ef8b2e866965c9626ce7",
65
65
  "exports": {
66
66
  ".": {
67
67
  "types": "./dist/index.d.ts",