medos-sdk 1.1.9 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/MedosClient.d.ts +1 -0
- package/dist/client/MedosClient.js +7 -0
- package/dist/components/AppointmentCalender.js +22 -8
- package/dist/components/AppointmentConfirmationStep.d.ts +4 -0
- package/dist/components/AppointmentConfirmationStep.js +50 -52
- package/dist/components/AppointmentDateTimeModal.d.ts +4 -0
- package/dist/components/AppointmentDateTimeModal.js +216 -165
- package/dist/components/AppointmentSummaryStep.d.ts +12 -0
- package/dist/components/AppointmentSummaryStep.js +168 -0
- package/dist/components/BookingOptionStep.d.ts +14 -0
- package/dist/components/BookingOptionStep.js +346 -0
- package/dist/components/ContactInformationStep.js +13 -6
- package/dist/components/ContactPreferenceStep.js +16 -6
- package/dist/components/DoctorSelectModal.d.ts +5 -0
- package/dist/components/DoctorSelectModal.js +169 -74
- package/dist/components/EnquiryForm.js +84 -72
- package/dist/components/Icons/CloseIcon.d.ts +9 -0
- package/dist/components/Icons/CloseIcon.js +5 -0
- package/dist/components/InquiryDetailsStep.js +11 -6
- package/dist/components/PatientDetailsStep.js +17 -12
- package/dist/components/PatientSelectionStep.d.ts +12 -0
- package/dist/components/PatientSelectionStep.js +254 -0
- package/dist/components/PhoneVerificationStep.js +1 -1
- package/dist/components/SuccessStep.js +1 -1
- package/dist/components/appointment-booking/AppointmentCalender.d.ts +5 -0
- package/dist/components/appointment-booking/AppointmentCalender.js +247 -0
- package/dist/components/appointment-booking/hooks/index.d.ts +3 -0
- package/dist/components/appointment-booking/hooks/index.js +3 -0
- package/dist/components/appointment-booking/hooks/useAppointmentFlow.d.ts +8 -0
- package/dist/components/appointment-booking/hooks/useAppointmentFlow.js +318 -0
- package/dist/components/appointment-booking/hooks/useAppointmentState.d.ts +9 -0
- package/dist/components/appointment-booking/hooks/useAppointmentState.js +125 -0
- package/dist/components/appointment-booking/hooks/useInitializeAddresses.d.ts +1 -0
- package/dist/components/appointment-booking/hooks/useInitializeAddresses.js +55 -0
- package/dist/components/appointment-booking/index.d.ts +5 -0
- package/dist/components/appointment-booking/index.js +3 -0
- package/dist/components/appointment-booking/types.d.ts +291 -0
- package/dist/components/appointment-booking/types.js +49 -0
- package/dist/components/appointment-modal-styles.d.ts +259 -0
- package/dist/components/appointment-modal-styles.js +395 -0
- package/dist/components/constant.d.ts +2 -0
- package/dist/components/constant.js +15 -0
- package/dist/components/custom-calendar.js +20 -11
- package/dist/components/styles.js +93 -52
- package/dist/components/theme-styles.d.ts +5 -4
- package/dist/components/theme-styles.js +221 -125
- package/dist/components/types.d.ts +12 -139
- package/dist/components/types.js +15 -32
- package/dist/components/uiComponents/SelectDropdown.d.ts +1 -1
- package/dist/components/uiComponents/SelectDropdown.js +24 -24
- package/dist/components/utils.d.ts +3 -0
- package/dist/components/utils.js +59 -0
- package/dist/components/validation.d.ts +2 -0
- package/dist/components/validation.js +41 -0
- package/dist/core/theme/index.d.ts +1 -0
- package/dist/core/theme/index.js +1 -0
- package/dist/core/theme/responsive.d.ts +15 -0
- package/dist/core/theme/responsive.js +113 -0
- package/dist/core/theme/themes.js +16 -4
- package/dist/core/theme/types.d.ts +8 -0
- package/dist/enquiry-form/validation.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/react/ThemeProvider.d.ts +2 -1
- package/dist/react/ThemeProvider.js +49 -10
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +1 -1
- package/dist/services/AppointmentService.d.ts +80 -2
- package/dist/services/AppointmentService.js +114 -5
- package/dist/services/WorkspaceService.d.ts +58 -3
- package/dist/services/WorkspaceService.js +10 -1
- package/dist/vanilla/AppointmentCalendarWidget.d.ts +9 -7
- package/dist/vanilla/AppointmentCalendarWidget.js +834 -384
- package/dist/vanilla/EnquiryFormWidget.d.ts +1 -0
- package/dist/vanilla/EnquiryFormWidget.js +25 -43
- package/dist/vanilla/client/MedosClient.d.ts +1 -0
- package/dist/vanilla/components/AppointmentConfirmationStep.d.ts +4 -0
- package/dist/vanilla/components/AppointmentDateTimeModal.d.ts +4 -0
- package/dist/vanilla/components/AppointmentSummaryStep.d.ts +12 -0
- package/dist/vanilla/components/BookingOptionStep.d.ts +14 -0
- package/dist/vanilla/components/DoctorSelectModal.d.ts +5 -0
- package/dist/vanilla/components/Icons/CloseIcon.d.ts +9 -0
- package/dist/vanilla/components/PatientSelectionStep.d.ts +12 -0
- package/dist/vanilla/components/VanillaCalendar.js +33 -18
- package/dist/vanilla/components/VanillaIcons.d.ts +5 -0
- package/dist/vanilla/components/VanillaIcons.js +92 -0
- package/dist/vanilla/components/VanillaSelect.d.ts +3 -0
- package/dist/vanilla/components/VanillaSelect.js +93 -5
- package/dist/vanilla/components/appointment-booking/AppointmentCalender.d.ts +5 -0
- package/dist/vanilla/components/appointment-booking/hooks/index.d.ts +3 -0
- package/dist/vanilla/components/appointment-booking/hooks/useAppointmentFlow.d.ts +8 -0
- package/dist/vanilla/components/appointment-booking/hooks/useAppointmentState.d.ts +9 -0
- package/dist/vanilla/components/appointment-booking/hooks/useInitializeAddresses.d.ts +1 -0
- package/dist/vanilla/components/appointment-booking/index.d.ts +5 -0
- package/dist/vanilla/components/appointment-booking/types.d.ts +291 -0
- package/dist/vanilla/components/appointment-modal-styles.d.ts +259 -0
- package/dist/vanilla/components/constant.d.ts +2 -0
- package/dist/vanilla/components/theme-styles.d.ts +5 -4
- package/dist/vanilla/components/types.d.ts +12 -139
- package/dist/vanilla/components/uiComponents/SelectDropdown.d.ts +1 -1
- package/dist/vanilla/components/utils.d.ts +3 -0
- package/dist/vanilla/components/validation.d.ts +2 -0
- package/dist/vanilla/core/theme/index.d.ts +1 -0
- package/dist/vanilla/core/theme/responsive.d.ts +15 -0
- package/dist/vanilla/core/theme/types.d.ts +8 -0
- package/dist/vanilla/enquiry-widget.js +374 -53
- package/dist/vanilla/index.d.ts +3 -1
- package/dist/vanilla/react/ThemeProvider.d.ts +2 -1
- package/dist/vanilla/react/index.d.ts +2 -1
- package/dist/vanilla/services/AppointmentService.d.ts +80 -2
- package/dist/vanilla/services/WorkspaceService.d.ts +58 -3
- package/dist/vanilla/vanilla/AppointmentCalendarWidget.d.ts +9 -7
- package/dist/vanilla/vanilla/EnquiryFormWidget.d.ts +1 -0
- package/dist/vanilla/vanilla/components/VanillaIcons.d.ts +5 -0
- package/dist/vanilla/vanilla/components/VanillaSelect.d.ts +3 -0
- package/dist/vanilla/widget.css +833 -207
- package/dist/vanilla/widget.js +6463 -5687
- package/package.json +1 -1
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
export const getMobileStyles = (theme, breakpoint) => {
|
|
2
|
+
const borderRadius = "12px";
|
|
3
|
+
const cardBorder = `1px solid ${theme.colors.border}`;
|
|
4
|
+
const buttonRadius = "8px";
|
|
5
|
+
return {
|
|
6
|
+
container: {
|
|
7
|
+
backgroundColor: theme.colors.background,
|
|
8
|
+
padding: "20px 16px",
|
|
9
|
+
maxWidth: "100%",
|
|
10
|
+
fontFamily: theme.typography.fontFamily,
|
|
11
|
+
color: theme.colors.text,
|
|
12
|
+
minHeight: "100vh",
|
|
13
|
+
boxSizing: "border-box",
|
|
14
|
+
},
|
|
15
|
+
header: { marginBottom: 24 },
|
|
16
|
+
title: {
|
|
17
|
+
fontSize: 18,
|
|
18
|
+
fontWeight: 600,
|
|
19
|
+
margin: 0,
|
|
20
|
+
color: theme.colors.text,
|
|
21
|
+
},
|
|
22
|
+
section: { marginBottom: 24 },
|
|
23
|
+
sectionTitle: {
|
|
24
|
+
fontSize: 15,
|
|
25
|
+
fontWeight: 600,
|
|
26
|
+
marginBottom: 12,
|
|
27
|
+
color: theme.colors.text,
|
|
28
|
+
},
|
|
29
|
+
required: { color: theme.colors.error, marginLeft: 4 },
|
|
30
|
+
modeContainer: {
|
|
31
|
+
display: "flex",
|
|
32
|
+
flexDirection: "column",
|
|
33
|
+
gap: 10,
|
|
34
|
+
},
|
|
35
|
+
modeOption: {
|
|
36
|
+
display: "flex",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
gap: 12,
|
|
39
|
+
padding: "14px 16px",
|
|
40
|
+
border: cardBorder,
|
|
41
|
+
borderRadius,
|
|
42
|
+
cursor: "pointer",
|
|
43
|
+
fontSize: 15,
|
|
44
|
+
transition: "all 0.2s ease",
|
|
45
|
+
backgroundColor: theme.colors.surface,
|
|
46
|
+
},
|
|
47
|
+
radioInput: { width: 18, height: 18, accentColor: theme.colors.primary },
|
|
48
|
+
chargeAmount: { fontSize: 18, fontWeight: 600, color: theme.colors.text },
|
|
49
|
+
paymentOption: {
|
|
50
|
+
padding: "14px 16px",
|
|
51
|
+
border: cardBorder,
|
|
52
|
+
borderRadius,
|
|
53
|
+
fontSize: 15,
|
|
54
|
+
color: theme.colors.textSecondary,
|
|
55
|
+
backgroundColor: theme.colors.surface,
|
|
56
|
+
},
|
|
57
|
+
dateSection: {
|
|
58
|
+
marginBottom: 24,
|
|
59
|
+
padding: "16px",
|
|
60
|
+
backgroundColor: theme.colors.backgroundSecondary,
|
|
61
|
+
borderRadius,
|
|
62
|
+
border: cardBorder,
|
|
63
|
+
},
|
|
64
|
+
dateSectionHeader: { marginBottom: 12 },
|
|
65
|
+
dateSectionTitle: {
|
|
66
|
+
fontSize: 12,
|
|
67
|
+
fontWeight: 600,
|
|
68
|
+
color: theme.colors.textSecondary,
|
|
69
|
+
margin: 0,
|
|
70
|
+
letterSpacing: "0.5px",
|
|
71
|
+
textTransform: "uppercase",
|
|
72
|
+
},
|
|
73
|
+
monthNavigationContainer: {
|
|
74
|
+
display: "flex",
|
|
75
|
+
alignItems: "center",
|
|
76
|
+
justifyContent: "space-between",
|
|
77
|
+
marginBottom: 16,
|
|
78
|
+
position: "relative",
|
|
79
|
+
},
|
|
80
|
+
monthYearDisplay: {
|
|
81
|
+
fontSize: 16,
|
|
82
|
+
fontWeight: 600,
|
|
83
|
+
color: theme.colors.text,
|
|
84
|
+
textAlign: "center",
|
|
85
|
+
flex: 1,
|
|
86
|
+
},
|
|
87
|
+
navButton: {
|
|
88
|
+
background: "none",
|
|
89
|
+
border: "none",
|
|
90
|
+
color: theme.colors.text,
|
|
91
|
+
cursor: "pointer",
|
|
92
|
+
padding: 8,
|
|
93
|
+
borderRadius: buttonRadius,
|
|
94
|
+
display: "flex",
|
|
95
|
+
alignItems: "center",
|
|
96
|
+
justifyContent: "center",
|
|
97
|
+
transition: "all 0.2s ease",
|
|
98
|
+
minWidth: 36,
|
|
99
|
+
minHeight: 36,
|
|
100
|
+
flexShrink: 0,
|
|
101
|
+
},
|
|
102
|
+
dateCardsContainer: {
|
|
103
|
+
display: "flex",
|
|
104
|
+
justifyContent: "space-around",
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
gap: 8,
|
|
107
|
+
width: "100%",
|
|
108
|
+
maxWidth: "100%",
|
|
109
|
+
overflow: "hidden",
|
|
110
|
+
},
|
|
111
|
+
dateCard: {
|
|
112
|
+
width: 56,
|
|
113
|
+
height: 56,
|
|
114
|
+
border: `2px solid ${theme.colors.border}`,
|
|
115
|
+
borderRadius: "50%",
|
|
116
|
+
display: "flex",
|
|
117
|
+
flexDirection: "column",
|
|
118
|
+
alignItems: "center",
|
|
119
|
+
justifyContent: "center",
|
|
120
|
+
cursor: "pointer",
|
|
121
|
+
transition: "all 0.2s ease",
|
|
122
|
+
backgroundColor: theme.colors.surface,
|
|
123
|
+
position: "relative",
|
|
124
|
+
flex: "0 0 auto",
|
|
125
|
+
},
|
|
126
|
+
dateCardSelected: {
|
|
127
|
+
borderColor: theme.colors.primary,
|
|
128
|
+
backgroundColor: theme.colors.primary,
|
|
129
|
+
color: theme.colors.textOnPrimary,
|
|
130
|
+
},
|
|
131
|
+
dateCardWeekday: {
|
|
132
|
+
fontSize: 9,
|
|
133
|
+
fontWeight: 500,
|
|
134
|
+
textTransform: "uppercase",
|
|
135
|
+
marginBottom: 2,
|
|
136
|
+
letterSpacing: "0.3px",
|
|
137
|
+
lineHeight: 1,
|
|
138
|
+
},
|
|
139
|
+
dateCardDay: { fontSize: 14, fontWeight: 700, lineHeight: 1 },
|
|
140
|
+
slotsContainer: { marginBottom: 24 },
|
|
141
|
+
slotGrid: {
|
|
142
|
+
display: "grid",
|
|
143
|
+
gridTemplateColumns: "repeat(2, 1fr)",
|
|
144
|
+
gap: 12,
|
|
145
|
+
marginTop: 12,
|
|
146
|
+
maxHeight: "280px",
|
|
147
|
+
overflowY: "auto",
|
|
148
|
+
paddingRight: "8px",
|
|
149
|
+
paddingBottom: "4px",
|
|
150
|
+
scrollbarWidth: "thin",
|
|
151
|
+
scrollbarColor: `${theme.colors.primary}40 ${theme.colors.surface}`,
|
|
152
|
+
},
|
|
153
|
+
slotButton: {
|
|
154
|
+
padding: "14px 10px",
|
|
155
|
+
border: `2px solid ${theme.colors.border}`,
|
|
156
|
+
borderRadius: buttonRadius,
|
|
157
|
+
backgroundColor: theme.colors.surface,
|
|
158
|
+
color: theme.colors.text,
|
|
159
|
+
fontSize: 13,
|
|
160
|
+
fontWeight: 600,
|
|
161
|
+
cursor: "pointer",
|
|
162
|
+
transition: "all 0.25s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
163
|
+
minHeight: 48,
|
|
164
|
+
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.03)",
|
|
165
|
+
position: "relative",
|
|
166
|
+
letterSpacing: "0.3px",
|
|
167
|
+
},
|
|
168
|
+
slotButtonSelected: {
|
|
169
|
+
borderColor: theme.colors.primary,
|
|
170
|
+
backgroundColor: theme.colors.primary,
|
|
171
|
+
color: theme.colors.textOnPrimary,
|
|
172
|
+
boxShadow: `0 4px 12px ${theme.colors.primary}30, 0 2px 4px ${theme.colors.primary}20`,
|
|
173
|
+
transform: "translateY(-1px)",
|
|
174
|
+
},
|
|
175
|
+
noSlots: {
|
|
176
|
+
textAlign: "center",
|
|
177
|
+
color: theme.colors.textSecondary,
|
|
178
|
+
fontSize: 14,
|
|
179
|
+
marginTop: 16,
|
|
180
|
+
padding: "20px",
|
|
181
|
+
},
|
|
182
|
+
footer: {
|
|
183
|
+
display: "flex",
|
|
184
|
+
gap: 12,
|
|
185
|
+
marginTop: "auto",
|
|
186
|
+
paddingTop: 20,
|
|
187
|
+
borderTop: cardBorder,
|
|
188
|
+
},
|
|
189
|
+
backButton: {
|
|
190
|
+
flex: 1,
|
|
191
|
+
padding: "12px 20px",
|
|
192
|
+
border: cardBorder,
|
|
193
|
+
borderRadius: buttonRadius,
|
|
194
|
+
backgroundColor: theme.colors.surface,
|
|
195
|
+
color: theme.colors.text,
|
|
196
|
+
fontSize: 14,
|
|
197
|
+
fontWeight: 600,
|
|
198
|
+
cursor: "pointer",
|
|
199
|
+
transition: "all 0.2s ease",
|
|
200
|
+
minHeight: 44,
|
|
201
|
+
},
|
|
202
|
+
nextButton: {
|
|
203
|
+
flex: 1,
|
|
204
|
+
padding: "12px 20px",
|
|
205
|
+
border: "none",
|
|
206
|
+
borderRadius: buttonRadius,
|
|
207
|
+
backgroundColor: theme.colors.secondary,
|
|
208
|
+
color: theme.colors.textOnSecondary,
|
|
209
|
+
fontSize: 14,
|
|
210
|
+
fontWeight: 600,
|
|
211
|
+
cursor: "pointer",
|
|
212
|
+
transition: "all 0.2s ease",
|
|
213
|
+
minHeight: 44,
|
|
214
|
+
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.05)",
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
export const getDesktopStyles = (theme, breakpoint) => {
|
|
219
|
+
const borderRadius = "12px";
|
|
220
|
+
const buttonRadius = "8px";
|
|
221
|
+
const cardBorder = `1px solid ${theme.colors.border}`;
|
|
222
|
+
return {
|
|
223
|
+
modalWrapper: {
|
|
224
|
+
backgroundColor: theme.colors.background,
|
|
225
|
+
borderRadius,
|
|
226
|
+
padding: "24px",
|
|
227
|
+
maxWidth: 800,
|
|
228
|
+
margin: "0 auto",
|
|
229
|
+
fontFamily: theme.typography.fontFamily,
|
|
230
|
+
color: theme.colors.text,
|
|
231
|
+
boxSizing: "border-box",
|
|
232
|
+
},
|
|
233
|
+
sectionCard: {
|
|
234
|
+
border: cardBorder,
|
|
235
|
+
borderRadius,
|
|
236
|
+
marginBottom: 20,
|
|
237
|
+
position: "relative",
|
|
238
|
+
overflow: "hidden",
|
|
239
|
+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.04)",
|
|
240
|
+
},
|
|
241
|
+
sectionHeader: {
|
|
242
|
+
background: theme.colors.primary,
|
|
243
|
+
color: theme.colors.textOnPrimary,
|
|
244
|
+
borderBottom: cardBorder,
|
|
245
|
+
padding: "14px 20px",
|
|
246
|
+
display: "flex",
|
|
247
|
+
alignItems: "center",
|
|
248
|
+
gap: 10,
|
|
249
|
+
},
|
|
250
|
+
sectionTitle: { fontSize: 16, fontWeight: 600 },
|
|
251
|
+
sectionBody: {
|
|
252
|
+
padding: "20px",
|
|
253
|
+
position: "relative",
|
|
254
|
+
},
|
|
255
|
+
label: {
|
|
256
|
+
fontSize: 14,
|
|
257
|
+
fontWeight: 500,
|
|
258
|
+
marginBottom: 8,
|
|
259
|
+
display: "block",
|
|
260
|
+
color: theme.colors.text,
|
|
261
|
+
},
|
|
262
|
+
modeContainer: {
|
|
263
|
+
display: "flex",
|
|
264
|
+
gap: 20,
|
|
265
|
+
marginTop: 8,
|
|
266
|
+
flexDirection: "row",
|
|
267
|
+
},
|
|
268
|
+
radioLabel: {
|
|
269
|
+
display: "flex",
|
|
270
|
+
alignItems: "center",
|
|
271
|
+
gap: 10,
|
|
272
|
+
cursor: "pointer",
|
|
273
|
+
fontSize: 14,
|
|
274
|
+
padding: "8px 16px",
|
|
275
|
+
borderRadius: buttonRadius,
|
|
276
|
+
border: cardBorder,
|
|
277
|
+
transition: "all 0.2s ease",
|
|
278
|
+
backgroundColor: theme.colors.surface,
|
|
279
|
+
},
|
|
280
|
+
radioInput: {
|
|
281
|
+
width: 18,
|
|
282
|
+
height: 18,
|
|
283
|
+
accentColor: theme.colors.secondary,
|
|
284
|
+
cursor: "pointer",
|
|
285
|
+
},
|
|
286
|
+
rupee: {
|
|
287
|
+
fontWeight: 600,
|
|
288
|
+
fontSize: 18,
|
|
289
|
+
color: theme.colors.text,
|
|
290
|
+
},
|
|
291
|
+
dateTimeContainer: {
|
|
292
|
+
display: "flex",
|
|
293
|
+
gap: 24,
|
|
294
|
+
flexDirection: "row",
|
|
295
|
+
alignItems: "flex-start",
|
|
296
|
+
},
|
|
297
|
+
calendarBox: {
|
|
298
|
+
border: cardBorder,
|
|
299
|
+
borderRadius,
|
|
300
|
+
padding: 0,
|
|
301
|
+
width: "320px",
|
|
302
|
+
minWidth: "320px",
|
|
303
|
+
overflow: "visible",
|
|
304
|
+
backgroundColor: theme.colors.surface,
|
|
305
|
+
},
|
|
306
|
+
timesContainer: {
|
|
307
|
+
flex: 1,
|
|
308
|
+
minWidth: "320px",
|
|
309
|
+
},
|
|
310
|
+
timesLabel: {
|
|
311
|
+
fontWeight: 600,
|
|
312
|
+
fontSize: 15,
|
|
313
|
+
color: theme.colors.text,
|
|
314
|
+
marginBottom: 4,
|
|
315
|
+
},
|
|
316
|
+
dateLabel: {
|
|
317
|
+
color: theme.colors.textSecondary,
|
|
318
|
+
fontSize: 13,
|
|
319
|
+
fontWeight: 400,
|
|
320
|
+
},
|
|
321
|
+
noSlots: {
|
|
322
|
+
color: theme.colors.textSecondary,
|
|
323
|
+
fontSize: 14,
|
|
324
|
+
marginTop: 12,
|
|
325
|
+
padding: "16px",
|
|
326
|
+
textAlign: "center",
|
|
327
|
+
backgroundColor: theme.colors.backgroundSecondary,
|
|
328
|
+
borderRadius: buttonRadius,
|
|
329
|
+
},
|
|
330
|
+
slotGrid: {
|
|
331
|
+
display: "grid",
|
|
332
|
+
gridTemplateColumns: "repeat(2, 1fr)",
|
|
333
|
+
gap: 12,
|
|
334
|
+
marginTop: 16,
|
|
335
|
+
maxHeight: "340px",
|
|
336
|
+
overflowY: "auto",
|
|
337
|
+
paddingRight: "8px",
|
|
338
|
+
paddingBottom: "4px",
|
|
339
|
+
scrollbarWidth: "thin",
|
|
340
|
+
scrollbarColor: `${theme.colors.secondary}40 ${theme.colors.surface}`,
|
|
341
|
+
},
|
|
342
|
+
slotButton: {
|
|
343
|
+
borderRadius: buttonRadius,
|
|
344
|
+
padding: "12px 16px",
|
|
345
|
+
border: `2px solid ${theme.colors.border}`,
|
|
346
|
+
fontSize: 14,
|
|
347
|
+
fontWeight: 600,
|
|
348
|
+
cursor: "pointer",
|
|
349
|
+
transition: "all 0.25s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
350
|
+
minHeight: 48,
|
|
351
|
+
backgroundColor: theme.colors.surface,
|
|
352
|
+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.04)",
|
|
353
|
+
position: "relative",
|
|
354
|
+
letterSpacing: "0.3px",
|
|
355
|
+
textAlign: "center",
|
|
356
|
+
},
|
|
357
|
+
footer: {
|
|
358
|
+
display: "flex",
|
|
359
|
+
justifyContent: "flex-end",
|
|
360
|
+
alignItems: "center",
|
|
361
|
+
marginTop: 24,
|
|
362
|
+
paddingTop: 20,
|
|
363
|
+
gap: 12,
|
|
364
|
+
flexDirection: "row",
|
|
365
|
+
borderTop: cardBorder,
|
|
366
|
+
},
|
|
367
|
+
backBtn: {
|
|
368
|
+
border: cardBorder,
|
|
369
|
+
background: theme.colors.surface,
|
|
370
|
+
color: theme.colors.text,
|
|
371
|
+
borderRadius: buttonRadius,
|
|
372
|
+
fontWeight: 600,
|
|
373
|
+
padding: "10px 20px",
|
|
374
|
+
cursor: "pointer",
|
|
375
|
+
width: "auto",
|
|
376
|
+
minHeight: 40,
|
|
377
|
+
fontSize: 14,
|
|
378
|
+
transition: "all 0.2s ease",
|
|
379
|
+
},
|
|
380
|
+
continueBtn: {
|
|
381
|
+
background: theme.colors.secondary,
|
|
382
|
+
color: theme.colors.textOnSecondary,
|
|
383
|
+
border: "none",
|
|
384
|
+
borderRadius: buttonRadius,
|
|
385
|
+
fontWeight: 600,
|
|
386
|
+
padding: "10px 20px",
|
|
387
|
+
cursor: "pointer",
|
|
388
|
+
width: "auto",
|
|
389
|
+
minHeight: 40,
|
|
390
|
+
fontSize: 14,
|
|
391
|
+
transition: "all 0.2s ease",
|
|
392
|
+
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.05)",
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const MONTHS = [
|
|
2
|
+
"January",
|
|
3
|
+
"February",
|
|
4
|
+
"March",
|
|
5
|
+
"April",
|
|
6
|
+
"May",
|
|
7
|
+
"June",
|
|
8
|
+
"July",
|
|
9
|
+
"August",
|
|
10
|
+
"September",
|
|
11
|
+
"October",
|
|
12
|
+
"November",
|
|
13
|
+
"December",
|
|
14
|
+
];
|
|
15
|
+
export const WEEKDAYS = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
|
|
@@ -3,14 +3,21 @@ import { useState, useEffect } from "react";
|
|
|
3
3
|
import ChevronLeft from "./Icons/ChevronLeft";
|
|
4
4
|
import ChevronRight from "./Icons/ChevronRight";
|
|
5
5
|
import { useTheme } from "../react/hooks/useTheme";
|
|
6
|
-
|
|
6
|
+
import { useBreakpoint } from "../core/theme/responsive";
|
|
7
|
+
const getStyle = (theme, isMobile) => `
|
|
8
|
+
.custom-calendar-wrapper {
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
-webkit-overflow-scrolling: touch;
|
|
11
|
+
}
|
|
7
12
|
.custom-calendar {
|
|
8
|
-
width:
|
|
13
|
+
width: ${isMobile ? "320px" : "100%"};
|
|
14
|
+
min-width: ${isMobile ? "320px" : "auto"};
|
|
9
15
|
background-color: ${theme.colors.background};
|
|
10
16
|
border-radius: ${theme.radii.md};
|
|
11
17
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
|
|
12
|
-
padding: 16px;
|
|
18
|
+
padding: ${isMobile ? "12px" : "16px"};
|
|
13
19
|
font-family: ${theme.typography.fontFamily};
|
|
20
|
+
box-sizing: border-box;
|
|
14
21
|
}
|
|
15
22
|
.calendar-header {
|
|
16
23
|
display: flex;
|
|
@@ -92,10 +99,12 @@ const getStyle = (theme) => `
|
|
|
92
99
|
`;
|
|
93
100
|
export const CustomCalendarWithDateSelector = ({ selectedDate, onSelect, pastDisabled = false, }) => {
|
|
94
101
|
const theme = useTheme();
|
|
102
|
+
const breakpoint = useBreakpoint(theme);
|
|
103
|
+
const isMobile = breakpoint === "mobile";
|
|
95
104
|
useEffect(() => {
|
|
96
105
|
const styleId = "custom-calendar-style";
|
|
97
106
|
const existingStyle = document.getElementById(styleId);
|
|
98
|
-
const themeStyle = getStyle(theme);
|
|
107
|
+
const themeStyle = getStyle(theme, isMobile);
|
|
99
108
|
if (existingStyle) {
|
|
100
109
|
existingStyle.innerHTML = themeStyle;
|
|
101
110
|
}
|
|
@@ -105,7 +114,7 @@ export const CustomCalendarWithDateSelector = ({ selectedDate, onSelect, pastDis
|
|
|
105
114
|
s.innerHTML = themeStyle;
|
|
106
115
|
document.head.appendChild(s);
|
|
107
116
|
}
|
|
108
|
-
}, [theme]);
|
|
117
|
+
}, [theme, isMobile]);
|
|
109
118
|
const today = new Date();
|
|
110
119
|
today.setHours(0, 0, 0, 0);
|
|
111
120
|
const [currentMonth, setCurrentMonth] = useState(today.getMonth());
|
|
@@ -162,10 +171,10 @@ export const CustomCalendarWithDateSelector = ({ selectedDate, onSelect, pastDis
|
|
|
162
171
|
todayStart.setHours(0, 0, 0, 0);
|
|
163
172
|
return date < todayStart;
|
|
164
173
|
};
|
|
165
|
-
return (_jsxs("div", { className: "custom-calendar", children: [_jsxs("div", { className: "calendar-header", children: [_jsx(ChevronLeft, { onClick: prevMonth, className: "calendar-nav" }), _jsxs("p", { className: "calendar-month", children: [months[currentMonth], " ", currentYear] }), _jsx(ChevronRight, { onClick: nextMonth, className: "calendar-nav" })] }), _jsx("div", { className: "calendar-days-header", children: daysOfWeek.map((d) => (_jsx("div", { className: "calendar-day-name", children: d }, d))) }), _jsxs("div", { className: "calendar-grid", children: [Array.from({ length: startOffset }).map((_, idx) => (_jsx("div", { className: "calendar-empty" }, `empty-${idx}`))), Array.from({ length: daysInMonth }).map((_, i) => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
174
|
+
return (_jsx("div", { className: "custom-calendar-wrapper", children: _jsxs("div", { className: "custom-calendar", children: [_jsxs("div", { className: "calendar-header", children: [_jsx(ChevronLeft, { onClick: prevMonth, className: "calendar-nav" }), _jsxs("p", { className: "calendar-month", children: [months[currentMonth], " ", currentYear] }), _jsx(ChevronRight, { onClick: nextMonth, className: "calendar-nav" })] }), _jsx("div", { className: "calendar-days-header", children: daysOfWeek.map((d) => (_jsx("div", { className: "calendar-day-name", children: d }, d))) }), _jsxs("div", { className: "calendar-grid", children: [Array.from({ length: startOffset }).map((_, idx) => (_jsx("div", { className: "calendar-empty" }, `empty-start-${currentMonth}-${idx}`))), Array.from({ length: daysInMonth }).map((_, i) => {
|
|
175
|
+
const date = new Date(currentYear, currentMonth, i + 1);
|
|
176
|
+
const disabled = pastDisabled && isBeforeToday(date);
|
|
177
|
+
const isSelected = selectedDate && isSameDate(selectedDate, date);
|
|
178
|
+
return (_jsxs("button", { disabled: disabled, onClick: () => onSelect(date), className: `calendar-day ${isSelected ? "selected" : ""} ${disabled ? "disabled" : ""}`, children: [_jsx("span", { children: i + 1 }), isSelected && _jsx("span", { className: "calendar-dot", children: "\u2022" })] }, i + 1));
|
|
179
|
+
})] })] }) }));
|
|
171
180
|
};
|