Skip to content

Commit

Permalink
chore: add className to dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
k0stik committed Jul 31, 2024
1 parent c743a8f commit 0b74a6a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dist/mui/components/dialog/Dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { DialogProps } from "@mui/material/Dialog";
import React from "react";
export interface DialogModalProps extends DialogProps {
id?: string;
className?: string;
titleComponent?: string | React.ReactNode;
open: boolean;
onSubmit?: (() => void) | undefined;
Expand All @@ -24,5 +25,5 @@ export interface DialogModalProps extends DialogProps {
cancelButtonProps?: ButtonProps;
draggableId?: string;
}
declare function DialogModal({ id, title, titleComponent, open, scroll, onSubmit, onCancel, onClose, children, maxWidth, dividers, fullWidth, isSubmitButtonDisabled, isSubmitButtonProcessing, isSubmitOnEnter, renderHeaderCustom, renderBodyCustom, renderFooterCustom, submitButtonText, cancelButtonText, submitButtonProps, cancelButtonProps, PaperComponent, draggableId, }: DialogModalProps): React.JSX.Element;
declare function DialogModal({ id, className, title, titleComponent, open, scroll, onSubmit, onCancel, onClose, children, maxWidth, dividers, fullWidth, isSubmitButtonDisabled, isSubmitButtonProcessing, isSubmitOnEnter, renderHeaderCustom, renderBodyCustom, renderFooterCustom, submitButtonText, cancelButtonText, submitButtonProps, cancelButtonProps, PaperComponent, draggableId, }: DialogModalProps): React.JSX.Element;
export default DialogModal;
4 changes: 2 additions & 2 deletions dist/mui/components/dialog/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import IconButton from "@mui/material/IconButton";
import Typography from "@mui/material/Typography";
import React, { useCallback } from "react";
import IconByName from "../icon/IconByName";
function DialogModal({ id = "modal-dialog", title, titleComponent, open, scroll = "paper", onSubmit = undefined, onCancel, onClose, children, maxWidth = "sm", dividers = true, fullWidth = true, isSubmitButtonDisabled = false, isSubmitButtonProcessing = false, isSubmitOnEnter = false, renderHeaderCustom, renderBodyCustom, renderFooterCustom, submitButtonText = "Submit", cancelButtonText = "Cancel", submitButtonProps, cancelButtonProps, PaperComponent, draggableId, }) {
function DialogModal({ id = "modal-dialog", className, title, titleComponent, open, scroll = "paper", onSubmit = undefined, onCancel, onClose, children, maxWidth = "sm", dividers = true, fullWidth = true, isSubmitButtonDisabled = false, isSubmitButtonProcessing = false, isSubmitOnEnter = false, renderHeaderCustom, renderBodyCustom, renderFooterCustom, submitButtonText = "Submit", cancelButtonText = "Cancel", submitButtonProps, cancelButtonProps, PaperComponent, draggableId, }) {
const handleSubmit = () => {
if (onSubmit)
onSubmit();
Expand Down Expand Up @@ -46,7 +46,7 @@ function DialogModal({ id = "modal-dialog", title, titleComponent, open, scroll
React.createElement(Button, { id: `${id}-cancel-button`, variant: "text", "data-dismiss": "modal", "aria-label": cancelButtonText, onClick: handleCancel, ...cancelButtonProps }, cancelButtonText),
React.createElement(LoadingButton, { id: `${id}-submit-button`, loading: isSubmitButtonProcessing, variant: "text", "aria-label": submitButtonText, disabled: isSubmitButtonDisabled || isSubmitButtonProcessing, onClick: handleSubmit, ...submitButtonProps }, submitButtonText)));
};
return (React.createElement(Dialog, { id: id, open: open, onClose: onClose, onSubmit: onSubmit, maxWidth: maxWidth, scroll: scroll, fullWidth: fullWidth, onKeyUp: handleSubmitOnEnter, PaperComponent: PaperComponent },
return (React.createElement(Dialog, { id: id, className: className, open: open, onClose: onClose, onSubmit: onSubmit, maxWidth: maxWidth, scroll: scroll, fullWidth: fullWidth, onKeyUp: handleSubmitOnEnter, PaperComponent: PaperComponent },
renderHeaderCustom ? renderHeaderCustom() : renderHeaderDefault(),
renderBodyCustom ? renderBodyCustom() : renderBodyDefault(),
renderFooterCustom ? renderFooterCustom() : renderFooterDefault()));
Expand Down
3 changes: 3 additions & 0 deletions src/mui/components/dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import IconByName from "../icon/IconByName";

export interface DialogModalProps extends DialogProps {
id?: string;
className?: string;
titleComponent?: string | React.ReactNode;
open: boolean;
onSubmit?: (() => void) | undefined;
Expand All @@ -38,6 +39,7 @@ export interface DialogModalProps extends DialogProps {

function DialogModal({
id = "modal-dialog",
className,
title,
titleComponent,
open,
Expand Down Expand Up @@ -142,6 +144,7 @@ function DialogModal({
return (
<Dialog
id={id}
className={className}
open={open}
onClose={onClose}
onSubmit={onSubmit}
Expand Down

0 comments on commit 0b74a6a

Please sign in to comment.