@saas-ui/modals 1.5.5 → 2.0.0-next.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saas-ui/modals",
3
- "version": "1.5.5",
3
+ "version": "2.0.0-next.0",
4
4
  "description": "A modal manager for Chakra UI",
5
5
  "source": "src/index.ts",
6
6
  "exports": {
@@ -17,7 +17,7 @@
17
17
  "types": "./dist/index.d.ts",
18
18
  "scripts": {
19
19
  "clean": "rimraf dist",
20
- "build": "yarn clean && cross-env NODE_ENV=production microbundle --tsconfig ./tsconfig.json --jsx React.createElement --jsxFragment React.Fragment -f cjs,modern --compress",
20
+ "build": "tsup src/index.ts --config tsup.config.ts",
21
21
  "lint": "eslint src --ext .ts,.tsx,.js,.jsx --config ../../.eslintrc.js",
22
22
  "lint:staged": "lint-staged --allow-empty --config ../../lint-staged.config.js",
23
23
  "typecheck": "tsc --noEmit"
@@ -57,14 +57,16 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@chakra-ui/utils": "^2.0.14",
60
- "@saas-ui/button": "1.4.0",
61
- "@saas-ui/forms": "1.5.3",
62
- "@saas-ui/menu": "1.4.1"
60
+ "@saas-ui/forms": "2.0.0-next.0",
61
+ "@saas-ui/hooks": "2.0.0-next.0",
62
+ "@saas-ui/react-utils": "2.0.0-next.0"
63
63
  },
64
64
  "peerDependencies": {
65
- "@chakra-ui/react": ">=2.4.6",
66
- "@chakra-ui/system": ">=2.3.8",
67
- "framer-motion": ">=5.5.0",
68
- "react": ">=18.0.0"
65
+ "@chakra-ui/react": ">=2.4.9",
66
+ "@emotion/react": ">=11.0.0",
67
+ "@emotion/styled": ">=11.0.0",
68
+ "framer-motion": ">=6.0.0",
69
+ "react": ">=18.0.0",
70
+ "react-dom": ">=18.0.0"
69
71
  }
70
72
  }
package/src/dialog.tsx CHANGED
@@ -8,14 +8,11 @@ import {
8
8
  AlertDialogContent,
9
9
  AlertDialogOverlay,
10
10
  AlertDialogProps,
11
- } from '@chakra-ui/react'
12
-
13
- import {
14
11
  ButtonGroup,
15
12
  ButtonGroupProps,
16
13
  Button,
17
14
  ButtonProps,
18
- } from '@saas-ui/button'
15
+ } from '@chakra-ui/react'
19
16
 
20
17
  export interface ConfirmDialogProps
21
18
  extends Omit<AlertDialogProps, 'leastDestructiveRef'> {
@@ -116,7 +113,7 @@ export const ConfirmDialog: React.FC<ConfirmDialogProps> = (props) => {
116
113
  closeOnCancel && onClose()
117
114
  }}
118
115
  >
119
- {cancelProps?.children || cancelProps?.label || cancelLabel}
116
+ {cancelProps?.children || cancelLabel}
120
117
  </Button>
121
118
  <Button
122
119
  ref={confirmRef}
@@ -127,7 +124,7 @@ export const ConfirmDialog: React.FC<ConfirmDialogProps> = (props) => {
127
124
  closeOnConfirm && onClose()
128
125
  }}
129
126
  >
130
- {confirmProps?.children || confirmProps?.label || confirmLabel}
127
+ {confirmProps?.children || confirmLabel}
131
128
  </Button>
132
129
  </ButtonGroup>
133
130
  </AlertDialogFooter>
package/src/form.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react'
2
2
 
3
3
  import { ModalBody, ModalFooter, Button, forwardRef } from '@chakra-ui/react'
4
- import { runIfFn } from '@chakra-ui/utils'
4
+ import { runIfFn } from '@saas-ui/react-utils'
5
5
 
6
6
  import {
7
7
  Form,
@@ -10,17 +10,20 @@ import {
10
10
  FormProps,
11
11
  FieldValues,
12
12
  FieldResolver,
13
- UseFormReturn,
14
13
  } from '@saas-ui/forms'
15
14
 
16
15
  import { BaseModal, BaseModalProps } from './modal'
17
16
 
18
- export interface FormDialogProps<TFieldValues extends FieldValues = FieldValues>
19
- extends Omit<BaseModalProps, 'children'>,
17
+ export interface FormDialogProps<
18
+ TFieldValues extends FieldValues = FieldValues,
19
+ TContext extends object = object
20
+ > extends Omit<BaseModalProps, 'children'>,
20
21
  Pick<
21
- FormProps<TFieldValues>,
22
+ FormProps<TFieldValues, TContext>,
22
23
  | 'schema'
23
24
  | 'defaultValues'
25
+ | 'values'
26
+ | 'context'
24
27
  | 'onChange'
25
28
  | 'onSubmit'
26
29
  | 'onError'
@@ -59,9 +62,12 @@ export interface FormDialogProps<TFieldValues extends FieldValues = FieldValues>
59
62
  }
60
63
 
