@openlettermarketing/olc-react-sdk 2.1.6 → 2.1.8
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/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/types/version.d.ts +1 -1
- package/package.json +7 -6
- package/.eslintignore +0 -1
- package/.eslintrc.cjs +0 -18
- package/.eslintrc.yml +0 -47
- package/.github/workflows/publish-beta.yml +0 -154
- package/.github/workflows/publish-production.yml +0 -143
- package/.prettierignore +0 -3
- package/.prettierrc.yml +0 -5
- package/CHANGELOG.md +0 -4
- package/babel.config.json +0 -10
- package/examples/.eslintrc.yml +0 -4
- package/index.html +0 -18
- package/public/vite.svg +0 -1
- package/src/App.tsx +0 -209
- package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
- package/src/assets/images/create-template/prebuilt.svg +0 -13
- package/src/assets/images/create-template/scratch.svg +0 -4
- package/src/assets/images/input/cancel.tsx +0 -20
- package/src/assets/images/input/search.tsx +0 -20
- package/src/assets/images/input/select-cancel.tsx +0 -17
- package/src/assets/images/modal-icons/add.tsx +0 -36
- package/src/assets/images/modal-icons/cancel-file.tsx +0 -12
- package/src/assets/images/modal-icons/cancel-input.tsx +0 -13
- package/src/assets/images/modal-icons/cancel.tsx +0 -35
- package/src/assets/images/modal-icons/close-new.svg +0 -3
- package/src/assets/images/modal-icons/confirm-close-icon.tsx +0 -14
- package/src/assets/images/modal-icons/confirm-new.tsx +0 -22
- package/src/assets/images/modal-icons/confirm.svg +0 -12
- package/src/assets/images/modal-icons/cross.tsx +0 -23
- package/src/assets/images/modal-icons/del.tsx +0 -19
- package/src/assets/images/modal-icons/design-icon.tsx +0 -22
- package/src/assets/images/modal-icons/doc.tsx +0 -43
- package/src/assets/images/modal-icons/docx.tsx +0 -43
- package/src/assets/images/modal-icons/envelope-icon.tsx +0 -26
- package/src/assets/images/modal-icons/info.tsx +0 -19
- package/src/assets/images/modal-icons/jpeg.tsx +0 -43
- package/src/assets/images/modal-icons/jpg.tsx +0 -43
- package/src/assets/images/modal-icons/modal-cros.svg +0 -4
- package/src/assets/images/modal-icons/modal-cross.tsx +0 -37
- package/src/assets/images/modal-icons/new-cancel.tsx +0 -11
- package/src/assets/images/modal-icons/order-download.tsx +0 -42
- package/src/assets/images/modal-icons/pdf.tsx +0 -51
- package/src/assets/images/modal-icons/png.tsx +0 -43
- package/src/assets/images/modal-icons/save.tsx +0 -23
- package/src/assets/images/modal-icons/template-copy.tsx +0 -25
- package/src/assets/images/modal-icons/tool-cancel.tsx +0 -25
- package/src/assets/images/products/bi-new.svg +0 -23
- package/src/assets/images/products/left-arrow.svg +0 -17
- package/src/assets/images/products/personal-new.tsx +0 -31
- package/src/assets/images/products/postcard-new.tsx +0 -27
- package/src/assets/images/products/professional-new.tsx +0 -24
- package/src/assets/images/products/real-new.tsx +0 -30
- package/src/assets/images/products/right-arrow.svg +0 -17
- package/src/assets/images/products/snap-new.svg +0 -31
- package/src/assets/images/templates/actions.svg +0 -3
- package/src/assets/images/templates/address-block-icon.tsx +0 -62
- package/src/assets/images/templates/archive.svg +0 -3
- package/src/assets/images/templates/arrow-down.tsx +0 -27
- package/src/assets/images/templates/back-arrow.tsx +0 -19
- package/src/assets/images/templates/bi-fold-self-mailers.tsx +0 -28
- package/src/assets/images/templates/check.svg +0 -3
- package/src/assets/images/templates/code.svg +0 -10
- package/src/assets/images/templates/content-copy-icon.tsx +0 -24
- package/src/assets/images/templates/custom-add-on-icon.tsx +0 -18
- package/src/assets/images/templates/custom-qr-section-icon.tsx +0 -9
- package/src/assets/images/templates/custom-template.tsx +0 -23
- package/src/assets/images/templates/designer.tsx +0 -43
- package/src/assets/images/templates/dot.tsx +0 -22
- package/src/assets/images/templates/download-v2.svg +0 -4
- package/src/assets/images/templates/download.svg +0 -4
- package/src/assets/images/templates/dummy-template.tsx +0 -76
- package/src/assets/images/templates/dynamic-field.tsx +0 -119
- package/src/assets/images/templates/edit-pencil-icon.tsx +0 -21
- package/src/assets/images/templates/edit.svg +0 -3
- package/src/assets/images/templates/epo-icon.tsx +0 -16
- package/src/assets/images/templates/field.tsx +0 -29
- package/src/assets/images/templates/gsv-icon.tsx +0 -31
- package/src/assets/images/templates/info-icon.tsx +0 -37
- package/src/assets/images/templates/left-arrow.svg +0 -17
- package/src/assets/images/templates/pencil.svg +0 -3
- package/src/assets/images/templates/personal-letter.tsx +0 -53
- package/src/assets/images/templates/postcard.tsx +0 -32
- package/src/assets/images/templates/professional-letter.tsx +0 -53
- package/src/assets/images/templates/qr-code.tsx +0 -13
- package/src/assets/images/templates/real-penned-letters.tsx +0 -57
- package/src/assets/images/templates/right-arrow.svg +0 -17
- package/src/assets/images/templates/size-image-lg.tsx +0 -20
- package/src/assets/images/templates/size-image-mid.tsx +0 -20
- package/src/assets/images/templates/size-image-xl.tsx +0 -20
- package/src/assets/images/templates/size-image.tsx +0 -20
- package/src/assets/images/templates/snap-pack.tsx +0 -67
- package/src/assets/images/templates/template-default-design.tsx +0 -21
- package/src/assets/images/templates/trash-upload.svg +0 -3
- package/src/assets/images/templates/trash.svg +0 -3
- package/src/assets/images/templates/tri-fold-self-mailers.tsx +0 -93
- package/src/assets/images/templates/upload-image.svg +0 -10
- package/src/assets/images/templates/x.svg +0 -3
- package/src/assets/images/thumbnails/one.svg +0 -9
- package/src/assets/images/tooltip/tool-arrow.tsx +0 -25
- package/src/components/CreateTemplate/V2/index.tsx +0 -527
- package/src/components/CreateTemplate/V2/styles.scss +0 -372
- package/src/components/CreateTemplate/index.tsx +0 -508
- package/src/components/CreateTemplate/styles.scss +0 -404
- package/src/components/GenericUIBlocks/Button/index.tsx +0 -54
- package/src/components/GenericUIBlocks/Button/styles.scss +0 -43
- package/src/components/GenericUIBlocks/CircularProgress/index.tsx +0 -18
- package/src/components/GenericUIBlocks/CircularProgress/styles.scss +0 -93
- package/src/components/GenericUIBlocks/CustomTooltip/index.tsx +0 -88
- package/src/components/GenericUIBlocks/CustomTooltip/styles.scss +0 -19
- package/src/components/GenericUIBlocks/Dialog/V2/index.tsx +0 -227
- package/src/components/GenericUIBlocks/Dialog/V2/styles.scss +0 -289
- package/src/components/GenericUIBlocks/Dialog/index.tsx +0 -185
- package/src/components/GenericUIBlocks/Dialog/styles.scss +0 -227
- package/src/components/GenericUIBlocks/Divider/index.tsx +0 -12
- package/src/components/GenericUIBlocks/Divider/styles.scss +0 -7
- package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +0 -114
- package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +0 -406
- package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +0 -25
- package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +0 -20
- package/src/components/GenericUIBlocks/GenericSnackbar/Toast/index.tsx +0 -91
- package/src/components/GenericUIBlocks/GenericSnackbar/Toast/styles.scss +0 -92
- package/src/components/GenericUIBlocks/Grid/index.tsx +0 -82
- package/src/components/GenericUIBlocks/Input/index.tsx +0 -269
- package/src/components/GenericUIBlocks/Input/styles.scss +0 -332
- package/src/components/GenericUIBlocks/Tabs/index.tsx +0 -71
- package/src/components/GenericUIBlocks/Tabs/styles.scss +0 -42
- package/src/components/GenericUIBlocks/Typography/index.tsx +0 -18
- package/src/components/GenericUIBlocks/Typography/styles.scss +0 -27
- package/src/components/SidePanel/CustomAddOns/index.tsx +0 -342
- package/src/components/SidePanel/CustomAddOns/styles.scss +0 -86
- package/src/components/SidePanel/CustomBlockColors/index.tsx +0 -211
- package/src/components/SidePanel/CustomBlockColors/styles.scss +0 -80
- package/src/components/SidePanel/CustomFields/customFieldSection.tsx +0 -547
- package/src/components/SidePanel/CustomFields/styles.scss +0 -64
- package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/index.tsx +0 -172
- package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/styles.scss +0 -46
- package/src/components/SidePanel/CustomQRCode/index.tsx +0 -1070
- package/src/components/SidePanel/CustomQRCode/styles.scss +0 -149
- package/src/components/SidePanel/CustomUploads/V2/index.tsx +0 -542
- package/src/components/SidePanel/CustomUploads/V2/styles.scss +0 -267
- package/src/components/SidePanel/CustomUploads/index.tsx +0 -301
- package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/index.tsx +0 -424
- package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/styles.scss +0 -180
- package/src/components/SidePanel/Templates/ModalGallery/V2/index.tsx +0 -235
- package/src/components/SidePanel/Templates/ModalGallery/V2/styles.scss +0 -244
- package/src/components/SidePanel/Templates/ModalGallery/index.tsx +0 -231
- package/src/components/SidePanel/Templates/SideBarGallery/index.tsx +0 -233
- package/src/components/SidePanel/Templates/SideBarGallery/styles.scss +0 -152
- package/src/components/SidePanel/Templates/TemplatesCard/V2/index.tsx +0 -149
- package/src/components/SidePanel/Templates/TemplatesCard/V2/styles.scss +0 -156
- package/src/components/SidePanel/Templates/TemplatesCard/index.tsx +0 -160
- package/src/components/SidePanel/Templates/TemplatesCard/styles.scss +0 -98
- package/src/components/SidePanel/Templates/customTemplateSection.tsx +0 -793
- package/src/components/SidePanel/Templates/styles.scss +0 -244
- package/src/components/SidePanel/index.tsx +0 -160
- package/src/components/TemplateBuilder/index.tsx +0 -585
- package/src/components/TemplateBuilder/styles.scss +0 -100
- package/src/components/TemplateTypes/index.tsx +0 -96
- package/src/components/TemplateTypes/styles.scss +0 -91
- package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +0 -81
- package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +0 -123
- package/src/components/TopNavigation/DuplicateTemplateModal.tsx +0 -103
- package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +0 -71
- package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +0 -88
- package/src/components/TopNavigation/SaveTemplateModel/index.tsx +0 -201
- package/src/components/TopNavigation/SaveTemplateModel/styles.scss +0 -128
- package/src/components/TopNavigation/index.tsx +0 -938
- package/src/components/TopNavigation/styles.scss +0 -303
- package/src/importMeta.d.ts +0 -31
- package/src/index.scss +0 -131
- package/src/index.tsx +0 -238
- package/src/libs/test.ts +0 -7
- package/src/redux/actions/action-types.ts +0 -52
- package/src/redux/actions/customQRCodeActions.ts +0 -54
- package/src/redux/actions/snackbarActions.ts +0 -16
- package/src/redux/actions/templateActions.ts +0 -236
- package/src/redux/reducers/customFieldReducer.ts +0 -99
- package/src/redux/reducers/customQRCodeReducer.ts +0 -58
- package/src/redux/reducers/index.ts +0 -15
- package/src/redux/reducers/snackbarReducer.ts +0 -40
- package/src/redux/reducers/templateReducer.ts +0 -485
- package/src/redux/store.ts +0 -18
- package/src/styles/colors.scss +0 -61
- package/src/test/mocks.js +0 -89
- package/src/test/setupJest.js +0 -1
- package/src/utils/api.ts +0 -36
- package/src/utils/constants.ts +0 -182
- package/src/utils/customStyles.ts +0 -45
- package/src/utils/fetchWrapper.ts +0 -73
- package/src/utils/fonts.json +0 -1597
- package/src/utils/helper.ts +0 -205
- package/src/utils/local-storage.ts +0 -15
- package/src/utils/message.ts +0 -162
- package/src/utils/products.ts +0 -186
- package/src/utils/template-builder.ts +0 -328
- package/src/utils/templateIdentifierArea/biFold.ts +0 -107
- package/src/utils/templateIdentifierArea/index.ts +0 -35
- package/src/utils/templateIdentifierArea/personal.ts +0 -107
- package/src/utils/templateIdentifierArea/postCards.ts +0 -163
- package/src/utils/templateIdentifierArea/professional.ts +0 -125
- package/src/utils/templateIdentifierArea/snapPack.ts +0 -107
- package/src/utils/templateIdentifierArea/triFold.ts +0 -107
- package/src/utils/templateRestrictedArea/biFold.ts +0 -329
- package/src/utils/templateRestrictedArea/nonWindowProfessional.ts +0 -90
- package/src/utils/templateRestrictedArea/personal.ts +0 -90
- package/src/utils/templateRestrictedArea/postCard.ts +0 -334
- package/src/utils/templateRestrictedArea/postCardJumbo.tsx +0 -408
- package/src/utils/templateRestrictedArea/professional.ts +0 -318
- package/src/utils/templateRestrictedArea/realPenned.ts +0 -233
- package/src/utils/templateRestrictedArea/snapPack.ts +0 -1009
- package/src/utils/templateRestrictedArea/triFold.ts +0 -330
- package/src/utils/templateSafetyBorders/biFold.ts +0 -91
- package/src/utils/templateSafetyBorders/index.ts +0 -43
- package/src/utils/templateSafetyBorders/personal.ts +0 -41
- package/src/utils/templateSafetyBorders/postCards.ts +0 -259
- package/src/utils/templateSafetyBorders/professional.ts +0 -78
- package/src/utils/templateSafetyBorders/snapPack.ts +0 -165
- package/src/utils/templateSafetyBorders/triFold.ts +0 -114
- package/src/utils/templateSafetyBorders/types.d.ts +0 -68
- package/src/utils/types.ts +0 -12
- package/src/v2Theme.scss +0 -142
- package/tsconfig.json +0 -29
- package/tsconfig.node.json +0 -12
- package/update-version.js +0 -23
- package/version.js +0 -1
- package/vite.config.ts +0 -8
- package/webpack.config.js +0 -80
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, CSSProperties, useRef, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
// components
|
|
4
|
-
import Typography from '../../Typography';
|
|
5
|
-
import CircularProgress from '../../CircularProgress';
|
|
6
|
-
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
import CloseNew from '../../../../assets/images/modal-icons/close-new.svg'
|
|
9
|
-
|
|
10
|
-
// styles
|
|
11
|
-
import './styles.scss';
|
|
12
|
-
|
|
13
|
-
interface DialogProps {
|
|
14
|
-
icon?: ReactNode;
|
|
15
|
-
customStyles?: CSSProperties;
|
|
16
|
-
open: boolean;
|
|
17
|
-
handleClose: () => void;
|
|
18
|
-
loading?: boolean;
|
|
19
|
-
title?: string | ReactNode;
|
|
20
|
-
subHeading?: string;
|
|
21
|
-
description?: string;
|
|
22
|
-
onSubmit?: () => void;
|
|
23
|
-
onCancel?: () => void;
|
|
24
|
-
cancelText?: string;
|
|
25
|
-
submitText?: string;
|
|
26
|
-
children?: ReactNode;
|
|
27
|
-
isGallery?: boolean;
|
|
28
|
-
currentTheme?: string | null | undefined;
|
|
29
|
-
isQRCode?: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const buttonStyles: CSSProperties = {
|
|
33
|
-
color: '#fff',
|
|
34
|
-
backgroundColor: 'var(--primary-color)',
|
|
35
|
-
maxWidth: '100%',
|
|
36
|
-
minHeight: '50px',
|
|
37
|
-
border: '0.5px solid var(--border-color)',
|
|
38
|
-
fontSize: '14px',
|
|
39
|
-
borderRadius: '8px'
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const heading: CSSProperties = {
|
|
43
|
-
color: '#000',
|
|
44
|
-
fontWeight: '600',
|
|
45
|
-
textAlign: 'center',
|
|
46
|
-
margin: '0',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const subHeadingStyle: CSSProperties = {
|
|
50
|
-
fontSize: '16px',
|
|
51
|
-
color: '#656565',
|
|
52
|
-
fontWeight: '400',
|
|
53
|
-
textAlign: 'center',
|
|
54
|
-
width: '100%',
|
|
55
|
-
maxWidth: '400px',
|
|
56
|
-
margin: '0',
|
|
57
|
-
fontFamily: 'var(--font-family)',
|
|
58
|
-
lineHeight: '20px',
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const progressStyles: CSSProperties = {
|
|
62
|
-
width: '20px',
|
|
63
|
-
height: '20px',
|
|
64
|
-
border: '2px solid #fff',
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const DialogV2: React.FC<DialogProps> = ({
|
|
68
|
-
icon = null,
|
|
69
|
-
customStyles = {},
|
|
70
|
-
open,
|
|
71
|
-
handleClose,
|
|
72
|
-
loading = false,
|
|
73
|
-
title = "",
|
|
74
|
-
subHeading = "",
|
|
75
|
-
description = "",
|
|
76
|
-
onSubmit,
|
|
77
|
-
onCancel,
|
|
78
|
-
cancelText = "",
|
|
79
|
-
submitText = "",
|
|
80
|
-
children = [],
|
|
81
|
-
isGallery = false,
|
|
82
|
-
currentTheme = "default",
|
|
83
|
-
isQRCode = false
|
|
84
|
-
}) => {
|
|
85
|
-
const contentAdjust = submitText.length > 6 ? "fit-content" : "100px";
|
|
86
|
-
|
|
87
|
-
const modalRef = useRef<HTMLDivElement>(null);
|
|
88
|
-
|
|
89
|
-
const handleClickOutside = (event: MouseEvent) => {
|
|
90
|
-
if (modalRef.current && !modalRef.current.contains(event.target as Node)) {
|
|
91
|
-
handleClose();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
96
|
-
if (event.key === 'Escape' && !loading) {
|
|
97
|
-
handleClose();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
if (open) {
|
|
103
|
-
// document.addEventListener('mousedown', handleClickOutside);
|
|
104
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
105
|
-
} else {
|
|
106
|
-
// document.removeEventListener('mousedown', handleClickOutside);
|
|
107
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return () => {
|
|
111
|
-
// document.removeEventListener('mousedown', handleClickOutside);
|
|
112
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
113
|
-
};
|
|
114
|
-
}, [open]);
|
|
115
|
-
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
const handleCopy = (event: KeyboardEvent) => {
|
|
118
|
-
if ((event.metaKey || event.ctrlKey) && event.key === 'c') {
|
|
119
|
-
event.stopPropagation();
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
document.addEventListener('keydown', handleCopy, true);
|
|
124
|
-
|
|
125
|
-
return () => {
|
|
126
|
-
document.removeEventListener('keydown', handleCopy, true);
|
|
127
|
-
};
|
|
128
|
-
}, []);
|
|
129
|
-
|
|
130
|
-
return (
|
|
131
|
-
<>
|
|
132
|
-
{
|
|
133
|
-
isGallery || isQRCode ? (
|
|
134
|
-
<div
|
|
135
|
-
id="myModal"
|
|
136
|
-
className={`modal-v2 ${isGallery && 'galleryModal'}`}
|
|
137
|
-
style={{ display: open ? 'flex' : 'none' }}
|
|
138
|
-
>
|
|
139
|
-
<div className="modal-content" style={customStyles} ref={modalRef}>
|
|
140
|
-
<div className="modal-header" style={{ paddingRight: !isQRCode ? '40px' : '0' }}>
|
|
141
|
-
<Typography variant="p" style={{ ...heading, fontSize: "20px" }}>
|
|
142
|
-
{title}
|
|
143
|
-
</Typography>
|
|
144
|
-
<img src={CloseNew} alt="close" onClick={handleClose} />
|
|
145
|
-
</div>
|
|
146
|
-
<div className="modal-body">
|
|
147
|
-
{icon && <div className="modal-icon">{icon}</div>}
|
|
148
|
-
{subHeading && (
|
|
149
|
-
<Typography variant="p" style={subHeadingStyle}>
|
|
150
|
-
{subHeading}
|
|
151
|
-
</Typography>
|
|
152
|
-
)}
|
|
153
|
-
{description && (
|
|
154
|
-
<Typography
|
|
155
|
-
variant="p"
|
|
156
|
-
style={subHeadingStyle}
|
|
157
|
-
>
|
|
158
|
-
{description}
|
|
159
|
-
</Typography>
|
|
160
|
-
)}
|
|
161
|
-
{children}
|
|
162
|
-
<div className="modal-footer">
|
|
163
|
-
{(!isGallery || isQRCode) &&
|
|
164
|
-
<>
|
|
165
|
-
<button onClick={onSubmit} disabled={loading}>
|
|
166
|
-
{loading ? <CircularProgress style={progressStyles} /> : submitText}
|
|
167
|
-
</button>
|
|
168
|
-
<button onClick={onCancel}>
|
|
169
|
-
{cancelText}
|
|
170
|
-
</button>
|
|
171
|
-
</>
|
|
172
|
-
}
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
</div>
|
|
176
|
-
</div>
|
|
177
|
-
) : (
|
|
178
|
-
<div
|
|
179
|
-
id="myModal"
|
|
180
|
-
className={`confirm-modal-v2 ${isGallery && 'galleryModal'}`}
|
|
181
|
-
style={{ display: open ? 'flex' : 'none' }}
|
|
182
|
-
>
|
|
183
|
-
<div className="confirm-modal-content" style={customStyles} ref={modalRef}>
|
|
184
|
-
<div className="confirm-modal-header">
|
|
185
|
-
{icon && <div className="confirm-modal-icon">{icon}</div>}
|
|
186
|
-
<Typography variant="p" style={{ ...heading, fontSize: "24px", lineHeight: "24px" }}>
|
|
187
|
-
{title}
|
|
188
|
-
</Typography>
|
|
189
|
-
<img src={CloseNew} className="confirm-modal-close" alt="close" onClick={handleClose} />
|
|
190
|
-
</div>
|
|
191
|
-
<div className="confirm-modal-body">
|
|
192
|
-
{subHeading && (
|
|
193
|
-
<Typography variant="p" style={subHeadingStyle}>
|
|
194
|
-
{subHeading}
|
|
195
|
-
</Typography>
|
|
196
|
-
)}
|
|
197
|
-
{description && (
|
|
198
|
-
<Typography
|
|
199
|
-
variant="p"
|
|
200
|
-
style={subHeadingStyle}
|
|
201
|
-
>
|
|
202
|
-
{description}
|
|
203
|
-
</Typography>
|
|
204
|
-
)}
|
|
205
|
-
{children}
|
|
206
|
-
<div className="confirm-modal-footer">
|
|
207
|
-
{!isGallery &&
|
|
208
|
-
<>
|
|
209
|
-
<button onClick={onSubmit} disabled={loading}>
|
|
210
|
-
{loading ? <CircularProgress style={progressStyles} /> : submitText}
|
|
211
|
-
</button>
|
|
212
|
-
<button onClick={onCancel}>
|
|
213
|
-
{cancelText}
|
|
214
|
-
</button>
|
|
215
|
-
</>
|
|
216
|
-
}
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
)
|
|
222
|
-
}
|
|
223
|
-
</>
|
|
224
|
-
);
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
export default DialogV2;
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
.modal-v2 {
|
|
2
|
-
display: none;
|
|
3
|
-
justify-content: center;
|
|
4
|
-
align-items: center;
|
|
5
|
-
position: fixed;
|
|
6
|
-
z-index: 99999;
|
|
7
|
-
left: 0;
|
|
8
|
-
top: 0;
|
|
9
|
-
width: 100%;
|
|
10
|
-
height: 100%;
|
|
11
|
-
overflow: hidden !important;
|
|
12
|
-
background-color: rgb(0 0 0 / 60%);
|
|
13
|
-
|
|
14
|
-
.modal-content {
|
|
15
|
-
position: relative;
|
|
16
|
-
background-color: #fff;
|
|
17
|
-
margin: auto;
|
|
18
|
-
padding: 0;
|
|
19
|
-
border: 1px solid #888;
|
|
20
|
-
width: 80%;
|
|
21
|
-
max-height: 90%;
|
|
22
|
-
box-shadow:
|
|
23
|
-
0 4px 8px 0 rgba(0, 0, 0, 0.2),
|
|
24
|
-
0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
25
|
-
-webkit-animation-name: animatetop;
|
|
26
|
-
-webkit-animation-duration: 0.4s;
|
|
27
|
-
animation-name: animatetop;
|
|
28
|
-
animation-duration: 0.4s;
|
|
29
|
-
border-radius: 11px;
|
|
30
|
-
|
|
31
|
-
.modal-header {
|
|
32
|
-
display: flex;
|
|
33
|
-
justify-content: space-between;
|
|
34
|
-
align-items: center;
|
|
35
|
-
height: 100%;
|
|
36
|
-
min-height: 20px;
|
|
37
|
-
color: var(--text-color);
|
|
38
|
-
|
|
39
|
-
img{
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
transition: all 0.3s ease;
|
|
42
|
-
|
|
43
|
-
&:hover{
|
|
44
|
-
opacity: 0.8;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.modal-body {
|
|
50
|
-
padding: 0;
|
|
51
|
-
display: flex;
|
|
52
|
-
justify-content: center;
|
|
53
|
-
align-items: center;
|
|
54
|
-
flex-direction: column;
|
|
55
|
-
color: var(--text-color);
|
|
56
|
-
|
|
57
|
-
.modal-icon {
|
|
58
|
-
width: 100%;
|
|
59
|
-
max-width: 60px;
|
|
60
|
-
height: 100%;
|
|
61
|
-
max-height: 59px;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.modal-footer {
|
|
66
|
-
color: var(--text-color);
|
|
67
|
-
width: 100%;
|
|
68
|
-
display: flex;
|
|
69
|
-
justify-content: center;
|
|
70
|
-
align-items: center;
|
|
71
|
-
gap: 16px;
|
|
72
|
-
|
|
73
|
-
button{
|
|
74
|
-
min-height: 50px;
|
|
75
|
-
font-size: 16px;
|
|
76
|
-
font-weight: 600;
|
|
77
|
-
border-radius: 8px;
|
|
78
|
-
width: 100%;
|
|
79
|
-
font-family: var(--font-family);
|
|
80
|
-
cursor: pointer;
|
|
81
|
-
transition: all 0.3s ease;
|
|
82
|
-
|
|
83
|
-
&:focus{
|
|
84
|
-
outline: none !important;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&:first-child{
|
|
88
|
-
background-color: var(--primary-color);
|
|
89
|
-
color: #fff;
|
|
90
|
-
border: none;
|
|
91
|
-
display: flex;
|
|
92
|
-
justify-content: center;
|
|
93
|
-
align-items: center;
|
|
94
|
-
|
|
95
|
-
&:hover{
|
|
96
|
-
background-color: var(--primary-color-btn-hover);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
&:last-child{
|
|
101
|
-
color: var(--text-color);
|
|
102
|
-
background-color: #F1F1F1;
|
|
103
|
-
border: none;
|
|
104
|
-
border: 0.5px solid #F1F1F1;
|
|
105
|
-
|
|
106
|
-
&:hover{
|
|
107
|
-
background-color: #FFFFFF;
|
|
108
|
-
border: 0.5px solid rgba(0, 0, 0, 0.24);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
@-webkit-keyframes animatetop {
|
|
116
|
-
from {
|
|
117
|
-
top: -300px;
|
|
118
|
-
opacity: 0;
|
|
119
|
-
}
|
|
120
|
-
to {
|
|
121
|
-
top: 0;
|
|
122
|
-
opacity: 1;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@keyframes animatetop {
|
|
127
|
-
from {
|
|
128
|
-
top: -300px;
|
|
129
|
-
opacity: 0;
|
|
130
|
-
}
|
|
131
|
-
to {
|
|
132
|
-
top: 0;
|
|
133
|
-
opacity: 1;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
.confirm-modal-v2 {
|
|
141
|
-
display: none;
|
|
142
|
-
justify-content: center;
|
|
143
|
-
align-items: center;
|
|
144
|
-
position: fixed;
|
|
145
|
-
z-index: 99999;
|
|
146
|
-
left: 0;
|
|
147
|
-
top: 0;
|
|
148
|
-
width: 100%;
|
|
149
|
-
height: 100%;
|
|
150
|
-
overflow: hidden !important;
|
|
151
|
-
background-color: rgb(0 0 0 / 60%);
|
|
152
|
-
|
|
153
|
-
.confirm-modal-content {
|
|
154
|
-
position: relative;
|
|
155
|
-
background-color: #fff;
|
|
156
|
-
margin: auto;
|
|
157
|
-
padding: 0;
|
|
158
|
-
border: 1px solid #888;
|
|
159
|
-
width: 80%;
|
|
160
|
-
max-height: 90%;
|
|
161
|
-
overflow-y: auto;
|
|
162
|
-
box-shadow:
|
|
163
|
-
0 4px 8px 0 rgba(0, 0, 0, 0.2),
|
|
164
|
-
0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
165
|
-
-webkit-animation-name: animatetop;
|
|
166
|
-
-webkit-animation-duration: 0.4s;
|
|
167
|
-
animation-name: animatetop;
|
|
168
|
-
animation-duration: 0.4s;
|
|
169
|
-
border-radius: 11px;
|
|
170
|
-
|
|
171
|
-
.confirm-modal-header {
|
|
172
|
-
display: flex;
|
|
173
|
-
justify-content: space-between;
|
|
174
|
-
align-items: center;
|
|
175
|
-
flex-direction: column;
|
|
176
|
-
gap: 16px;
|
|
177
|
-
height: 100%;
|
|
178
|
-
min-height: 20px;
|
|
179
|
-
color: var(--text-color);
|
|
180
|
-
position: relative;
|
|
181
|
-
|
|
182
|
-
.confirm-modal-close{
|
|
183
|
-
position: absolute;
|
|
184
|
-
right: -25px;
|
|
185
|
-
top: -25px;
|
|
186
|
-
cursor: pointer;
|
|
187
|
-
transition: all 0.3s ease;
|
|
188
|
-
|
|
189
|
-
&:hover{
|
|
190
|
-
opacity: 0.8;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.confirm-modal-icon {
|
|
195
|
-
width: 100%;
|
|
196
|
-
max-width: 60px;
|
|
197
|
-
height: 100%;
|
|
198
|
-
min-height: 59px;
|
|
199
|
-
display: flex;
|
|
200
|
-
justify-content: center;
|
|
201
|
-
align-items: center;
|
|
202
|
-
border-radius: 50%;
|
|
203
|
-
background-color: var(--modal-svg-bg);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.confirm-modal-body {
|
|
208
|
-
padding: 0;
|
|
209
|
-
display: flex;
|
|
210
|
-
justify-content: center;
|
|
211
|
-
align-items: center;
|
|
212
|
-
flex-direction: column;
|
|
213
|
-
color: var(--text-color);
|
|
214
|
-
margin-top: 16px;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.confirm-modal-footer {
|
|
218
|
-
color: var(--text-color);
|
|
219
|
-
width: 100%;
|
|
220
|
-
display: flex;
|
|
221
|
-
justify-content: center;
|
|
222
|
-
align-items: center;
|
|
223
|
-
gap: 12px;
|
|
224
|
-
margin-top: 16px;
|
|
225
|
-
|
|
226
|
-
button{
|
|
227
|
-
min-height: 50px;
|
|
228
|
-
font-size: 16px;
|
|
229
|
-
font-weight: 600;
|
|
230
|
-
border-radius: 8px;
|
|
231
|
-
width: 100%;
|
|
232
|
-
font-family: var(--font-family);
|
|
233
|
-
cursor: pointer;
|
|
234
|
-
transition: all 0.3s ease;
|
|
235
|
-
|
|
236
|
-
&:focus{
|
|
237
|
-
outline: none !important;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
&:first-child{
|
|
241
|
-
background-color: var(--primary-color);
|
|
242
|
-
color: #fff;
|
|
243
|
-
border: none;
|
|
244
|
-
display: flex;
|
|
245
|
-
justify-content: center;
|
|
246
|
-
align-items: center;
|
|
247
|
-
|
|
248
|
-
&:hover{
|
|
249
|
-
background-color: var(--primary-color-btn-hover);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
&:last-child{
|
|
254
|
-
color: var(--text-color);
|
|
255
|
-
background-color: #F1F1F1;
|
|
256
|
-
border: none;
|
|
257
|
-
border: 0.5px solid #F1F1F1;
|
|
258
|
-
|
|
259
|
-
&:hover{
|
|
260
|
-
background-color: #FFFFFF;
|
|
261
|
-
border: 0.5px solid rgba(0, 0, 0, 0.24);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
@-webkit-keyframes animatetop {
|
|
269
|
-
from {
|
|
270
|
-
top: -300px;
|
|
271
|
-
opacity: 0;
|
|
272
|
-
}
|
|
273
|
-
to {
|
|
274
|
-
top: 0;
|
|
275
|
-
opacity: 1;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
@keyframes animatetop {
|
|
280
|
-
from {
|
|
281
|
-
top: -300px;
|
|
282
|
-
opacity: 0;
|
|
283
|
-
}
|
|
284
|
-
to {
|
|
285
|
-
top: 0;
|
|
286
|
-
opacity: 1;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, CSSProperties, useRef, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
// components
|
|
4
|
-
import Button from '../Button';
|
|
5
|
-
import Typography from '../Typography';
|
|
6
|
-
import CircularProgress from '../CircularProgress';
|
|
7
|
-
|
|
8
|
-
// cross-icon
|
|
9
|
-
import Cross from '../../../assets/images/modal-icons/cross'
|
|
10
|
-
import NewCancel from '../../../assets/images/modal-icons/new-cancel'
|
|
11
|
-
|
|
12
|
-
// styles
|
|
13
|
-
import './styles.scss';
|
|
14
|
-
|
|
15
|
-
interface DialogProps {
|
|
16
|
-
icon?: ReactNode;
|
|
17
|
-
customStyles?: CSSProperties;
|
|
18
|
-
open: boolean;
|
|
19
|
-
handleClose: () => void;
|
|
20
|
-
loading?: boolean;
|
|
21
|
-
title?: string | ReactNode;
|
|
22
|
-
subHeading?: string;
|
|
23
|
-
description?: string;
|
|
24
|
-
onSubmit?: () => void;
|
|
25
|
-
onCancel?: () => void;
|
|
26
|
-
cancelText?: string;
|
|
27
|
-
submitText?: string;
|
|
28
|
-
children?: ReactNode;
|
|
29
|
-
isGallery?: boolean;
|
|
30
|
-
currentTheme?: string | null | undefined;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const buttonStyles: CSSProperties = {
|
|
34
|
-
color: '#fff',
|
|
35
|
-
backgroundColor: 'var(--primary-color)',
|
|
36
|
-
maxWidth: '100px',
|
|
37
|
-
minHeight: '40px',
|
|
38
|
-
border: '0.5px solid var(--border-color)',
|
|
39
|
-
fontSize: '14px',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const heading: CSSProperties = {
|
|
43
|
-
color: 'var(--primary-color)',
|
|
44
|
-
fontWeight: '600',
|
|
45
|
-
textAlign: 'center',
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const subHeadingStyle: CSSProperties = {
|
|
49
|
-
fontSize: '16px',
|
|
50
|
-
color: 'var(--text-color)',
|
|
51
|
-
fontWeight: '600',
|
|
52
|
-
textAlign: 'center',
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const progressStyles: CSSProperties = {
|
|
56
|
-
width: '20px',
|
|
57
|
-
height: '20px',
|
|
58
|
-
border: '2px solid #fff',
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const Dialog: React.FC<DialogProps> = ({
|
|
62
|
-
icon = null,
|
|
63
|
-
customStyles = {},
|
|
64
|
-
open,
|
|
65
|
-
handleClose,
|
|
66
|
-
loading = false,
|
|
67
|
-
title = "",
|
|
68
|
-
subHeading = "",
|
|
69
|
-
description = "",
|
|
70
|
-
onSubmit,
|
|
71
|
-
onCancel,
|
|
72
|
-
cancelText = "",
|
|
73
|
-
submitText = "",
|
|
74
|
-
children = [],
|
|
75
|
-
isGallery = false,
|
|
76
|
-
currentTheme = "default"
|
|
77
|
-
}) => {
|
|
78
|
-
const contentAdjust = submitText.length > 6 ? "fit-content" : "100px";
|
|
79
|
-
|
|
80
|
-
const modalRef = useRef<HTMLDivElement>(null);
|
|
81
|
-
|
|
82
|
-
const handleClickOutside = (event: MouseEvent) => {
|
|
83
|
-
if (modalRef.current && !modalRef.current.contains(event.target as Node)) {
|
|
84
|
-
handleClose();
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
89
|
-
if (event.key === 'Escape' && !loading) {
|
|
90
|
-
handleClose();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
if (open) {
|
|
96
|
-
// document.addEventListener('mousedown', handleClickOutside);
|
|
97
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
98
|
-
} else {
|
|
99
|
-
// document.removeEventListener('mousedown', handleClickOutside);
|
|
100
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return () => {
|
|
104
|
-
// document.removeEventListener('mousedown', handleClickOutside);
|
|
105
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
106
|
-
};
|
|
107
|
-
}, [open]);
|
|
108
|
-
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
const handleCopy = (event: KeyboardEvent) => {
|
|
111
|
-
if ((event.metaKey || event.ctrlKey) && event.key === 'c') {
|
|
112
|
-
event.stopPropagation();
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
document.addEventListener('keydown', handleCopy, true);
|
|
117
|
-
|
|
118
|
-
return () => {
|
|
119
|
-
document.removeEventListener('keydown', handleCopy, true);
|
|
120
|
-
};
|
|
121
|
-
}, []);
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<div
|
|
125
|
-
id="myModal"
|
|
126
|
-
className={`modal ${isGallery && 'galleryModal'}`}
|
|
127
|
-
style={{ display: open ? 'flex' : 'none' }}
|
|
128
|
-
>
|
|
129
|
-
<div className="modal-content" style={customStyles} ref={modalRef}>
|
|
130
|
-
<div className="modal-header">
|
|
131
|
-
<span className="close" onClick={handleClose}>
|
|
132
|
-
<Cross />
|
|
133
|
-
</span>
|
|
134
|
-
</div>
|
|
135
|
-
<div className="modal-body" style={{
|
|
136
|
-
padding: isGallery ? '0px' : "2px 16px"
|
|
137
|
-
}}>
|
|
138
|
-
{icon && <div className="modal-icon">{icon}</div>}
|
|
139
|
-
<Typography variant="p" style={{ ...heading, fontSize: isGallery ? "26px" : "22px" }}>
|
|
140
|
-
{title}
|
|
141
|
-
</Typography>
|
|
142
|
-
{subHeading && (
|
|
143
|
-
<Typography variant="p" style={subHeadingStyle}>
|
|
144
|
-
{subHeading}
|
|
145
|
-
</Typography>
|
|
146
|
-
)}
|
|
147
|
-
{description && (
|
|
148
|
-
<Typography
|
|
149
|
-
variant="p"
|
|
150
|
-
style={{ ...subHeadingStyle, fontWeight: '400', fontSize: '14px' }}
|
|
151
|
-
>
|
|
152
|
-
{description}
|
|
153
|
-
</Typography>
|
|
154
|
-
)}
|
|
155
|
-
{children}
|
|
156
|
-
</div>
|
|
157
|
-
<div className="modal-footer">
|
|
158
|
-
{!isGallery &&
|
|
159
|
-
<>
|
|
160
|
-
<Button
|
|
161
|
-
onClick={onCancel}
|
|
162
|
-
style={{
|
|
163
|
-
...buttonStyles,
|
|
164
|
-
color: 'var(--text-color)',
|
|
165
|
-
backgroundColor: '#fff',
|
|
166
|
-
}}
|
|
167
|
-
>
|
|
168
|
-
{cancelText}
|
|
169
|
-
</Button>
|
|
170
|
-
<Button
|
|
171
|
-
style={{ ...buttonStyles, border: 'none', maxWidth: contentAdjust }}
|
|
172
|
-
onClick={onSubmit}
|
|
173
|
-
disabled={loading}
|
|
174
|
-
>
|
|
175
|
-
{loading ? <CircularProgress style={progressStyles} /> : submitText}
|
|
176
|
-
</Button>
|
|
177
|
-
</>
|
|
178
|
-
}
|
|
179
|
-
</div>
|
|
180
|
-
</div>
|
|
181
|
-
</div>
|
|
182
|
-
);
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
export default Dialog;
|