mui-dialog 1.0.12 → 1.0.14

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/README.md CHANGED
@@ -1,7 +1,11 @@
1
- # mui-dialog
1
+ # MUI Dialog
2
2
 
3
3
  A reusable dialog component for React applications built with Material-UI (MUI).
4
4
 
5
+ ## Documentation
6
+
7
+ For detailed documentation and examples, visit our [Storybook](https://storybook.viplatform.net/mui-dialog/).
8
+
5
9
  ## Installation
6
10
 
7
11
  ```bash
package/dist/index.d.ts CHANGED
@@ -1,126 +1,3 @@
1
- import { Breakpoint } from '@mui/material';
2
- import { JSX } from 'react/jsx-runtime';
3
-
4
- export declare interface BaseModalProps {
5
- wrapperClassName?: string;
6
- onClose: () => void;
7
- open: boolean;
8
- showCloseIcon?: boolean;
9
- title?: string | React.ReactNode;
10
- subTitle?: string | React.ReactNode;
11
- description?: string | React.ReactNode;
12
- children: React.ReactNode;
13
- actions?: IActions;
14
- showDivider?: boolean;
15
- showActions?: boolean;
16
- }
17
-
18
- export declare const CONFIRMATION_SUBTYPES: {
19
- readonly DEFAULT: "default";
20
- readonly DESTRUCTIVE: "destructive";
21
- readonly NESTED: "nested";
22
- };
23
-
24
- export declare interface ConfirmationModalProps extends BaseModalProps {
25
- type: typeof MODAL_TYPES.CONFIRMATION;
26
- subtype: (typeof CONFIRMATION_SUBTYPES)[keyof typeof CONFIRMATION_SUBTYPES];
27
- size?: ModalSize;
28
- tertiaryCtaType?: (typeof TERTIARY_CTA_TYPES)[keyof typeof TERTIARY_CTA_TYPES];
29
- }
30
-
31
- export declare type ConfirmationSubtype = (typeof CONFIRMATION_SUBTYPES)[keyof typeof CONFIRMATION_SUBTYPES];
32
-
33
- declare interface IActions {
34
- primaryCtaTitle?: string;
35
- secondaryCtaTitle?: string;
36
- isPrimaryCtaLoading?: boolean;
37
- isPrimaryCtaDisabled?: boolean;
38
- isSecondaryCtaDisabled?: boolean;
39
- isSecondaryCtaLoading?: boolean;
40
- onPrimaryCtaClick?: () => void;
41
- onSecondaryCtaClick?: () => void;
42
- tertiaryCtaTitle?: string;
43
- tertiaryCtaStartIcon?: React.ReactNode;
44
- isTertiaryCtaLoading?: boolean;
45
- isTertiaryCtaDisabled?: boolean;
46
- onTertiaryCtaClick?: () => void;
47
- }
48
-
49
- export declare const INFORMATION_SUBTYPES: {
50
- readonly ACKNOWLEDGEMENT: "acknowledgement";
51
- readonly PROGRESS: "progress";
52
- readonly PASSIVE: "passive";
53
- };
54
-
55
- export declare interface InformationModalProps extends BaseModalProps {
56
- type: typeof MODAL_TYPES.INFORMATION;
57
- subtype: (typeof INFORMATION_SUBTYPES)[keyof typeof INFORMATION_SUBTYPES];
58
- size?: ModalSize;
59
- tertiaryCtaType?: (typeof TERTIARY_CTA_TYPES)[keyof typeof TERTIARY_CTA_TYPES];
60
- }
61
-
62
- export declare type InformationSubtype = (typeof INFORMATION_SUBTYPES)[keyof typeof INFORMATION_SUBTYPES];
63
-
64
- export declare const INPUT_SUBTYPES: {
65
- readonly DEFAULT: "default";
66
- readonly DESTRUCTIVE: "destructive";
67
- };
68
-
69
- export declare interface InputModalProps extends BaseModalProps {
70
- type: typeof MODAL_TYPES.INPUT;
71
- subtype: (typeof INPUT_SUBTYPES)[keyof typeof INPUT_SUBTYPES];
72
- size?: ModalSize;
73
- tertiaryCtaType?: (typeof TERTIARY_CTA_TYPES)[keyof typeof TERTIARY_CTA_TYPES];
74
- }
75
-
76
- export declare type InputSubtype = (typeof INPUT_SUBTYPES)[keyof typeof INPUT_SUBTYPES];
77
-
78
- export declare const MODAL_CONFIGS: Record<ModalType, ModalTypeConfig>;
79
-
80
- export declare const MODAL_SIZE_VS_CLASS_NAMES: {
81
- small: string;
82
- medium: string;
83
- large: string;
84
- extraLarge: string;
85
- };
86
-
87
- export declare const MODAL_SIZES: {
88
- readonly SMALL: "small";
89
- readonly MEDIUM: "medium";
90
- readonly LARGE: "large";
91
- readonly EXTRA_LARGE: "extraLarge";
92
- };
93
-
94
- export declare const MODAL_TYPES: {
95
- readonly INFORMATION: "information";
96
- readonly CONFIRMATION: "confirmation";
97
- readonly INPUT: "input";
98
- };
99
-
100
- declare type ModalConfig = {
101
- DISMISSIBLE: 'full' | 'partial';
102
- ALLOWED_SIZES: ModalSize[];
103
- };
104
-
105
- declare type ModalProps = InformationModalProps | ConfirmationModalProps | InputModalProps;
106
-
107
- export declare type ModalSize = (typeof MODAL_SIZES)[keyof typeof MODAL_SIZES];
108
-
109
- export declare type ModalType = (typeof MODAL_TYPES)[keyof typeof MODAL_TYPES];
110
-
111
- declare type ModalTypeConfig = {
112
- [subtype: string]: ModalConfig;
113
- };
114
-
115
- export declare const MuiDialog: (props: ModalProps) => JSX.Element;
116
-
117
- export declare const SIZE_TO_MAX_WIDTH: Record<ModalSize, Breakpoint>;
118
-
119
- export declare type SubtypeForType<T extends ModalType> = T extends typeof MODAL_TYPES.INFORMATION ? InformationSubtype : T extends typeof MODAL_TYPES.CONFIRMATION ? ConfirmationSubtype : T extends typeof MODAL_TYPES.INPUT ? InputSubtype : never;
120
-
121
- export declare const TERTIARY_CTA_TYPES: {
122
- DEFAULT: string;
123
- DESTRUCTIVE: string;
124
- };
125
-
126
- export { }
1
+ export { default as MuiDialog } from './muiDialog';
2
+ export * from './muiDialog/constants/muiDialog.types';
3
+ export * from './muiDialog/constants/muiDialog.interfaces';
@@ -0,0 +1,48 @@
1
+ import { CONFIRMATION_SUBTYPES, INFORMATION_SUBTYPES, INPUT_SUBTYPES, MODAL_TYPES, ModalSize, TERTIARY_CTA_TYPES } from './muiDialog.types';
2
+ interface IActions {
3
+ primaryCtaTitle?: string;
4
+ secondaryCtaTitle?: string;
5
+ isPrimaryCtaLoading?: boolean;
6
+ isPrimaryCtaDisabled?: boolean;
7
+ isSecondaryCtaDisabled?: boolean;
8
+ isSecondaryCtaLoading?: boolean;
9
+ onPrimaryCtaClick?: () => void;
10
+ onSecondaryCtaClick?: () => void;
11
+ tertiaryCtaTitle?: string;
12
+ tertiaryCtaStartIcon?: React.ReactNode;
13
+ isTertiaryCtaLoading?: boolean;
14
+ isTertiaryCtaDisabled?: boolean;
15
+ onTertiaryCtaClick?: () => void;
16
+ }
17
+ export interface BaseModalProps {
18
+ wrapperClassName?: string;
19
+ onClose: () => void;
20
+ open: boolean;
21
+ showCloseIcon?: boolean;
22
+ title?: string | React.ReactNode;
23
+ subTitle?: string | React.ReactNode;
24
+ description?: string | React.ReactNode;
25
+ children: React.ReactNode;
26
+ actions?: IActions;
27
+ showDivider?: boolean;
28
+ showActions?: boolean;
29
+ }
30
+ export interface InformationModalProps extends BaseModalProps {
31
+ type: typeof MODAL_TYPES.INFORMATION;
32
+ subtype: (typeof INFORMATION_SUBTYPES)[keyof typeof INFORMATION_SUBTYPES];
33
+ size?: ModalSize;
34
+ tertiaryCtaType?: (typeof TERTIARY_CTA_TYPES)[keyof typeof TERTIARY_CTA_TYPES];
35
+ }
36
+ export interface ConfirmationModalProps extends BaseModalProps {
37
+ type: typeof MODAL_TYPES.CONFIRMATION;
38
+ subtype: (typeof CONFIRMATION_SUBTYPES)[keyof typeof CONFIRMATION_SUBTYPES];
39
+ size?: ModalSize;
40
+ tertiaryCtaType?: (typeof TERTIARY_CTA_TYPES)[keyof typeof TERTIARY_CTA_TYPES];
41
+ }
42
+ export interface InputModalProps extends BaseModalProps {
43
+ type: typeof MODAL_TYPES.INPUT;
44
+ subtype: (typeof INPUT_SUBTYPES)[keyof typeof INPUT_SUBTYPES];
45
+ size?: ModalSize;
46
+ tertiaryCtaType?: (typeof TERTIARY_CTA_TYPES)[keyof typeof TERTIARY_CTA_TYPES];
47
+ }
48
+ export {};
@@ -0,0 +1,52 @@
1
+ import { Breakpoint } from '@mui/material';
2
+ export declare const MODAL_TYPES: {
3
+ readonly INFORMATION: "information";
4
+ readonly CONFIRMATION: "confirmation";
5
+ readonly INPUT: "input";
6
+ };
7
+ export type ModalType = (typeof MODAL_TYPES)[keyof typeof MODAL_TYPES];
8
+ export declare const INFORMATION_SUBTYPES: {
9
+ readonly ACKNOWLEDGEMENT: "acknowledgement";
10
+ readonly PROGRESS: "progress";
11
+ readonly PASSIVE: "passive";
12
+ };
13
+ export declare const CONFIRMATION_SUBTYPES: {
14
+ readonly DEFAULT: "default";
15
+ readonly DESTRUCTIVE: "destructive";
16
+ readonly NESTED: "nested";
17
+ };
18
+ export declare const INPUT_SUBTYPES: {
19
+ readonly DEFAULT: "default";
20
+ readonly DESTRUCTIVE: "destructive";
21
+ };
22
+ export type InformationSubtype = (typeof INFORMATION_SUBTYPES)[keyof typeof INFORMATION_SUBTYPES];
23
+ export type ConfirmationSubtype = (typeof CONFIRMATION_SUBTYPES)[keyof typeof CONFIRMATION_SUBTYPES];
24
+ export type InputSubtype = (typeof INPUT_SUBTYPES)[keyof typeof INPUT_SUBTYPES];
25
+ export declare const MODAL_SIZES: {
26
+ readonly SMALL: "small";
27
+ readonly MEDIUM: "medium";
28
+ readonly LARGE: "large";
29
+ readonly EXTRA_LARGE: "extraLarge";
30
+ };
31
+ export declare const TERTIARY_CTA_TYPES: {
32
+ DEFAULT: string;
33
+ DESTRUCTIVE: string;
34
+ };
35
+ export type ModalSize = (typeof MODAL_SIZES)[keyof typeof MODAL_SIZES];
36
+ type ModalConfig = {
37
+ DISMISSIBLE: 'full' | 'partial';
38
+ ALLOWED_SIZES: ModalSize[];
39
+ };
40
+ type ModalTypeConfig = {
41
+ [subtype: string]: ModalConfig;
42
+ };
43
+ export declare const MODAL_CONFIGS: Record<ModalType, ModalTypeConfig>;
44
+ export declare const SIZE_TO_MAX_WIDTH: Record<ModalSize, Breakpoint>;
45
+ export type SubtypeForType<T extends ModalType> = T extends typeof MODAL_TYPES.INFORMATION ? InformationSubtype : T extends typeof MODAL_TYPES.CONFIRMATION ? ConfirmationSubtype : T extends typeof MODAL_TYPES.INPUT ? InputSubtype : never;
46
+ export declare const MODAL_SIZE_VS_CLASS_NAMES: {
47
+ small: string;
48
+ medium: string;
49
+ large: string;
50
+ extraLarge: string;
51
+ };
52
+ export {};
@@ -0,0 +1 @@
1
+ export declare const checkIfTertiaryCtaIsAllowed: (type: string, subtype: string, size: string) => boolean;
@@ -0,0 +1,4 @@
1
+ import { ConfirmationModalProps, InformationModalProps, InputModalProps } from './constants/muiDialog.interfaces';
2
+ type ModalProps = InformationModalProps | ConfirmationModalProps | InputModalProps;
3
+ declare const MuiDialog: (props: ModalProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default MuiDialog;
@@ -0,0 +1,239 @@
1
+ import { Theme } from '@mui/material';
2
+ export declare const dialogTypography: {
3
+ fontFamily: string;
4
+ displayL: {
5
+ fontSize: string;
6
+ fontWeight: number;
7
+ lineHeight: string;
8
+ letterSpacing: string;
9
+ };
10
+ displayM: {
11
+ fontSize: string;
12
+ fontWeight: number;
13
+ lineHeight: string;
14
+ letterSpacing: string;
15
+ };
16
+ headingL: {
17
+ fontSize: string;
18
+ fontWeight: number;
19
+ lineHeight: string;
20
+ letterSpacing: string;
21
+ };
22
+ headingM: {
23
+ fontSize: string;
24
+ fontWeight: number;
25
+ lineHeight: string;
26
+ letterSpacing: string;
27
+ };
28
+ headingS: {
29
+ fontSize: string;
30
+ fontWeight: number;
31
+ lineHeight: string;
32
+ letterSpacing: string;
33
+ };
34
+ semiBoldLabelL: {
35
+ fontSize: string;
36
+ lineHeight: string;
37
+ fontWeight: number;
38
+ letterSpacing: string;
39
+ };
40
+ semiBoldLabelM: {
41
+ fontSize: string;
42
+ lineHeight: string;
43
+ fontWeight: number;
44
+ letterSpacing: string;
45
+ };
46
+ semiBoldLabelS: {
47
+ fontSize: string;
48
+ lineHeight: string;
49
+ fontWeight: number;
50
+ letterSpacing: string;
51
+ };
52
+ semiBoldLabelXs: {
53
+ fontSize: string;
54
+ lineHeight: string;
55
+ fontWeight: number;
56
+ letterSpacing: string;
57
+ };
58
+ semiBoldLabelXxs: {
59
+ fontSize: string;
60
+ lineHeight: string;
61
+ fontWeight: number;
62
+ letterSpacing: string;
63
+ };
64
+ regularLabelL: {
65
+ fontSize: string;
66
+ lineHeight: string;
67
+ fontWeight: number;
68
+ letterSpacing: string;
69
+ };
70
+ regularLabelM: {
71
+ fontSize: string;
72
+ lineHeight: string;
73
+ fontWeight: number;
74
+ letterSpacing: string;
75
+ };
76
+ regularLabelS: {
77
+ fontSize: string;
78
+ lineHeight: string;
79
+ fontWeight: number;
80
+ letterSpacing: string;
81
+ };
82
+ regularLabelXs: {
83
+ fontSize: string;
84
+ lineHeight: string;
85
+ fontWeight: number;
86
+ letterSpacing: string;
87
+ };
88
+ regularLabelXxs: {
89
+ fontSize: string;
90
+ lineHeight: string;
91
+ fontWeight: number;
92
+ letterSpacing: string;
93
+ };
94
+ textXl: {
95
+ fontSize: string;
96
+ fontWeight: number;
97
+ lineHeight: string;
98
+ letterSpacing: string;
99
+ };
100
+ textL: {
101
+ fontSize: string;
102
+ fontWeight: number;
103
+ lineHeight: string;
104
+ letterSpacing: string;
105
+ };
106
+ textM: {
107
+ fontSize: string;
108
+ fontWeight: number;
109
+ lineHeight: string;
110
+ letterSpacing: string;
111
+ };
112
+ subtextM: {
113
+ fontSize: string;
114
+ fontWeight: number;
115
+ lineHeight: string;
116
+ letterSpacing: string;
117
+ };
118
+ subtextS: {
119
+ fontSize: string;
120
+ fontWeight: number;
121
+ lineHeight: string;
122
+ letterSpacing: string;
123
+ };
124
+ semiBoldLinkXL: {
125
+ fontSize: string;
126
+ fontWeight: number;
127
+ lineHeight: string;
128
+ letterSpacing: string;
129
+ textDecoration: string;
130
+ };
131
+ semiBoldLinkL: {
132
+ fontSize: string;
133
+ fontWeight: number;
134
+ lineHeight: string;
135
+ letterSpacing: string;
136
+ textDecoration: string;
137
+ };
138
+ semiBoldLinkM: {
139
+ fontSize: string;
140
+ fontWeight: number;
141
+ lineHeight: string;
142
+ letterSpacing: string;
143
+ textDecoration: string;
144
+ };
145
+ semiBoldLinkS: {
146
+ fontSize: string;
147
+ fontWeight: number;
148
+ lineHeight: string;
149
+ letterSpacing: string;
150
+ textDecoration: string;
151
+ };
152
+ semiBoldLinkXs: {
153
+ fontSize: string;
154
+ fontWeight: number;
155
+ lineHeight: string;
156
+ letterSpacing: string;
157
+ textDecoration: string;
158
+ };
159
+ regularLinkXL: {
160
+ fontSize: string;
161
+ fontWeight: number;
162
+ lineHeight: string;
163
+ letterSpacing: string;
164
+ textDecoration: string;
165
+ };
166
+ regularLinkL: {
167
+ fontSize: string;
168
+ fontWeight: number;
169
+ lineHeight: string;
170
+ letterSpacing: string;
171
+ textDecoration: string;
172
+ };
173
+ h1: {
174
+ fontSize: string;
175
+ fontWeight: number;
176
+ lineHeight: string;
177
+ };
178
+ h2: {
179
+ fontSize: string;
180
+ fontWeight: number;
181
+ lineHeight: string;
182
+ };
183
+ h3: {
184
+ fontSize: string;
185
+ fontWeight: number;
186
+ lineHeight: string;
187
+ };
188
+ h4: {
189
+ fontSize: string;
190
+ fontWeight: number;
191
+ lineHeight: string;
192
+ };
193
+ h5: {
194
+ fontSize: string;
195
+ fontWeight: number;
196
+ lineHeight: string;
197
+ };
198
+ headline: {
199
+ fontSize: string;
200
+ fontWeight: number;
201
+ lineHeight: string;
202
+ };
203
+ body: {
204
+ fontSize: string;
205
+ lineHeight: string;
206
+ fontWeight: number;
207
+ };
208
+ callout: {
209
+ fontSize: string;
210
+ fontWeight: number;
211
+ lineHeight: string;
212
+ };
213
+ subHeadline1: {
214
+ fontSize: string;
215
+ lineHeight: string;
216
+ fontWeight: number;
217
+ };
218
+ subHeadline2: {
219
+ fontSize: string;
220
+ lineHeight: string;
221
+ fontWeight: number;
222
+ };
223
+ footNote: {
224
+ fontSize: string;
225
+ lineHeight: string;
226
+ fontWeight: number;
227
+ };
228
+ caption1: {
229
+ fontSize: string;
230
+ lineHeight: string;
231
+ fontWeight: number;
232
+ };
233
+ caption2: {
234
+ fontSize: string;
235
+ lineHeight: string;
236
+ fontWeight: number;
237
+ };
238
+ };
239
+ export declare const muiTheme: Theme;
@@ -0,0 +1,9 @@
1
+ export declare const textStyles: {
2
+ fontWeight: {
3
+ semibold: number;
4
+ regular: number;
5
+ };
6
+ letterSpacing: {
7
+ default: string;
8
+ };
9
+ };
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/viplatform/mui-dialog/issues"
8
8
  },
9
9
  "homepage": "https://github.com/viplatform/mui-dialog#readme",
10
- "version": "1.0.12",
10
+ "version": "1.0.14",
11
11
  "files": [
12
12
  "dist"
13
13
  ],