@hitachivantara/uikit-react-core 5.99.1 → 5.100.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.
@@ -2,14 +2,14 @@ import { createClasses } from "@hitachivantara/uikit-react-utils";
2
2
  import { theme } from "@hitachivantara/uikit-styles";
3
3
  const show = {
4
4
  top: theme.header.height,
5
- transition: ["top"],
5
+ transitionProperty: "top",
6
6
  boxShadow: theme.colors.shadow,
7
7
  transitionDuration: "500ms",
8
8
  backgroundColor: theme.colors.bgPage
9
9
  };
10
10
  const hide = {
11
11
  top: 0,
12
- transition: ["top"],
12
+ transitionProperty: "top",
13
13
  boxShadow: "none",
14
14
  transitionDuration: "300ms"
15
15
  };
@@ -24,6 +24,7 @@ const HvLoading = forwardRef(function HvLoading2(props, ref) {
24
24
  {
25
25
  ref,
26
26
  hidden: !!hidden,
27
+ "data-size": size,
27
28
  style: mergeStyles(style, {
28
29
  color: getColor(color, small ? "text" : "brand"),
29
30
  "--customColor": getColor(color)
@@ -6,28 +6,27 @@ const { staticClasses, useClasses } = createClasses("HvLoading", {
6
6
  flexDirection: "column",
7
7
  alignItems: "center",
8
8
  justifyContent: "center",
9
- gap: theme.space.xs
9
+ gap: theme.space.xs,
10
+ "&[data-size=small]": {
11
+ "--bar-size": "2px",
12
+ "--size": "18px",
13
+ "--height": "40%"
14
+ }
10
15
  },
11
16
  barContainer: {
12
17
  display: "flex",
13
18
  alignItems: "center",
14
19
  justifyContent: "space-around",
15
- ":has($regular)": {
16
- width: 30,
17
- height: 30
18
- },
19
- ":has($small)": {
20
- "--height": "40%",
21
- width: 18,
22
- height: 18
23
- }
20
+ width: "var(--size, 30px)",
21
+ height: "var(--size, 30px)"
24
22
  },
25
23
  loadingBar: {
26
24
  backgroundColor: "currentcolor",
27
25
  display: "inline-block",
28
26
  animation: "loading 1s ease-in-out infinite",
29
27
  // TODO: make this the default when it has better support
30
- width: "round(up, 0.11em, 2px)",
28
+ // width: "round(up, 0.11em, 2px)",
29
+ width: "var(--bar-size, 4px)",
31
30
  height: "100%",
32
31
  "@keyframes loading": {
33
32
  "50%": {
@@ -44,13 +43,13 @@ const { staticClasses, useClasses } = createClasses("HvLoading", {
44
43
  overlay: {},
45
44
  blur: {},
46
45
  hidden: { display: "none" },
47
- small: {
48
- width: 2
49
- },
50
- regular: {
51
- width: 4
52
- },
46
+ /** @deprecated use data-size=small instead */
47
+ small: {},
48
+ /** @deprecated use data-size=regular instead */
49
+ regular: {},
50
+ /** @deprecated leverage data-size=small instead */
53
51
  smallColor: {},
52
+ /** @deprecated leverage data-size=regular instead */
54
53
  regularColor: {}
55
54
  });
56
55
  export {
@@ -24,7 +24,7 @@ const { staticClasses, useClasses } = createClasses(name, {
24
24
  fontSize: 4,
25
25
  color: theme.colors.textDisabled
26
26
  },
27
- // TODO: remove in v6 (use classes.button)
27
+ /** @deprecated: use classes.button instead */
28
28
  text: {},
29
29
  button: {
30
30
  display: "flex",
@@ -39,7 +39,7 @@ const { staticClasses, useClasses } = createClasses("HvStatusIcon", {
39
39
  ),
40
40
  [`&[data-variant="default"]`]: {
41
41
  color: theme.colors.text,
42
- backgroundColor: theme.colors.bgContainerSecondary,
42
+ backgroundColor: theme.colors.bgPage,
43
43
  outline: `1px solid ${theme.colors.borderSubtle}`,
44
44
  [`&[data-type="simple"]`]: {
45
45
  outline: "none",
@@ -1,7 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useCallback } from "react";
3
3
  import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
4
- import { getColor } from "@hitachivantara/uikit-styles";
5
4
  import { useControlled } from "../hooks/useControlled.js";
6
5
  import { useUniqueId } from "../hooks/useUniqueId.js";
7
6
  import { setId } from "../utils/setId.js";
@@ -12,7 +11,6 @@ import { HvFormElement } from "../FormElement/FormElement.js";
12
11
  import { HvLabel } from "../FormElement/Label/Label.js";
13
12
  import { isInvalid } from "../FormElement/utils.js";
14
13
  import { HvWarningText } from "../FormElement/WarningText/WarningText.js";
15
- const isSemantical = (color) => ["positive", "negative", "warning"].includes(color);
16
14
  const HvSwitch = forwardRef(
17
15
  function HvSwitch2(props, ref) {
18
16
  const {
@@ -36,10 +34,9 @@ const HvSwitch = forwardRef(
36
34
  statusMessage,
37
35
  "aria-errormessage": ariaErrorMessage,
38
36
  inputProps,
39
- color,
40
37
  ...others
41
38
  } = useDefaultProps("HvSwitch", props);
42
- const { classes, cx, css } = useClasses(classesProp);
39
+ const { classes, cx } = useClasses(classesProp);
43
40
  const elementId = useUniqueId(id);
44
41
  const [isChecked, setIsChecked] = useControlled(checked, defaultChecked);
45
42
  const [validationState, setValidationState] = useControlled(
@@ -115,16 +112,6 @@ const HvSwitch = forwardRef(
115
112
  "aria-describedby": ariaDescribedBy,
116
113
  ...inputProps
117
114
  },
118
- ...color && {
119
- classes: {
120
- switchBase: css({
121
- "&&&+.HvBaseSwitch-track,&&&.HvBaseSwitch-checked+.HvBaseSwitch-track": {
122
- backgroundColor: getColor(color),
123
- borderColor: isSemantical(color) ? getColor(`${color}Deep`) : "#00000032"
124
- }
125
- })
126
- }
127
- },
128
115
  ...others
129
116
  }
130
117
  )
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, isValidElement, cloneElement } from "react";
3
- import { useDefaultProps, mergeStyles } from "@hitachivantara/uikit-react-utils";
3
+ import { useDefaultProps, useTheme, mergeStyles } from "@hitachivantara/uikit-react-utils";
4
4
  import { theme, getColor } from "@hitachivantara/uikit-styles";
5
5
  import { HvCheckBoxIcon } from "../BaseCheckBox/CheckBoxIcon.js";
6
6
  import { useControlled } from "../hooks/useControlled.js";
@@ -10,6 +10,12 @@ import { useClasses } from "./Tag.styles.js";
10
10
  import { staticClasses } from "./Tag.styles.js";
11
11
  import { HvButtonBase } from "../ButtonBase/ButtonBase.js";
12
12
  import { HvTypography } from "../Typography/Typography.js";
13
+ const colorMap = {
14
+ positive_20: "positive",
15
+ negative_20: "negative",
16
+ warning_20: "warning",
17
+ neutral_20: "info"
18
+ };
13
19
  const HvTag = forwardRef(function HvTag2(props, ref) {
14
20
  const {
15
21
  classes: classesProp,
@@ -25,7 +31,7 @@ const HvTag = forwardRef(function HvTag2(props, ref) {
25
31
  selected,
26
32
  defaultSelected = false,
27
33
  showSelectIcon = selectable,
28
- color,
34
+ color: colorProp,
29
35
  icon: iconProp,
30
36
  deleteIcon: deleteIconProp,
31
37
  onDelete,
@@ -37,6 +43,7 @@ const HvTag = forwardRef(function HvTag2(props, ref) {
37
43
  ...others
38
44
  } = useDefaultProps("HvTag", props);
39
45
  const { classes, cx } = useClasses(classesProp);
46
+ const { activeTheme } = useTheme();
40
47
  const [isSelected, setIsSelected] = useControlled(
41
48
  selected,
42
49
  Boolean(defaultSelected)
@@ -45,6 +52,7 @@ const HvTag = forwardRef(function HvTag2(props, ref) {
45
52
  event.stopPropagation();
46
53
  onDelete?.(event);
47
54
  };
55
+ const color = activeTheme?.name === "pentahoPlus" && colorMap[colorProp] || colorProp;
48
56
  const tagColor = (
49
57
  // backwards-compatibility for `type` prop
50
58
  type === "categorical" && theme.alpha(color || "cat1", 0.2) || // use the palette color if it matches
@@ -179,9 +179,7 @@ const ds3 = mergeTheme(ds3$1, {
179
179
  HvBaseSwitch: {
180
180
  classes: {
181
181
  root: {
182
- width: "32px",
183
- height: "16px",
184
- borderRadius: 0,
182
+ padding: 0,
185
183
  "&:hover": {
186
184
  backgroundColor: "transparent"
187
185
  },
@@ -202,7 +200,8 @@ const ds3 = mergeTheme(ds3$1, {
202
200
  },
203
201
  thumb: {
204
202
  width: 12,
205
- height: 12
203
+ height: 12,
204
+ left: -9
206
205
  }
207
206
  }
208
207
  },
@@ -1152,9 +1151,6 @@ const ds3 = mergeTheme(ds3$1, {
1152
1151
  "& button&.HvMultiButton-button&.HvMultiButton-selected": {
1153
1152
  height: 32
1154
1153
  }
1155
- },
1156
- splitDisabled: {
1157
- backgroundColor: theme.colors.atmo3
1158
1154
  }
1159
1155
  }
1160
1156
  },
@@ -44,33 +44,33 @@ const ds5 = mergeTheme(ds5$1, {
44
44
  classes: {
45
45
  root: {
46
46
  ":where(:not(.HvButton-disabled,.HvButton-contained))": {
47
- "&[data-color=warning]": { color: theme.colors.warning_140 }
47
+ "&[data-color=warning]": { color: theme.colors.warningDeep }
48
48
  }
49
49
  },
50
50
  contained: {
51
51
  ":where([data-color=primary]:not(.HvButton-disabled))": {
52
52
  ":hover, &:focus-visible": {
53
- backgroundColor: theme.colors.primary_80,
54
- borderColor: theme.colors.primary_80
53
+ backgroundColor: theme.colors.primaryStrong,
54
+ borderColor: theme.colors.primaryStrong
55
55
  }
56
56
  },
57
57
  ":where([data-color=positive]:not(.HvButton-disabled))": {
58
58
  ":hover, &:focus-visible": {
59
- backgroundColor: theme.colors.positive_80,
60
- borderColor: theme.colors.positive_80
59
+ backgroundColor: theme.colors.positiveStrong,
60
+ borderColor: theme.colors.positiveStrong
61
61
  }
62
62
  },
63
63
  ":where([data-color=warning]:not(.HvButton-disabled))": {
64
- backgroundColor: theme.colors.warning_120,
64
+ backgroundColor: theme.colors.warningStrong,
65
65
  ":hover, &:focus-visible": {
66
- backgroundColor: theme.colors.warning_140,
67
- borderColor: theme.colors.warning_140
66
+ backgroundColor: theme.colors.warningDeep,
67
+ borderColor: theme.colors.warningDeep
68
68
  }
69
69
  },
70
70
  ":where([data-color=negative]:not(.HvButton-disabled))": {
71
71
  ":hover, &:focus-visible": {
72
- backgroundColor: theme.colors.negative_80,
73
- borderColor: theme.colors.negative_80
72
+ backgroundColor: theme.colors.negativeStrong,
73
+ borderColor: theme.colors.negativeStrong
74
74
  }
75
75
  }
76
76
  }
@@ -103,10 +103,10 @@ const ds5 = mergeTheme(ds5$1, {
103
103
  splitGroup: {
104
104
  // NEXT5 subtle multi-buttons have a custom background
105
105
  "& .HvButton-subtle": {
106
- backgroundColor: theme.colors.atmo1
106
+ backgroundColor: theme.colors.bgContainer
107
107
  },
108
108
  "&& .HvButton-disabled": {
109
- backgroundColor: theme.colors.atmo3
109
+ backgroundColor: theme.colors.bgDisabled
110
110
  }
111
111
  }
112
112
  }
@@ -131,7 +131,7 @@ const ds5 = mergeTheme(ds5$1, {
131
131
  classes: {
132
132
  root: {
133
133
  "&.HvTab-selected": {
134
- color: theme.colors.secondary
134
+ color: theme.colors.text
135
135
  }
136
136
  }
137
137
  }
@@ -153,7 +153,7 @@ const ds5 = mergeTheme(ds5$1, {
153
153
  padding: 0
154
154
  },
155
155
  "& .HvIconContainer-root": {
156
- color: `${theme.colors.secondary}!important`
156
+ color: `${theme.colors.text}!important`
157
157
  }
158
158
  }
159
159
  }
@@ -112,39 +112,71 @@ const pentahoPlus = mergeTheme(pentahoPlus$1, {
112
112
  HvBaseSwitch: {
113
113
  classes: {
114
114
  root: {
115
- borderRadius: theme.radii.base,
115
+ padding: theme.space.xxs,
116
+ borderRadius: theme.radii.full,
116
117
  "&:hover": {
117
118
  backgroundColor: theme.colors.bgHover
118
119
  },
119
120
  "& .HvBaseSwitch-switchBase": {
120
121
  "& .HvBaseSwitch-thumb": {
121
122
  borderColor: "transparent",
122
- boxShadow: `0px 1px 1px 0px ${theme.alpha(slate[700], 0.16)}`
123
+ backgroundColor: "#FFFFFF",
124
+ left: -8,
125
+ top: -3,
126
+ width: 14,
127
+ height: 14
123
128
  },
124
129
  "+.HvBaseSwitch-track": {
125
- height: 14,
126
130
  backgroundColor: theme.colors.textDimmed,
127
- borderColor: theme.colors.textSubtle
131
+ border: "none",
132
+ width: 40,
133
+ height: 18
128
134
  },
129
135
  "&.HvBaseSwitch-checked": {
130
- "& .HvBaseSwitch-thumb": {
131
- border: `1px solid ${theme.colors.bgContainer}`
132
- },
133
136
  "+.HvBaseSwitch-track": {
134
- borderColor: theme.colors.primaryStrong
137
+ backgroundColor: theme.colors.positive
138
+ },
139
+ "& .HvBaseSwitch-thumb": {
140
+ left: -2
135
141
  }
136
142
  },
137
143
  "&.HvBaseSwitch-disabled": {
138
144
  "& .HvBaseSwitch-thumb": {
139
- backgroundColor: theme.colors.borderDisabled,
140
- borderColor: theme.colors.borderDisabled
145
+ borderColor: theme.colors.textDisabled
141
146
  },
142
147
  "+.HvBaseSwitch-track": {
143
- borderColor: theme.colors.borderDisabled,
144
- backgroundColor: theme.colors.bgDisabled
148
+ backgroundColor: theme.colors.bgDisabled,
149
+ border: "none"
150
+ }
151
+ },
152
+ "&[data-size=medium]": {
153
+ "+.HvBaseSwitch-track": {
154
+ width: 48,
155
+ height: 24
156
+ },
157
+ "& .HvBaseSwitch-thumb": {
158
+ left: -5,
159
+ top: 0,
160
+ width: 16,
161
+ height: 16
162
+ },
163
+ "&.HvBaseSwitch-checked .HvBaseSwitch-thumb": {
164
+ left: 3,
165
+ top: 0
145
166
  }
146
167
  }
147
168
  }
169
+ },
170
+ readOnly: {
171
+ ":hover": {
172
+ backgroundColor: "transparent"
173
+ },
174
+ "& .HvBaseSwitch-switchBase + .HvBaseSwitch-track": {
175
+ backgroundColor: theme.colors.border
176
+ },
177
+ "& .HvBaseSwitch-switchBase.HvBaseSwitch-checked + .HvBaseSwitch-track": {
178
+ backgroundColor: theme.mix("positive", 0.5, "dimmer")
179
+ }
148
180
  }
149
181
  }
150
182
  },
@@ -152,7 +184,6 @@ const pentahoPlus = mergeTheme(pentahoPlus$1, {
152
184
  classes: {
153
185
  content: {
154
186
  backgroundColor: theme.colors.bgPage
155
- // = bgContainerSecondary
156
187
  }
157
188
  }
158
189
  },
@@ -360,7 +391,7 @@ const pentahoPlus = mergeTheme(pentahoPlus$1, {
360
391
  },
361
392
  "&[data-color=secondary]": {
362
393
  borderColor: theme.colors.border,
363
- backgroundColor: theme.colors.bgContainerSecondary
394
+ backgroundColor: theme.colors.bgPage
364
395
  },
365
396
  ":hover": {
366
397
  backgroundColor: theme.colors.primaryDimmed