@bodynarf/react.components 1.13.8 → 1.14.1

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.
Files changed (132) hide show
  1. package/changelog.md +55 -0
  2. package/components/accordion/component/index.js +1 -1
  3. package/components/accordion/component/style.css +21 -0
  4. package/components/anchor/component/style.css +12 -0
  5. package/components/button/component/style.css +10 -0
  6. package/components/dropdown/component/style.css +101 -0
  7. package/components/dropdown/components/compact/index.d.ts.map +1 -1
  8. package/components/dropdown/components/compact/index.js +3 -3
  9. package/components/dropdown/components/label/components/empty/index.js +1 -1
  10. package/components/dropdown/components/label/components/withSearch/style.css +21 -0
  11. package/components/dropdown/types.d.ts +6 -6
  12. package/components/dropdown/types.d.ts.map +1 -1
  13. package/components/file/component/styles.css +74 -0
  14. package/components/icon/component/style.css +19 -0
  15. package/components/index.d.ts +14 -2
  16. package/components/index.d.ts.map +1 -1
  17. package/components/index.js +14 -2
  18. package/components/modal/component/index.d.ts +7 -0
  19. package/components/modal/component/index.d.ts.map +1 -0
  20. package/components/modal/component/index.js +42 -0
  21. package/components/modal/component/style.css +32 -0
  22. package/components/modal/component/style.scss +42 -0
  23. package/components/modal/index.d.ts +3 -0
  24. package/components/modal/index.d.ts.map +1 -0
  25. package/components/modal/index.js +2 -0
  26. package/components/modal/types.d.ts +44 -0
  27. package/components/modal/types.d.ts.map +1 -0
  28. package/components/modal/types.js +1 -0
  29. package/components/multiselect/component/style.css +20 -0
  30. package/components/multiselect/components/withoutLabel/index.d.ts.map +1 -1
  31. package/components/multiselect/components/withoutLabel/index.js +5 -5
  32. package/components/primitives/checkbox/component/style.css +19 -0
  33. package/components/primitives/color/component/style.css +15 -0
  34. package/components/primitives/date/component/style.css +9 -0
  35. package/components/primitives/index.d.ts +4 -0
  36. package/components/primitives/index.d.ts.map +1 -1
  37. package/components/primitives/index.js +4 -0
  38. package/components/primitives/internal/hint/style.css +4 -0
  39. package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
  40. package/components/primitives/number/components/withLabel/index.js +10 -2
  41. package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
  42. package/components/primitives/number/components/withoutLabel/index.js +12 -4
  43. package/components/primitives/number/types.d.ts +6 -0
  44. package/components/primitives/number/types.d.ts.map +1 -1
  45. package/components/primitives/password/component/style.css +10 -0
  46. package/components/primitives/radioGroup/component/index.d.ts +7 -0
  47. package/components/primitives/radioGroup/component/index.d.ts.map +1 -0
  48. package/components/primitives/radioGroup/component/index.js +42 -0
  49. package/components/primitives/radioGroup/component/style.css +382 -0
  50. package/components/primitives/radioGroup/component/style.scss +271 -0
  51. package/components/primitives/radioGroup/index.d.ts +3 -0
  52. package/components/primitives/radioGroup/index.d.ts.map +1 -0
  53. package/components/primitives/radioGroup/index.js +2 -0
  54. package/components/primitives/radioGroup/types.d.ts +61 -0
  55. package/components/primitives/radioGroup/types.d.ts.map +1 -0
  56. package/components/primitives/radioGroup/types.js +1 -0
  57. package/components/primitives/slider/component/index.d.ts +7 -0
  58. package/components/primitives/slider/component/index.d.ts.map +1 -0
  59. package/components/primitives/slider/component/index.js +47 -0
  60. package/components/primitives/slider/component/style.css +438 -0
  61. package/components/primitives/slider/component/style.scss +321 -0
  62. package/components/primitives/slider/index.d.ts +3 -0
  63. package/components/primitives/slider/index.d.ts.map +1 -0
  64. package/components/primitives/slider/index.js +2 -0
  65. package/components/primitives/slider/types.d.ts +51 -0
  66. package/components/primitives/slider/types.d.ts.map +1 -0
  67. package/components/primitives/slider/types.js +1 -0
  68. package/components/primitives/switch/component/index.d.ts +7 -0
  69. package/components/primitives/switch/component/index.d.ts.map +1 -0
  70. package/components/primitives/switch/component/index.js +39 -0
  71. package/components/primitives/switch/component/style.css +482 -0
  72. package/components/primitives/switch/component/style.scss +216 -0
  73. package/components/primitives/switch/index.d.ts +3 -0
  74. package/components/primitives/switch/index.d.ts.map +1 -0
  75. package/components/primitives/switch/index.js +2 -0
  76. package/components/primitives/switch/types.d.ts +23 -0
  77. package/components/primitives/switch/types.d.ts.map +1 -0
  78. package/components/primitives/switch/types.js +1 -0
  79. package/components/primitives/timePicker/component/index.d.ts +8 -0
  80. package/components/primitives/timePicker/component/index.d.ts.map +1 -0
  81. package/components/primitives/timePicker/component/index.js +65 -0
  82. package/components/primitives/timePicker/component/style.css +21 -0
  83. package/components/primitives/timePicker/component/style.scss +26 -0
  84. package/components/primitives/timePicker/index.d.ts +3 -0
  85. package/components/primitives/timePicker/index.d.ts.map +1 -0
  86. package/components/primitives/timePicker/index.js +2 -0
  87. package/components/primitives/timePicker/types.d.ts +33 -0
  88. package/components/primitives/timePicker/types.d.ts.map +1 -0
  89. package/components/primitives/timePicker/types.js +1 -0
  90. package/components/progress/component/style.css +167 -0
  91. package/components/search/component/index.d.ts.map +1 -1
  92. package/components/search/component/index.js +9 -3
  93. package/components/search/component/style.css +18 -0
  94. package/components/search/types.d.ts +5 -0
  95. package/components/search/types.d.ts.map +1 -1
  96. package/components/stepper/component/index.d.ts +7 -0
  97. package/components/stepper/component/index.d.ts.map +1 -0
  98. package/components/stepper/component/index.js +56 -0
  99. package/components/stepper/component/style.css +510 -0
  100. package/components/stepper/component/style.scss +432 -0
  101. package/components/stepper/index.d.ts +3 -0
  102. package/components/stepper/index.d.ts.map +1 -0
  103. package/components/stepper/index.js +2 -0
  104. package/components/stepper/types.d.ts +65 -0
  105. package/components/stepper/types.d.ts.map +1 -0
  106. package/components/stepper/types.js +1 -0
  107. package/components/table/component/style.css +14 -0
  108. package/components/tabs/component/style.css +6 -0
  109. package/components/tag/component/style.css +19 -0
  110. package/components/timeline/component/index.d.ts +7 -0
  111. package/components/timeline/component/index.d.ts.map +1 -0
  112. package/components/timeline/component/index.js +36 -0
  113. package/components/timeline/component/style.css +488 -0
  114. package/components/timeline/component/style.scss +397 -0
  115. package/components/timeline/index.d.ts +3 -0
  116. package/components/timeline/index.d.ts.map +1 -0
  117. package/components/timeline/index.js +2 -0
  118. package/components/timeline/types.d.ts +55 -0
  119. package/components/timeline/types.d.ts.map +1 -0
  120. package/components/timeline/types.js +1 -0
  121. package/components/tooltip/component/index.d.ts +6 -0
  122. package/components/tooltip/component/index.d.ts.map +1 -0
  123. package/components/tooltip/component/index.js +80 -0
  124. package/components/tooltip/index.d.ts +3 -0
  125. package/components/tooltip/index.d.ts.map +1 -0
  126. package/components/tooltip/index.js +2 -0
  127. package/components/tooltip/types.d.ts +31 -0
  128. package/components/tooltip/types.d.ts.map +1 -0
  129. package/components/tooltip/types.js +1 -0
  130. package/package.json +10 -3
  131. package/readme.md +18 -3
  132. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,397 @@
