@yogiswara/honcho-editor-ui 2.6.10 → 2.6.12
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.
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
type Preset = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
1
5
|
interface Props {
|
|
6
|
+
preset: Preset;
|
|
2
7
|
isLoading: boolean;
|
|
3
8
|
onCancel: () => void;
|
|
4
|
-
onSubmit: () => void;
|
|
9
|
+
onSubmit: (id: string) => void;
|
|
5
10
|
}
|
|
6
11
|
declare function HPresetDeleteDialog(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
12
|
export default HPresetDeleteDialog;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import ModalDialog from "../modal/HModalDialog";
|
|
3
3
|
function HPresetDeleteDialog(props) {
|
|
4
|
-
return (_jsx(ModalDialog, { isOpen: true, title: "Delete preset?", description: "The preset will be permanently removed.", isLoading: props.isLoading, onCancel: props.onCancel, submitLabel: "Delete", onSubmit: props.onSubmit
|
|
4
|
+
return (_jsx(ModalDialog, { isOpen: true, title: "Delete preset?", description: "The preset will be permanently removed.", isLoading: props.isLoading, onCancel: props.onCancel, submitLabel: "Delete", onSubmit: () => props.onSubmit(props.preset.id), preset: {
|
|
5
|
+
id: "",
|
|
6
|
+
name: ""
|
|
7
|
+
} }));
|
|
5
8
|
}
|
|
6
9
|
;
|
|
7
10
|
export default HPresetDeleteDialog;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
type Preset = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
1
5
|
interface ModalDialogProps {
|
|
2
6
|
isOpen: boolean;
|
|
7
|
+
preset: Preset;
|
|
3
8
|
isLoading?: boolean;
|
|
4
9
|
title?: string;
|
|
5
10
|
description?: string;
|
|
6
11
|
onCancel: () => void;
|
|
7
|
-
onSubmit: () => void;
|
|
12
|
+
onSubmit: (id: string) => void;
|
|
8
13
|
cancelLabel?: string;
|
|
9
14
|
submitLabel?: string;
|
|
10
15
|
}
|
|
@@ -8,11 +8,11 @@ const defaultPaperStyle = {
|
|
|
8
8
|
boxShadow: "none",
|
|
9
9
|
};
|
|
10
10
|
function ModalDialog(props) {
|
|
11
|
-
const { isOpen, isLoading = false, title, description, onCancel, onSubmit, cancelLabel = "Cancel", submitLabel = "Confirm", } = props;
|
|
11
|
+
const { isOpen, preset, isLoading = false, title, description, onCancel, onSubmit, cancelLabel = "Cancel", submitLabel = "Confirm", } = props;
|
|
12
12
|
const theme = useTheme();
|
|
13
13
|
const typography = useHonchoTypography();
|
|
14
14
|
const colors = useColors();
|
|
15
|
-
return (_jsxs(Dialog, { disableScrollLock: true, open: isOpen, onClose: onCancel, "aria-labelledby": "dialog-title", PaperProps: { sx: defaultPaperStyle }, children: ["``", title && (_jsx(DialogTitle, { children: _jsx(Typography, { variant: "labelLarge", color: colors.onSurface, children: title }) })), _jsx(DialogContent, { sx: { padding: { xs: "24px 24px 0 24px", sm: "24px 24px 0 24px" } }, children: description && (_jsx(Typography, { sx: { color: "#656369", fontSize: 14 }, variant: "bodyMedium", children: description })) }), _jsx(DialogActions, { sx: { padding: 3 }, children: _jsxs(Grid, { container: true, direction: "row", justifyContent: "end", alignItems: "center", gap: 1, children: [_jsx(Button, { variant: "text", onClick: onCancel, children: cancelLabel }), _jsx(Button, { variant: "text", color: "error", disabled: isLoading, onClick: onSubmit, children: submitLabel })] }) })] }));
|
|
15
|
+
return (_jsxs(Dialog, { disableScrollLock: true, open: isOpen, onClose: onCancel, "aria-labelledby": "dialog-title", PaperProps: { sx: defaultPaperStyle }, children: ["``", title && (_jsx(DialogTitle, { children: _jsx(Typography, { variant: "labelLarge", color: colors.onSurface, children: title }) })), _jsx(DialogContent, { sx: { padding: { xs: "24px 24px 0 24px", sm: "24px 24px 0 24px" } }, children: description && (_jsx(Typography, { sx: { color: "#656369", fontSize: 14 }, variant: "bodyMedium", children: description })) }), _jsx(DialogActions, { sx: { padding: 3 }, children: _jsxs(Grid, { container: true, direction: "row", justifyContent: "end", alignItems: "center", gap: 1, children: [_jsx(Button, { variant: "text", onClick: onCancel, children: cancelLabel }), _jsx(Button, { variant: "text", color: "error", disabled: isLoading, onClick: () => onSubmit(preset.id), children: submitLabel })] }) })] }));
|
|
16
16
|
}
|
|
17
17
|
;
|
|
18
18
|
export default ModalDialog;
|