@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/esm/Badge/Badge.js
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
2
3
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
3
4
|
import { useClasses } from "./Badge.styles.js";
|
|
4
5
|
import { staticClasses } from "./Badge.styles.js";
|
|
5
6
|
import { HvTypography } from "../Typography/Typography.js";
|
|
6
|
-
const HvBadge = (props) => {
|
|
7
|
+
const HvBadge = forwardRef((props, ref) => {
|
|
7
8
|
const {
|
|
8
9
|
classes: classesProp,
|
|
9
10
|
className,
|
|
10
11
|
showCount = false,
|
|
11
|
-
count = 0,
|
|
12
|
+
count: countProp = 0,
|
|
12
13
|
maxCount = 99,
|
|
13
|
-
label
|
|
14
|
-
icon
|
|
15
|
-
text
|
|
16
|
-
textVariant
|
|
14
|
+
label,
|
|
15
|
+
icon,
|
|
16
|
+
text,
|
|
17
|
+
textVariant,
|
|
17
18
|
...others
|
|
18
19
|
} = useDefaultProps("HvBadge", props);
|
|
19
20
|
const { classes, cx } = useClasses(classesProp);
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const count = typeof label === "number" ? label : countProp;
|
|
22
|
+
const countValue = count > maxCount ? `${maxCount}+` : count;
|
|
23
|
+
const renderedCount = showCount && count > 0 ? countValue : "";
|
|
24
|
+
const renderedCountOrLabel = label && typeof label !== "number" ? label : renderedCount;
|
|
25
|
+
const children = icon || text && /* @__PURE__ */ jsx(HvTypography, { variant: textVariant, children: text });
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cx(classes.root, className), ...others, children: [
|
|
27
|
+
children,
|
|
28
|
+
/* @__PURE__ */ jsx("div", { className: cx({ [classes.badgeContainer]: children }), children: /* @__PURE__ */ jsx(
|
|
26
29
|
"div",
|
|
27
30
|
{
|
|
28
31
|
className: cx(classes.badgePosition, {
|
|
32
|
+
[classes.badgeHidden]: !(count > 0 || renderedCountOrLabel),
|
|
33
|
+
// TODO: remove unnecessary classes in v6 (hoist+rename `badge` to `badgePosition`)
|
|
29
34
|
[classes.badge]: !!(count > 0 || renderedCountOrLabel),
|
|
30
35
|
[classes.showCount]: !!(!label && renderedCountOrLabel),
|
|
31
36
|
[classes.showLabel]: !!label,
|
|
@@ -36,7 +41,7 @@ const HvBadge = (props) => {
|
|
|
36
41
|
}
|
|
37
42
|
) })
|
|
38
43
|
] });
|
|
39
|
-
};
|
|
44
|
+
});
|
|
40
45
|
export {
|
|
41
46
|
HvBadge,
|
|
42
47
|
staticClasses as badgeClasses
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../src/Badge/Badge.tsx"],"sourcesContent":["import {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../types/generic\";\nimport { HvTypography, HvTypographyVariants } from \"../Typography\";\nimport { staticClasses, useClasses } from \"./Badge.styles\";\n\nexport { staticClasses as badgeClasses };\n\nexport type HvBadgeClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvBadgeProps extends HvBaseProps {\n /**\n * Count is the number of unread notifications.\n * Note count and label are mutually exclusive.\n * count is ignored when label is specified at the same time.\n */\n count?: number;\n /**\n * True if count should be displayed.\n
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../src/Badge/Badge.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseProps } from \"../types/generic\";\nimport { HvTypography, HvTypographyVariants } from \"../Typography\";\nimport { staticClasses, useClasses } from \"./Badge.styles\";\n\nexport { staticClasses as badgeClasses };\n\nexport type HvBadgeClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvBadgeProps extends HvBaseProps {\n /**\n * Count is the number of unread notifications.\n * Note count and label are mutually exclusive.\n * count is ignored when label is specified at the same time.\n * @deprecated use numeric `label` instead\n */\n count?: number;\n /**\n * True if `count` should be displayed.\n *\n * NOTE: `showCount` is ignored when a **non-numeric** `label` is specified.\n */\n showCount?: boolean;\n /** The maximum number of unread notifications to be displayed */\n maxCount?: number;\n /**\n * Badge content to show in.\n *\n * If value is numeric, then `showCount` and `maxCount` will show or limit the value respectively.\n */\n label?: React.ReactNode;\n /** Icon which the notification will be attached. */\n icon?: React.ReactNode;\n /** Text which the notification will be attached. */\n text?: string;\n /** Text variant. */\n textVariant?: HvTypographyVariants;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvBadgeClasses;\n}\n\n/**\n * The badge is a component used to notify the user that something has occurred, in the app context.\n */\nexport const HvBadge = forwardRef<\n // no-indent\n HTMLDivElement,\n HvBadgeProps\n>((props, ref) => {\n const {\n classes: classesProp,\n className,\n showCount = false,\n count: countProp = 0,\n maxCount = 99,\n label,\n icon,\n text,\n textVariant,\n ...others\n } = useDefaultProps(\"HvBadge\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const count = typeof label === \"number\" ? label : countProp;\n const countValue = count > maxCount ? `${maxCount}+` : count;\n const renderedCount = showCount && count > 0 ? countValue : \"\";\n // If label is specified and non-empty, render it.\n // If showCount is specified and count > 0, render the count.\n // Otherwise, render nothing on the badge.\n // (Note count=0 should not be rendered to avoid ghosty 0.)\n const renderedCountOrLabel =\n label && typeof label !== \"number\" ? label : renderedCount;\n const children =\n icon || (text && <HvTypography variant={textVariant}>{text}</HvTypography>);\n\n return (\n <div ref={ref} className={cx(classes.root, className)} {...others}>\n {children}\n <div className={cx({ [classes.badgeContainer]: children })}>\n <div\n className={cx(classes.badgePosition, {\n [classes.badgeHidden]: !(count > 0 || renderedCountOrLabel),\n // TODO: remove unnecessary classes in v6 (hoist+rename `badge` to `badgePosition`)\n [classes.badge]: !!(count > 0 || renderedCountOrLabel),\n [classes.showCount]: !!(!label && renderedCountOrLabel),\n [classes.showLabel]: !!label,\n [classes.badgeIcon]: !!icon,\n [classes.badgeOneDigit]: String(renderedCountOrLabel).length === 1,\n })}\n >\n {renderedCountOrLabel}\n </div>\n </div>\n </div>\n );\n});\n"],"names":[],"mappings":";;;;;;AAiDO,MAAM,UAAU,WAIrB,CAAC,OAAO,QAAQ;AACV,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA,YAAY;AAAA,IACZ,OAAO,YAAY;AAAA,IACnB,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,WAAW,KAAK;AAEpC,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAE9C,QAAM,QAAQ,OAAO,UAAU,WAAW,QAAQ;AAClD,QAAM,aAAa,QAAQ,WAAW,GAAG,QAAQ,MAAM;AACvD,QAAM,gBAAgB,aAAa,QAAQ,IAAI,aAAa;AAK5D,QAAM,uBACJ,SAAS,OAAO,UAAU,WAAW,QAAQ;AAC/C,QAAM,WACJ,QAAS,4BAAS,cAAa,EAAA,SAAS,aAAc,UAAK,KAAA,CAAA;AAG3D,SAAA,qBAAC,OAAI,EAAA,KAAU,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QACxD,UAAA;AAAA,IAAA;AAAA,IACD,oBAAC,OAAI,EAAA,WAAW,GAAG,EAAE,CAAC,QAAQ,cAAc,GAAG,UAAU,GACvD,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,GAAG,QAAQ,eAAe;AAAA,UACnC,CAAC,QAAQ,WAAW,GAAG,EAAE,QAAQ,KAAK;AAAA;AAAA,UAEtC,CAAC,QAAQ,KAAK,GAAG,CAAC,EAAE,QAAQ,KAAK;AAAA,UACjC,CAAC,QAAQ,SAAS,GAAG,CAAC,EAAE,CAAC,SAAS;AAAA,UAClC,CAAC,QAAQ,SAAS,GAAG,CAAC,CAAC;AAAA,UACvB,CAAC,QAAQ,SAAS,GAAG,CAAC,CAAC;AAAA,UACvB,CAAC,QAAQ,aAAa,GAAG,OAAO,oBAAoB,EAAE,WAAW;AAAA,QAAA,CAClE;AAAA,QAEA,UAAA;AAAA,MAAA;AAAA,IAAA,GAEL;AAAA,EACF,EAAA,CAAA;AAEJ,CAAC;"}
|
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
import { createClasses } from "@hitachivantara/uikit-react-utils";
|
|
2
2
|
import { theme } from "@hitachivantara/uikit-styles";
|
|
3
|
-
const labelBaseStyle = {
|
|
4
|
-
...theme.typography.caption2,
|
|
5
|
-
padding: "0 5px",
|
|
6
|
-
color: theme.colors.atmo1,
|
|
7
|
-
lineHeight: "16px"
|
|
8
|
-
};
|
|
9
3
|
const { staticClasses, useClasses } = createClasses("HvBadge", {
|
|
10
4
|
root: { position: "relative", "&>*": { float: "left" } },
|
|
5
|
+
/** class applied to the badge container when it has content */
|
|
11
6
|
badgeContainer: { width: 0 },
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
/** class applied to the badge */
|
|
8
|
+
badgePosition: {
|
|
9
|
+
...theme.typography.caption2,
|
|
10
|
+
color: theme.colors.atmo1,
|
|
11
|
+
borderRadius: theme.radii.full,
|
|
15
12
|
backgroundColor: theme.colors.secondary,
|
|
13
|
+
lineHeight: "16px",
|
|
14
|
+
minWidth: 8,
|
|
15
|
+
padding: "0 5px",
|
|
16
16
|
float: "left",
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
wordBreak: "keep-all",
|
|
18
|
+
textAlign: "center",
|
|
19
|
+
":empty": {
|
|
20
|
+
height: 8,
|
|
21
|
+
width: 8,
|
|
22
|
+
padding: 0
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
/** applied to the badge when it's visible */
|
|
26
|
+
badge: {},
|
|
27
|
+
/** applied to the badge when it's hidden */
|
|
28
|
+
badgeHidden: {
|
|
29
|
+
display: "none"
|
|
19
30
|
},
|
|
20
|
-
showCount: {
|
|
21
|
-
showLabel: {
|
|
31
|
+
showCount: {},
|
|
32
|
+
showLabel: {},
|
|
22
33
|
badgeIcon: { position: "relative", top: "1px", left: "-7px" },
|
|
23
|
-
badgeOneDigit: { padding: 0, width: "16px"
|
|
34
|
+
badgeOneDigit: { padding: 0, width: "16px" }
|
|
24
35
|
});
|
|
25
36
|
export {
|
|
26
37
|
staticClasses,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.styles.js","sources":["../../../src/Badge/Badge.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\
|
|
1
|
+
{"version":3,"file":"Badge.styles.js","sources":["../../../src/Badge/Badge.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvBadge\", {\n root: { position: \"relative\", \"&>*\": { float: \"left\" } },\n /** class applied to the badge container when it has content */\n badgeContainer: { width: 0 },\n /** class applied to the badge */\n badgePosition: {\n ...theme.typography.caption2,\n color: theme.colors.atmo1,\n borderRadius: theme.radii.full,\n backgroundColor: theme.colors.secondary,\n lineHeight: \"16px\",\n minWidth: 8,\n padding: \"0 5px\",\n float: \"left\",\n wordBreak: \"keep-all\",\n textAlign: \"center\",\n\n \":empty\": {\n height: 8,\n width: 8,\n padding: 0,\n },\n },\n /** applied to the badge when it's visible */\n badge: {},\n /** applied to the badge when it's hidden */\n badgeHidden: {\n display: \"none\",\n },\n showCount: {},\n showLabel: {},\n badgeIcon: { position: \"relative\", top: \"1px\", left: \"-7px\" },\n badgeOneDigit: { padding: 0, width: \"16px\" },\n});\n"],"names":[],"mappings":";;AAGO,MAAM,EAAE,eAAe,eAAe,cAAc,WAAW;AAAA,EACpE,MAAM,EAAE,UAAU,YAAY,OAAO,EAAE,OAAO,SAAS;AAAA;AAAA,EAEvD,gBAAgB,EAAE,OAAO,EAAE;AAAA;AAAA,EAE3B,eAAe;AAAA,IACb,GAAG,MAAM,WAAW;AAAA,IACpB,OAAO,MAAM,OAAO;AAAA,IACpB,cAAc,MAAM,MAAM;AAAA,IAC1B,iBAAiB,MAAM,OAAO;AAAA,IAC9B,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,IACP,WAAW;AAAA,IACX,WAAW;AAAA,IAEX,UAAU;AAAA,MACR,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,SAAS;AAAA,IACX;AAAA,EACF;AAAA;AAAA,EAEA,OAAO,CAAC;AAAA;AAAA,EAER,aAAa;AAAA,IACX,SAAS;AAAA,EACX;AAAA,EACA,WAAW,CAAC;AAAA,EACZ,WAAW,CAAC;AAAA,EACZ,WAAW,EAAE,UAAU,YAAY,KAAK,OAAO,MAAM,OAAO;AAAA,EAC5D,eAAe,EAAE,SAAS,GAAG,OAAO,OAAO;AAC7C,CAAC;"}
|