@unbxd-ui/unbxd-react-components 0.3.1 → 0.3.2-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/assets/desktop.svg +6 -0
- package/assets/map-pin.svg +6 -0
- package/assets/p1.svg +20 -0
- package/assets/p2.svg +22 -0
- package/assets/p3.svg +19 -0
- package/assets/p4.svg +22 -0
- package/assets/p5.svg +23 -0
- package/components/Accordian/accordianCore.scss +8 -0
- package/components/Accordian/accordianTheme.scss +6 -0
- package/components/Button/button.css +1 -0
- package/components/Button/buttonTheme.scss +94 -0
- package/components/Form/Dropdown.js +77 -10
- package/components/Form/SearchableDropdown.js +22 -15
- package/components/Form/SelectedPills.js +128 -0
- package/components/Form/SummarySelection.js +46 -0
- package/components/Form/form.css +1 -0
- package/components/Form/formCore.css +1 -1
- package/components/Form/formCore.scss +706 -0
- package/components/Form/formTheme.scss +33 -0
- package/components/Form/stories/Dropdown.stories.js +242 -2
- package/components/Form/stories/SearchableDropdown.stories.js +173 -3
- package/components/Form/stories/ServerPaginatedDropdown.stories.js +166 -94
- package/components/Form/summarySelection.css +1 -0
- package/components/Form/summarySelection.scss +106 -0
- package/components/Form/variables.scss +116 -0
- package/components/InlineModal/inlineModal.css +1 -0
- package/components/InlineModal/inlineModalCore.scss +40 -0
- package/components/InlineModal/inlineModalTheme.scss +16 -0
- package/components/Link/linkCore.css +1 -1
- package/components/Link/linkCore.scss +66 -0
- package/components/Link/linkTheme.scss +79 -0
- package/components/List/list.css +1 -0
- package/components/List/listCore.scss +6 -0
- package/components/List/listTheme.scss +0 -0
- package/components/Modal/modal.css +1 -0
- package/components/Modal/modalCore.scss +58 -0
- package/components/Modal/modalTheme.scss +0 -0
- package/components/NoDataPlaceholder/noDataPlaceholderCore.scss +33 -0
- package/components/NotificationComponent/notificationComponent.css +1 -0
- package/components/NotificationComponent/notificationTheme.scss +38 -0
- package/components/PIDItemComponent/PIDItemComponent.js +82 -0
- package/components/PIDItemComponent/PIDItemComponent.stories.js +175 -0
- package/components/PIDItemComponent/PIDItemComponentCore.css +1 -0
- package/components/PIDItemComponent/PIDItemComponentCore.scss +36 -0
- package/components/PIDItemComponent/index.js +9 -0
- package/components/PageLoader/pageLoaderCore.scss +34 -0
- package/components/ProgressBar/ProgressBar.scss +0 -0
- package/components/ProgressBar/progressBar.css +0 -0
- package/components/ProgressBar/progressBarCore.scss +22 -0
- package/components/ProgressBar/progressBarTheme.scss +0 -0
- package/components/Table/tableCore.scss +547 -0
- package/components/Table/tableTheme.scss +34 -0
- package/components/TabsComponent/tabs.css +1 -0
- package/components/TabsComponent/tabsCore.scss +59 -0
- package/components/TabsComponent/tabsTheme.scss +0 -0
- package/components/ToastNotification/toastNotificationCore.scss +273 -0
- package/components/Tooltip/tooltipCore.scss +207 -0
- package/components/Tooltip/tooltipTheme.scss +20 -0
- package/components/UIDItemComponent/UIDItemComponent.js +148 -0
- package/components/UIDItemComponent/UIDItemComponent.stories.js +51 -0
- package/components/UIDItemComponent/UIDItemComponentCore.css +1 -0
- package/components/UIDItemComponent/UIDItemComponentCore.scss +57 -0
- package/components/UIDItemComponent/index.js +9 -0
- package/components/common/common.scss +14 -0
- package/components/core.css +3 -2
- package/components/core.scss +12 -10
- package/components/index.js +25 -11
- package/components/theme.css +3 -2
- package/components/theme.scss +2 -1
- package/core/index.js +7 -0
- package/core/lazyLoadImage.js +56 -0
- package/core/utils.js +6 -1
- package/index.js +48 -0
- package/package.json +2 -2
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
.notification-outer-wrapper {
|
|
2
|
+
position: fixed;
|
|
3
|
+
z-index: 200;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 10px;
|
|
7
|
+
max-width: 400px;
|
|
8
|
+
width: 100%;
|
|
9
|
+
|
|
10
|
+
// Default bottom-left position
|
|
11
|
+
&.bottom-left {
|
|
12
|
+
bottom: 20px;
|
|
13
|
+
left: 30px;
|
|
14
|
+
|
|
15
|
+
@media (max-width: 768px) {
|
|
16
|
+
bottom: 10px;
|
|
17
|
+
left: 10px;
|
|
18
|
+
right: 10px;
|
|
19
|
+
max-width: none;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Top-left position
|
|
24
|
+
&.top-left {
|
|
25
|
+
top: 20px;
|
|
26
|
+
left: 30px;
|
|
27
|
+
|
|
28
|
+
@media (max-width: 768px) {
|
|
29
|
+
top: 10px;
|
|
30
|
+
left: 10px;
|
|
31
|
+
right: 10px;
|
|
32
|
+
max-width: none;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Top-right position
|
|
37
|
+
&.top-right {
|
|
38
|
+
top: 20px;
|
|
39
|
+
right: 30px;
|
|
40
|
+
|
|
41
|
+
@media (max-width: 768px) {
|
|
42
|
+
top: 10px;
|
|
43
|
+
left: 10px;
|
|
44
|
+
right: 10px;
|
|
45
|
+
max-width: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Bottom-right position
|
|
50
|
+
&.bottom-right {
|
|
51
|
+
bottom: 20px;
|
|
52
|
+
right: 30px;
|
|
53
|
+
|
|
54
|
+
@media (max-width: 768px) {
|
|
55
|
+
bottom: 10px;
|
|
56
|
+
left: 10px;
|
|
57
|
+
right: 10px;
|
|
58
|
+
max-width: none;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// For top positions, reverse the order so newest appears at top
|
|
63
|
+
&.top-left,
|
|
64
|
+
&.top-right {
|
|
65
|
+
flex-direction: column-reverse;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Animation direction based on position
|
|
69
|
+
&.top-left .toast,
|
|
70
|
+
&.bottom-left .toast {
|
|
71
|
+
animation: slideInFromLeft 0.3s ease-out;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.top-right .toast,
|
|
75
|
+
&.bottom-right .toast {
|
|
76
|
+
animation: slideInFromRight 0.3s ease-out;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.toast {
|
|
81
|
+
position: relative;
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: space-between;
|
|
85
|
+
padding: 12px 16px;
|
|
86
|
+
border-radius: 8px;
|
|
87
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
88
|
+
background: #fff;
|
|
89
|
+
margin-bottom: 8px;
|
|
90
|
+
min-height: 56px;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
|
|
93
|
+
&.success {
|
|
94
|
+
|
|
95
|
+
background-color: #E7EFE7;
|
|
96
|
+
|
|
97
|
+
.toast-success {
|
|
98
|
+
color: #10b981;
|
|
99
|
+
|
|
100
|
+
&::before {
|
|
101
|
+
content: "✓";
|
|
102
|
+
font-weight: bold;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.error {
|
|
108
|
+
background-color: #FFE7E7;
|
|
109
|
+
|
|
110
|
+
.toast-error {
|
|
111
|
+
color: #ef4444;
|
|
112
|
+
|
|
113
|
+
&::before {
|
|
114
|
+
content: "✕";
|
|
115
|
+
font-weight: bold;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.warning {
|
|
121
|
+
background-color: #FFF8E7;
|
|
122
|
+
|
|
123
|
+
.toast-warn {
|
|
124
|
+
color: #f59e0b;
|
|
125
|
+
|
|
126
|
+
&::before {
|
|
127
|
+
content: "⚠";
|
|
128
|
+
font-weight: bold;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&.info {
|
|
134
|
+
background-color: #E7EDFF;
|
|
135
|
+
|
|
136
|
+
.toast-info {
|
|
137
|
+
color: #3b82f6;
|
|
138
|
+
|
|
139
|
+
&::before {
|
|
140
|
+
content: "ℹ";
|
|
141
|
+
font-weight: bold;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.message-icon-box {
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
gap: 12px;
|
|
151
|
+
flex: 1;
|
|
152
|
+
|
|
153
|
+
.message {
|
|
154
|
+
color: #17173A;
|
|
155
|
+
font-size: 14px;
|
|
156
|
+
font-weight: 600;
|
|
157
|
+
line-height: 1.4;
|
|
158
|
+
word-break: break-word;
|
|
159
|
+
flex: 1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.toast-close {
|
|
164
|
+
background: none;
|
|
165
|
+
border: none;
|
|
166
|
+
color: #17173A;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
font-size: 18px;
|
|
169
|
+
padding: 4px;
|
|
170
|
+
margin-left: 12px;
|
|
171
|
+
border-radius: 4px;
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: center;
|
|
175
|
+
min-width: 24px;
|
|
176
|
+
height: 24px;
|
|
177
|
+
|
|
178
|
+
&:hover {
|
|
179
|
+
color: #6b7280;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.toast-progress {
|
|
185
|
+
position: absolute;
|
|
186
|
+
bottom: 0;
|
|
187
|
+
left: 0;
|
|
188
|
+
height: 3px;
|
|
189
|
+
transition: width 0.1s linear;
|
|
190
|
+
|
|
191
|
+
&.success {
|
|
192
|
+
background: #00C48C;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&.error {
|
|
196
|
+
background: #F05C5C;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&.warning {
|
|
200
|
+
background: #D5A555;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&.info {
|
|
204
|
+
background: #3E71F2;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@keyframes slideInFromLeft {
|
|
209
|
+
from {
|
|
210
|
+
transform: translateX(-100%);
|
|
211
|
+
opacity: 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
to {
|
|
215
|
+
transform: translateX(0);
|
|
216
|
+
opacity: 1;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@keyframes slideInFromRight {
|
|
221
|
+
from {
|
|
222
|
+
transform: translateX(100%);
|
|
223
|
+
opacity: 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
to {
|
|
227
|
+
transform: translateX(0);
|
|
228
|
+
opacity: 1;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@keyframes slideOutToLeft {
|
|
233
|
+
from {
|
|
234
|
+
transform: translateX(0);
|
|
235
|
+
opacity: 1;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
to {
|
|
239
|
+
transform: translateX(-100%);
|
|
240
|
+
opacity: 0;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@keyframes slideOutToRight {
|
|
245
|
+
from {
|
|
246
|
+
transform: translateX(0);
|
|
247
|
+
opacity: 1;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
to {
|
|
251
|
+
transform: translateX(100%);
|
|
252
|
+
opacity: 0;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// High contrast mode support
|
|
257
|
+
@media (prefers-contrast: high) {
|
|
258
|
+
.toast {
|
|
259
|
+
border-width: 2px;
|
|
260
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Reduced motion support
|
|
265
|
+
@media (prefers-reduced-motion: reduce) {
|
|
266
|
+
.notification-outer-wrapper .toast {
|
|
267
|
+
animation: none !important;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.toast-progress {
|
|
271
|
+
transition: none;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/*.RCB {
|
|
2
|
+
&-tooltip {
|
|
3
|
+
display: inline-block;
|
|
4
|
+
position: relative;
|
|
5
|
+
|
|
6
|
+
.RCB-tooltip-body {
|
|
7
|
+
&.RCB-tooltip-hover {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&.RCB-tooltip-click {
|
|
12
|
+
display: inline-block;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&-tooltip-body {
|
|
18
|
+
display: none;
|
|
19
|
+
position: absolute;
|
|
20
|
+
z-index: 1;
|
|
21
|
+
|
|
22
|
+
&.RCB-tooltip-right {
|
|
23
|
+
top: -10px;
|
|
24
|
+
&:before {
|
|
25
|
+
content: " ";
|
|
26
|
+
width: 0;
|
|
27
|
+
height: 0;
|
|
28
|
+
border-top: 10px solid transparent;
|
|
29
|
+
border-bottom: 10px solid transparent;
|
|
30
|
+
border-right: 10px solid #ffffff;
|
|
31
|
+
position: absolute;
|
|
32
|
+
left: -10px;
|
|
33
|
+
filter: drop-shadow(-1px 3px 1px #e5e7e8);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.RCB-tooltip-left {
|
|
38
|
+
right: 34px;
|
|
39
|
+
top: -14px;
|
|
40
|
+
|
|
41
|
+
&:after {
|
|
42
|
+
content: " ";
|
|
43
|
+
width: 0;
|
|
44
|
+
height: 0;
|
|
45
|
+
border-top: 10px solid transparent;
|
|
46
|
+
border-bottom: 10px solid transparent;
|
|
47
|
+
border-left: 10px solid #ffffff;
|
|
48
|
+
position: absolute;
|
|
49
|
+
right: -10px;
|
|
50
|
+
top: 16px;
|
|
51
|
+
filter: drop-shadow(2px 2px 1px #e5e7e8);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.RCB-tooltip-top {
|
|
56
|
+
|
|
57
|
+
&:after {
|
|
58
|
+
content: " ";
|
|
59
|
+
width: 0;
|
|
60
|
+
height: 0;
|
|
61
|
+
border-top: 10px solid #ffffff;
|
|
62
|
+
border-right: 10px solid transparent;
|
|
63
|
+
border-left: 10px solid transparent;
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: 100%;
|
|
66
|
+
left: 50%;
|
|
67
|
+
filter: drop-shadow(0px 1px 1px #e5e7e8);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&.RCB-tooltip-bottom {
|
|
72
|
+
top: 150%;
|
|
73
|
+
left: -125px;
|
|
74
|
+
|
|
75
|
+
&:after {
|
|
76
|
+
content: " ";
|
|
77
|
+
width: 0;
|
|
78
|
+
height: 0;
|
|
79
|
+
border-left: 10px solid transparent;
|
|
80
|
+
border-bottom: 10px solid #ffffff;
|
|
81
|
+
border-right: 10px solid transparent;
|
|
82
|
+
position: absolute;
|
|
83
|
+
bottom: 100%;
|
|
84
|
+
left: 50%;
|
|
85
|
+
filter: drop-shadow(0px -1px 1px #e5e7e8);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
.demo-tooltip {
|
|
93
|
+
.RCB-tooltip-body {
|
|
94
|
+
min-width: 235px;
|
|
95
|
+
}
|
|
96
|
+
.RCB-tooltip-btn {
|
|
97
|
+
border: none;
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
.RCB-tooltip {
|
|
104
|
+
display: inline-block;
|
|
105
|
+
position: relative;
|
|
106
|
+
|
|
107
|
+
&-btn {
|
|
108
|
+
display: inline-block;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
|
|
111
|
+
// Ensure the button doesn't interfere with tooltip positioning
|
|
112
|
+
position: relative;
|
|
113
|
+
z-index: 1;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&-body {
|
|
117
|
+
display: none; // Hidden by default
|
|
118
|
+
position: absolute;
|
|
119
|
+
background: #fff;
|
|
120
|
+
padding: 10px;
|
|
121
|
+
border-radius: 4px;
|
|
122
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
123
|
+
z-index: 1000;
|
|
124
|
+
max-width: 300px;
|
|
125
|
+
word-wrap: break-word;
|
|
126
|
+
|
|
127
|
+
// Add smooth transitions
|
|
128
|
+
opacity: 0;
|
|
129
|
+
transition: opacity 0.2s ease-in-out;
|
|
130
|
+
|
|
131
|
+
// Show tooltip when it has these classes
|
|
132
|
+
&.RCB-tooltip-hover,
|
|
133
|
+
&.RCB-tooltip-click {
|
|
134
|
+
display: block;
|
|
135
|
+
opacity: 1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Prevent text selection in tooltip
|
|
139
|
+
user-select: none;
|
|
140
|
+
|
|
141
|
+
// Ensure proper text rendering
|
|
142
|
+
line-height: 1.4;
|
|
143
|
+
color: #333;
|
|
144
|
+
font-size: 14px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&-arrow {
|
|
148
|
+
width: 0;
|
|
149
|
+
height: 0;
|
|
150
|
+
border-style: solid;
|
|
151
|
+
|
|
152
|
+
// Prevent arrow from interfering with hover/click events
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
|
|
155
|
+
// Ensure arrow is positioned correctly
|
|
156
|
+
position: absolute;
|
|
157
|
+
|
|
158
|
+
&-top {
|
|
159
|
+
border-left: 10px solid transparent;
|
|
160
|
+
border-right: 10px solid transparent;
|
|
161
|
+
border-top: 10px solid #fff;
|
|
162
|
+
border-bottom: 0px solid transparent;
|
|
163
|
+
filter: drop-shadow(0 1px 1px #e5e7e8);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&-bottom {
|
|
167
|
+
border-left: 10px solid transparent;
|
|
168
|
+
border-right: 10px solid transparent;
|
|
169
|
+
border-bottom: 10px solid #fff;
|
|
170
|
+
border-top: 0px solid transparent;
|
|
171
|
+
filter: drop-shadow(0 -1px 1px #e5e7e8);
|
|
172
|
+
|
|
173
|
+
/*border-left: 8px solid transparent;
|
|
174
|
+
border-right: 8px solid transparent;
|
|
175
|
+
border-top: 8px solid #fff;
|
|
176
|
+
filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));*/
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&-left {
|
|
180
|
+
border-top: 10px solid transparent;
|
|
181
|
+
border-bottom: 10px solid transparent;
|
|
182
|
+
border-right: 0px solid transparent;
|
|
183
|
+
border-left: 10px solid #fff;
|
|
184
|
+
filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.1));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&-right {
|
|
188
|
+
border-top: 10px solid transparent;
|
|
189
|
+
border-bottom: 10px solid transparent;
|
|
190
|
+
border-right: 10px solid #fff;
|
|
191
|
+
border-left: 0px solid transparent;
|
|
192
|
+
filter: drop-shadow(-2px 2px 2px rgba(0, 0, 0, 0.1));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Keep the demo styles for storybook
|
|
198
|
+
.demo-tooltip {
|
|
199
|
+
.RCB-tooltip-body {
|
|
200
|
+
min-width: 235px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.RCB-tooltip-btn {
|
|
204
|
+
border: none;
|
|
205
|
+
background-color: transparent;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.RCB {
|
|
2
|
+
&-tooltip-btn {
|
|
3
|
+
display: inline-block;
|
|
4
|
+
font-style: italic;
|
|
5
|
+
font-size: 12px;
|
|
6
|
+
color: #9199AA;
|
|
7
|
+
background-color: #F8FAFB;
|
|
8
|
+
border: 1px solid #D0DDE2;
|
|
9
|
+
padding: 0px 6px;
|
|
10
|
+
border-radius: 50%;
|
|
11
|
+
text-align: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&-tooltip-body {
|
|
15
|
+
background: #FFF;
|
|
16
|
+
padding: 10px;
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
box-shadow: 0px 1px 7px 0px #ccc;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = UIDItemComponent;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _desktop = _interopRequireDefault(require("../../assets/desktop.svg"));
|
|
10
|
+
var _mapPin = _interopRequireDefault(require("../../assets/map-pin.svg"));
|
|
11
|
+
var _p = _interopRequireDefault(require("../../assets/p1.svg"));
|
|
12
|
+
var _p2 = _interopRequireDefault(require("../../assets/p2.svg"));
|
|
13
|
+
var _p3 = _interopRequireDefault(require("../../assets/p3.svg"));
|
|
14
|
+
var _p4 = _interopRequireDefault(require("../../assets/p4.svg"));
|
|
15
|
+
var _p5 = _interopRequireDefault(require("../../assets/p5.svg"));
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
18
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
19
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
21
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
22
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
23
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } // Assets imported from global src/assets folder
|
|
24
|
+
function UIDItemComponent(props) {
|
|
25
|
+
// Desrructure props that are needed for client as well as server pagination types.
|
|
26
|
+
var _props$itemData = props.itemData,
|
|
27
|
+
itemData = _props$itemData === void 0 ? {} : _props$itemData,
|
|
28
|
+
_props$paginationType = props.paginationType,
|
|
29
|
+
clientPaginationType = _props$paginationType === void 0 ? "" : _props$paginationType,
|
|
30
|
+
_props$selectItem = props.selectItem,
|
|
31
|
+
clientSelectItem = _props$selectItem === void 0 ? function () {} : _props$selectItem,
|
|
32
|
+
_props$selectedItems = props.selectedItems,
|
|
33
|
+
clientSelectedItems = _props$selectedItems === void 0 ? [] : _props$selectedItems,
|
|
34
|
+
_props$data = props.data,
|
|
35
|
+
data = _props$data === void 0 ? {} : _props$data,
|
|
36
|
+
_props$index = props.index,
|
|
37
|
+
index = _props$index === void 0 ? 0 : _props$index,
|
|
38
|
+
_props$style = props.style,
|
|
39
|
+
style = _props$style === void 0 ? {} : _props$style;
|
|
40
|
+
var _data$items = data.items,
|
|
41
|
+
items = _data$items === void 0 ? [] : _data$items,
|
|
42
|
+
_data$paginationType = data.paginationType,
|
|
43
|
+
serverPaginationType = _data$paginationType === void 0 ? "" : _data$paginationType,
|
|
44
|
+
_data$selectItem = data.selectItem,
|
|
45
|
+
serverSelectItem = _data$selectItem === void 0 ? function () {} : _data$selectItem,
|
|
46
|
+
_data$selectedItems = data.selectedItems,
|
|
47
|
+
serverSelectedItems = _data$selectedItems === void 0 ? [] : _data$selectedItems;
|
|
48
|
+
|
|
49
|
+
// Determine the pagination type
|
|
50
|
+
var paginationType = clientPaginationType ? "CLIENT" : serverPaginationType;
|
|
51
|
+
|
|
52
|
+
// Update the item data and select item function based on the pagination type
|
|
53
|
+
var updatedItemData = paginationType !== 'SERVER' ? itemData : items[index] || {};
|
|
54
|
+
var updatedSelectItem = paginationType !== 'SERVER' ? clientSelectItem : serverSelectItem;
|
|
55
|
+
var updatedSelectedItems = paginationType !== 'SERVER' ? clientSelectedItems : serverSelectedItems || [];
|
|
56
|
+
|
|
57
|
+
// Check if the item is selected
|
|
58
|
+
var isItemSelected = updatedSelectedItems.find(function (item) {
|
|
59
|
+
return item.user_id === updatedItemData.user_id;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Normalize the item data to fetch fields needed for the component to display.
|
|
63
|
+
var _updatedItemData$user = updatedItemData.user_id,
|
|
64
|
+
user_id = _updatedItemData$user === void 0 ? '' : _updatedItemData$user,
|
|
65
|
+
_updatedItemData$user2 = updatedItemData.user_behavior,
|
|
66
|
+
user_behavior = _updatedItemData$user2 === void 0 ? {} : _updatedItemData$user2,
|
|
67
|
+
_updatedItemData$enga = updatedItemData.engagement_metrics,
|
|
68
|
+
engagement_metrics = _updatedItemData$enga === void 0 ? {} : _updatedItemData$enga,
|
|
69
|
+
_updatedItemData$devi = updatedItemData.device_info,
|
|
70
|
+
device_info = _updatedItemData$devi === void 0 ? {} : _updatedItemData$devi,
|
|
71
|
+
_updatedItemData$loca = updatedItemData.location_info,
|
|
72
|
+
location_info = _updatedItemData$loca === void 0 ? {} : _updatedItemData$loca,
|
|
73
|
+
_updatedItemData$rank = updatedItemData.rank,
|
|
74
|
+
rank = _updatedItemData$rank === void 0 ? 0 : _updatedItemData$rank;
|
|
75
|
+
var _user_behavior$user_t = user_behavior.user_types,
|
|
76
|
+
user_types = _user_behavior$user_t === void 0 ? "" : _user_behavior$user_t,
|
|
77
|
+
_user_behavior$sessio = user_behavior.session_count,
|
|
78
|
+
session_count = _user_behavior$sessio === void 0 ? 0 : _user_behavior$sessio,
|
|
79
|
+
_user_behavior$total_ = user_behavior.total_events,
|
|
80
|
+
total_events = _user_behavior$total_ === void 0 ? 0 : _user_behavior$total_;
|
|
81
|
+
var _engagement_metrics$c = engagement_metrics.clicks,
|
|
82
|
+
clicks = _engagement_metrics$c === void 0 ? 0 : _engagement_metrics$c,
|
|
83
|
+
_engagement_metrics$o = engagement_metrics.orders,
|
|
84
|
+
orders = _engagement_metrics$o === void 0 ? 0 : _engagement_metrics$o,
|
|
85
|
+
_engagement_metrics$r = engagement_metrics.revenue,
|
|
86
|
+
revenue = _engagement_metrics$r === void 0 ? "0.0" : _engagement_metrics$r;
|
|
87
|
+
var _device_info$platform = device_info.platforms,
|
|
88
|
+
platforms = _device_info$platform === void 0 ? [] : _device_info$platform,
|
|
89
|
+
_device_info$devices = device_info.devices,
|
|
90
|
+
devices = _device_info$devices === void 0 ? [] : _device_info$devices;
|
|
91
|
+
var _location_info$region = location_info.regions,
|
|
92
|
+
regions = _location_info$region === void 0 ? [] : _location_info$region,
|
|
93
|
+
_location_info$countr = location_info.countries,
|
|
94
|
+
countries = _location_info$countr === void 0 ? [] : _location_info$countr,
|
|
95
|
+
_location_info$cities = location_info.cities,
|
|
96
|
+
cities = _location_info$cities === void 0 ? [] : _location_info$cities;
|
|
97
|
+
var locationMetadata = (0, _react.useMemo)(function () {
|
|
98
|
+
if (regions.length > 0) return regions[0];
|
|
99
|
+
if (countries.length > 0) return countries[0];
|
|
100
|
+
if (cities.length > 0) return cities[0];
|
|
101
|
+
return "";
|
|
102
|
+
}, [regions, countries, cities]);
|
|
103
|
+
var deviceMetadata = (0, _react.useMemo)(function () {
|
|
104
|
+
return [].concat(_toConsumableArray(platforms), _toConsumableArray(devices)).join(", ");
|
|
105
|
+
}, [platforms, devices]);
|
|
106
|
+
var getAvatarSrc = function getAvatarSrc(rank) {
|
|
107
|
+
var avatars = [_p["default"], _p2["default"], _p3["default"], _p4["default"], _p5["default"]];
|
|
108
|
+
var avatarIndex = rank % 5;
|
|
109
|
+
return avatars[avatarIndex];
|
|
110
|
+
};
|
|
111
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
112
|
+
className: "RCB-list-item RCB-uid-dd-item ".concat(isItemSelected ? "selected" : ""),
|
|
113
|
+
style: style,
|
|
114
|
+
onClick: function onClick() {
|
|
115
|
+
return updatedSelectItem(updatedItemData);
|
|
116
|
+
}
|
|
117
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
118
|
+
className: "RCB-list-item-content RCB-user-id-dropdown-item"
|
|
119
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
120
|
+
className: "RCB-avatar-container"
|
|
121
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
122
|
+
className: "RCB-avatar-container-inner"
|
|
123
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
124
|
+
src: getAvatarSrc(rank),
|
|
125
|
+
alt: "user",
|
|
126
|
+
className: "RCB-avatar-img"
|
|
127
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
128
|
+
className: "RCB-user-details"
|
|
129
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
130
|
+
className: "RCB-user-id-title"
|
|
131
|
+
}, "User #", rank, ": ", user_id), /*#__PURE__*/_react["default"].createElement("div", {
|
|
132
|
+
className: "RCB-user-id-metadata"
|
|
133
|
+
}, locationMetadata && /*#__PURE__*/_react["default"].createElement("div", {
|
|
134
|
+
className: "RCB-user-id-metadata-item RCB-location-metadata-item"
|
|
135
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
136
|
+
src: _mapPin["default"],
|
|
137
|
+
alt: "location",
|
|
138
|
+
className: "RCB-location-icon"
|
|
139
|
+
}), /*#__PURE__*/_react["default"].createElement("span", null, " ", locationMetadata)), locationMetadata && deviceMetadata && /*#__PURE__*/_react["default"].createElement("div", null, "|"), deviceMetadata && /*#__PURE__*/_react["default"].createElement("div", {
|
|
140
|
+
className: "RCB-user-id-metadata-item"
|
|
141
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
142
|
+
src: _desktop["default"],
|
|
143
|
+
alt: "device",
|
|
144
|
+
className: "RCB-device-icon"
|
|
145
|
+
}), /*#__PURE__*/_react["default"].createElement("span", null, deviceMetadata))))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
146
|
+
className: "RCB-user-id-description"
|
|
147
|
+
}, "This user is a ", /*#__PURE__*/_react["default"].createElement("b", null, user_types), " visitor with", " ", /*#__PURE__*/_react["default"].createElement("b", null, session_count), " sessions and ", /*#__PURE__*/_react["default"].createElement("b", null, total_events), " ", "events. They made ", /*#__PURE__*/_react["default"].createElement("b", null, clicks), " clicks, placed ", /*#__PURE__*/_react["default"].createElement("b", null, orders), " ", "order(s) worth ", /*#__PURE__*/_react["default"].createElement("b", null, "$", revenue), ".")))));
|
|
148
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.Default = void 0;
|
|
7
|
+
var _UIDItemComponent = _interopRequireDefault(require("./UIDItemComponent"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
var meta = {
|
|
10
|
+
title: 'Components/UIDItemComponent',
|
|
11
|
+
component: _UIDItemComponent["default"],
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: 'centered'
|
|
14
|
+
},
|
|
15
|
+
tags: ['autodocs'],
|
|
16
|
+
argTypes: {
|
|
17
|
+
props: {
|
|
18
|
+
description: 'Props object containing itemData and other configuration'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var _default = exports["default"] = meta;
|
|
23
|
+
var Default = exports.Default = {
|
|
24
|
+
args: {
|
|
25
|
+
props: {
|
|
26
|
+
itemData: {
|
|
27
|
+
user_id: 'user_12345',
|
|
28
|
+
user_behavior: {
|
|
29
|
+
user_types: 'returning',
|
|
30
|
+
session_count: 15,
|
|
31
|
+
total_events: 142
|
|
32
|
+
},
|
|
33
|
+
engagement_metrics: {
|
|
34
|
+
clicks: 48,
|
|
35
|
+
orders: 3,
|
|
36
|
+
revenue: '249.99'
|
|
37
|
+
},
|
|
38
|
+
device_info: {
|
|
39
|
+
platforms: ['Desktop'],
|
|
40
|
+
devices: ['Chrome']
|
|
41
|
+
},
|
|
42
|
+
location_info: {
|
|
43
|
+
regions: ['California'],
|
|
44
|
+
countries: ['USA'],
|
|
45
|
+
cities: ['San Francisco']
|
|
46
|
+
},
|
|
47
|
+
rank: 1
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.RCB-user-id-dropdown-item{display:flex;flex-direction:column;gap:20px}.RCB-user-id-dropdown-item .RCB-avatar-container{display:flex;flex-direction:column;gap:10px}.RCB-user-id-dropdown-item .RCB-avatar-container .RCB-avatar-container-inner{display:flex;gap:10px}.RCB-user-id-dropdown-item .RCB-avatar-container .RCB-avatar-img{width:55px;aspect-ratio:1}.RCB-user-id-dropdown-item .RCB-avatar-container .RCB-user-details{display:flex;flex-direction:column;gap:15px}.RCB-user-id-dropdown-item .RCB-avatar-container .RCB-user-id-title{font-size:16px;font-weight:600;color:#273251;line-height:21.82px}.RCB-user-id-dropdown-item .RCB-avatar-container .RCB-user-id-description{font-size:14px;font-weight:400;color:#3f5767;letter-spacing:0px;line-height:19px}.RCB-user-id-dropdown-item .RCB-user-id-metadata{display:flex;gap:20px;font-size:12px;font-weight:500;color:#687f8f}.RCB-user-id-dropdown-item .RCB-user-id-metadata .RCB-user-id-metadata-item{display:flex;gap:10px;align-items:center}.RCB-user-id-dropdown-item .RCB-location-icon{width:16px;height:16px}.RCB-user-id-dropdown-item .RCB-device-icon{width:16px;height:16px}
|