medos-sdk 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/dist/client/MedosClient.d.ts +3 -5
- package/dist/client/MedosClient.js +4 -4
- package/dist/components/AppointmentCalender.d.ts +1 -4
- package/dist/components/AppointmentCalender.js +323 -530
- package/dist/components/AppointmentDateTimeModal.d.ts +14 -0
- package/dist/components/AppointmentDateTimeModal.js +220 -0
- package/dist/components/ConfigurableCard.d.ts +12 -0
- package/dist/components/ConfigurableCard.js +29 -0
- package/dist/components/ContactInformationStep.d.ts +13 -0
- package/dist/components/ContactInformationStep.js +14 -0
- package/dist/components/ContactPreferenceStep.d.ts +9 -0
- package/dist/components/ContactPreferenceStep.js +16 -0
- package/dist/components/DoctorSelectModal.d.ts +7 -0
- package/dist/components/DoctorSelectModal.js +93 -0
- package/dist/components/EnquiryForm.d.ts +7 -0
- package/dist/components/EnquiryForm.js +212 -0
- package/dist/components/Icons/Check.d.ts +6 -0
- package/dist/components/Icons/Check.js +2 -0
- package/dist/components/Icons/ChevronDownIcon.d.ts +4 -0
- package/dist/components/Icons/ChevronDownIcon.js +2 -0
- package/dist/components/Icons/ChevronLeft.d.ts +3 -0
- package/dist/components/Icons/ChevronLeft.js +3 -0
- package/dist/components/Icons/ChevronRight.d.ts +3 -0
- package/dist/components/Icons/ChevronRight.js +3 -0
- package/dist/components/Icons/ConfirmationCheck.d.ts +1 -0
- package/dist/components/Icons/ConfirmationCheck.js +9 -0
- package/dist/components/Icons/ConsultationType.d.ts +1 -0
- package/dist/components/Icons/ConsultationType.js +2 -0
- package/dist/components/Icons/Date&TimeIcon.d.ts +1 -0
- package/dist/components/Icons/Date&TimeIcon.js +2 -0
- package/dist/components/Icons/MapIcon.d.ts +1 -0
- package/dist/components/Icons/MapIcon.js +2 -0
- package/dist/components/Icons/PaymentMethodIcon.d.ts +1 -0
- package/dist/components/Icons/PaymentMethodIcon.js +2 -0
- package/dist/components/Icons/UserIcon.d.ts +1 -0
- package/dist/components/Icons/UserIcon.js +2 -0
- package/dist/components/InquiryDetailsStep.d.ts +10 -0
- package/dist/components/InquiryDetailsStep.js +15 -0
- package/dist/components/PatientDetailsStep.d.ts +3 -0
- package/dist/components/PatientDetailsStep.js +84 -0
- package/dist/components/PhoneVerificationStep.d.ts +3 -0
- package/dist/components/PhoneVerificationStep.js +49 -0
- package/dist/components/SuccessStep.d.ts +5 -0
- package/dist/components/SuccessStep.js +9 -0
- package/dist/components/custom-calendar.d.ts +5 -0
- package/dist/components/custom-calendar.js +171 -0
- package/dist/components/styles.d.ts +6 -0
- package/dist/components/styles.js +257 -0
- package/dist/components/theme-styles.d.ts +12 -0
- package/dist/components/theme-styles.js +319 -0
- package/dist/components/types.d.ts +181 -0
- package/dist/components/types.js +55 -0
- package/dist/components/ui/select.d.ts +10 -0
- package/dist/components/ui/select.js +21 -0
- package/dist/components/uiComponents/SelectDropdown.d.ts +41 -0
- package/dist/components/uiComponents/SelectDropdown.js +302 -0
- package/dist/components/utils.d.ts +5 -0
- package/dist/components/utils.js +15 -0
- package/dist/components/validation.d.ts +2 -0
- package/dist/components/validation.js +7 -0
- package/dist/context/TemplateContext.d.ts +12 -0
- package/dist/context/TemplateContext.js +19 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +4 -0
- package/dist/core/theme/index.d.ts +3 -0
- package/dist/core/theme/index.js +3 -0
- package/dist/core/theme/themes.d.ts +8 -0
- package/dist/core/theme/themes.js +178 -0
- package/dist/core/theme/types.d.ts +106 -0
- package/dist/core/theme/types.js +1 -0
- package/dist/core/theme/utils.d.ts +8 -0
- package/dist/core/theme/utils.js +135 -0
- package/dist/enquiry-form/index.d.ts +4 -0
- package/dist/enquiry-form/index.js +4 -0
- package/dist/enquiry-form/provider.d.ts +3 -0
- package/dist/enquiry-form/provider.js +9 -0
- package/dist/enquiry-form/serialization.d.ts +4 -0
- package/dist/enquiry-form/serialization.js +57 -0
- package/dist/enquiry-form/types.d.ts +38 -0
- package/dist/enquiry-form/types.js +1 -0
- package/dist/enquiry-form/validation.d.ts +6 -0
- package/dist/enquiry-form/validation.js +21 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +7 -0
- package/dist/lib/templateUtils.d.ts +3 -0
- package/dist/lib/templateUtils.js +28 -0
- package/dist/react/ThemeProvider.d.ts +18 -0
- package/dist/react/ThemeProvider.js +45 -0
- package/dist/react/hooks/useTheme.d.ts +1 -0
- package/dist/react/hooks/useTheme.js +1 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/index.js +3 -0
- package/dist/services/AppointmentService.d.ts +4 -5
- package/dist/services/AppointmentService.js +12 -10
- package/dist/services/EnquiryService.d.ts +5 -0
- package/dist/services/EnquiryService.js +30 -0
- package/dist/templates/registry.d.ts +12 -0
- package/dist/templates/registry.js +58 -0
- package/dist/vanilla/AppointmentCalendarWidget.d.ts +2 -34
- package/dist/vanilla/AppointmentCalendarWidget.js +264 -275
- package/dist/vanilla/EnquiryFormWidget.d.ts +35 -0
- package/dist/vanilla/EnquiryFormWidget.js +425 -0
- package/dist/vanilla/client/MedosClient.d.ts +3 -5
- package/dist/vanilla/components/AppointmentCalender.d.ts +1 -4
- package/dist/vanilla/components/AppointmentDateTimeModal.d.ts +14 -0
- package/dist/vanilla/components/ConfigurableCard.d.ts +12 -0
- package/dist/vanilla/components/ContactInformationStep.d.ts +13 -0
- package/dist/vanilla/components/ContactPreferenceStep.d.ts +9 -0
- package/dist/vanilla/components/DoctorSelectModal.d.ts +7 -0
- package/dist/vanilla/components/EnquiryForm.d.ts +7 -0
- package/dist/vanilla/components/Icons/Check.d.ts +6 -0
- package/dist/vanilla/components/Icons/ChevronDownIcon.d.ts +4 -0
- package/dist/vanilla/components/Icons/ChevronLeft.d.ts +3 -0
- package/dist/vanilla/components/Icons/ChevronRight.d.ts +3 -0
- package/dist/vanilla/components/Icons/ConfirmationCheck.d.ts +1 -0
- package/dist/vanilla/components/Icons/ConsultationType.d.ts +1 -0
- package/dist/vanilla/components/Icons/Date&TimeIcon.d.ts +1 -0
- package/dist/vanilla/components/Icons/MapIcon.d.ts +1 -0
- package/dist/vanilla/components/Icons/PaymentMethodIcon.d.ts +1 -0
- package/dist/vanilla/components/Icons/UserIcon.d.ts +1 -0
- package/dist/vanilla/components/InquiryDetailsStep.d.ts +10 -0
- package/dist/vanilla/components/PatientDetailsStep.d.ts +3 -0
- package/dist/vanilla/components/PhoneVerificationStep.d.ts +3 -0
- package/dist/vanilla/components/SuccessStep.d.ts +5 -0
- package/dist/vanilla/components/custom-calendar.d.ts +5 -0
- package/dist/vanilla/components/styles.d.ts +6 -0
- package/dist/vanilla/components/theme-styles.d.ts +12 -0
- package/dist/vanilla/components/types.d.ts +181 -0
- package/dist/vanilla/components/ui/select.d.ts +10 -0
- package/dist/vanilla/components/uiComponents/SelectDropdown.d.ts +41 -0
- package/dist/vanilla/components/utils.d.ts +5 -0
- package/dist/vanilla/components/validation.d.ts +2 -0
- package/dist/vanilla/context/TemplateContext.d.ts +12 -0
- package/dist/vanilla/core/index.d.ts +4 -0
- package/dist/vanilla/core/theme/index.d.ts +3 -0
- package/dist/vanilla/core/theme/themes.d.ts +8 -0
- package/dist/vanilla/core/theme/types.d.ts +106 -0
- package/dist/vanilla/core/theme/utils.d.ts +8 -0
- package/dist/vanilla/enquiry-form/index.d.ts +4 -0
- package/dist/vanilla/enquiry-form/provider.d.ts +3 -0
- package/dist/vanilla/enquiry-form/serialization.d.ts +4 -0
- package/dist/vanilla/enquiry-form/types.d.ts +38 -0
- package/dist/vanilla/enquiry-form/validation.d.ts +6 -0
- package/dist/vanilla/enquiry-widget.js +4650 -0
- package/dist/vanilla/index.d.ts +9 -0
- package/dist/vanilla/index.js +3 -1
- package/dist/vanilla/lib/templateUtils.d.ts +3 -0
- package/dist/vanilla/react/ThemeProvider.d.ts +18 -0
- package/dist/vanilla/react/hooks/useTheme.d.ts +1 -0
- package/dist/vanilla/react/index.d.ts +5 -0
- package/dist/vanilla/services/AppointmentService.d.ts +4 -5
- package/dist/vanilla/services/EnquiryService.d.ts +5 -0
- package/dist/vanilla/templates/alternative.css +13 -0
- package/dist/vanilla/templates/default.css +13 -0
- package/dist/vanilla/templates/registry.d.ts +12 -0
- package/dist/vanilla/theme-injector.d.ts +6 -0
- package/dist/vanilla/theme-injector.js +44 -0
- package/dist/vanilla/vanilla/AppointmentCalendarWidget.d.ts +2 -34
- package/dist/vanilla/vanilla/EnquiryFormWidget.d.ts +35 -0
- package/dist/vanilla/vanilla/index.d.ts +3 -1
- package/dist/vanilla/vanilla/theme-injector.d.ts +6 -0
- package/dist/vanilla/vanilla/widget.d.ts +6 -1
- package/dist/vanilla/widget.css +173 -0
- package/dist/vanilla/widget.d.ts +6 -1
- package/dist/vanilla/widget.js +813 -288
- package/package.json +9 -4
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ChevronDownIcon } from '../Icons/ChevronDownIcon';
|
|
4
|
+
import { Check } from '../Icons/Check';
|
|
5
|
+
const cn = (...classes) => {
|
|
6
|
+
return classes.filter(Boolean).join(' ');
|
|
7
|
+
};
|
|
8
|
+
if (typeof document !== 'undefined') {
|
|
9
|
+
const styleId = 'custom-select-styles';
|
|
10
|
+
if (!document.getElementById(styleId)) {
|
|
11
|
+
const styleElement = document.createElement('style');
|
|
12
|
+
styleElement.id = styleId;
|
|
13
|
+
styleElement.innerHTML = `
|
|
14
|
+
/* Container */
|
|
15
|
+
.select-container {
|
|
16
|
+
position: relative;
|
|
17
|
+
display: inline-block;
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Trigger Button */
|
|
22
|
+
.select-trigger {
|
|
23
|
+
display: flex;
|
|
24
|
+
height: 40px;
|
|
25
|
+
width: 100%;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
border-radius: 6px;
|
|
30
|
+
border: 1px solid #e2e8f0;
|
|
31
|
+
background-color: #fff;
|
|
32
|
+
padding: 8px 12px;
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
line-height: 1.5;
|
|
35
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
36
|
+
transition: all 0.15s ease-in-out;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
outline: none;
|
|
39
|
+
font-family: inherit;
|
|
40
|
+
text-align: left;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.select-trigger:hover:not(:disabled) {
|
|
44
|
+
background-color: #f8fafc;
|
|
45
|
+
border-color: #cbd5e1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.select-trigger:focus:not(:disabled) {
|
|
49
|
+
border-color: #94a3b8;
|
|
50
|
+
box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.2);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.select-trigger:disabled {
|
|
54
|
+
cursor: not-allowed;
|
|
55
|
+
opacity: 0.5;
|
|
56
|
+
background-color: #f9fafb;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.select-trigger-error {
|
|
60
|
+
border-color: #ef4444;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.select-trigger-error:focus {
|
|
64
|
+
border-color: #ef4444;
|
|
65
|
+
box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Select Value */
|
|
69
|
+
.select-value {
|
|
70
|
+
flex: 1;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
text-overflow: ellipsis;
|
|
73
|
+
white-space: nowrap;
|
|
74
|
+
color: #1e293b;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.select-placeholder {
|
|
78
|
+
color: #94a3b8;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Select Icon */
|
|
82
|
+
.select-icon {
|
|
83
|
+
height: 16px;
|
|
84
|
+
width: 16px;
|
|
85
|
+
opacity: 0.5;
|
|
86
|
+
flex-shrink: 0;
|
|
87
|
+
margin-left: 8px;
|
|
88
|
+
transition: transform 0.2s;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.select-trigger[aria-expanded="true"] .select-icon {
|
|
92
|
+
transform: rotate(180deg);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.select-icon-error {
|
|
96
|
+
color: #ef4444;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Content Dropdown */
|
|
100
|
+
.select-content {
|
|
101
|
+
position: absolute;
|
|
102
|
+
top: 100%;
|
|
103
|
+
left: 0;
|
|
104
|
+
right: 0;
|
|
105
|
+
z-index: 1050;
|
|
106
|
+
margin-top: 4px;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
border-radius: 6px;
|
|
109
|
+
border: 1px solid #e2e8f0;
|
|
110
|
+
background-color: #ffffff;
|
|
111
|
+
color: #1e293b;
|
|
112
|
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
113
|
+
animation: select-show 0.15s ease-out;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@keyframes select-show {
|
|
117
|
+
from {
|
|
118
|
+
opacity: 0;
|
|
119
|
+
transform: translateY(-4px);
|
|
120
|
+
}
|
|
121
|
+
to {
|
|
122
|
+
opacity: 1;
|
|
123
|
+
transform: translateY(0);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Viewport */
|
|
128
|
+
.select-viewport {
|
|
129
|
+
padding: 4px;
|
|
130
|
+
max-height: 256px;
|
|
131
|
+
overflow-y: auto;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Select Item */
|
|
135
|
+
.select-item {
|
|
136
|
+
position: relative;
|
|
137
|
+
display: flex;
|
|
138
|
+
width: 100%;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
user-select: none;
|
|
141
|
+
align-items: center;
|
|
142
|
+
border-radius: 4px;
|
|
143
|
+
padding: 8px 8px 8px 32px;
|
|
144
|
+
font-size: 14px;
|
|
145
|
+
outline: none;
|
|
146
|
+
transition: background-color 0.1s ease;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.select-item:hover:not(.select-item-disabled) {
|
|
150
|
+
background-color: #f1f5f9;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.select-item:focus {
|
|
154
|
+
background-color: #f1f5f9;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.select-item-selected {
|
|
158
|
+
background-color: #f3f4f6;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.select-item-disabled {
|
|
162
|
+
pointer-events: none;
|
|
163
|
+
opacity: 0.5;
|
|
164
|
+
cursor: not-allowed;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* Item Indicator */
|
|
168
|
+
.select-item-indicator {
|
|
169
|
+
position: absolute;
|
|
170
|
+
left: 8px;
|
|
171
|
+
display: flex;
|
|
172
|
+
height: 14px;
|
|
173
|
+
width: 14px;
|
|
174
|
+
align-items: center;
|
|
175
|
+
justify-content: center;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Item Text */
|
|
179
|
+
.select-item-text {
|
|
180
|
+
flex: 1;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* Select Group */
|
|
184
|
+
.select-group {
|
|
185
|
+
padding: 2px 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* Select Label */
|
|
189
|
+
.select-label {
|
|
190
|
+
padding: 8px 8px 6px;
|
|
191
|
+
font-size: 12px;
|
|
192
|
+
font-weight: 600;
|
|
193
|
+
color: #64748b;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Select Separator */
|
|
197
|
+
.select-separator {
|
|
198
|
+
margin: 4px 0;
|
|
199
|
+
height: 1px;
|
|
200
|
+
background-color: #e2e8f0;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* Scrollbar styling */
|
|
204
|
+
.select-viewport::-webkit-scrollbar {
|
|
205
|
+
width: 8px;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.select-viewport::-webkit-scrollbar-track {
|
|
209
|
+
background: #f1f5f9;
|
|
210
|
+
border-radius: 4px;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.select-viewport::-webkit-scrollbar-thumb {
|
|
214
|
+
background: #cbd5e1;
|
|
215
|
+
border-radius: 4px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.select-viewport::-webkit-scrollbar-thumb:hover {
|
|
219
|
+
background: #94a3b8;
|
|
220
|
+
}
|
|
221
|
+
`;
|
|
222
|
+
document.head.appendChild(styleElement);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const SelectContext = React.createContext(undefined);
|
|
226
|
+
const useSelectContext = () => {
|
|
227
|
+
const context = React.useContext(SelectContext);
|
|
228
|
+
if (!context) {
|
|
229
|
+
throw new Error('Select components must be used within a Select');
|
|
230
|
+
}
|
|
231
|
+
return context;
|
|
232
|
+
};
|
|
233
|
+
const Select = ({ children, value, onValueChange, defaultValue, disabled = false }) => {
|
|
234
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
235
|
+
const [selectedValue, setSelectedValue] = React.useState(value || defaultValue || '');
|
|
236
|
+
const [selectedLabel, setSelectedLabel] = React.useState('');
|
|
237
|
+
const triggerRef = React.useRef(null);
|
|
238
|
+
const contentRef = React.useRef(null);
|
|
239
|
+
React.useEffect(() => {
|
|
240
|
+
if (value !== undefined) {
|
|
241
|
+
setSelectedValue(value);
|
|
242
|
+
}
|
|
243
|
+
}, [value]);
|
|
244
|
+
React.useEffect(() => {
|
|
245
|
+
const handleClickOutside = (event) => {
|
|
246
|
+
if (triggerRef.current &&
|
|
247
|
+
contentRef.current &&
|
|
248
|
+
!triggerRef.current.contains(event.target) &&
|
|
249
|
+
!contentRef.current.contains(event.target)) {
|
|
250
|
+
setIsOpen(false);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
if (isOpen) {
|
|
254
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
255
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
256
|
+
}
|
|
257
|
+
}, [isOpen]);
|
|
258
|
+
const handleSelect = (value, label) => {
|
|
259
|
+
setSelectedValue(value);
|
|
260
|
+
setSelectedLabel(label);
|
|
261
|
+
if (onValueChange) {
|
|
262
|
+
onValueChange(value);
|
|
263
|
+
}
|
|
264
|
+
setIsOpen(false);
|
|
265
|
+
};
|
|
266
|
+
return (_jsx(SelectContext.Provider, { value: {
|
|
267
|
+
isOpen,
|
|
268
|
+
setIsOpen,
|
|
269
|
+
selectedValue,
|
|
270
|
+
selectedLabel,
|
|
271
|
+
handleSelect,
|
|
272
|
+
triggerRef,
|
|
273
|
+
contentRef,
|
|
274
|
+
disabled,
|
|
275
|
+
}, children: _jsx("div", { className: "select-container", children: children }) }));
|
|
276
|
+
};
|
|
277
|
+
const SelectTrigger = React.forwardRef(({ children, className, error = false, ...props }, ref) => {
|
|
278
|
+
const { isOpen, setIsOpen, triggerRef, disabled } = useSelectContext();
|
|
279
|
+
return (_jsxs("button", { ref: triggerRef, type: "button", className: cn('select-trigger', error && 'select-trigger-error', className), onClick: () => !disabled && setIsOpen(!isOpen), disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "listbox", ...props, children: [children, _jsx(ChevronDownIcon, { className: cn('select-icon', error && 'select-icon-error') })] }));
|
|
280
|
+
});
|
|
281
|
+
SelectTrigger.displayName = 'SelectTrigger';
|
|
282
|
+
const SelectValue = ({ placeholder = 'Select...' }) => {
|
|
283
|
+
const { selectedLabel, selectedValue } = useSelectContext();
|
|
284
|
+
return (_jsx("span", { className: cn('select-value', !selectedValue && 'select-placeholder'), children: selectedLabel || placeholder }));
|
|
285
|
+
};
|
|
286
|
+
const SelectContent = React.forwardRef(({ children, className, ...props }, ref) => {
|
|
287
|
+
const { isOpen, contentRef } = useSelectContext();
|
|
288
|
+
if (!isOpen)
|
|
289
|
+
return null;
|
|
290
|
+
return (_jsx("div", { ref: contentRef, className: cn('select-content', className), role: "listbox", ...props, children: _jsx("div", { className: "select-viewport", children: children }) }));
|
|
291
|
+
});
|
|
292
|
+
SelectContent.displayName = 'SelectContent';
|
|
293
|
+
const SelectItem = React.forwardRef(({ children, value, className, disabled = false, ...props }, ref) => {
|
|
294
|
+
const { selectedValue, handleSelect } = useSelectContext();
|
|
295
|
+
const isSelected = selectedValue === value;
|
|
296
|
+
return (_jsxs("div", { ref: ref, className: cn('select-item', isSelected && 'select-item-selected', disabled && 'select-item-disabled', className), onClick: () => !disabled && handleSelect(value, children), role: "option", "aria-selected": isSelected, "data-disabled": disabled, ...props, children: [isSelected && (_jsx("span", { className: "select-item-indicator", children: _jsx(Check, {}) })), _jsx("span", { className: "select-item-text", children: children })] }));
|
|
297
|
+
});
|
|
298
|
+
SelectItem.displayName = 'SelectItem';
|
|
299
|
+
const SelectGroup = ({ children, className }) => (_jsx("div", { className: cn('select-group', className), children: children }));
|
|
300
|
+
const SelectLabel = ({ children, className }) => (_jsx("div", { className: cn('select-label', className), children: children }));
|
|
301
|
+
const SelectSeparator = ({ className }) => (_jsx("div", { className: cn('select-separator', className) }));
|
|
302
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const formatDateToISO = (date) => {
|
|
2
|
+
const year = String(date.getFullYear()).padStart(4, "0");
|
|
3
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
4
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
5
|
+
return `${year}-${month}-${day}`;
|
|
6
|
+
};
|
|
7
|
+
export const parsePatientName = (fullName) => {
|
|
8
|
+
const nameParts = fullName.trim().split(/\s+/);
|
|
9
|
+
const firstName = nameParts[0] || "Patient";
|
|
10
|
+
const lastName = nameParts.slice(1).join(" ") || "";
|
|
11
|
+
return {
|
|
12
|
+
firstName,
|
|
13
|
+
lastName,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import type { TemplateId } from "../core";
|
|
3
|
+
interface TemplateContextType {
|
|
4
|
+
templateId: TemplateId;
|
|
5
|
+
}
|
|
6
|
+
export interface TemplateProviderProps {
|
|
7
|
+
templateId: TemplateId;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const TemplateProvider: React.FC<TemplateProviderProps>;
|
|
11
|
+
export declare const useTemplate: () => TemplateContextType;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { createContext, useContext, useEffect } from "react";
|
|
3
|
+
import { injectTemplateStyles, removeTemplateStyles, } from "../lib/templateUtils";
|
|
4
|
+
const TemplateContext = createContext(null);
|
|
5
|
+
export const TemplateProvider = ({ templateId, children, }) => {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
injectTemplateStyles(templateId);
|
|
8
|
+
return () => removeTemplateStyles();
|
|
9
|
+
}, [templateId]);
|
|
10
|
+
const contextValue = React.useMemo(() => ({ templateId }), [templateId]);
|
|
11
|
+
return (_jsx(TemplateContext.Provider, { value: contextValue, children: _jsx("div", { className: "medos-sdk-container", children: children }) }));
|
|
12
|
+
};
|
|
13
|
+
export const useTemplate = () => {
|
|
14
|
+
const context = useContext(TemplateContext);
|
|
15
|
+
if (!context) {
|
|
16
|
+
return { templateId: "default" };
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
};
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export { MedosClient } from "../client/MedosClient";
|
|
2
|
+
export * from "./theme";
|
|
2
3
|
export * from "../appointments/provider";
|
|
3
4
|
export * from "../appointments/types";
|
|
4
5
|
export * from "../appointment-calendar/provider";
|
|
5
6
|
export * from "../appointment-calendar/types";
|
|
7
|
+
export * from "../enquiry-form/provider";
|
|
8
|
+
export * from "../enquiry-form/types";
|
|
6
9
|
export { PatientService, SendPhoneVerificationOtpPayload, VerifyPhoneVerificationOtpPayload, } from "../services/PatientService";
|
|
7
10
|
export { AppointmentService, type BookAppointmentPayload, type PatientPayload, type PatientAddressPayload, type AddressesResponse, type AddressItem, } from "../services/AppointmentService";
|
|
8
11
|
export { AuthService } from "../services/AuthService";
|
|
12
|
+
export { EnquiryService } from "../services/EnquiryService";
|
package/dist/core/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export { MedosClient } from "../client/MedosClient";
|
|
2
|
+
export * from "./theme";
|
|
2
3
|
export * from "../appointments/provider";
|
|
3
4
|
export * from "../appointments/types";
|
|
4
5
|
export * from "../appointment-calendar/provider";
|
|
5
6
|
export * from "../appointment-calendar/types";
|
|
7
|
+
export * from "../enquiry-form/provider";
|
|
8
|
+
export * from "../enquiry-form/types";
|
|
6
9
|
export { PatientService, } from "../services/PatientService";
|
|
7
10
|
export { AppointmentService, } from "../services/AppointmentService";
|
|
8
11
|
export { AuthService } from "../services/AuthService";
|
|
12
|
+
export { EnquiryService } from "../services/EnquiryService";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MedosTheme } from "./types";
|
|
2
|
+
export declare const defaultTheme: MedosTheme;
|
|
3
|
+
export declare const modernTheme: MedosTheme;
|
|
4
|
+
export declare const themes: {
|
|
5
|
+
readonly default: MedosTheme;
|
|
6
|
+
readonly modern: MedosTheme;
|
|
7
|
+
};
|
|
8
|
+
export type ThemeName = keyof typeof themes;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
export const defaultTheme = {
|
|
2
|
+
name: "default",
|
|
3
|
+
colors: {
|
|
4
|
+
primary: "#27903F",
|
|
5
|
+
primaryHover: "#218838",
|
|
6
|
+
primaryActive: "#1e7835",
|
|
7
|
+
secondary: "#009b4d",
|
|
8
|
+
secondaryHover: "#008840",
|
|
9
|
+
accent: "#10b981",
|
|
10
|
+
accentHover: "#059669",
|
|
11
|
+
background: "#f6f8fa",
|
|
12
|
+
backgroundSecondary: "#f9fafb",
|
|
13
|
+
backgroundTertiary: "#fff",
|
|
14
|
+
surface: "#fff",
|
|
15
|
+
surfaceHover: "#f9fafb",
|
|
16
|
+
border: "#e5e7eb",
|
|
17
|
+
borderHover: "#d1d5db",
|
|
18
|
+
borderFocus: "#27903F",
|
|
19
|
+
text: "#111827",
|
|
20
|
+
textSecondary: "#374151",
|
|
21
|
+
textTertiary: "#6b7280",
|
|
22
|
+
textDisabled: "#9ca3af",
|
|
23
|
+
textOnPrimary: "#fff",
|
|
24
|
+
textOnSecondary: "#fff",
|
|
25
|
+
success: "#10b981",
|
|
26
|
+
successBackground: "#ecfdf5",
|
|
27
|
+
successBorder: "#6ee7b7",
|
|
28
|
+
error: "#ef4444",
|
|
29
|
+
errorBackground: "#fee2e2",
|
|
30
|
+
errorBorder: "#fca5a5",
|
|
31
|
+
warning: "#f59e0b",
|
|
32
|
+
warningBackground: "#fef3c7",
|
|
33
|
+
warningBorder: "#fcd34d",
|
|
34
|
+
info: "#3b82f6",
|
|
35
|
+
infoBackground: "#dbeafe",
|
|
36
|
+
infoBorder: "#93c5fd",
|
|
37
|
+
},
|
|
38
|
+
typography: {
|
|
39
|
+
fontFamily: "'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
|
|
40
|
+
fontFamilyHeading: "'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
|
|
41
|
+
fontSizeXs: "12px",
|
|
42
|
+
fontSizeSm: "14px",
|
|
43
|
+
fontSizeMd: "16px",
|
|
44
|
+
fontSizeLg: "18px",
|
|
45
|
+
fontSizeXl: "20px",
|
|
46
|
+
fontSize2xl: "24px",
|
|
47
|
+
fontSize3xl: "30px",
|
|
48
|
+
fontWeightNormal: "400",
|
|
49
|
+
fontWeightMedium: "500",
|
|
50
|
+
fontWeightSemibold: "600",
|
|
51
|
+
fontWeightBold: "700",
|
|
52
|
+
lineHeightTight: "1.25",
|
|
53
|
+
lineHeightNormal: "1.5",
|
|
54
|
+
lineHeightRelaxed: "1.75",
|
|
55
|
+
},
|
|
56
|
+
spacing: {
|
|
57
|
+
xs: "4px",
|
|
58
|
+
sm: "8px",
|
|
59
|
+
md: "12px",
|
|
60
|
+
lg: "16px",
|
|
61
|
+
xl: "20px",
|
|
62
|
+
"2xl": "24px",
|
|
63
|
+
"3xl": "32px",
|
|
64
|
+
"4xl": "40px",
|
|
65
|
+
},
|
|
66
|
+
shadows: {
|
|
67
|
+
none: "none",
|
|
68
|
+
sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
|
|
69
|
+
md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
|
|
70
|
+
lg: "0 8px 24px rgba(16, 24, 40, 0.08)",
|
|
71
|
+
xl: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
|
|
72
|
+
"2xl": "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
|
|
73
|
+
},
|
|
74
|
+
radii: {
|
|
75
|
+
none: "0",
|
|
76
|
+
sm: "4px",
|
|
77
|
+
md: "8px",
|
|
78
|
+
lg: "12px",
|
|
79
|
+
xl: "16px",
|
|
80
|
+
full: "9999px",
|
|
81
|
+
},
|
|
82
|
+
transitions: {
|
|
83
|
+
fast: "150ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
84
|
+
normal: "200ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
85
|
+
slow: "300ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
export const modernTheme = {
|
|
89
|
+
name: "modern",
|
|
90
|
+
colors: {
|
|
91
|
+
primary: "#1e3a5f",
|
|
92
|
+
primaryHover: "#2c4a6f",
|
|
93
|
+
primaryActive: "#152942",
|
|
94
|
+
secondary: "#ff6b35",
|
|
95
|
+
secondaryHover: "#ff5722",
|
|
96
|
+
accent: "#3b82f6",
|
|
97
|
+
accentHover: "#2563eb",
|
|
98
|
+
background: "#ffffff",
|
|
99
|
+
backgroundSecondary: "#f8fafc",
|
|
100
|
+
backgroundTertiary: "#f1f5f9",
|
|
101
|
+
surface: "#ffffff",
|
|
102
|
+
surfaceHover: "#f8fafc",
|
|
103
|
+
border: "#e2e8f0",
|
|
104
|
+
borderHover: "#cbd5e1",
|
|
105
|
+
borderFocus: "#3b82f6",
|
|
106
|
+
text: "#1e293b",
|
|
107
|
+
textSecondary: "#64748b",
|
|
108
|
+
textTertiary: "#94a3b8",
|
|
109
|
+
textDisabled: "#cbd5e1",
|
|
110
|
+
textOnPrimary: "#ffffff",
|
|
111
|
+
textOnSecondary: "#ffffff",
|
|
112
|
+
success: "#10b981",
|
|
113
|
+
successBackground: "#ecfdf5",
|
|
114
|
+
successBorder: "#6ee7b7",
|
|
115
|
+
error: "#ef4444",
|
|
116
|
+
errorBackground: "#fef2f2",
|
|
117
|
+
errorBorder: "#fca5a5",
|
|
118
|
+
warning: "#f59e0b",
|
|
119
|
+
warningBackground: "#fffbeb",
|
|
120
|
+
warningBorder: "#fcd34d",
|
|
121
|
+
info: "#0ea5e9",
|
|
122
|
+
infoBackground: "#e0f2fe",
|
|
123
|
+
infoBorder: "#7dd3fc",
|
|
124
|
+
},
|
|
125
|
+
typography: {
|
|
126
|
+
fontFamily: "'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
|
|
127
|
+
fontFamilyHeading: "'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
|
|
128
|
+
fontSizeXs: "12px",
|
|
129
|
+
fontSizeSm: "14px",
|
|
130
|
+
fontSizeMd: "16px",
|
|
131
|
+
fontSizeLg: "18px",
|
|
132
|
+
fontSizeXl: "20px",
|
|
133
|
+
fontSize2xl: "24px",
|
|
134
|
+
fontSize3xl: "30px",
|
|
135
|
+
fontWeightNormal: "400",
|
|
136
|
+
fontWeightMedium: "500",
|
|
137
|
+
fontWeightSemibold: "600",
|
|
138
|
+
fontWeightBold: "700",
|
|
139
|
+
lineHeightTight: "1.25",
|
|
140
|
+
lineHeightNormal: "1.5",
|
|
141
|
+
lineHeightRelaxed: "1.75",
|
|
142
|
+
},
|
|
143
|
+
spacing: {
|
|
144
|
+
xs: "4px",
|
|
145
|
+
sm: "8px",
|
|
146
|
+
md: "12px",
|
|
147
|
+
lg: "16px",
|
|
148
|
+
xl: "20px",
|
|
149
|
+
"2xl": "24px",
|
|
150
|
+
"3xl": "32px",
|
|
151
|
+
"4xl": "40px",
|
|
152
|
+
},
|
|
153
|
+
shadows: {
|
|
154
|
+
none: "none",
|
|
155
|
+
sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
|
|
156
|
+
md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
|
|
157
|
+
lg: "0 8px 24px rgba(30, 58, 95, 0.12)",
|
|
158
|
+
xl: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
|
|
159
|
+
"2xl": "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
|
|
160
|
+
},
|
|
161
|
+
radii: {
|
|
162
|
+
none: "0",
|
|
163
|
+
sm: "4px",
|
|
164
|
+
md: "8px",
|
|
165
|
+
lg: "12px",
|
|
166
|
+
xl: "16px",
|
|
167
|
+
full: "9999px",
|
|
168
|
+
},
|
|
169
|
+
transitions: {
|
|
170
|
+
fast: "150ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
171
|
+
normal: "200ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
172
|
+
slow: "300ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
export const themes = {
|
|
176
|
+
default: defaultTheme,
|
|
177
|
+
modern: modernTheme,
|
|
178
|
+
};
|