@entur/tooltip 4.0.0-beta.1 → 4.0.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.
- package/dist/styles.css +298 -298
- package/dist/tooltip.cjs.development.js +8 -8
- package/dist/tooltip.cjs.development.js.map +1 -1
- package/dist/tooltip.cjs.production.min.js +1 -1
- package/dist/tooltip.cjs.production.min.js.map +1 -1
- package/dist/tooltip.esm.js +8 -8
- package/dist/tooltip.esm.js.map +1 -1
- package/package.json +6 -6
package/dist/styles.css
CHANGED
|
@@ -24,205 +24,6 @@
|
|
|
24
24
|
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
25
25
|
/* DO NOT CHANGE!*/
|
|
26
26
|
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
27
|
-
/* DO NOT CHANGE!*/
|
|
28
|
-
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
29
|
-
[data-color-mode=light],
|
|
30
|
-
:root {
|
|
31
|
-
--components-tooltip-popover-contrast-border: rgba(255, 255, 255, 0);
|
|
32
|
-
--components-tooltip-popover-contrast-fill: #393d79;
|
|
33
|
-
--components-tooltip-popover-contrast-icon: #ffffff;
|
|
34
|
-
--components-tooltip-popover-contrast-text: #ffffff;
|
|
35
|
-
--components-tooltip-popover-standard-border: rgba(84, 86, 140, 0.4);
|
|
36
|
-
--components-tooltip-popover-standard-fill: #f6f6f9;
|
|
37
|
-
--components-tooltip-popover-standard-icon: #181c56;
|
|
38
|
-
--components-tooltip-popover-standard-text: #181c56;
|
|
39
|
-
--components-tooltip-tooltip-contrast-fill: #ffffff;
|
|
40
|
-
--components-tooltip-tooltip-contrast-fill-negative: #ff9494;
|
|
41
|
-
--components-tooltip-tooltip-contrast-icon: #181c56;
|
|
42
|
-
--components-tooltip-tooltip-contrast-icon-negative: #181c56;
|
|
43
|
-
--components-tooltip-tooltip-contrast-text: #181c56;
|
|
44
|
-
--components-tooltip-tooltip-contrast-text-negative: #181c56;
|
|
45
|
-
--components-tooltip-tooltip-contrast-triangle: #ffffff;
|
|
46
|
-
--components-tooltip-tooltip-contrast-triangle-negative: #ff9494;
|
|
47
|
-
--components-tooltip-tooltip-standard-fill: #181c56;
|
|
48
|
-
--components-tooltip-tooltip-standard-fill-negative: #ffcece;
|
|
49
|
-
--components-tooltip-tooltip-standard-icon: #ffffff;
|
|
50
|
-
--components-tooltip-tooltip-standard-icon-negative: #181c56;
|
|
51
|
-
--components-tooltip-tooltip-standard-text: #ffffff;
|
|
52
|
-
--components-tooltip-tooltip-standard-text-negative: #181c56;
|
|
53
|
-
--components-tooltip-tooltip-standard-triangle: #181c56;
|
|
54
|
-
--components-tooltip-tooltip-standard-triangle-negative: #ffcece;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
[data-color-mode=dark] {
|
|
58
|
-
--components-tooltip-popover-contrast-border: rgba(255, 255, 255, 0);
|
|
59
|
-
--components-tooltip-popover-contrast-fill: #393a49;
|
|
60
|
-
--components-tooltip-popover-contrast-icon: #e5e5e9;
|
|
61
|
-
--components-tooltip-popover-contrast-text: #e5e5e9;
|
|
62
|
-
--components-tooltip-popover-standard-border: rgba(255, 255, 255, 0);
|
|
63
|
-
--components-tooltip-popover-standard-fill: #393a49;
|
|
64
|
-
--components-tooltip-popover-standard-icon: #e5e5e9;
|
|
65
|
-
--components-tooltip-popover-standard-text: #e5e5e9;
|
|
66
|
-
--components-tooltip-tooltip-contrast-fill: #393a49;
|
|
67
|
-
--components-tooltip-tooltip-contrast-fill-negative: #ff9494;
|
|
68
|
-
--components-tooltip-tooltip-contrast-icon: #e5e5e9;
|
|
69
|
-
--components-tooltip-tooltip-contrast-icon-negative: #08091c;
|
|
70
|
-
--components-tooltip-tooltip-contrast-text: #e5e5e9;
|
|
71
|
-
--components-tooltip-tooltip-contrast-text-negative: #08091c;
|
|
72
|
-
--components-tooltip-tooltip-contrast-triangle: #393a49;
|
|
73
|
-
--components-tooltip-tooltip-contrast-triangle-negative: #ff9494;
|
|
74
|
-
--components-tooltip-tooltip-standard-fill: #393a49;
|
|
75
|
-
--components-tooltip-tooltip-standard-fill-negative: #ff9494;
|
|
76
|
-
--components-tooltip-tooltip-standard-icon: #e5e5e9;
|
|
77
|
-
--components-tooltip-tooltip-standard-icon-negative: #08091c;
|
|
78
|
-
--components-tooltip-tooltip-standard-text: #e5e5e9;
|
|
79
|
-
--components-tooltip-tooltip-standard-text-negative: #08091c;
|
|
80
|
-
--components-tooltip-tooltip-standard-triangle: #393a49;
|
|
81
|
-
--components-tooltip-tooltip-standard-triangle-negative: #ff9494;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/* DO NOT CHANGE!*/
|
|
85
|
-
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
86
|
-
/* DO NOT CHANGE!*/
|
|
87
|
-
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
88
|
-
[data-color-mode=light],
|
|
89
|
-
:root {
|
|
90
|
-
--basecolors-frame-contrast: #181c56;
|
|
91
|
-
--basecolors-frame-contrastalt: #393d79;
|
|
92
|
-
--basecolors-frame-default: #ffffff;
|
|
93
|
-
--basecolors-frame-elevated: #ffffff;
|
|
94
|
-
--basecolors-frame-elevatedalt: #f6f6f9;
|
|
95
|
-
--basecolors-frame-subdued: #d9dae8;
|
|
96
|
-
--basecolors-frame-tint: #f6f6f9;
|
|
97
|
-
--basecolors-shape-accent: #181c56;
|
|
98
|
-
--basecolors-shape-bicycle-contrast: #00db9b;
|
|
99
|
-
--basecolors-shape-bicycle-default: #388f76;
|
|
100
|
-
--basecolors-shape-bus-contrast: #ff6392;
|
|
101
|
-
--basecolors-shape-bus-default: #c5044e;
|
|
102
|
-
--basecolors-shape-cableway-contrast: #b482fb;
|
|
103
|
-
--basecolors-shape-cableway-default: #78469a;
|
|
104
|
-
--basecolors-shape-disabled: #6e6f73;
|
|
105
|
-
--basecolors-shape-disabledalt: #b6b8ba;
|
|
106
|
-
--basecolors-shape-ferry-contrast: #6fdfff;
|
|
107
|
-
--basecolors-shape-ferry-default: #0c6693;
|
|
108
|
-
--basecolors-shape-funicular-contrast: #b482fb;
|
|
109
|
-
--basecolors-shape-funicular-default: #78469a;
|
|
110
|
-
--basecolors-shape-helicopter-contrast: #fbafea;
|
|
111
|
-
--basecolors-shape-helicopter-default: #800664;
|
|
112
|
-
--basecolors-shape-highlight: #ff5959;
|
|
113
|
-
--basecolors-shape-light: #ffffff;
|
|
114
|
-
--basecolors-shape-mask: #ffffff;
|
|
115
|
-
--basecolors-shape-maskalt: #ffffff;
|
|
116
|
-
--basecolors-shape-metro-contrast: #f08901;
|
|
117
|
-
--basecolors-shape-metro-default: #bf5826;
|
|
118
|
-
--basecolors-shape-mobility-contrast: #00db9b;
|
|
119
|
-
--basecolors-shape-mobility-default: #388f76;
|
|
120
|
-
--basecolors-shape-plane-contrast: #fbafea;
|
|
121
|
-
--basecolors-shape-plane-default: #800664;
|
|
122
|
-
--basecolors-shape-subdued: #626493;
|
|
123
|
-
--basecolors-shape-subduedalt: #d9dae8;
|
|
124
|
-
--basecolors-shape-taxi-contrast: #ffe082;
|
|
125
|
-
--basecolors-shape-taxi-default: #3d3e40;
|
|
126
|
-
--basecolors-shape-train-contrast: #42a5f5;
|
|
127
|
-
--basecolors-shape-train-default: #00367f;
|
|
128
|
-
--basecolors-shape-tram-contrast: #b482fb;
|
|
129
|
-
--basecolors-shape-tram-default: #78469a;
|
|
130
|
-
--basecolors-shape-walk-contrast: #8284ab;
|
|
131
|
-
--basecolors-shape-walk-default: #8d8e9c;
|
|
132
|
-
--basecolors-shape-airportlinkbus-contrast: #fbafea;
|
|
133
|
-
--basecolors-shape-airportlinkbus-default: #800664;
|
|
134
|
-
--basecolors-shape-airportlinkrail-contrast: #fbafea;
|
|
135
|
-
--basecolors-shape-airportlinkrail-default: #800664;
|
|
136
|
-
--basecolors-stroke-contrast: #aeb7e2;
|
|
137
|
-
--basecolors-stroke-default: #181c56;
|
|
138
|
-
--basecolors-stroke-disabled: #949699;
|
|
139
|
-
--basecolors-stroke-focus-contrast: #aeb7e2;
|
|
140
|
-
--basecolors-stroke-focus-standard: #181c56;
|
|
141
|
-
--basecolors-stroke-highlight: #ff5959;
|
|
142
|
-
--basecolors-stroke-light: #ffffff;
|
|
143
|
-
--basecolors-stroke-subdued: #8284ab;
|
|
144
|
-
--basecolors-stroke-subduedalt: #e3e6e8;
|
|
145
|
-
--basecolors-text-accent: #181c56;
|
|
146
|
-
--basecolors-text-disabled: #6e6f73;
|
|
147
|
-
--basecolors-text-disabledalt: #b6b8ba;
|
|
148
|
-
--basecolors-text-highlight: #ff5959;
|
|
149
|
-
--basecolors-text-light: #ffffff;
|
|
150
|
-
--basecolors-text-subdued: #626493;
|
|
151
|
-
--basecolors-text-subduedalt: #d9dae8;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
[data-color-mode=dark] {
|
|
155
|
-
--basecolors-frame-contrast: #212233;
|
|
156
|
-
--basecolors-frame-contrastalt: #141527;
|
|
157
|
-
--basecolors-frame-default: #08091c;
|
|
158
|
-
--basecolors-frame-elevated: rgba(229, 229, 233, 0.1490196078);
|
|
159
|
-
--basecolors-frame-elevatedalt: #464755;
|
|
160
|
-
--basecolors-frame-subdued: #2d2e3e;
|
|
161
|
-
--basecolors-frame-tint: #141527;
|
|
162
|
-
--basecolors-shape-accent: #e5e5e9;
|
|
163
|
-
--basecolors-shape-bicycle-contrast: #4db295;
|
|
164
|
-
--basecolors-shape-bicycle-default: #4db295;
|
|
165
|
-
--basecolors-shape-bus-contrast: #ef7398;
|
|
166
|
-
--basecolors-shape-bus-default: #ef7398;
|
|
167
|
-
--basecolors-shape-cableway-contrast: #b898e5;
|
|
168
|
-
--basecolors-shape-cableway-default: #b898e5;
|
|
169
|
-
--basecolors-shape-disabled: #b6b8ba;
|
|
170
|
-
--basecolors-shape-disabledalt: #b3b4bd;
|
|
171
|
-
--basecolors-shape-ferry-contrast: #8ccfe2;
|
|
172
|
-
--basecolors-shape-ferry-default: #8ccfe2;
|
|
173
|
-
--basecolors-shape-funicular-contrast: #b898e5;
|
|
174
|
-
--basecolors-shape-funicular-default: #b898e5;
|
|
175
|
-
--basecolors-shape-helicopter-contrast: #f2b8e5;
|
|
176
|
-
--basecolors-shape-helicopter-default: #f2b8e5;
|
|
177
|
-
--basecolors-shape-highlight: #ff9494;
|
|
178
|
-
--basecolors-shape-light: #e5e5e9;
|
|
179
|
-
--basecolors-shape-mask: #2d2e3e;
|
|
180
|
-
--basecolors-shape-maskalt: #393a49;
|
|
181
|
-
--basecolors-shape-metro-contrast: #dd973c;
|
|
182
|
-
--basecolors-shape-metro-default: #dd973c;
|
|
183
|
-
--basecolors-shape-mobility-contrast: #4db295;
|
|
184
|
-
--basecolors-shape-mobility-default: #4db295;
|
|
185
|
-
--basecolors-shape-plane-contrast: #f2b8e5;
|
|
186
|
-
--basecolors-shape-plane-default: #f2b8e5;
|
|
187
|
-
--basecolors-shape-subdued: #b3b4bd;
|
|
188
|
-
--basecolors-shape-subduedalt: #b3b4bd;
|
|
189
|
-
--basecolors-shape-taxi-contrast: #ffe082;
|
|
190
|
-
--basecolors-shape-taxi-default: #ffe082;
|
|
191
|
-
--basecolors-shape-train-contrast: #60a2d7;
|
|
192
|
-
--basecolors-shape-train-default: #60a2d7;
|
|
193
|
-
--basecolors-shape-tram-contrast: #b898e5;
|
|
194
|
-
--basecolors-shape-tram-default: #b898e5;
|
|
195
|
-
--basecolors-shape-walk-contrast: #8d8e9c;
|
|
196
|
-
--basecolors-shape-walk-default: #8d8e9c;
|
|
197
|
-
--basecolors-shape-airportlinkbus-contrast: #f2b8e5;
|
|
198
|
-
--basecolors-shape-airportlinkbus-default: #f2b8e5;
|
|
199
|
-
--basecolors-shape-airportlinkrail-contrast: #f2b8e5;
|
|
200
|
-
--basecolors-shape-airportlinkrail-default: #f2b8e5;
|
|
201
|
-
--basecolors-stroke-contrast: #aeb7e2;
|
|
202
|
-
--basecolors-stroke-default: #b3b4bd;
|
|
203
|
-
--basecolors-stroke-disabled: #e3e6e8;
|
|
204
|
-
--basecolors-stroke-focus-contrast: #aeb7e2;
|
|
205
|
-
--basecolors-stroke-focus-standard: #aeb7e2;
|
|
206
|
-
--basecolors-stroke-highlight: #ff9494;
|
|
207
|
-
--basecolors-stroke-light: #b3b4bd;
|
|
208
|
-
--basecolors-stroke-subdued: #81828f;
|
|
209
|
-
--basecolors-stroke-subduedalt: #949699;
|
|
210
|
-
--basecolors-text-accent: #e5e5e9;
|
|
211
|
-
--basecolors-text-disabled: #b6b8ba;
|
|
212
|
-
--basecolors-text-disabledalt: #b6b8ba;
|
|
213
|
-
--basecolors-text-highlight: #ff9494;
|
|
214
|
-
--basecolors-text-light: #e5e5e9;
|
|
215
|
-
--basecolors-text-subdued: #b3b4bd;
|
|
216
|
-
--basecolors-text-subduedalt: #b3b4bd;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
:root {
|
|
220
|
-
--eds-tooltip: 1;
|
|
221
|
-
}
|
|
222
|
-
/* DO NOT CHANGE!*/
|
|
223
|
-
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
224
|
-
/* DO NOT CHANGE!*/
|
|
225
|
-
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
226
27
|
a.eds-button {
|
|
227
28
|
padding: 0.5rem 1rem;
|
|
228
29
|
}
|
|
@@ -565,74 +366,6 @@ a.eds-button--size-large {
|
|
|
565
366
|
margin-right: 0;
|
|
566
367
|
}
|
|
567
368
|
|
|
568
|
-
/* DO NOT CHANGE!*/
|
|
569
|
-
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
570
|
-
.eds-icon-button {
|
|
571
|
-
border: 0.125rem solid transparent;
|
|
572
|
-
border-radius: 0.25rem;
|
|
573
|
-
background: none;
|
|
574
|
-
color: var(--components-button-iconbutton-standard-text);
|
|
575
|
-
cursor: pointer;
|
|
576
|
-
display: flex;
|
|
577
|
-
justify-content: center;
|
|
578
|
-
align-items: center;
|
|
579
|
-
font-size: 1rem;
|
|
580
|
-
padding: 0.5rem;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
.eds-contrast .eds-icon-button {
|
|
584
|
-
color: var(--components-button-iconbutton-contrast-text);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
.eds-contrast .eds-icon-button > .eds-loading-dots .eds-loading-dots__dot {
|
|
588
|
-
background-color: var(--components-button-iconbutton-contrast-icon);
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
.eds-icon-button--size-small {
|
|
592
|
-
height: 1.5rem;
|
|
593
|
-
width: 1.5rem;
|
|
594
|
-
padding: 0;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
.eds-icon-button:hover {
|
|
598
|
-
background-color: var(--components-button-iconbutton-standard-hover);
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
.eds-contrast .eds-icon-button:hover {
|
|
602
|
-
background-color: var(--components-button-iconbutton-contrast-hover);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
.eds-icon-button:active {
|
|
606
|
-
background: var(--components-button-iconbutton-standard-active);
|
|
607
|
-
color: var(--components-button-iconbutton-standard-text-active);
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
.eds-contrast .eds-icon-button:active {
|
|
611
|
-
background: var(--components-button-iconbutton-contrast-active);
|
|
612
|
-
color: var(--components-button-iconbutton-contrast-text-active);
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
.eds-icon-button:focus {
|
|
616
|
-
outline: 2px solid #181c56;
|
|
617
|
-
outline-color: var(--basecolors-stroke-focus-standard);
|
|
618
|
-
outline-offset: 0.125rem;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
.eds-contrast .eds-icon-button:focus {
|
|
622
|
-
outline-color: var(--basecolors-stroke-focus-contrast);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
.eds-icon-button--disabled {
|
|
626
|
-
opacity: 0.5;
|
|
627
|
-
pointer-events: none;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
.eds-icon-button--disabled__wrapper {
|
|
631
|
-
cursor: not-allowed;
|
|
632
|
-
width: -moz-fit-content;
|
|
633
|
-
width: fit-content;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
369
|
/* DO NOT CHANGE!*/
|
|
637
370
|
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
638
371
|
.eds-square-button {
|
|
@@ -783,51 +516,119 @@ a.eds-button--size-large {
|
|
|
783
516
|
--button-background: var(--components-button-squaresuccess-contrast-active);
|
|
784
517
|
}
|
|
785
518
|
|
|
786
|
-
.eds-square-button--tertiary {
|
|
787
|
-
--button-background: var(--components-button-squaresecondary-standard-default);
|
|
788
|
-
--border-color: var(--components-button-squaresecondary-standard-border);
|
|
789
|
-
--icon-color: var(--components-button-squaresecondary-standard-icon);
|
|
790
|
-
--label-color: var(--components-button-squaresecondary-standard-text);
|
|
791
|
-
font-size: 0.875rem;
|
|
519
|
+
.eds-square-button--tertiary {
|
|
520
|
+
--button-background: var(--components-button-squaresecondary-standard-default);
|
|
521
|
+
--border-color: var(--components-button-squaresecondary-standard-border);
|
|
522
|
+
--icon-color: var(--components-button-squaresecondary-standard-icon);
|
|
523
|
+
--label-color: var(--components-button-squaresecondary-standard-text);
|
|
524
|
+
font-size: 0.875rem;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.eds-square-button--tertiary:hover {
|
|
528
|
+
--button-background: var(--components-button-squaresecondary-standard-hover);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.eds-square-button--tertiary:active {
|
|
532
|
+
--button-background: var(--components-button-squaresecondary-standard-active);
|
|
533
|
+
--border-color: var(--components-button-squaresecondary-standard-border-active);
|
|
534
|
+
--icon-color: var(--components-button-squaresecondary-standard-icon-active);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.eds-contrast .eds-square-button--tertiary {
|
|
538
|
+
--button-background: var(--components-button-squaresecondary-contrast-default);
|
|
539
|
+
--border-color: var(--components-button-squaresecondary-contrast-border);
|
|
540
|
+
--icon-color: var(--components-button-squaresecondary-contrast-icon-default);
|
|
541
|
+
--label-color: var(--components-button-squaresecondary-contrast-label);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.eds-contrast .eds-square-button--tertiary:hover {
|
|
545
|
+
--button-background: var(--components-button-squaresecondary-contrast-hover);
|
|
546
|
+
--icon-color: var(--components-button-squaresecondary-contrast-icon-hover);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.eds-contrast .eds-square-button--tertiary:active {
|
|
550
|
+
--button-background: var(--components-button-squaresecondary-contrast-active);
|
|
551
|
+
--border-color: var(--components-button-squaresecondary-contrast-border-active);
|
|
552
|
+
--icon-color: var(--components-button-squaresecondary-contrast-icon-active);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.eds-square-button--tertiary .eds-square-button__label + .eds-square-button__button,
|
|
556
|
+
.eds-square-button--tertiary .eds-square-button__button + .eds-square-button__label {
|
|
557
|
+
margin-left: 0.75rem;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.eds-square-button--tertiary .eds-square-button__button {
|
|
561
|
+
height: 2rem;
|
|
562
|
+
width: 2rem;
|
|
563
|
+
border-width: 0.0625rem;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/* DO NOT CHANGE!*/
|
|
567
|
+
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
568
|
+
.eds-icon-button {
|
|
569
|
+
border: 0.125rem solid transparent;
|
|
570
|
+
border-radius: 0.25rem;
|
|
571
|
+
background: none;
|
|
572
|
+
color: var(--components-button-iconbutton-standard-text);
|
|
573
|
+
cursor: pointer;
|
|
574
|
+
display: flex;
|
|
575
|
+
justify-content: center;
|
|
576
|
+
align-items: center;
|
|
577
|
+
font-size: 1rem;
|
|
578
|
+
padding: 0.5rem;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.eds-contrast .eds-icon-button {
|
|
582
|
+
color: var(--components-button-iconbutton-contrast-text);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
.eds-contrast .eds-icon-button > .eds-loading-dots .eds-loading-dots__dot {
|
|
586
|
+
background-color: var(--components-button-iconbutton-contrast-icon);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
.eds-icon-button--size-small {
|
|
590
|
+
height: 1.5rem;
|
|
591
|
+
width: 1.5rem;
|
|
592
|
+
padding: 0;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.eds-icon-button:hover {
|
|
596
|
+
background-color: var(--components-button-iconbutton-standard-hover);
|
|
792
597
|
}
|
|
793
598
|
|
|
794
|
-
.eds-
|
|
795
|
-
|
|
599
|
+
.eds-contrast .eds-icon-button:hover {
|
|
600
|
+
background-color: var(--components-button-iconbutton-contrast-hover);
|
|
796
601
|
}
|
|
797
602
|
|
|
798
|
-
.eds-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
--icon-color: var(--components-button-squaresecondary-standard-icon-active);
|
|
603
|
+
.eds-icon-button:active {
|
|
604
|
+
background: var(--components-button-iconbutton-standard-active);
|
|
605
|
+
color: var(--components-button-iconbutton-standard-text-active);
|
|
802
606
|
}
|
|
803
607
|
|
|
804
|
-
.eds-contrast .eds-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
--icon-color: var(--components-button-squaresecondary-contrast-icon-default);
|
|
808
|
-
--label-color: var(--components-button-squaresecondary-contrast-label);
|
|
608
|
+
.eds-contrast .eds-icon-button:active {
|
|
609
|
+
background: var(--components-button-iconbutton-contrast-active);
|
|
610
|
+
color: var(--components-button-iconbutton-contrast-text-active);
|
|
809
611
|
}
|
|
810
612
|
|
|
811
|
-
.eds-
|
|
812
|
-
|
|
813
|
-
|
|
613
|
+
.eds-icon-button:focus {
|
|
614
|
+
outline: 2px solid #181c56;
|
|
615
|
+
outline-color: var(--basecolors-stroke-focus-standard);
|
|
616
|
+
outline-offset: 0.125rem;
|
|
814
617
|
}
|
|
815
618
|
|
|
816
|
-
.eds-contrast .eds-
|
|
817
|
-
|
|
818
|
-
--border-color: var(--components-button-squaresecondary-contrast-border-active);
|
|
819
|
-
--icon-color: var(--components-button-squaresecondary-contrast-icon-active);
|
|
619
|
+
.eds-contrast .eds-icon-button:focus {
|
|
620
|
+
outline-color: var(--basecolors-stroke-focus-contrast);
|
|
820
621
|
}
|
|
821
622
|
|
|
822
|
-
.eds-
|
|
823
|
-
|
|
824
|
-
|
|
623
|
+
.eds-icon-button--disabled {
|
|
624
|
+
opacity: 0.5;
|
|
625
|
+
pointer-events: none;
|
|
825
626
|
}
|
|
826
627
|
|
|
827
|
-
.eds-
|
|
828
|
-
|
|
829
|
-
width:
|
|
830
|
-
|
|
628
|
+
.eds-icon-button--disabled__wrapper {
|
|
629
|
+
cursor: not-allowed;
|
|
630
|
+
width: -moz-fit-content;
|
|
631
|
+
width: fit-content;
|
|
831
632
|
}
|
|
832
633
|
|
|
833
634
|
/* DO NOT CHANGE!*/
|
|
@@ -1301,3 +1102,202 @@ a.eds-button--size-large {
|
|
|
1301
1102
|
.eds-contrast .eds-tooltip__close-button:active {
|
|
1302
1103
|
background-color: var(--components-button-iconbutton-standard-active);
|
|
1303
1104
|
}
|
|
1105
|
+
/* DO NOT CHANGE!*/
|
|
1106
|
+
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
1107
|
+
/* DO NOT CHANGE!*/
|
|
1108
|
+
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
1109
|
+
/* DO NOT CHANGE!*/
|
|
1110
|
+
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
1111
|
+
[data-color-mode=light],
|
|
1112
|
+
:root {
|
|
1113
|
+
--components-tooltip-popover-contrast-border: rgba(255, 255, 255, 0);
|
|
1114
|
+
--components-tooltip-popover-contrast-fill: #393d79;
|
|
1115
|
+
--components-tooltip-popover-contrast-icon: #ffffff;
|
|
1116
|
+
--components-tooltip-popover-contrast-text: #ffffff;
|
|
1117
|
+
--components-tooltip-popover-standard-border: rgba(84, 86, 140, 0.4);
|
|
1118
|
+
--components-tooltip-popover-standard-fill: #f6f6f9;
|
|
1119
|
+
--components-tooltip-popover-standard-icon: #181c56;
|
|
1120
|
+
--components-tooltip-popover-standard-text: #181c56;
|
|
1121
|
+
--components-tooltip-tooltip-contrast-fill: #ffffff;
|
|
1122
|
+
--components-tooltip-tooltip-contrast-fill-negative: #ff9494;
|
|
1123
|
+
--components-tooltip-tooltip-contrast-icon: #181c56;
|
|
1124
|
+
--components-tooltip-tooltip-contrast-icon-negative: #181c56;
|
|
1125
|
+
--components-tooltip-tooltip-contrast-text: #181c56;
|
|
1126
|
+
--components-tooltip-tooltip-contrast-text-negative: #181c56;
|
|
1127
|
+
--components-tooltip-tooltip-contrast-triangle: #ffffff;
|
|
1128
|
+
--components-tooltip-tooltip-contrast-triangle-negative: #ff9494;
|
|
1129
|
+
--components-tooltip-tooltip-standard-fill: #181c56;
|
|
1130
|
+
--components-tooltip-tooltip-standard-fill-negative: #ffcece;
|
|
1131
|
+
--components-tooltip-tooltip-standard-icon: #ffffff;
|
|
1132
|
+
--components-tooltip-tooltip-standard-icon-negative: #181c56;
|
|
1133
|
+
--components-tooltip-tooltip-standard-text: #ffffff;
|
|
1134
|
+
--components-tooltip-tooltip-standard-text-negative: #181c56;
|
|
1135
|
+
--components-tooltip-tooltip-standard-triangle: #181c56;
|
|
1136
|
+
--components-tooltip-tooltip-standard-triangle-negative: #ffcece;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
[data-color-mode=dark] {
|
|
1140
|
+
--components-tooltip-popover-contrast-border: rgba(255, 255, 255, 0);
|
|
1141
|
+
--components-tooltip-popover-contrast-fill: #393a49;
|
|
1142
|
+
--components-tooltip-popover-contrast-icon: #e5e5e9;
|
|
1143
|
+
--components-tooltip-popover-contrast-text: #e5e5e9;
|
|
1144
|
+
--components-tooltip-popover-standard-border: rgba(255, 255, 255, 0);
|
|
1145
|
+
--components-tooltip-popover-standard-fill: #393a49;
|
|
1146
|
+
--components-tooltip-popover-standard-icon: #e5e5e9;
|
|
1147
|
+
--components-tooltip-popover-standard-text: #e5e5e9;
|
|
1148
|
+
--components-tooltip-tooltip-contrast-fill: #393a49;
|
|
1149
|
+
--components-tooltip-tooltip-contrast-fill-negative: #ff9494;
|
|
1150
|
+
--components-tooltip-tooltip-contrast-icon: #e5e5e9;
|
|
1151
|
+
--components-tooltip-tooltip-contrast-icon-negative: #08091c;
|
|
1152
|
+
--components-tooltip-tooltip-contrast-text: #e5e5e9;
|
|
1153
|
+
--components-tooltip-tooltip-contrast-text-negative: #08091c;
|
|
1154
|
+
--components-tooltip-tooltip-contrast-triangle: #393a49;
|
|
1155
|
+
--components-tooltip-tooltip-contrast-triangle-negative: #ff9494;
|
|
1156
|
+
--components-tooltip-tooltip-standard-fill: #393a49;
|
|
1157
|
+
--components-tooltip-tooltip-standard-fill-negative: #ff9494;
|
|
1158
|
+
--components-tooltip-tooltip-standard-icon: #e5e5e9;
|
|
1159
|
+
--components-tooltip-tooltip-standard-icon-negative: #08091c;
|
|
1160
|
+
--components-tooltip-tooltip-standard-text: #e5e5e9;
|
|
1161
|
+
--components-tooltip-tooltip-standard-text-negative: #08091c;
|
|
1162
|
+
--components-tooltip-tooltip-standard-triangle: #393a49;
|
|
1163
|
+
--components-tooltip-tooltip-standard-triangle-negative: #ff9494;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/* DO NOT CHANGE!*/
|
|
1167
|
+
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
1168
|
+
/* DO NOT CHANGE!*/
|
|
1169
|
+
/* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
|
|
1170
|
+
[data-color-mode=light],
|
|
1171
|
+
:root {
|
|
1172
|
+
--basecolors-frame-contrast: #181c56;
|
|
1173
|
+
--basecolors-frame-contrastalt: #393d79;
|
|
1174
|
+
--basecolors-frame-default: #ffffff;
|
|
1175
|
+
--basecolors-frame-elevated: #ffffff;
|
|
1176
|
+
--basecolors-frame-elevatedalt: #f6f6f9;
|
|
1177
|
+
--basecolors-frame-subdued: #d9dae8;
|
|
1178
|
+
--basecolors-frame-tint: #f6f6f9;
|
|
1179
|
+
--basecolors-shape-accent: #181c56;
|
|
1180
|
+
--basecolors-shape-bicycle-contrast: #00db9b;
|
|
1181
|
+
--basecolors-shape-bicycle-default: #388f76;
|
|
1182
|
+
--basecolors-shape-bus-contrast: #ff6392;
|
|
1183
|
+
--basecolors-shape-bus-default: #c5044e;
|
|
1184
|
+
--basecolors-shape-cableway-contrast: #b482fb;
|
|
1185
|
+
--basecolors-shape-cableway-default: #78469a;
|
|
1186
|
+
--basecolors-shape-disabled: #6e6f73;
|
|
1187
|
+
--basecolors-shape-disabledalt: #b6b8ba;
|
|
1188
|
+
--basecolors-shape-ferry-contrast: #6fdfff;
|
|
1189
|
+
--basecolors-shape-ferry-default: #0c6693;
|
|
1190
|
+
--basecolors-shape-funicular-contrast: #b482fb;
|
|
1191
|
+
--basecolors-shape-funicular-default: #78469a;
|
|
1192
|
+
--basecolors-shape-helicopter-contrast: #fbafea;
|
|
1193
|
+
--basecolors-shape-helicopter-default: #800664;
|
|
1194
|
+
--basecolors-shape-highlight: #ff5959;
|
|
1195
|
+
--basecolors-shape-light: #ffffff;
|
|
1196
|
+
--basecolors-shape-mask: #ffffff;
|
|
1197
|
+
--basecolors-shape-maskalt: #ffffff;
|
|
1198
|
+
--basecolors-shape-metro-contrast: #f08901;
|
|
1199
|
+
--basecolors-shape-metro-default: #bf5826;
|
|
1200
|
+
--basecolors-shape-mobility-contrast: #00db9b;
|
|
1201
|
+
--basecolors-shape-mobility-default: #388f76;
|
|
1202
|
+
--basecolors-shape-plane-contrast: #fbafea;
|
|
1203
|
+
--basecolors-shape-plane-default: #800664;
|
|
1204
|
+
--basecolors-shape-subdued: #626493;
|
|
1205
|
+
--basecolors-shape-subduedalt: #d9dae8;
|
|
1206
|
+
--basecolors-shape-taxi-contrast: #ffe082;
|
|
1207
|
+
--basecolors-shape-taxi-default: #3d3e40;
|
|
1208
|
+
--basecolors-shape-train-contrast: #42a5f5;
|
|
1209
|
+
--basecolors-shape-train-default: #00367f;
|
|
1210
|
+
--basecolors-shape-tram-contrast: #b482fb;
|
|
1211
|
+
--basecolors-shape-tram-default: #78469a;
|
|
1212
|
+
--basecolors-shape-walk-contrast: #8284ab;
|
|
1213
|
+
--basecolors-shape-walk-default: #8d8e9c;
|
|
1214
|
+
--basecolors-shape-airportlinkbus-contrast: #fbafea;
|
|
1215
|
+
--basecolors-shape-airportlinkbus-default: #800664;
|
|
1216
|
+
--basecolors-shape-airportlinkrail-contrast: #fbafea;
|
|
1217
|
+
--basecolors-shape-airportlinkrail-default: #800664;
|
|
1218
|
+
--basecolors-stroke-contrast: #aeb7e2;
|
|
1219
|
+
--basecolors-stroke-default: #181c56;
|
|
1220
|
+
--basecolors-stroke-disabled: #949699;
|
|
1221
|
+
--basecolors-stroke-focus-contrast: #aeb7e2;
|
|
1222
|
+
--basecolors-stroke-focus-standard: #181c56;
|
|
1223
|
+
--basecolors-stroke-highlight: #ff5959;
|
|
1224
|
+
--basecolors-stroke-light: #ffffff;
|
|
1225
|
+
--basecolors-stroke-subdued: #8284ab;
|
|
1226
|
+
--basecolors-stroke-subduedalt: #e3e6e8;
|
|
1227
|
+
--basecolors-text-accent: #181c56;
|
|
1228
|
+
--basecolors-text-disabled: #6e6f73;
|
|
1229
|
+
--basecolors-text-disabledalt: #b6b8ba;
|
|
1230
|
+
--basecolors-text-highlight: #ff5959;
|
|
1231
|
+
--basecolors-text-light: #ffffff;
|
|
1232
|
+
--basecolors-text-subdued: #626493;
|
|
1233
|
+
--basecolors-text-subduedalt: #d9dae8;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
[data-color-mode=dark] {
|
|
1237
|
+
--basecolors-frame-contrast: #212233;
|
|
1238
|
+
--basecolors-frame-contrastalt: #141527;
|
|
1239
|
+
--basecolors-frame-default: #08091c;
|
|
1240
|
+
--basecolors-frame-elevated: rgba(229, 229, 233, 0.1490196078);
|
|
1241
|
+
--basecolors-frame-elevatedalt: #464755;
|
|
1242
|
+
--basecolors-frame-subdued: #2d2e3e;
|
|
1243
|
+
--basecolors-frame-tint: #141527;
|
|
1244
|
+
--basecolors-shape-accent: #e5e5e9;
|
|
1245
|
+
--basecolors-shape-bicycle-contrast: #4db295;
|
|
1246
|
+
--basecolors-shape-bicycle-default: #4db295;
|
|
1247
|
+
--basecolors-shape-bus-contrast: #ef7398;
|
|
1248
|
+
--basecolors-shape-bus-default: #ef7398;
|
|
1249
|
+
--basecolors-shape-cableway-contrast: #b898e5;
|
|
1250
|
+
--basecolors-shape-cableway-default: #b898e5;
|
|
1251
|
+
--basecolors-shape-disabled: #b6b8ba;
|
|
1252
|
+
--basecolors-shape-disabledalt: #b3b4bd;
|
|
1253
|
+
--basecolors-shape-ferry-contrast: #8ccfe2;
|
|
1254
|
+
--basecolors-shape-ferry-default: #8ccfe2;
|
|
1255
|
+
--basecolors-shape-funicular-contrast: #b898e5;
|
|
1256
|
+
--basecolors-shape-funicular-default: #b898e5;
|
|
1257
|
+
--basecolors-shape-helicopter-contrast: #f2b8e5;
|
|
1258
|
+
--basecolors-shape-helicopter-default: #f2b8e5;
|
|
1259
|
+
--basecolors-shape-highlight: #ff9494;
|
|
1260
|
+
--basecolors-shape-light: #e5e5e9;
|
|
1261
|
+
--basecolors-shape-mask: #2d2e3e;
|
|
1262
|
+
--basecolors-shape-maskalt: #393a49;
|
|
1263
|
+
--basecolors-shape-metro-contrast: #dd973c;
|
|
1264
|
+
--basecolors-shape-metro-default: #dd973c;
|
|
1265
|
+
--basecolors-shape-mobility-contrast: #4db295;
|
|
1266
|
+
--basecolors-shape-mobility-default: #4db295;
|
|
1267
|
+
--basecolors-shape-plane-contrast: #f2b8e5;
|
|
1268
|
+
--basecolors-shape-plane-default: #f2b8e5;
|
|
1269
|
+
--basecolors-shape-subdued: #b3b4bd;
|
|
1270
|
+
--basecolors-shape-subduedalt: #b3b4bd;
|
|
1271
|
+
--basecolors-shape-taxi-contrast: #ffe082;
|
|
1272
|
+
--basecolors-shape-taxi-default: #ffe082;
|
|
1273
|
+
--basecolors-shape-train-contrast: #60a2d7;
|
|
1274
|
+
--basecolors-shape-train-default: #60a2d7;
|
|
1275
|
+
--basecolors-shape-tram-contrast: #b898e5;
|
|
1276
|
+
--basecolors-shape-tram-default: #b898e5;
|
|
1277
|
+
--basecolors-shape-walk-contrast: #8d8e9c;
|
|
1278
|
+
--basecolors-shape-walk-default: #8d8e9c;
|
|
1279
|
+
--basecolors-shape-airportlinkbus-contrast: #f2b8e5;
|
|
1280
|
+
--basecolors-shape-airportlinkbus-default: #f2b8e5;
|
|
1281
|
+
--basecolors-shape-airportlinkrail-contrast: #f2b8e5;
|
|
1282
|
+
--basecolors-shape-airportlinkrail-default: #f2b8e5;
|
|
1283
|
+
--basecolors-stroke-contrast: #aeb7e2;
|
|
1284
|
+
--basecolors-stroke-default: #b3b4bd;
|
|
1285
|
+
--basecolors-stroke-disabled: #e3e6e8;
|
|
1286
|
+
--basecolors-stroke-focus-contrast: #aeb7e2;
|
|
1287
|
+
--basecolors-stroke-focus-standard: #aeb7e2;
|
|
1288
|
+
--basecolors-stroke-highlight: #ff9494;
|
|
1289
|
+
--basecolors-stroke-light: #b3b4bd;
|
|
1290
|
+
--basecolors-stroke-subdued: #81828f;
|
|
1291
|
+
--basecolors-stroke-subduedalt: #949699;
|
|
1292
|
+
--basecolors-text-accent: #e5e5e9;
|
|
1293
|
+
--basecolors-text-disabled: #b6b8ba;
|
|
1294
|
+
--basecolors-text-disabledalt: #b6b8ba;
|
|
1295
|
+
--basecolors-text-highlight: #ff9494;
|
|
1296
|
+
--basecolors-text-light: #e5e5e9;
|
|
1297
|
+
--basecolors-text-subdued: #b3b4bd;
|
|
1298
|
+
--basecolors-text-subduedalt: #b3b4bd;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
:root {
|
|
1302
|
+
--eds-tooltip: 1;
|
|
1303
|
+
}
|
|
@@ -82,8 +82,8 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
82
82
|
setShowTooltip = _useState[1];
|
|
83
83
|
var tooltipArrowRef = React.useRef(null);
|
|
84
84
|
var tooltipId = utils.useRandomId('eds-tooltip');
|
|
85
|
-
var hoverOpenTimer;
|
|
86
|
-
var hoverCloseTimer;
|
|
85
|
+
var hoverOpenTimer = React.useRef();
|
|
86
|
+
var hoverCloseTimer = React.useRef();
|
|
87
87
|
// calculations for floating-UI tooltip position
|
|
88
88
|
var _useFloating = reactDom.useFloating({
|
|
89
89
|
whileElementsMounted: function whileElementsMounted(ref, _float, update) {
|
|
@@ -105,21 +105,21 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
105
105
|
middlewareData = _useFloating.middlewareData,
|
|
106
106
|
actualPlacement = _useFloating.placement;
|
|
107
107
|
var onMouseEnter = function onMouseEnter() {
|
|
108
|
-
clearTimeout(hoverCloseTimer);
|
|
109
|
-
hoverOpenTimer = setTimeout(function () {
|
|
108
|
+
clearTimeout(hoverCloseTimer.current);
|
|
109
|
+
hoverOpenTimer.current = setTimeout(function () {
|
|
110
110
|
setShowTooltip(true);
|
|
111
111
|
}, 150);
|
|
112
112
|
};
|
|
113
113
|
var onMouseLeave = function onMouseLeave() {
|
|
114
|
-
clearTimeout(hoverOpenTimer);
|
|
115
|
-
hoverCloseTimer = setTimeout(function () {
|
|
114
|
+
clearTimeout(hoverOpenTimer.current);
|
|
115
|
+
hoverCloseTimer.current = setTimeout(function () {
|
|
116
116
|
setShowTooltip(false);
|
|
117
117
|
}, 300);
|
|
118
118
|
};
|
|
119
119
|
React.useEffect(function () {
|
|
120
120
|
return function () {
|
|
121
|
-
clearTimeout(hoverOpenTimer);
|
|
122
|
-
clearTimeout(hoverCloseTimer);
|
|
121
|
+
clearTimeout(hoverOpenTimer.current);
|
|
122
|
+
clearTimeout(hoverCloseTimer.current);
|
|
123
123
|
};
|
|
124
124
|
}, []);
|
|
125
125
|
var referenceListenerProps = _extends({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.cjs.development.js","sources":["../src/utils.ts","../src/Tooltip.tsx","../src/Popover.tsx","../src/index.tsx"],"sourcesContent":["import { Placement as FloatingUIPlacement } from '@floating-ui/react-dom';\n\nexport type Placement =\n | 'top'\n | 'top-left'\n | 'top-start'\n | 'top-right'\n | 'top-end'\n | 'left'\n | 'right'\n | 'bottom-left'\n | 'bottom-start'\n | 'bottom'\n | 'bottom-right'\n | 'bottom-end';\n\nexport function standardisePlacement(placement: string): FloatingUIPlacement {\n switch (placement) {\n case 'top-left':\n return 'top-start';\n case 'top-right':\n return 'top-end';\n case 'bottom-left':\n return 'bottom-start';\n case 'bottom-right':\n return 'bottom-end';\n default:\n return placement as FloatingUIPlacement;\n }\n}\n","import React, { cloneElement, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n arrow,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { useRandomId } from '@entur/utils';\nimport { CloseIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { space, borderRadiuses } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Tooltip.scss';\n\ntype Modifier = {\n name: string;\n enabled?: boolean;\n requires?: Array<string>;\n requiresIfExists?: Array<string>;\n options?: Record<string, unknown>;\n data?: Record<string, unknown>;\n [key: string]: any;\n};\n\ntype ChildEventListner = {\n 'aria-describedby'?: string;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: () => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n onKeyUp?: (e: React.KeyboardEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n};\n\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type TooltipProps = {\n /** Plassering av tooltip-en */\n placement: Placement;\n /** Innholdet i tooltip-boksen */\n content: React.ReactNode;\n /** Elementet som skal ha tooltip-funksjonalitet */\n children: React.ReactElement;\n /** Om tooltip-en skal vises */\n isOpen?: boolean;\n /** Ekstra klassenavn for tooltip */\n className?: string;\n /** Åpner ikke tooltip ved hover-events\n * @default false\n */\n disableHoverListener?: boolean;\n /** Åpner ikke tooltip ved focus-events\n * @default false\n */\n disableFocusListener?: boolean;\n disableKeyboardListener?: boolean;\n disableClickListner?: boolean;\n /** Viser en lukkeknapp om man kontrollerer åpningen av Tooltip vha `isOpen`\n * @default true\n */\n showCloseButton?: boolean;\n /** Valideringsvariant for Tooltip */\n variant?: 'negative' | typeof error;\n /** @deprecated Ikke lenger støttet. Meld fra på #talk-designsystem hvis du trenger støtte for\n * overskrivinger av plasseringen til Tooltip!\n */\n popperModifiers?: Modifier[];\n [key: string]: any;\n};\n\nexport const Tooltip: React.FC<TooltipProps> = ({\n placement,\n content,\n children,\n className,\n isOpen = false,\n disableHoverListener = false,\n disableFocusListener = false,\n disableKeyboardListener = true,\n disableClickListner = true,\n showCloseButton = true,\n variant,\n style,\n ...rest\n}) => {\n const [showTooltip, setShowTooltip] = useState(isOpen);\n const tooltipArrowRef = useRef(null);\n const tooltipId = useRandomId('eds-tooltip');\n let hoverOpenTimer: ReturnType<typeof setTimeout>;\n let hoverCloseTimer: ReturnType<typeof setTimeout>;\n\n // calculations for floating-UI tooltip position\n const {\n refs,\n floatingStyles,\n middlewareData,\n placement: actualPlacement,\n } = useFloating({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n arrow({\n element: tooltipArrowRef,\n padding: borderRadiuses.medium,\n }),\n ],\n });\n\n const onMouseEnter = () => {\n clearTimeout(hoverCloseTimer);\n hoverOpenTimer = setTimeout(() => {\n setShowTooltip(true);\n }, 150);\n };\n\n const onMouseLeave = () => {\n clearTimeout(hoverOpenTimer);\n hoverCloseTimer = setTimeout(() => {\n setShowTooltip(false);\n }, 300);\n };\n\n React.useEffect(() => {\n return () => {\n clearTimeout(hoverOpenTimer);\n clearTimeout(hoverCloseTimer);\n };\n }, []);\n\n const referenceListenerProps: ChildEventListner = {\n 'aria-describedby': showTooltip ? tooltipId : undefined,\n // focusListner\n ...(!disableFocusListener && { onFocus: () => setShowTooltip(true) }),\n ...(!disableFocusListener && { onBlur: () => setShowTooltip(false) }),\n // hoverListner\n ...(!disableHoverListener && { onMouseEnter }),\n ...(!disableHoverListener && { onMouseLeave }),\n // keyboardListner\n ...(!disableKeyboardListener && {\n onKeyDown: e => {\n if (e.key === 'Escape') setShowTooltip(false);\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n setShowTooltip(!showTooltip);\n }\n },\n }),\n // clickListner\n ...(!disableClickListner && {\n onClick: () => setShowTooltip(!showTooltip),\n }),\n };\n\n return (\n <>\n {cloneElement(children, {\n ref: refs.setReference,\n ...referenceListenerProps,\n })}\n <div\n className={classNames(className, 'eds-tooltip', {\n 'eds-tooltip--negative': variant === error || variant === 'negative',\n })}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n display: showTooltip && content ? undefined : 'none',\n ...style,\n }}\n role=\"tooltip\"\n id={tooltipId}\n onMouseEnter={!disableHoverListener ? onMouseEnter : undefined}\n onMouseLeave={!disableHoverListener ? onMouseLeave : undefined}\n {...rest}\n >\n {content}\n {isOpen && showCloseButton && (\n <IconButton\n className=\"eds-tooltip__close-button\"\n onClick={() => setShowTooltip(false)}\n type=\"button\"\n aria-label=\"Lukk tooltip\"\n >\n <CloseIcon aria-hidden=\"true\" />\n </IconButton>\n )}\n <div\n className={`eds-tooltip__arrow--${actualPlacement?.split('-')?.[0]}`}\n ref={tooltipArrowRef}\n style={{\n left: middlewareData.arrow?.x,\n top: middlewareData.arrow?.y,\n }}\n />\n </div>\n </>\n );\n};\n","import React, {\n cloneElement,\n createContext,\n MutableRefObject,\n useContext,\n} from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { Contrast } from '@entur/layout';\nimport { mergeRefs, useOnClickOutside } from '@entur/utils';\nimport { space } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Popover.scss';\n\nexport type PopoverProps = {\n /** Innholdet i Popover */\n children: React.ReactNode;\n /** Plasseringen av Popover\n * @default \"bottom-start\"\n */\n placement?: Placement;\n /** Hvis du ønsker å styre state selv kan du sende inn state her */\n showPopover?: boolean;\n /** Hvis du ønsker å styre state selv kan du sende inn setState her */\n setShowPopover?: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const Popover: React.FC<PopoverProps> = ({\n children,\n placement = 'bottom-start',\n showPopover: controlledState,\n setShowPopover: setControlledState,\n}) => {\n const [showPopover, setShowPopover, controlled] = useCustomState(\n controlledState,\n setControlledState,\n );\n\n // calculations for floating-UI popover position\n const { refs, floatingStyles } = useFloating<HTMLButtonElement>({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n ],\n });\n\n useOnClickOutside([refs.floating, refs.reference], () =>\n setShowPopover(false),\n );\n\n const popoverTriggerProps = {\n 'aria-haspopup': 'dialog',\n 'aria-expanded': showPopover,\n ref: refs.setReference,\n type: 'button',\n ...(!controlled && {\n onClick: () => setShowPopover(prev => !prev),\n }),\n };\n\n const popoverContentProps = {\n role: 'dialog',\n 'aria-modal': false,\n 'aria-hidden': !showPopover,\n ref: refs.setFloating,\n style: { ...(!showPopover && { display: 'none' }) },\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key === 'Escape') setShowPopover(false);\n },\n onBlur: (event: React.FocusEvent) => {\n const elementReceivingFocus = event.relatedTarget as HTMLElement;\n // The check for 'tabindex=-1' is a special case for focus handling in Docz\n if (\n !elementReceivingFocus ||\n elementReceivingFocus.getAttribute('tabindex') === '-1'\n )\n return;\n const focusedElementIsPopover = elementContainsElement(\n refs.floating.current,\n elementReceivingFocus,\n );\n const focusedElementIsTrigger = elementContainsElement(\n refs.reference.current,\n elementReceivingFocus,\n );\n const popoverShouldClose =\n !focusedElementIsPopover && !focusedElementIsTrigger;\n if (showPopover && popoverShouldClose) setShowPopover(false);\n },\n };\n\n const closeButtonProps = {\n onClick: () => setShowPopover(false),\n type: 'button',\n };\n\n const contextValue: PopoverContextProps = {\n showPopover,\n floatingStyles,\n popoverTriggerProps,\n popoverContentProps,\n closeButtonProps,\n };\n\n return (\n <PopoverContext.Provider value={contextValue}>\n {children}\n </PopoverContext.Provider>\n );\n};\n\nexport type PopoverTriggerProps = {\n /** Knapp som skal brukes for å åpne Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = ({ children }) => {\n const { popoverTriggerProps } = usePopoverContext();\n const child = React.Children.only(children) as React.ReactElement<any>;\n return cloneElement(child, popoverTriggerProps);\n};\n\nexport type PopoverCloseButtonProps = {\n /** En valgfri knapp som kan legges inn for å lukke Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverCloseButton: React.FC<PopoverCloseButtonProps> = ({\n children,\n ...rest\n}) => {\n const { closeButtonProps } = usePopoverContext();\n return cloneElement(children, { ...closeButtonProps, ...rest });\n};\n\nexport type PopoverContentProps = {\n /**Innholdet til Popover */\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n};\n\nexport const PopoverContent = React.forwardRef<\n HTMLDivElement,\n PopoverContentProps\n>(({ children, className, style }, ref: React.Ref<HTMLDivElement>) => {\n const { floatingStyles, popoverContentProps } = usePopoverContext();\n return (\n <Contrast\n className={classNames(className, 'eds-popover')}\n {...popoverContentProps}\n style={{ ...floatingStyles, ...popoverContentProps.style, ...style }}\n // @ts-expect-error correct type for floating cannot be set via useFloating\n ref={mergeRefs(popoverContentProps.ref, ref)}\n >\n {children}\n </Contrast>\n );\n});\n\ntype PopoverContextProps = {\n showPopover: boolean;\n floatingStyles: React.CSSProperties;\n closeButtonProps: Record<string, unknown>;\n popoverContentProps: {\n role: string;\n 'aria-modal': boolean;\n 'aria-hidden': boolean;\n ref: MutableRefObject<HTMLElement> | ((node: HTMLElement | null) => void);\n style: React.CSSProperties;\n onKeyDown: (event: React.KeyboardEvent) => void;\n onBlur: (event: React.FocusEvent) => void;\n };\n popoverTriggerProps: Record<string, unknown>;\n};\n\nconst PopoverContext = createContext<PopoverContextProps | undefined>(\n undefined,\n);\nconst usePopoverContext = () => {\n const context = useContext(PopoverContext);\n if (context == null) {\n throw Error('usePopoverContext must be used within <Popover/>');\n }\n return context;\n};\n\nconst useCustomState = (\n state?: boolean,\n setState?: React.Dispatch<React.SetStateAction<boolean>>,\n): [boolean, React.Dispatch<React.SetStateAction<boolean>>, boolean] => {\n const [internalState, setInternalState] = React.useState<boolean>(false);\n const controlled = state !== undefined && setState !== undefined;\n if (controlled) return [state, setState, controlled];\n return [internalState, setInternalState, controlled];\n};\n\nfunction elementContainsElement(\n parent: HTMLElement | null,\n child: HTMLElement,\n) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('tooltip');\n\nexport * from './Tooltip';\nexport * from './Popover';\nexport { Placement } from './utils';\n"],"names":["standardisePlacement","placement","error","Tooltip","content","children","className","isOpen","disableHoverListener","disableFocusListener","disableKeyboardListener","disableClickListner","showCloseButton","variant","style","rest","_excluded","useState","showTooltip","setShowTooltip","tooltipArrowRef","useRef","tooltipId","useRandomId","hoverOpenTimer","hoverCloseTimer","useFloating","whileElementsMounted","ref","float","update","autoUpdate","middleware","offset","space","extraSmall","flip","shift","padding","limiter","limitShift","arrow","element","borderRadiuses","medium","refs","floatingStyles","middlewareData","actualPlacement","onMouseEnter","clearTimeout","setTimeout","onMouseLeave","React","useEffect","referenceListenerProps","undefined","onFocus","onBlur","onKeyDown","e","key","preventDefault","onClick","createElement","Fragment","cloneElement","setReference","classNames","setFloating","display","role","id","IconButton","type","CloseIcon","split","left","x","top","y","Popover","controlledState","showPopover","setControlledState","setShowPopover","useCustomState","controlled","useOnClickOutside","floating","reference","popoverTriggerProps","prev","popoverContentProps","event","elementReceivingFocus","relatedTarget","getAttribute","focusedElementIsPopover","elementContainsElement","current","focusedElementIsTrigger","popoverShouldClose","closeButtonProps","contextValue","PopoverContext","Provider","value","PopoverTrigger","usePopoverContext","child","Children","only","PopoverCloseButton","PopoverContent","forwardRef","Contrast","mergeRefs","createContext","context","useContext","Error","state","setState","internalState","setInternalState","parent","contains","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBM,SAAUA,oBAAoB,CAACC,SAAiB,EAAA;AACpD,EAAA,QAAQA,SAAS;AACf,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,WAAW,CAAA;AACpB,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,SAAS,CAAA;AAClB,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,cAAc,CAAA;AACvB,IAAA,KAAK,cAAc;AACjB,MAAA,OAAO,YAAY,CAAA;AACrB,IAAA;AACE,MAAA,OAAOA,SAAgC,CAAA;AAAC,GAAA;AAE9C;;;ACcA;AACA,IAAMC,KAAK,GAAG,OAAO,CAAA;AAoCRC,IAAAA,OAAO,GAA2B,SAAlCA,OAAO,CAcf,IAAA,EAAA;AAAA,EAAA,IAAA,qBAAA,EAAA,qBAAA,EAAA,sBAAA,CAAA;EAAA,IAbHF,SAAS,QAATA,SAAS;AACTG,IAAAA,OAAO,QAAPA,OAAO;AACPC,IAAAA,QAAQ,QAARA,QAAQ;AACRC,IAAAA,SAAS,QAATA,SAAS;AAAA,IAAA,WAAA,GAAA,IAAA,CACTC,MAAM;AAANA,IAAAA,MAAM,4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
|
+
{"version":3,"file":"tooltip.cjs.development.js","sources":["../src/utils.ts","../src/Tooltip.tsx","../src/Popover.tsx","../src/index.tsx"],"sourcesContent":["import { Placement as FloatingUIPlacement } from '@floating-ui/react-dom';\n\nexport type Placement =\n | 'top'\n | 'top-left'\n | 'top-start'\n | 'top-right'\n | 'top-end'\n | 'left'\n | 'right'\n | 'bottom-left'\n | 'bottom-start'\n | 'bottom'\n | 'bottom-right'\n | 'bottom-end';\n\nexport function standardisePlacement(placement: string): FloatingUIPlacement {\n switch (placement) {\n case 'top-left':\n return 'top-start';\n case 'top-right':\n return 'top-end';\n case 'bottom-left':\n return 'bottom-start';\n case 'bottom-right':\n return 'bottom-end';\n default:\n return placement as FloatingUIPlacement;\n }\n}\n","import React, { cloneElement, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n arrow,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { useRandomId } from '@entur/utils';\nimport { CloseIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { space, borderRadiuses } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Tooltip.scss';\n\ntype Modifier = {\n name: string;\n enabled?: boolean;\n requires?: Array<string>;\n requiresIfExists?: Array<string>;\n options?: Record<string, unknown>;\n data?: Record<string, unknown>;\n [key: string]: any;\n};\n\ntype ChildEventListner = {\n 'aria-describedby'?: string;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: () => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n onKeyUp?: (e: React.KeyboardEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n};\n\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type TooltipProps = {\n /** Plassering av tooltip-en */\n placement: Placement;\n /** Innholdet i tooltip-boksen */\n content: React.ReactNode;\n /** Elementet som skal ha tooltip-funksjonalitet */\n children: React.ReactElement;\n /** Om tooltip-en skal vises */\n isOpen?: boolean;\n /** Ekstra klassenavn for tooltip */\n className?: string;\n /** Åpner ikke tooltip ved hover-events\n * @default false\n */\n disableHoverListener?: boolean;\n /** Åpner ikke tooltip ved focus-events\n * @default false\n */\n disableFocusListener?: boolean;\n disableKeyboardListener?: boolean;\n disableClickListner?: boolean;\n /** Viser en lukkeknapp om man kontrollerer åpningen av Tooltip vha `isOpen`\n * @default true\n */\n showCloseButton?: boolean;\n /** Valideringsvariant for Tooltip */\n variant?: 'negative' | typeof error;\n /** @deprecated Ikke lenger støttet. Meld fra på #talk-designsystem hvis du trenger støtte for\n * overskrivinger av plasseringen til Tooltip!\n */\n popperModifiers?: Modifier[];\n [key: string]: any;\n};\n\nexport const Tooltip: React.FC<TooltipProps> = ({\n placement,\n content,\n children,\n className,\n isOpen = false,\n disableHoverListener = false,\n disableFocusListener = false,\n disableKeyboardListener = true,\n disableClickListner = true,\n showCloseButton = true,\n variant,\n style,\n ...rest\n}) => {\n const [showTooltip, setShowTooltip] = useState(isOpen);\n const tooltipArrowRef = useRef(null);\n const tooltipId = useRandomId('eds-tooltip');\n const hoverOpenTimer = useRef<ReturnType<typeof setTimeout>>();\n const hoverCloseTimer = useRef<ReturnType<typeof setTimeout>>();\n\n // calculations for floating-UI tooltip position\n const {\n refs,\n floatingStyles,\n middlewareData,\n placement: actualPlacement,\n } = useFloating({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n arrow({\n element: tooltipArrowRef,\n padding: borderRadiuses.medium,\n }),\n ],\n });\n\n const onMouseEnter = () => {\n clearTimeout(hoverCloseTimer.current);\n hoverOpenTimer.current = setTimeout(() => {\n setShowTooltip(true);\n }, 150);\n };\n\n const onMouseLeave = () => {\n clearTimeout(hoverOpenTimer.current);\n hoverCloseTimer.current = setTimeout(() => {\n setShowTooltip(false);\n }, 300);\n };\n\n React.useEffect(() => {\n return () => {\n clearTimeout(hoverOpenTimer.current);\n clearTimeout(hoverCloseTimer.current);\n };\n }, []);\n\n const referenceListenerProps: ChildEventListner = {\n 'aria-describedby': showTooltip ? tooltipId : undefined,\n // focusListner\n ...(!disableFocusListener && { onFocus: () => setShowTooltip(true) }),\n ...(!disableFocusListener && { onBlur: () => setShowTooltip(false) }),\n // hoverListner\n ...(!disableHoverListener && { onMouseEnter }),\n ...(!disableHoverListener && { onMouseLeave }),\n // keyboardListner\n ...(!disableKeyboardListener && {\n onKeyDown: e => {\n if (e.key === 'Escape') setShowTooltip(false);\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n setShowTooltip(!showTooltip);\n }\n },\n }),\n // clickListner\n ...(!disableClickListner && {\n onClick: () => setShowTooltip(!showTooltip),\n }),\n };\n\n return (\n <>\n {cloneElement(children, {\n ref: refs.setReference,\n ...referenceListenerProps,\n })}\n <div\n className={classNames(className, 'eds-tooltip', {\n 'eds-tooltip--negative': variant === error || variant === 'negative',\n })}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n display: showTooltip && content ? undefined : 'none',\n ...style,\n }}\n role=\"tooltip\"\n id={tooltipId}\n onMouseEnter={!disableHoverListener ? onMouseEnter : undefined}\n onMouseLeave={!disableHoverListener ? onMouseLeave : undefined}\n {...rest}\n >\n {content}\n {isOpen && showCloseButton && (\n <IconButton\n className=\"eds-tooltip__close-button\"\n onClick={() => setShowTooltip(false)}\n type=\"button\"\n aria-label=\"Lukk tooltip\"\n >\n <CloseIcon aria-hidden=\"true\" />\n </IconButton>\n )}\n <div\n className={`eds-tooltip__arrow--${actualPlacement?.split('-')?.[0]}`}\n ref={tooltipArrowRef}\n style={{\n left: middlewareData.arrow?.x,\n top: middlewareData.arrow?.y,\n }}\n />\n </div>\n </>\n );\n};\n","import React, {\n cloneElement,\n createContext,\n MutableRefObject,\n useContext,\n} from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { Contrast } from '@entur/layout';\nimport { mergeRefs, useOnClickOutside } from '@entur/utils';\nimport { space } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Popover.scss';\n\nexport type PopoverProps = {\n /** Innholdet i Popover */\n children: React.ReactNode;\n /** Plasseringen av Popover\n * @default \"bottom-start\"\n */\n placement?: Placement;\n /** Hvis du ønsker å styre state selv kan du sende inn state her */\n showPopover?: boolean;\n /** Hvis du ønsker å styre state selv kan du sende inn setState her */\n setShowPopover?: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const Popover: React.FC<PopoverProps> = ({\n children,\n placement = 'bottom-start',\n showPopover: controlledState,\n setShowPopover: setControlledState,\n}) => {\n const [showPopover, setShowPopover, controlled] = useCustomState(\n controlledState,\n setControlledState,\n );\n\n // calculations for floating-UI popover position\n const { refs, floatingStyles } = useFloating<HTMLButtonElement>({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n ],\n });\n\n useOnClickOutside([refs.floating, refs.reference], () =>\n setShowPopover(false),\n );\n\n const popoverTriggerProps = {\n 'aria-haspopup': 'dialog',\n 'aria-expanded': showPopover,\n ref: refs.setReference,\n type: 'button',\n ...(!controlled && {\n onClick: () => setShowPopover(prev => !prev),\n }),\n };\n\n const popoverContentProps = {\n role: 'dialog',\n 'aria-modal': false,\n 'aria-hidden': !showPopover,\n ref: refs.setFloating,\n style: { ...(!showPopover && { display: 'none' }) },\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key === 'Escape') setShowPopover(false);\n },\n onBlur: (event: React.FocusEvent) => {\n const elementReceivingFocus = event.relatedTarget as HTMLElement;\n // The check for 'tabindex=-1' is a special case for focus handling in Docz\n if (\n !elementReceivingFocus ||\n elementReceivingFocus.getAttribute('tabindex') === '-1'\n )\n return;\n const focusedElementIsPopover = elementContainsElement(\n refs.floating.current,\n elementReceivingFocus,\n );\n const focusedElementIsTrigger = elementContainsElement(\n refs.reference.current,\n elementReceivingFocus,\n );\n const popoverShouldClose =\n !focusedElementIsPopover && !focusedElementIsTrigger;\n if (showPopover && popoverShouldClose) setShowPopover(false);\n },\n };\n\n const closeButtonProps = {\n onClick: () => setShowPopover(false),\n type: 'button',\n };\n\n const contextValue: PopoverContextProps = {\n showPopover,\n floatingStyles,\n popoverTriggerProps,\n popoverContentProps,\n closeButtonProps,\n };\n\n return (\n <PopoverContext.Provider value={contextValue}>\n {children}\n </PopoverContext.Provider>\n );\n};\n\nexport type PopoverTriggerProps = {\n /** Knapp som skal brukes for å åpne Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = ({ children }) => {\n const { popoverTriggerProps } = usePopoverContext();\n const child = React.Children.only(children) as React.ReactElement<any>;\n return cloneElement(child, popoverTriggerProps);\n};\n\nexport type PopoverCloseButtonProps = {\n /** En valgfri knapp som kan legges inn for å lukke Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverCloseButton: React.FC<PopoverCloseButtonProps> = ({\n children,\n ...rest\n}) => {\n const { closeButtonProps } = usePopoverContext();\n return cloneElement(children, { ...closeButtonProps, ...rest });\n};\n\nexport type PopoverContentProps = {\n /**Innholdet til Popover */\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n};\n\nexport const PopoverContent = React.forwardRef<\n HTMLDivElement,\n PopoverContentProps\n>(({ children, className, style }, ref: React.Ref<HTMLDivElement>) => {\n const { floatingStyles, popoverContentProps } = usePopoverContext();\n return (\n <Contrast\n className={classNames(className, 'eds-popover')}\n {...popoverContentProps}\n style={{ ...floatingStyles, ...popoverContentProps.style, ...style }}\n // @ts-expect-error correct type for floating cannot be set via useFloating\n ref={mergeRefs(popoverContentProps.ref, ref)}\n >\n {children}\n </Contrast>\n );\n});\n\ntype PopoverContextProps = {\n showPopover: boolean;\n floatingStyles: React.CSSProperties;\n closeButtonProps: Record<string, unknown>;\n popoverContentProps: {\n role: string;\n 'aria-modal': boolean;\n 'aria-hidden': boolean;\n ref: MutableRefObject<HTMLElement> | ((node: HTMLElement | null) => void);\n style: React.CSSProperties;\n onKeyDown: (event: React.KeyboardEvent) => void;\n onBlur: (event: React.FocusEvent) => void;\n };\n popoverTriggerProps: Record<string, unknown>;\n};\n\nconst PopoverContext = createContext<PopoverContextProps | undefined>(\n undefined,\n);\nconst usePopoverContext = () => {\n const context = useContext(PopoverContext);\n if (context == null) {\n throw Error('usePopoverContext must be used within <Popover/>');\n }\n return context;\n};\n\nconst useCustomState = (\n state?: boolean,\n setState?: React.Dispatch<React.SetStateAction<boolean>>,\n): [boolean, React.Dispatch<React.SetStateAction<boolean>>, boolean] => {\n const [internalState, setInternalState] = React.useState<boolean>(false);\n const controlled = state !== undefined && setState !== undefined;\n if (controlled) return [state, setState, controlled];\n return [internalState, setInternalState, controlled];\n};\n\nfunction elementContainsElement(\n parent: HTMLElement | null,\n child: HTMLElement,\n) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('tooltip');\n\nexport * from './Tooltip';\nexport * from './Popover';\nexport { Placement } from './utils';\n"],"names":["standardisePlacement","placement","error","Tooltip","content","children","className","isOpen","disableHoverListener","disableFocusListener","disableKeyboardListener","disableClickListner","showCloseButton","variant","style","rest","_excluded","useState","showTooltip","setShowTooltip","tooltipArrowRef","useRef","tooltipId","useRandomId","hoverOpenTimer","hoverCloseTimer","useFloating","whileElementsMounted","ref","float","update","autoUpdate","middleware","offset","space","extraSmall","flip","shift","padding","limiter","limitShift","arrow","element","borderRadiuses","medium","refs","floatingStyles","middlewareData","actualPlacement","onMouseEnter","clearTimeout","current","setTimeout","onMouseLeave","React","useEffect","referenceListenerProps","undefined","onFocus","onBlur","onKeyDown","e","key","preventDefault","onClick","createElement","Fragment","cloneElement","setReference","classNames","setFloating","display","role","id","IconButton","type","CloseIcon","split","left","x","top","y","Popover","controlledState","showPopover","setControlledState","setShowPopover","useCustomState","controlled","useOnClickOutside","floating","reference","popoverTriggerProps","prev","popoverContentProps","event","elementReceivingFocus","relatedTarget","getAttribute","focusedElementIsPopover","elementContainsElement","focusedElementIsTrigger","popoverShouldClose","closeButtonProps","contextValue","PopoverContext","Provider","value","PopoverTrigger","usePopoverContext","child","Children","only","PopoverCloseButton","PopoverContent","forwardRef","Contrast","mergeRefs","createContext","context","useContext","Error","state","setState","internalState","setInternalState","parent","contains","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBM,SAAUA,oBAAoB,CAACC,SAAiB,EAAA;AACpD,EAAA,QAAQA,SAAS;AACf,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,WAAW,CAAA;AACpB,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,SAAS,CAAA;AAClB,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,cAAc,CAAA;AACvB,IAAA,KAAK,cAAc;AACjB,MAAA,OAAO,YAAY,CAAA;AACrB,IAAA;AACE,MAAA,OAAOA,SAAgC,CAAA;AAAC,GAAA;AAE9C;;;ACcA;AACA,IAAMC,KAAK,GAAG,OAAO,CAAA;AAoCRC,IAAAA,OAAO,GAA2B,SAAlCA,OAAO,CAcf,IAAA,EAAA;AAAA,EAAA,IAAA,qBAAA,EAAA,qBAAA,EAAA,sBAAA,CAAA;EAAA,IAbHF,SAAS,QAATA,SAAS;AACTG,IAAAA,OAAO,QAAPA,OAAO;AACPC,IAAAA,QAAQ,QAARA,QAAQ;AACRC,IAAAA,SAAS,QAATA,SAAS;AAAA,IAAA,WAAA,GAAA,IAAA,CACTC,MAAM;AAANA,IAAAA,MAAM,4BAAG,KAAK,GAAA,WAAA;AAAA,IAAA,qBAA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AAIgB,MAAM,CAACC,QAAQ,CAACjB,KAAK,CAAC,CAAA;AACnD;;ACvNAkB,4BAAsB,CAAC,SAAS,CAAC;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),r=require("classnames"),n=require("@floating-ui/react-dom"),o=require("@entur/icons"),i=require("@entur/button"),a=require("@entur/tokens"),l=require("@entur/layout");function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s.apply(this,arguments)}function u(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}function c(e){switch(e){case"top-left":return"top-start";case"top-right":return"top-end";case"bottom-left":return"bottom-start";case"bottom-right":return"bottom-end";default:return e}}var d=["placement","content","children","className","isOpen","disableHoverListener","disableFocusListener","disableKeyboardListener","disableClickListner","showCloseButton","variant","style"],f=["children"],p=t.forwardRef((function(n,o){var i=n.children,a=n.className,u=n.style,c=m(),d=c.floatingStyles,f=c.popoverContentProps;return t.createElement(l.Contrast,s({className:r(a,"eds-popover")},f,{style:s({},d,f.style,u),ref:e.mergeRefs(f.ref,o)}),i)})),v=t.createContext(void 0),m=function(){var e=t.useContext(v);if(null==e)throw Error("usePopoverContext must be used within <Popover/>");return e};function g(e,t){return!!e&&(e===t||e.contains(t))}e.warnAboutMissingStyles("tooltip"),exports.Popover=function(r){var o=r.children,i=r.placement,l=void 0===i?"bottom-start":i,u=function(e,r){var n=t.useState(!1),o=void 0!==e&&void 0!==r;return o?[e,r,o]:[n[0],n[1],o]}(r.showPopover,r.setShowPopover),d=u[0],f=u[1],p=u[2],m=n.useFloating({whileElementsMounted:function(e,t,r){return n.autoUpdate(e,t,r)},placement:c(l),middleware:[n.offset(a.space.extraSmall),n.flip(),n.shift({padding:a.space.extraSmall,limiter:n.limitShift({offset:8})})]}),y=m.refs,b=m.floatingStyles;e.useOnClickOutside([y.floating,y.reference],(function(){return f(!1)}));var h=s({"aria-haspopup":"dialog","aria-expanded":d,ref:y.setReference,type:"button"},!p&&{onClick:function(){return f((function(e){return!e}))}}),w={role:"dialog","aria-modal":!1,"aria-hidden":!d,ref:y.setFloating,style:s({},!d&&{display:"none"}),onKeyDown:function(e){"Escape"===e.key&&f(!1)},onBlur:function(e){var t=e.relatedTarget;if(t&&"-1"!==t.getAttribute("tabindex")){var r=g(y.floating.current,t),n=g(y.reference.current,t);d&&!r&&!n&&f(!1)}}};return t.createElement(v.Provider,{value:{showPopover:d,floatingStyles:b,popoverTriggerProps:h,popoverContentProps:w,closeButtonProps:{onClick:function(){return f(!1)},type:"button"}}},o)},exports.PopoverCloseButton=function(e){var r=e.children,n=u(e,f),o=m();return t.cloneElement(r,s({},o.closeButtonProps,n))},exports.PopoverContent=p,exports.PopoverTrigger=function(e){var r=e.children,n=m().popoverTriggerProps,o=t.Children.only(r);return t.cloneElement(o,n)},exports.Tooltip=function(l){var f,p,v,m,g,y=l.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),r=require("classnames"),n=require("@floating-ui/react-dom"),o=require("@entur/icons"),i=require("@entur/button"),a=require("@entur/tokens"),l=require("@entur/layout");function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s.apply(this,arguments)}function u(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}function c(e){switch(e){case"top-left":return"top-start";case"top-right":return"top-end";case"bottom-left":return"bottom-start";case"bottom-right":return"bottom-end";default:return e}}var d=["placement","content","children","className","isOpen","disableHoverListener","disableFocusListener","disableKeyboardListener","disableClickListner","showCloseButton","variant","style"],f=["children"],p=t.forwardRef((function(n,o){var i=n.children,a=n.className,u=n.style,c=m(),d=c.floatingStyles,f=c.popoverContentProps;return t.createElement(l.Contrast,s({className:r(a,"eds-popover")},f,{style:s({},d,f.style,u),ref:e.mergeRefs(f.ref,o)}),i)})),v=t.createContext(void 0),m=function(){var e=t.useContext(v);if(null==e)throw Error("usePopoverContext must be used within <Popover/>");return e};function g(e,t){return!!e&&(e===t||e.contains(t))}e.warnAboutMissingStyles("tooltip"),exports.Popover=function(r){var o=r.children,i=r.placement,l=void 0===i?"bottom-start":i,u=function(e,r){var n=t.useState(!1),o=void 0!==e&&void 0!==r;return o?[e,r,o]:[n[0],n[1],o]}(r.showPopover,r.setShowPopover),d=u[0],f=u[1],p=u[2],m=n.useFloating({whileElementsMounted:function(e,t,r){return n.autoUpdate(e,t,r)},placement:c(l),middleware:[n.offset(a.space.extraSmall),n.flip(),n.shift({padding:a.space.extraSmall,limiter:n.limitShift({offset:8})})]}),y=m.refs,b=m.floatingStyles;e.useOnClickOutside([y.floating,y.reference],(function(){return f(!1)}));var h=s({"aria-haspopup":"dialog","aria-expanded":d,ref:y.setReference,type:"button"},!p&&{onClick:function(){return f((function(e){return!e}))}}),w={role:"dialog","aria-modal":!1,"aria-hidden":!d,ref:y.setFloating,style:s({},!d&&{display:"none"}),onKeyDown:function(e){"Escape"===e.key&&f(!1)},onBlur:function(e){var t=e.relatedTarget;if(t&&"-1"!==t.getAttribute("tabindex")){var r=g(y.floating.current,t),n=g(y.reference.current,t);d&&!r&&!n&&f(!1)}}};return t.createElement(v.Provider,{value:{showPopover:d,floatingStyles:b,popoverTriggerProps:h,popoverContentProps:w,closeButtonProps:{onClick:function(){return f(!1)},type:"button"}}},o)},exports.PopoverCloseButton=function(e){var r=e.children,n=u(e,f),o=m();return t.cloneElement(r,s({},o.closeButtonProps,n))},exports.PopoverContent=p,exports.PopoverTrigger=function(e){var r=e.children,n=m().popoverTriggerProps,o=t.Children.only(r);return t.cloneElement(o,n)},exports.Tooltip=function(l){var f,p,v,m=l.placement,g=l.content,y=l.children,b=l.className,h=l.isOpen,w=void 0!==h&&h,C=l.disableHoverListener,E=void 0!==C&&C,P=l.disableFocusListener,x=void 0!==P&&P,k=l.disableKeyboardListener,S=void 0===k||k,L=l.disableClickListner,O=void 0===L||L,T=l.showCloseButton,R=void 0===T||T,q=l.variant,B=l.style,F=u(l,d),M=t.useState(w),N=M[0],_=M[1],j=t.useRef(null),D=e.useRandomId("eds-tooltip"),K=t.useRef(),I=t.useRef(),A=n.useFloating({whileElementsMounted:function(e,t,r){return n.autoUpdate(e,t,r)},placement:c(m),middleware:[n.offset(a.space.extraSmall),n.flip(),n.shift({padding:a.space.extraSmall,limiter:n.limitShift({offset:8})}),n.arrow({element:j,padding:a.borderRadiuses.medium})]}),H=A.refs,U=A.floatingStyles,z=A.middlewareData,G=A.placement,J=function(){clearTimeout(I.current),K.current=setTimeout((function(){_(!0)}),150)},Q=function(){clearTimeout(K.current),I.current=setTimeout((function(){_(!1)}),300)};t.useEffect((function(){return function(){clearTimeout(K.current),clearTimeout(I.current)}}),[]);var V=s({"aria-describedby":N?D:void 0},!x&&{onFocus:function(){return _(!0)}},!x&&{onBlur:function(){return _(!1)}},!E&&{onMouseEnter:J},!E&&{onMouseLeave:Q},!S&&{onKeyDown:function(e){"Escape"===e.key&&_(!1)," "!==e.key&&"Enter"!==e.key||(e.preventDefault(),_(!N))}},!O&&{onClick:function(){return _(!N)}});return t.createElement(t.Fragment,null,t.cloneElement(y,s({ref:H.setReference},V)),t.createElement("div",s({className:r(b,"eds-tooltip",{"eds-tooltip--negative":"error"===q||"negative"===q}),ref:H.setFloating,style:s({},U,{display:N&&g?void 0:"none"},B),role:"tooltip",id:D,onMouseEnter:E?void 0:J,onMouseLeave:E?void 0:Q},F),g,w&&R&&t.createElement(i.IconButton,{className:"eds-tooltip__close-button",onClick:function(){return _(!1)},type:"button","aria-label":"Lukk tooltip"},t.createElement(o.CloseIcon,{"aria-hidden":"true"})),t.createElement("div",{className:"eds-tooltip__arrow--"+(null==G||null==(f=G.split("-"))?void 0:f[0]),ref:j,style:{left:null==(p=z.arrow)?void 0:p.x,top:null==(v=z.arrow)?void 0:v.y}})))};
|
|
2
2
|
//# sourceMappingURL=tooltip.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.cjs.production.min.js","sources":["../src/utils.ts","../src/Popover.tsx","../src/index.tsx","../src/Tooltip.tsx"],"sourcesContent":["import { Placement as FloatingUIPlacement } from '@floating-ui/react-dom';\n\nexport type Placement =\n | 'top'\n | 'top-left'\n | 'top-start'\n | 'top-right'\n | 'top-end'\n | 'left'\n | 'right'\n | 'bottom-left'\n | 'bottom-start'\n | 'bottom'\n | 'bottom-right'\n | 'bottom-end';\n\nexport function standardisePlacement(placement: string): FloatingUIPlacement {\n switch (placement) {\n case 'top-left':\n return 'top-start';\n case 'top-right':\n return 'top-end';\n case 'bottom-left':\n return 'bottom-start';\n case 'bottom-right':\n return 'bottom-end';\n default:\n return placement as FloatingUIPlacement;\n }\n}\n","import React, {\n cloneElement,\n createContext,\n MutableRefObject,\n useContext,\n} from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { Contrast } from '@entur/layout';\nimport { mergeRefs, useOnClickOutside } from '@entur/utils';\nimport { space } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Popover.scss';\n\nexport type PopoverProps = {\n /** Innholdet i Popover */\n children: React.ReactNode;\n /** Plasseringen av Popover\n * @default \"bottom-start\"\n */\n placement?: Placement;\n /** Hvis du ønsker å styre state selv kan du sende inn state her */\n showPopover?: boolean;\n /** Hvis du ønsker å styre state selv kan du sende inn setState her */\n setShowPopover?: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const Popover: React.FC<PopoverProps> = ({\n children,\n placement = 'bottom-start',\n showPopover: controlledState,\n setShowPopover: setControlledState,\n}) => {\n const [showPopover, setShowPopover, controlled] = useCustomState(\n controlledState,\n setControlledState,\n );\n\n // calculations for floating-UI popover position\n const { refs, floatingStyles } = useFloating<HTMLButtonElement>({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n ],\n });\n\n useOnClickOutside([refs.floating, refs.reference], () =>\n setShowPopover(false),\n );\n\n const popoverTriggerProps = {\n 'aria-haspopup': 'dialog',\n 'aria-expanded': showPopover,\n ref: refs.setReference,\n type: 'button',\n ...(!controlled && {\n onClick: () => setShowPopover(prev => !prev),\n }),\n };\n\n const popoverContentProps = {\n role: 'dialog',\n 'aria-modal': false,\n 'aria-hidden': !showPopover,\n ref: refs.setFloating,\n style: { ...(!showPopover && { display: 'none' }) },\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key === 'Escape') setShowPopover(false);\n },\n onBlur: (event: React.FocusEvent) => {\n const elementReceivingFocus = event.relatedTarget as HTMLElement;\n // The check for 'tabindex=-1' is a special case for focus handling in Docz\n if (\n !elementReceivingFocus ||\n elementReceivingFocus.getAttribute('tabindex') === '-1'\n )\n return;\n const focusedElementIsPopover = elementContainsElement(\n refs.floating.current,\n elementReceivingFocus,\n );\n const focusedElementIsTrigger = elementContainsElement(\n refs.reference.current,\n elementReceivingFocus,\n );\n const popoverShouldClose =\n !focusedElementIsPopover && !focusedElementIsTrigger;\n if (showPopover && popoverShouldClose) setShowPopover(false);\n },\n };\n\n const closeButtonProps = {\n onClick: () => setShowPopover(false),\n type: 'button',\n };\n\n const contextValue: PopoverContextProps = {\n showPopover,\n floatingStyles,\n popoverTriggerProps,\n popoverContentProps,\n closeButtonProps,\n };\n\n return (\n <PopoverContext.Provider value={contextValue}>\n {children}\n </PopoverContext.Provider>\n );\n};\n\nexport type PopoverTriggerProps = {\n /** Knapp som skal brukes for å åpne Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = ({ children }) => {\n const { popoverTriggerProps } = usePopoverContext();\n const child = React.Children.only(children) as React.ReactElement<any>;\n return cloneElement(child, popoverTriggerProps);\n};\n\nexport type PopoverCloseButtonProps = {\n /** En valgfri knapp som kan legges inn for å lukke Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverCloseButton: React.FC<PopoverCloseButtonProps> = ({\n children,\n ...rest\n}) => {\n const { closeButtonProps } = usePopoverContext();\n return cloneElement(children, { ...closeButtonProps, ...rest });\n};\n\nexport type PopoverContentProps = {\n /**Innholdet til Popover */\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n};\n\nexport const PopoverContent = React.forwardRef<\n HTMLDivElement,\n PopoverContentProps\n>(({ children, className, style }, ref: React.Ref<HTMLDivElement>) => {\n const { floatingStyles, popoverContentProps } = usePopoverContext();\n return (\n <Contrast\n className={classNames(className, 'eds-popover')}\n {...popoverContentProps}\n style={{ ...floatingStyles, ...popoverContentProps.style, ...style }}\n // @ts-expect-error correct type for floating cannot be set via useFloating\n ref={mergeRefs(popoverContentProps.ref, ref)}\n >\n {children}\n </Contrast>\n );\n});\n\ntype PopoverContextProps = {\n showPopover: boolean;\n floatingStyles: React.CSSProperties;\n closeButtonProps: Record<string, unknown>;\n popoverContentProps: {\n role: string;\n 'aria-modal': boolean;\n 'aria-hidden': boolean;\n ref: MutableRefObject<HTMLElement> | ((node: HTMLElement | null) => void);\n style: React.CSSProperties;\n onKeyDown: (event: React.KeyboardEvent) => void;\n onBlur: (event: React.FocusEvent) => void;\n };\n popoverTriggerProps: Record<string, unknown>;\n};\n\nconst PopoverContext = createContext<PopoverContextProps | undefined>(\n undefined,\n);\nconst usePopoverContext = () => {\n const context = useContext(PopoverContext);\n if (context == null) {\n throw Error('usePopoverContext must be used within <Popover/>');\n }\n return context;\n};\n\nconst useCustomState = (\n state?: boolean,\n setState?: React.Dispatch<React.SetStateAction<boolean>>,\n): [boolean, React.Dispatch<React.SetStateAction<boolean>>, boolean] => {\n const [internalState, setInternalState] = React.useState<boolean>(false);\n const controlled = state !== undefined && setState !== undefined;\n if (controlled) return [state, setState, controlled];\n return [internalState, setInternalState, controlled];\n};\n\nfunction elementContainsElement(\n parent: HTMLElement | null,\n child: HTMLElement,\n) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('tooltip');\n\nexport * from './Tooltip';\nexport * from './Popover';\nexport { Placement } from './utils';\n","import React, { cloneElement, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n arrow,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { useRandomId } from '@entur/utils';\nimport { CloseIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { space, borderRadiuses } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Tooltip.scss';\n\ntype Modifier = {\n name: string;\n enabled?: boolean;\n requires?: Array<string>;\n requiresIfExists?: Array<string>;\n options?: Record<string, unknown>;\n data?: Record<string, unknown>;\n [key: string]: any;\n};\n\ntype ChildEventListner = {\n 'aria-describedby'?: string;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: () => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n onKeyUp?: (e: React.KeyboardEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n};\n\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type TooltipProps = {\n /** Plassering av tooltip-en */\n placement: Placement;\n /** Innholdet i tooltip-boksen */\n content: React.ReactNode;\n /** Elementet som skal ha tooltip-funksjonalitet */\n children: React.ReactElement;\n /** Om tooltip-en skal vises */\n isOpen?: boolean;\n /** Ekstra klassenavn for tooltip */\n className?: string;\n /** Åpner ikke tooltip ved hover-events\n * @default false\n */\n disableHoverListener?: boolean;\n /** Åpner ikke tooltip ved focus-events\n * @default false\n */\n disableFocusListener?: boolean;\n disableKeyboardListener?: boolean;\n disableClickListner?: boolean;\n /** Viser en lukkeknapp om man kontrollerer åpningen av Tooltip vha `isOpen`\n * @default true\n */\n showCloseButton?: boolean;\n /** Valideringsvariant for Tooltip */\n variant?: 'negative' | typeof error;\n /** @deprecated Ikke lenger støttet. Meld fra på #talk-designsystem hvis du trenger støtte for\n * overskrivinger av plasseringen til Tooltip!\n */\n popperModifiers?: Modifier[];\n [key: string]: any;\n};\n\nexport const Tooltip: React.FC<TooltipProps> = ({\n placement,\n content,\n children,\n className,\n isOpen = false,\n disableHoverListener = false,\n disableFocusListener = false,\n disableKeyboardListener = true,\n disableClickListner = true,\n showCloseButton = true,\n variant,\n style,\n ...rest\n}) => {\n const [showTooltip, setShowTooltip] = useState(isOpen);\n const tooltipArrowRef = useRef(null);\n const tooltipId = useRandomId('eds-tooltip');\n let hoverOpenTimer: ReturnType<typeof setTimeout>;\n let hoverCloseTimer: ReturnType<typeof setTimeout>;\n\n // calculations for floating-UI tooltip position\n const {\n refs,\n floatingStyles,\n middlewareData,\n placement: actualPlacement,\n } = useFloating({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n arrow({\n element: tooltipArrowRef,\n padding: borderRadiuses.medium,\n }),\n ],\n });\n\n const onMouseEnter = () => {\n clearTimeout(hoverCloseTimer);\n hoverOpenTimer = setTimeout(() => {\n setShowTooltip(true);\n }, 150);\n };\n\n const onMouseLeave = () => {\n clearTimeout(hoverOpenTimer);\n hoverCloseTimer = setTimeout(() => {\n setShowTooltip(false);\n }, 300);\n };\n\n React.useEffect(() => {\n return () => {\n clearTimeout(hoverOpenTimer);\n clearTimeout(hoverCloseTimer);\n };\n }, []);\n\n const referenceListenerProps: ChildEventListner = {\n 'aria-describedby': showTooltip ? tooltipId : undefined,\n // focusListner\n ...(!disableFocusListener && { onFocus: () => setShowTooltip(true) }),\n ...(!disableFocusListener && { onBlur: () => setShowTooltip(false) }),\n // hoverListner\n ...(!disableHoverListener && { onMouseEnter }),\n ...(!disableHoverListener && { onMouseLeave }),\n // keyboardListner\n ...(!disableKeyboardListener && {\n onKeyDown: e => {\n if (e.key === 'Escape') setShowTooltip(false);\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n setShowTooltip(!showTooltip);\n }\n },\n }),\n // clickListner\n ...(!disableClickListner && {\n onClick: () => setShowTooltip(!showTooltip),\n }),\n };\n\n return (\n <>\n {cloneElement(children, {\n ref: refs.setReference,\n ...referenceListenerProps,\n })}\n <div\n className={classNames(className, 'eds-tooltip', {\n 'eds-tooltip--negative': variant === error || variant === 'negative',\n })}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n display: showTooltip && content ? undefined : 'none',\n ...style,\n }}\n role=\"tooltip\"\n id={tooltipId}\n onMouseEnter={!disableHoverListener ? onMouseEnter : undefined}\n onMouseLeave={!disableHoverListener ? onMouseLeave : undefined}\n {...rest}\n >\n {content}\n {isOpen && showCloseButton && (\n <IconButton\n className=\"eds-tooltip__close-button\"\n onClick={() => setShowTooltip(false)}\n type=\"button\"\n aria-label=\"Lukk tooltip\"\n >\n <CloseIcon aria-hidden=\"true\" />\n </IconButton>\n )}\n <div\n className={`eds-tooltip__arrow--${actualPlacement?.split('-')?.[0]}`}\n ref={tooltipArrowRef}\n style={{\n left: middlewareData.arrow?.x,\n top: middlewareData.arrow?.y,\n }}\n />\n </div>\n </>\n );\n};\n"],"names":["standardisePlacement","placement","PopoverContent","React","forwardRef","ref","children","className","style","_usePopoverContext3","usePopoverContext","floatingStyles","popoverContentProps","createElement","Contrast","_extends","classNames","mergeRefs","PopoverContext","createContext","undefined","context","useContext","Error","elementContainsElement","parent","child","contains","warnAboutMissingStyles","_ref","_ref$placement","_useCustomState","state","setState","_React$useState","useState","controlled","useCustomState","showPopover","setShowPopover","_useFloating","useFloating","whileElementsMounted","float","update","autoUpdate","middleware","offset","space","extraSmall","flip","shift","padding","limiter","limitShift","refs","useOnClickOutside","floating","reference","popoverTriggerProps","setReference","type","onClick","prev","role","setFloating","display","onKeyDown","event","key","onBlur","elementReceivingFocus","relatedTarget","getAttribute","focusedElementIsPopover","current","focusedElementIsTrigger","Provider","value","closeButtonProps","_ref3","rest","_objectWithoutPropertiesLoose","_excluded","_usePopoverContext2","cloneElement","_ref2","Children","only","_actualPlacement$spli","_middlewareData$arrow","_middlewareData$arrow2","hoverOpenTimer","hoverCloseTimer","content","_ref$isOpen","isOpen","_ref$disableHoverList","disableHoverListener","_ref$disableFocusList","disableFocusListener","_ref$disableKeyboardL","disableKeyboardListener","_ref$disableClickList","disableClickListner","_ref$showCloseButton","showCloseButton","variant","showTooltip","_useState","setShowTooltip","tooltipArrowRef","useRef","tooltipId","useRandomId","arrow","element","borderRadiuses","medium","middlewareData","actualPlacement","onMouseEnter","clearTimeout","setTimeout","onMouseLeave","useEffect","referenceListenerProps","onFocus","e","preventDefault","Fragment","id","IconButton","CloseIcon","split","left","x","top","y"],"mappings":"ooBAgBM,SAAUA,EAAqBC,GACnC,OAAQA,GACN,IAAK,WACH,MAAO,YACT,IAAK,YACH,MAAO,UACT,IAAK,cACH,MAAO,eACT,IAAK,eACH,MAAO,aACT,QACE,OAAOA,EAEb,gNCgIaC,EAAiBC,EAAMC,YAGlC,SAAiCC,EAAAA,GAAkC,IAAhEC,IAAAA,SAAUC,IAAAA,UAAWC,IAAAA,MACxBC,EAAgDC,IAAxCC,IAAAA,eAAgBC,IAAAA,oBACxB,OACET,EAAAU,cAACC,EAAQA,SAAAC,EAAA,CACPR,UAAWS,EAAWT,EAAW,gBAC7BK,EAAmB,CACvBJ,MAAKO,EAAA,CAAA,EAAOJ,EAAmBC,EAAoBJ,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AAyB,UAAV2D,EAAE3D,MACrB2D,EAAEC,iBACFnB,GAAgBF,GAEpB,IAGGJ,GAAuB,CAC1B1C,QAAS,WAAA,OAAMgD,GAAgBF,EAAY,IAI/C,OACEzG,EAAAU,cAAAV,EAAA+H,SAAA,KACG7C,EAAYA,aAAC/E,EAAQS,EAAA,CACpBV,IAAKkD,EAAKK,cACPkE,IAEL3H,EAAAU,cAAA,MAAAE,EAAA,CACER,UAAWS,EAAWT,EAAW,cAAe,CAC9C,wBAnII,UAmIqBoG,GAAiC,aAAZA,IAEhDtG,IAAKkD,EAAKU,YACVzD,WACKG,EAAc,CACjBuD,QAAS0C,GAAed,OAAU1E,EAAY,QAC3CZ,GAELwD,KAAK,UACLmE,GAAIlB,EACJQ,aAAevB,OAAsC9E,EAAfqG,EACtCG,aAAe1B,OAAsC9E,EAAfwG,GAClC3C,GAEHa,EACAE,GAAUU,GACTvG,EAAAU,cAACuH,aACC,CAAA7H,UAAU,4BACVuD,QAAS,WAAA,OAAMgD,GAAe,EAAM,EACpCjD,KAAK,SAAQ,aACF,gBAEX1D,EAAAU,cAACwH,YAAS,CAAA,cAAa,UAG3BlI,EACEU,cAAA,MAAA,CAAAN,UAAkCiH,wBAAAA,MAAAA,GAA2B,OAA3BA,EAAAA,EAAiBc,MAAM,WAAvBd,EAAA/B,EAA8B,IAChEpF,IAAK0G,EACLvG,MAAO,CACL+H,KAA0B,SAApBhB,EAAeJ,YAAK,EAApBzB,EAAsB8C,EAC5BC,WAAKlB,EAAAA,EAAeJ,cAAfxB,EAAsB+C,MAMvC"}
|
|
1
|
+
{"version":3,"file":"tooltip.cjs.production.min.js","sources":["../src/utils.ts","../src/Popover.tsx","../src/index.tsx","../src/Tooltip.tsx"],"sourcesContent":["import { Placement as FloatingUIPlacement } from '@floating-ui/react-dom';\n\nexport type Placement =\n | 'top'\n | 'top-left'\n | 'top-start'\n | 'top-right'\n | 'top-end'\n | 'left'\n | 'right'\n | 'bottom-left'\n | 'bottom-start'\n | 'bottom'\n | 'bottom-right'\n | 'bottom-end';\n\nexport function standardisePlacement(placement: string): FloatingUIPlacement {\n switch (placement) {\n case 'top-left':\n return 'top-start';\n case 'top-right':\n return 'top-end';\n case 'bottom-left':\n return 'bottom-start';\n case 'bottom-right':\n return 'bottom-end';\n default:\n return placement as FloatingUIPlacement;\n }\n}\n","import React, {\n cloneElement,\n createContext,\n MutableRefObject,\n useContext,\n} from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { Contrast } from '@entur/layout';\nimport { mergeRefs, useOnClickOutside } from '@entur/utils';\nimport { space } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Popover.scss';\n\nexport type PopoverProps = {\n /** Innholdet i Popover */\n children: React.ReactNode;\n /** Plasseringen av Popover\n * @default \"bottom-start\"\n */\n placement?: Placement;\n /** Hvis du ønsker å styre state selv kan du sende inn state her */\n showPopover?: boolean;\n /** Hvis du ønsker å styre state selv kan du sende inn setState her */\n setShowPopover?: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const Popover: React.FC<PopoverProps> = ({\n children,\n placement = 'bottom-start',\n showPopover: controlledState,\n setShowPopover: setControlledState,\n}) => {\n const [showPopover, setShowPopover, controlled] = useCustomState(\n controlledState,\n setControlledState,\n );\n\n // calculations for floating-UI popover position\n const { refs, floatingStyles } = useFloating<HTMLButtonElement>({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n ],\n });\n\n useOnClickOutside([refs.floating, refs.reference], () =>\n setShowPopover(false),\n );\n\n const popoverTriggerProps = {\n 'aria-haspopup': 'dialog',\n 'aria-expanded': showPopover,\n ref: refs.setReference,\n type: 'button',\n ...(!controlled && {\n onClick: () => setShowPopover(prev => !prev),\n }),\n };\n\n const popoverContentProps = {\n role: 'dialog',\n 'aria-modal': false,\n 'aria-hidden': !showPopover,\n ref: refs.setFloating,\n style: { ...(!showPopover && { display: 'none' }) },\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key === 'Escape') setShowPopover(false);\n },\n onBlur: (event: React.FocusEvent) => {\n const elementReceivingFocus = event.relatedTarget as HTMLElement;\n // The check for 'tabindex=-1' is a special case for focus handling in Docz\n if (\n !elementReceivingFocus ||\n elementReceivingFocus.getAttribute('tabindex') === '-1'\n )\n return;\n const focusedElementIsPopover = elementContainsElement(\n refs.floating.current,\n elementReceivingFocus,\n );\n const focusedElementIsTrigger = elementContainsElement(\n refs.reference.current,\n elementReceivingFocus,\n );\n const popoverShouldClose =\n !focusedElementIsPopover && !focusedElementIsTrigger;\n if (showPopover && popoverShouldClose) setShowPopover(false);\n },\n };\n\n const closeButtonProps = {\n onClick: () => setShowPopover(false),\n type: 'button',\n };\n\n const contextValue: PopoverContextProps = {\n showPopover,\n floatingStyles,\n popoverTriggerProps,\n popoverContentProps,\n closeButtonProps,\n };\n\n return (\n <PopoverContext.Provider value={contextValue}>\n {children}\n </PopoverContext.Provider>\n );\n};\n\nexport type PopoverTriggerProps = {\n /** Knapp som skal brukes for å åpne Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = ({ children }) => {\n const { popoverTriggerProps } = usePopoverContext();\n const child = React.Children.only(children) as React.ReactElement<any>;\n return cloneElement(child, popoverTriggerProps);\n};\n\nexport type PopoverCloseButtonProps = {\n /** En valgfri knapp som kan legges inn for å lukke Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverCloseButton: React.FC<PopoverCloseButtonProps> = ({\n children,\n ...rest\n}) => {\n const { closeButtonProps } = usePopoverContext();\n return cloneElement(children, { ...closeButtonProps, ...rest });\n};\n\nexport type PopoverContentProps = {\n /**Innholdet til Popover */\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n};\n\nexport const PopoverContent = React.forwardRef<\n HTMLDivElement,\n PopoverContentProps\n>(({ children, className, style }, ref: React.Ref<HTMLDivElement>) => {\n const { floatingStyles, popoverContentProps } = usePopoverContext();\n return (\n <Contrast\n className={classNames(className, 'eds-popover')}\n {...popoverContentProps}\n style={{ ...floatingStyles, ...popoverContentProps.style, ...style }}\n // @ts-expect-error correct type for floating cannot be set via useFloating\n ref={mergeRefs(popoverContentProps.ref, ref)}\n >\n {children}\n </Contrast>\n );\n});\n\ntype PopoverContextProps = {\n showPopover: boolean;\n floatingStyles: React.CSSProperties;\n closeButtonProps: Record<string, unknown>;\n popoverContentProps: {\n role: string;\n 'aria-modal': boolean;\n 'aria-hidden': boolean;\n ref: MutableRefObject<HTMLElement> | ((node: HTMLElement | null) => void);\n style: React.CSSProperties;\n onKeyDown: (event: React.KeyboardEvent) => void;\n onBlur: (event: React.FocusEvent) => void;\n };\n popoverTriggerProps: Record<string, unknown>;\n};\n\nconst PopoverContext = createContext<PopoverContextProps | undefined>(\n undefined,\n);\nconst usePopoverContext = () => {\n const context = useContext(PopoverContext);\n if (context == null) {\n throw Error('usePopoverContext must be used within <Popover/>');\n }\n return context;\n};\n\nconst useCustomState = (\n state?: boolean,\n setState?: React.Dispatch<React.SetStateAction<boolean>>,\n): [boolean, React.Dispatch<React.SetStateAction<boolean>>, boolean] => {\n const [internalState, setInternalState] = React.useState<boolean>(false);\n const controlled = state !== undefined && setState !== undefined;\n if (controlled) return [state, setState, controlled];\n return [internalState, setInternalState, controlled];\n};\n\nfunction elementContainsElement(\n parent: HTMLElement | null,\n child: HTMLElement,\n) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('tooltip');\n\nexport * from './Tooltip';\nexport * from './Popover';\nexport { Placement } from './utils';\n","import React, { cloneElement, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n arrow,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { useRandomId } from '@entur/utils';\nimport { CloseIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { space, borderRadiuses } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Tooltip.scss';\n\ntype Modifier = {\n name: string;\n enabled?: boolean;\n requires?: Array<string>;\n requiresIfExists?: Array<string>;\n options?: Record<string, unknown>;\n data?: Record<string, unknown>;\n [key: string]: any;\n};\n\ntype ChildEventListner = {\n 'aria-describedby'?: string;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: () => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n onKeyUp?: (e: React.KeyboardEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n};\n\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type TooltipProps = {\n /** Plassering av tooltip-en */\n placement: Placement;\n /** Innholdet i tooltip-boksen */\n content: React.ReactNode;\n /** Elementet som skal ha tooltip-funksjonalitet */\n children: React.ReactElement;\n /** Om tooltip-en skal vises */\n isOpen?: boolean;\n /** Ekstra klassenavn for tooltip */\n className?: string;\n /** Åpner ikke tooltip ved hover-events\n * @default false\n */\n disableHoverListener?: boolean;\n /** Åpner ikke tooltip ved focus-events\n * @default false\n */\n disableFocusListener?: boolean;\n disableKeyboardListener?: boolean;\n disableClickListner?: boolean;\n /** Viser en lukkeknapp om man kontrollerer åpningen av Tooltip vha `isOpen`\n * @default true\n */\n showCloseButton?: boolean;\n /** Valideringsvariant for Tooltip */\n variant?: 'negative' | typeof error;\n /** @deprecated Ikke lenger støttet. Meld fra på #talk-designsystem hvis du trenger støtte for\n * overskrivinger av plasseringen til Tooltip!\n */\n popperModifiers?: Modifier[];\n [key: string]: any;\n};\n\nexport const Tooltip: React.FC<TooltipProps> = ({\n placement,\n content,\n children,\n className,\n isOpen = false,\n disableHoverListener = false,\n disableFocusListener = false,\n disableKeyboardListener = true,\n disableClickListner = true,\n showCloseButton = true,\n variant,\n style,\n ...rest\n}) => {\n const [showTooltip, setShowTooltip] = useState(isOpen);\n const tooltipArrowRef = useRef(null);\n const tooltipId = useRandomId('eds-tooltip');\n const hoverOpenTimer = useRef<ReturnType<typeof setTimeout>>();\n const hoverCloseTimer = useRef<ReturnType<typeof setTimeout>>();\n\n // calculations for floating-UI tooltip position\n const {\n refs,\n floatingStyles,\n middlewareData,\n placement: actualPlacement,\n } = useFloating({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n arrow({\n element: tooltipArrowRef,\n padding: borderRadiuses.medium,\n }),\n ],\n });\n\n const onMouseEnter = () => {\n clearTimeout(hoverCloseTimer.current);\n hoverOpenTimer.current = setTimeout(() => {\n setShowTooltip(true);\n }, 150);\n };\n\n const onMouseLeave = () => {\n clearTimeout(hoverOpenTimer.current);\n hoverCloseTimer.current = setTimeout(() => {\n setShowTooltip(false);\n }, 300);\n };\n\n React.useEffect(() => {\n return () => {\n clearTimeout(hoverOpenTimer.current);\n clearTimeout(hoverCloseTimer.current);\n };\n }, []);\n\n const referenceListenerProps: ChildEventListner = {\n 'aria-describedby': showTooltip ? tooltipId : undefined,\n // focusListner\n ...(!disableFocusListener && { onFocus: () => setShowTooltip(true) }),\n ...(!disableFocusListener && { onBlur: () => setShowTooltip(false) }),\n // hoverListner\n ...(!disableHoverListener && { onMouseEnter }),\n ...(!disableHoverListener && { onMouseLeave }),\n // keyboardListner\n ...(!disableKeyboardListener && {\n onKeyDown: e => {\n if (e.key === 'Escape') setShowTooltip(false);\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n setShowTooltip(!showTooltip);\n }\n },\n }),\n // clickListner\n ...(!disableClickListner && {\n onClick: () => setShowTooltip(!showTooltip),\n }),\n };\n\n return (\n <>\n {cloneElement(children, {\n ref: refs.setReference,\n ...referenceListenerProps,\n })}\n <div\n className={classNames(className, 'eds-tooltip', {\n 'eds-tooltip--negative': variant === error || variant === 'negative',\n })}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n display: showTooltip && content ? undefined : 'none',\n ...style,\n }}\n role=\"tooltip\"\n id={tooltipId}\n onMouseEnter={!disableHoverListener ? onMouseEnter : undefined}\n onMouseLeave={!disableHoverListener ? onMouseLeave : undefined}\n {...rest}\n >\n {content}\n {isOpen && showCloseButton && (\n <IconButton\n className=\"eds-tooltip__close-button\"\n onClick={() => setShowTooltip(false)}\n type=\"button\"\n aria-label=\"Lukk tooltip\"\n >\n <CloseIcon aria-hidden=\"true\" />\n </IconButton>\n )}\n <div\n className={`eds-tooltip__arrow--${actualPlacement?.split('-')?.[0]}`}\n ref={tooltipArrowRef}\n style={{\n left: middlewareData.arrow?.x,\n top: middlewareData.arrow?.y,\n }}\n />\n </div>\n </>\n );\n};\n"],"names":["standardisePlacement","placement","PopoverContent","React","forwardRef","ref","children","className","style","_usePopoverContext3","usePopoverContext","floatingStyles","popoverContentProps","createElement","Contrast","_extends","classNames","mergeRefs","PopoverContext","createContext","undefined","context","useContext","Error","elementContainsElement","parent","child","contains","warnAboutMissingStyles","_ref","_ref$placement","_useCustomState","state","setState","_React$useState","useState","controlled","useCustomState","showPopover","setShowPopover","_useFloating","useFloating","whileElementsMounted","float","update","autoUpdate","middleware","offset","space","extraSmall","flip","shift","padding","limiter","limitShift","refs","useOnClickOutside","floating","reference","popoverTriggerProps","setReference","type","onClick","prev","role","setFloating","display","onKeyDown","event","key","onBlur","elementReceivingFocus","relatedTarget","getAttribute","focusedElementIsPopover","current","focusedElementIsTrigger","Provider","value","closeButtonProps","_ref3","rest","_objectWithoutPropertiesLoose","_excluded","_usePopoverContext2","cloneElement","_ref2","Children","only","_actualPlacement$spli","_middlewareData$arrow","_middlewareData$arrow2","content","_ref$isOpen","isOpen","_ref$disableHoverList","disableHoverListener","_ref$disableFocusList","disableFocusListener","_ref$disableKeyboardL","disableKeyboardListener","_ref$disableClickList","disableClickListner","_ref$showCloseButton","showCloseButton","variant","showTooltip","_useState","setShowTooltip","tooltipArrowRef","useRef","tooltipId","useRandomId","hoverOpenTimer","hoverCloseTimer","arrow","element","borderRadiuses","medium","middlewareData","actualPlacement","onMouseEnter","clearTimeout","setTimeout","onMouseLeave","useEffect","referenceListenerProps","onFocus","e","preventDefault","Fragment","id","IconButton","CloseIcon","split","left","x","top","y"],"mappings":"ooBAgBM,SAAUA,EAAqBC,GACnC,OAAQA,GACN,IAAK,WACH,MAAO,YACT,IAAK,YACH,MAAO,UACT,IAAK,cACH,MAAO,eACT,IAAK,eACH,MAAO,aACT,QACE,OAAOA,EAEb,gNCgIaC,EAAiBC,EAAMC,YAGlC,SAAiCC,EAAAA,GAAkC,IAAhEC,IAAAA,SAAUC,IAAAA,UAAWC,IAAAA,MACxBC,EAAgDC,IAAxCC,IAAAA,eAAgBC,IAAAA,oBACxB,OACET,EAAAU,cAACC,EAAQA,SAAAC,EAAA,CACPR,UAAWS,EAAWT,EAAW,gBAC7BK,EAAmB,CACvBJ,MAAKO,EAAA,CAAA,EAAOJ,EAAmBC,EAAoBJ,MAAUA,GAE7DH,IAAKY,EAASA,UAACL,EAAoBP,IAAKA,KAEvCC,EAGP,IAkBMY,EAAiBC,EAAAA,mBACrBC,GAEIV,EAAoB,WACxB,IAAMW,EAAUC,aAAWJ,GAC3B,GAAe,MAAXG,EACF,MAAME,MAAM,oDAEd,OAAOF,CACT,EAYA,SAASG,EACPC,EACAC,GAEA,QAAKD,IACEA,IAAWC,GAASD,EAAOE,SAASD,GAC7C,CCvNAE,EAAsBA,uBAAC,2BDmCwB,SAK1CC,GAAA,IAJHvB,IAAAA,SAAQwB,EAAAD,EACR5B,UAAAA,aAAY,eAAc6B,EAI1BC,EA8JqB,SACrBC,EACAC,GAEA,IAAAC,EAA0C/B,EAAMgC,UAAkB,GAC5DC,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EAAc,CACjBuD,QAASwC,GAAed,OAAUxE,EAAY,QAC3CZ,GAELwD,KAAK,UACLmE,GAAIpB,EACJU,aAAezB,OAAsC5E,EAAfqG,EACtCG,aAAe5B,OAAsC5E,EAAfwG,GAClC3C,GAEHW,EACAE,GAAUU,GACTrG,EAAAU,cAACuH,aACC,CAAA7H,UAAU,4BACVuD,QAAS,WAAA,OAAM8C,GAAe,EAAM,EACpC/C,KAAK,SAAQ,aACF,gBAEX1D,EAAAU,cAACwH,YAAS,CAAA,cAAa,UAG3BlI,EACEU,cAAA,MAAA,CAAAN,UAAkCiH,wBAAAA,MAAAA,GAA2B,OAA3BA,EAAAA,EAAiBc,MAAM,WAAvBd,EAAA/B,EAA8B,IAChEpF,IAAKwG,EACLrG,MAAO,CACL+H,KAA0B,SAApBhB,EAAeJ,YAAK,EAApBzB,EAAsB8C,EAC5BC,WAAKlB,EAAAA,EAAeJ,cAAfxB,EAAsB+C,MAMvC"}
|
package/dist/tooltip.esm.js
CHANGED
|
@@ -78,8 +78,8 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
78
78
|
setShowTooltip = _useState[1];
|
|
79
79
|
var tooltipArrowRef = useRef(null);
|
|
80
80
|
var tooltipId = useRandomId('eds-tooltip');
|
|
81
|
-
var hoverOpenTimer;
|
|
82
|
-
var hoverCloseTimer;
|
|
81
|
+
var hoverOpenTimer = useRef();
|
|
82
|
+
var hoverCloseTimer = useRef();
|
|
83
83
|
// calculations for floating-UI tooltip position
|
|
84
84
|
var _useFloating = useFloating({
|
|
85
85
|
whileElementsMounted: function whileElementsMounted(ref, _float, update) {
|
|
@@ -101,21 +101,21 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
101
101
|
middlewareData = _useFloating.middlewareData,
|
|
102
102
|
actualPlacement = _useFloating.placement;
|
|
103
103
|
var onMouseEnter = function onMouseEnter() {
|
|
104
|
-
clearTimeout(hoverCloseTimer);
|
|
105
|
-
hoverOpenTimer = setTimeout(function () {
|
|
104
|
+
clearTimeout(hoverCloseTimer.current);
|
|
105
|
+
hoverOpenTimer.current = setTimeout(function () {
|
|
106
106
|
setShowTooltip(true);
|
|
107
107
|
}, 150);
|
|
108
108
|
};
|
|
109
109
|
var onMouseLeave = function onMouseLeave() {
|
|
110
|
-
clearTimeout(hoverOpenTimer);
|
|
111
|
-
hoverCloseTimer = setTimeout(function () {
|
|
110
|
+
clearTimeout(hoverOpenTimer.current);
|
|
111
|
+
hoverCloseTimer.current = setTimeout(function () {
|
|
112
112
|
setShowTooltip(false);
|
|
113
113
|
}, 300);
|
|
114
114
|
};
|
|
115
115
|
React.useEffect(function () {
|
|
116
116
|
return function () {
|
|
117
|
-
clearTimeout(hoverOpenTimer);
|
|
118
|
-
clearTimeout(hoverCloseTimer);
|
|
117
|
+
clearTimeout(hoverOpenTimer.current);
|
|
118
|
+
clearTimeout(hoverCloseTimer.current);
|
|
119
119
|
};
|
|
120
120
|
}, []);
|
|
121
121
|
var referenceListenerProps = _extends({
|
package/dist/tooltip.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.esm.js","sources":["../src/utils.ts","../src/Tooltip.tsx","../src/Popover.tsx","../src/index.tsx"],"sourcesContent":["import { Placement as FloatingUIPlacement } from '@floating-ui/react-dom';\n\nexport type Placement =\n | 'top'\n | 'top-left'\n | 'top-start'\n | 'top-right'\n | 'top-end'\n | 'left'\n | 'right'\n | 'bottom-left'\n | 'bottom-start'\n | 'bottom'\n | 'bottom-right'\n | 'bottom-end';\n\nexport function standardisePlacement(placement: string): FloatingUIPlacement {\n switch (placement) {\n case 'top-left':\n return 'top-start';\n case 'top-right':\n return 'top-end';\n case 'bottom-left':\n return 'bottom-start';\n case 'bottom-right':\n return 'bottom-end';\n default:\n return placement as FloatingUIPlacement;\n }\n}\n","import React, { cloneElement, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n arrow,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { useRandomId } from '@entur/utils';\nimport { CloseIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { space, borderRadiuses } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Tooltip.scss';\n\ntype Modifier = {\n name: string;\n enabled?: boolean;\n requires?: Array<string>;\n requiresIfExists?: Array<string>;\n options?: Record<string, unknown>;\n data?: Record<string, unknown>;\n [key: string]: any;\n};\n\ntype ChildEventListner = {\n 'aria-describedby'?: string;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: () => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n onKeyUp?: (e: React.KeyboardEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n};\n\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type TooltipProps = {\n /** Plassering av tooltip-en */\n placement: Placement;\n /** Innholdet i tooltip-boksen */\n content: React.ReactNode;\n /** Elementet som skal ha tooltip-funksjonalitet */\n children: React.ReactElement;\n /** Om tooltip-en skal vises */\n isOpen?: boolean;\n /** Ekstra klassenavn for tooltip */\n className?: string;\n /** Åpner ikke tooltip ved hover-events\n * @default false\n */\n disableHoverListener?: boolean;\n /** Åpner ikke tooltip ved focus-events\n * @default false\n */\n disableFocusListener?: boolean;\n disableKeyboardListener?: boolean;\n disableClickListner?: boolean;\n /** Viser en lukkeknapp om man kontrollerer åpningen av Tooltip vha `isOpen`\n * @default true\n */\n showCloseButton?: boolean;\n /** Valideringsvariant for Tooltip */\n variant?: 'negative' | typeof error;\n /** @deprecated Ikke lenger støttet. Meld fra på #talk-designsystem hvis du trenger støtte for\n * overskrivinger av plasseringen til Tooltip!\n */\n popperModifiers?: Modifier[];\n [key: string]: any;\n};\n\nexport const Tooltip: React.FC<TooltipProps> = ({\n placement,\n content,\n children,\n className,\n isOpen = false,\n disableHoverListener = false,\n disableFocusListener = false,\n disableKeyboardListener = true,\n disableClickListner = true,\n showCloseButton = true,\n variant,\n style,\n ...rest\n}) => {\n const [showTooltip, setShowTooltip] = useState(isOpen);\n const tooltipArrowRef = useRef(null);\n const tooltipId = useRandomId('eds-tooltip');\n let hoverOpenTimer: ReturnType<typeof setTimeout>;\n let hoverCloseTimer: ReturnType<typeof setTimeout>;\n\n // calculations for floating-UI tooltip position\n const {\n refs,\n floatingStyles,\n middlewareData,\n placement: actualPlacement,\n } = useFloating({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n arrow({\n element: tooltipArrowRef,\n padding: borderRadiuses.medium,\n }),\n ],\n });\n\n const onMouseEnter = () => {\n clearTimeout(hoverCloseTimer);\n hoverOpenTimer = setTimeout(() => {\n setShowTooltip(true);\n }, 150);\n };\n\n const onMouseLeave = () => {\n clearTimeout(hoverOpenTimer);\n hoverCloseTimer = setTimeout(() => {\n setShowTooltip(false);\n }, 300);\n };\n\n React.useEffect(() => {\n return () => {\n clearTimeout(hoverOpenTimer);\n clearTimeout(hoverCloseTimer);\n };\n }, []);\n\n const referenceListenerProps: ChildEventListner = {\n 'aria-describedby': showTooltip ? tooltipId : undefined,\n // focusListner\n ...(!disableFocusListener && { onFocus: () => setShowTooltip(true) }),\n ...(!disableFocusListener && { onBlur: () => setShowTooltip(false) }),\n // hoverListner\n ...(!disableHoverListener && { onMouseEnter }),\n ...(!disableHoverListener && { onMouseLeave }),\n // keyboardListner\n ...(!disableKeyboardListener && {\n onKeyDown: e => {\n if (e.key === 'Escape') setShowTooltip(false);\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n setShowTooltip(!showTooltip);\n }\n },\n }),\n // clickListner\n ...(!disableClickListner && {\n onClick: () => setShowTooltip(!showTooltip),\n }),\n };\n\n return (\n <>\n {cloneElement(children, {\n ref: refs.setReference,\n ...referenceListenerProps,\n })}\n <div\n className={classNames(className, 'eds-tooltip', {\n 'eds-tooltip--negative': variant === error || variant === 'negative',\n })}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n display: showTooltip && content ? undefined : 'none',\n ...style,\n }}\n role=\"tooltip\"\n id={tooltipId}\n onMouseEnter={!disableHoverListener ? onMouseEnter : undefined}\n onMouseLeave={!disableHoverListener ? onMouseLeave : undefined}\n {...rest}\n >\n {content}\n {isOpen && showCloseButton && (\n <IconButton\n className=\"eds-tooltip__close-button\"\n onClick={() => setShowTooltip(false)}\n type=\"button\"\n aria-label=\"Lukk tooltip\"\n >\n <CloseIcon aria-hidden=\"true\" />\n </IconButton>\n )}\n <div\n className={`eds-tooltip__arrow--${actualPlacement?.split('-')?.[0]}`}\n ref={tooltipArrowRef}\n style={{\n left: middlewareData.arrow?.x,\n top: middlewareData.arrow?.y,\n }}\n />\n </div>\n </>\n );\n};\n","import React, {\n cloneElement,\n createContext,\n MutableRefObject,\n useContext,\n} from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { Contrast } from '@entur/layout';\nimport { mergeRefs, useOnClickOutside } from '@entur/utils';\nimport { space } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Popover.scss';\n\nexport type PopoverProps = {\n /** Innholdet i Popover */\n children: React.ReactNode;\n /** Plasseringen av Popover\n * @default \"bottom-start\"\n */\n placement?: Placement;\n /** Hvis du ønsker å styre state selv kan du sende inn state her */\n showPopover?: boolean;\n /** Hvis du ønsker å styre state selv kan du sende inn setState her */\n setShowPopover?: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const Popover: React.FC<PopoverProps> = ({\n children,\n placement = 'bottom-start',\n showPopover: controlledState,\n setShowPopover: setControlledState,\n}) => {\n const [showPopover, setShowPopover, controlled] = useCustomState(\n controlledState,\n setControlledState,\n );\n\n // calculations for floating-UI popover position\n const { refs, floatingStyles } = useFloating<HTMLButtonElement>({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n ],\n });\n\n useOnClickOutside([refs.floating, refs.reference], () =>\n setShowPopover(false),\n );\n\n const popoverTriggerProps = {\n 'aria-haspopup': 'dialog',\n 'aria-expanded': showPopover,\n ref: refs.setReference,\n type: 'button',\n ...(!controlled && {\n onClick: () => setShowPopover(prev => !prev),\n }),\n };\n\n const popoverContentProps = {\n role: 'dialog',\n 'aria-modal': false,\n 'aria-hidden': !showPopover,\n ref: refs.setFloating,\n style: { ...(!showPopover && { display: 'none' }) },\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key === 'Escape') setShowPopover(false);\n },\n onBlur: (event: React.FocusEvent) => {\n const elementReceivingFocus = event.relatedTarget as HTMLElement;\n // The check for 'tabindex=-1' is a special case for focus handling in Docz\n if (\n !elementReceivingFocus ||\n elementReceivingFocus.getAttribute('tabindex') === '-1'\n )\n return;\n const focusedElementIsPopover = elementContainsElement(\n refs.floating.current,\n elementReceivingFocus,\n );\n const focusedElementIsTrigger = elementContainsElement(\n refs.reference.current,\n elementReceivingFocus,\n );\n const popoverShouldClose =\n !focusedElementIsPopover && !focusedElementIsTrigger;\n if (showPopover && popoverShouldClose) setShowPopover(false);\n },\n };\n\n const closeButtonProps = {\n onClick: () => setShowPopover(false),\n type: 'button',\n };\n\n const contextValue: PopoverContextProps = {\n showPopover,\n floatingStyles,\n popoverTriggerProps,\n popoverContentProps,\n closeButtonProps,\n };\n\n return (\n <PopoverContext.Provider value={contextValue}>\n {children}\n </PopoverContext.Provider>\n );\n};\n\nexport type PopoverTriggerProps = {\n /** Knapp som skal brukes for å åpne Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = ({ children }) => {\n const { popoverTriggerProps } = usePopoverContext();\n const child = React.Children.only(children) as React.ReactElement<any>;\n return cloneElement(child, popoverTriggerProps);\n};\n\nexport type PopoverCloseButtonProps = {\n /** En valgfri knapp som kan legges inn for å lukke Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverCloseButton: React.FC<PopoverCloseButtonProps> = ({\n children,\n ...rest\n}) => {\n const { closeButtonProps } = usePopoverContext();\n return cloneElement(children, { ...closeButtonProps, ...rest });\n};\n\nexport type PopoverContentProps = {\n /**Innholdet til Popover */\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n};\n\nexport const PopoverContent = React.forwardRef<\n HTMLDivElement,\n PopoverContentProps\n>(({ children, className, style }, ref: React.Ref<HTMLDivElement>) => {\n const { floatingStyles, popoverContentProps } = usePopoverContext();\n return (\n <Contrast\n className={classNames(className, 'eds-popover')}\n {...popoverContentProps}\n style={{ ...floatingStyles, ...popoverContentProps.style, ...style }}\n // @ts-expect-error correct type for floating cannot be set via useFloating\n ref={mergeRefs(popoverContentProps.ref, ref)}\n >\n {children}\n </Contrast>\n );\n});\n\ntype PopoverContextProps = {\n showPopover: boolean;\n floatingStyles: React.CSSProperties;\n closeButtonProps: Record<string, unknown>;\n popoverContentProps: {\n role: string;\n 'aria-modal': boolean;\n 'aria-hidden': boolean;\n ref: MutableRefObject<HTMLElement> | ((node: HTMLElement | null) => void);\n style: React.CSSProperties;\n onKeyDown: (event: React.KeyboardEvent) => void;\n onBlur: (event: React.FocusEvent) => void;\n };\n popoverTriggerProps: Record<string, unknown>;\n};\n\nconst PopoverContext = createContext<PopoverContextProps | undefined>(\n undefined,\n);\nconst usePopoverContext = () => {\n const context = useContext(PopoverContext);\n if (context == null) {\n throw Error('usePopoverContext must be used within <Popover/>');\n }\n return context;\n};\n\nconst useCustomState = (\n state?: boolean,\n setState?: React.Dispatch<React.SetStateAction<boolean>>,\n): [boolean, React.Dispatch<React.SetStateAction<boolean>>, boolean] => {\n const [internalState, setInternalState] = React.useState<boolean>(false);\n const controlled = state !== undefined && setState !== undefined;\n if (controlled) return [state, setState, controlled];\n return [internalState, setInternalState, controlled];\n};\n\nfunction elementContainsElement(\n parent: HTMLElement | null,\n child: HTMLElement,\n) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('tooltip');\n\nexport * from './Tooltip';\nexport * from './Popover';\nexport { Placement } from './utils';\n"],"names":["standardisePlacement","placement","error","Tooltip","content","children","className","isOpen","disableHoverListener","disableFocusListener","disableKeyboardListener","disableClickListner","showCloseButton","variant","style","rest","_excluded","useState","showTooltip","setShowTooltip","tooltipArrowRef","useRef","tooltipId","useRandomId","hoverOpenTimer","hoverCloseTimer","useFloating","whileElementsMounted","ref","float","update","autoUpdate","middleware","offset","space","extraSmall","flip","shift","padding","limiter","limitShift","arrow","element","borderRadiuses","medium","refs","floatingStyles","middlewareData","actualPlacement","onMouseEnter","clearTimeout","setTimeout","onMouseLeave","React","useEffect","referenceListenerProps","undefined","onFocus","onBlur","onKeyDown","e","key","preventDefault","onClick","createElement","Fragment","cloneElement","setReference","classNames","setFloating","display","role","id","IconButton","type","CloseIcon","split","left","x","top","y","Popover","controlledState","showPopover","setControlledState","setShowPopover","useCustomState","controlled","useOnClickOutside","floating","reference","popoverTriggerProps","prev","popoverContentProps","event","elementReceivingFocus","relatedTarget","getAttribute","focusedElementIsPopover","elementContainsElement","current","focusedElementIsTrigger","popoverShouldClose","closeButtonProps","contextValue","PopoverContext","Provider","value","PopoverTrigger","usePopoverContext","child","Children","only","PopoverCloseButton","PopoverContent","forwardRef","Contrast","mergeRefs","createContext","context","useContext","Error","state","setState","internalState","setInternalState","parent","contains","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBM,SAAUA,oBAAoB,CAACC,SAAiB,EAAA;AACpD,EAAA,QAAQA,SAAS;AACf,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,WAAW,CAA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gB,GAAA,eAAA,CAAA,CAAA,CAAA,CAAA;EACtC,IAAMtC,UAAU,GAAGmC,KAAK,KAAKlE,SAAS,IAAImE,QAAQ,KAAKnE,SAAS,CAAA;EAChE,IAAI+B,UAAU,EAAE,OAAO,CAACmC,KAAK,EAAEC,QAAQ,EAAEpC,UAAU,CAAC,CAAA;AACpD,EAAA,OAAO,CAACqC,aAAa,EAAEC,gBAAgB,EAAEtC,UAAU,CAAC,CAAA;AACtD,CAAC,CAAA;AAED,SAASY,sBAAsB,CAC7B2B,MAA0B,EAC1BhB,KAAkB,EAAA;AAElB,EAAA,IAAI,CAACgB,MAAM,EAAE,OAAO,KAAK,CAAA;EACzB,OAAOA,MAAM,KAAKhB,KAAK,IAAIgB,MAAM,CAACC,QAAQ,CAACjB,KAAK,CAAC,CAAA;AACnD;;ACvNAkB,sBAAsB,CAAC,SAAS,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"tooltip.esm.js","sources":["../src/utils.ts","../src/Tooltip.tsx","../src/Popover.tsx","../src/index.tsx"],"sourcesContent":["import { Placement as FloatingUIPlacement } from '@floating-ui/react-dom';\n\nexport type Placement =\n | 'top'\n | 'top-left'\n | 'top-start'\n | 'top-right'\n | 'top-end'\n | 'left'\n | 'right'\n | 'bottom-left'\n | 'bottom-start'\n | 'bottom'\n | 'bottom-right'\n | 'bottom-end';\n\nexport function standardisePlacement(placement: string): FloatingUIPlacement {\n switch (placement) {\n case 'top-left':\n return 'top-start';\n case 'top-right':\n return 'top-end';\n case 'bottom-left':\n return 'bottom-start';\n case 'bottom-right':\n return 'bottom-end';\n default:\n return placement as FloatingUIPlacement;\n }\n}\n","import React, { cloneElement, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n arrow,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { useRandomId } from '@entur/utils';\nimport { CloseIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { space, borderRadiuses } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Tooltip.scss';\n\ntype Modifier = {\n name: string;\n enabled?: boolean;\n requires?: Array<string>;\n requiresIfExists?: Array<string>;\n options?: Record<string, unknown>;\n data?: Record<string, unknown>;\n [key: string]: any;\n};\n\ntype ChildEventListner = {\n 'aria-describedby'?: string;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: () => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n onKeyUp?: (e: React.KeyboardEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n};\n\n/** @deprecated use variant=\"negative\" instead */\nconst error = 'error';\n\nexport type TooltipProps = {\n /** Plassering av tooltip-en */\n placement: Placement;\n /** Innholdet i tooltip-boksen */\n content: React.ReactNode;\n /** Elementet som skal ha tooltip-funksjonalitet */\n children: React.ReactElement;\n /** Om tooltip-en skal vises */\n isOpen?: boolean;\n /** Ekstra klassenavn for tooltip */\n className?: string;\n /** Åpner ikke tooltip ved hover-events\n * @default false\n */\n disableHoverListener?: boolean;\n /** Åpner ikke tooltip ved focus-events\n * @default false\n */\n disableFocusListener?: boolean;\n disableKeyboardListener?: boolean;\n disableClickListner?: boolean;\n /** Viser en lukkeknapp om man kontrollerer åpningen av Tooltip vha `isOpen`\n * @default true\n */\n showCloseButton?: boolean;\n /** Valideringsvariant for Tooltip */\n variant?: 'negative' | typeof error;\n /** @deprecated Ikke lenger støttet. Meld fra på #talk-designsystem hvis du trenger støtte for\n * overskrivinger av plasseringen til Tooltip!\n */\n popperModifiers?: Modifier[];\n [key: string]: any;\n};\n\nexport const Tooltip: React.FC<TooltipProps> = ({\n placement,\n content,\n children,\n className,\n isOpen = false,\n disableHoverListener = false,\n disableFocusListener = false,\n disableKeyboardListener = true,\n disableClickListner = true,\n showCloseButton = true,\n variant,\n style,\n ...rest\n}) => {\n const [showTooltip, setShowTooltip] = useState(isOpen);\n const tooltipArrowRef = useRef(null);\n const tooltipId = useRandomId('eds-tooltip');\n const hoverOpenTimer = useRef<ReturnType<typeof setTimeout>>();\n const hoverCloseTimer = useRef<ReturnType<typeof setTimeout>>();\n\n // calculations for floating-UI tooltip position\n const {\n refs,\n floatingStyles,\n middlewareData,\n placement: actualPlacement,\n } = useFloating({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n arrow({\n element: tooltipArrowRef,\n padding: borderRadiuses.medium,\n }),\n ],\n });\n\n const onMouseEnter = () => {\n clearTimeout(hoverCloseTimer.current);\n hoverOpenTimer.current = setTimeout(() => {\n setShowTooltip(true);\n }, 150);\n };\n\n const onMouseLeave = () => {\n clearTimeout(hoverOpenTimer.current);\n hoverCloseTimer.current = setTimeout(() => {\n setShowTooltip(false);\n }, 300);\n };\n\n React.useEffect(() => {\n return () => {\n clearTimeout(hoverOpenTimer.current);\n clearTimeout(hoverCloseTimer.current);\n };\n }, []);\n\n const referenceListenerProps: ChildEventListner = {\n 'aria-describedby': showTooltip ? tooltipId : undefined,\n // focusListner\n ...(!disableFocusListener && { onFocus: () => setShowTooltip(true) }),\n ...(!disableFocusListener && { onBlur: () => setShowTooltip(false) }),\n // hoverListner\n ...(!disableHoverListener && { onMouseEnter }),\n ...(!disableHoverListener && { onMouseLeave }),\n // keyboardListner\n ...(!disableKeyboardListener && {\n onKeyDown: e => {\n if (e.key === 'Escape') setShowTooltip(false);\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n setShowTooltip(!showTooltip);\n }\n },\n }),\n // clickListner\n ...(!disableClickListner && {\n onClick: () => setShowTooltip(!showTooltip),\n }),\n };\n\n return (\n <>\n {cloneElement(children, {\n ref: refs.setReference,\n ...referenceListenerProps,\n })}\n <div\n className={classNames(className, 'eds-tooltip', {\n 'eds-tooltip--negative': variant === error || variant === 'negative',\n })}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n display: showTooltip && content ? undefined : 'none',\n ...style,\n }}\n role=\"tooltip\"\n id={tooltipId}\n onMouseEnter={!disableHoverListener ? onMouseEnter : undefined}\n onMouseLeave={!disableHoverListener ? onMouseLeave : undefined}\n {...rest}\n >\n {content}\n {isOpen && showCloseButton && (\n <IconButton\n className=\"eds-tooltip__close-button\"\n onClick={() => setShowTooltip(false)}\n type=\"button\"\n aria-label=\"Lukk tooltip\"\n >\n <CloseIcon aria-hidden=\"true\" />\n </IconButton>\n )}\n <div\n className={`eds-tooltip__arrow--${actualPlacement?.split('-')?.[0]}`}\n ref={tooltipArrowRef}\n style={{\n left: middlewareData.arrow?.x,\n top: middlewareData.arrow?.y,\n }}\n />\n </div>\n </>\n );\n};\n","import React, {\n cloneElement,\n createContext,\n MutableRefObject,\n useContext,\n} from 'react';\n\nimport classNames from 'classnames';\nimport {\n useFloating,\n autoUpdate,\n offset,\n flip,\n shift,\n limitShift,\n} from '@floating-ui/react-dom';\n\nimport { Contrast } from '@entur/layout';\nimport { mergeRefs, useOnClickOutside } from '@entur/utils';\nimport { space } from '@entur/tokens';\n\nimport { Placement, standardisePlacement } from './utils';\n\nimport './Popover.scss';\n\nexport type PopoverProps = {\n /** Innholdet i Popover */\n children: React.ReactNode;\n /** Plasseringen av Popover\n * @default \"bottom-start\"\n */\n placement?: Placement;\n /** Hvis du ønsker å styre state selv kan du sende inn state her */\n showPopover?: boolean;\n /** Hvis du ønsker å styre state selv kan du sende inn setState her */\n setShowPopover?: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const Popover: React.FC<PopoverProps> = ({\n children,\n placement = 'bottom-start',\n showPopover: controlledState,\n setShowPopover: setControlledState,\n}) => {\n const [showPopover, setShowPopover, controlled] = useCustomState(\n controlledState,\n setControlledState,\n );\n\n // calculations for floating-UI popover position\n const { refs, floatingStyles } = useFloating<HTMLButtonElement>({\n whileElementsMounted: (ref, float, update) =>\n autoUpdate(ref, float, update),\n placement: standardisePlacement(placement),\n middleware: [\n offset(space.extraSmall),\n flip(),\n shift({ padding: space.extraSmall, limiter: limitShift({ offset: 8 }) }),\n ],\n });\n\n useOnClickOutside([refs.floating, refs.reference], () =>\n setShowPopover(false),\n );\n\n const popoverTriggerProps = {\n 'aria-haspopup': 'dialog',\n 'aria-expanded': showPopover,\n ref: refs.setReference,\n type: 'button',\n ...(!controlled && {\n onClick: () => setShowPopover(prev => !prev),\n }),\n };\n\n const popoverContentProps = {\n role: 'dialog',\n 'aria-modal': false,\n 'aria-hidden': !showPopover,\n ref: refs.setFloating,\n style: { ...(!showPopover && { display: 'none' }) },\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key === 'Escape') setShowPopover(false);\n },\n onBlur: (event: React.FocusEvent) => {\n const elementReceivingFocus = event.relatedTarget as HTMLElement;\n // The check for 'tabindex=-1' is a special case for focus handling in Docz\n if (\n !elementReceivingFocus ||\n elementReceivingFocus.getAttribute('tabindex') === '-1'\n )\n return;\n const focusedElementIsPopover = elementContainsElement(\n refs.floating.current,\n elementReceivingFocus,\n );\n const focusedElementIsTrigger = elementContainsElement(\n refs.reference.current,\n elementReceivingFocus,\n );\n const popoverShouldClose =\n !focusedElementIsPopover && !focusedElementIsTrigger;\n if (showPopover && popoverShouldClose) setShowPopover(false);\n },\n };\n\n const closeButtonProps = {\n onClick: () => setShowPopover(false),\n type: 'button',\n };\n\n const contextValue: PopoverContextProps = {\n showPopover,\n floatingStyles,\n popoverTriggerProps,\n popoverContentProps,\n closeButtonProps,\n };\n\n return (\n <PopoverContext.Provider value={contextValue}>\n {children}\n </PopoverContext.Provider>\n );\n};\n\nexport type PopoverTriggerProps = {\n /** Knapp som skal brukes for å åpne Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = ({ children }) => {\n const { popoverTriggerProps } = usePopoverContext();\n const child = React.Children.only(children) as React.ReactElement<any>;\n return cloneElement(child, popoverTriggerProps);\n};\n\nexport type PopoverCloseButtonProps = {\n /** En valgfri knapp som kan legges inn for å lukke Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverCloseButton: React.FC<PopoverCloseButtonProps> = ({\n children,\n ...rest\n}) => {\n const { closeButtonProps } = usePopoverContext();\n return cloneElement(children, { ...closeButtonProps, ...rest });\n};\n\nexport type PopoverContentProps = {\n /**Innholdet til Popover */\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n};\n\nexport const PopoverContent = React.forwardRef<\n HTMLDivElement,\n PopoverContentProps\n>(({ children, className, style }, ref: React.Ref<HTMLDivElement>) => {\n const { floatingStyles, popoverContentProps } = usePopoverContext();\n return (\n <Contrast\n className={classNames(className, 'eds-popover')}\n {...popoverContentProps}\n style={{ ...floatingStyles, ...popoverContentProps.style, ...style }}\n // @ts-expect-error correct type for floating cannot be set via useFloating\n ref={mergeRefs(popoverContentProps.ref, ref)}\n >\n {children}\n </Contrast>\n );\n});\n\ntype PopoverContextProps = {\n showPopover: boolean;\n floatingStyles: React.CSSProperties;\n closeButtonProps: Record<string, unknown>;\n popoverContentProps: {\n role: string;\n 'aria-modal': boolean;\n 'aria-hidden': boolean;\n ref: MutableRefObject<HTMLElement> | ((node: HTMLElement | null) => void);\n style: React.CSSProperties;\n onKeyDown: (event: React.KeyboardEvent) => void;\n onBlur: (event: React.FocusEvent) => void;\n };\n popoverTriggerProps: Record<string, unknown>;\n};\n\nconst PopoverContext = createContext<PopoverContextProps | undefined>(\n undefined,\n);\nconst usePopoverContext = () => {\n const context = useContext(PopoverContext);\n if (context == null) {\n throw Error('usePopoverContext must be used within <Popover/>');\n }\n return context;\n};\n\nconst useCustomState = (\n state?: boolean,\n setState?: React.Dispatch<React.SetStateAction<boolean>>,\n): [boolean, React.Dispatch<React.SetStateAction<boolean>>, boolean] => {\n const [internalState, setInternalState] = React.useState<boolean>(false);\n const controlled = state !== undefined && setState !== undefined;\n if (controlled) return [state, setState, controlled];\n return [internalState, setInternalState, controlled];\n};\n\nfunction elementContainsElement(\n parent: HTMLElement | null,\n child: HTMLElement,\n) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('tooltip');\n\nexport * from './Tooltip';\nexport * from './Popover';\nexport { Placement } from './utils';\n"],"names":["standardisePlacement","placement","error","Tooltip","content","children","className","isOpen","disableHoverListener","disableFocusListener","disableKeyboardListener","disableClickListner","showCloseButton","variant","style","rest","_excluded","useState","showTooltip","setShowTooltip","tooltipArrowRef","useRef","tooltipId","useRandomId","hoverOpenTimer","hoverCloseTimer","useFloating","whileElementsMounted","ref","float","update","autoUpdate","middleware","offset","space","extraSmall","flip","shift","padding","limiter","limitShift","arrow","element","borderRadiuses","medium","refs","floatingStyles","middlewareData","actualPlacement","onMouseEnter","clearTimeout","current","setTimeout","onMouseLeave","React","useEffect","referenceListenerProps","undefined","onFocus","onBlur","onKeyDown","e","key","preventDefault","onClick","createElement","Fragment","cloneElement","setReference","classNames","setFloating","display","role","id","IconButton","type","CloseIcon","split","left","x","top","y","Popover","controlledState","showPopover","setControlledState","setShowPopover","useCustomState","controlled","useOnClickOutside","floating","reference","popoverTriggerProps","prev","popoverContentProps","event","elementReceivingFocus","relatedTarget","getAttribute","focusedElementIsPopover","elementContainsElement","focusedElementIsTrigger","popoverShouldClose","closeButtonProps","contextValue","PopoverContext","Provider","value","PopoverTrigger","usePopoverContext","child","Children","only","PopoverCloseButton","PopoverContent","forwardRef","Contrast","mergeRefs","createContext","context","useContext","Error","state","setState","internalState","setInternalState","parent","contains","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBM,SAAUA,oBAAoB,CAACC,SAAiB,EAAA;AACpD,EAAA,QAAQA,SAAS;AACf,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,WAAW,CAAA;AACpB,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,SAAS,CAAA;AAClB,IAAA,KAA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QAAQ,CAAU,KAAK,CAAC;IAAjE2G,aAAa,GAAA,eAAA,CAAA,CAAA,CAAA;IAAEC,gBAAgB,GAAA,eAAA,CAAA,CAAA,CAAA,CAAA;EACtC,IAAMrC,UAAU,GAAGkC,KAAK,KAAKjE,SAAS,IAAIkE,QAAQ,KAAKlE,SAAS,CAAA;EAChE,IAAI+B,UAAU,EAAE,OAAO,CAACkC,KAAK,EAAEC,QAAQ,EAAEnC,UAAU,CAAC,CAAA;AACpD,EAAA,OAAO,CAACoC,aAAa,EAAEC,gBAAgB,EAAErC,UAAU,CAAC,CAAA;AACtD,CAAC,CAAA;AAED,SAASY,sBAAsB,CAC7B0B,MAA0B,EAC1BhB,KAAkB,EAAA;AAElB,EAAA,IAAI,CAACgB,MAAM,EAAE,OAAO,KAAK,CAAA;EACzB,OAAOA,MAAM,KAAKhB,KAAK,IAAIgB,MAAM,CAACC,QAAQ,CAACjB,KAAK,CAAC,CAAA;AACnD;;ACvNAkB,sBAAsB,CAAC,SAAS,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entur/tooltip",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/tooltip.esm.js",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"react-dom": ">=16.8.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@entur/button": "^3.2.
|
|
31
|
-
"@entur/icons": "^7.
|
|
32
|
-
"@entur/layout": "^2.3.
|
|
30
|
+
"@entur/button": "^3.2.32",
|
|
31
|
+
"@entur/icons": "^7.4.0",
|
|
32
|
+
"@entur/layout": "^2.3.16",
|
|
33
33
|
"@entur/tokens": "^3.17.0",
|
|
34
|
-
"@entur/utils": "^0.11.2
|
|
34
|
+
"@entur/utils": "^0.11.2",
|
|
35
35
|
"@floating-ui/react-dom": "^2.1.0",
|
|
36
36
|
"classnames": "^2.3.1"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "045cada5d95c62d8ddfc95d82b4526742ab07d0a"
|
|
39
39
|
}
|