@hitachivantara/uikit-react-core 5.84.3 → 5.85.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 +2 -1
- package/dist/cjs/Dialog/Actions/Actions.cjs +2 -2
- package/dist/cjs/Dialog/Actions/Actions.styles.cjs +3 -3
- package/dist/cjs/Dialog/Content/Content.styles.cjs +1 -3
- package/dist/cjs/Dialog/Dialog.cjs +15 -18
- package/dist/cjs/Dialog/Dialog.styles.cjs +9 -6
- package/dist/cjs/Dialog/Title/Title.cjs +15 -20
- package/dist/cjs/Dialog/Title/Title.styles.cjs +12 -15
- package/dist/cjs/Dialog/context.cjs +1 -1
- package/dist/cjs/Panel/Panel.styles.cjs +1 -0
- package/dist/cjs/Section/Section.cjs +1 -1
- package/dist/cjs/Section/Section.styles.cjs +2 -0
- package/dist/cjs/TableSection/TableSection.styles.cjs +0 -1
- package/dist/cjs/{Tab → Tabs/Tab}/Tab.styles.cjs +1 -1
- package/dist/cjs/Tabs/Tabs.styles.cjs +2 -5
- package/dist/cjs/index.cjs +4 -4
- package/dist/esm/Badge/Badge.js +2 -1
- package/dist/esm/Badge/Badge.js.map +1 -1
- package/dist/esm/Dialog/Actions/Actions.js +2 -2
- package/dist/esm/Dialog/Actions/Actions.js.map +1 -1
- package/dist/esm/Dialog/Actions/Actions.styles.js +3 -3
- package/dist/esm/Dialog/Actions/Actions.styles.js.map +1 -1
- package/dist/esm/Dialog/Content/Content.styles.js +1 -3
- package/dist/esm/Dialog/Content/Content.styles.js.map +1 -1
- package/dist/esm/Dialog/Dialog.js +15 -18
- package/dist/esm/Dialog/Dialog.js.map +1 -1
- package/dist/esm/Dialog/Dialog.styles.js +9 -6
- package/dist/esm/Dialog/Dialog.styles.js.map +1 -1
- package/dist/esm/Dialog/Title/Title.js +16 -21
- package/dist/esm/Dialog/Title/Title.js.map +1 -1
- package/dist/esm/Dialog/Title/Title.styles.js +12 -15
- package/dist/esm/Dialog/Title/Title.styles.js.map +1 -1
- package/dist/esm/Dialog/context.js +1 -1
- package/dist/esm/Dialog/context.js.map +1 -1
- package/dist/esm/Panel/Panel.styles.js +1 -0
- package/dist/esm/Panel/Panel.styles.js.map +1 -1
- package/dist/esm/Section/Section.js +2 -2
- package/dist/esm/Section/Section.js.map +1 -1
- package/dist/esm/Section/Section.styles.js +2 -0
- package/dist/esm/Section/Section.styles.js.map +1 -1
- package/dist/esm/TableSection/TableSection.styles.js +0 -1
- package/dist/esm/TableSection/TableSection.styles.js.map +1 -1
- package/dist/esm/Tabs/Tab/Tab.js.map +1 -0
- package/dist/esm/{Tab → Tabs/Tab}/Tab.styles.js +1 -1
- package/dist/esm/Tabs/Tab/Tab.styles.js.map +1 -0
- package/dist/esm/Tabs/Tabs.styles.js +2 -5
- package/dist/esm/Tabs/Tabs.styles.js.map +1 -1
- package/dist/esm/index.js +19 -19
- package/dist/types/index.d.ts +28 -24
- package/package.json +2 -2
- package/dist/esm/Tab/Tab.js.map +0 -1
- package/dist/esm/Tab/Tab.styles.js.map +0 -1
- /package/dist/cjs/{Tab → Tabs/Tab}/Tab.cjs +0 -0
- /package/dist/esm/{Tab → Tabs/Tab}/Tab.js +0 -0
package/dist/cjs/Badge/Badge.cjs
CHANGED
|
@@ -16,6 +16,7 @@ const HvBadge = React.forwardRef(function HvBadge2(props, ref) {
|
|
|
16
16
|
icon,
|
|
17
17
|
text,
|
|
18
18
|
textVariant,
|
|
19
|
+
children: childrenProp,
|
|
19
20
|
...others
|
|
20
21
|
} = uikitReactUtils.useDefaultProps("HvBadge", props);
|
|
21
22
|
const { classes, cx } = Badge_styles.useClasses(classesProp);
|
|
@@ -23,7 +24,7 @@ const HvBadge = React.forwardRef(function HvBadge2(props, ref) {
|
|
|
23
24
|
const countValue = count > maxCount ? `${maxCount}+` : count;
|
|
24
25
|
const renderedCount = showCount && count > 0 ? countValue : "";
|
|
25
26
|
const renderedCountOrLabel = label && typeof label !== "number" ? label : renderedCount;
|
|
26
|
-
const children = icon || text && /* @__PURE__ */ jsxRuntime.jsx(Typography.HvTypography, { variant: textVariant, children: text });
|
|
27
|
+
const children = childrenProp || icon || text && /* @__PURE__ */ jsxRuntime.jsx(Typography.HvTypography, { variant: textVariant, children: text });
|
|
27
28
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: cx(classes.root, className), ...others, children: [
|
|
28
29
|
children,
|
|
29
30
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cx({ [classes.badgeContainer]: children }), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -16,14 +16,14 @@ const HvDialogActions = (props) => {
|
|
|
16
16
|
...others
|
|
17
17
|
} = uikitReactUtils.useDefaultProps("HvDialogActions", props);
|
|
18
18
|
const context$1 = context.useDialogContext();
|
|
19
|
-
const
|
|
19
|
+
const fullScreen = fullScreenProp ?? context$1.fullScreen;
|
|
20
20
|
const { classes, cx } = Actions_styles.useClasses(classesProp);
|
|
21
21
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
22
|
MuiDialogActions__default.default,
|
|
23
23
|
{
|
|
24
24
|
className,
|
|
25
25
|
classes: {
|
|
26
|
-
root: cx(classes.root, { [classes.fullscreen]:
|
|
26
|
+
root: cx(classes.root, { [classes.fullscreen]: fullScreen }),
|
|
27
27
|
spacing: classes.spacing
|
|
28
28
|
},
|
|
29
29
|
...others,
|
|
@@ -4,12 +4,12 @@ const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
|
4
4
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
5
5
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvDialog-Action", {
|
|
6
6
|
root: {
|
|
7
|
-
margin:
|
|
7
|
+
margin: 0,
|
|
8
8
|
padding: uikitStyles.theme.space.sm,
|
|
9
|
+
backgroundColor: "inherit",
|
|
9
10
|
borderTop: `3px solid ${uikitStyles.theme.colors.atmo2}`,
|
|
10
11
|
height: 65,
|
|
11
|
-
maxHeight: 65
|
|
12
|
-
flex: 1
|
|
12
|
+
maxHeight: 65
|
|
13
13
|
},
|
|
14
14
|
fullscreen: { position: "fixed", width: "100%", bottom: 0, left: 0 },
|
|
15
15
|
spacing: {
|
|
@@ -4,13 +4,11 @@ const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
|
4
4
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
5
5
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvDialog-Content", {
|
|
6
6
|
root: {
|
|
7
|
-
padding:
|
|
8
|
-
flex: "none"
|
|
7
|
+
padding: uikitStyles.theme.spacing(0, "sm", "sm")
|
|
9
8
|
},
|
|
10
9
|
textContent: {
|
|
11
10
|
marginLeft: "42px",
|
|
12
11
|
paddingRight: "62px",
|
|
13
|
-
flex: 1,
|
|
14
12
|
overflowY: "auto"
|
|
15
13
|
}
|
|
16
14
|
});
|
|
@@ -23,28 +23,37 @@ const HvDialog = (props) => {
|
|
|
23
23
|
onClose,
|
|
24
24
|
firstFocusable,
|
|
25
25
|
buttonTitle = "Close",
|
|
26
|
-
|
|
26
|
+
fullHeight,
|
|
27
|
+
fullscreen: fullScreen = false,
|
|
28
|
+
// TODO: rename to `fullScreen` in v6
|
|
27
29
|
disableBackdropClick = false,
|
|
28
30
|
...others
|
|
29
31
|
} = uikitReactUtils.useDefaultProps("HvDialog", props);
|
|
30
|
-
const { classes,
|
|
32
|
+
const { classes, cx } = Dialog_styles.useClasses(classesProp);
|
|
31
33
|
const { rootId } = uikitReactUtils.useTheme();
|
|
32
34
|
const measuredRef = React.useCallback(() => {
|
|
33
35
|
if (!firstFocusable) return;
|
|
34
36
|
const element = document.getElementById(firstFocusable);
|
|
35
37
|
element?.focus();
|
|
36
38
|
}, [firstFocusable]);
|
|
37
|
-
const contextValue = React.useMemo(() => ({
|
|
39
|
+
const contextValue = React.useMemo(() => ({ fullScreen }), [fullScreen]);
|
|
38
40
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
39
41
|
MuiDialog__default.default,
|
|
40
42
|
{
|
|
41
43
|
container: document$1.getElementById(rootId),
|
|
42
|
-
className
|
|
43
|
-
classes: {
|
|
44
|
+
className,
|
|
45
|
+
classes: {
|
|
46
|
+
root: classes.root,
|
|
47
|
+
paper: cx(classes.paper, classes[variant], {
|
|
48
|
+
[classes.fullHeight]: fullHeight,
|
|
49
|
+
[classes.statusBar]: !!variant,
|
|
50
|
+
[classes.fullscreen]: fullScreen
|
|
51
|
+
})
|
|
52
|
+
},
|
|
44
53
|
id,
|
|
45
54
|
ref: measuredRef,
|
|
46
55
|
open,
|
|
47
|
-
fullScreen
|
|
56
|
+
fullScreen,
|
|
48
57
|
onClose: (event, reason) => {
|
|
49
58
|
if (disableBackdropClick) return;
|
|
50
59
|
onClose?.(event, reason);
|
|
@@ -56,18 +65,6 @@ const HvDialog = (props) => {
|
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
67
|
},
|
|
59
|
-
PaperProps: {
|
|
60
|
-
classes: {
|
|
61
|
-
root: cx(
|
|
62
|
-
css({ position: "absolute" }),
|
|
63
|
-
classes.paper,
|
|
64
|
-
variant && cx(classes.statusBar, classes[variant]),
|
|
65
|
-
{
|
|
66
|
-
[classes.fullscreen]: fullscreen
|
|
67
|
-
}
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
68
|
...others,
|
|
72
69
|
children: [
|
|
73
70
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -8,10 +8,14 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvDialog",
|
|
|
8
8
|
paper: {
|
|
9
9
|
color: uikitStyles.theme.colors.secondary,
|
|
10
10
|
backgroundColor: uikitStyles.theme.colors.atmo1,
|
|
11
|
-
boxShadow:
|
|
11
|
+
boxShadow: uikitStyles.theme.colors.shadow,
|
|
12
|
+
borderColor: uikitStyles.theme.colors.atmo4,
|
|
12
13
|
borderRadius: uikitStyles.theme.radii.round
|
|
13
14
|
},
|
|
14
15
|
fullscreen: {},
|
|
16
|
+
fullHeight: {
|
|
17
|
+
height: "100%"
|
|
18
|
+
},
|
|
15
19
|
closeButton: {
|
|
16
20
|
padding: 0,
|
|
17
21
|
minWidth: "auto",
|
|
@@ -24,17 +28,16 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvDialog",
|
|
|
24
28
|
statusBar: {
|
|
25
29
|
borderTopLeftRadius: 0,
|
|
26
30
|
borderTopRightRadius: 0,
|
|
27
|
-
borderTopWidth: 4
|
|
28
|
-
borderTopStyle: "solid"
|
|
31
|
+
borderTopWidth: 4
|
|
29
32
|
},
|
|
30
33
|
success: {
|
|
31
|
-
|
|
34
|
+
borderColor: uikitStyles.theme.colors.positive
|
|
32
35
|
},
|
|
33
36
|
error: {
|
|
34
|
-
|
|
37
|
+
borderColor: uikitStyles.theme.colors.negative
|
|
35
38
|
},
|
|
36
39
|
warning: {
|
|
37
|
-
|
|
40
|
+
borderColor: uikitStyles.theme.colors.warning
|
|
38
41
|
}
|
|
39
42
|
});
|
|
40
43
|
exports.staticClasses = staticClasses;
|
|
@@ -6,6 +6,7 @@ const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
|
6
6
|
const iconVariant = require("../../utils/iconVariant.cjs");
|
|
7
7
|
const context = require("../context.cjs");
|
|
8
8
|
const Title_styles = require("./Title.styles.cjs");
|
|
9
|
+
const Typography = require("../../Typography/Typography.cjs");
|
|
9
10
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
11
|
const MuiDialogTitle__default = /* @__PURE__ */ _interopDefault(MuiDialogTitle);
|
|
11
12
|
const HvDialogTitle = (props) => {
|
|
@@ -15,38 +16,32 @@ const HvDialogTitle = (props) => {
|
|
|
15
16
|
children,
|
|
16
17
|
variant = "default",
|
|
17
18
|
showIcon = true,
|
|
18
|
-
customIcon
|
|
19
|
+
customIcon,
|
|
19
20
|
...others
|
|
20
21
|
} = uikitReactUtils.useDefaultProps("HvDialogTitle", props);
|
|
21
|
-
const { classes,
|
|
22
|
-
const {
|
|
23
|
-
const isString = typeof children === "string";
|
|
22
|
+
const { classes, cx } = Title_styles.useClasses(classesProp);
|
|
23
|
+
const { fullScreen } = context.useDialogContext();
|
|
24
24
|
const icon = customIcon || showIcon && iconVariant.iconVariant(variant);
|
|
25
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
26
|
-
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
26
|
+
Typography.HvTypography,
|
|
27
27
|
{
|
|
28
|
+
component: MuiDialogTitle__default.default,
|
|
29
|
+
variant: "title4",
|
|
28
30
|
className: cx(
|
|
29
|
-
!fullscreen && css({ flex: 1 }),
|
|
30
31
|
classes.root,
|
|
32
|
+
classes.messageContainer,
|
|
31
33
|
{
|
|
32
|
-
[classes.fullscreen]:
|
|
34
|
+
[classes.fullscreen]: fullScreen,
|
|
35
|
+
[classes.textWithIcon]: icon,
|
|
36
|
+
[classes.titleText]: typeof children === "string"
|
|
33
37
|
},
|
|
34
38
|
className
|
|
35
39
|
),
|
|
36
40
|
...others,
|
|
37
|
-
children:
|
|
41
|
+
children: [
|
|
38
42
|
icon,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
className: cx({
|
|
43
|
-
[classes.textWithIcon]: !!icon,
|
|
44
|
-
[classes.titleText]: isString
|
|
45
|
-
}),
|
|
46
|
-
children
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
] })
|
|
43
|
+
children
|
|
44
|
+
]
|
|
50
45
|
}
|
|
51
46
|
);
|
|
52
47
|
};
|
|
@@ -4,24 +4,21 @@ const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
|
4
4
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
5
5
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvDialog-Title", {
|
|
6
6
|
root: {
|
|
7
|
-
fontFamily: uikitStyles.theme.fontFamily.body,
|
|
8
|
-
// override MUI font
|
|
9
7
|
padding: uikitStyles.theme.space.sm,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
messageContainer: {
|
|
8
|
+
paddingRight: 32 + 16,
|
|
9
|
+
// close icon padding
|
|
10
|
+
backgroundColor: "inherit",
|
|
14
11
|
display: "flex",
|
|
15
|
-
alignItems: "center"
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
gap: uikitStyles.theme.space.xs
|
|
16
14
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
15
|
+
fullscreen: {},
|
|
16
|
+
/** @deprecated use `classes.root` instead */
|
|
17
|
+
messageContainer: {},
|
|
18
|
+
// TODO: consider deprecating
|
|
19
|
+
textWithIcon: {},
|
|
20
|
+
/** @deprecated use `classes.root` instead */
|
|
21
|
+
titleText: {}
|
|
25
22
|
});
|
|
26
23
|
exports.staticClasses = staticClasses;
|
|
27
24
|
exports.useClasses = useClasses;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const DialogContext = React.createContext({
|
|
4
|
+
const DialogContext = React.createContext({ fullScreen: false });
|
|
5
5
|
const useDialogContext = () => React.useContext(DialogContext);
|
|
6
6
|
exports.DialogContext = DialogContext;
|
|
7
7
|
exports.useDialogContext = useDialogContext;
|
|
@@ -6,6 +6,7 @@ const { useClasses, staticClasses } = uikitReactUtils.createClasses("HvPanel", {
|
|
|
6
6
|
root: {
|
|
7
7
|
position: "relative",
|
|
8
8
|
padding: uikitStyles.theme.space.sm,
|
|
9
|
+
borderColor: uikitStyles.theme.colors.atmo4,
|
|
9
10
|
backgroundColor: uikitStyles.theme.colors.atmo1,
|
|
10
11
|
overflow: "auto",
|
|
11
12
|
borderRadius: "inherit"
|
|
@@ -54,7 +54,7 @@ const HvSection = React.forwardRef(
|
|
|
54
54
|
"aria-label": isOpen ? "Collapse" : "Expand",
|
|
55
55
|
...buttonProps,
|
|
56
56
|
...expandButtonProps,
|
|
57
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.
|
|
57
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.DropDownXS, { rotate: isOpen })
|
|
58
58
|
}
|
|
59
59
|
),
|
|
60
60
|
title,
|
|
@@ -15,6 +15,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvSection",
|
|
|
15
15
|
header: {
|
|
16
16
|
display: "flex",
|
|
17
17
|
alignItems: "center",
|
|
18
|
+
borderColor: "inherit",
|
|
18
19
|
position: "relative",
|
|
19
20
|
minHeight: uikitStyles.theme.sizes.sm,
|
|
20
21
|
padding: uikitStyles.theme.space.sm
|
|
@@ -37,6 +38,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvSection",
|
|
|
37
38
|
raisedHeader: {
|
|
38
39
|
"& $header": {
|
|
39
40
|
zIndex: 1,
|
|
41
|
+
borderBottomWidth: 1,
|
|
40
42
|
boxShadow: uikitStyles.theme.colors.shadow
|
|
41
43
|
},
|
|
42
44
|
"& $content": {
|
|
@@ -19,7 +19,6 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTableSect
|
|
|
19
19
|
header: {
|
|
20
20
|
// Only apply the border to divide the header and content when both are displayed
|
|
21
21
|
"+ div": {
|
|
22
|
-
borderTop: `1px solid ${uikitStyles.theme.colors.atmo3}`,
|
|
23
22
|
borderTopLeftRadius: 0,
|
|
24
23
|
borderTopRightRadius: 0
|
|
25
24
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
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 focusUtils = require("
|
|
5
|
+
const focusUtils = require("../../utils/focusUtils.cjs");
|
|
6
6
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTab", {
|
|
7
7
|
root: {
|
|
8
8
|
marginTop: "3px",
|
|
@@ -3,13 +3,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
4
4
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTabs", {
|
|
5
5
|
root: {
|
|
6
|
-
minHeight: 0
|
|
7
|
-
overflow: "visible"
|
|
6
|
+
minHeight: 0
|
|
8
7
|
},
|
|
9
8
|
indicator: {},
|
|
10
|
-
scroller: {
|
|
11
|
-
overflow: "visible !important"
|
|
12
|
-
},
|
|
9
|
+
scroller: {},
|
|
13
10
|
flexContainer: {
|
|
14
11
|
marginLeft: "3px"
|
|
15
12
|
},
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -231,8 +231,6 @@ const Stack_styles = require("./Stack/Stack.styles.cjs");
|
|
|
231
231
|
const Stack = require("./Stack/Stack.cjs");
|
|
232
232
|
const Switch_styles = require("./Switch/Switch.styles.cjs");
|
|
233
233
|
const Switch = require("./Switch/Switch.cjs");
|
|
234
|
-
const Tab_styles = require("./Tab/Tab.styles.cjs");
|
|
235
|
-
const Tab = require("./Tab/Tab.cjs");
|
|
236
234
|
const useHvTable = require("./Table/hooks/useHvTable.cjs");
|
|
237
235
|
const Table_styles = require("./Table/Table.styles.cjs");
|
|
238
236
|
const Table = require("./Table/Table.cjs");
|
|
@@ -267,6 +265,8 @@ const ProgressColumnCell = require("./Table/renderers/ProgressColumnCell.cjs");
|
|
|
267
265
|
const SwitchColumnCell = require("./Table/renderers/SwitchColumnCell.cjs");
|
|
268
266
|
const Tabs_styles = require("./Tabs/Tabs.styles.cjs");
|
|
269
267
|
const Tabs = require("./Tabs/Tabs.cjs");
|
|
268
|
+
const Tab_styles = require("./Tabs/Tab/Tab.styles.cjs");
|
|
269
|
+
const Tab = require("./Tabs/Tab/Tab.cjs");
|
|
270
270
|
const Tag_styles = require("./Tag/Tag.styles.cjs");
|
|
271
271
|
const Tag = require("./Tag/Tag.cjs");
|
|
272
272
|
const TagsInput_styles = require("./TagsInput/TagsInput.styles.cjs");
|
|
@@ -589,8 +589,6 @@ exports.stackClasses = Stack_styles.staticClasses;
|
|
|
589
589
|
exports.HvStack = Stack.HvStack;
|
|
590
590
|
exports.switchClasses = Switch_styles.staticClasses;
|
|
591
591
|
exports.HvSwitch = Switch.HvSwitch;
|
|
592
|
-
exports.tabClasses = Tab_styles.staticClasses;
|
|
593
|
-
exports.HvTab = Tab.HvTab;
|
|
594
592
|
exports.useHvData = useHvTable.useHvTable;
|
|
595
593
|
exports.useHvTable = useHvTable.useHvTable;
|
|
596
594
|
exports.tableClasses = Table_styles.staticClasses;
|
|
@@ -642,6 +640,8 @@ exports.normalizeProgressBar = ProgressColumnCell.normalizeProgressBar;
|
|
|
642
640
|
exports.HvSwitchColumnCell = SwitchColumnCell.HvSwitchColumnCell;
|
|
643
641
|
exports.tabsClasses = Tabs_styles.staticClasses;
|
|
644
642
|
exports.HvTabs = Tabs.HvTabs;
|
|
643
|
+
exports.tabClasses = Tab_styles.staticClasses;
|
|
644
|
+
exports.HvTab = Tab.HvTab;
|
|
645
645
|
exports.tagClasses = Tag_styles.staticClasses;
|
|
646
646
|
exports.HvTag = Tag.HvTag;
|
|
647
647
|
exports.tagsInputClasses = TagsInput_styles.staticClasses;
|
package/dist/esm/Badge/Badge.js
CHANGED
|
@@ -15,6 +15,7 @@ const HvBadge = forwardRef(function HvBadge2(props, ref) {
|
|
|
15
15
|
icon,
|
|
16
16
|
text,
|
|
17
17
|
textVariant,
|
|
18
|
+
children: childrenProp,
|
|
18
19
|
...others
|
|
19
20
|
} = useDefaultProps("HvBadge", props);
|
|
20
21
|
const { classes, cx } = useClasses(classesProp);
|
|
@@ -22,7 +23,7 @@ const HvBadge = forwardRef(function HvBadge2(props, ref) {
|
|
|
22
23
|
const countValue = count > maxCount ? `${maxCount}+` : count;
|
|
23
24
|
const renderedCount = showCount && count > 0 ? countValue : "";
|
|
24
25
|
const renderedCountOrLabel = label && typeof label !== "number" ? label : renderedCount;
|
|
25
|
-
const children = icon || text && /* @__PURE__ */ jsx(HvTypography, { variant: textVariant, children: text });
|
|
26
|
+
const children = childrenProp || icon || text && /* @__PURE__ */ jsx(HvTypography, { variant: textVariant, children: text });
|
|
26
27
|
return /* @__PURE__ */ jsxs("div", { ref, className: cx(classes.root, className), ...others, children: [
|
|
27
28
|
children,
|
|
28
29
|
/* @__PURE__ */ jsx("div", { className: cx({ [classes.badgeContainer]: children }), children: /* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
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>(function HvBadge(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
|
|
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. @deprecated use `children` instead. */\n text?: string;\n /** Text variant. @deprecated use a `HvTypography` on `children` instead. */\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>(function HvBadge(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 children: childrenProp,\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 childrenProp ||\n icon ||\n (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":["HvBadge"],"mappings":";;;;;;AAiDO,MAAM,UAAU,WAIrB,SAASA,SAAQ,OAAO,KAAK;AACvB,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,UAAU;AAAA,IACV,GAAG;AAAA,EAAA,IACD,gBAAgB,WAAW,KAAK;AAEpC,QAAM,EAAE,SAAS,OAAO,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;AACzC,QAAA,WACJ,gBACA,QACC,4BAAS,cAAa,EAAA,SAAS,aAAc,UAAK,KAAA,CAAA;AAGnD,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,EAEL,CAAA;AAAA,EAAA,GACF;AAEJ,CAAC;"}
|
|
@@ -13,14 +13,14 @@ const HvDialogActions = (props) => {
|
|
|
13
13
|
...others
|
|
14
14
|
} = useDefaultProps("HvDialogActions", props);
|
|
15
15
|
const context = useDialogContext();
|
|
16
|
-
const
|
|
16
|
+
const fullScreen = fullScreenProp ?? context.fullScreen;
|
|
17
17
|
const { classes, cx } = useClasses(classesProp);
|
|
18
18
|
return /* @__PURE__ */ jsx(
|
|
19
19
|
MuiDialogActions,
|
|
20
20
|
{
|
|
21
21
|
className,
|
|
22
22
|
classes: {
|
|
23
|
-
root: cx(classes.root, { [classes.fullscreen]:
|
|
23
|
+
root: cx(classes.root, { [classes.fullscreen]: fullScreen }),
|
|
24
24
|
spacing: classes.spacing
|
|
25
25
|
},
|
|
26
26
|
...others,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.js","sources":["../../../../src/Dialog/Actions/Actions.tsx"],"sourcesContent":["import MuiDialogActions, {\n DialogActionsProps as MuiDialogActionsProps,\n} from \"@mui/material/DialogActions\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { useDialogContext } from \"../context\";\nimport { staticClasses, useClasses } from \"./Actions.styles\";\n\nexport { staticClasses as dialogActionClasses };\n\nexport type HvDialogActionClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDialogActionsProps\n extends Omit<MuiDialogActionsProps, \"classes\"> {\n /** Set the dialog to fullscreen mode. @deprecated set `fullscreen` in `HvDialog` */\n fullscreen?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDialogActionClasses;\n}\n\nexport const HvDialogActions = (props: HvDialogActionsProps) => {\n const {\n classes: classesProp,\n className,\n children,\n fullscreen: fullScreenProp,\n ...others\n } = useDefaultProps(\"HvDialogActions\", props);\n const context = useDialogContext();\n const
|
|
1
|
+
{"version":3,"file":"Actions.js","sources":["../../../../src/Dialog/Actions/Actions.tsx"],"sourcesContent":["import MuiDialogActions, {\n DialogActionsProps as MuiDialogActionsProps,\n} from \"@mui/material/DialogActions\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { useDialogContext } from \"../context\";\nimport { staticClasses, useClasses } from \"./Actions.styles\";\n\nexport { staticClasses as dialogActionClasses };\n\nexport type HvDialogActionClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDialogActionsProps\n extends Omit<MuiDialogActionsProps, \"classes\"> {\n /** Set the dialog to fullscreen mode. @deprecated set `fullscreen` in `HvDialog` */\n fullscreen?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDialogActionClasses;\n}\n\nexport const HvDialogActions = (props: HvDialogActionsProps) => {\n const {\n classes: classesProp,\n className,\n children,\n fullscreen: fullScreenProp,\n ...others\n } = useDefaultProps(\"HvDialogActions\", props);\n const context = useDialogContext();\n const fullScreen = fullScreenProp ?? context.fullScreen;\n\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <MuiDialogActions\n className={className}\n classes={{\n root: cx(classes.root, { [classes.fullscreen]: fullScreen }),\n spacing: classes.spacing,\n }}\n {...others}\n >\n {children}\n </MuiDialogActions>\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBa,MAAA,kBAAkB,CAAC,UAAgC;AACxD,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,IACD,gBAAgB,mBAAmB,KAAK;AAC5C,QAAM,UAAU,iBAAiB;AAC3B,QAAA,aAAa,kBAAkB,QAAQ;AAE7C,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAG5C,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,SAAS;AAAA,QACP,MAAM,GAAG,QAAQ,MAAM,EAAE,CAAC,QAAQ,UAAU,GAAG,YAAY;AAAA,QAC3D,SAAS,QAAQ;AAAA,MACnB;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EACH;AAEJ;"}
|
|
@@ -2,12 +2,12 @@ import { createClasses } from "@hitachivantara/uikit-react-utils";
|
|
|
2
2
|
import { theme } from "@hitachivantara/uikit-styles";
|
|
3
3
|
const { staticClasses, useClasses } = createClasses("HvDialog-Action", {
|
|
4
4
|
root: {
|
|
5
|
-
margin:
|
|
5
|
+
margin: 0,
|
|
6
6
|
padding: theme.space.sm,
|
|
7
|
+
backgroundColor: "inherit",
|
|
7
8
|
borderTop: `3px solid ${theme.colors.atmo2}`,
|
|
8
9
|
height: 65,
|
|
9
|
-
maxHeight: 65
|
|
10
|
-
flex: 1
|
|
10
|
+
maxHeight: 65
|
|
11
11
|
},
|
|
12
12
|
fullscreen: { position: "fixed", width: "100%", bottom: 0, left: 0 },
|
|
13
13
|
spacing: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.styles.js","sources":["../../../../src/Dialog/Actions/Actions.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvDialog-Action\", {\n root: {\n margin:
|
|
1
|
+
{"version":3,"file":"Actions.styles.js","sources":["../../../../src/Dialog/Actions/Actions.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvDialog-Action\", {\n root: {\n margin: 0,\n padding: theme.space.sm,\n backgroundColor: \"inherit\",\n borderTop: `3px solid ${theme.colors.atmo2}`,\n height: 65,\n maxHeight: 65,\n },\n fullscreen: { position: \"fixed\", width: \"100%\", bottom: 0, left: 0 },\n spacing: {\n \"& > :not(:first-of-type)\": {\n marginLeft: theme.space.xs,\n },\n },\n});\n"],"names":[],"mappings":";;AAGO,MAAM,EAAE,eAAe,eAAe,cAAc,mBAAmB;AAAA,EAC5E,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,SAAS,MAAM,MAAM;AAAA,IACrB,iBAAiB;AAAA,IACjB,WAAW,aAAa,MAAM,OAAO,KAAK;AAAA,IAC1C,QAAQ;AAAA,IACR,WAAW;AAAA,EACb;AAAA,EACA,YAAY,EAAE,UAAU,SAAS,OAAO,QAAQ,QAAQ,GAAG,MAAM,EAAE;AAAA,EACnE,SAAS;AAAA,IACP,4BAA4B;AAAA,MAC1B,YAAY,MAAM,MAAM;AAAA,IAAA;AAAA,EAC1B;AAEJ,CAAC;"}
|
|
@@ -2,13 +2,11 @@ import { createClasses } from "@hitachivantara/uikit-react-utils";
|
|
|
2
2
|
import { theme } from "@hitachivantara/uikit-styles";
|
|
3
3
|
const { staticClasses, useClasses } = createClasses("HvDialog-Content", {
|
|
4
4
|
root: {
|
|
5
|
-
padding:
|
|
6
|
-
flex: "none"
|
|
5
|
+
padding: theme.spacing(0, "sm", "sm")
|
|
7
6
|
},
|
|
8
7
|
textContent: {
|
|
9
8
|
marginLeft: "42px",
|
|
10
9
|
paddingRight: "62px",
|
|
11
|
-
flex: 1,
|
|
12
10
|
overflowY: "auto"
|
|
13
11
|
}
|
|
14
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.styles.js","sources":["../../../../src/Dialog/Content/Content.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvDialog-Content\", {\n root: {\n padding:
|
|
1
|
+
{"version":3,"file":"Content.styles.js","sources":["../../../../src/Dialog/Content/Content.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvDialog-Content\", {\n root: {\n padding: theme.spacing(0, \"sm\", \"sm\"),\n },\n textContent: {\n marginLeft: \"42px\",\n paddingRight: \"62px\",\n overflowY: \"auto\",\n },\n});\n"],"names":[],"mappings":";;AAGO,MAAM,EAAE,eAAe,eAAe,cAAc,oBAAoB;AAAA,EAC7E,MAAM;AAAA,IACJ,SAAS,MAAM,QAAQ,GAAG,MAAM,IAAI;AAAA,EACtC;AAAA,EACA,aAAa;AAAA,IACX,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,WAAW;AAAA,EAAA;AAEf,CAAC;"}
|
|
@@ -20,28 +20,37 @@ const HvDialog = (props) => {
|
|
|
20
20
|
onClose,
|
|
21
21
|
firstFocusable,
|
|
22
22
|
buttonTitle = "Close",
|
|
23
|
-
|
|
23
|
+
fullHeight,
|
|
24
|
+
fullscreen: fullScreen = false,
|
|
25
|
+
// TODO: rename to `fullScreen` in v6
|
|
24
26
|
disableBackdropClick = false,
|
|
25
27
|
...others
|
|
26
28
|
} = useDefaultProps("HvDialog", props);
|
|
27
|
-
const { classes,
|
|
29
|
+
const { classes, cx } = useClasses(classesProp);
|
|
28
30
|
const { rootId } = useTheme();
|
|
29
31
|
const measuredRef = useCallback(() => {
|
|
30
32
|
if (!firstFocusable) return;
|
|
31
33
|
const element = document.getElementById(firstFocusable);
|
|
32
34
|
element?.focus();
|
|
33
35
|
}, [firstFocusable]);
|
|
34
|
-
const contextValue = useMemo(() => ({
|
|
36
|
+
const contextValue = useMemo(() => ({ fullScreen }), [fullScreen]);
|
|
35
37
|
return /* @__PURE__ */ jsxs(
|
|
36
38
|
MuiDialog,
|
|
37
39
|
{
|
|
38
40
|
container: getElementById(rootId),
|
|
39
|
-
className
|
|
40
|
-
classes: {
|
|
41
|
+
className,
|
|
42
|
+
classes: {
|
|
43
|
+
root: classes.root,
|
|
44
|
+
paper: cx(classes.paper, classes[variant], {
|
|
45
|
+
[classes.fullHeight]: fullHeight,
|
|
46
|
+
[classes.statusBar]: !!variant,
|
|
47
|
+
[classes.fullscreen]: fullScreen
|
|
48
|
+
})
|
|
49
|
+
},
|
|
41
50
|
id,
|
|
42
51
|
ref: measuredRef,
|
|
43
52
|
open,
|
|
44
|
-
fullScreen
|
|
53
|
+
fullScreen,
|
|
45
54
|
onClose: (event, reason) => {
|
|
46
55
|
if (disableBackdropClick) return;
|
|
47
56
|
onClose?.(event, reason);
|
|
@@ -53,18 +62,6 @@ const HvDialog = (props) => {
|
|
|
53
62
|
}
|
|
54
63
|
}
|
|
55
64
|
},
|
|
56
|
-
PaperProps: {
|
|
57
|
-
classes: {
|
|
58
|
-
root: cx(
|
|
59
|
-
css({ position: "absolute" }),
|
|
60
|
-
classes.paper,
|
|
61
|
-
variant && cx(classes.statusBar, classes[variant]),
|
|
62
|
-
{
|
|
63
|
-
[classes.fullscreen]: fullscreen
|
|
64
|
-
}
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
65
|
...others,
|
|
69
66
|
children: [
|
|
70
67
|
/* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":["../../../src/Dialog/Dialog.tsx"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport MuiDialog, { DialogProps as MuiDialogProps } from \"@mui/material/Dialog\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n useTheme,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvIconButton } from \"../IconButton\";\nimport { getElementById } from \"../utils/document\";\nimport { setId } from \"../utils/setId\";\nimport { DialogContext } from \"./context\";\nimport { staticClasses, useClasses } from \"./Dialog.styles\";\n\nexport { staticClasses as dialogClasses };\n\nexport type HvDialogClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDialogProps\n extends Omit<MuiDialogProps, \"fullScreen\" | \"classes\" | \"open\"> {\n /** Current state of the Dialog. */\n open?: boolean;\n /** Callback fired when the component requests to be closed. */\n onClose?: (\n event: React.MouseEvent<HTMLButtonElement> | {},\n reason?: \"escapeKeyDown\" | \"backdropClick\",\n ) => void;\n /** @inheritdoc */\n maxWidth?: MuiDialogProps[\"maxWidth\"];\n /** @inheritdoc */\n fullWidth?: MuiDialogProps[\"fullWidth\"];\n /**\n * Element id that should be focus when the Dialog opens.\n * Auto-focusing elements can cause usability issues, so this should be avoided.\n * @deprecated Use `autoFocus` on the element instead, if auto-focusing is required.\n */\n firstFocusable?: string;\n /** Title for the button close. */\n buttonTitle?: string;\n /** Set the dialog to fullscreen mode. */\n fullscreen?: boolean;\n /** Prevent closing the dialog when clicking on the backdrop. */\n disableBackdropClick?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDialogClasses;\n /** Variant of the dialog. Adds a status bar to the top of the dialog. If not provided, no status bar is added. */\n variant?: \"success\" | \"error\" | \"warning\";\n /** @ignore */\n ref?: MuiDialogProps[\"ref\"];\n /** @ignore */\n component?: MuiDialogProps[\"component\"];\n}\n\nexport const HvDialog = (props: HvDialogProps) => {\n const {\n variant,\n classes: classesProp,\n className,\n id,\n children,\n open = false,\n onClose,\n firstFocusable,\n buttonTitle = \"Close\",\n fullscreen = false
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../../../src/Dialog/Dialog.tsx"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport MuiDialog, { DialogProps as MuiDialogProps } from \"@mui/material/Dialog\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n useTheme,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvIconButton } from \"../IconButton\";\nimport { getElementById } from \"../utils/document\";\nimport { setId } from \"../utils/setId\";\nimport { DialogContext } from \"./context\";\nimport { staticClasses, useClasses } from \"./Dialog.styles\";\n\nexport { staticClasses as dialogClasses };\n\nexport type HvDialogClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDialogProps\n extends Omit<MuiDialogProps, \"fullScreen\" | \"classes\" | \"open\"> {\n /** Current state of the Dialog. */\n open?: boolean;\n /** Callback fired when the component requests to be closed. */\n onClose?: (\n event: React.MouseEvent<HTMLButtonElement> | {},\n reason?: \"escapeKeyDown\" | \"backdropClick\",\n ) => void;\n /** @inheritdoc */\n maxWidth?: MuiDialogProps[\"maxWidth\"];\n /** @inheritdoc */\n fullWidth?: MuiDialogProps[\"fullWidth\"];\n /** If true, the dialog stretches vertically, limited by the margins. @default false */\n fullHeight?: boolean;\n /**\n * Element id that should be focus when the Dialog opens.\n * Auto-focusing elements can cause usability issues, so this should be avoided.\n * @deprecated Use `autoFocus` on the element instead, if auto-focusing is required.\n */\n firstFocusable?: string;\n /** Title for the button close. */\n buttonTitle?: string;\n /** Set the dialog to fullscreen mode. */\n fullscreen?: boolean;\n /** Prevent closing the dialog when clicking on the backdrop. */\n disableBackdropClick?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDialogClasses;\n /** Variant of the dialog. Adds a status bar to the top of the dialog. If not provided, no status bar is added. */\n variant?: \"success\" | \"error\" | \"warning\";\n /** @ignore */\n ref?: MuiDialogProps[\"ref\"];\n /** @ignore */\n component?: MuiDialogProps[\"component\"];\n}\n\nexport const HvDialog = (props: HvDialogProps) => {\n const {\n variant,\n classes: classesProp,\n className,\n id,\n children,\n open = false,\n onClose,\n firstFocusable,\n buttonTitle = \"Close\",\n fullHeight,\n fullscreen: fullScreen = false, // TODO: rename to `fullScreen` in v6\n disableBackdropClick = false,\n ...others\n } = useDefaultProps(\"HvDialog\", props);\n\n const { classes, cx } = useClasses(classesProp);\n const { rootId } = useTheme();\n\n const measuredRef = useCallback(() => {\n if (!firstFocusable) return;\n\n const element = document.getElementById(firstFocusable);\n element?.focus();\n }, [firstFocusable]);\n\n const contextValue = useMemo(() => ({ fullScreen }), [fullScreen]);\n\n return (\n <MuiDialog\n container={getElementById(rootId)}\n className={className}\n classes={{\n root: classes.root,\n paper: cx(classes.paper, classes[variant!], {\n [classes.fullHeight]: fullHeight,\n [classes.statusBar]: !!variant,\n [classes.fullscreen]: fullScreen,\n }),\n }}\n id={id}\n ref={measuredRef}\n open={open}\n fullScreen={fullScreen}\n onClose={(event, reason) => {\n // `disableBackdropClick` property was removed in MUI5\n // and we want to maintain that functionality\n if (disableBackdropClick) return;\n\n onClose?.(event, reason);\n }}\n slotProps={{\n backdrop: {\n classes: {\n root: classes.background,\n },\n },\n }}\n {...others}\n >\n <HvIconButton<\"button\">\n title={buttonTitle}\n id={setId(id, \"close\")}\n className={classes.closeButton}\n onClick={(event) => onClose?.(event, undefined)}\n >\n <Close />\n </HvIconButton>\n <DialogContext.Provider value={contextValue}>\n {children}\n </DialogContext.Provider>\n </MuiDialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAwDa,MAAA,WAAW,CAAC,UAAyB;AAC1C,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA,YAAY,aAAa;AAAA;AAAA,IACzB,uBAAuB;AAAA,IACvB,GAAG;AAAA,EAAA,IACD,gBAAgB,YAAY,KAAK;AAErC,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AACxC,QAAA,EAAE,OAAO,IAAI,SAAS;AAEtB,QAAA,cAAc,YAAY,MAAM;AACpC,QAAI,CAAC,eAAgB;AAEf,UAAA,UAAU,SAAS,eAAe,cAAc;AACtD,aAAS,MAAM;AAAA,EAAA,GACd,CAAC,cAAc,CAAC;AAEb,QAAA,eAAe,QAAQ,OAAO,EAAE,eAAe,CAAC,UAAU,CAAC;AAG/D,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,eAAe,MAAM;AAAA,MAChC;AAAA,MACA,SAAS;AAAA,QACP,MAAM,QAAQ;AAAA,QACd,OAAO,GAAG,QAAQ,OAAO,QAAQ,OAAQ,GAAG;AAAA,UAC1C,CAAC,QAAQ,UAAU,GAAG;AAAA,UACtB,CAAC,QAAQ,SAAS,GAAG,CAAC,CAAC;AAAA,UACvB,CAAC,QAAQ,UAAU,GAAG;AAAA,QACvB,CAAA;AAAA,MACH;AAAA,MACA;AAAA,MACA,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,CAAC,OAAO,WAAW;AAG1B,YAAI,qBAAsB;AAE1B,kBAAU,OAAO,MAAM;AAAA,MACzB;AAAA,MACA,WAAW;AAAA,QACT,UAAU;AAAA,UACR,SAAS;AAAA,YACP,MAAM,QAAQ;AAAA,UAAA;AAAA,QAChB;AAAA,MAEJ;AAAA,MACC,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,YACP,IAAI,MAAM,IAAI,OAAO;AAAA,YACrB,WAAW,QAAQ;AAAA,YACnB,SAAS,CAAC,UAAU,UAAU,OAAO,MAAS;AAAA,YAE9C,8BAAC,OAAM,CAAA,CAAA;AAAA,UAAA;AAAA,QACT;AAAA,4BACC,cAAc,UAAd,EAAuB,OAAO,cAC5B,SACH,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|