@hitachivantara/uikit-react-lab
Version:
Contributed React components to UI Kit by the community.
68 lines (67 loc) • 2.37 kB
JavaScript
import { HvDashboard } from "../../Dashboard/Dashboard.js";
import { HvFlowNode } from "../Node/Node.js";
import { useClasses } from "./DashboardNode.styles.js";
import { HvButton, HvDialog, HvDialogActions, HvDialogContent, HvDialogTitle, HvEmptyState, useLabels } from "@hitachivantara/uikit-react-core";
import { jsx, jsxs } from "react/jsx-runtime";
import { Info } from "@hitachivantara/uikit-react-icons";
//#region src/Flow/nodes/DashboardNode.tsx
var DEFAULT_LABELS = {
emptyMessage: "No visualizations connected to the dashboard.",
dialogTitle: "Configure dashboard",
dialogSubtitle: "Please configure the layout of your dashboard as needed.",
dialogApply: "Apply",
dialogCancel: "Cancel"
};
/** @deprecated no longer supported. Instead create a custom node with `HvDialog` + `HvDashboard` */
var HvDashboardNode = (props) => {
const { id, open, layout, labels: labelsProp, classes: classesProp, previewItems, children, dialogProps, dashboardProps, onApply, onCancel, onClose, ...others } = props;
const labels = useLabels(DEFAULT_LABELS, labelsProp);
const { classes } = useClasses(classesProp);
return /* @__PURE__ */ jsxs(HvFlowNode, {
id,
classes,
labels,
...others,
children: [children, /* @__PURE__ */ jsxs(HvDialog, {
open,
maxWidth: "lg",
fullWidth: true,
onClose,
...dialogProps,
children: [
/* @__PURE__ */ jsx(HvDialogTitle, {
variant: "info",
children: labels?.dialogTitle
}),
/* @__PURE__ */ jsxs(HvDialogContent, {
indentContent: true,
children: [labels?.dialogSubtitle, layout && layout?.length > 0 ? /* @__PURE__ */ jsx(HvDashboard, {
cols: 12,
layout,
compactType: "vertical",
rowHeight: 80,
margin: [16, 16],
containerPadding: [0, 16],
...dashboardProps,
children: previewItems
}) : /* @__PURE__ */ jsx(HvEmptyState, {
className: classes.empty,
icon: /* @__PURE__ */ jsx(Info, {}),
message: labels?.emptyMessage
})]
}),
/* @__PURE__ */ jsxs(HvDialogActions, { children: [/* @__PURE__ */ jsx(HvButton, {
variant: "primary",
onClick: onApply,
children: labels?.dialogApply
}), /* @__PURE__ */ jsx(HvButton, {
variant: "secondarySubtle",
onClick: onCancel,
children: labels?.dialogCancel
})] })
]
})]
});
};
//#endregion
export { HvDashboardNode };