1
+ @import "bulma/sass/utilities/derived-variables";
2
+
3
+ $timeline-marker-size: 1.5rem !default;
4
+ $timeline-marker-size-small: 1.25rem !default;
5
+ $timeline-marker-size-medium: 1.75rem !default;
6
+ $timeline-marker-size-large: 2rem !default;
7
+
8
+ $timeline-connector-width: 2px !default;
9
+ $timeline-connector-color: $grey-lighter !default;
10
+
11
+ $timeline-marker-bg: $primary !default;
12
+ $timeline-marker-border: 2px solid $primary !default;
13
+ $timeline-marker-color: $white !default;
14
+
15
+ $timeline-marker-hollow-bg: $white !default;
16
+
17
+ $timeline-content-bg: $white !default;
18
+ $timeline-content-border: 1px solid $grey-lighter !default;
19
+ $timeline-content-shadow: 0 2px 4px rgba($black, 0.05) !default;
20
+
21
+ $timeline-title-color: $grey-darker !default;
22
+ $timeline-text-color: $grey !default;
23
+ $timeline-timestamp-color: $grey-light !default;
24
+
25
+ $timeline-item-spacing: 2rem !default;
26
+
27
+ // Animations
28
+ @keyframes timeline-fade-in-left {
29
+ from {
30
+ opacity: 0;
31
+ transform: translateX(-20px);
32
+ }
33
+ to {
34
+ opacity: 1;
35
+ transform: translateX(0);
36
+ }
37
+ }
38
+
39
+ @keyframes timeline-fade-in-right {
40
+ from {
41
+ opacity: 0;
42
+ transform: translateX(20px);
43
+ }
44
+ to {
45
+ opacity: 1;
46
+ transform: translateX(0);
47
+ }
48
+ }
49
+
50
+ .bbr-timeline {
51
+ position: relative;
52
+ display: flex;
53
+ flex-direction: column;
54
+ width: 100%;
55
+
56
+ // Timeline item
57
+ .bbr-timeline-item {
58
+ position: relative;
59
+ display: flex;
60
+ align-items: flex-start;
61
+ padding-bottom: $timeline-item-spacing;
62
+
63
+ &:last-child {
64
+ padding-bottom: 0;
65
+
66
+ .bbr-timeline-connector {
67
+ display: none;
68
+ }
69
+ }
70
+ }
71
+
72
+ // Marker (circle with optional icon/content)
73
+ .bbr-timeline-marker {
74
+ display: flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+ width: $timeline-marker-size;
78
+ height: $timeline-marker-size;
79
+ min-width: $timeline-marker-size;
80
+ border-radius: 50%;
81
+ background: $timeline-marker-bg;
82
+ border: $timeline-marker-border;
83
+ color: $timeline-marker-color;
84
+ font-size: 0.75rem;
85
+ font-weight: 600;
86
+ z-index: 1;
87
+ flex-shrink: 0;
88
+ }
89
+
90
+ .bbr-timeline-icon,
91
+ .bbr-timeline-marker-content {
92
+ display: flex;
93
+ align-items: center;
94
+ justify-content: center;
95
+ font-size: 0.65rem;
96
+ }
97
+
98
+ // Content box
99
+ .bbr-timeline-content {
100
+ flex: 1;
101
+ background: $timeline-content-bg;
102
+ border: $timeline-content-border;
103
+ border-radius: 4px;
104
+ padding: 1rem;
105
+ margin-left: 1rem;
106
+ box-shadow: $timeline-content-shadow;
107
+ }
108
+
109
+ .bbr-timeline-title {
110
+ font-weight: 600;
111
+ font-size: 1rem;
112
+ color: $timeline-title-color;
113
+ line-height: 1.25;
114
+ }
115
+
116
+ .bbr-timeline-text {
117
+ margin-top: 0.5rem;
118
+ font-size: 0.875rem;
119
+ color: $timeline-text-color;
120
+ line-height: 1.5;
121
+ }
122
+
123
+ .bbr-timeline-timestamp {
124
+ font-size: 0.75rem;
125
+ color: $timeline-timestamp-color;
126
+ margin-bottom: 0.25rem;
127
+ }
128
+
129
+ // Connector line
130
+ .bbr-timeline-connector {
131
+ position: absolute;
132
+ left: calc($timeline-marker-size / 2 - $timeline-connector-width / 2);
133
+ top: $timeline-marker-size;
134
+ width: $timeline-connector-width;
135
+ height: calc(100% - $timeline-marker-size);
136
+ background: $timeline-connector-color;
137
+ z-index: 0;
138
+ }
139
+
140
+ // Left aligned mode (default)
141
+ &.is-left-aligned {
142
+ .bbr-timeline-item {
143
+ padding-left: 0;
144
+ }
145
+ }
146
+
147
+ // Centered mode (alternating left/right)
148
+ &.is-centered {
149
+ .bbr-timeline-item {
150
+ width: 50%;
151
+ margin-left: 50%;
152
+
153
+ &:nth-child(odd) {
154
+ margin-left: 0;
155
+ flex-direction: row-reverse;
156
+ text-align: right;
157
+
158
+ .bbr-timeline-content {
159
+ margin-left: 0;
160
+ margin-right: 1rem;
161
+ }
162
+
163
+ .bbr-timeline-connector {
164
+ left: auto;
165
+ right: calc($timeline-marker-size / 2 - $timeline-connector-width / 2);
166
+ }
167
+ }
168
+ }
169
+
170
+ .bbr-timeline-marker {
171
+ position: absolute;
172
+ left: 50%;
173
+ transform: translateX(-50%);
174
+ }
175
+
176
+ .bbr-timeline-item:nth-child(odd) .bbr-timeline-marker {
177
+ left: auto;
178
+ right: 0;
179
+ transform: translateX(50%);
180
+ }
181
+
182
+ .bbr-timeline-item:nth-child(even) .bbr-timeline-marker {
183
+ left: 0;
184
+ transform: translateX(-50%);
185
+ }
186
+
187
+ .bbr-timeline-connector {
188
+ left: 50%;
189
+ transform: translateX(-50%);
190
+ }
191
+
192
+ .bbr-timeline-item:nth-child(odd) .bbr-timeline-connector {
193
+ left: auto;
194
+ right: 0;
195
+ transform: translateX(50%);
196
+ }
197
+
198
+ .bbr-timeline-item:nth-child(even) .bbr-timeline-connector {
199
+ left: 0;
200
+ transform: translateX(-50%);
201
+ }
202
+
203
+ // Separate timestamps
204
+ &.has-separate-timestamps {
205
+ .bbr-timeline-timestamp {
206
+ position: absolute;
207
+ width: 100%;
208
+ margin-bottom: 0;
209
+
210
+ &.is-left {
211
+ right: calc(50% + $timeline-marker-size / 2 + 1rem);
212
+ left: auto;
213
+ text-align: right;
214
+ }
215
+
216
+ &.is-right {
217
+ left: calc(50% + $timeline-marker-size / 2 + 1rem);
218
+ right: auto;
219
+ text-align: left;
220
+ }
221
+ }
222
+
223
+ .bbr-timeline-item:nth-child(odd) {
224
+ .bbr-timeline-timestamp.is-left {
225
+ display: none;
226
+ }
227
+ }
228
+
229
+ .bbr-timeline-item:nth-child(even) {
230
+ .bbr-timeline-timestamp.is-right {
231
+ display: none;
232
+ }
233
+ }
234
+ }
235
+ }
236
+
237
+ // Hollow markers
238
+ &.is-hollow {
239
+ .bbr-timeline-marker {
240
+ background: $timeline-marker-hollow-bg;
241
+ }
242
+
243
+ @each $name, $pair in $colors {
244
+ $color: nth($pair, 1);
245
+
246
+ .bbr-timeline-item.is-#{$name} .bbr-timeline-marker {
247
+ background: $timeline-marker-hollow-bg;
248
+ border-color: $color;
249
+ color: $color;
250
+ }
251
+ }
252
+ }
253
+
254
+ // Animation
255
+ &.is-animated {
256
+ .bbr-timeline-item {
257
+ opacity: 0;
258
+
259
+ &.is-animated-left {
260
+ animation: timeline-fade-in-left 0.5s ease forwards;
261
+ }
262
+
263
+ &.is-animated-right {
264
+ animation: timeline-fade-in-right 0.5s ease forwards;
265
+ }
266
+
267
+ @for $i from 1 through 20 {
268
+ &:nth-child(#{$i}) {
269
+ animation-delay: #{($i - 1) * 0.15}s;
270
+ }
271
+ }
272
+ }
273
+ }
274
+
275
+ // Size variations
276
+ &.is-small {
277
+ .bbr-timeline-marker {
278
+ width: $timeline-marker-size-small;
279
+ height: $timeline-marker-size-small;
280
+ min-width: $timeline-marker-size-small;
281
+ font-size: 0.625rem;
282
+ }
283
+
284
+ .bbr-timeline-icon,
285
+ .bbr-timeline-marker-content {
286
+ font-size: 0.55rem;
287
+ }
288
+
289
+ .bbr-timeline-title {
290
+ font-size: 0.875rem;
291
+ }
292
+
293
+ .bbr-timeline-text {
294
+ font-size: 0.75rem;
295
+ }
296
+
297
+ .bbr-timeline-timestamp {
298
+ font-size: 0.625rem;
299
+ }
300
+
301
+ .bbr-timeline-content {
302
+ padding: 0.75rem;
303
+ }
304
+
305
+ .bbr-timeline-connector {
306
+ left: calc($timeline-marker-size-small / 2 - $timeline-connector-width / 2);
307
+ top: $timeline-marker-size-small;
308
+ height: calc(100% - $timeline-marker-size-small);
309
+ }
310
+ }
311
+
312
+ &.is-medium {
313
+ .bbr-timeline-marker {
314
+ width: $timeline-marker-size-medium;
315
+ height: $timeline-marker-size-medium;
316
+ min-width: $timeline-marker-size-medium;
317
+ font-size: 0.875rem;
318
+ }
319
+
320
+ .bbr-timeline-icon,
321
+ .bbr-timeline-marker-content {
322
+ font-size: 0.75rem;
323
+ }
324
+
325
+ .bbr-timeline-title {
326
+ font-size: 1.125rem;
327
+ }
328
+
329
+ .bbr-timeline-text {
330
+ font-size: 1rem;
331
+ }
332
+
333
+ .bbr-timeline-connector {
334
+ left: calc($timeline-marker-size-medium / 2 - $timeline-connector-width / 2);
335
+ top: $timeline-marker-size-medium;
336
+ height: calc(100% - $timeline-marker-size-medium);
337
+ }
338
+ }
339
+
340
+ &.is-large {
341
+ .bbr-timeline-marker {
342
+ width: $timeline-marker-size-large;
343
+ height: $timeline-marker-size-large;
344
+ min-width: $timeline-marker-size-large;
345
+ font-size: 1rem;
346
+ }
347
+
348
+ .bbr-timeline-icon,
349
+ .bbr-timeline-marker-content {
350
+ font-size: 0.875rem;
351
+ }
352
+
353
+ .bbr-timeline-title {
354
+ font-size: 1.25rem;
355
+ }
356
+
357
+ .bbr-timeline-text {
358
+ font-size: 1.125rem;
359
+ }
360
+
361
+ .bbr-timeline-content {
362
+ padding: 1.25rem;
363
+ }
364
+
365
+ .bbr-timeline-connector {
366
+ left: calc($timeline-marker-size-large / 2 - $timeline-connector-width / 2);
367
+ top: $timeline-marker-size-large;
368
+ height: calc(100% - $timeline-marker-size-large);
369
+ }
370
+ }
371
+
372
+ // Color variations
373
+ @each $name, $pair in $colors {
374
+ $color: nth($pair, 1);
375
+ $color-invert: nth($pair, 2);
376
+
377
+ &.is-#{$name} {
378
+ .bbr-timeline-marker {
379
+ background: $color;
380
+ border-color: $color;
381
+ color: $color-invert;
382
+ }
383
+
384
+ .bbr-timeline-connector {
385
+ background: rgba($color, 0.3);
386
+ }
387
+ }
388
+
389
+ .bbr-timeline-item.is-#{$name} {
390
+ .bbr-timeline-marker {
391
+ background: $color;
392
+ border-color: $color;
393
+ color: $color-invert;
394
+ }
395
+ }
396
+ }
397
+ }
@@ -0,0 +1,3 @@
1
+ export { default } from "./component";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -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,2 @@
1
+ export { default } from "./component";
2
+ export * from "./types";
@@ -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,6 @@
1
+ import { FC } from "react";
2
+ import { TooltipProps } from "..";
3
+ import "./style.scss";
4
+ declare const Tooltip: FC<TooltipProps>;
5
+ export default Tooltip;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -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,3 @@
1
+ export { default } from "./component";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -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,2 @@
1
+ export { default } from "./component";
2
+ export * from "./types";
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodynarf/react.components",
3
- "version": "1.13.8",
3
+ "version": "1.14.1",
4
4
  "author": {
5
5
  "name": "Artem",
6
6
  "email": "bodynar@gmail.com"
@@ -27,13 +27,17 @@
27
27
  "transfer": "npm run copy_styles && npm run copy_main",
28
28
  "build_transfer": "npm run build && npm run transfer",
29
29
  "prepublish": "npm run build_transfer && cd dist && npm pack",
30
- "publish_pkg": "npm run build_transfer && cd dist && npm publish --access=public",
31
- "lint": "npx eslint src/**/*.ts src/**/*.tsx"
30
+ "publish_pkg": "npm run lint && npm run validate:scss && npm run build_transfer && cd dist && npm publish --access=public",
31
+ "lint": "npx eslint src/**/*.ts src/**/*.tsx",
32
+ "lint:scss": "npx stylelint \"src/**/*.scss\"",
33
+ "build:scss": "npx sass --load-path=node_modules src/:dist/ --no-source-map",
34
+ "validate:scss": "npm run lint:scss && npm run build:scss"
32
35
  },
33
36
  "devDependencies": {
34
37
  "@eslint/js": "^9.30.1",
35
38
  "@types/react": "^18.0.11",
36
39
  "@types/react-dom": "^18.0.5",
40
+ "bulma": "^0.9.4",
37
41
  "copyfiles": "^2.4.1",
38
42
  "eslint": "^9.32.0",
39
43
  "eslint-plugin-import": "^2.32.0",
@@ -41,6 +45,9 @@
41
45
  "eslint-plugin-react-hooks": "^5.2.0",
42
46
  "eslint-plugin-react-refresh": "^0.4.20",
43
47
  "react": ">=18.1.0",
48
+ "sass": "^1.77.0",
49
+ "stylelint": "^16.6.0",
50
+ "stylelint-config-standard-scss": "^13.1.0",
44
51
  "tsc-alias": "^1.8.6",
45
52
  "typescript": "~5.8.3",
46
53
  "typescript-eslint": "^8.35.1"