Skip to content

Commit

Permalink
Merge pull request #76 from Exabyte-io/update/SOF-7411
Browse files Browse the repository at this point in the history
SOF-7411: Minor dialog changes
  • Loading branch information
k0stik authored Jul 31, 2024
2 parents 0c18b15 + 006f2a4 commit bebbfa1
Show file tree
Hide file tree
Showing 45 changed files with 7,482 additions and 3,397 deletions.
4 changes: 2 additions & 2 deletions dist/hooks/useCopyToClipboard.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { enqueueSnackbar } from "notistack";
import { useCallback } from "react";
import { showSuccessAlert } from "../other/alerts";
import { copyToClipboard } from "../utils/clipboard";
export const useCopyToClipboard = () => {
return useCallback((textToCopy, content) => {
copyToClipboard(textToCopy, () => {
enqueueSnackbar(content, { variant: "success" });
showSuccessAlert(content);
});
}, []);
};
8 changes: 4 additions & 4 deletions dist/mui/components/custom/date-picker/DatePicker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export type DateRange = {
};
interface DatePickerProps {
onChange: (dateRange: DateRange | Record<string, never>, option?: DateRangeOption | null) => void;
startDate: Moment | null;
endDate: Moment | null;
defaultOption: DateRangeOption | null;
isMaxOption: boolean;
startDate?: Moment | null;
endDate?: Moment | null;
defaultOption?: DateRangeOption | null;
isMaxOption?: boolean;
}
declare function DatePicker({ onChange, startDate, endDate, defaultOption, isMaxOption, }: DatePickerProps): React.JSX.Element;
export default DatePicker;
10 changes: 6 additions & 4 deletions dist/mui/components/custom/date-picker/DatePicker.styled.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export declare const DatePickerButtonsContainer: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
export declare const StyledPopover: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
export declare const StyledDatePicker: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
export declare const StyledDatePickerContainer: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
/// <reference types="react" />
import { Theme } from "@mui/material/styles";
export declare const DatePickerButtonsContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
export declare const StyledPopover: import("@emotion/styled").StyledComponent<import("@mui/material/Popover").PopoverProps & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
export declare const StyledDatePicker: import("@emotion/styled").StyledComponent<import("@mui/x-date-pickers/DatePicker").DatePickerProps<unknown> & import("react").RefAttributes<HTMLDivElement> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
export declare const StyledDatePickerContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
3 changes: 1 addition & 2 deletions dist/mui/components/dialog/Dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export interface DialogModalProps extends DialogProps {
onSubmit?: (() => void) | undefined;
onClose?: (() => void) | undefined;
onCancel?: (() => void) | undefined;
scroll?: "body" | "paper";
children?: React.ReactNode;
maxWidth?: false | "md" | "xs" | "sm" | "lg" | "xl" | undefined;
dividers?: boolean;
Expand All @@ -24,5 +23,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, title, titleComponent, open, scroll, onSubmit, onCancel, onClose, children, maxWidth, dividers, fullWidth, isSubmitButtonDisabled, isSubmitButtonProcessing, isSubmitOnEnter, renderHeaderCustom, renderBodyCustom, renderFooterCustom, submitButtonText, cancelButtonText, submitButtonProps, cancelButtonProps, PaperComponent, draggableId, ...originalProps }: DialogModalProps): React.JSX.Element;
export default DialogModal;
10 changes: 7 additions & 3 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", 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, ...originalProps }) {
const handleSubmit = () => {
if (onSubmit)
onSubmit();
Expand All @@ -35,14 +35,18 @@ function DialogModal({ id = "modal-dialog", title, titleComponent, open, scroll
React.createElement(IconByName, { name: "actions.close", fontSize: "small" }))))));
}, [title, titleComponent]);
const renderBodyDefault = () => {
return React.createElement(DialogContent, { dividers: dividers }, children);
return (React.createElement(DialogContent, { sx: {
display: "flex",
flexDirection: "column",
overflow: "hidden",
}, dividers: dividers }, children));
};
const renderFooterDefault = () => {
return (React.createElement(DialogActions, null,
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, open: open, onClose: onClose, onSubmit: onSubmit, maxWidth: maxWidth, scroll: scroll, fullWidth: fullWidth, onKeyUp: handleSubmitOnEnter, PaperComponent: PaperComponent, ...originalProps },
renderHeaderCustom ? renderHeaderCustom() : renderHeaderDefault(),
renderBodyCustom ? renderBodyCustom() : renderBodyDefault(),
renderFooterCustom ? renderFooterCustom() : renderFooterDefault()));
Expand Down
4 changes: 2 additions & 2 deletions dist/mui/components/popover/info-popover/InfoPopover.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ export declare const InfoIconButton: import("@mui/styles").StyledComponent<Omit<
}>;
export declare const PopoverTitle: import("@mui/styles").StyledComponent<Omit<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
}, "variant" | "className" | "style" | "classes" | "children" | "color" | "fontSize" | "sx" | "p" | "height" | "width" | "display" | "fontFamily" | "fontStyle" | "fontWeight" | "letterSpacing" | "order" | "overflow" | "visibility" | "border" | "boxShadow" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "className" | "classes"> & import("@mui/styles").StyledComponentProps<"root"> & Omit<{
}, "bottom" | "top" | "left" | "right" | "variant" | "className" | "style" | "classes" | "children" | "color" | "fontSize" | "sx" | "p" | "height" | "width" | "display" | "fontFamily" | "fontStyle" | "fontWeight" | "letterSpacing" | "order" | "overflow" | "visibility" | "border" | "boxShadow" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "columnGap" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "className" | "classes"> & import("@mui/styles").StyledComponentProps<"root"> & Omit<{
theme: Theme;
}, "className" | "theme"> & {
className?: string | undefined;
theme?: Theme | undefined;
}>;
export declare const PopoverText: import("@mui/styles").StyledComponent<Omit<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
}, "variant" | "className" | "style" | "classes" | "children" | "color" | "fontSize" | "sx" | "p" | "height" | "width" | "display" | "fontFamily" | "fontStyle" | "fontWeight" | "letterSpacing" | "order" | "overflow" | "visibility" | "border" | "boxShadow" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "className" | "classes"> & import("@mui/styles").StyledComponentProps<"root"> & Omit<{
}, "bottom" | "top" | "left" | "right" | "variant" | "className" | "style" | "classes" | "children" | "color" | "fontSize" | "sx" | "p" | "height" | "width" | "display" | "fontFamily" | "fontStyle" | "fontWeight" | "letterSpacing" | "order" | "overflow" | "visibility" | "border" | "boxShadow" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "columnGap" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "className" | "classes"> & import("@mui/styles").StyledComponentProps<"root"> & Omit<{
theme: Theme;
}, "className" | "theme"> & {
className?: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion dist/mui/components/stepper/Stepper.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
export declare const StyledStepConnector: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>;
export declare const StyledStepConnector: import("@emotion/styled").StyledComponent<import("@mui/material/StepConnector").StepConnectorProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
export interface StyledStepperProps {
activeStep: number;
steps: string[];
Expand Down
5 changes: 5 additions & 0 deletions dist/other/alerts.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare function showSuccessAlert(message: string): void;
export declare function showErrorAlert(message: string): void;
export declare function showWarningAlert(message: string): void;
export declare function showInfoAlert(message: string): void;
export declare function showAlert(message: string, type: "info" | "warning" | "error" | "success"): void;
35 changes: 35 additions & 0 deletions dist/other/alerts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { enqueueSnackbar } from "notistack";
const anchorOrigin = {
vertical: "bottom",
horizontal: "left",
};
export function showSuccessAlert(message) {
enqueueSnackbar(message, { variant: "success", anchorOrigin });
}
export function showErrorAlert(message) {
enqueueSnackbar(message, { variant: "error", anchorOrigin });
}
export function showWarningAlert(message) {
enqueueSnackbar(message, { variant: "warning", anchorOrigin });
}
export function showInfoAlert(message) {
enqueueSnackbar(message, { variant: "info", anchorOrigin });
}
export function showAlert(message, type) {
switch (type) {
case "warning":
showWarningAlert(message);
break;
case "error":
showErrorAlert(message);
break;
case "success":
showSuccessAlert(message);
break;
case "info":
showInfoAlert(message);
break;
default:
showInfoAlert(message);
}
}
7 changes: 4 additions & 3 deletions dist/other/fullscreen/FullscreenComponentMixin.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from "react";
import Fullscreen from "react-full-screen";
declare class FullscreenHandlerComponent extends Fullscreen {
render(): React.JSX.Element;
import { FullScreenProps } from "react-full-screen";
interface FullscreenHandlerComponent extends Omit<FullScreenProps, "handle"> {
enabled: boolean;
}
declare function FullscreenHandlerComponent({ enabled, ...props }: FullscreenHandlerComponent): React.JSX.Element;
declare const FullscreenComponentMixin: (superclass: React.ComponentClass) => {
new (props: never): {
toggleFullscreen(): void;
Expand Down
21 changes: 14 additions & 7 deletions dist/other/fullscreen/FullscreenComponentMixin.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
/* eslint-disable react/jsx-props-no-spreading */
import setClass from "classnames";
import React from "react";
import Fullscreen from "react-full-screen";
class FullscreenHandlerComponent extends Fullscreen {
render() {
// @ts-ignore
return React.createElement("div", { className: this.props.className }, super.render());
}
import React, { useEffect } from "react";
import { FullScreen, useFullScreenHandle } from "react-full-screen";
function FullscreenHandlerComponent({ enabled, ...props }) {
const handle = useFullScreenHandle();
useEffect(() => {
if (enabled) {
handle.enter();
}
else {
handle.exit();
}
}, [enabled]);
return React.createElement(FullScreen, { ...props, handle: handle });
}
const FullscreenComponentMixin = (superclass) => class extends superclass {
constructor(props) {
Expand Down
4 changes: 4 additions & 0 deletions dist/other/rjsf/RJSFForm.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { FormProps } from "@rjsf/core";
import { RJSFSchema } from "@rjsf/utils";
import React from "react";
export default function RJSFForm(props: FormProps<any, RJSFSchema, any>): React.JSX.Element;
17 changes: 17 additions & 0 deletions dist/other/rjsf/RJSFForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Form from "@rjsf/mui";
import React from "react";
import ArrayFieldItemTemplate from "./templates/ArrayFieldItemTemplate";
import ArrayFieldTemplate from "./templates/ArrayFieldTemplate";
import BaseInputTemplate from "./templates/BaseInputTemplate";
import ObjectFieldTemplate from "./templates/ObjectFieldTemplate";
import TitleFieldTemplate from "./templates/TitleFieldTemplate";
import SelectWidget from "./widgets/SelectWidget";
export default function RJSFForm(props) {
return (React.createElement(Form, { ...props, templates: {
ObjectFieldTemplate,
BaseInputTemplate,
ArrayFieldTemplate,
ArrayFieldItemTemplate,
TitleFieldTemplate,
}, widgets: { SelectWidget } }));
}
4 changes: 4 additions & 0 deletions dist/other/rjsf/RJSForm.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { FormProps } from "@rjsf/core";
import { RJSFSchema } from "@rjsf/utils";
import React from "react";
export default function RJSForm({ widgets, templates, ...props }: FormProps<any, RJSFSchema, any>): React.JSX.Element;
Loading

0 comments on commit bebbfa1

Please sign in to comment.