@bodynarf/react.components 1.13.8 → 1.14.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/changelog.md +55 -0
- package/components/index.d.ts +14 -0
- package/components/index.d.ts.map +1 -1
- package/components/index.js +14 -0
- package/components/modal/component/index.d.ts +7 -0
- package/components/modal/component/index.d.ts.map +1 -0
- package/components/modal/component/index.js +42 -0
- package/components/modal/component/style.scss +42 -0
- package/components/modal/index.d.ts +3 -0
- package/components/modal/index.d.ts.map +1 -0
- package/components/modal/index.js +2 -0
- package/components/modal/types.d.ts +44 -0
- package/components/modal/types.d.ts.map +1 -0
- package/components/modal/types.js +1 -0
- package/components/multiselect/components/withoutLabel/index.js +2 -2
- package/components/primitives/index.d.ts +4 -0
- package/components/primitives/index.d.ts.map +1 -1
- package/components/primitives/index.js +4 -0
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withLabel/index.js +10 -2
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withoutLabel/index.js +12 -4
- package/components/primitives/number/types.d.ts +6 -0
- package/components/primitives/number/types.d.ts.map +1 -1
- package/components/primitives/radioGroup/component/index.d.ts +7 -0
- package/components/primitives/radioGroup/component/index.d.ts.map +1 -0
- package/components/primitives/radioGroup/component/index.js +42 -0
- package/components/primitives/radioGroup/component/style.scss +269 -0
- package/components/primitives/radioGroup/index.d.ts +3 -0
- package/components/primitives/radioGroup/index.d.ts.map +1 -0
- package/components/primitives/radioGroup/index.js +2 -0
- package/components/primitives/radioGroup/types.d.ts +61 -0
- package/components/primitives/radioGroup/types.d.ts.map +1 -0
- package/components/primitives/radioGroup/types.js +1 -0
- package/components/primitives/slider/component/index.d.ts +7 -0
- package/components/primitives/slider/component/index.d.ts.map +1 -0
- package/components/primitives/slider/component/index.js +47 -0
- package/components/primitives/slider/component/style.scss +319 -0
- package/components/primitives/slider/index.d.ts +3 -0
- package/components/primitives/slider/index.d.ts.map +1 -0
- package/components/primitives/slider/index.js +2 -0
- package/components/primitives/slider/types.d.ts +51 -0
- package/components/primitives/slider/types.d.ts.map +1 -0
- package/components/primitives/slider/types.js +1 -0
- package/components/primitives/switch/component/index.d.ts +7 -0
- package/components/primitives/switch/component/index.d.ts.map +1 -0
- package/components/primitives/switch/component/index.js +39 -0
- package/components/primitives/switch/component/style.scss +214 -0
- package/components/primitives/switch/index.d.ts +3 -0
- package/components/primitives/switch/index.d.ts.map +1 -0
- package/components/primitives/switch/index.js +2 -0
- package/components/primitives/switch/types.d.ts +23 -0
- package/components/primitives/switch/types.d.ts.map +1 -0
- package/components/primitives/switch/types.js +1 -0
- package/components/primitives/timePicker/component/index.d.ts +8 -0
- package/components/primitives/timePicker/component/index.d.ts.map +1 -0
- package/components/primitives/timePicker/component/index.js +65 -0
- package/components/primitives/timePicker/component/style.scss +26 -0
- package/components/primitives/timePicker/index.d.ts +3 -0
- package/components/primitives/timePicker/index.d.ts.map +1 -0
- package/components/primitives/timePicker/index.js +2 -0
- package/components/primitives/timePicker/types.d.ts +33 -0
- package/components/primitives/timePicker/types.d.ts.map +1 -0
- package/components/primitives/timePicker/types.js +1 -0
- package/components/search/component/index.d.ts.map +1 -1
- package/components/search/component/index.js +9 -3
- package/components/search/types.d.ts +5 -0
- package/components/search/types.d.ts.map +1 -1
- package/components/stepper/component/index.d.ts +7 -0
- package/components/stepper/component/index.d.ts.map +1 -0
- package/components/stepper/component/index.js +56 -0
- package/components/stepper/component/style.scss +430 -0
- package/components/stepper/index.d.ts +3 -0
- package/components/stepper/index.d.ts.map +1 -0
- package/components/stepper/index.js +2 -0
- package/components/stepper/types.d.ts +65 -0
- package/components/stepper/types.d.ts.map +1 -0
- package/components/stepper/types.js +1 -0
- package/components/timeline/component/index.d.ts +7 -0
- package/components/timeline/component/index.d.ts.map +1 -0
- package/components/timeline/component/index.js +36 -0
- package/components/timeline/component/style.scss +395 -0
- package/components/timeline/index.d.ts +3 -0
- package/components/timeline/index.d.ts.map +1 -0
- package/components/timeline/index.js +2 -0
- package/components/timeline/types.d.ts +55 -0
- package/components/timeline/types.d.ts.map +1 -0
- package/components/timeline/types.js +1 -0
- package/components/tooltip/component/index.d.ts +6 -0
- package/components/tooltip/component/index.d.ts.map +1 -0
- package/components/tooltip/component/index.js +80 -0
- package/components/tooltip/index.d.ts +3 -0
- package/components/tooltip/index.d.ts.map +1 -0
- package/components/tooltip/index.js +2 -0
- package/components/tooltip/types.d.ts +31 -0
- package/components/tooltip/types.d.ts.map +1 -0
- package/components/tooltip/types.js +1 -0
- package/package.json +1 -1
- package/readme.md +18 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
$timeline-marker-size: 1.5rem !default;
|
|
2
|
+
$timeline-marker-size-small: 1.25rem !default;
|
|
3
|
+
$timeline-marker-size-medium: 1.75rem !default;
|
|
4
|
+
$timeline-marker-size-large: 2rem !default;
|
|
5
|
+
|
|
6
|
+
$timeline-connector-width: 2px !default;
|
|
7
|
+
$timeline-connector-color: $grey-lighter !default;
|
|
8
|
+
|
|
9
|
+
$timeline-marker-bg: $primary !default;
|
|
10
|
+
$timeline-marker-border: 2px solid $primary !default;
|
|
11
|
+
$timeline-marker-color: $white !default;
|
|
12
|
+
|
|
13
|
+
$timeline-marker-hollow-bg: $white !default;
|
|
14
|
+
|
|
15
|
+
$timeline-content-bg: $white !default;
|
|
16
|
+
$timeline-content-border: 1px solid $grey-lighter !default;
|
|
17
|
+
$timeline-content-shadow: 0 2px 4px rgba($black, 0.05) !default;
|
|
18
|
+
|
|
19
|
+
$timeline-title-color: $grey-darker !default;
|
|
20
|
+
$timeline-text-color: $grey !default;
|
|
21
|
+
$timeline-timestamp-color: $grey-light !default;
|
|
22
|
+
|
|
23
|
+
$timeline-item-spacing: 2rem !default;
|
|
24
|
+
|
|
25
|
+
// Animations
|
|
26
|
+
@keyframes timeline-fade-in-left {
|
|
27
|
+
from {
|
|
28
|
+
opacity: 0;
|
|
29
|
+
transform: translateX(-20px);
|
|
30
|
+
}
|
|
31
|
+
to {
|
|
32
|
+
opacity: 1;
|
|
33
|
+
transform: translateX(0);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@keyframes timeline-fade-in-right {
|
|
38
|
+
from {
|
|
39
|
+
opacity: 0;
|
|
40
|
+
transform: translateX(20px);
|
|
41
|
+
}
|
|
42
|
+
to {
|
|
43
|
+
opacity: 1;
|
|
44
|
+
transform: translateX(0);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.bbr-timeline {
|
|
49
|
+
position: relative;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
width: 100%;
|
|
53
|
+
|
|
54
|
+
// Timeline item
|
|
55
|
+
.bbr-timeline-item {
|
|
56
|
+
position: relative;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: flex-start;
|
|
59
|
+
padding-bottom: $timeline-item-spacing;
|
|
60
|
+
|
|
61
|
+
&:last-child {
|
|
62
|
+
padding-bottom: 0;
|
|
63
|
+
|
|
64
|
+
.bbr-timeline-connector {
|
|
65
|
+
display: none;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Marker (circle with optional icon/content)
|
|
71
|
+
.bbr-timeline-marker {
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
width: $timeline-marker-size;
|
|
76
|
+
height: $timeline-marker-size;
|
|
77
|
+
min-width: $timeline-marker-size;
|
|
78
|
+
border-radius: 50%;
|
|
79
|
+
background: $timeline-marker-bg;
|
|
80
|
+
border: $timeline-marker-border;
|
|
81
|
+
color: $timeline-marker-color;
|
|
82
|
+
font-size: 0.75rem;
|
|
83
|
+
font-weight: 600;
|
|
84
|
+
z-index: 1;
|
|
85
|
+
flex-shrink: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.bbr-timeline-icon,
|
|
89
|
+
.bbr-timeline-marker-content {
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
font-size: 0.65rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Content box
|
|
97
|
+
.bbr-timeline-content {
|
|
98
|
+
flex: 1;
|
|
99
|
+
background: $timeline-content-bg;
|
|
100
|
+
border: $timeline-content-border;
|
|
101
|
+
border-radius: 4px;
|
|
102
|
+
padding: 1rem;
|
|
103
|
+
margin-left: 1rem;
|
|
104
|
+
box-shadow: $timeline-content-shadow;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.bbr-timeline-title {
|
|
108
|
+
font-weight: 600;
|
|
109
|
+
font-size: 1rem;
|
|
110
|
+
color: $timeline-title-color;
|
|
111
|
+
line-height: 1.25;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.bbr-timeline-text {
|
|
115
|
+
margin-top: 0.5rem;
|
|
116
|
+
font-size: 0.875rem;
|
|
117
|
+
color: $timeline-text-color;
|
|
118
|
+
line-height: 1.5;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.bbr-timeline-timestamp {
|
|
122
|
+
font-size: 0.75rem;
|
|
123
|
+
color: $timeline-timestamp-color;
|
|
124
|
+
margin-bottom: 0.25rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Connector line
|
|
128
|
+
.bbr-timeline-connector {
|
|
129
|
+
position: absolute;
|
|
130
|
+
left: calc($timeline-marker-size / 2 - $timeline-connector-width / 2);
|
|
131
|
+
top: $timeline-marker-size;
|
|
132
|
+
width: $timeline-connector-width;
|
|
133
|
+
height: calc(100% - $timeline-marker-size);
|
|
134
|
+
background: $timeline-connector-color;
|
|
135
|
+
z-index: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Left aligned mode (default)
|
|
139
|
+
&.is-left-aligned {
|
|
140
|
+
.bbr-timeline-item {
|
|
141
|
+
padding-left: 0;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Centered mode (alternating left/right)
|
|
146
|
+
&.is-centered {
|
|
147
|
+
.bbr-timeline-item {
|
|
148
|
+
width: 50%;
|
|
149
|
+
margin-left: 50%;
|
|
150
|
+
|
|
151
|
+
&:nth-child(odd) {
|
|
152
|
+
margin-left: 0;
|
|
153
|
+
flex-direction: row-reverse;
|
|
154
|
+
text-align: right;
|
|
155
|
+
|
|
156
|
+
.bbr-timeline-content {
|
|
157
|
+
margin-left: 0;
|
|
158
|
+
margin-right: 1rem;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.bbr-timeline-connector {
|
|
162
|
+
left: auto;
|
|
163
|
+
right: calc($timeline-marker-size / 2 - $timeline-connector-width / 2);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.bbr-timeline-marker {
|
|
169
|
+
position: absolute;
|
|
170
|
+
left: 50%;
|
|
171
|
+
transform: translateX(-50%);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.bbr-timeline-item:nth-child(odd) .bbr-timeline-marker {
|
|
175
|
+
left: auto;
|
|
176
|
+
right: 0;
|
|
177
|
+
transform: translateX(50%);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.bbr-timeline-item:nth-child(even) .bbr-timeline-marker {
|
|
181
|
+
left: 0;
|
|
182
|
+
transform: translateX(-50%);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.bbr-timeline-connector {
|
|
186
|
+
left: 50%;
|
|
187
|
+
transform: translateX(-50%);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.bbr-timeline-item:nth-child(odd) .bbr-timeline-connector {
|
|
191
|
+
left: auto;
|
|
192
|
+
right: 0;
|
|
193
|
+
transform: translateX(50%);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.bbr-timeline-item:nth-child(even) .bbr-timeline-connector {
|
|
197
|
+
left: 0;
|
|
198
|
+
transform: translateX(-50%);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Separate timestamps
|
|
202
|
+
&.has-separate-timestamps {
|
|
203
|
+
.bbr-timeline-timestamp {
|
|
204
|
+
position: absolute;
|
|
205
|
+
width: 100%;
|
|
206
|
+
margin-bottom: 0;
|
|
207
|
+
|
|
208
|
+
&.is-left {
|
|
209
|
+
right: calc(50% + $timeline-marker-size / 2 + 1rem);
|
|
210
|
+
left: auto;
|
|
211
|
+
text-align: right;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&.is-right {
|
|
215
|
+
left: calc(50% + $timeline-marker-size / 2 + 1rem);
|
|
216
|
+
right: auto;
|
|
217
|
+
text-align: left;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.bbr-timeline-item:nth-child(odd) {
|
|
222
|
+
.bbr-timeline-timestamp.is-left {
|
|
223
|
+
display: none;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.bbr-timeline-item:nth-child(even) {
|
|
228
|
+
.bbr-timeline-timestamp.is-right {
|
|
229
|
+
display: none;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Hollow markers
|
|
236
|
+
&.is-hollow {
|
|
237
|
+
.bbr-timeline-marker {
|
|
238
|
+
background: $timeline-marker-hollow-bg;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
@each $name, $pair in $colors {
|
|
242
|
+
$color: nth($pair, 1);
|
|
243
|
+
|
|
244
|
+
.bbr-timeline-item.is-#{$name} .bbr-timeline-marker {
|
|
245
|
+
background: $timeline-marker-hollow-bg;
|
|
246
|
+
border-color: $color;
|
|
247
|
+
color: $color;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Animation
|
|
253
|
+
&.is-animated {
|
|
254
|
+
.bbr-timeline-item {
|
|
255
|
+
opacity: 0;
|
|
256
|
+
|
|
257
|
+
&.is-animated-left {
|
|
258
|
+
animation: timeline-fade-in-left 0.5s ease forwards;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
&.is-animated-right {
|
|
262
|
+
animation: timeline-fade-in-right 0.5s ease forwards;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
@for $i from 1 through 20 {
|
|
266
|
+
&:nth-child(#{$i}) {
|
|
267
|
+
animation-delay: #{($i - 1) * 0.15}s;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Size variations
|
|
274
|
+
&.is-small {
|
|
275
|
+
.bbr-timeline-marker {
|
|
276
|
+
width: $timeline-marker-size-small;
|
|
277
|
+
height: $timeline-marker-size-small;
|
|
278
|
+
min-width: $timeline-marker-size-small;
|
|
279
|
+
font-size: 0.625rem;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.bbr-timeline-icon,
|
|
283
|
+
.bbr-timeline-marker-content {
|
|
284
|
+
font-size: 0.55rem;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.bbr-timeline-title {
|
|
288
|
+
font-size: 0.875rem;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.bbr-timeline-text {
|
|
292
|
+
font-size: 0.75rem;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.bbr-timeline-timestamp {
|
|
296
|
+
font-size: 0.625rem;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.bbr-timeline-content {
|
|
300
|
+
padding: 0.75rem;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.bbr-timeline-connector {
|
|
304
|
+
left: calc($timeline-marker-size-small / 2 - $timeline-connector-width / 2);
|
|
305
|
+
top: $timeline-marker-size-small;
|
|
306
|
+
height: calc(100% - $timeline-marker-size-small);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&.is-medium {
|
|
311
|
+
.bbr-timeline-marker {
|
|
312
|
+
width: $timeline-marker-size-medium;
|
|
313
|
+
height: $timeline-marker-size-medium;
|
|
314
|
+
min-width: $timeline-marker-size-medium;
|
|
315
|
+
font-size: 0.875rem;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.bbr-timeline-icon,
|
|
319
|
+
.bbr-timeline-marker-content {
|
|
320
|
+
font-size: 0.75rem;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.bbr-timeline-title {
|
|
324
|
+
font-size: 1.125rem;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.bbr-timeline-text {
|
|
328
|
+
font-size: 1rem;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.bbr-timeline-connector {
|
|
332
|
+
left: calc($timeline-marker-size-medium / 2 - $timeline-connector-width / 2);
|
|
333
|
+
top: $timeline-marker-size-medium;
|
|
334
|
+
height: calc(100% - $timeline-marker-size-medium);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
&.is-large {
|
|
339
|
+
.bbr-timeline-marker {
|
|
340
|
+
width: $timeline-marker-size-large;
|
|
341
|
+
height: $timeline-marker-size-large;
|
|
342
|
+
min-width: $timeline-marker-size-large;
|
|
343
|
+
font-size: 1rem;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.bbr-timeline-icon,
|
|
347
|
+
.bbr-timeline-marker-content {
|
|
348
|
+
font-size: 0.875rem;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.bbr-timeline-title {
|
|
352
|
+
font-size: 1.25rem;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.bbr-timeline-text {
|
|
356
|
+
font-size: 1.125rem;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.bbr-timeline-content {
|
|
360
|
+
padding: 1.25rem;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.bbr-timeline-connector {
|
|
364
|
+
left: calc($timeline-marker-size-large / 2 - $timeline-connector-width / 2);
|
|
365
|
+
top: $timeline-marker-size-large;
|
|
366
|
+
height: calc(100% - $timeline-marker-size-large);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Color variations
|
|
371
|
+
@each $name, $pair in $colors {
|
|
372
|
+
$color: nth($pair, 1);
|
|
373
|
+
$color-invert: nth($pair, 2);
|
|
374
|
+
|
|
375
|
+
&.is-#{$name} {
|
|
376
|
+
.bbr-timeline-marker {
|
|
377
|
+
background: $color;
|
|
378
|
+
border-color: $color;
|
|
379
|
+
color: $color-invert;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.bbr-timeline-connector {
|
|
383
|
+
background: rgba($color, 0.3);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.bbr-timeline-item.is-#{$name} {
|
|
388
|
+
.bbr-timeline-marker {
|
|
389
|
+
background: $color;
|
|
390
|
+
border-color: $color;
|
|
391
|
+
color: $color-invert;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/timeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BaseElementProps, ElementColor, ElementSize } from "../../types";
|
|
2
|
+
/** Single timeline event item */
|
|
3
|
+
export interface TimelineItem {
|
|
4
|
+
/** Unique event identifier */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Event title/label */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Optional event description or content */
|
|
9
|
+
content?: string;
|
|
10
|
+
/** Optional timestamp or date string */
|
|
11
|
+
timestamp?: string;
|
|
12
|
+
/** Optional icon class (e.g., "fa-check", "fa-user") */
|
|
13
|
+
icon?: string;
|
|
14
|
+
/** Optional color override for this specific item */
|
|
15
|
+
color?: ElementColor;
|
|
16
|
+
/** Optional custom marker content (text or icon) */
|
|
17
|
+
marker?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Timeline component props */
|
|
20
|
+
export type TimelineProps = BaseElementProps & {
|
|
21
|
+
/** Array of timeline events to display */
|
|
22
|
+
items: Array<TimelineItem>;
|
|
23
|
+
/** Component size */
|
|
24
|
+
size?: ElementSize;
|
|
25
|
+
/** Default color for timeline markers */
|
|
26
|
+
color?: ElementColor;
|
|
27
|
+
/**
|
|
28
|
+
* Display timeline on the left side (markers on left, content on right).
|
|
29
|
+
* When false, timeline is centered with alternating content.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
leftAligned?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Show connector lines between events.
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
showConnectors?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Use animated appearance for items.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
animated?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Show timestamps on separate side from content.
|
|
45
|
+
* Only works when leftAligned is false (centered mode).
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
showTimestampsSeparate?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Render markers as hollow (outlined) circles.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
hollow?: boolean;
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/timeline/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzE,iCAAiC;AACjC,MAAM,WAAW,YAAY;IACzB,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IAEX,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IAEd,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,qDAAqD;IACrD,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,+BAA+B;AAC/B,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG;IAC3C,0CAA0C;IAC1C,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAE3B,qBAAqB;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,yCAAyC;IACzC,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tooltip/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAoD,MAAM,OAAO,CAAC;AAO7E,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,cAAc,CAAC;AAEtB,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAsJ7B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useId, useMemo, useState } from "react";
|
|
3
|
+
import { getClassName, isNotNullish, isNullish } from "@bodynarf/utils";
|
|
4
|
+
import { useComponentOutsideClick, useEventListener } from "../../../hooks";
|
|
5
|
+
import { mapDataAttributes } from "../../../utils";
|
|
6
|
+
import "./style.scss";
|
|
7
|
+
const Tooltip = ({ content, children, trigger = "hover", position = "top", disabled = false, isOpen, defaultOpen = false, closeOnOutsideClick = true, closeOnEsc = true, interactive = false, className, contentClassName, title, data, onOpenChange, }) => {
|
|
8
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
9
|
+
const generatedId = useId();
|
|
10
|
+
const id = useMemo(() => `tooltip-${generatedId}`.replace(/:/g, ""), [generatedId]);
|
|
11
|
+
const isControlled = isNotNullish(isOpen);
|
|
12
|
+
const open = (isControlled ? isOpen : internalOpen) ?? false;
|
|
13
|
+
const setOpen = useCallback((next) => {
|
|
14
|
+
if (!isControlled) {
|
|
15
|
+
setInternalOpen(next);
|
|
16
|
+
}
|
|
17
|
+
onOpenChange?.(next);
|
|
18
|
+
}, [isControlled, onOpenChange]);
|
|
19
|
+
const onMouseEnter = useCallback(() => {
|
|
20
|
+
if (disabled || trigger !== "hover") {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
setOpen(true);
|
|
24
|
+
}, [disabled, trigger, setOpen]);
|
|
25
|
+
const onMouseLeave = useCallback(() => {
|
|
26
|
+
if (disabled || trigger !== "hover") {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setOpen(false);
|
|
30
|
+
}, [disabled, trigger, setOpen]);
|
|
31
|
+
const onFocus = useCallback(() => {
|
|
32
|
+
if (disabled || trigger !== "hover") {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
setOpen(true);
|
|
36
|
+
}, [disabled, trigger, setOpen]);
|
|
37
|
+
const onBlur = useCallback(() => {
|
|
38
|
+
if (disabled || trigger !== "hover") {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setOpen(false);
|
|
42
|
+
}, [disabled, trigger, setOpen]);
|
|
43
|
+
const onClick = useCallback(() => {
|
|
44
|
+
if (disabled || trigger !== "click") {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
setOpen(!open);
|
|
48
|
+
}, [disabled, trigger, open, setOpen]);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (disabled && open) {
|
|
51
|
+
setOpen(false);
|
|
52
|
+
}
|
|
53
|
+
}, [disabled, open, setOpen]);
|
|
54
|
+
useComponentOutsideClick(`[data-tooltip-id="${id}"]`, open && trigger === "click" && closeOnOutsideClick, () => setOpen(false), trigger === "click");
|
|
55
|
+
useEventListener("keydown", (event) => {
|
|
56
|
+
if (!closeOnEsc || !open) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (event.key === "Escape") {
|
|
60
|
+
setOpen(false);
|
|
61
|
+
}
|
|
62
|
+
}, document);
|
|
63
|
+
const rootClassName = getClassName([
|
|
64
|
+
"bbr-tooltip",
|
|
65
|
+
`bbr-tooltip--${position}`,
|
|
66
|
+
className,
|
|
67
|
+
]);
|
|
68
|
+
const dataAttributes = mapDataAttributes(data);
|
|
69
|
+
const contentClassNames = getClassName([
|
|
70
|
+
"bbr-tooltip__content",
|
|
71
|
+
interactive ? "" : "bbr-tooltip__content--noninteractive",
|
|
72
|
+
"has-background-dark",
|
|
73
|
+
"has-text-white",
|
|
74
|
+
contentClassName,
|
|
75
|
+
]);
|
|
76
|
+
return (_jsxs("span", { title: title, onBlur: onBlur, onClick: onClick, onFocus: onFocus, ...dataAttributes, "data-tooltip-id": id, className: rootClassName, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: [children, open && !disabled && !isNullish(content)
|
|
77
|
+
? (_jsx("span", { role: "tooltip", className: contentClassNames, children: content }))
|
|
78
|
+
: null] }));
|
|
79
|
+
};
|
|
80
|
+
export default Tooltip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseElementProps } from "../../types";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export type TooltipPosition = "top" | "bottom" | "left" | "right";
|
|
4
|
+
export type TooltipTrigger = "hover" | "click";
|
|
5
|
+
export type TooltipProps = BaseElementProps & {
|
|
6
|
+
/** Tooltip / popover content */
|
|
7
|
+
content: ReactNode;
|
|
8
|
+
/** Trigger element */
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
/** How tooltip is opened */
|
|
11
|
+
trigger?: TooltipTrigger;
|
|
12
|
+
/** Position relative to trigger */
|
|
13
|
+
position?: TooltipPosition;
|
|
14
|
+
/** Disable tooltip behavior entirely */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Controlled open state */
|
|
17
|
+
isOpen?: boolean;
|
|
18
|
+
/** Uncontrolled open initial state */
|
|
19
|
+
defaultOpen?: boolean;
|
|
20
|
+
/** Close on outside click (relevant for click trigger) */
|
|
21
|
+
closeOnOutsideClick?: boolean;
|
|
22
|
+
/** Close on Escape key */
|
|
23
|
+
closeOnEsc?: boolean;
|
|
24
|
+
/** Allow pointer interaction with content (popover-like) */
|
|
25
|
+
interactive?: boolean;
|
|
26
|
+
/** Additional class name for content container */
|
|
27
|
+
contentClassName?: string;
|
|
28
|
+
/** Notify when open state changes */
|
|
29
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG;IAC1C,gCAAgC;IAChC,OAAO,EAAE,SAAS,CAAC;IAEnB,sBAAsB;IACtB,QAAQ,EAAE,SAAS,CAAC;IAEpB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,sCAAsC;IACtC,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,0DAA0D;IAC1D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,qCAAqC;IACrC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -30,12 +30,18 @@ Simple react components based on html elements.
|
|
|
30
30
|
- **Multiline** - multiline text input
|
|
31
31
|
- **Number** - number input with step
|
|
32
32
|
- **Password** - single line password input (requires icon, see icon component description)
|
|
33
|
-
- **
|
|
33
|
+
- **RadioGroup** - group of radio buttons with vertical/horizontal layout and customizable styles
|
|
34
|
+
- **Slider** - range input component with optional value display and progress track
|
|
35
|
+
- **Switch** - toggle switch component with multiple style variants (rounded, outlined, thin)
|
|
36
|
+
- **Text** - single line text input
|
|
37
|
+
- **TimePicker** - time input component with hours, minutes and optional seconds
|
|
34
38
|
|
|
35
39
|
#### Components
|
|
36
40
|
- **Anchor** - simple anchor (link) component
|
|
37
41
|
- **Button** - button that allows user to interact with system by clicking it _(assume everyone knows what is button)_
|
|
42
|
+
- **File** - file upload component with customizable placeholder, file type filtering and boxed style option
|
|
38
43
|
- **Icon** - *see p.4 of installation*
|
|
44
|
+
- **Progress** - progress bar component with percentage display, indeterminate state and animation
|
|
39
45
|
- **Tag** - small component stands for tag visualization
|
|
40
46
|
- **BreadCrumbs** - speaks for it self
|
|
41
47
|
- **Table** - table with sortable headers
|
|
@@ -44,6 +50,7 @@ Simple react components based on html elements.
|
|
|
44
50
|
Complex components is set of components built via combining simple components or represent complex logical component
|
|
45
51
|
- **Accordion** - Collapsible container that can hide some content inside
|
|
46
52
|
- **Dropdown** - Custom dropdown component, based on html div elements & css (requires icon, see icon component description)
|
|
53
|
+
- **ModalWrapper** - Modal window component with customizable header, body and action buttons
|
|
47
54
|
- **Multiselect** - Dropdown with option to select several records
|
|
48
55
|
- **Paginator** - Pagination elements to navigate through paged list
|
|
49
56
|
|
|
@@ -61,12 +68,20 @@ Complex components is set of components built via combining simple components or
|
|
|
61
68
|
/>
|
|
62
69
|
```
|
|
63
70
|
- **Search** - Search bar with optional button to perform search
|
|
71
|
+
- **Stepper** - Step indicator component for multi-step processes with vertical/horizontal layout
|
|
64
72
|
- **Tabs** - Container for multi-content with option of switching displaying content without refreshing\scrolling page
|
|
73
|
+
- **Timeline** - Vertical timeline component for displaying chronological events
|
|
65
74
|
|
|
66
75
|
### Hooks
|
|
67
76
|
|
|
68
77
|
- **useComponentOutsideClick** - Attach watcher for mouse clicks and emit event when click was outside of component
|
|
78
|
+
- **useDebounceHandler** - Create a cooldown event handler
|
|
79
|
+
- **useEventListener** - Attach an event listener to window/document/element with automatic cleanup
|
|
80
|
+
- **useInterval** - Execute a callback repeatedly with a fixed time delay
|
|
81
|
+
- **useLocalStorage** - Store state in localStorage and keep it in sync
|
|
82
|
+
- **useMount** - Handle component initial mount event
|
|
69
83
|
- **usePagination** - Create a pagination config to easily manipulate with Paginator component
|
|
84
|
+
- **usePrevious** - Get the previous value of a state or prop
|
|
85
|
+
- **useTimeout** - Execute a callback after a specified delay
|
|
70
86
|
- **useUnmount** - Handle component unmounting event. Useful as component cleanup fn
|
|
71
|
-
- **
|
|
72
|
-
- **useDebounceHandler** - Create a cooldown event handler
|
|
87
|
+
- **useUpdateEffect** - Like useEffect, but skips execution on the initial render
|