@openlettermarketing/olc-react-sdk 2.1.4 → 2.1.5-beta.2
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/.eslintignore +1 -0
- package/.eslintrc.cjs +18 -0
- package/.eslintrc.yml +47 -0
- package/.github/workflows/publish-beta.yml +154 -0
- package/.github/workflows/publish-production.yml +143 -0
- package/.prettierignore +3 -0
- package/.prettierrc.yml +5 -0
- package/CHANGELOG.md +4 -0
- package/babel.config.json +10 -0
- package/build/index.js +82 -82
- package/build/index.js.map +1 -1
- package/build/types/version.d.ts +1 -1
- package/examples/.eslintrc.yml +4 -0
- package/index.html +18 -0
- package/package.json +1 -1
- package/public/vite.svg +1 -0
- package/src/App.tsx +209 -0
- package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
- package/src/assets/images/create-template/prebuilt.svg +13 -0
- package/src/assets/images/create-template/scratch.svg +4 -0
- package/src/assets/images/input/cancel.tsx +20 -0
- package/src/assets/images/input/search.tsx +20 -0
- package/src/assets/images/input/select-cancel.tsx +17 -0
- package/src/assets/images/modal-icons/add.tsx +36 -0
- package/src/assets/images/modal-icons/cancel-file.tsx +12 -0
- package/src/assets/images/modal-icons/cancel-input.tsx +13 -0
- package/src/assets/images/modal-icons/cancel.tsx +35 -0
- package/src/assets/images/modal-icons/close-new.svg +3 -0
- package/src/assets/images/modal-icons/confirm-close-icon.tsx +14 -0
- package/src/assets/images/modal-icons/confirm-new.tsx +22 -0
- package/src/assets/images/modal-icons/confirm.svg +12 -0
- package/src/assets/images/modal-icons/cross.tsx +23 -0
- package/src/assets/images/modal-icons/del.tsx +19 -0
- package/src/assets/images/modal-icons/design-icon.tsx +22 -0
- package/src/assets/images/modal-icons/doc.tsx +43 -0
- package/src/assets/images/modal-icons/docx.tsx +43 -0
- package/src/assets/images/modal-icons/envelope-icon.tsx +26 -0
- package/src/assets/images/modal-icons/info.tsx +19 -0
- package/src/assets/images/modal-icons/jpeg.tsx +43 -0
- package/src/assets/images/modal-icons/jpg.tsx +43 -0
- package/src/assets/images/modal-icons/modal-cros.svg +4 -0
- package/src/assets/images/modal-icons/modal-cross.tsx +37 -0
- package/src/assets/images/modal-icons/new-cancel.tsx +11 -0
- package/src/assets/images/modal-icons/order-download.tsx +42 -0
- package/src/assets/images/modal-icons/pdf.tsx +51 -0
- package/src/assets/images/modal-icons/png.tsx +43 -0
- package/src/assets/images/modal-icons/save.tsx +23 -0
- package/src/assets/images/modal-icons/template-copy.tsx +25 -0
- package/src/assets/images/modal-icons/tool-cancel.tsx +25 -0
- package/src/assets/images/products/bi-new.svg +23 -0
- package/src/assets/images/products/left-arrow.svg +17 -0
- package/src/assets/images/products/personal-new.tsx +31 -0
- package/src/assets/images/products/postcard-new.tsx +27 -0
- package/src/assets/images/products/professional-new.tsx +24 -0
- package/src/assets/images/products/real-new.tsx +30 -0
- package/src/assets/images/products/right-arrow.svg +17 -0
- package/src/assets/images/products/snap-new.svg +31 -0
- package/src/assets/images/templates/actions.svg +3 -0
- package/src/assets/images/templates/address-block-icon.tsx +62 -0
- package/src/assets/images/templates/archive.svg +3 -0
- package/src/assets/images/templates/arrow-down.tsx +27 -0
- package/src/assets/images/templates/back-arrow.tsx +19 -0
- package/src/assets/images/templates/bi-fold-self-mailers.tsx +28 -0
- package/src/assets/images/templates/check.svg +3 -0
- package/src/assets/images/templates/code.svg +10 -0
- package/src/assets/images/templates/content-copy-icon.tsx +24 -0
- package/src/assets/images/templates/custom-add-on-icon.tsx +18 -0
- package/src/assets/images/templates/custom-qr-section-icon.tsx +9 -0
- package/src/assets/images/templates/custom-template.tsx +23 -0
- package/src/assets/images/templates/designer.tsx +43 -0
- package/src/assets/images/templates/dot.tsx +22 -0
- package/src/assets/images/templates/download-v2.svg +4 -0
- package/src/assets/images/templates/download.svg +4 -0
- package/src/assets/images/templates/dummy-template.tsx +76 -0
- package/src/assets/images/templates/dynamic-field.tsx +119 -0
- package/src/assets/images/templates/edit-pencil-icon.tsx +21 -0
- package/src/assets/images/templates/edit.svg +3 -0
- package/src/assets/images/templates/epo-icon.tsx +16 -0
- package/src/assets/images/templates/field.tsx +29 -0
- package/src/assets/images/templates/gsv-icon.tsx +31 -0
- package/src/assets/images/templates/info-icon.tsx +37 -0
- package/src/assets/images/templates/left-arrow.svg +17 -0
- package/src/assets/images/templates/pencil.svg +3 -0
- package/src/assets/images/templates/personal-letter.tsx +53 -0
- package/src/assets/images/templates/postcard.tsx +32 -0
- package/src/assets/images/templates/professional-letter.tsx +53 -0
- package/src/assets/images/templates/qr-code.tsx +13 -0
- package/src/assets/images/templates/real-penned-letters.tsx +57 -0
- package/src/assets/images/templates/right-arrow.svg +17 -0
- package/src/assets/images/templates/size-image-lg.tsx +20 -0
- package/src/assets/images/templates/size-image-mid.tsx +20 -0
- package/src/assets/images/templates/size-image-xl.tsx +20 -0
- package/src/assets/images/templates/size-image.tsx +20 -0
- package/src/assets/images/templates/snap-pack.tsx +67 -0
- package/src/assets/images/templates/template-default-design.tsx +21 -0
- package/src/assets/images/templates/trash-upload.svg +3 -0
- package/src/assets/images/templates/trash.svg +3 -0
- package/src/assets/images/templates/tri-fold-self-mailers.tsx +93 -0
- package/src/assets/images/templates/upload-image.svg +10 -0
- package/src/assets/images/templates/x.svg +3 -0
- package/src/assets/images/thumbnails/one.svg +9 -0
- package/src/assets/images/tooltip/tool-arrow.tsx +25 -0
- package/src/components/CreateTemplate/V2/index.tsx +525 -0
- package/src/components/CreateTemplate/V2/styles.scss +372 -0
- package/src/components/CreateTemplate/index.tsx +508 -0
- package/src/components/CreateTemplate/styles.scss +404 -0
- package/src/components/GenericUIBlocks/Button/index.tsx +54 -0
- package/src/components/GenericUIBlocks/Button/styles.scss +43 -0
- package/src/components/GenericUIBlocks/CircularProgress/index.tsx +18 -0
- package/src/components/GenericUIBlocks/CircularProgress/styles.scss +93 -0
- package/src/components/GenericUIBlocks/CustomTooltip/index.tsx +88 -0
- package/src/components/GenericUIBlocks/CustomTooltip/styles.scss +19 -0
- package/src/components/GenericUIBlocks/Dialog/V2/index.tsx +227 -0
- package/src/components/GenericUIBlocks/Dialog/V2/styles.scss +289 -0
- package/src/components/GenericUIBlocks/Dialog/index.tsx +185 -0
- package/src/components/GenericUIBlocks/Dialog/styles.scss +227 -0
- package/src/components/GenericUIBlocks/Divider/index.tsx +12 -0
- package/src/components/GenericUIBlocks/Divider/styles.scss +7 -0
- package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +114 -0
- package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +406 -0
- package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +25 -0
- package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +20 -0
- package/src/components/GenericUIBlocks/GenericSnackbar/Toast/index.tsx +91 -0
- package/src/components/GenericUIBlocks/GenericSnackbar/Toast/styles.scss +92 -0
- package/src/components/GenericUIBlocks/Grid/index.tsx +82 -0
- package/src/components/GenericUIBlocks/Input/index.tsx +269 -0
- package/src/components/GenericUIBlocks/Input/styles.scss +332 -0
- package/src/components/GenericUIBlocks/Tabs/index.tsx +71 -0
- package/src/components/GenericUIBlocks/Tabs/styles.scss +42 -0
- package/src/components/GenericUIBlocks/Typography/index.tsx +18 -0
- package/src/components/GenericUIBlocks/Typography/styles.scss +27 -0
- package/src/components/SidePanel/CustomAddOns/index.tsx +342 -0
- package/src/components/SidePanel/CustomAddOns/styles.scss +86 -0
- package/src/components/SidePanel/CustomBlockColors/index.tsx +211 -0
- package/src/components/SidePanel/CustomBlockColors/styles.scss +80 -0
- package/src/components/SidePanel/CustomFields/customFieldSection.tsx +547 -0
- package/src/components/SidePanel/CustomFields/styles.scss +64 -0
- package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/index.tsx +172 -0
- package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/styles.scss +46 -0
- package/src/components/SidePanel/CustomQRCode/index.tsx +1070 -0
- package/src/components/SidePanel/CustomQRCode/styles.scss +149 -0
- package/src/components/SidePanel/CustomUploads/V2/index.tsx +542 -0
- package/src/components/SidePanel/CustomUploads/V2/styles.scss +267 -0
- package/src/components/SidePanel/CustomUploads/index.tsx +301 -0
- package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/index.tsx +424 -0
- package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/styles.scss +180 -0
- package/src/components/SidePanel/Templates/ModalGallery/V2/index.tsx +235 -0
- package/src/components/SidePanel/Templates/ModalGallery/V2/styles.scss +244 -0
- package/src/components/SidePanel/Templates/ModalGallery/index.tsx +231 -0
- package/src/components/SidePanel/Templates/SideBarGallery/index.tsx +233 -0
- package/src/components/SidePanel/Templates/SideBarGallery/styles.scss +152 -0
- package/src/components/SidePanel/Templates/TemplatesCard/V2/index.tsx +149 -0
- package/src/components/SidePanel/Templates/TemplatesCard/V2/styles.scss +156 -0
- package/src/components/SidePanel/Templates/TemplatesCard/index.tsx +160 -0
- package/src/components/SidePanel/Templates/TemplatesCard/styles.scss +98 -0
- package/src/components/SidePanel/Templates/customTemplateSection.tsx +793 -0
- package/src/components/SidePanel/Templates/styles.scss +244 -0
- package/src/components/SidePanel/index.tsx +160 -0
- package/src/components/TemplateBuilder/index.tsx +585 -0
- package/src/components/TemplateBuilder/styles.scss +100 -0
- package/src/components/TemplateTypes/index.tsx +96 -0
- package/src/components/TemplateTypes/styles.scss +91 -0
- package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +81 -0
- package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +123 -0
- package/src/components/TopNavigation/DuplicateTemplateModal.tsx +103 -0
- package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +71 -0
- package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +88 -0
- package/src/components/TopNavigation/SaveTemplateModel/index.tsx +201 -0
- package/src/components/TopNavigation/SaveTemplateModel/styles.scss +128 -0
- package/src/components/TopNavigation/index.tsx +938 -0
- package/src/components/TopNavigation/styles.scss +303 -0
- package/src/importMeta.d.ts +31 -0
- package/src/index.scss +131 -0
- package/src/index.tsx +238 -0
- package/src/libs/test.ts +7 -0
- package/src/redux/actions/action-types.ts +52 -0
- package/src/redux/actions/customQRCodeActions.ts +54 -0
- package/src/redux/actions/snackbarActions.ts +16 -0
- package/src/redux/actions/templateActions.ts +236 -0
- package/src/redux/reducers/customFieldReducer.ts +99 -0
- package/src/redux/reducers/customQRCodeReducer.ts +58 -0
- package/src/redux/reducers/index.ts +15 -0
- package/src/redux/reducers/snackbarReducer.ts +40 -0
- package/src/redux/reducers/templateReducer.ts +485 -0
- package/src/redux/store.ts +18 -0
- package/src/styles/colors.scss +61 -0
- package/src/test/mocks.js +89 -0
- package/src/test/setupJest.js +1 -0
- package/src/utils/api.ts +36 -0
- package/src/utils/constants.ts +182 -0
- package/src/utils/customStyles.ts +45 -0
- package/src/utils/fetchWrapper.ts +73 -0
- package/src/utils/fonts.json +1597 -0
- package/src/utils/helper.ts +205 -0
- package/src/utils/local-storage.ts +15 -0
- package/src/utils/message.ts +162 -0
- package/src/utils/products.ts +186 -0
- package/src/utils/template-builder.ts +328 -0
- package/src/utils/templateIdentifierArea/biFold.ts +107 -0
- package/src/utils/templateIdentifierArea/index.ts +35 -0
- package/src/utils/templateIdentifierArea/personal.ts +107 -0
- package/src/utils/templateIdentifierArea/postCards.ts +163 -0
- package/src/utils/templateIdentifierArea/professional.ts +125 -0
- package/src/utils/templateIdentifierArea/snapPack.ts +107 -0
- package/src/utils/templateIdentifierArea/triFold.ts +107 -0
- package/src/utils/templateRestrictedArea/biFold.ts +329 -0
- package/src/utils/templateRestrictedArea/nonWindowProfessional.ts +90 -0
- package/src/utils/templateRestrictedArea/personal.ts +90 -0
- package/src/utils/templateRestrictedArea/postCard.ts +334 -0
- package/src/utils/templateRestrictedArea/postCardJumbo.tsx +408 -0
- package/src/utils/templateRestrictedArea/professional.ts +318 -0
- package/src/utils/templateRestrictedArea/realPenned.ts +233 -0
- package/src/utils/templateRestrictedArea/snapPack.ts +1009 -0
- package/src/utils/templateRestrictedArea/triFold.ts +330 -0
- package/src/utils/templateSafetyBorders/biFold.ts +91 -0
- package/src/utils/templateSafetyBorders/index.ts +43 -0
- package/src/utils/templateSafetyBorders/personal.ts +41 -0
- package/src/utils/templateSafetyBorders/postCards.ts +259 -0
- package/src/utils/templateSafetyBorders/professional.ts +78 -0
- package/src/utils/templateSafetyBorders/snapPack.ts +165 -0
- package/src/utils/templateSafetyBorders/triFold.ts +114 -0
- package/src/utils/templateSafetyBorders/types.d.ts +68 -0
- package/src/utils/types.ts +12 -0
- package/src/v2Theme.scss +142 -0
- package/tsconfig.json +29 -0
- package/tsconfig.node.json +12 -0
- package/update-version.js +23 -0
- package/version.js +1 -0
- package/vite.config.ts +8 -0
- package/webpack.config.js +80 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
.modal {
|
|
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: var(--modal-background-color);
|
|
17
|
+
margin: auto;
|
|
18
|
+
padding: 0;
|
|
19
|
+
border: 1px solid #888;
|
|
20
|
+
width: 80%;
|
|
21
|
+
max-height: 90%;
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
box-shadow:
|
|
24
|
+
0 4px 8px 0 rgba(0, 0, 0, 0.2),
|
|
25
|
+
0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
26
|
+
-webkit-animation-name: animatetop;
|
|
27
|
+
-webkit-animation-duration: 0.4s;
|
|
28
|
+
animation-name: animatetop;
|
|
29
|
+
animation-duration: 0.4s;
|
|
30
|
+
border-radius: 11px;
|
|
31
|
+
.modal-header {
|
|
32
|
+
position: relative;
|
|
33
|
+
height: 100%;
|
|
34
|
+
min-height: 20px;
|
|
35
|
+
color: var(--text-color);
|
|
36
|
+
|
|
37
|
+
.close {
|
|
38
|
+
float: right;
|
|
39
|
+
font-size: 28px;
|
|
40
|
+
font-weight: bold;
|
|
41
|
+
position: absolute;
|
|
42
|
+
right: 5px;
|
|
43
|
+
top: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.close:hover,
|
|
47
|
+
.close:focus {
|
|
48
|
+
text-decoration: none;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.modal-body {
|
|
54
|
+
padding: 2px 16px;
|
|
55
|
+
display: flex;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
align-items: center;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
color: var(--text-color);
|
|
60
|
+
.modal-icon {
|
|
61
|
+
svg {
|
|
62
|
+
width: 100%;
|
|
63
|
+
max-width: 60px;
|
|
64
|
+
height: 100%;
|
|
65
|
+
min-height: 70px;
|
|
66
|
+
g {
|
|
67
|
+
mask: none;
|
|
68
|
+
path {
|
|
69
|
+
fill: var(--primary-color);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
circle {
|
|
73
|
+
stroke: var(--primary-color);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.modal-footer {
|
|
80
|
+
padding: 2px 16px;
|
|
81
|
+
color: var(--text-color);
|
|
82
|
+
position: absolute;
|
|
83
|
+
bottom: 10px;
|
|
84
|
+
width: 100%;
|
|
85
|
+
display: flex;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
align-items: center;
|
|
88
|
+
gap: 20px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@-webkit-keyframes animatetop {
|
|
93
|
+
from {
|
|
94
|
+
top: -300px;
|
|
95
|
+
opacity: 0;
|
|
96
|
+
}
|
|
97
|
+
to {
|
|
98
|
+
top: 0;
|
|
99
|
+
opacity: 1;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@keyframes animatetop {
|
|
104
|
+
from {
|
|
105
|
+
top: -300px;
|
|
106
|
+
opacity: 0;
|
|
107
|
+
}
|
|
108
|
+
to {
|
|
109
|
+
top: 0;
|
|
110
|
+
opacity: 1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.galleryModal {
|
|
116
|
+
@media (max-width: 1200px) {
|
|
117
|
+
min-width: 1000px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media (max-width: 992px) {
|
|
121
|
+
min-width: 750px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@media (max-width: 768px) {
|
|
125
|
+
min-width: auto;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// new theme modal
|
|
130
|
+
.newThemeModal{
|
|
131
|
+
.modal-content {
|
|
132
|
+
position: relative;
|
|
133
|
+
background-color: var(--modal-background-color);
|
|
134
|
+
margin: auto;
|
|
135
|
+
padding: 0;
|
|
136
|
+
border: 1px solid #888;
|
|
137
|
+
width: 80%;
|
|
138
|
+
max-height: 90%;
|
|
139
|
+
overflow-y: auto;
|
|
140
|
+
box-shadow:
|
|
141
|
+
0 4px 8px 0 rgba(0, 0, 0, 0.2),
|
|
142
|
+
0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
143
|
+
-webkit-animation-name: animatetop;
|
|
144
|
+
-webkit-animation-duration: 0.4s;
|
|
145
|
+
animation-name: animatetop;
|
|
146
|
+
animation-duration: 0.4s;
|
|
147
|
+
border-radius: 11px;
|
|
148
|
+
padding: 40px;
|
|
149
|
+
|
|
150
|
+
.modal-header {
|
|
151
|
+
height: 100%;
|
|
152
|
+
min-height: 20px;
|
|
153
|
+
color: var(--text-color);
|
|
154
|
+
display: flex;
|
|
155
|
+
justify-content: space-between;
|
|
156
|
+
align-items: center;
|
|
157
|
+
|
|
158
|
+
.close-icon {
|
|
159
|
+
float: right;
|
|
160
|
+
font-size: 28px;
|
|
161
|
+
font-weight: bold;
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.modal-body {
|
|
167
|
+
padding: 0;
|
|
168
|
+
display: flex;
|
|
169
|
+
justify-content: center;
|
|
170
|
+
align-items: center;
|
|
171
|
+
flex-direction: column;
|
|
172
|
+
color: var(--text-color);
|
|
173
|
+
margin: 24px 0;
|
|
174
|
+
|
|
175
|
+
.modal-icon {
|
|
176
|
+
svg {
|
|
177
|
+
width: 100%;
|
|
178
|
+
max-width: 60px;
|
|
179
|
+
height: 100%;
|
|
180
|
+
min-height: 70px;
|
|
181
|
+
g {
|
|
182
|
+
mask: none;
|
|
183
|
+
path {
|
|
184
|
+
fill: var(--primary-color);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
circle {
|
|
188
|
+
stroke: var(--primary-color);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.footer {
|
|
195
|
+
color: var(--text-color);
|
|
196
|
+
width: 100%;
|
|
197
|
+
display: flex;
|
|
198
|
+
justify-content: center;
|
|
199
|
+
align-items: center;
|
|
200
|
+
gap: 16px;
|
|
201
|
+
|
|
202
|
+
.new-theme-button{
|
|
203
|
+
transition: all 0.3s ease;
|
|
204
|
+
&:first-child{
|
|
205
|
+
&:hover{
|
|
206
|
+
background-color: #DD5026 !important;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&:last-child{
|
|
211
|
+
border: 0.5px solid #F1F1F1 !important;
|
|
212
|
+
|
|
213
|
+
&:hover{
|
|
214
|
+
background-color: #FFFFFF !important;
|
|
215
|
+
border: 0.5px solid rgba(0, 0, 0, 0.24) !important;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.confirmNavigateDialog-v2{
|
|
224
|
+
.modal-content{
|
|
225
|
+
background-color: #fff;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
// react select
|
|
4
|
+
import Select, {StylesConfig, ClearIndicatorProps, components} from 'react-select';
|
|
5
|
+
|
|
6
|
+
// icons
|
|
7
|
+
import Cancel from '../../../assets/images/input/select-cancel';
|
|
8
|
+
|
|
9
|
+
// components
|
|
10
|
+
import Typography from '../Typography';
|
|
11
|
+
|
|
12
|
+
// styles
|
|
13
|
+
import './styles.scss';
|
|
14
|
+
|
|
15
|
+
interface Option {
|
|
16
|
+
id?: number | string;
|
|
17
|
+
value: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface GeneralSelectProps {
|
|
22
|
+
options: Option[];
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
error?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
selectedValue: Option | null;
|
|
27
|
+
isError: boolean;
|
|
28
|
+
setSelectedValue: (option: Option | null) => void;
|
|
29
|
+
builderSelect: boolean;
|
|
30
|
+
gallerySelect: boolean;
|
|
31
|
+
clearField: boolean;
|
|
32
|
+
qrField?: boolean;
|
|
33
|
+
search?: boolean;
|
|
34
|
+
currentTheme?: string | null | undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const colourStyles: StylesConfig<Option, false> = {
|
|
38
|
+
dropdownIndicator: (styles, {isFocused, selectProps}) => ({
|
|
39
|
+
...styles,
|
|
40
|
+
color: isFocused && selectProps.menuIsOpen ? 'var(--primary-color)' : 'grey',
|
|
41
|
+
transform:
|
|
42
|
+
!isFocused && !selectProps.menuIsOpen ? 'rotate(0deg)' : 'rotate(180deg)',
|
|
43
|
+
}),
|
|
44
|
+
option: (styles, {isDisabled, isFocused, isSelected}) => {
|
|
45
|
+
return {
|
|
46
|
+
...styles,
|
|
47
|
+
backgroundColor: isDisabled
|
|
48
|
+
? undefined
|
|
49
|
+
: isSelected && isFocused
|
|
50
|
+
? 'var(--secondary-color)'
|
|
51
|
+
: isFocused && !isSelected
|
|
52
|
+
? 'var(--secondary-color)'
|
|
53
|
+
: undefined,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const errorStyles = {
|
|
59
|
+
color: 'var(--error-color)',
|
|
60
|
+
fontWeight: '400',
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const ClearIndicator: React.FC<ClearIndicatorProps<any>> = (props) => {
|
|
64
|
+
return (
|
|
65
|
+
<components.ClearIndicator {...props}>
|
|
66
|
+
<Cancel />
|
|
67
|
+
</components.ClearIndicator>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const GeneralSelect: React.FC<GeneralSelectProps> = ({
|
|
72
|
+
options,
|
|
73
|
+
placeholder,
|
|
74
|
+
error,
|
|
75
|
+
label,
|
|
76
|
+
isError,
|
|
77
|
+
selectedValue,
|
|
78
|
+
setSelectedValue,
|
|
79
|
+
builderSelect,
|
|
80
|
+
gallerySelect=false,
|
|
81
|
+
clearField,
|
|
82
|
+
qrField = false,
|
|
83
|
+
search = false,
|
|
84
|
+
currentTheme = "default"
|
|
85
|
+
}) => {
|
|
86
|
+
return (
|
|
87
|
+
<div className={`${currentTheme === 'v2' ? 'select-layout-v2' : 'select-layout'}`} style={{
|
|
88
|
+
display: gallerySelect ? "block" : 'flex'
|
|
89
|
+
}}>
|
|
90
|
+
{label && <label>{label}</label>}
|
|
91
|
+
<Select
|
|
92
|
+
value={selectedValue}
|
|
93
|
+
options={options}
|
|
94
|
+
onChange={setSelectedValue}
|
|
95
|
+
styles={colourStyles}
|
|
96
|
+
className={`generic-select-container ${builderSelect && 'template-select'} ${gallerySelect && 'gallery-select'} ${qrField && 'qr-select'}`}
|
|
97
|
+
classNamePrefix="generic-select"
|
|
98
|
+
placeholder={placeholder}
|
|
99
|
+
blurInputOnSelect
|
|
100
|
+
isClearable={clearField}
|
|
101
|
+
components={{ClearIndicator}}
|
|
102
|
+
isSearchable={search}
|
|
103
|
+
/>
|
|
104
|
+
{isError && (
|
|
105
|
+
<Typography variant="p" style={errorStyles}>
|
|
106
|
+
<sup>*</sup>
|
|
107
|
+
{error}
|
|
108
|
+
</Typography>
|
|
109
|
+
)}
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export default GeneralSelect;
|