UNPKG

@hitachivantara/uikit-react-lab

Version:

Contributed React components for the NEXT UI Kit.

90 lines (89 loc) 2.89 kB
import { jsxs, jsx } from "react/jsx-runtime"; import { useLabels, HvDialog, HvDialogTitle, HvDialogContent, HvEmptyState, HvDialogActions, HvButton } from "@hitachivantara/uikit-react-core"; import { Info } from "@hitachivantara/uikit-react-icons"; import { useClasses } from "./DashboardNode.styles.js"; import { staticClasses } from "./DashboardNode.styles.js"; import { HvFlowNode } from "../Node/Node.js"; import { HvDashboard } from "../../Dashboard/Dashboard.js"; const 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" }; const 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 }) ] }) ] } ) ] } ); }; export { HvDashboardNode, staticClasses as hvDashboardNodeClasses };