@chris-c-brine/form-dialog 1.3.2 → 1.3.3
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.
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/dist/components/AutoGrid.d.ts +0 -36
- package/dist/components/BaseDialog.d.ts +0 -13
- package/dist/components/BlackoutDialog.d.ts +0 -23
- package/dist/components/FormDialog.d.ts +0 -11
- package/dist/components/FormDialogActions.d.ts +0 -15
- package/dist/components/PaperForm.d.ts +0 -6
- package/dist/components/PersistForm.d.ts +0 -5
- package/dist/components/forms/PersistForm.d.ts +0 -43
- package/dist/hooks/useMaxAttempts.d.ts +0 -13
- package/dist/hooks/useOnMount.d.ts +0 -6
- package/dist/hooks/usePersistForm.d.ts +0 -18
- package/dist/hooks/usePersistedForm.d.ts +0 -41
- package/dist/state/createFormChangeStore.d.ts +0 -20
- package/dist/utils/deepCompare.d.ts +0 -16
- package/dist/utils/hasMaxAttempts.d.ts +0 -5
- package/dist/utils/utils.types.d.ts +0 -15
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/components/dialogs/BlackoutDialog.tsx","../src/components/dialogs/BaseDialog.tsx","../src/components/forms/PaperForm.tsx","../src/state/FormDialogContext.ts","../src/utils/applyDefaultFormDialogProps.tsx","../src/utils/ThemeBridge.tsx","../src/utils/formState.ts","../src/state/FormDialogProvider.tsx","../src/components/dialogs/FormDialog.tsx","../src/hooks/useFormDialog.ts","../src/hooks/useDialog.ts","../src/hooks/useFormButton.ts","../src/components/buttons/LoadingButton.tsx","../src/components/buttons/FormCancelButton.tsx","../src/components/buttons/FormSubmitButton.tsx","../src/components/buttons/FormResetButton.tsx","../src/components/GridSpacer.tsx","../src/components/dialogs/FormDialogActions.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["_jsx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CAAC,gBAAgB,EAAA,EAAA,GAAK,iBAAiB,EAAA,CAAI,EAAA,CACtC,CACR,EACA,CAAC,iBAAiB,KACjBA,GAAA,CAAC,IAAI,EAAA,EAAA,QAAA,EACHA,GAAA,CAAC,eAAe,EAAA,EAAA,GAAK,gBAAgB,EAAA,CAAI,EAAA,CACpC,CACR,EACA,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAA,MAAA,GAAR,QAAQ,GAAIA,GAAA,CAAC,UAAU,EAAA,EAAA,CAAG,EAC3BA,GAAA,CAAC,IAAI,EAAA,EAAA,QAAA,EACHA,GAAA,CAAC,gBAAgB,EAAA,EAAA,GAAK,iBAAiB,EAAA,CAAI,EAAA,CACtC,CAAA,EAAA,CACF;AAEX;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/components/dialogs/BlackoutDialog.tsx","../src/components/dialogs/BaseDialog.tsx","../src/components/forms/PaperForm.tsx","../src/state/FormDialogContext.ts","../src/utils/applyDefaultFormDialogProps.tsx","../src/utils/ThemeBridge.tsx","../src/utils/formState.ts","../src/state/FormDialogProvider.tsx","../src/components/dialogs/FormDialog.tsx","../src/hooks/useFormDialog.ts","../src/hooks/useDialog.ts","../src/hooks/useFormButton.ts","../src/components/buttons/LoadingButton.tsx","../src/components/buttons/FormCancelButton.tsx","../src/components/buttons/FormSubmitButton.tsx","../src/components/buttons/FormResetButton.tsx","../src/components/GridSpacer.tsx","../src/components/dialogs/FormDialogActions.tsx"],"sourcesContent":["// src/components/BlackoutDialog.tsx\nimport { Dialog } from \"@mui/material\";\nimport { type FC } from \"react\";\nimport { BlackoutDialogProps } from \"../../types\";\n\n/**\n * A component for rendering a modal dialog with an optional blackout effect.\n */\nexport const BlackoutDialog: FC<BlackoutDialogProps> = ({\n open = false,\n blackout = false,\n id = \"blackout-dialog\",\n children,\n sx,\n ...props\n}) => {\n const sxProps = blackout ? { ...sx, backgroundColor: \"black\" } : sx;\n\n /**\n * 1) When you open a dialog via a button, the button's ancestor gets aria-hidden, presumably so that\n * screen readers (SR) can't interact with it while the dialog is open.\n * 2) When you close the dialog, the aria-hidden is removed so that SRs can interact with the button again.\n * 3) Also, when closing, the focus is moved back on the opener button.\n *\n * Now comes the important part. You get Blocked aria-hidden on a <div> only when 3 happens before 2. In this case,\n * as the error message explains, we are trying to place focus somewhere where SRs don't have access, which is\n * a No No, and browsers correctly warn about it.\n *\n * This ordering is dependent on the closeAfterTransition prop on the MUI Dialog. When false and user triggers\n * dialog close, aria-hidden is removed (2) and then focus is placed on the opener button (3). Meaning there is no\n * issue. You can see it in action here. However, when it's true (the default), the order is the other way around,\n * and you get the warning.\n */\n return (\n <Dialog closeAfterTransition={false} open={open} id={id} sx={sxProps} {...props}>\n {children}\n </Dialog>\n );\n};\n","// src/components/BaseDialog.tsx\nimport type { FC } from \"react\";\nimport { DialogTitle, DialogContent, DialogActions } from \"@mui/material\";\nimport { BlackoutDialog } from \"./BlackoutDialog\";\nimport { BaseDialogProps } from \"../../types\";\n\n/**\n * A flexible dialog component with standardized structure and styling\n *\n * BaseDialog provides a consistent dialog layout with optional title, content,\n * and action sections. It builds upon the BlackoutDialog component, adding\n * structure through Material UI's dialog subcomponents.\n *\n * Key features:\n * - Consistent dialog structure with title, content, and actions areas\n * - Optional rendering of each section based on provided props\n * - Full control over styling and props for each section\n * - Standardized minimum width and spacing\n * - Support for a dedicated close button in the header\n *\n * The component automatically renders only the sections for which content\n * is provided, allowing for flexible dialog layouts while maintaining\n * consistent styling and behavior.\n *\n * @example\n * // Customized with section props\n * <BaseDialog\n * open={isOpen}\n * title=\"Advanced Settings\"\n * titleProps={{ sx: { backgroundColor: 'primary.main', color: 'white' } }}\n * contentProps={{ sx: { p: 3 } }}\n * actionsProps={{ sx: { justifyContent: 'space-between' } }}\n * actions={<SettingsDialogActions />}\n * >\n * <SettingsForm />\n * </BaseDialog>\n */\nexport const BaseDialog: FC<BaseDialogProps> = ({\n title = null,\n closeButton,\n titleProps,\n children = null,\n contentProps,\n id,\n actions = null,\n actionsProps,\n ...props\n}) => (\n <BlackoutDialog id={id} {...props}>\n {title && <DialogTitle {...titleProps}>{title}</DialogTitle>} {closeButton}\n {children && <DialogContent {...contentProps}>{children}</DialogContent>}\n {actions && <DialogActions {...actionsProps}>{actions}</DialogActions>}\n </BlackoutDialog>\n);\n","// src/components/PaperForm.tsx\r\nimport { Paper } from \"@mui/material\";\r\nimport { FormContainer, type FieldValues } from \"react-hook-form-mui\";\r\nimport {PaperFormProps} from \"../../types\";\r\n\r\n/**\r\n * A component that combines a Material UI Paper with a form container\r\n *\r\n * PaperForm wraps form content in an elevated paper surface, providing\r\n * visual distinction and a clean container for form elements. It integrates\r\n * seamlessly with react-hook-form by using FormContainer internally.\r\n *\r\n * This component is useful for creating standalone form surfaces outside of dialogs,\r\n * such as on pages or within cards. It supports all Paper props for styling\r\n * while handling form state management through FormContainer.\r\n *\r\n * @example\r\n * // Basic usage\r\n * <PaperForm\r\n * formProps={{\r\n * defaultValues: { name: \"\", email: \"\" },\r\n * onSuccess: handleSubmit\r\n * }}\r\n * elevation={3}\r\n * >\r\n * <TextFieldElement name=\"name\" label=\"Name\" />\r\n * <TextFieldElement name=\"email\" label=\"Email\" />\r\n * <Button type=\"submit\">Submit</Button>\r\n * </PaperForm>\r\n *\r\n * @example\r\n * // With custom styling and validation\r\n * <PaperForm\r\n * formProps={{\r\n * defaultValues: formDefaultValues,\r\n * onSuccess: handleSubmit,\r\n * onError: handleError,\r\n * }}\r\n * sx={{\r\n * padding: 3,\r\n * borderRadius: 2,\r\n * backgroundColor: 'background.paper',\r\n * }}\r\n * elevation={2}\r\n * >\r\n * <FormFields />\r\n * <FormDialogActions submitProps={{ children: \"Save Profile\" }} />\r\n * </PaperForm>\r\n *\r\n * @template T - The type of form values being handled\r\n */\r\nexport const PaperForm = <T extends FieldValues>({ children, formProps, ...paperProps }: PaperFormProps<T>) => (\r\n <Paper {...paperProps}>\r\n <FormContainer {...formProps}>\r\n {children}\r\n </FormContainer>\r\n </Paper>\r\n);\r\n","import { createContext } from \"react\";\r\nimport {FormDialogContextType} from \"../types\";\r\n\r\nexport const FormDialogContext = createContext<FormDialogContextType | undefined>(undefined);\r\n\r\nFormDialogContext.displayName = \"FormDialogContext\";\r\n","import { Fragment, ReactNode } from \"react\";\nimport {\n Close as CloseIcon,\n Refresh as RefreshIcon,\n Save as SaveIcon,\n} from \"@mui/icons-material\";\n\nimport { ApplyDefaultFormDialogPropsProps, FormButtonProps } from \"../types\";\n\nexport function applyDefaultFormDialogProps({\n resetProps,\n submitProps,\n gridProps,\n cancelProps,\n variant = \"iconText\",\n}: ApplyDefaultFormDialogPropsProps) {\n // Grid Container\n const gridContainerProps = {\n ...gridProps,\n sx: {\n justifyContent: \"space-between\",\n minWidth: 275,\n px: 1,\n pb: 1.5,\n columnGap: 1,\n width: \"100%\",\n ...gridProps?.sx,\n },\n };\n\n // Reset Button\n let resetChildren: ReactNode | undefined = undefined;\n if (variant == \"icon\") resetChildren = <RefreshIcon />;\n if (variant == \"iconText\")\n resetChildren = (\n <Fragment key=\"refreshIconText\">\n <RefreshIcon sx={{ mr: 1 }} /> RESET\n </Fragment>\n );\n const resetButtonProps = {\n ...(resetChildren ? { children: resetChildren } : {}),\n ...resetProps,\n };\n\n // Cancel Button\n let cancelChildren: ReactNode | undefined = undefined;\n if (variant == \"icon\") cancelChildren = <CloseIcon />;\n if (variant == \"iconText\")\n cancelChildren = (\n <Fragment key=\"cancelIconText\">\n <CloseIcon sx={{ mr: 1 }} /> CANCEL\n </Fragment>\n );\n const cancelButtonProps = {\n ...(cancelChildren ? { children: cancelChildren } : {}),\n ...cancelProps,\n };\n\n // Submit Button\n let submitChildren: Partial<FormButtonProps> = {};\n if (variant == \"icon\")\n submitChildren = { children: <></>, altIcon: <SaveIcon /> };\n if (variant == \"iconText\")\n submitChildren = { altIcon: <SaveIcon sx={{ mr: 1 }} /> };\n const submitButtonProps = {\n ...submitChildren,\n ...submitProps,\n };\n\n return {\n resetButtonProps,\n gridContainerProps,\n cancelButtonProps,\n submitButtonProps,\n };\n}\n","// src/utils/ThemeBridge.tsx\r\nimport { useTheme as useMuiTheme } from '@mui/material/styles';\r\nimport React, { createContext, useEffect, useState, PropsWithChildren } from 'react';\r\n\r\n// Create a context that will hold the parent theme\r\nconst ParentThemeContext = createContext<any>(null);\r\n\r\nexport const ThemeBridge: React.FC<PropsWithChildren> = ({ children }) => {\r\n const parentTheme = useMuiTheme();\r\n const [themeSnapshot, setThemeSnapshot] = useState(parentTheme);\r\n\r\n // Update the snapshot when the parent theme changes\r\n useEffect(() => {\r\n setThemeSnapshot(parentTheme);\r\n }, [parentTheme]);\r\n\r\n // Pass the parent theme to our components\r\n return (\r\n <ParentThemeContext.Provider value={themeSnapshot}>\r\n {children}\r\n </ParentThemeContext.Provider>\r\n );\r\n};\r\n","import {FieldValues, UseFormStateReturn} from \"react-hook-form-mui\";\r\n\r\nexport type DisabledWhileActionProps = {\r\n formState: UseFormStateReturn<FieldValues>,\r\n disabledForm: boolean,\r\n}\r\nexport const disabledWhileLoading = ({formState, disabledForm}: DisabledWhileActionProps): boolean => {\r\n return formState.isSubmitting || formState.isLoading || disabledForm;\r\n}\r\n\r\nexport const enabledWhileDirty = ({formState, disabledForm}: DisabledWhileActionProps): boolean => {\r\n return !formState.isDirty || disabledWhileLoading({formState, disabledForm})\r\n}\r\n","// src/components/dialogs/FormDialog/state/FormDialogProvider.tsx\r\nimport {useState, type FC } from \"react\";\r\nimport {FormDialogContext} from \"./FormDialogContext\";\r\nimport {ThemeBridge} from '../utils';\r\nimport {FormDialogProviderProps} from \"../types\";\r\n\r\n/**\r\n * Context provider component for form dialog state management\r\n *\r\n * FormDialogProvider creates and manages shared state for form dialogs,\r\n * allowing child components to access dialog state and controls through\r\n * the useFormDialog hook.\r\n *\r\n * This provider handles:\r\n * - Dialog open/close state\r\n * - Form-wide disabled state\r\n * - Dialog close handler passing\r\n * - Theme consistency via ThemeBridge\r\n *\r\n * Use this provider to wrap form components that need to share state\r\n * and disabled status, such as dialogs with multiple form fields\r\n * and action buttons that need to be coordinated.\r\n *\r\n * @example\r\n * // Basic usage wrapping a form\r\n * <FormDialogProvider>\r\n * <FormContainer onSuccess={handleSubmit}>\r\n * <TextFieldElement name=\"name\" />\r\n * <FormDialogActions />\r\n * </FormContainer>\r\n * </FormDialogProvider>\r\n *\r\n * @example\r\n * // With pre-configured dialog state\r\n * <FormDialogProvider open={isOpen} closeDialog={handleClose}>\r\n * <PaperForm formProps={formProps}>\r\n * <LoginFormFields />\r\n * <FormDialogActions submitProps={{ maxAttempts: 3 }} />\r\n * </PaperForm>\r\n * </FormDialogProvider>\r\n */\r\nexport const FormDialogProvider: FC<FormDialogProviderProps> = ({children, ...value}) => {\r\n const [disabled, setDisabled] = useState(false);\r\n\r\n return (\r\n <ThemeBridge>\r\n <FormDialogContext.Provider value={{...value, disabled, setDisabled}}>\r\n {children}\r\n </FormDialogContext.Provider>\r\n </ThemeBridge>\r\n );\r\n};","// src/components/FormDialog.tsx\r\nimport {useCallback, useMemo} from \"react\";\r\nimport {BaseDialog} from \"./BaseDialog\";\r\nimport {PaperForm} from \"../forms/PaperForm\";\r\nimport {type FieldValues} from \"react-hook-form-mui\";\r\nimport {IconButton, type PaperProps} from \"@mui/material\";\nimport type {SxProps, Theme} from \"@mui/material/styles\";\nimport {FormDialogProvider} from \"../../state/FormDialogProvider\";\r\nimport {Close as CloseIcon} from \"@mui/icons-material\";\r\nimport {FormDialogProps, BaseDialogProps} from \"../../types\";\r\n\r\n/**\r\n * A dialog component specialized for forms with integrated context providers\r\n *\r\n * FormDialog combines Material UI dialog functionality with React Hook Form,\r\n * creating a comprehensive solution for modal forms. It provides context\r\n * providers for form state management, dialog controls, and accessibility.\r\n *\r\n * Key features:\r\n * - Integrates React Hook Form with Material UI dialogs\r\n * - Provides form state management through FormProvider\r\n * - Establishes dialog context through FormDialogProvider\r\n * - Handles form submission and error states\r\n * - Supports loading states for form operations\r\n * - Maintains consistent styling and behavior\r\n *\r\n * Child components can access the form and dialog context through hooks:\r\n * - useFormContext() - Access form methods and state\r\n * - useFormState() - Access form validation state\r\n * - useFormDialog() - Access dialog controls and state\r\n *\r\n */\r\nexport const FormDialog = function <T extends FieldValues>(\n {formProps, children, open, onClose, ...dialogProps}: FormDialogProps<T>\n) {\n const mergeSx = (base: SxProps<Theme>, override?: SxProps<Theme>) => {\n if (!override) return base;\n return Array.isArray(override) ? [base, ...override] : [base, override];\n };\n\n const PaperComponent = useCallback(\n (props: PaperProps) => <PaperForm formProps={formProps} {...props} />,\n [formProps]\n );\n\n const baseDialogProps: BaseDialogProps = useMemo(() => {\n const actionsDefaultSx = {pt: 2.5};\n const actionsProps = {\n ...dialogProps?.actionsProps,\n sx: mergeSx(actionsDefaultSx, dialogProps?.actionsProps?.sx),\n };\n\n const contentDefaultSx = {\n display: \"flex\",\n justifyContent: \"center\",\n boxSizing: \"border-box\",\n maxHeight: `calc(100vh - 235px)`, // 235 estimate using H4 title & default FormDialogActions\n };\n const contentProps = {\n ...dialogProps?.contentProps,\n sx: mergeSx(contentDefaultSx, dialogProps?.contentProps?.sx),\n };\n\n return {\n ...dialogProps,\n open,\n actionsProps,\n contentProps,\n };\n }, [dialogProps, open]);\n\r\n return (\r\n <FormDialogProvider open={open} closeDialog={onClose}>\r\n <BaseDialog\r\n PaperComponent={PaperComponent}\r\n onClose={onClose}\r\n closeButton={\r\n <IconButton\r\n sx={{\r\n position: \"absolute\",\r\n top: 8,\r\n right: 8,\r\n }}\r\n onClick={(e) => onClose?.(e, 'escapeKeyDown')}\r\n >\r\n <CloseIcon fontSize=\"small\" aria-label=\"close-form-dialog\"/>\r\n </IconButton>\r\n }\r\n {...baseDialogProps}\r\n >\r\n {children}\r\n </BaseDialog>\r\n </FormDialogProvider>\r\n );\r\n};\r\n\r\nFormDialog.displayName = \"FormDialog\";\r\n","// src/components/dialogs/FormDialog/hooks/useFormDialog.ts\r\nimport { useContext } from \"react\";\r\nimport { FormDialogContext } from \"../state/FormDialogContext\";\r\n\r\n/**\r\n * Hook for accessing the FormDialog context values and functions\r\n *\r\n * This hook provides access to the form dialog state and controls managed by\r\n * the FormDialogProvider. It allows components to interact with the dialog state,\r\n * including open/close status and form-wide disabled state.\r\n *\r\n * The context provides:\r\n * - Dialog open state\r\n * - Close dialog function\r\n * - Form disabled state and setter function\r\n *\r\n * @throws Error if used outside a FormDialogProvider\r\n *\r\n * @example\r\n * // Using in a form button component\r\n * const FormButton = () => {\r\n * const { openDialog, disabled } = useFormDialog();\r\n * return (<Button\r\n * disabled={disabled}\r\n * onClick={() => openDialog()}\r\n * >\r\n * Cancel\r\n * </Button>);\r\n * }\r\n *\r\n * @returns FormDialogContextType object containing dialog state and controls\r\n */\r\nexport const useFormDialog = () => {\r\n const context = useContext(FormDialogContext);\r\n if (!context) {\r\n throw new Error(\"useFormDialog must be used within a FormDialogProvider\");\r\n }\r\n return context;\r\n};","import { useCallback, useState } from \"react\";\r\nimport {UseDialogProps, UseDialogReturn} from \"../types\";\r\n\r\n\r\n/**\r\n * Hook for managing dialog state and providing dialog control functions\r\n *\r\n * This hook provides a simple way to manage the dialog state and returns\r\n * functions to open and close the dialog, along with props that can be\r\n * spread onto a Material-UI Dialog component.\r\n *\r\n * Restores focus to the opening element, but only after the dialog has fully closed.\r\n *\r\n * @example\r\n * // Basic usage\r\n * const { openDialog, closeDialog, dialogProps } = useDialog();\r\n * return (<>\r\n * <Button onClick={openDialog}>Open Dialog</Button>\r\n * <BaseDialog {...dialogProps}>Dialog Content</BaseDialog>\r\n * </>);\r\n *\r\n * @example\r\n * // With initial configuration\r\n * const { dialogProps } = useDialog({ keepMounted: true});\r\n *\r\n * @param props - Optional configuration options\r\n */\r\nexport const useDialog = (props?: UseDialogProps): UseDialogReturn => {\r\n const [open, setOpen] = useState(!!props?.open);\r\n\r\n const closeDialog = useCallback(() => setOpen(false), []);\r\n const openDialog = useCallback(() => setOpen(true), []);\r\n\r\n return {\r\n closeDialog,\r\n openDialog,\r\n dialogProps: { open, onClose: closeDialog, keepMounted: !!props?.keepMounted }\r\n };\r\n};","import {useFormContext, useFormState} from \"react-hook-form-mui\";\r\nimport {useFormDialog} from \"./useFormDialog\";\r\n\r\nexport const useFormButton = () => {\r\n const formState = useFormState();\r\n const dialogState = useFormDialog();\r\n const formContext = useFormContext();\r\n return {\r\n formState,\r\n dialogState,\r\n formContext,\r\n }\r\n}","// src/components/buttons/LoadingButton.tsx\r\nimport {Button, CircularProgress, Box} from \"@mui/material\";\r\nimport {LoadingButtonProps} from \"../../types\";\r\n\r\n/**\r\n * A button component with built-in loading state visualization\r\n *\r\n * This component extends Material UI's Button with loading functionality:\r\n * - Displays a spinner when in loading state\r\n * - Shows an optional alternative icon when not loading\r\n * - Maintains consistent layout during state transitions\r\n * - Automatically sizes the spinner based on the current theme's font size\r\n *\r\n * The loading state can be controlled through the `loading` prop:\n * - When `loading` is true, the button shows a circular progress indicator\n * - When `loading` is false or undefined, the button shows its normal content\n *\r\n * @example\r\n * // Basic usage\r\n * <LoadingButton loading={isLoading}>\r\n * Submit\r\n * </LoadingButton>\r\n *\r\n * @example\r\n * // With alternative icon\r\n * <LoadingButton\r\n * loading={!isProcessing}\r\n * altIcon={<SaveIcon />}\r\n * >\r\n * Save\r\n * </LoadingButton>\r\n *\r\n * @example\r\n * // With custom styling\r\n * <LoadingButton\r\n * loading={isSubmitting}\r\n * variant=\"contained\"\r\n * color=\"primary\"\r\n * fullWidth\r\n * >\r\n * Process Payment\r\n * </LoadingButton>\r\n */\r\nexport const LoadingButton = ({children, loading = false, altIcon, loadingIconProps, ...props}: LoadingButtonProps) => {\r\n return (\r\n <Button {...props}>\r\n {!loading ? altIcon : (\r\n <Box\r\n sx={{\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n width: \"100%\",\r\n height: \"auto\",\r\n mr: 1,\r\n }}>\r\n <CircularProgress {...loadingIconProps}/>\r\n </Box>\r\n )}\r\n {children}\r\n </Button>\r\n );\r\n};\n","import {memo, MouseEvent, useCallback} from \"react\";\r\nimport {useFormButton} from \"../../hooks\";\r\nimport {FormButtonProps, LoadingButtonProps} from \"../../types\";\r\nimport {LoadingButton} from \"./LoadingButton\";\r\n\r\n\r\n/**\r\n * A cancel button component that integrates with FormDialogContext.\r\n * Automatically closes the parent dialog when clicked.\r\n *\r\n * @example\r\n * // Basic usage\r\n * <FormCancelButton />\r\n *\r\n * @example\r\n * // With custom styling\r\n * <FormCancelButton\r\n * color=\"secondary\"\r\n * variant=\"text\"\r\n * children=\"Go Back\"\r\n * />\r\n */\r\nexport const FormCancelButton = memo(function (props?: FormButtonProps) {\r\n const {dialogState: {closeDialog}} = useFormButton();\r\n\r\n const handleOnClick = useCallback((e: MouseEvent<HTMLButtonElement>) => {\r\n props?.onClick?.(e);\r\n if (e.isDefaultPrevented()) return;\r\n closeDialog?.(e, \"escapeKeyDown\");\r\n }, [closeDialog, props?.onClick]);\r\n\r\n const buttonProps: LoadingButtonProps = {\r\n color: \"error\",\r\n children: \"CANCEL\",\r\n variant: \"outlined\",\r\n size: \"large\",\r\n ...props\r\n };\r\n\r\n return <LoadingButton {...buttonProps} onClick={handleOnClick}/>;\r\n});\r\n\r\nFormCancelButton.displayName = \"FormCancelButton\";\r\n\r\n","// src/components/buttons/FormSubmitButton.tsx\r\nimport {LoadingButton} from \"./LoadingButton\";\r\nimport {memo} from \"react\";\r\nimport {useFormButton} from \"../../hooks\";\r\nimport type {FormButtonProps} from \"../../types\";\r\nimport {disabledWhileLoading} from \"../../utils\";\r\n\r\n/**\r\n * A \"submit button\" for forms with loading state, attempt tracking, and form context awareness\r\n *\r\n * This component extends the LoadingButton with form-specific features:\r\n * - Automatically displays loading state during form submission\r\n * - Tracks and displays submission attempt count (optional)\r\n * - Supports maximum attempts with visual indicators\r\n * - Integrates with FormDialog context for form-wide disabled state\r\n *\r\n * The button automatically handles disabled states based on:\r\n * - Form submission status\r\n * - Form loading status\r\n * - Explicit-disabled prop\r\n * - Form-wide disabled state from FormDialogContext\r\n *\r\n *\r\n * @example\r\n * // With custom text and props\r\n * <FormSubmitButton\r\n * color=\"secondary\"\r\n * fullWidth\r\n * >\r\n * Save Changes\r\n * </FormSubmitButton>\r\n */\r\nexport const FormSubmitButton = memo(\r\n function (\r\n {\r\n children = \"Save\",\r\n ...props\r\n }: FormButtonProps) {\r\n const {formState, dialogState: {disabled: disabledForm}} = useFormButton();\r\n\r\n const disabled = disabledWhileLoading({formState, disabledForm})\r\n\r\n return (\r\n <LoadingButton\r\n loading={formState.isSubmitting || formState.isLoading}\r\n variant=\"contained\"\r\n type=\"submit\"\r\n size=\"large\"\r\n disabled={disabled}\r\n {...props}\r\n >\r\n {children}\r\n </LoadingButton>\r\n );\r\n });\r\n\r\nFormSubmitButton.displayName = \"FormSubmitButton\";\r\n","import {memo, useCallback, MouseEvent} from \"react\";\r\nimport {FormButtonProps, LoadingButtonProps} from \"../../types\";\r\nimport {LoadingButton} from \"./LoadingButton\";\r\nimport {useFormButton} from \"../../hooks\";\r\nimport {enabledWhileDirty} from \"../../utils\";\r\n\r\n/**\r\n * A reset button for forms with context awareness and persistence integration\r\n *\r\n * This component extends the Material UI Button with form-specific reset functionality:\r\n * - Automatically resets the form using React Hook Form's reset method\r\n * - Auto-disables when the form is pristine (no changes to reset)\r\n * - Respects the form's busy state (submitting/loading)\r\n * - Integrates with FormDialog context for form-wide disabled state\r\n *\r\n * The button automatically handles disabled states based on:\r\n * - Form submission/loading status\r\n * - Form dirty state (disabled when form is pristine)\r\n * - Explicit disabled prop\r\n * - Form-wide disabled state from FormDialogContext\r\n *\r\n * @example\r\n * // Customize appearance\r\n * <FormResetButton\r\n * color=\"secondary\"\r\n * variant=\"text\"\r\n * size=\"small\"\r\n * >\r\n * Clear Form\r\n * </FormResetButton>\r\n */\r\nexport const FormResetButton = memo(function (props?: FormButtonProps) {\r\n const {\r\n formState,\r\n dialogState: {disabled: disabledForm},\r\n formContext: {reset}\r\n } = useFormButton();\r\n\r\n const handleOnClick = useCallback((e: MouseEvent<HTMLButtonElement>) => {\r\n props?.onClick?.(e);\r\n if (!e.isDefaultPrevented()) reset();\r\n }, [props?.onClick, reset]);\r\n\r\n const disabled = enabledWhileDirty({formState, disabledForm});\r\n\r\n const buttonProps: LoadingButtonProps = {\r\n color: \"primary\",\r\n children: \"RESET\",\r\n variant: \"outlined\",\r\n type: \"reset\",\r\n size: \"large\",\r\n ...props,\r\n disabled\r\n };\r\n\r\n return (\r\n <LoadingButton {...buttonProps} onClick={handleOnClick}/>\r\n );\r\n});\r\n\r\nFormResetButton.displayName = \"FormResetButton\";\r\n","import { Grid } from \"@mui/material\";\nimport type { FC } from \"react\";\n\n/**\n * A utility component that creates flexible space within Grid layouts\n *\n * GridSpacer uses the flex property to create expandable space in a Grid container.\n * It helps with responsive layouts by pushing adjacent elements apart\n * without requiring fixed dimensions or explicit spacing values.\n *\n * The component applies `flex=\"1 0 0\"` which means:\n * - Flex grow: 1 (expands to fill available space)\n * - Flex shrink: 0 (doesn't shrink below base size)\n * - Flex basis: 0 (starts with zero width)\n *\n * This is particularly useful in action buttons layouts where you want\n * some buttons aligned left and others aligned right, with flexible\n * space between them that adapts to the container width.\n *\n * @example\n * // Basic usage in a button row\n * <Grid container>\n * <Grid>\n * <Button>Cancel</Button>\n * </Grid>\n * <GridSpacer />\n * <Grid>\n * <Button>Submit</Button>\n * </Grid>\n * </Grid>\n *\n * @example\n * // Used in FormDialogActions\n * <Grid container>\n * <Grid>\n * <FormCancelButton />\n * </Grid>\n * <GridSpacer />\n * <Grid>\n * <FormSubmitButton />\n * </Grid>\n * </Grid>\n */\nexport const GridSpacer: FC = () => <Grid sx={{ w: 0, flex: \"1 0 0\" }} />;\n","// src/components/FormDialogActions.tsx\nimport { Grid } from \"@mui/material\";\nimport type { FC } from \"react\";\nimport { FormCancelButton } from \"../buttons/FormCancelButton\";\nimport { FormResetButton } from \"../buttons/FormResetButton\";\nimport { FormSubmitButton } from \"../buttons/FormSubmitButton\";\nimport { GridSpacer } from \"../GridSpacer\";\nimport { applyDefaultFormDialogProps } from \"../../utils\";\nimport { FormDialogActionsProps } from \"../../types\";\n\n/**\n * Standard set of form dialog action buttons with consistent styling and behavior\n *\n * This component renders a consistent set of form action buttons (cancel, reset, submit)\n * in a responsive grid layout. It integrates with the form dialog context to handle\n * form state and provides built-in support for form attempt limiting.\n *\n * Key features:\n * - Standardized button placement and styling\n * - Support for maximum submission attempts via the maxAttempts prop\n * - Ability to selectively show/hide specific buttons\n * - Customization options for all buttons and the container grid\n * - Flexible display variants (icon, text, or both)\n * - Automatic integration with form dialog context\n *\n * By default, the component displays cancel, reset, and submit buttons with a spacer\n * between them for responsive alignment.\n *\n * @example\n * // Basic usage\n * <FormDialogActions />\n *\n * @example\n * // With maximum attempts and customized buttons\n * <FormDialogActions\n * submitProps={{ children: \"Save Changes\" }}\n * />\n *\n * @example\n * // Hiding buttons and customizing layout\n * <FormDialogActions\n * removeResetButton\n * removeCancelButton\n * gridProps={{ justifyContent: \"center\", mt: 3 }}\n * />\n */\nexport const FormDialogActions: FC<FormDialogActionsProps> = ({\n resetProps,\n submitProps,\n cancelProps,\n children,\n variant,\n removeCancelButton = false,\n removeResetButton = false,\n gridProps,\n}) => {\n // Apply default props to the buttons and grid container\n const { gridContainerProps, cancelButtonProps, resetButtonProps, submitButtonProps } = applyDefaultFormDialogProps({\n resetProps,\n submitProps,\n cancelProps,\n gridProps,\n variant,\n });\n\n return (\n <Grid container {...gridContainerProps}>\n {!removeCancelButton && (\n <Grid>\n <FormCancelButton {...cancelButtonProps} />\n </Grid>\n )}\n {!removeResetButton && (\n <Grid>\n <FormResetButton {...resetButtonProps} />\n </Grid>\n )}\n {children ?? <GridSpacer />}\n <Grid>\n <FormSubmitButton {...submitButtonProps} />\n </Grid>\n </Grid>\n );\n};\n"],"names":["_jsx","_jsxs","RefreshIcon","CloseIcon","_Fragment","SaveIcon","useMuiTheme"],"mappings":";;;;;;;AAKA;;AAEG;AACI,MAAM,cAAc,GAA4B,CAAC,EACtD,IAAI,GAA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QAAA,EACHA,GAAA,CAAC,eAAe,EAAA,EAAA,GAAK,gBAAgB,EAAA,CAAI,EAAA,CACpC,CACR,EACA,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAA,MAAA,GAAR,QAAQ,GAAIA,GAAA,CAAC,UAAU,EAAA,EAAA,CAAG,EAC3BA,GAAA,CAAC,IAAI,EAAA,EAAA,QAAA,EACHA,GAAA,CAAC,gBAAgB,EAAA,EAAA,GAAK,iBAAiB,EAAA,CAAI,EAAA,CACtC,CAAA,EAAA,CACF;AAEX;;;;"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/components/dialogs/BlackoutDialog.tsx","../src/components/dialogs/BaseDialog.tsx","../src/components/forms/PaperForm.tsx","../src/state/FormDialogContext.ts","../src/utils/applyDefaultFormDialogProps.tsx","../src/utils/ThemeBridge.tsx","../src/utils/formState.ts","../src/state/FormDialogProvider.tsx","../src/components/dialogs/FormDialog.tsx","../src/hooks/useFormDialog.ts","../src/hooks/useDialog.ts","../src/hooks/useFormButton.ts","../src/components/buttons/LoadingButton.tsx","../src/components/buttons/FormCancelButton.tsx","../src/components/buttons/FormSubmitButton.tsx","../src/components/buttons/FormResetButton.tsx","../src/components/GridSpacer.tsx","../src/components/dialogs/FormDialogActions.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["_jsx","_jsxs","RefreshIcon","CloseIcon","_Fragment","SaveIcon","useMuiTheme"],"mappings":";;;;;;;AAKA;;AAEG;AACI,MAAM,cAAc,GAA4B,CAAC,EACtD,IAAI,GAAG,KAAK,EACZ,QAAQ,GAAG,KAAK,EAChB,EAAE,GAAG,iBAAiB,EACtB,QAAQ,EACR,EAAE,EACF,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,OAAO,GAAG,QAAQ,GAAG,EAAE,GAAG,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,EAAE;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AI,EAAA,EAAA,QAAA,EACHA,GAAA,CAAC,gBAAgB,EAAA,EAAA,GAAK,iBAAiB,EAAA,CAAI,EAAA,CACtC,CAAA,EAAA,CACF;AAEX;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/dialogs/BlackoutDialog.tsx","../src/components/dialogs/BaseDialog.tsx","../src/components/forms/PaperForm.tsx","../src/state/FormDialogContext.ts","../src/utils/applyDefaultFormDialogProps.tsx","../src/utils/ThemeBridge.tsx","../src/utils/formState.ts","../src/state/FormDialogProvider.tsx","../src/components/dialogs/FormDialog.tsx","../src/hooks/useFormDialog.ts","../src/hooks/useDialog.ts","../src/hooks/useFormButton.ts","../src/components/buttons/LoadingButton.tsx","../src/components/buttons/FormCancelButton.tsx","../src/components/buttons/FormSubmitButton.tsx","../src/components/buttons/FormResetButton.tsx","../src/components/GridSpacer.tsx","../src/components/dialogs/FormDialogActions.tsx"],"sourcesContent":["// src/components/BlackoutDialog.tsx\nimport { Dialog } from \"@mui/material\";\nimport { type FC } from \"react\";\nimport { BlackoutDialogProps } from \"../../types\";\n\n/**\n * A component for rendering a modal dialog with an optional blackout effect.\n */\nexport const BlackoutDialog: FC<BlackoutDialogProps> = ({\n open = false,\n blackout = false,\n id = \"blackout-dialog\",\n children,\n sx,\n ...props\n}) => {\n const sxProps = blackout ? { ...sx, backgroundColor: \"black\" } : sx;\n\n /**\n * 1) When you open a dialog via a button, the button's ancestor gets aria-hidden, presumably so that\n * screen readers (SR) can't interact with it while the dialog is open.\n * 2) When you close the dialog, the aria-hidden is removed so that SRs can interact with the button again.\n * 3) Also, when closing, the focus is moved back on the opener button.\n *\n * Now comes the important part. You get Blocked aria-hidden on a <div> only when 3 happens before 2. In this case,\n * as the error message explains, we are trying to place focus somewhere where SRs don't have access, which is\n * a No No, and browsers correctly warn about it.\n *\n * This ordering is dependent on the closeAfterTransition prop on the MUI Dialog. When false and user triggers\n * dialog close, aria-hidden is removed (2) and then focus is placed on the opener button (3). Meaning there is no\n * issue. You can see it in action here. However, when it's true (the default), the order is the other way around,\n * and you get the warning.\n */\n return (\n <Dialog closeAfterTransition={false} open={open} id={id} sx={sxProps} {...props}>\n {children}\n </Dialog>\n );\n};\n","// src/components/BaseDialog.tsx\nimport type { FC } from \"react\";\nimport { DialogTitle, DialogContent, DialogActions } from \"@mui/material\";\nimport { BlackoutDialog } from \"./BlackoutDialog\";\nimport { BaseDialogProps } from \"../../types\";\n\n/**\n * A flexible dialog component with standardized structure and styling\n *\n * BaseDialog provides a consistent dialog layout with optional title, content,\n * and action sections. It builds upon the BlackoutDialog component, adding\n * structure through Material UI's dialog subcomponents.\n *\n * Key features:\n * - Consistent dialog structure with title, content, and actions areas\n * - Optional rendering of each section based on provided props\n * - Full control over styling and props for each section\n * - Standardized minimum width and spacing\n * - Support for a dedicated close button in the header\n *\n * The component automatically renders only the sections for which content\n * is provided, allowing for flexible dialog layouts while maintaining\n * consistent styling and behavior.\n *\n * @example\n * // Customized with section props\n * <BaseDialog\n * open={isOpen}\n * title=\"Advanced Settings\"\n * titleProps={{ sx: { backgroundColor: 'primary.main', color: 'white' } }}\n * contentProps={{ sx: { p: 3 } }}\n * actionsProps={{ sx: { justifyContent: 'space-between' } }}\n * actions={<SettingsDialogActions />}\n * >\n * <SettingsForm />\n * </BaseDialog>\n */\nexport const BaseDialog: FC<BaseDialogProps> = ({\n title = null,\n closeButton,\n titleProps,\n children = null,\n contentProps,\n id,\n actions = null,\n actionsProps,\n ...props\n}) => (\n <BlackoutDialog id={id} {...props}>\n {title && <DialogTitle {...titleProps}>{title}</DialogTitle>} {closeButton}\n {children && <DialogContent {...contentProps}>{children}</DialogContent>}\n {actions && <DialogActions {...actionsProps}>{actions}</DialogActions>}\n </BlackoutDialog>\n);\n","// src/components/PaperForm.tsx\r\nimport { Paper } from \"@mui/material\";\r\nimport { FormContainer, type FieldValues } from \"react-hook-form-mui\";\r\nimport {PaperFormProps} from \"../../types\";\r\n\r\n/**\r\n * A component that combines a Material UI Paper with a form container\r\n *\r\n * PaperForm wraps form content in an elevated paper surface, providing\r\n * visual distinction and a clean container for form elements. It integrates\r\n * seamlessly with react-hook-form by using FormContainer internally.\r\n *\r\n * This component is useful for creating standalone form surfaces outside of dialogs,\r\n * such as on pages or within cards. It supports all Paper props for styling\r\n * while handling form state management through FormContainer.\r\n *\r\n * @example\r\n * // Basic usage\r\n * <PaperForm\r\n * formProps={{\r\n * defaultValues: { name: \"\", email: \"\" },\r\n * onSuccess: handleSubmit\r\n * }}\r\n * elevation={3}\r\n * >\r\n * <TextFieldElement name=\"name\" label=\"Name\" />\r\n * <TextFieldElement name=\"email\" label=\"Email\" />\r\n * <Button type=\"submit\">Submit</Button>\r\n * </PaperForm>\r\n *\r\n * @example\r\n * // With custom styling and validation\r\n * <PaperForm\r\n * formProps={{\r\n * defaultValues: formDefaultValues,\r\n * onSuccess: handleSubmit,\r\n * onError: handleError,\r\n * }}\r\n * sx={{\r\n * padding: 3,\r\n * borderRadius: 2,\r\n * backgroundColor: 'background.paper',\r\n * }}\r\n * elevation={2}\r\n * >\r\n * <FormFields />\r\n * <FormDialogActions submitProps={{ children: \"Save Profile\" }} />\r\n * </PaperForm>\r\n *\r\n * @template T - The type of form values being handled\r\n */\r\nexport const PaperForm = <T extends FieldValues>({ children, formProps, ...paperProps }: PaperFormProps<T>) => (\r\n <Paper {...paperProps}>\r\n <FormContainer {...formProps}>\r\n {children}\r\n </FormContainer>\r\n </Paper>\r\n);\r\n","import { createContext } from \"react\";\r\nimport {FormDialogContextType} from \"../types\";\r\n\r\nexport const FormDialogContext = createContext<FormDialogContextType | undefined>(undefined);\r\n\r\nFormDialogContext.displayName = \"FormDialogContext\";\r\n","import { Fragment, ReactNode } from \"react\";\nimport {\n Close as CloseIcon,\n Refresh as RefreshIcon,\n Save as SaveIcon,\n} from \"@mui/icons-material\";\n\nimport { ApplyDefaultFormDialogPropsProps, FormButtonProps } from \"../types\";\n\nexport function applyDefaultFormDialogProps({\n resetProps,\n submitProps,\n gridProps,\n cancelProps,\n variant = \"iconText\",\n}: ApplyDefaultFormDialogPropsProps) {\n // Grid Container\n const gridContainerProps = {\n ...gridProps,\n sx: {\n justifyContent: \"space-between\",\n minWidth: 275,\n px: 1,\n pb: 1.5,\n columnGap: 1,\n width: \"100%\",\n ...gridProps?.sx,\n },\n };\n\n // Reset Button\n let resetChildren: ReactNode | undefined = undefined;\n if (variant == \"icon\") resetChildren = <RefreshIcon />;\n if (variant == \"iconText\")\n resetChildren = (\n <Fragment key=\"refreshIconText\">\n <RefreshIcon sx={{ mr: 1 }} /> RESET\n </Fragment>\n );\n const resetButtonProps = {\n ...(resetChildren ? { children: resetChildren } : {}),\n ...resetProps,\n };\n\n // Cancel Button\n let cancelChildren: ReactNode | undefined = undefined;\n if (variant == \"icon\") cancelChildren = <CloseIcon />;\n if (variant == \"iconText\")\n cancelChildren = (\n <Fragment key=\"cancelIconText\">\n <CloseIcon sx={{ mr: 1 }} /> CANCEL\n </Fragment>\n );\n const cancelButtonProps = {\n ...(cancelChildren ? { children: cancelChildren } : {}),\n ...cancelProps,\n };\n\n // Submit Button\n let submitChildren: Partial<FormButtonProps> = {};\n if (variant == \"icon\")\n submitChildren = { children: <></>, altIcon: <SaveIcon /> };\n if (variant == \"iconText\")\n submitChildren = { altIcon: <SaveIcon sx={{ mr: 1 }} /> };\n const submitButtonProps = {\n ...submitChildren,\n ...submitProps,\n };\n\n return {\n resetButtonProps,\n gridContainerProps,\n cancelButtonProps,\n submitButtonProps,\n };\n}\n","// src/utils/ThemeBridge.tsx\r\nimport { useTheme as useMuiTheme } from '@mui/material/styles';\r\nimport React, { createContext, useEffect, useState, PropsWithChildren } from 'react';\r\n\r\n// Create a context that will hold the parent theme\r\nconst ParentThemeContext = createContext<any>(null);\r\n\r\nexport const ThemeBridge: React.FC<PropsWithChildren> = ({ children }) => {\r\n const parentTheme = useMuiTheme();\r\n const [themeSnapshot, setThemeSnapshot] = useState(parentTheme);\r\n\r\n // Update the snapshot when the parent theme changes\r\n useEffect(() => {\r\n setThemeSnapshot(parentTheme);\r\n }, [parentTheme]);\r\n\r\n // Pass the parent theme to our components\r\n return (\r\n <ParentThemeContext.Provider value={themeSnapshot}>\r\n {children}\r\n </ParentThemeContext.Provider>\r\n );\r\n};\r\n","import {FieldValues, UseFormStateReturn} from \"react-hook-form-mui\";\r\n\r\nexport type DisabledWhileActionProps = {\r\n formState: UseFormStateReturn<FieldValues>,\r\n disabledForm: boolean,\r\n}\r\nexport const disabledWhileLoading = ({formState, disabledForm}: DisabledWhileActionProps): boolean => {\r\n return formState.isSubmitting || formState.isLoading || disabledForm;\r\n}\r\n\r\nexport const enabledWhileDirty = ({formState, disabledForm}: DisabledWhileActionProps): boolean => {\r\n return !formState.isDirty || disabledWhileLoading({formState, disabledForm})\r\n}\r\n","// src/components/dialogs/FormDialog/state/FormDialogProvider.tsx\r\nimport {useState, type FC } from \"react\";\r\nimport {FormDialogContext} from \"./FormDialogContext\";\r\nimport {ThemeBridge} from '../utils';\r\nimport {FormDialogProviderProps} from \"../types\";\r\n\r\n/**\r\n * Context provider component for form dialog state management\r\n *\r\n * FormDialogProvider creates and manages shared state for form dialogs,\r\n * allowing child components to access dialog state and controls through\r\n * the useFormDialog hook.\r\n *\r\n * This provider handles:\r\n * - Dialog open/close state\r\n * - Form-wide disabled state\r\n * - Dialog close handler passing\r\n * - Theme consistency via ThemeBridge\r\n *\r\n * Use this provider to wrap form components that need to share state\r\n * and disabled status, such as dialogs with multiple form fields\r\n * and action buttons that need to be coordinated.\r\n *\r\n * @example\r\n * // Basic usage wrapping a form\r\n * <FormDialogProvider>\r\n * <FormContainer onSuccess={handleSubmit}>\r\n * <TextFieldElement name=\"name\" />\r\n * <FormDialogActions />\r\n * </FormContainer>\r\n * </FormDialogProvider>\r\n *\r\n * @example\r\n * // With pre-configured dialog state\r\n * <FormDialogProvider open={isOpen} closeDialog={handleClose}>\r\n * <PaperForm formProps={formProps}>\r\n * <LoginFormFields />\r\n * <FormDialogActions submitProps={{ maxAttempts: 3 }} />\r\n * </PaperForm>\r\n * </FormDialogProvider>\r\n */\r\nexport const FormDialogProvider: FC<FormDialogProviderProps> = ({children, ...value}) => {\r\n const [disabled, setDisabled] = useState(false);\r\n\r\n return (\r\n <ThemeBridge>\r\n <FormDialogContext.Provider value={{...value, disabled, setDisabled}}>\r\n {children}\r\n </FormDialogContext.Provider>\r\n </ThemeBridge>\r\n );\r\n};","// src/components/FormDialog.tsx\r\nimport {useCallback, useMemo} from \"react\";\r\nimport {BaseDialog} from \"./BaseDialog\";\r\nimport {PaperForm} from \"../forms/PaperForm\";\r\nimport {type FieldValues} from \"react-hook-form-mui\";\r\nimport {IconButton, type PaperProps} from \"@mui/material\";\nimport type {SxProps, Theme} from \"@mui/material/styles\";\nimport {FormDialogProvider} from \"../../state/FormDialogProvider\";\r\nimport {Close as CloseIcon} from \"@mui/icons-material\";\r\nimport {FormDialogProps, BaseDialogProps} from \"../../types\";\r\n\r\n/**\r\n * A dialog component specialized for forms with integrated context providers\r\n *\r\n * FormDialog combines Material UI dialog functionality with React Hook Form,\r\n * creating a comprehensive solution for modal forms. It provides context\r\n * providers for form state management, dialog controls, and accessibility.\r\n *\r\n * Key features:\r\n * - Integrates React Hook Form with Material UI dialogs\r\n * - Provides form state management through FormProvider\r\n * - Establishes dialog context through FormDialogProvider\r\n * - Handles form submission and error states\r\n * - Supports loading states for form operations\r\n * - Maintains consistent styling and behavior\r\n *\r\n * Child components can access the form and dialog context through hooks:\r\n * - useFormContext() - Access form methods and state\r\n * - useFormState() - Access form validation state\r\n * - useFormDialog() - Access dialog controls and state\r\n *\r\n */\r\nexport const FormDialog = function <T extends FieldValues>(\n {formProps, children, open, onClose, ...dialogProps}: FormDialogProps<T>\n) {\n const mergeSx = (base: SxProps<Theme>, override?: SxProps<Theme>) => {\n if (!override) return base;\n return Array.isArray(override) ? [base, ...override] : [base, override];\n };\n\n const PaperComponent = useCallback(\n (props: PaperProps) => <PaperForm formProps={formProps} {...props} />,\n [formProps]\n );\n\n const baseDialogProps: BaseDialogProps = useMemo(() => {\n const actionsDefaultSx = {pt: 2.5};\n const actionsProps = {\n ...dialogProps?.actionsProps,\n sx: mergeSx(actionsDefaultSx, dialogProps?.actionsProps?.sx),\n };\n\n const contentDefaultSx = {\n display: \"flex\",\n justifyContent: \"center\",\n boxSizing: \"border-box\",\n maxHeight: `calc(100vh - 235px)`, // 235 estimate using H4 title & default FormDialogActions\n };\n const contentProps = {\n ...dialogProps?.contentProps,\n sx: mergeSx(contentDefaultSx, dialogProps?.contentProps?.sx),\n };\n\n return {\n ...dialogProps,\n open,\n actionsProps,\n contentProps,\n };\n }, [dialogProps, open]);\n\r\n return (\r\n <FormDialogProvider open={open} closeDialog={onClose}>\r\n <BaseDialog\r\n PaperComponent={PaperComponent}\r\n onClose={onClose}\r\n closeButton={\r\n <IconButton\r\n sx={{\r\n position: \"absolute\",\r\n top: 8,\r\n right: 8,\r\n }}\r\n onClick={(e) => onClose?.(e, 'escapeKeyDown')}\r\n >\r\n <CloseIcon fontSize=\"small\" aria-label=\"close-form-dialog\"/>\r\n </IconButton>\r\n }\r\n {...baseDialogProps}\r\n >\r\n {children}\r\n </BaseDialog>\r\n </FormDialogProvider>\r\n );\r\n};\r\n\r\nFormDialog.displayName = \"FormDialog\";\r\n","// src/components/dialogs/FormDialog/hooks/useFormDialog.ts\r\nimport { useContext } from \"react\";\r\nimport { FormDialogContext } from \"../state/FormDialogContext\";\r\n\r\n/**\r\n * Hook for accessing the FormDialog context values and functions\r\n *\r\n * This hook provides access to the form dialog state and controls managed by\r\n * the FormDialogProvider. It allows components to interact with the dialog state,\r\n * including open/close status and form-wide disabled state.\r\n *\r\n * The context provides:\r\n * - Dialog open state\r\n * - Close dialog function\r\n * - Form disabled state and setter function\r\n *\r\n * @throws Error if used outside a FormDialogProvider\r\n *\r\n * @example\r\n * // Using in a form button component\r\n * const FormButton = () => {\r\n * const { openDialog, disabled } = useFormDialog();\r\n * return (<Button\r\n * disabled={disabled}\r\n * onClick={() => openDialog()}\r\n * >\r\n * Cancel\r\n * </Button>);\r\n * }\r\n *\r\n * @returns FormDialogContextType object containing dialog state and controls\r\n */\r\nexport const useFormDialog = () => {\r\n const context = useContext(FormDialogContext);\r\n if (!context) {\r\n throw new Error(\"useFormDialog must be used within a FormDialogProvider\");\r\n }\r\n return context;\r\n};","import { useCallback, useState } from \"react\";\r\nimport {UseDialogProps, UseDialogReturn} from \"../types\";\r\n\r\n\r\n/**\r\n * Hook for managing dialog state and providing dialog control functions\r\n *\r\n * This hook provides a simple way to manage the dialog state and returns\r\n * functions to open and close the dialog, along with props that can be\r\n * spread onto a Material-UI Dialog component.\r\n *\r\n * Restores focus to the opening element, but only after the dialog has fully closed.\r\n *\r\n * @example\r\n * // Basic usage\r\n * const { openDialog, closeDialog, dialogProps } = useDialog();\r\n * return (<>\r\n * <Button onClick={openDialog}>Open Dialog</Button>\r\n * <BaseDialog {...dialogProps}>Dialog Content</BaseDialog>\r\n * </>);\r\n *\r\n * @example\r\n * // With initial configuration\r\n * const { dialogProps } = useDialog({ keepMounted: true});\r\n *\r\n * @param props - Optional configuration options\r\n */\r\nexport const useDialog = (props?: UseDialogProps): UseDialogReturn => {\r\n const [open, setOpen] = useState(!!props?.open);\r\n\r\n const closeDialog = useCallback(() => setOpen(false), []);\r\n const openDialog = useCallback(() => setOpen(true), []);\r\n\r\n return {\r\n closeDialog,\r\n openDialog,\r\n dialogProps: { open, onClose: closeDialog, keepMounted: !!props?.keepMounted }\r\n };\r\n};","import {useFormContext, useFormState} from \"react-hook-form-mui\";\r\nimport {useFormDialog} from \"./useFormDialog\";\r\n\r\nexport const useFormButton = () => {\r\n const formState = useFormState();\r\n const dialogState = useFormDialog();\r\n const formContext = useFormContext();\r\n return {\r\n formState,\r\n dialogState,\r\n formContext,\r\n }\r\n}","// src/components/buttons/LoadingButton.tsx\r\nimport {Button, CircularProgress, Box} from \"@mui/material\";\r\nimport {LoadingButtonProps} from \"../../types\";\r\n\r\n/**\r\n * A button component with built-in loading state visualization\r\n *\r\n * This component extends Material UI's Button with loading functionality:\r\n * - Displays a spinner when in loading state\r\n * - Shows an optional alternative icon when not loading\r\n * - Maintains consistent layout during state transitions\r\n * - Automatically sizes the spinner based on the current theme's font size\r\n *\r\n * The loading state can be controlled through the `loading` prop:\n * - When `loading` is true, the button shows a circular progress indicator\n * - When `loading` is false or undefined, the button shows its normal content\n *\r\n * @example\r\n * // Basic usage\r\n * <LoadingButton loading={isLoading}>\r\n * Submit\r\n * </LoadingButton>\r\n *\r\n * @example\r\n * // With alternative icon\r\n * <LoadingButton\r\n * loading={!isProcessing}\r\n * altIcon={<SaveIcon />}\r\n * >\r\n * Save\r\n * </LoadingButton>\r\n *\r\n * @example\r\n * // With custom styling\r\n * <LoadingButton\r\n * loading={isSubmitting}\r\n * variant=\"contained\"\r\n * color=\"primary\"\r\n * fullWidth\r\n * >\r\n * Process Payment\r\n * </LoadingButton>\r\n */\r\nexport const LoadingButton = ({children, loading = false, altIcon, loadingIconProps, ...props}: LoadingButtonProps) => {\r\n return (\r\n <Button {...props}>\r\n {!loading ? altIcon : (\r\n <Box\r\n sx={{\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n width: \"100%\",\r\n height: \"auto\",\r\n mr: 1,\r\n }}>\r\n <CircularProgress {...loadingIconProps}/>\r\n </Box>\r\n )}\r\n {children}\r\n </Button>\r\n );\r\n};\n","import {memo, MouseEvent, useCallback} from \"react\";\r\nimport {useFormButton} from \"../../hooks\";\r\nimport {FormButtonProps, LoadingButtonProps} from \"../../types\";\r\nimport {LoadingButton} from \"./LoadingButton\";\r\n\r\n\r\n/**\r\n * A cancel button component that integrates with FormDialogContext.\r\n * Automatically closes the parent dialog when clicked.\r\n *\r\n * @example\r\n * // Basic usage\r\n * <FormCancelButton />\r\n *\r\n * @example\r\n * // With custom styling\r\n * <FormCancelButton\r\n * color=\"secondary\"\r\n * variant=\"text\"\r\n * children=\"Go Back\"\r\n * />\r\n */\r\nexport const FormCancelButton = memo(function (props?: FormButtonProps) {\r\n const {dialogState: {closeDialog}} = useFormButton();\r\n\r\n const handleOnClick = useCallback((e: MouseEvent<HTMLButtonElement>) => {\r\n props?.onClick?.(e);\r\n if (e.isDefaultPrevented()) return;\r\n closeDialog?.(e, \"escapeKeyDown\");\r\n }, [closeDialog, props?.onClick]);\r\n\r\n const buttonProps: LoadingButtonProps = {\r\n color: \"error\",\r\n children: \"CANCEL\",\r\n variant: \"outlined\",\r\n size: \"large\",\r\n ...props\r\n };\r\n\r\n return <LoadingButton {...buttonProps} onClick={handleOnClick}/>;\r\n});\r\n\r\nFormCancelButton.displayName = \"FormCancelButton\";\r\n\r\n","// src/components/buttons/FormSubmitButton.tsx\r\nimport {LoadingButton} from \"./LoadingButton\";\r\nimport {memo} from \"react\";\r\nimport {useFormButton} from \"../../hooks\";\r\nimport type {FormButtonProps} from \"../../types\";\r\nimport {disabledWhileLoading} from \"../../utils\";\r\n\r\n/**\r\n * A \"submit button\" for forms with loading state, attempt tracking, and form context awareness\r\n *\r\n * This component extends the LoadingButton with form-specific features:\r\n * - Automatically displays loading state during form submission\r\n * - Tracks and displays submission attempt count (optional)\r\n * - Supports maximum attempts with visual indicators\r\n * - Integrates with FormDialog context for form-wide disabled state\r\n *\r\n * The button automatically handles disabled states based on:\r\n * - Form submission status\r\n * - Form loading status\r\n * - Explicit-disabled prop\r\n * - Form-wide disabled state from FormDialogContext\r\n *\r\n *\r\n * @example\r\n * // With custom text and props\r\n * <FormSubmitButton\r\n * color=\"secondary\"\r\n * fullWidth\r\n * >\r\n * Save Changes\r\n * </FormSubmitButton>\r\n */\r\nexport const FormSubmitButton = memo(\r\n function (\r\n {\r\n children = \"Save\",\r\n ...props\r\n }: FormButtonProps) {\r\n const {formState, dialogState: {disabled: disabledForm}} = useFormButton();\r\n\r\n const disabled = disabledWhileLoading({formState, disabledForm})\r\n\r\n return (\r\n <LoadingButton\r\n loading={formState.isSubmitting || formState.isLoading}\r\n variant=\"contained\"\r\n type=\"submit\"\r\n size=\"large\"\r\n disabled={disabled}\r\n {...props}\r\n >\r\n {children}\r\n </LoadingButton>\r\n );\r\n });\r\n\r\nFormSubmitButton.displayName = \"FormSubmitButton\";\r\n","import {memo, useCallback, MouseEvent} from \"react\";\r\nimport {FormButtonProps, LoadingButtonProps} from \"../../types\";\r\nimport {LoadingButton} from \"./LoadingButton\";\r\nimport {useFormButton} from \"../../hooks\";\r\nimport {enabledWhileDirty} from \"../../utils\";\r\n\r\n/**\r\n * A reset button for forms with context awareness and persistence integration\r\n *\r\n * This component extends the Material UI Button with form-specific reset functionality:\r\n * - Automatically resets the form using React Hook Form's reset method\r\n * - Auto-disables when the form is pristine (no changes to reset)\r\n * - Respects the form's busy state (submitting/loading)\r\n * - Integrates with FormDialog context for form-wide disabled state\r\n *\r\n * The button automatically handles disabled states based on:\r\n * - Form submission/loading status\r\n * - Form dirty state (disabled when form is pristine)\r\n * - Explicit disabled prop\r\n * - Form-wide disabled state from FormDialogContext\r\n *\r\n * @example\r\n * // Customize appearance\r\n * <FormResetButton\r\n * color=\"secondary\"\r\n * variant=\"text\"\r\n * size=\"small\"\r\n * >\r\n * Clear Form\r\n * </FormResetButton>\r\n */\r\nexport const FormResetButton = memo(function (props?: FormButtonProps) {\r\n const {\r\n formState,\r\n dialogState: {disabled: disabledForm},\r\n formContext: {reset}\r\n } = useFormButton();\r\n\r\n const handleOnClick = useCallback((e: MouseEvent<HTMLButtonElement>) => {\r\n props?.onClick?.(e);\r\n if (!e.isDefaultPrevented()) reset();\r\n }, [props?.onClick, reset]);\r\n\r\n const disabled = enabledWhileDirty({formState, disabledForm});\r\n\r\n const buttonProps: LoadingButtonProps = {\r\n color: \"primary\",\r\n children: \"RESET\",\r\n variant: \"outlined\",\r\n type: \"reset\",\r\n size: \"large\",\r\n ...props,\r\n disabled\r\n };\r\n\r\n return (\r\n <LoadingButton {...buttonProps} onClick={handleOnClick}/>\r\n );\r\n});\r\n\r\nFormResetButton.displayName = \"FormResetButton\";\r\n","import { Grid } from \"@mui/material\";\nimport type { FC } from \"react\";\n\n/**\n * A utility component that creates flexible space within Grid layouts\n *\n * GridSpacer uses the flex property to create expandable space in a Grid container.\n * It helps with responsive layouts by pushing adjacent elements apart\n * without requiring fixed dimensions or explicit spacing values.\n *\n * The component applies `flex=\"1 0 0\"` which means:\n * - Flex grow: 1 (expands to fill available space)\n * - Flex shrink: 0 (doesn't shrink below base size)\n * - Flex basis: 0 (starts with zero width)\n *\n * This is particularly useful in action buttons layouts where you want\n * some buttons aligned left and others aligned right, with flexible\n * space between them that adapts to the container width.\n *\n * @example\n * // Basic usage in a button row\n * <Grid container>\n * <Grid>\n * <Button>Cancel</Button>\n * </Grid>\n * <GridSpacer />\n * <Grid>\n * <Button>Submit</Button>\n * </Grid>\n * </Grid>\n *\n * @example\n * // Used in FormDialogActions\n * <Grid container>\n * <Grid>\n * <FormCancelButton />\n * </Grid>\n * <GridSpacer />\n * <Grid>\n * <FormSubmitButton />\n * </Grid>\n * </Grid>\n */\nexport const GridSpacer: FC = () => <Grid sx={{ w: 0, flex: \"1 0 0\" }} />;\n","// src/components/FormDialogActions.tsx\nimport { Grid } from \"@mui/material\";\nimport type { FC } from \"react\";\nimport { FormCancelButton } from \"../buttons/FormCancelButton\";\nimport { FormResetButton } from \"../buttons/FormResetButton\";\nimport { FormSubmitButton } from \"../buttons/FormSubmitButton\";\nimport { GridSpacer } from \"../GridSpacer\";\nimport { applyDefaultFormDialogProps } from \"../../utils\";\nimport { FormDialogActionsProps } from \"../../types\";\n\n/**\n * Standard set of form dialog action buttons with consistent styling and behavior\n *\n * This component renders a consistent set of form action buttons (cancel, reset, submit)\n * in a responsive grid layout. It integrates with the form dialog context to handle\n * form state and provides built-in support for form attempt limiting.\n *\n * Key features:\n * - Standardized button placement and styling\n * - Support for maximum submission attempts via the maxAttempts prop\n * - Ability to selectively show/hide specific buttons\n * - Customization options for all buttons and the container grid\n * - Flexible display variants (icon, text, or both)\n * - Automatic integration with form dialog context\n *\n * By default, the component displays cancel, reset, and submit buttons with a spacer\n * between them for responsive alignment.\n *\n * @example\n * // Basic usage\n * <FormDialogActions />\n *\n * @example\n * // With maximum attempts and customized buttons\n * <FormDialogActions\n * submitProps={{ children: \"Save Changes\" }}\n * />\n *\n * @example\n * // Hiding buttons and customizing layout\n * <FormDialogActions\n * removeResetButton\n * removeCancelButton\n * gridProps={{ justifyContent: \"center\", mt: 3 }}\n * />\n */\nexport const FormDialogActions: FC<FormDialogActionsProps> = ({\n resetProps,\n submitProps,\n cancelProps,\n children,\n variant,\n removeCancelButton = false,\n removeResetButton = false,\n gridProps,\n}) => {\n // Apply default props to the buttons and grid container\n const { gridContainerProps, cancelButtonProps, resetButtonProps, submitButtonProps } = applyDefaultFormDialogProps({\n resetProps,\n submitProps,\n cancelProps,\n gridProps,\n variant,\n });\n\n return (\n <Grid container {...gridContainerProps}>\n {!removeCancelButton && (\n <Grid>\n <FormCancelButton {...cancelButtonProps} />\n </Grid>\n )}\n {!removeResetButton && (\n <Grid>\n <FormResetButton {...resetButtonProps} />\n </Grid>\n )}\n {children ?? <GridSpacer />}\n <Grid>\n <FormSubmitButton {...submitButtonProps} />\n </Grid>\n </Grid>\n );\n};\n"],"names":["_jsx","_jsxs","RefreshIcon","CloseIcon","_Fragment","SaveIcon","useMuiTheme"],"mappings":";;;;;;;AAKA;;AAEG;AACI,MAAM,cAAc,GAA4B,CAAC,EACtD,IAAI,GAAG,KAAK,EACZ,QAAQ,GAAG,KAAK,EAChB,EAAE,GAAG,iBAAiB,EACtB,QAAQ,EACR,EAAE,EACF,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,OAAO,GAAG,QAAQ,GAAG,EAAE,GAAG,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,EAAE;AAEnE;;;;;;;;;;;;;;AAcG;IACH,QACEA,GAAA,CAAC,MAAM,EAAA,EAAC,oBAAoB,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAA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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chris-c-brine/form-dialog",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Easy MUI Form Dialogs with react-hook-form!",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"LICENSE"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"
|
|
13
|
+
"clean": "node --eval \"require('fs').rmSync('./dist', {recursive: true, force: true})\"",
|
|
14
|
+
"build": "npm run clean && rollup -c",
|
|
14
15
|
"prepare": "npm run build"
|
|
15
16
|
},
|
|
16
17
|
"keywords": [
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type FC } from "react";
|
|
2
|
-
import { AutoGridProps } from "../types";
|
|
3
|
-
/**
|
|
4
|
-
* A responsive grid component that automatically arranges children in equal columns
|
|
5
|
-
*
|
|
6
|
-
* AutoGrid simplifies the creation of grid layouts by automatically calculating
|
|
7
|
-
* column sizes based on the provided `columnCount`. It's particularly useful
|
|
8
|
-
* for form layouts where fields need to be arranged in a consistent grid pattern.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* // Basic usage with 2 columns
|
|
12
|
-
* <AutoGrid
|
|
13
|
-
* columnCount={2}
|
|
14
|
-
* components={[
|
|
15
|
-
* <TextFieldElement key="name" label="Name" />,
|
|
16
|
-
* <TextFieldElement key="email" label="Email" />
|
|
17
|
-
* ]}
|
|
18
|
-
* />
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* // With spacing and custom props
|
|
22
|
-
* <AutoGrid
|
|
23
|
-
* columnCount={3}
|
|
24
|
-
* rowSpacing={2}
|
|
25
|
-
* columnSpacing={3}
|
|
26
|
-
* components={[
|
|
27
|
-
* <TextFieldElement key="first" label="First Name" />,
|
|
28
|
-
* <TextFieldElement key="middle" label="Middle Name" />,
|
|
29
|
-
* <TextFieldElement key="last" label="Last Name" />
|
|
30
|
-
* ]}
|
|
31
|
-
* />
|
|
32
|
-
*
|
|
33
|
-
* @note Be careful of transferring keys of children to the wrapper Grid.
|
|
34
|
-
* If not done correctly, it will cause React to discard the old tree and remount children components.
|
|
35
|
-
*/
|
|
36
|
-
export declare const AutoGrid: FC<AutoGridProps>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { FC, ReactNode } from "react";
|
|
2
|
-
import { type BlackoutDialogProps } from "./BlackoutDialog";
|
|
3
|
-
import type { DialogContentProps, DialogTitleProps, DialogActionsProps } from "@mui/material";
|
|
4
|
-
export type BaseDialogProps = Omit<BlackoutDialogProps, "children" | "title" | "content"> & {
|
|
5
|
-
title?: ReactNode;
|
|
6
|
-
titleProps?: DialogTitleProps;
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
contentProps?: DialogContentProps;
|
|
9
|
-
actions?: ReactNode;
|
|
10
|
-
actionsProps?: DialogActionsProps;
|
|
11
|
-
closeButton?: ReactNode;
|
|
12
|
-
};
|
|
13
|
-
export declare const BaseDialog: FC<BaseDialogProps>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type DialogProps } from "@mui/material";
|
|
2
|
-
import { type FC, type PropsWithChildren } from "react";
|
|
3
|
-
export type BlackoutDialogProps = DialogProps & Partial<PropsWithChildren> & {
|
|
4
|
-
/**
|
|
5
|
-
* An optional unique string identifier
|
|
6
|
-
* @default 'blackout-dialog'
|
|
7
|
-
*/
|
|
8
|
-
id?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Whether the dialog is currently visible.
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
open: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Whether to apply a black overlay behind the dialog.
|
|
16
|
-
* @default false
|
|
17
|
-
*/
|
|
18
|
-
blackout?: boolean;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* A component for rendering a modal dialog with an optional blackout effect.
|
|
22
|
-
*/
|
|
23
|
-
export declare const BlackoutDialog: FC<BlackoutDialogProps>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type BaseDialogProps } from "./BaseDialog";
|
|
2
|
-
import { type FieldValues, type FormContainerProps } from "react-hook-form-mui";
|
|
3
|
-
/**
|
|
4
|
-
* Props for the FormDialog component. Inherits from BaseDialogProps and adds formProps.
|
|
5
|
-
* @param formProps - Props for the FormContainer component from react-hook-form-mui.
|
|
6
|
-
* @returns The FormDialog component.
|
|
7
|
-
*/
|
|
8
|
-
export type FormDialogProps<T extends FieldValues> = Omit<BaseDialogProps, "PaperComponent"> & {
|
|
9
|
-
formProps: FormContainerProps<T>;
|
|
10
|
-
};
|
|
11
|
-
export declare const FormDialog: <T extends FieldValues>({ formProps, children, open, onClose, ...dialogProps }: FormDialogProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { GridProps } from "@mui/material";
|
|
2
|
-
import type { FC, PropsWithChildren } from "react";
|
|
3
|
-
import { type FormCancelButtonProps } from "./buttons/FormCancelButton";
|
|
4
|
-
import { type FormResetButtonProps } from "./buttons/FormResetButton";
|
|
5
|
-
import { FormSubmitButtonProps } from "./buttons/FormSubmitButton";
|
|
6
|
-
export type FormDialogActionsProps = PropsWithChildren & {
|
|
7
|
-
cancelProps?: FormCancelButtonProps;
|
|
8
|
-
resetProps?: FormResetButtonProps;
|
|
9
|
-
submitProps?: FormSubmitButtonProps;
|
|
10
|
-
variant?: "icon" | "text" | "iconText";
|
|
11
|
-
removeCancelButton?: boolean;
|
|
12
|
-
removeResetButton?: boolean;
|
|
13
|
-
gridProps?: GridProps;
|
|
14
|
-
};
|
|
15
|
-
export declare const FormDialogActions: FC<FormDialogActionsProps>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type PaperProps } from "@mui/material";
|
|
2
|
-
import { type FieldValues, type FormContainerProps } from "react-hook-form-mui";
|
|
3
|
-
export type PaperFormProps<T extends FieldValues> = PaperProps & {
|
|
4
|
-
formProps: FormContainerProps<T>;
|
|
5
|
-
};
|
|
6
|
-
export declare const PaperForm: <T extends FieldValues>({ children, formProps, ...paperProps }: PaperFormProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { PersistFormProps } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* A component that enables form state persistence across sessions
|
|
4
|
-
*
|
|
5
|
-
* PersistForm is a lightweight wrapper that connects a form to persistent storage,
|
|
6
|
-
* allowing form values to be preserved when navigating away and returning. It wraps
|
|
7
|
-
* the usePersistedForm hook in a convenient component API.
|
|
8
|
-
*
|
|
9
|
-
* Key features:
|
|
10
|
-
* - Persists form values during navigation or page reloads
|
|
11
|
-
* - Automatically restores saved values when the form is rendered
|
|
12
|
-
* - Only saves changed fields, not the entire form state
|
|
13
|
-
* - Automatically clears storage when form values match defaults
|
|
14
|
-
* - Works with any React Hook Form based forms
|
|
15
|
-
*
|
|
16
|
-
* Note: This component must be used inside a FormProvider from react-hook-form
|
|
17
|
-
* and should be within a FormDialogProvider for full functionality.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Basic usage
|
|
21
|
-
* const MyForm = () => {
|
|
22
|
-
* const methods = useForm({ defaultValues: { name: '' } });
|
|
23
|
-
*
|
|
24
|
-
* return (<FormProvider {...methods}>
|
|
25
|
-
* <PersistForm formName="user-profile">
|
|
26
|
-
* <TextFieldElement name="name" label="Name" />
|
|
27
|
-
* <FormSubmitButton>Save</FormSubmitButton>
|
|
28
|
-
* </PersistForm>
|
|
29
|
-
* </FormProvider>);
|
|
30
|
-
* }
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* // Usage within a dialog
|
|
34
|
-
* <FormDialog
|
|
35
|
-
* formProps={{ defaultValues: defaultValues }}
|
|
36
|
-
* title="Edit Profile"
|
|
37
|
-
* >
|
|
38
|
-
* <PersistForm formName="edit-profile-dialog">
|
|
39
|
-
* <ProfileFormFields />
|
|
40
|
-
* </PersistForm>
|
|
41
|
-
* </FormDialog>
|
|
42
|
-
*/
|
|
43
|
-
export declare const PersistForm: import("react").NamedExoticComponent<PersistFormProps>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { UseMaxAttemptProps } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* Hook that monitors form submission attempts and disables the form when a limit is reached.
|
|
4
|
-
*
|
|
5
|
-
* It performs two main functions:
|
|
6
|
-
* 1. Monitors `formState.submitCount` and calls `setDisabled(true)` from the dialog context
|
|
7
|
-
* once it reaches or exceeds the specified `maxAttempts`.
|
|
8
|
-
* 2. When the dialog context enters a `disabled` state, it automatically resets form fields
|
|
9
|
-
* that have errors or are dirty to ensure a clean state for the user.
|
|
10
|
-
*
|
|
11
|
-
* @param props - UseMaxAttemptProps
|
|
12
|
-
*/
|
|
13
|
-
export declare const useMaxAttempts: ({ maxAttempts }: UseMaxAttemptProps) => void;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FieldValues } from "react-hook-form-mui";
|
|
2
|
-
import { PersistedFormProviderProps } from "../types";
|
|
3
|
-
/**
|
|
4
|
-
* Hook that enables form state persistence across sessions
|
|
5
|
-
*
|
|
6
|
-
* This hook connects a form to persistent storage (e.g., sessionStorage)
|
|
7
|
-
* allowing form values to be preserved when navigating away and returning.
|
|
8
|
-
* It works by watching form changes and syncing with a zustand store.
|
|
9
|
-
*
|
|
10
|
-
* Key features:
|
|
11
|
-
* - Persists form values during navigation or page reloads
|
|
12
|
-
* - Automatically restores saved values when form is rendered
|
|
13
|
-
* - Debounced updates to avoid excessive storage operations
|
|
14
|
-
* - Only saves changed fields, not the entire form state
|
|
15
|
-
* - Automatically clears storage when form values match defaults
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
export declare const usePersistForm: <T extends FieldValues>({ formName, formContext }: PersistedFormProviderProps<T>) => void;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export interface PersistedFormProviderProps {
|
|
2
|
-
/**
|
|
3
|
-
* A unique key for the form
|
|
4
|
-
*/
|
|
5
|
-
formName: string | undefined;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Hook that enables form state persistence across sessions
|
|
9
|
-
*
|
|
10
|
-
* This hook connects a form to persistent storage (e.g., sessionStorage)
|
|
11
|
-
* allowing form values to be preserved when navigating away and returning.
|
|
12
|
-
* It works by watching form changes and syncing with a zustand store.
|
|
13
|
-
*
|
|
14
|
-
* Key features:
|
|
15
|
-
* - Persists form values during navigation or page reloads
|
|
16
|
-
* - Automatically restores saved values when form is rendered
|
|
17
|
-
* - Debounced updates to avoid excessive storage operations
|
|
18
|
-
* - Only saves changed fields, not the entire form state
|
|
19
|
-
* - Automatically clears storage when form values match defaults
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // In a form component:
|
|
23
|
-
* const MyPersistedForm = () => {
|
|
24
|
-
* const formMethods = useForm({ defaultValues: { name: '' } });
|
|
25
|
-
* // Connect the form to persistence
|
|
26
|
-
* usePersistedForm({ formName: 'user-registration' });
|
|
27
|
-
*
|
|
28
|
-
* return (<FormProvider {...formMethods}>
|
|
29
|
-
* <TextFieldElement name="name" label="Name" />
|
|
30
|
-
* </FormProvider>);
|
|
31
|
-
* }
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* // For convenience, use with the PersistForm wrapper component:
|
|
35
|
-
* <PersistForm formName="user-profile">
|
|
36
|
-
* <ProfileFormFields />
|
|
37
|
-
* </PersistForm>
|
|
38
|
-
*
|
|
39
|
-
* @param props - Configuration options
|
|
40
|
-
*/
|
|
41
|
-
export declare const usePersistedForm: ({ formName }: PersistedFormProviderProps) => void;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { FieldValues } from "react-hook-form";
|
|
2
|
-
import { FormStore } from "../types";
|
|
3
|
-
/**
|
|
4
|
-
* Factory function to create a form store with a custom storage name.
|
|
5
|
-
*
|
|
6
|
-
* @param storeName - Unique name for sessionStorage/localStorage key.
|
|
7
|
-
* @returns Zustand store with form data.
|
|
8
|
-
*/
|
|
9
|
-
export declare const createFormChangeStore: (storeName: string) => import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<FormStore<FieldValues>>, "persist"> & {
|
|
10
|
-
persist: {
|
|
11
|
-
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<FormStore<FieldValues>, unknown>>) => void;
|
|
12
|
-
clearStorage: () => void;
|
|
13
|
-
rehydrate: () => Promise<void> | void;
|
|
14
|
-
hasHydrated: () => boolean;
|
|
15
|
-
onHydrate: (fn: (state: FormStore<FieldValues>) => void) => () => void;
|
|
16
|
-
onFinishHydration: (fn: (state: FormStore<FieldValues>) => void) => () => void;
|
|
17
|
-
getOptions: () => Partial<import("zustand/middleware").PersistOptions<FormStore<FieldValues>, unknown>>;
|
|
18
|
-
};
|
|
19
|
-
}>;
|
|
20
|
-
export default createFormChangeStore;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compares two objects for deep equality.
|
|
3
|
-
*
|
|
4
|
-
* This function uses lodash's `isEqualWith` function for deep comparison,
|
|
5
|
-
* with additional logic for handling numbers and empty values.
|
|
6
|
-
*
|
|
7
|
-
* @param a The first object to compare.
|
|
8
|
-
* @param b The second object to compare.
|
|
9
|
-
* @param equalEmpty (default: false) Whether to consider empty values (null, undefined, empty arrays or objects) equal.
|
|
10
|
-
* @returns True if the objects are deeply equal, false otherwise.
|
|
11
|
-
*/
|
|
12
|
-
declare const deepCompare: {
|
|
13
|
-
<T>(a: T, b: T, equalEmpty?: boolean): boolean;
|
|
14
|
-
displayName: string;
|
|
15
|
-
};
|
|
16
|
-
export default deepCompare;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A utility type that simplifies complex nested types for better IDE display.
|
|
3
|
-
* https://www.totaltypescript.com/concepts/the-prettify-helper
|
|
4
|
-
*
|
|
5
|
-
* WARNING: This utility strips TSDoc comments from the original type properties.
|
|
6
|
-
* Always document the final exported type rather than properties within the type being prettified.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* // Document the final type, not properties inside
|
|
10
|
-
* /** Description of MyType *\/
|
|
11
|
-
* export type MyType = Prettify<ComplexType>;
|
|
12
|
-
*/
|
|
13
|
-
export type Prettify<T> = {
|
|
14
|
-
[K in keyof T]: T[K];
|
|
15
|
-
} & {};
|