61
64
  export const FormDialog = forwardRef(
62
- <TFieldValues extends FieldValues = FieldValues>(
63
- props: FormDialogProps<TFieldValues>,
64
- ref: React.ForwardedRef<UseFormReturn<TFieldValues>>
65
+ <
66
+ TFieldValues extends FieldValues = FieldValues,
67
+ TContext extends object = object
68
+ >(
69
+ props: FormDialogProps<TFieldValues, TContext>,
70
+ ref: React.ForwardedRef<HTMLFormElement>
65
71
  ) => {
66
72
  const {
67
73
  children,
@@ -69,6 +75,8 @@ export const FormDialog = forwardRef(
69
75
  resolver,
70
76
  fieldResolver,
71
77
  defaultValues,
78
+ values,
79
+ context,
72
80
  onChange,
73
81
  onSubmit,
74
82
  onError,
@@ -79,8 +87,8 @@ export const FormDialog = forwardRef(
79
87
  shouldUseNativeValidation,
80
88
  criteriaMode,
81
89
  delayError = 100,
82
- cancelLabel,
83
- submitLabel,
90
+ cancelLabel = 'Cancel',
91
+ submitLabel = 'Submit',
84
92
  footer,
85
93
  isOpen,
86
94
  onClose,
@@ -92,6 +100,8 @@ export const FormDialog = forwardRef(
92
100
  schema,
93
101
  resolver,
94
102
  defaultValues,
103
+ values,
104
+ context,
95
105
  onChange,
96
106
  onSubmit,
97
107
  onError,
@@ -106,7 +116,7 @@ export const FormDialog = forwardRef(
106
116
 
107
117
  return (
108
118
  <BaseModal isOpen={isOpen} onClose={onClose} {...rest}>
109
- <Form {...formProps}>
119
+ <Form {...formProps} ref={ref}>
110
120
  {(form) => (
111
121
  <>
112
122
  <ModalBody>
@@ -122,9 +132,9 @@ export const FormDialog = forwardRef(
122
132
  {footer || (
123
133
  <ModalFooter>
124
134
  <Button variant="ghost" mr={3} onClick={onClose}>
125
- {cancelLabel || 'Cancel'}
135
+ {cancelLabel}
126
136
  </Button>
127
- <SubmitButton>{submitLabel || 'Submit'}</SubmitButton>
137
+ <SubmitButton>{submitLabel}</SubmitButton>
128
138
  </ModalFooter>
129
139
  )}
130
140
  </>
@@ -135,6 +145,6 @@ export const FormDialog = forwardRef(
135
145
  }
136
146
  ) as <TFieldValues extends FieldValues>(
137
147
  props: FormDialogProps<TFieldValues> & {
138
- ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>
148
+ ref?: React.ForwardedRef<HTMLFormElement>
139
149
  }
140
150
  ) => React.ReactElement
package/src/menu.tsx CHANGED
@@ -12,11 +12,9 @@ import {
12
12
  MenuListProps,
13
13
  } from '@chakra-ui/react'
14
14
 
15
- import {} from '@chakra-ui/system'
16
-
17
15
  import { BaseModal, BaseModalProps } from './modal'
18
16
 
19
- const [StylesProvider] = createStylesContext('MenuDialog')
17
+ const [StylesProvider] = createStylesContext('SuiMenuDialog')
20
18
 
21
19
  export interface MenuDialogProps extends BaseModalProps {
22
20
  /**
package/dist/dialog.d.ts DELETED
@@ -1,54 +0,0 @@
1
- import * as React from 'react';
2
- import { AlertDialogProps } from '@chakra-ui/react';
3
- import { ButtonGroupProps, ButtonProps } from '@saas-ui/button';
4
- export interface ConfirmDialogProps extends Omit<AlertDialogProps, 'leastDestructiveRef'> {
5
- /**
6
- * The dialog title
7
- */
8
- title?: React.ReactNode;
9
- /**
10
- * The cancel button label
11
- */
12
- cancelLabel?: React.ReactNode;
13
- /**
14
- * The confirm button label
15
- */
16
- confirmLabel?: React.ReactNode;
17
- /**
18
- * The cancel button props
19
- */
20
- cancelProps?: ButtonProps;
21
- /**
22
- * The confirm button props
23
- */
24
- confirmProps?: ButtonProps;
25
- /**
26
- * The button group props
27
- */
28
- buttonGroupProps?: ButtonGroupProps;
29
- /**
30
- * Close the dialog on cancel
31
- * @default true
32
- */
33
- closeOnCancel?: boolean;
34
- /**
35
- * Close the dialog on confirm
36
- * @default true
37
- */
38
- closeOnConfirm?: boolean;
39
- /**
40
- * Defines which button gets initial focus
41
- * https://www.w3.org/TR/wai-aria-practices/#alertdialog
42
- */
43
- leastDestructiveFocus?: 'cancel' | 'confirm';
44
- /**
45
- * Function that's called when cancel is clicked
46
- */
47
- onCancel?: () => void;
48
- /**
49
- * Function that's called when confirm is clicked
50
- */
51
- onConfirm?: () => void;
52
- }
53
- export declare const ConfirmDialog: React.FC<ConfirmDialogProps>;
54
- //# sourceMappingURL=dialog.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../src/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAOL,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAEL,gBAAgB,EAEhB,WAAW,EACZ,MAAM,iBAAiB,CAAA;AAExB,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;IACrD;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC5C;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAmEtD,CAAA"}
package/dist/drawer.d.ts DELETED
@@ -1,26 +0,0 @@
1
- import * as React from 'react';
2
- import { DrawerProps as ChakraDrawerProps } from '@chakra-ui/react';
3
- export interface BaseDrawerProps extends Omit<ChakraDrawerProps, 'children'> {
4
- /**
5
- * The drawer title
6
- */
7
- title: React.ReactNode;
8
- /**
9
- * Hide the close button
10
- */
11
- hideCloseButton?: boolean;
12
- /**
13
- * Hide the overflow
14
- */
15
- hideOverlay?: boolean;
16
- children?: React.ReactNode;
17
- }
18
- export declare const BaseDrawer: React.FC<BaseDrawerProps>;
19
- export interface DrawerProps extends BaseDrawerProps {
20
- /**
21
- * Drawer footer content, wrapped with `DrawerFooter`
22
- */
23
- footer?: React.ReactNode;
24
- }
25
- export declare const Drawer: React.FC<DrawerProps>;
26
- //# sourceMappingURL=drawer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../src/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAQL,WAAW,IAAI,iBAAiB,EACjC,MAAM,kBAAkB,CAAA;AAEzB,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC;IAC1E;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAoBhD,CAAA;AAED,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACzB;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CASxC,CAAA"}
package/dist/form.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import * as React from 'react';
2
- import { FormProps, FieldValues, FieldResolver, UseFormReturn } from '@saas-ui/forms';
3
- import { BaseModalProps } from './modal';
4
- export interface FormDialogProps<TFieldValues extends FieldValues = FieldValues> extends Omit<BaseModalProps, 'children'>, Pick<FormProps<TFieldValues>, 'schema' | 'defaultValues' | 'onChange' | 'onSubmit' | 'onError' | 'resolver' | 'mode' | 'reValidateMode' | 'shouldFocusError' | 'shouldUnregister' | 'shouldUseNativeValidation' | 'criteriaMode' | 'delayError'> {
5
- /**
6
- * The modal footer, will be wrapped with `ModalFooter`.
7
- * Defaults to a cancel and submit button.
8
- */
9
- footer?: React.ReactNode;
10
- /**
11
- * The cancel button label
12
- * @default "Cancel"
13
- */
14
- cancelLabel?: React.ReactNode;
15
- /**
16
- * The submit button label
17
- * @default "Submit"
18
- */
19
- submitLabel?: React.ReactNode;
20
- /**
21
- * If no children are passed, this will auto render fields based on the supplied schema.
22
- */
23
- children?: React.ReactNode;
24
- /**
25
- * A schema field resolver used to auto generate form fields.
26
- */
27
- fieldResolver?: FieldResolver;
28
- }
29
- export declare const FormDialog: <TFieldValues extends FieldValues>(props: FormDialogProps<TFieldValues> & {
30
- ref?: React.ForwardedRef<UseFormReturn<TFieldValues, any>> | undefined;
31
- }) => React.ReactElement;
32
- //# sourceMappingURL=form.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EAIL,SAAS,EACT,WAAW,EACX,aAAa,EACb,aAAa,EACd,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAa,cAAc,EAAE,MAAM,SAAS,CAAA;AAEnD,MAAM,WAAW,eAAe,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,CAC7E,SAAQ,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,EACtC,IAAI,CACF,SAAS,CAAC,YAAY,CAAC,EACrB,QAAQ,GACR,eAAe,GACf,UAAU,GACV,UAAU,GACV,SAAS,GACT,UAAU,GACV,MAAM,GACN,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,2BAA2B,GAC3B,cAAc,GACd,YAAY,CACf;IACH;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,eAAO,MAAM,UAAU;;MA+ElB,MAAM,YAAY,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA"}
@@ -1,2 +0,0 @@
1
- import*as e from"react";import{AlertDialog as l,AlertDialogOverlay as n,AlertDialogContent as o,AlertDialogHeader as t,AlertDialogBody as r,AlertDialogFooter as s,Drawer as i,DrawerOverlay as a,DrawerContent as c,DrawerHeader as u,DrawerCloseButton as m,DrawerBody as d,DrawerFooter as p,Modal as f,ModalOverlay as h,ModalContent as C,ModalHeader as E,ModalCloseButton as v,ModalFooter as O,ModalBody as y,createStylesContext as b,forwardRef as g,useMenuContext as P,useMenuList as F,useMultiStyleConfig as M,chakra as R,Menu as w,Button as V}from"@chakra-ui/react";import{ButtonGroup as B,Button as L}from"@saas-ui/button";import{runIfFn as k}from"@chakra-ui/utils";import{Form as S,Fields as x,SubmitButton as D}from"@saas-ui/forms";function U(){return U=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var n=arguments[l];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},U.apply(this,arguments)}function j(e,l){if(null==e)return{};var n,o,t={},r=Object.keys(e);for(o=0;o<r.length;o++)l.indexOf(n=r[o])>=0||(t[n]=e[n]);return t}const A=["title","cancelLabel","confirmLabel","cancelProps","confirmProps","buttonGroupProps","isOpen","closeOnCancel","closeOnConfirm","leastDestructiveFocus","onClose","onCancel","onConfirm","children"],N=i=>{const{title:a,cancelLabel:c="Cancel",confirmLabel:u="Confirm",cancelProps:m,confirmProps:d,buttonGroupProps:p,isOpen:f,closeOnCancel:h=!0,closeOnConfirm:C=!0,leastDestructiveFocus:E="cancel",onClose:v,onCancel:O,onConfirm:y,children:b}=i,g=j(i,A),P=e.useRef(null),F=e.useRef(null);/*#__PURE__*/return e.createElement(l,U({isOpen:f,onClose:v},g,{leastDestructiveRef:"cancel"===E?P:F}),/*#__PURE__*/e.createElement(n,null,/*#__PURE__*/e.createElement(o,null,/*#__PURE__*/e.createElement(t,null,a),/*#__PURE__*/e.createElement(r,null,b),/*#__PURE__*/e.createElement(s,null,/*#__PURE__*/e.createElement(B,p,/*#__PURE__*/e.createElement(L,U({ref:P},m,{onClick:()=>{null==O||O(),h&&v()}}),(null==m?void 0:m.children)||(null==m?void 0:m.label)||c),/*#__PURE__*/e.createElement(L,U({ref:F},d,{onClick:()=>{null==y||y(),C&&v()}}),(null==d?void 0:d.children)||(null==d?void 0:d.label)||u))))))},G=["title","children","isOpen","onClose","hideCloseButton","hideOverlay"],_=["footer","children"],z=l=>{const{title:n,children:o,isOpen:t,onClose:r,hideCloseButton:s,hideOverlay:d}=l,p=j(l,G);/*#__PURE__*/return e.createElement(i,U({isOpen:t,onClose:r},p),!d&&/*#__PURE__*/e.createElement(a,null),/*#__PURE__*/e.createElement(c,null,/*#__PURE__*/e.createElement(u,null,n),!s&&/*#__PURE__*/e.createElement(m,null),o))},H=l=>{const{footer:n,children:o}=l,t=j(l,_);/*#__PURE__*/return e.createElement(z,t,/*#__PURE__*/e.createElement(d,null,o),n&&/*#__PURE__*/e.createElement(p,null,n))},K=["title","footer","children","isOpen","onClose","hideCloseButton","hideOverlay"],Y=["children"],q=l=>{const{title:n,footer:o,children:t,isOpen:r,onClose:s,hideCloseButton:i,hideOverlay:a}=l,c=j(l,K);/*#__PURE__*/return e.createElement(f,U({isOpen:r,onClose:s},c),!a&&/*#__PURE__*/e.createElement(h,null),/*#__PURE__*/e.createElement(C,null,n&&/*#__PURE__*/e.createElement(E,null,n),!i&&/*#__PURE__*/e.createElement(v,null),t,o&&/*#__PURE__*/e.createElement(O,null,o)))},I=l=>{const{children:n}=l,o=j(l,Y);/*#__PURE__*/return e.createElement(q,o,/*#__PURE__*/e.createElement(y,null,n))},J=["onClose","onCloseComplete"],Q=["rootProps","title","footer","initialFocusRef","hideCloseButton","motionPreset"],T=["ref"],[W]=b("MenuDialog"),X=l=>{const{onClose:n,onCloseComplete:o}=l,t=j(l,J);/*#__PURE__*/return e.createElement(w,U({variant:"dialog",onClose:()=>{null==n||n(),null==o||o()}},t))},Z=g((l,n)=>{const{title:o,footer:t,initialFocusRef:r,hideCloseButton:s,motionPreset:i}=l,a=j(l,Q),{isOpen:c,onClose:u,menuRef:m}=P(),d=F(a,n),{ref:p}=d,f=j(d,T),h=M("Menu",l);/*#__PURE__*/return e.createElement(q,{isOpen:c,onClose:u,initialFocusRef:r||m,title:o,hideCloseButton:s,motionPreset:i},/*#__PURE__*/e.createElement(W,{value:h},/*#__PURE__*/e.createElement(R.div,U({},f,{ref:p,__css:U({outline:0,maxHeight:"80vh",overflowY:"auto"},h.list,{boxShadow:"none",border:0})}))),t&&/*#__PURE__*/e.createElement(O,null,t))}),$=["children","schema","resolver","fieldResolver","defaultValues","onChange","onSubmit","onError","mode","reValidateMode","shouldFocusError","shouldUnregister","shouldUseNativeValidation","criteriaMode","delayError","cancelLabel","submitLabel","footer","isOpen","onClose"],ee=g((l,n)=>{const{children:o,schema:t,resolver:r,fieldResolver:s,defaultValues:i,onChange:a,onSubmit:c,onError:u,mode:m,reValidateMode:d,shouldFocusError:p=!0,shouldUnregister:f,shouldUseNativeValidation:h,criteriaMode:C,delayError:E=100,cancelLabel:v,submitLabel:b,footer:g,isOpen:P,onClose:F}=l,M=j(l,$),R={ref:n,schema:t,resolver:r,defaultValues:i,onChange:a,onSubmit:c,onError:u,mode:m,reValidateMode:d,shouldFocusError:p,shouldUnregister:f,shouldUseNativeValidation:h,criteriaMode:C,delayError:E};/*#__PURE__*/return e.createElement(q,U({isOpen:P,onClose:F},M),/*#__PURE__*/e.createElement(S,R,l=>/*#__PURE__*/e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(y,null,k(o,l)||/*#__PURE__*/e.createElement(x,{schema:t,fieldResolver:s,focusFirstField:!0})),g||/*#__PURE__*/e.createElement(O,null,/*#__PURE__*/e.createElement(V,{variant:"ghost",mr:3,onClick:F},v||"Cancel"),/*#__PURE__*/e.createElement(D,null,b||"Submit")))))}),le=["id","type","scope","component"],ne=["title","body","children"],oe=e.createContext(null),te={id:null,props:null,type:"modal"},re={alert:N,confirm:N,drawer:H,modal:I,menu:X,form:ee};function se({children:l,modals:n}){const o=e.useMemo(()=>new Set,[]),[t,r]=e.useState({modal:te}),s=e.useMemo(()=>{const e=U({},re,n);return(l="modal")=>e[l]||e.modal},[n]),i=(e,l)=>{if(!l)return r({modal:e});r(n=>U({},n,{[l]:e}))},a=e=>{"function"==typeof e&&(e={component:e});const{id:l=o.size+1,type:n="modal",scope:t="modal",component:r}=e,s={id:l,props:j(e,le),type:n,scope:t,component:r,isOpen:!0};return o.add(s),i(s,t),l},c=async(e,l)=>{var n;const t=[...Array.from(o)],r=t.filter(l=>l.id===e)[0];if(!r)return;if(!1===await(null==(n=r.props)||null==n.onClose?void 0:n.onClose({force:l})))return;const s=t.filter(({scope:e})=>e===r.scope);i(1===s.length?U({},r,{isOpen:!1}):s.length>1?s[s.length-2]:{id:null,props:null,type:r.type},r.scope)},u={open:a,drawer:e=>a(U({},e,{type:"drawer"})),alert:e=>a(U({},e,{scope:"alert",type:"alert",cancelProps:{display:"none"},confirmProps:{label:"OK"},leastDestructiveFocus:"confirm"})),confirm:e=>a(U({},e,{scope:"alert",type:"confirm"})),menu:e=>a(U({},e,{type:"menu"})),form:e=>a(U({},e,{type:"form"})),close:c,closeAll:()=>{o.forEach(e=>{var l;return null==(l=e.props)||null==l.onClose?void 0:l.onClose({force:!0})}),o.clear(),i(te)}},m=e.useMemo(()=>Object.entries(t).map(([l,n])=>{const t=n.component||s(n.type),r=n.props||{},{title:a,body:u,children:m}=r,d=j(r,ne);/*#__PURE__*/return e.createElement(t,U({key:l,title:a,children:u||m},d,{isOpen:!!n.isOpen,onClose:()=>c(n.id),onCloseComplete:()=>(e=>{const l=[...Array.from(o)],n=l.filter(l=>l.id===e)[0];o.delete(n),1===l.filter(({scope:e})=>e===n.scope).length&&i(te,n.scope)})(n.id)}))}),[t]);/*#__PURE__*/return e.createElement(oe.Provider,{value:u},m,l)}const ie=()=>e.useContext(oe),ae=()=>ie();export{z as BaseDrawer,q as BaseModal,N as ConfirmDialog,H as Drawer,ee as FormDialog,X as MenuDialog,Z as MenuDialogList,I as Modal,oe as ModalsContext,se as ModalsProvider,ae as useModals,ie as useModalsContext};
2
- //# sourceMappingURL=index.modern.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.modern.mjs","sources":["../src/dialog.tsx","../src/drawer.tsx","../src/modal.tsx","../src/menu.tsx","../src/form.tsx","../src/provider.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {\n AlertDialog,\n AlertDialogBody,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogContent,\n AlertDialogOverlay,\n AlertDialogProps,\n} from '@chakra-ui/react'\n\nimport {\n ButtonGroup,\n ButtonGroupProps,\n Button,\n ButtonProps,\n} from '@saas-ui/button'\n\nexport interface ConfirmDialogProps\n extends Omit<AlertDialogProps, 'leastDestructiveRef'> {\n /**\n * The dialog title\n */\n title?: React.ReactNode\n /**\n * The cancel button label\n */\n cancelLabel?: React.ReactNode\n /**\n * The confirm button label\n */\n confirmLabel?: React.ReactNode\n /**\n * The cancel button props\n */\n cancelProps?: ButtonProps\n /**\n * The confirm button props\n */\n confirmProps?: ButtonProps\n /**\n * The button group props\n */\n buttonGroupProps?: ButtonGroupProps\n /**\n * Close the dialog on cancel\n * @default true\n */\n closeOnCancel?: boolean\n /**\n * Close the dialog on confirm\n * @default true\n */\n closeOnConfirm?: boolean\n /**\n * Defines which button gets initial focus\n * https://www.w3.org/TR/wai-aria-practices/#alertdialog\n */\n leastDestructiveFocus?: 'cancel' | 'confirm'\n /**\n * Function that's called when cancel is clicked\n */\n onCancel?: () => void\n /**\n * Function that's called when confirm is clicked\n */\n onConfirm?: () => void\n}\n\nexport const ConfirmDialog: React.FC<ConfirmDialogProps> = (props) => {\n const {\n title,\n cancelLabel = 'Cancel',\n confirmLabel = 'Confirm',\n cancelProps,\n confirmProps,\n buttonGroupProps,\n isOpen,\n closeOnCancel = true,\n closeOnConfirm = true,\n leastDestructiveFocus = 'cancel',\n onClose,\n onCancel,\n onConfirm,\n children,\n ...rest\n } = props\n\n const cancelRef = React.useRef(null)\n const confirmRef = React.useRef(null)\n\n return (\n <AlertDialog\n isOpen={isOpen}\n onClose={onClose}\n {...rest}\n leastDestructiveRef={\n leastDestructiveFocus === 'cancel' ? cancelRef : confirmRef\n }\n >\n <AlertDialogOverlay>\n <AlertDialogContent>\n <AlertDialogHeader>{title}</AlertDialogHeader>\n\n <AlertDialogBody>{children}</AlertDialogBody>\n\n <AlertDialogFooter>\n <ButtonGroup {...buttonGroupProps}>\n <Button\n ref={cancelRef}\n {...cancelProps}\n onClick={() => {\n onCancel?.()\n\n closeOnCancel && onClose()\n }}\n >\n {cancelProps?.children || cancelProps?.label || cancelLabel}\n </Button>\n <Button\n ref={confirmRef}\n {...confirmProps}\n onClick={() => {\n onConfirm?.()\n\n closeOnConfirm && onClose()\n }}\n >\n {confirmProps?.children || confirmProps?.label || confirmLabel}\n </Button>\n </ButtonGroup>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialogOverlay>\n </AlertDialog>\n )\n}\n","import * as React from 'react'\n\nimport {\n Drawer as ChakraDrawer,\n DrawerOverlay,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerBody,\n DrawerCloseButton,\n DrawerProps as ChakraDrawerProps,\n} from '@chakra-ui/react'\n\nexport interface BaseDrawerProps extends Omit<ChakraDrawerProps, 'children'> {\n /**\n * The drawer title\n */\n title: React.ReactNode\n /**\n * Hide the close button\n */\n hideCloseButton?: boolean\n /**\n * Hide the overflow\n */\n hideOverlay?: boolean\n children?: React.ReactNode\n}\n\nexport const BaseDrawer: React.FC<BaseDrawerProps> = (props) => {\n const {\n title,\n children,\n isOpen,\n onClose,\n hideCloseButton,\n hideOverlay,\n ...rest\n } = props\n return (\n <ChakraDrawer isOpen={isOpen} onClose={onClose} {...rest}>\n {!hideOverlay && <DrawerOverlay />}\n <DrawerContent>\n <DrawerHeader>{title}</DrawerHeader>\n {!hideCloseButton && <DrawerCloseButton />}\n {children}\n </DrawerContent>\n </ChakraDrawer>\n )\n}\n\nexport interface DrawerProps extends BaseDrawerProps {\n /**\n * Drawer footer content, wrapped with `DrawerFooter`\n */\n footer?: React.ReactNode\n}\n\nexport const Drawer: React.FC<DrawerProps> = (props) => {\n const { footer, children, ...rest } = props\n return (\n <BaseDrawer {...rest}>\n <DrawerBody>{children}</DrawerBody>\n\n {footer && <DrawerFooter>{footer}</DrawerFooter>}\n </BaseDrawer>\n )\n}\n","import * as React from 'react'\n\nimport {\n Modal as ChakraModal,\n ModalOverlay,\n ModalContent,\n ModalHeader,\n ModalFooter,\n ModalBody,\n ModalCloseButton,\n ModalProps as ChakraModalProps,\n} from '@chakra-ui/react'\n\nexport interface BaseModalProps extends ChakraModalProps {\n /**\n * The modal title\n */\n title?: React.ReactNode\n /**\n * The modal footer\n */\n footer?: React.ReactNode\n /**\n * Hide the close button\n */\n hideCloseButton?: boolean\n /**\n * Hide the overlay\n */\n hideOverlay?: boolean\n}\n\nexport const BaseModal: React.FC<BaseModalProps> = (props) => {\n const {\n title,\n footer,\n children,\n isOpen,\n onClose,\n hideCloseButton,\n hideOverlay,\n ...rest\n } = props\n return (\n <ChakraModal isOpen={isOpen} onClose={onClose} {...rest}>\n {!hideOverlay && <ModalOverlay />}\n <ModalContent>\n {title && <ModalHeader>{title}</ModalHeader>}\n {!hideCloseButton && <ModalCloseButton />}\n {children}\n {footer && <ModalFooter>{footer}</ModalFooter>}\n </ModalContent>\n </ChakraModal>\n )\n}\n\nexport const Modal: React.FC<BaseModalProps> = (props) => {\n const { children, ...rest } = props\n return (\n <BaseModal {...rest}>\n <ModalBody>{children}</ModalBody>\n </BaseModal>\n )\n}\n","import * as React from 'react'\n\nimport {\n ModalFooter,\n chakra,\n forwardRef,\n useMenuContext,\n useMenuList,\n createStylesContext,\n useMultiStyleConfig,\n Menu,\n MenuListProps,\n} from '@chakra-ui/react'\n\nimport {} from '@chakra-ui/system'\n\nimport { BaseModal, BaseModalProps } from './modal'\n\nconst [StylesProvider] = createStylesContext('MenuDialog')\n\nexport interface MenuDialogProps extends BaseModalProps {\n /**\n * The modal footer, wrapped with `ModalFooter`\n */\n footer?: React.ReactNode\n}\n\nexport const MenuDialog: React.FC<MenuDialogProps> = (props) => {\n const { onClose, onCloseComplete, ...rest } = props\n\n return (\n <Menu\n variant=\"dialog\"\n onClose={() => {\n onClose?.()\n // Not supported in Menu, so we call it here instead\n // @todo Refactor this in v2?\n onCloseComplete?.()\n }}\n {...rest}\n />\n )\n}\n\nexport interface MenuDialogListProps\n extends Omit<\n BaseModalProps,\n 'isOpen' | 'onClose' | 'children' | 'scrollBehavior'\n >,\n Omit<MenuListProps, 'title'> {}\n\nexport const MenuDialogList = forwardRef<MenuDialogListProps, 'div'>(\n (props, forwardedRef) => {\n const {\n rootProps,\n title,\n footer,\n initialFocusRef,\n hideCloseButton,\n motionPreset,\n ...rest\n } = props\n\n const { isOpen, onClose, menuRef } = useMenuContext()\n\n const { ref, ...ownProps } = useMenuList(rest, forwardedRef)\n\n const styles = useMultiStyleConfig('Menu', props)\n\n return (\n <BaseModal\n isOpen={isOpen}\n onClose={onClose}\n initialFocusRef={initialFocusRef || menuRef}\n title={title}\n hideCloseButton={hideCloseButton}\n motionPreset={motionPreset}\n >\n {/* We forward the styles again, otherwise the modal styles will be picked up */}\n <StylesProvider value={styles}>\n <chakra.div\n {...ownProps}\n ref={ref as React.Ref<HTMLDivElement>}\n __css={{\n outline: 0,\n maxHeight: '80vh', // can override this in theme\n overflowY: 'auto', // can override this in theme\n ...styles.list,\n boxShadow: 'none',\n border: 0,\n }}\n />\n </StylesProvider>\n {footer && <ModalFooter>{footer}</ModalFooter>}\n </BaseModal>\n )\n }\n)\n","import * as React from 'react'\n\nimport { ModalBody, ModalFooter, Button, forwardRef } from '@chakra-ui/react'\nimport { runIfFn } from '@chakra-ui/utils'\n\nimport {\n Form,\n Fields,\n SubmitButton,\n FormProps,\n FieldValues,\n FieldResolver,\n UseFormReturn,\n} from '@saas-ui/forms'\n\nimport { BaseModal, BaseModalProps } from './modal'\n\nexport interface FormDialogProps<TFieldValues extends FieldValues = FieldValues>\n extends Omit<BaseModalProps, 'children'>,\n Pick<\n FormProps<TFieldValues>,\n | 'schema'\n | 'defaultValues'\n | 'onChange'\n | 'onSubmit'\n | 'onError'\n | 'resolver'\n | 'mode'\n | 'reValidateMode'\n | 'shouldFocusError'\n | 'shouldUnregister'\n | 'shouldUseNativeValidation'\n | 'criteriaMode'\n | 'delayError'\n > {\n /**\n * The modal footer, will be wrapped with `ModalFooter`.\n * Defaults to a cancel and submit button.\n */\n footer?: React.ReactNode\n /**\n * The cancel button label\n * @default \"Cancel\"\n */\n cancelLabel?: React.ReactNode\n /**\n * The submit button label\n * @default \"Submit\"\n */\n submitLabel?: React.ReactNode\n /**\n * If no children are passed, this will auto render fields based on the supplied schema.\n */\n children?: React.ReactNode\n /**\n * A schema field resolver used to auto generate form fields.\n */\n fieldResolver?: FieldResolver\n}\n\nexport const FormDialog = forwardRef(\n <TFieldValues extends FieldValues = FieldValues>(\n props: FormDialogProps<TFieldValues>,\n ref: React.ForwardedRef<UseFormReturn<TFieldValues>>\n ) => {\n const {\n children,\n schema,\n resolver,\n fieldResolver,\n defaultValues,\n onChange,\n onSubmit,\n onError,\n mode,\n reValidateMode,\n shouldFocusError = true,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError = 100,\n cancelLabel,\n submitLabel,\n footer,\n isOpen,\n onClose,\n ...rest\n } = props\n\n const formProps = {\n ref,\n schema,\n resolver,\n defaultValues,\n onChange,\n onSubmit,\n onError,\n mode,\n reValidateMode,\n shouldFocusError,\n shouldUnregister,\n shouldUseNativeValidation,\n criteriaMode,\n delayError,\n }\n\n return (\n <BaseModal isOpen={isOpen} onClose={onClose} {...rest}>\n <Form {...formProps}>\n {(form) => (\n <>\n <ModalBody>\n {runIfFn(children, form) || (\n <Fields\n schema={schema}\n fieldResolver={fieldResolver}\n focusFirstField\n />\n )}\n </ModalBody>\n\n {footer || (\n <ModalFooter>\n <Button variant=\"ghost\" mr={3} onClick={onClose}>\n {cancelLabel || 'Cancel'}\n </Button>\n <SubmitButton>{submitLabel || 'Submit'}</SubmitButton>\n </ModalFooter>\n )}\n </>\n )}\n </Form>\n </BaseModal>\n )\n }\n) as <TFieldValues extends FieldValues>(\n props: FormDialogProps<TFieldValues> & {\n ref?: React.ForwardedRef<UseFormReturn<TFieldValues>>\n }\n) => React.ReactElement\n","import * as React from 'react'\n\nimport { Modal, BaseModalProps } from './modal'\nimport { Drawer, DrawerProps } from './drawer'\nimport { ConfirmDialog, ConfirmDialogProps } from './dialog'\nimport { MenuDialog, MenuDialogProps } from './menu'\nimport { FormDialog, FormDialogProps } from './form'\n\nexport interface ModalsContextValue {\n open: (options: OpenOptions) => ModalId\n drawer: (options: DrawerOptions) => ModalId\n alert: (options: ConfirmDialogOptions) => ModalId\n confirm: (options: ConfirmDialogOptions) => ModalId\n menu: (options: MenuDialogOptions) => ModalId\n form: (options: FormDialogOptions) => ModalId\n close: (id: ModalId) => void\n closeAll: () => void\n}\n\nexport const ModalsContext = React.createContext<ModalsContextValue | null>(\n null\n)\n\ninterface ModalsProviderProps {\n children: React.ReactNode\n modals?: Record<string, React.FC<any>>\n}\n\nexport type ModalId = string | number\n\ninterface ModalOptions\n extends Omit<BaseModalProps, 'onClose' | 'isOpen' | 'children'> {\n onClose?: (args: { force?: boolean }) => Promise<boolean | undefined> | void\n body?: React.ReactNode\n children?: React.ReactNode\n [key: string]: any\n}\n\nexport interface DrawerOptions\n extends ModalOptions,\n Omit<DrawerProps, 'onClose' | 'isOpen' | 'children' | 'title' | 'size'> {}\n\nexport interface ConfirmDialogOptions\n extends ModalOptions,\n Omit<ConfirmDialogProps, 'onClose' | 'isOpen' | 'children'> {}\n\nexport interface MenuDialogOptions\n extends ModalOptions,\n Omit<MenuDialogProps, 'onClose' | 'isOpen' | 'children'> {}\n\nexport interface FormDialogOptions\n extends ModalOptions,\n Omit<FormDialogProps, 'onClose' | 'isOpen' | 'children'> {}\n\nexport interface OpenOptions extends ModalOptions {\n type?: ModalTypes\n scope?: ModalScopes\n}\n\nexport type ModalScopes = 'modal' | 'alert'\n\nexport type ModalTypes =\n | 'modal'\n | 'drawer'\n | 'alert'\n | 'confirm'\n | 'menu'\n | string\n\nexport interface ModalConfig<\n TModalOptions extends ModalOptions = ModalOptions\n> {\n /**\n * The modal id, autogenerated when not set.\n * Can be used to close modals.\n */\n id?: ModalId | null\n /**\n * The modal props\n */\n props?: TModalOptions | null\n /**\n * The modal scope\n * Modals can only have one level per scope.\n * The default scopes are 'modal' and 'alert', alerts can be openend above modals.\n */\n scope?: ModalScopes | string\n /**\n * The modal type to open.\n * Build in types are 'modal', 'drawer', 'alert', 'confirm'\n *\n * Custom types can be configured using the `modals` prop of `ModalProvider`\n */\n type?: ModalTypes\n /**\n * Render a custom modal component.\n * This will ignore the `type` param.\n */\n component?: React.FC<BaseModalProps>\n /**\n * Whether the modal is open or not.\n * This is used internally to keep track of the modal state.\n */\n isOpen?: boolean\n}\n\nconst initialModalState: ModalConfig = {\n id: null,\n props: null,\n type: 'modal',\n}\n\nconst defaultModals = {\n alert: ConfirmDialog,\n confirm: ConfirmDialog,\n drawer: Drawer,\n modal: Modal,\n menu: MenuDialog,\n form: FormDialog,\n}\n\nexport function ModalsProvider({ children, modals }: ModalsProviderProps) {\n // Note that updating the Set doesn't trigger a re-render,\n // use in conjuction with setActiveModals\n const _instances = React.useMemo(() => new Set<ModalConfig>(), [])\n\n const [activeModals, setActiveModals] = React.useState<\n Record<string, ModalConfig>\n >({\n modal: initialModalState,\n })\n\n const getModalComponent = React.useMemo(() => {\n const _modals: Record<string, React.FC<any>> = {\n ...defaultModals,\n ...modals,\n }\n\n return (type: ModalTypes = 'modal') => {\n const component = _modals[type] || _modals.modal\n\n return component\n }\n }, [modals])\n\n const setActiveModal = (modal: ModalConfig, scope?: string) => {\n if (!scope) {\n return setActiveModals({\n modal,\n })\n }\n setActiveModals((prevState) => ({\n ...prevState,\n [scope]: modal,\n }))\n }\n\n const open = <T extends ModalOptions>(\n options: T | React.FC<BaseModalProps>\n ): ModalId => {\n if (typeof options === 'function') {\n const component: React.FC<BaseModalProps> = options\n options = {\n component,\n } as unknown as T\n }\n\n const {\n id = _instances.size + 1,\n type = 'modal',\n scope = 'modal',\n component,\n ...props\n } = options\n\n const modal: ModalConfig<T> = {\n id,\n props: props as T,\n type,\n scope,\n component,\n isOpen: true,\n }\n\n _instances.add(modal)\n setActiveModal(modal, scope)\n\n return id\n }\n\n const drawer = (options: DrawerOptions): ModalId => {\n return open<DrawerOptions>({\n ...options,\n type: 'drawer',\n })\n }\n\n const alert = (options: ConfirmDialogOptions): ModalId => {\n return open({\n ...options,\n scope: 'alert',\n type: 'alert',\n cancelProps: {\n display: 'none',\n },\n confirmProps: {\n label: 'OK',\n },\n leastDestructiveFocus: 'confirm',\n })\n }\n\n const confirm = (options: ConfirmDialogOptions): ModalId => {\n return open<ConfirmDialogOptions>({\n ...options,\n scope: 'alert',\n type: 'confirm',\n })\n }\n\n const menu = (options: MenuDialogOptions): ModalId => {\n return open<MenuDialogOptions>({\n ...options,\n type: 'menu',\n })\n }\n\n const form = (options: FormDialogOptions): ModalId => {\n return open<FormDialogOptions>({\n ...options,\n type: 'form',\n })\n }\n\n const close = async (id?: ModalId | null, force?: boolean) => {\n const modals = [...Array.from(_instances)]\n const modal = modals.filter((modal) => modal.id === id)[0]\n\n if (!modal) {\n return\n }\n\n const shouldClose = await modal.props?.onClose?.({ force })\n if (shouldClose === false) {\n return\n }\n\n const scoped = modals.filter(({ scope }) => scope === modal.scope)\n\n if (scoped.length === 1) {\n setActiveModal(\n {\n ...modal,\n isOpen: false,\n },\n modal.scope\n )\n } else if (scoped.length > 1) {\n setActiveModal(scoped[scoped.length - 2], modal.scope)\n } else {\n setActiveModal(\n {\n id: null,\n props: null,\n type: modal.type, // Keep type same as last modal type to make sure the animation isn't interrupted\n },\n modal.scope\n )\n }\n }\n\n const closeComplete = (id?: ModalId | null) => {\n const modals = [...Array.from(_instances)]\n const modal = modals.filter((modal) => modal.id === id)[0]\n\n _instances.delete(modal)\n\n const scoped = modals.filter(({ scope }) => scope === modal.scope)\n\n if (scoped.length === 1) {\n setActiveModal(initialModalState, modal.scope)\n }\n }\n\n const closeAll = () => {\n _instances.forEach((modal) => modal.props?.onClose?.({ force: true }))\n _instances.clear()\n\n setActiveModal(initialModalState)\n }\n\n const context = {\n open,\n drawer,\n alert,\n confirm,\n menu,\n form,\n close,\n closeAll,\n }\n\n const content = React.useMemo(\n () =>\n Object.entries(activeModals).map(([scope, config]) => {\n const Component = config.component || getModalComponent(config.type)\n\n const { title, body, children, ...props } = config.props || {}\n\n return (\n <Component\n key={scope}\n title={title}\n children={body || children}\n {...props}\n isOpen={!!config.isOpen}\n onClose={() => close(config.id)}\n onCloseComplete={() => closeComplete(config.id)}\n />\n )\n }),\n [activeModals]\n )\n\n return (\n <ModalsContext.Provider value={context}>\n {content}\n {children}\n </ModalsContext.Provider>\n )\n}\n\nexport const useModalsContext = () =>\n React.useContext(ModalsContext) as ModalsContextValue\n\nexport const useModals = () => {\n return useModalsContext()\n}\n"],"names":["ConfirmDialog","props","title","cancelLabel","confirmLabel","cancelProps","confirmProps","buttonGroupProps","isOpen","closeOnCancel","closeOnConfirm","leastDestructiveFocus","onClose","onCancel","onConfirm","children","rest","_objectWithoutPropertiesLoose","_excluded","cancelRef","React","useRef","confirmRef","AlertDialog","_extends","leastDestructiveRef","createElement","AlertDialogOverlay","AlertDialogContent","AlertDialogHeader","AlertDialogBody","AlertDialogFooter","ButtonGroup","Button","ref","onClick","label","_excluded2","BaseDrawer","hideCloseButton","hideOverlay","ChakraDrawer","DrawerOverlay","DrawerContent","DrawerHeader","DrawerCloseButton","Drawer","footer","DrawerBody","DrawerFooter","BaseModal","ChakraModal","ModalOverlay","ModalContent","ModalHeader","ModalCloseButton","ModalFooter","Modal","ModalBody","StylesProvider","createStylesContext","MenuDialog","onCloseComplete","Menu","variant","forwardRef","forwardedRef","initialFocusRef","motionPreset","menuRef","useMenuContext","_useMenuList","useMenuList","ownProps","_excluded3","styles","useMultiStyleConfig","value","chakra","div","__css","outline","maxHeight","overflowY","list","boxShadow","border","FormDialog","schema","resolver","fieldResolver","defaultValues","onChange","onSubmit","onError","mode","reValidateMode","shouldFocusError","shouldUnregister","shouldUseNativeValidation","criteriaMode","delayError","submitLabel","Form","formProps","form","Fragment","runIfFn","Fields","focusFirstField","mr","SubmitButton","createContext","initialModalState","id","type","alert","confirm","drawer","modal","menu","ModalsProvider","modals","_instances","useMemo","Set","activeModals","setActiveModals","useState","getModalComponent","_modals","defaultModals","setActiveModal","scope","prevState","open","options","component","size","add","close","async","force","_modal$props","Array","from","filter","scoped","length","context","display","closeAll","forEach","_modal$props2","clear","content","Object","entries","map","config","_ref","body","Component","key","delete","closeComplete","ModalsContext","Provider","useModalsContext","useContext","useModals"],"mappings":"oxCAsEaA,EAA+CC,IAC1D,MAAMC,MACJA,EAAKC,YACLA,EAAc,SAAQC,aACtBA,EAAe,UAASC,YACxBA,EAAWC,aACXA,EAAYC,iBACZA,EAAgBC,OAChBA,EAAMC,cACNA,GAAgB,EAAIC,eACpBA,GAAiB,EAAIC,sBACrBA,EAAwB,SAAQC,QAChCA,EAAOC,SACPA,EAAQC,UACRA,EAASC,SACTA,GAEEd,EADCe,EAAIC,EACLhB,EAAKiB,GAEHC,EAAYC,EAAMC,OAAO,MACfC,EAAGF,EAAMC,OAAO,mBAEhC,OACED,gBAACG,EAAWC,EAAA,CACVhB,OAAQA,EACRI,QAASA,GACLI,EAAI,CACRS,oBAC4B,WAA1Bd,EAAqCQ,EAAYG,iBAGnDF,EAAAM,cAACC,EAAkB,kBACjBP,EAACM,cAAAE,EACC,kBAAAR,EAAAM,cAACG,EAAmB3B,KAAAA,gBAEpBkB,EAACM,cAAAI,EAAiBf,KAAAA,gBAElBK,EAACM,cAAAK,EACC,kBAAAX,EAAAM,cAACM,EAAgBzB,eACfa,EAAAM,cAACO,EAAMT,EAAA,CACLU,IAAKf,GACDd,EAAW,CACf8B,QAAS,KACPtB,MAAAA,GAAAA,IAEAJ,GAAiBG,GACnB,WAECP,SAAAA,EAAaU,YAAuB,MAAXV,OAAW,EAAXA,EAAa+B,QAASjC,gBAElDiB,EAAAM,cAACO,EACCT,EAAA,CAAAU,IAAKZ,GACDhB,EACJ,CAAA6B,QAAS,KACPrB,MAAAA,GAAAA,IAEAJ,GAAkBE,GAAO,KAGd,MAAZN,OAAY,EAAZA,EAAcS,YAAYT,MAAAA,OAAAA,EAAAA,EAAc8B,QAAShC,OAM9D,ECvIJc,EAAA,CAAA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AF"}
package/dist/menu.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import { MenuListProps } from '@chakra-ui/react';
3
- import { BaseModalProps } from './modal';
4
- export interface MenuDialogProps extends BaseModalProps {
5
- /**
6
- * The modal footer, wrapped with `ModalFooter`
7
- */
8
- footer?: React.ReactNode;
9
- }
10
- export declare const MenuDialog: React.FC<MenuDialogProps>;
11
- export interface MenuDialogListProps extends Omit<BaseModalProps, 'isOpen' | 'onClose' | 'children' | 'scrollBehavior'>, Omit<MenuListProps, 'title'> {
12
- }
13
- export declare const MenuDialogList: import("@chakra-ui/system/dist/system.types").ComponentWithAs<"div", MenuDialogListProps>;
14
- //# sourceMappingURL=menu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../src/menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EASL,aAAa,EACd,MAAM,kBAAkB,CAAA;AAIzB,OAAO,EAAa,cAAc,EAAE,MAAM,SAAS,CAAA;AAInD,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACzB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAehD,CAAA;AAED,MAAM,WAAW,mBACf,SAAQ,IAAI,CACR,cAAc,EACd,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,gBAAgB,CACrD,EACD,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC;CAAG;AAEnC,eAAO,MAAM,cAAc,2FA8C1B,CAAA"}
package/dist/modal.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import * as React from 'react';
2
- import { ModalProps as ChakraModalProps } from '@chakra-ui/react';
3
- export interface BaseModalProps extends ChakraModalProps {
4
- /**
5
- * The modal title
6
- */
7
- title?: React.ReactNode;
8
- /**
9
- * The modal footer
10
- */
11
- footer?: React.ReactNode;
12
- /**
13
- * Hide the close button
14
- */
15
- hideCloseButton?: boolean;
16
- /**
17
- * Hide the overlay
18
- */
19
- hideOverlay?: boolean;
20
- }
21
- export declare const BaseModal: React.FC<BaseModalProps>;
22
- export declare const Modal: React.FC<BaseModalProps>;
23
- //# sourceMappingURL=modal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../src/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAQL,UAAU,IAAI,gBAAgB,EAC/B,MAAM,kBAAkB,CAAA;AAEzB,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAsB9C,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAO1C,CAAA"}
@@ -1,83 +0,0 @@
1
- import * as React from 'react';
2
- import { BaseModalProps } from './modal';
3
- import { DrawerProps } from './drawer';
4
- import { ConfirmDialogProps } from './dialog';
5
- import { MenuDialogProps } from './menu';
6
- import { FormDialogProps } from './form';
7
- export interface ModalsContextValue {
8
- open: (options: OpenOptions) => ModalId;
9
- drawer: (options: DrawerOptions) => ModalId;
10
- alert: (options: ConfirmDialogOptions) => ModalId;
11
- confirm: (options: ConfirmDialogOptions) => ModalId;
12
- menu: (options: MenuDialogOptions) => ModalId;
13
- form: (options: FormDialogOptions) => ModalId;
14
- close: (id: ModalId) => void;
15
- closeAll: () => void;
16
- }
17
- export declare const ModalsContext: React.Context<ModalsContextValue | null>;
18
- interface ModalsProviderProps {
19
- children: React.ReactNode;
20
- modals?: Record<string, React.FC<any>>;
21
- }
22
- export type ModalId = string | number;
23
- interface ModalOptions extends Omit<BaseModalProps, 'onClose' | 'isOpen' | 'children'> {
24
- onClose?: (args: {
25
- force?: boolean;
26
- }) => Promise<boolean | undefined> | void;
27
- body?: React.ReactNode;
28
- children?: React.ReactNode;
29
- [key: string]: any;
30
- }
31
- export interface DrawerOptions extends ModalOptions, Omit<DrawerProps, 'onClose' | 'isOpen' | 'children' | 'title' | 'size'> {
32
- }
33
- export interface ConfirmDialogOptions extends ModalOptions, Omit<ConfirmDialogProps, 'onClose' | 'isOpen' | 'children'> {
34
- }
35
- export interface MenuDialogOptions extends ModalOptions, Omit<MenuDialogProps, 'onClose' | 'isOpen' | 'children'> {
36
- }
37
- export interface FormDialogOptions extends ModalOptions, Omit<FormDialogProps, 'onClose' | 'isOpen' | 'children'> {
38
- }
39
- export interface OpenOptions extends ModalOptions {
40
- type?: ModalTypes;
41
- scope?: ModalScopes;
42
- }
43
- export type ModalScopes = 'modal' | 'alert';
44
- export type ModalTypes = 'modal' | 'drawer' | 'alert' | 'confirm' | 'menu' | string;
45
- export interface ModalConfig<TModalOptions extends ModalOptions = ModalOptions> {
46
- /**
47
- * The modal id, autogenerated when not set.
48
- * Can be used to close modals.
49
- */
50
- id?: ModalId | null;
51
- /**
52
- * The modal props
53
- */
54
- props?: TModalOptions | null;
55
- /**
56
- * The modal scope
57
- * Modals can only have one level per scope.
58
- * The default scopes are 'modal' and 'alert', alerts can be openend above modals.
59
- */
60
- scope?: ModalScopes | string;
61
- /**
62
- * The modal type to open.
63
- * Build in types are 'modal', 'drawer', 'alert', 'confirm'
64
- *
65
- * Custom types can be configured using the `modals` prop of `ModalProvider`
66
- */
67
- type?: ModalTypes;
68
- /**
69
- * Render a custom modal component.
70
- * This will ignore the `type` param.
71
- */
72
- component?: React.FC<BaseModalProps>;
73
- /**
74
- * Whether the modal is open or not.
75
- * This is used internally to keep track of the modal state.
76
- */
77
- isOpen?: boolean;
78
- }
79
- export declare function ModalsProvider({ children, modals }: ModalsProviderProps): JSX.Element;
80
- export declare const useModalsContext: () => ModalsContextValue;
81
- export declare const useModals: () => ModalsContextValue;
82
- export {};
83
- //# sourceMappingURL=provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAS,cAAc,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAU,WAAW,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAiB,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAc,eAAe,EAAE,MAAM,QAAQ,CAAA;AACpD,OAAO,EAAc,eAAe,EAAE,MAAM,QAAQ,CAAA;AAEpD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAA;IACvC,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAA;IAC3C,KAAK,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAA;IACjD,OAAO,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAA;IACnD,IAAI,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAA;IAC7C,IAAI,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAA;IAC7C,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5B,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,eAAO,MAAM,aAAa,0CAEzB,CAAA;AAED,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MA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