@licklist/design 0.78.32 → 0.78.33
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/Maintenance/MaintenancePage.js +1 -0
- package/dist/index.js +8 -1
- package/dist/v2/components/ActionMenu/ActionMenu.d.ts +14 -0
- package/dist/v2/components/ActionMenu/ActionMenu.d.ts.map +1 -0
- package/dist/v2/components/ActionMenu/ActionMenu.js +159 -0
- package/dist/v2/components/ActionMenu/ActionMenu.scss.js +6 -0
- package/dist/v2/components/ActionMenu/index.d.ts +2 -0
- package/dist/v2/components/ActionMenu/index.d.ts.map +1 -0
- package/dist/v2/components/Alert/Alert.scss.js +1 -1
- package/dist/v2/components/Badge/Badge.d.ts +10 -0
- package/dist/v2/components/Badge/Badge.d.ts.map +1 -0
- package/dist/v2/components/Badge/Badge.js +19 -0
- package/dist/v2/components/Badge/Badge.scss.js +6 -0
- package/dist/v2/components/Badge/index.d.ts +2 -0
- package/dist/v2/components/Badge/index.d.ts.map +1 -0
- package/dist/v2/components/Button/Button.d.ts +3 -2
- package/dist/v2/components/Button/Button.d.ts.map +1 -1
- package/dist/v2/components/Button/Button.js +13 -6
- package/dist/v2/components/Button/Button.scss.js +1 -1
- package/dist/v2/components/Button/GhostButton.scss.js +1 -1
- package/dist/v2/components/Button/index.d.ts +2 -0
- package/dist/v2/components/Button/index.d.ts.map +1 -1
- package/dist/v2/components/Checkbox/Checkbox.scss.js +1 -1
- package/dist/v2/components/FormField/FormField.d.ts.map +1 -1
- package/dist/v2/components/FormField/FormField.scss.js +1 -1
- package/dist/v2/components/Modal/DeleteModal.d.ts +15 -0
- package/dist/v2/components/Modal/DeleteModal.d.ts.map +1 -0
- package/dist/v2/components/Modal/DeleteModal.js +151 -0
- package/dist/v2/components/Modal/DeleteModal.scss.js +6 -0
- package/dist/v2/components/Modal/index.d.ts +3 -0
- package/dist/v2/components/Modal/index.d.ts.map +1 -0
- package/dist/v2/components/NewInput/NewInput.d.ts +2 -0
- package/dist/v2/components/NewInput/NewInput.d.ts.map +1 -1
- package/dist/v2/components/NewInput/NewInput.js +37 -12
- package/dist/v2/components/NewPageHeader/NewPageHeader.d.ts +4 -1
- package/dist/v2/components/NewPageHeader/NewPageHeader.d.ts.map +1 -1
- package/dist/v2/components/NewPageHeader/NewPageHeader.js +18 -11
- package/dist/v2/components/NewPageHeader/NewPageHeader.scss.js +1 -1
- package/dist/v2/components/NewTable/NewTable.d.ts +21 -0
- package/dist/v2/components/NewTable/NewTable.d.ts.map +1 -0
- package/dist/v2/components/NewTable/NewTable.js +63 -0
- package/dist/v2/components/NewTable/NewTable.scss.js +6 -0
- package/dist/v2/components/NewTable/index.d.ts +2 -0
- package/dist/v2/components/NewTable/index.d.ts.map +1 -0
- package/dist/v2/components/Pagination/Pagination.d.ts +13 -0
- package/dist/v2/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/v2/components/Pagination/Pagination.js +76 -0
- package/dist/v2/components/Pagination/Pagination.scss.js +6 -0
- package/dist/v2/components/Pagination/index.d.ts +2 -0
- package/dist/v2/components/Pagination/index.d.ts.map +1 -0
- package/dist/v2/components/QuickFilter/QuickFilter.d.ts +14 -0
- package/dist/v2/components/QuickFilter/QuickFilter.d.ts.map +1 -0
- package/dist/v2/components/QuickFilter/QuickFilter.js +70 -0
- package/dist/v2/components/QuickFilter/QuickFilter.scss.js +6 -0
- package/dist/v2/components/QuickFilter/index.d.ts +2 -0
- package/dist/v2/components/QuickFilter/index.d.ts.map +1 -0
- package/dist/v2/components/SectionHeader/SectionHeader.d.ts.map +1 -1
- package/dist/v2/components/Select/Select.d.ts +7 -4
- package/dist/v2/components/Select/Select.d.ts.map +1 -1
- package/dist/v2/components/Select/Select.js +53 -24
- package/dist/v2/components/Select/Select.scss.js +1 -1
- package/dist/v2/components/TableSortIcon/TableSortIcon.d.ts +9 -0
- package/dist/v2/components/TableSortIcon/TableSortIcon.d.ts.map +1 -0
- package/dist/v2/components/TableSortIcon/TableSortIcon.js +14 -0
- package/dist/v2/components/TableSortIcon/index.d.ts +2 -0
- package/dist/v2/components/TableSortIcon/index.d.ts.map +1 -0
- package/dist/v2/components/WYSIWYGEditor/Icons.js +2 -2
- package/dist/v2/components/WYSIWYGEditor/WYSIWYGEditor.scss.js +1 -1
- package/dist/v2/components/index.d.ts +17 -4
- package/dist/v2/components/index.d.ts.map +1 -1
- package/dist/v2/icons/index.d.ts +46 -0
- package/dist/v2/icons/index.d.ts.map +1 -1
- package/dist/v2/icons/index.js +358 -4
- package/dist/v2/navigation/DashboardLayout/ProviderSidebar.d.ts.map +1 -1
- package/dist/v2/navigation/DashboardLayout/ProviderSidebar.js +4 -8
- package/dist/v2/pages/Settings/components/SidebarCustomisation.js +9 -3
- package/dist/v2/pages/Settings/components/SidebarNavItem.js +9 -3
- package/dist/v2/styles/form/NewInput.scss.js +1 -1
- package/package.json +3 -3
- package/src/v2/components/ActionMenu/ActionMenu.scss +106 -0
- package/src/v2/components/ActionMenu/ActionMenu.tsx +115 -0
- package/src/v2/components/ActionMenu/index.ts +1 -0
- package/src/v2/components/Badge/Badge.scss +82 -0
- package/src/v2/components/Badge/Badge.tsx +25 -0
- package/src/v2/components/Badge/index.ts +1 -0
- package/src/v2/components/Button/Button.tsx +18 -4
- package/src/v2/components/Button/GhostButton.scss +11 -1
- package/src/v2/components/Button/index.ts +2 -0
- package/src/v2/components/Customer/CustomerDetail.scss +319 -0
- package/src/v2/components/Customer/CustomersList.scss +815 -0
- package/src/v2/components/FormField/FormField.tsx +19 -21
- package/src/v2/components/Modal/DeleteModal.scss +254 -0
- package/src/v2/components/Modal/DeleteModal.tsx +102 -0
- package/src/v2/components/Modal/index.ts +3 -0
- package/src/v2/components/NewInput/NewInput.stories.tsx +3 -18
- package/src/v2/components/NewInput/NewInput.tsx +35 -12
- package/src/v2/components/NewPageHeader/NewPageHeader.scss +17 -8
- package/src/v2/components/NewPageHeader/NewPageHeader.tsx +17 -10
- package/src/v2/components/NewTable/NewTable.scss +126 -0
- package/src/v2/components/NewTable/NewTable.tsx +92 -0
- package/src/v2/components/NewTable/index.ts +1 -0
- package/src/v2/components/Pagination/Pagination.scss +142 -0
- package/src/v2/components/Pagination/Pagination.tsx +80 -0
- package/src/v2/components/Pagination/index.ts +1 -0
- package/src/v2/components/QuickFilter/QuickFilter.scss +67 -0
- package/src/v2/components/QuickFilter/QuickFilter.tsx +51 -0
- package/src/v2/components/QuickFilter/index.ts +1 -0
- package/src/v2/components/SectionHeader/SectionHeader.tsx +5 -7
- package/src/v2/components/Select/Select.scss +61 -24
- package/src/v2/components/Select/Select.stories.tsx +77 -1
- package/src/v2/components/Select/Select.tsx +63 -34
- package/src/v2/components/TableSortIcon/TableSortIcon.tsx +20 -0
- package/src/v2/components/TableSortIcon/index.ts +1 -0
- package/src/v2/components/WYSIWYGEditor/Icons.tsx +2 -2
- package/src/v2/components/index.ts +44 -5
- package/src/v2/icons/index.tsx +123 -3
- package/src/v2/navigation/DashboardLayout/ProviderSidebar.tsx +3 -1
- package/src/v2/navigation/config.tsx +1 -1
- package/src/v2/pages/Settings/components/SidebarCustomisation.tsx +1 -1
- package/src/v2/styles/common.scss +7 -0
- package/src/v2/styles/components/Button.scss +34 -2
- package/src/v2/styles/form/NewInput.scss +45 -21
- package/src/v2/styles/index.scss +1 -0
|
@@ -9,27 +9,25 @@ export interface FormFieldProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const FormField = forwardRef<HTMLInputElement, FormFieldProps>(
|
|
12
|
-
({ label, error, helpText, required, className = '', ...props }, ref) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{helpText
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
)
|
|
32
|
-
}
|
|
12
|
+
({ label, error, helpText, required, className = '', ...props }, ref) => (
|
|
13
|
+
<div className={`form-field ${className}`}>
|
|
14
|
+
{label && (
|
|
15
|
+
<label className="form-field__label">
|
|
16
|
+
{label}
|
|
17
|
+
{required && <span className="form-field__required">*</span>}
|
|
18
|
+
</label>
|
|
19
|
+
)}
|
|
20
|
+
<input
|
|
21
|
+
ref={ref}
|
|
22
|
+
className={`form-field__input ${error ? 'form-field__input--error' : ''}`}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
{helpText && !error && (
|
|
26
|
+
<span className="form-field__help-text">{helpText}</span>
|
|
27
|
+
)}
|
|
28
|
+
{error && <span className="form-field__error-text">{error}</span>}
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
33
31
|
)
|
|
34
32
|
|
|
35
33
|
FormField.displayName = 'FormField'
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
.delete-modal-overlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
z-index: 1000;
|
|
12
|
+
animation: fadeIn 0.2s ease-in-out;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@keyframes fadeIn {
|
|
16
|
+
from { opacity: 0; }
|
|
17
|
+
to { opacity: 1; }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.delete-modal {
|
|
21
|
+
background: white;
|
|
22
|
+
border-radius: 12px;
|
|
23
|
+
width: 95%;
|
|
24
|
+
max-width: 800px;
|
|
25
|
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
26
|
+
animation: slideUp 0.2s ease-in-out;
|
|
27
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@keyframes slideUp {
|
|
31
|
+
from {
|
|
32
|
+
transform: translateY(10px);
|
|
33
|
+
opacity: 0;
|
|
34
|
+
}
|
|
35
|
+
to {
|
|
36
|
+
transform: translateY(0);
|
|
37
|
+
opacity: 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.delete-modal__content {
|
|
42
|
+
padding: 48px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.delete-modal__title {
|
|
46
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
47
|
+
font-size: 32px;
|
|
48
|
+
font-weight: 700;
|
|
49
|
+
color: #14215A;
|
|
50
|
+
margin: 0 0 24px 0;
|
|
51
|
+
line-height: 40px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.delete-modal__description-group {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
gap: 24px;
|
|
58
|
+
margin-bottom: 32px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.delete-modal__description {
|
|
62
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
63
|
+
font-size: 20px;
|
|
64
|
+
font-weight: 400;
|
|
65
|
+
color: #626A90;
|
|
66
|
+
margin: 0;
|
|
67
|
+
line-height: 28px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.delete-modal__confirmation {
|
|
71
|
+
margin-bottom: 40px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.delete-modal__label {
|
|
75
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
76
|
+
display: block;
|
|
77
|
+
font-size: 20px;
|
|
78
|
+
color: #14215A;
|
|
79
|
+
margin-bottom: 16px;
|
|
80
|
+
font-weight: 600;
|
|
81
|
+
|
|
82
|
+
strong {
|
|
83
|
+
font-weight: 700;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.delete-modal__input {
|
|
88
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
89
|
+
width: 100%;
|
|
90
|
+
padding: 16px 24px;
|
|
91
|
+
font-size: 20px;
|
|
92
|
+
border: 1px solid #E8E9EF;
|
|
93
|
+
border-radius: 12px;
|
|
94
|
+
outline: none;
|
|
95
|
+
transition: all 0.2s ease-in-out;
|
|
96
|
+
font-family: inherit;
|
|
97
|
+
color: #14215A;
|
|
98
|
+
|
|
99
|
+
&::placeholder {
|
|
100
|
+
color: #626A90;
|
|
101
|
+
opacity: 0.6;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&:focus {
|
|
105
|
+
border-color: #D2D5E3;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.delete-modal__actions {
|
|
110
|
+
display: flex;
|
|
111
|
+
gap: 16px;
|
|
112
|
+
align-items: center;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.delete-modal__button {
|
|
116
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
117
|
+
padding: 12px 32px;
|
|
118
|
+
font-size: 20px;
|
|
119
|
+
font-weight: 600;
|
|
120
|
+
border-radius: 12px;
|
|
121
|
+
border: none;
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
transition: all 0.2s ease-in-out;
|
|
124
|
+
font-family: inherit;
|
|
125
|
+
outline: none;
|
|
126
|
+
min-height: 64px;
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
|
|
131
|
+
&:disabled {
|
|
132
|
+
opacity: 0.6;
|
|
133
|
+
cursor: not-allowed;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&--delete {
|
|
137
|
+
background-color: #CC3C35;
|
|
138
|
+
color: white;
|
|
139
|
+
|
|
140
|
+
&:disabled {
|
|
141
|
+
opacity: 0.5;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&:hover:not(:disabled) {
|
|
145
|
+
background-color: #b33630;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&--cancel {
|
|
150
|
+
background-color: transparent;
|
|
151
|
+
color: var(--label-primary);
|
|
152
|
+
border: 2px solid #D2D5E3;
|
|
153
|
+
|
|
154
|
+
&:hover:not(:disabled) {
|
|
155
|
+
background-color: var(--surface-secondary);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Mobile styles
|
|
161
|
+
@media (max-width: 768px) {
|
|
162
|
+
.delete-modal {
|
|
163
|
+
max-width: 90%;
|
|
164
|
+
width: 90%;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.delete-modal__content {
|
|
168
|
+
padding: 32px 24px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.delete-modal__title {
|
|
172
|
+
font-size: 24px;
|
|
173
|
+
line-height: 32px;
|
|
174
|
+
margin-bottom: 16px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.delete-modal__description-group {
|
|
178
|
+
gap: 16px;
|
|
179
|
+
margin-bottom: 24px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.delete-modal__description {
|
|
183
|
+
font-size: 16px;
|
|
184
|
+
line-height: 24px;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.delete-modal__confirmation {
|
|
188
|
+
margin-bottom: 32px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.delete-modal__label {
|
|
192
|
+
font-size: 16px;
|
|
193
|
+
margin-bottom: 12px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.delete-modal__actions {
|
|
197
|
+
gap: 12px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.delete-modal__button {
|
|
201
|
+
padding: 10px 24px;
|
|
202
|
+
font-size: 16px;
|
|
203
|
+
min-height: 52px;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@media (max-width: 480px) {
|
|
208
|
+
.delete-modal {
|
|
209
|
+
max-width: 95%;
|
|
210
|
+
width: 95%;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.delete-modal__content {
|
|
214
|
+
padding: 24px 16px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.delete-modal__title {
|
|
218
|
+
font-size: 20px;
|
|
219
|
+
line-height: 28px;
|
|
220
|
+
margin-bottom: 12px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.delete-modal__description-group {
|
|
224
|
+
gap: 12px;
|
|
225
|
+
margin-bottom: 20px;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.delete-modal__description {
|
|
229
|
+
font-size: 14px;
|
|
230
|
+
line-height: 20px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.delete-modal__confirmation {
|
|
234
|
+
margin-bottom: 24px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.delete-modal__label {
|
|
238
|
+
font-size: 14px;
|
|
239
|
+
margin-bottom: 10px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.delete-modal__actions {
|
|
243
|
+
flex-direction: column;
|
|
244
|
+
gap: 8px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.delete-modal__button {
|
|
248
|
+
width: 100%;
|
|
249
|
+
padding: 8px 20px;
|
|
250
|
+
font-size: 14px;
|
|
251
|
+
min-height: 48px;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import './DeleteModal.scss'
|
|
3
|
+
import { NewInput } from '../NewInput'
|
|
4
|
+
|
|
5
|
+
export interface DeleteModalProps {
|
|
6
|
+
isOpen: boolean
|
|
7
|
+
onClose: () => void
|
|
8
|
+
onConfirm: () => void
|
|
9
|
+
title: string
|
|
10
|
+
description?: string
|
|
11
|
+
description_1?: string
|
|
12
|
+
confirmationText: string
|
|
13
|
+
confirmationPlaceholder?: string
|
|
14
|
+
isDeleting?: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const DeleteModal: React.FC<DeleteModalProps> = ({
|
|
18
|
+
isOpen,
|
|
19
|
+
onClose,
|
|
20
|
+
onConfirm,
|
|
21
|
+
title,
|
|
22
|
+
description,
|
|
23
|
+
description_1,
|
|
24
|
+
confirmationText,
|
|
25
|
+
confirmationPlaceholder,
|
|
26
|
+
isDeleting = false,
|
|
27
|
+
}) => {
|
|
28
|
+
const [inputValue, setInputValue] = useState('')
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!isOpen) {
|
|
32
|
+
setInputValue('')
|
|
33
|
+
}
|
|
34
|
+
}, [isOpen])
|
|
35
|
+
|
|
36
|
+
const handleClose = () => {
|
|
37
|
+
onClose()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const handleConfirm = () => {
|
|
41
|
+
if (inputValue === confirmationText) {
|
|
42
|
+
onConfirm()
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const isConfirmDisabled = inputValue !== confirmationText || isDeleting
|
|
47
|
+
|
|
48
|
+
if (!isOpen) return null
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className="delete-modal-overlay" role="presentation" onClick={handleClose}>
|
|
52
|
+
<div className="delete-modal" role="presentation" onClick={(e) => e.stopPropagation()}>
|
|
53
|
+
<div className="delete-modal__content">
|
|
54
|
+
<h2 className="delete-modal__title">{title}</h2>
|
|
55
|
+
|
|
56
|
+
<div className="delete-modal__description-group">
|
|
57
|
+
{description && (
|
|
58
|
+
<p className="delete-modal__description">{description}</p>
|
|
59
|
+
)}
|
|
60
|
+
|
|
61
|
+
{description_1 && (
|
|
62
|
+
<p className="delete-modal__description">{description_1}</p>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div className="delete-modal__confirmation">
|
|
67
|
+
<p className="delete-modal__label">
|
|
68
|
+
Type <strong>{confirmationText}</strong> to confirm deletion
|
|
69
|
+
</p>
|
|
70
|
+
<NewInput
|
|
71
|
+
type="text"
|
|
72
|
+
placeholder={confirmationPlaceholder || confirmationText}
|
|
73
|
+
value={inputValue}
|
|
74
|
+
onChange={(e) => setInputValue(e.target.value)}
|
|
75
|
+
autoFocus
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div className="delete-modal__actions">
|
|
80
|
+
<button
|
|
81
|
+
type="button"
|
|
82
|
+
className="delete-modal__button delete-modal__button--delete"
|
|
83
|
+
onClick={handleConfirm}
|
|
84
|
+
disabled={isConfirmDisabled}
|
|
85
|
+
>
|
|
86
|
+
{isDeleting ? 'Deleting...' : 'Delete'}
|
|
87
|
+
</button>
|
|
88
|
+
<button
|
|
89
|
+
type="button"
|
|
90
|
+
className="delete-modal__button delete-modal__button--cancel"
|
|
91
|
+
onClick={handleClose}
|
|
92
|
+
disabled={isDeleting}
|
|
93
|
+
>
|
|
94
|
+
Cancel
|
|
95
|
+
</button>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
2
|
import { NewInput } from './NewInput'
|
|
3
3
|
import { useState } from 'react'
|
|
4
|
+
import { SearchIcon, CalendarSmallIcon } from '../../icons'
|
|
4
5
|
|
|
5
6
|
const meta: Meta<typeof NewInput> = {
|
|
6
7
|
title: 'V2/Components/NewInput',
|
|
@@ -121,6 +122,7 @@ export const DateInput: Story = {
|
|
|
121
122
|
args: {
|
|
122
123
|
label: 'Date of Birth',
|
|
123
124
|
type: 'date',
|
|
125
|
+
icon: <CalendarSmallIcon />,
|
|
124
126
|
},
|
|
125
127
|
}
|
|
126
128
|
|
|
@@ -202,24 +204,7 @@ export const RequiredField: Story = {
|
|
|
202
204
|
export const WithIcon: Story = {
|
|
203
205
|
args: {
|
|
204
206
|
label: 'Search',
|
|
205
|
-
|
|
206
|
-
icon: (
|
|
207
|
-
<svg
|
|
208
|
-
width="20"
|
|
209
|
-
height="20"
|
|
210
|
-
viewBox="0 0 20 20"
|
|
211
|
-
fill="none"
|
|
212
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
213
|
-
>
|
|
214
|
-
<path
|
|
215
|
-
d="M9 17A8 8 0 1 0 9 1a8 8 0 0 0 0 16zM18 18l-4.35-4.35"
|
|
216
|
-
stroke="currentColor"
|
|
217
|
-
strokeWidth="2"
|
|
218
|
-
strokeLinecap="round"
|
|
219
|
-
strokeLinejoin="round"
|
|
220
|
-
/>
|
|
221
|
-
</svg>
|
|
222
|
-
),
|
|
207
|
+
icon: <SearchIcon />,
|
|
223
208
|
},
|
|
224
209
|
}
|
|
225
210
|
|
|
@@ -7,7 +7,9 @@ type CommonInputProps = {
|
|
|
7
7
|
helperText?: string;
|
|
8
8
|
error?: string;
|
|
9
9
|
icon?: ReactNode;
|
|
10
|
+
iconPosition?: 'left' | 'right';
|
|
10
11
|
required?: boolean;
|
|
12
|
+
onIconClick?: () => void;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
type InputProps = CommonInputProps & {
|
|
@@ -21,7 +23,8 @@ type TextareaProps = CommonInputProps & {
|
|
|
21
23
|
export type NewInputProps = InputProps | TextareaProps
|
|
22
24
|
|
|
23
25
|
export const NewInput = forwardRef<HTMLInputElement | HTMLTextAreaElement, NewInputProps>(
|
|
24
|
-
({label, optional, helperText, error, icon, as = 'input', required, className = '', ...props}, ref) => {
|
|
26
|
+
({label, optional, helperText, error, icon, iconPosition = 'left', as = 'input', required, className = '', onIconClick, ...props}, ref) => {
|
|
27
|
+
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
25
28
|
const isError = !!error;
|
|
26
29
|
const containerClasses = [
|
|
27
30
|
'new-form-input',
|
|
@@ -30,6 +33,17 @@ export const NewInput = forwardRef<HTMLInputElement | HTMLTextAreaElement, NewIn
|
|
|
30
33
|
className
|
|
31
34
|
].filter(Boolean).join(' ');
|
|
32
35
|
|
|
36
|
+
// Merge refs
|
|
37
|
+
React.useImperativeHandle(ref, () => inputRef.current as HTMLInputElement);
|
|
38
|
+
|
|
39
|
+
const handleIconClick = () => {
|
|
40
|
+
if (onIconClick) {
|
|
41
|
+
onIconClick();
|
|
42
|
+
} else if (inputRef.current && (props as any).type === 'date') {
|
|
43
|
+
inputRef.current.showPicker?.();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
33
47
|
const renderInput = () => {
|
|
34
48
|
if (as === 'textarea') {
|
|
35
49
|
return (
|
|
@@ -43,12 +57,26 @@ export const NewInput = forwardRef<HTMLInputElement | HTMLTextAreaElement, NewIn
|
|
|
43
57
|
|
|
44
58
|
if (icon) {
|
|
45
59
|
return (
|
|
46
|
-
<div className=
|
|
60
|
+
<div className={`new-form-input__input-with-icon new-form-input__input-with-icon--${iconPosition}`}>
|
|
47
61
|
<input
|
|
48
|
-
ref={
|
|
62
|
+
ref={inputRef}
|
|
49
63
|
{...(props as React.InputHTMLAttributes<HTMLInputElement>)}
|
|
50
64
|
/>
|
|
51
|
-
<div
|
|
65
|
+
<div
|
|
66
|
+
className="icon"
|
|
67
|
+
role="button"
|
|
68
|
+
tabIndex={0}
|
|
69
|
+
onClick={handleIconClick}
|
|
70
|
+
onKeyDown={(e) => {
|
|
71
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
handleIconClick();
|
|
74
|
+
}
|
|
75
|
+
}}
|
|
76
|
+
style={{ cursor: (onIconClick || (props as any).type === 'date') ? 'pointer' : 'default' }}
|
|
77
|
+
>
|
|
78
|
+
{icon}
|
|
79
|
+
</div>
|
|
52
80
|
</div>
|
|
53
81
|
);
|
|
54
82
|
}
|
|
@@ -65,14 +93,9 @@ export const NewInput = forwardRef<HTMLInputElement | HTMLTextAreaElement, NewIn
|
|
|
65
93
|
return (
|
|
66
94
|
<div className={containerClasses}>
|
|
67
95
|
{(label || optional) && (
|
|
68
|
-
<
|
|
69
|
-
{label && (
|
|
70
|
-
|
|
71
|
-
{label}
|
|
72
|
-
</label>
|
|
73
|
-
)}
|
|
74
|
-
{optional && <span className="new-form-input__label-optional">Optional</span>}
|
|
75
|
-
</div>
|
|
96
|
+
<label className="new-form-input__label">
|
|
97
|
+
{label} {optional && <span className="new-form-input__label-optional">(Optional)</span>}
|
|
98
|
+
</label>
|
|
76
99
|
)}
|
|
77
100
|
|
|
78
101
|
{renderInput()}
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: flex-start;
|
|
5
|
-
gap:
|
|
5
|
+
gap: 0;
|
|
6
6
|
align-self: stretch;
|
|
7
|
-
padding
|
|
8
|
-
padding-right: 32px;
|
|
7
|
+
padding: 32px 32px 0px 32px;
|
|
9
8
|
|
|
10
9
|
@media (max-width: 768px) {
|
|
11
|
-
padding
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
padding: 16px 16px 0px 16px;
|
|
11
|
+
gap: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media (max-width: 480px) {
|
|
15
|
+
padding: 16px 12px 0px 12px;
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -29,12 +31,20 @@
|
|
|
29
31
|
|
|
30
32
|
&__title {
|
|
31
33
|
color: var(--label-primary);
|
|
32
|
-
font-family: 'Geist', sans-serif;
|
|
34
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
33
35
|
font-size: 24px;
|
|
34
36
|
font-style: normal;
|
|
35
37
|
font-weight: 600;
|
|
36
38
|
line-height: 28px;
|
|
37
39
|
margin: 0;
|
|
40
|
+
padding: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__actions {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: 16px;
|
|
47
|
+
flex-shrink: 0;
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
|
|
@@ -43,5 +53,4 @@
|
|
|
43
53
|
height: 1px;
|
|
44
54
|
border: none;
|
|
45
55
|
background-color: var(--border-primary, #e8e9ef);
|
|
46
|
-
margin: 0;
|
|
47
56
|
}
|
|
@@ -6,19 +6,26 @@ export interface NewPageHeaderProps {
|
|
|
6
6
|
title: string;
|
|
7
7
|
cancelLabel?: string;
|
|
8
8
|
onCancel?: () => void;
|
|
9
|
+
renderRight?: () => React.ReactNode;
|
|
9
10
|
className?: string;
|
|
11
|
+
showDivider?: boolean;
|
|
12
|
+
dividerClassName?: string;
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
export const NewPageHeader
|
|
15
|
+
export const NewPageHeader = ({
|
|
13
16
|
title,
|
|
14
17
|
cancelLabel = 'Cancel',
|
|
15
18
|
onCancel,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
renderRight,
|
|
20
|
+
className = '',
|
|
21
|
+
showDivider = true,
|
|
22
|
+
dividerClassName = ''
|
|
23
|
+
}: NewPageHeaderProps) => (
|
|
24
|
+
<div className={`new-page-header-container ${className}`}>
|
|
25
|
+
<div className="new-page-header">
|
|
26
|
+
<h1 className="new-page-header__title">{title}</h1>
|
|
27
|
+
<div className="new-page-header__actions">
|
|
28
|
+
{renderRight && renderRight()}
|
|
22
29
|
{onCancel && (
|
|
23
30
|
<Button
|
|
24
31
|
type="button"
|
|
@@ -29,7 +36,7 @@ export const NewPageHeader: React.FC<NewPageHeaderProps> = ({
|
|
|
29
36
|
</Button>
|
|
30
37
|
)}
|
|
31
38
|
</div>
|
|
32
|
-
<hr className="new-page-header__divider" />
|
|
33
39
|
</div>
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
{showDivider && <hr className={`new-page-header__divider ${dividerClassName}`} />}
|
|
41
|
+
</div>
|
|
42
|
+
);
|