@hitachivantara/uikit-react-core 5.74.0 → 5.76.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.
- package/dist/cjs/Badge/Badge.cjs +18 -13
- package/dist/cjs/Badge/Badge.styles.cjs +25 -14
- package/dist/cjs/Dropdown/Dropdown.cjs +271 -276
- package/dist/cjs/InlineEditor/InlineEditor.cjs +4 -2
- package/dist/cjs/QueryBuilder/Rule/Attribute/Attribute.cjs +1 -1
- package/dist/cjs/QueryBuilder/Rule/Operator/Operator.cjs +1 -1
- package/dist/cjs/QueryBuilder/Rule/Value/BooleanValue/BooleanValue.cjs +1 -1
- package/dist/cjs/Table/renderers/DropdownColumnCell/DropdownColumnCell.cjs +3 -17
- package/dist/cjs/Table/renderers/renderers.cjs +2 -5
- package/dist/esm/Badge/Badge.js +18 -13
- package/dist/esm/Badge/Badge.js.map +1 -1
- package/dist/esm/Badge/Badge.styles.js +25 -14
- package/dist/esm/Badge/Badge.styles.js.map +1 -1
- package/dist/esm/Dropdown/Dropdown.js +272 -277
- package/dist/esm/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/InlineEditor/InlineEditor.js +4 -2
- package/dist/esm/InlineEditor/InlineEditor.js.map +1 -1
- package/dist/esm/QueryBuilder/Rule/Attribute/Attribute.js +1 -1
- package/dist/esm/QueryBuilder/Rule/Attribute/Attribute.js.map +1 -1
- package/dist/esm/QueryBuilder/Rule/Operator/Operator.js +1 -1
- package/dist/esm/QueryBuilder/Rule/Operator/Operator.js.map +1 -1
- package/dist/esm/QueryBuilder/Rule/Value/BooleanValue/BooleanValue.js +1 -1
- package/dist/esm/QueryBuilder/Rule/Value/BooleanValue/BooleanValue.js.map +1 -1
- package/dist/esm/Table/renderers/DropdownColumnCell/DropdownColumnCell.js +3 -17
- package/dist/esm/Table/renderers/DropdownColumnCell/DropdownColumnCell.js.map +1 -1
- package/dist/esm/Table/renderers/renderers.js +2 -5
- package/dist/esm/Table/renderers/renderers.js.map +1 -1
- package/dist/types/index.d.ts +27 -28
- package/package.json +6 -6
package/dist/cjs/Badge/Badge.cjs
CHANGED
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
4
5
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
5
6
|
const Badge_styles = require("./Badge.styles.cjs");
|
|
6
7
|
const Typography = require("../Typography/Typography.cjs");
|
|
7
|
-
const HvBadge = (props) => {
|
|
8
|
+
const HvBadge = React.forwardRef((props, ref) => {
|
|
8
9
|
const {
|
|
9
10
|
classes: classesProp,
|
|
10
11
|
className,
|
|
11
12
|
showCount = false,
|
|
12
|
-
count = 0,
|
|
13
|
+
count: countProp = 0,
|
|
13
14
|
maxCount = 99,
|
|
14
|
-
label
|
|
15
|
-
icon
|
|
16
|
-
text
|
|
17
|
-
textVariant
|
|
15
|
+
label,
|
|
16
|
+
icon,
|
|
17
|
+
text,
|
|
18
|
+
textVariant,
|
|
18
19
|
...others
|
|
19
20
|
} = uikitReactUtils.useDefaultProps("HvBadge", props);
|
|
20
21
|
const { classes, cx } = Badge_styles.useClasses(classesProp);
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const count = typeof label === "number" ? label : countProp;
|
|
23
|
+
const countValue = count > maxCount ? `${maxCount}+` : count;
|
|
24
|
+
const renderedCount = showCount && count > 0 ? countValue : "";
|
|
25
|
+
const renderedCountOrLabel = label && typeof label !== "number" ? label : renderedCount;
|
|
26
|
+
const children = icon || text && /* @__PURE__ */ jsxRuntime.jsx(Typography.HvTypography, { variant: textVariant, children: text });
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: cx(classes.root, className), ...others, children: [
|
|
28
|
+
children,
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cx({ [classes.badgeContainer]: children }), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
30
|
"div",
|
|
28
31
|
{
|
|
29
32
|
className: cx(classes.badgePosition, {
|
|
33
|
+
[classes.badgeHidden]: !(count > 0 || renderedCountOrLabel),
|
|
34
|
+
// TODO: remove unnecessary classes in v6 (hoist+rename `badge` to `badgePosition`)
|
|
30
35
|
[classes.badge]: !!(count > 0 || renderedCountOrLabel),
|
|
31
36
|
[classes.showCount]: !!(!label && renderedCountOrLabel),
|
|
32
37
|
[classes.showLabel]: !!label,
|
|
@@ -37,6 +42,6 @@ const HvBadge = (props) => {
|
|
|
37
42
|
}
|
|
38
43
|
) })
|
|
39
44
|
] });
|
|
40
|
-
};
|
|
45
|
+
});
|
|
41
46
|
exports.badgeClasses = Badge_styles.staticClasses;
|
|
42
47
|
exports.HvBadge = HvBadge;
|
|
@@ -2,27 +2,38 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
4
4
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
5
|
-
const labelBaseStyle = {
|
|
6
|
-
...uikitStyles.theme.typography.caption2,
|
|
7
|
-
padding: "0 5px",
|
|
8
|
-
color: uikitStyles.theme.colors.atmo1,
|
|
9
|
-
lineHeight: "16px"
|
|
10
|
-
};
|
|
11
5
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBadge", {
|
|
12
6
|
root: { position: "relative", "&>*": { float: "left" } },
|
|
7
|
+
/** class applied to the badge container when it has content */
|
|
13
8
|
badgeContainer: { width: 0 },
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
/** class applied to the badge */
|
|
10
|
+
badgePosition: {
|
|
11
|
+
...uikitStyles.theme.typography.caption2,
|
|
12
|
+
color: uikitStyles.theme.colors.atmo1,
|
|
13
|
+
borderRadius: uikitStyles.theme.radii.full,
|
|
17
14
|
backgroundColor: uikitStyles.theme.colors.secondary,
|
|
15
|
+
lineHeight: "16px",
|
|
16
|
+
minWidth: 8,
|
|
17
|
+
padding: "0 5px",
|
|
18
18
|
float: "left",
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
wordBreak: "keep-all",
|
|
20
|
+
textAlign: "center",
|
|
21
|
+
":empty": {
|
|
22
|
+
height: 8,
|
|
23
|
+
width: 8,
|
|
24
|
+
padding: 0
|
|
25
|
+
}
|
|
21
26
|
},
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
/** applied to the badge when it's visible */
|
|
28
|
+
badge: {},
|
|
29
|
+
/** applied to the badge when it's hidden */
|
|
30
|
+
badgeHidden: {
|
|
31
|
+
display: "none"
|
|
32
|
+
},
|
|
33
|
+
showCount: {},
|
|
34
|
+
showLabel: {},
|
|
24
35
|
badgeIcon: { position: "relative", top: "1px", left: "-7px" },
|
|
25
|
-
badgeOneDigit: { padding: 0, width: "16px"
|
|
36
|
+
badgeOneDigit: { padding: 0, width: "16px" }
|
|
26
37
|
});
|
|
27
38
|
exports.staticClasses = staticClasses;
|
|
28
39
|
exports.useClasses = useClasses;
|