@transferwise/components 46.135.0 → 46.135.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/badge/BadgeAssets.js +2 -1
- package/build/badge/BadgeAssets.js.map +1 -1
- package/build/badge/BadgeAssets.mjs +2 -1
- package/build/badge/BadgeAssets.mjs.map +1 -1
- package/build/common/panel/Panel.js +49 -54
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +54 -59
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/main.css +26 -14
- package/build/select/Select.js +1 -1
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +1 -1
- package/build/select/Select.mjs.map +1 -1
- package/build/styles/css/neptune.css +22 -11
- package/build/styles/less/neptune-tokens.less +3 -2
- package/build/styles/main.css +26 -14
- package/build/styles/modal/Modal.css +2 -2
- package/build/styles/props/neptune-tokens.css +2 -1
- package/build/styles/select/Select.css +2 -1
- package/build/styles/styles/less/neptune.css +22 -11
- package/build/tooltip/Tooltip.js +29 -50
- package/build/tooltip/Tooltip.js.map +1 -1
- package/build/tooltip/Tooltip.mjs +30 -51
- package/build/tooltip/Tooltip.mjs.map +1 -1
- package/build/types/badge/BadgeAssets.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/tooltip/Tooltip.d.ts.map +1 -1
- package/package.json +11 -13
- package/src/avatarView/AvatarView.story.tsx +1 -1
- package/src/avatarView/AvatarView.test.story.tsx +108 -1
- package/src/badge/BadgeAssets.tsx +2 -0
- package/src/common/panel/Panel.tsx +56 -49
- package/src/main.css +26 -14
- package/src/modal/Modal.css +2 -2
- package/src/modal/Modal.less +1 -1
- package/src/select/Select.css +2 -1
- package/src/select/Select.less +6 -5
- package/src/select/Select.test.story.tsx +59 -0
- package/src/select/Select.tsx +1 -1
- package/src/styles/less/neptune.css +22 -11
- package/src/tooltip/Tooltip.tsx +26 -45
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
arrow as arrowMiddleware,
|
|
3
|
+
autoUpdate,
|
|
4
|
+
flip as flipMiddleware,
|
|
5
|
+
offset,
|
|
6
|
+
type Placement,
|
|
7
|
+
shift,
|
|
8
|
+
size as sizeMiddleware,
|
|
9
|
+
useFloating,
|
|
10
|
+
} from '@floating-ui/react';
|
|
1
11
|
import { clsx } from 'clsx';
|
|
2
12
|
import {
|
|
3
13
|
CSSProperties,
|
|
@@ -7,21 +17,19 @@ import {
|
|
|
7
17
|
SyntheticEvent,
|
|
8
18
|
forwardRef,
|
|
9
19
|
useContext,
|
|
10
|
-
|
|
11
|
-
useState,
|
|
20
|
+
useRef,
|
|
12
21
|
} from 'react';
|
|
13
|
-
import { usePopper } from 'react-popper';
|
|
14
22
|
|
|
15
23
|
import { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';
|
|
16
24
|
import Dimmer from '../../dimmer';
|
|
17
25
|
import { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';
|
|
18
26
|
|
|
19
|
-
const POPOVER_OFFSET =
|
|
27
|
+
const POPOVER_OFFSET = 16;
|
|
20
28
|
|
|
21
29
|
// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space
|
|
22
30
|
// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.
|
|
23
31
|
// This mapping forces popover to try the four available positions before going back to the initial chosen one.
|
|
24
|
-
const fallbackPlacements = {
|
|
32
|
+
const fallbackPlacements: Record<string, Placement[]> = {
|
|
25
33
|
[Position.TOP]: [Position.BOTTOM, Position.RIGHT, Position.LEFT],
|
|
26
34
|
[Position.BOTTOM]: [Position.TOP, Position.RIGHT, Position.LEFT],
|
|
27
35
|
[Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],
|
|
@@ -57,56 +65,57 @@ const Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(
|
|
|
57
65
|
}: PanelProps,
|
|
58
66
|
reference,
|
|
59
67
|
) {
|
|
60
|
-
const
|
|
61
|
-
|
|
68
|
+
const arrowRef = useRef<HTMLDivElement | null>(null);
|
|
69
|
+
|
|
70
|
+
const middleware = [];
|
|
62
71
|
|
|
63
|
-
|
|
72
|
+
if (arrow) {
|
|
73
|
+
middleware.push(offset(POPOVER_OFFSET));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (flip && fallbackPlacements[position]) {
|
|
77
|
+
middleware.push(
|
|
78
|
+
flipMiddleware({
|
|
79
|
+
fallbackPlacements: fallbackPlacements[position],
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
64
83
|
|
|
65
84
|
if (altAxis) {
|
|
66
|
-
|
|
67
|
-
// https://popper.js.org/docs/v2/modifiers/prevent-overflow
|
|
68
|
-
name: 'preventOverflow',
|
|
69
|
-
options: {
|
|
70
|
-
altAxis: true,
|
|
71
|
-
tether: false,
|
|
72
|
-
},
|
|
73
|
-
});
|
|
85
|
+
middleware.push(shift());
|
|
74
86
|
}
|
|
75
87
|
|
|
76
88
|
if (arrow) {
|
|
77
|
-
|
|
78
|
-
name: 'arrow',
|
|
79
|
-
options: {
|
|
80
|
-
element: arrowElement,
|
|
81
|
-
options: {
|
|
82
|
-
padding: 8, // 8px from the edges of the popper
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
// This lets you displace a popper element from its reference element.
|
|
87
|
-
modifiers.push({ name: 'offset', options: { offset: POPOVER_OFFSET } });
|
|
89
|
+
middleware.push(arrowMiddleware({ element: arrowRef, padding: 8 }));
|
|
88
90
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
|
|
92
|
+
if (considerHeight) {
|
|
93
|
+
middleware.push(
|
|
94
|
+
sizeMiddleware({
|
|
95
|
+
padding: POPOVER_OFFSET,
|
|
96
|
+
apply: ({ elements, availableHeight }) => {
|
|
97
|
+
elements.floating.style.setProperty(
|
|
98
|
+
'--np-panel-available-height',
|
|
99
|
+
`${availableHeight}px`,
|
|
100
|
+
);
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
);
|
|
96
104
|
}
|
|
97
105
|
|
|
98
|
-
const {
|
|
106
|
+
const { refs, floatingStyles, placement, middlewareData } = useFloating({
|
|
99
107
|
placement: position,
|
|
100
|
-
|
|
108
|
+
middleware,
|
|
109
|
+
elements: {
|
|
110
|
+
reference: anchorRef.current,
|
|
111
|
+
},
|
|
112
|
+
whileElementsMounted: open ? autoUpdate : undefined,
|
|
101
113
|
});
|
|
102
114
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
forceUpdate();
|
|
108
|
-
}
|
|
109
|
-
}, [open]);
|
|
115
|
+
const arrowStyle: CSSProperties = {
|
|
116
|
+
...(middlewareData.arrow?.x != null ? { left: middlewareData.arrow.x } : {}),
|
|
117
|
+
...(middlewareData.arrow?.y != null ? { top: middlewareData.arrow.y } : {}),
|
|
118
|
+
};
|
|
110
119
|
|
|
111
120
|
const contentStyle: CSSProperties = {
|
|
112
121
|
...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),
|
|
@@ -119,18 +128,16 @@ const Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(
|
|
|
119
128
|
<div
|
|
120
129
|
id={overlayId}
|
|
121
130
|
{...rest}
|
|
122
|
-
ref={
|
|
131
|
+
ref={refs.setFloating}
|
|
123
132
|
role="dialog"
|
|
124
|
-
style={
|
|
125
|
-
{
|
|
133
|
+
style={floatingStyles}
|
|
134
|
+
data-popper-placement={placement}
|
|
126
135
|
className={clsx('np-panel', { 'np-panel--open': open }, rest.className)}
|
|
127
136
|
>
|
|
128
137
|
<div ref={reference} style={contentStyle} className={clsx('np-panel__content')}>
|
|
129
138
|
{children}
|
|
130
139
|
{/* Arrow has to stay inside content to get the same animations as the "dialog" and to get hidden when panel is closed. */}
|
|
131
|
-
{arrow && (
|
|
132
|
-
<div ref={setArrowElement} className={clsx('np-panel__arrow')} style={styles.arrow} />
|
|
133
|
-
)}
|
|
140
|
+
{arrow && <div ref={arrowRef} className={clsx('np-panel__arrow')} style={arrowStyle} />}
|
|
134
141
|
</div>
|
|
135
142
|
</div>
|
|
136
143
|
</Dimmer>
|
package/src/main.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly, this file was auto-generated.
|
|
3
|
-
* Generated on
|
|
3
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root {
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
--radius-small: 10px;
|
|
54
54
|
--radius-medium: 16px;
|
|
55
55
|
--radius-large: 24px;
|
|
56
|
+
--radius-xlarge: 32px;
|
|
56
57
|
--size-4: 4px;
|
|
57
58
|
--size-5: 5px;
|
|
58
59
|
--size-8: 8px;
|
|
@@ -143,7 +144,7 @@
|
|
|
143
144
|
|
|
144
145
|
/**
|
|
145
146
|
* Do not edit directly, this file was auto-generated.
|
|
146
|
-
* Generated on
|
|
147
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
147
148
|
*/
|
|
148
149
|
|
|
149
150
|
.np-theme-personal {
|
|
@@ -236,6 +237,7 @@
|
|
|
236
237
|
--radius-small: 10px;
|
|
237
238
|
--radius-medium: 16px;
|
|
238
239
|
--radius-large: 24px;
|
|
240
|
+
--radius-xlarge: 32px;
|
|
239
241
|
--size-4: 4px;
|
|
240
242
|
--size-5: 5px;
|
|
241
243
|
--size-8: 8px;
|
|
@@ -392,7 +394,7 @@
|
|
|
392
394
|
|
|
393
395
|
/**
|
|
394
396
|
* Do not edit directly, this file was auto-generated.
|
|
395
|
-
* Generated on
|
|
397
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
396
398
|
*/
|
|
397
399
|
|
|
398
400
|
.np-theme-personal--forest-green {
|
|
@@ -485,6 +487,7 @@
|
|
|
485
487
|
--radius-small: 10px;
|
|
486
488
|
--radius-medium: 16px;
|
|
487
489
|
--radius-large: 24px;
|
|
490
|
+
--radius-xlarge: 32px;
|
|
488
491
|
--size-4: 4px;
|
|
489
492
|
--size-5: 5px;
|
|
490
493
|
--size-8: 8px;
|
|
@@ -641,7 +644,7 @@
|
|
|
641
644
|
|
|
642
645
|
/**
|
|
643
646
|
* Do not edit directly, this file was auto-generated.
|
|
644
|
-
* Generated on
|
|
647
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
645
648
|
*/
|
|
646
649
|
|
|
647
650
|
.np-theme-personal--bright-green {
|
|
@@ -734,6 +737,7 @@
|
|
|
734
737
|
--radius-small: 10px;
|
|
735
738
|
--radius-medium: 16px;
|
|
736
739
|
--radius-large: 24px;
|
|
740
|
+
--radius-xlarge: 32px;
|
|
737
741
|
--size-4: 4px;
|
|
738
742
|
--size-5: 5px;
|
|
739
743
|
--size-8: 8px;
|
|
@@ -890,7 +894,7 @@
|
|
|
890
894
|
|
|
891
895
|
/**
|
|
892
896
|
* Do not edit directly, this file was auto-generated.
|
|
893
|
-
* Generated on
|
|
897
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
894
898
|
*/
|
|
895
899
|
|
|
896
900
|
.np-theme-personal--dark {
|
|
@@ -983,6 +987,7 @@
|
|
|
983
987
|
--radius-small: 10px;
|
|
984
988
|
--radius-medium: 16px;
|
|
985
989
|
--radius-large: 24px;
|
|
990
|
+
--radius-xlarge: 32px;
|
|
986
991
|
--size-4: 4px;
|
|
987
992
|
--size-5: 5px;
|
|
988
993
|
--size-8: 8px;
|
|
@@ -1139,7 +1144,7 @@
|
|
|
1139
1144
|
|
|
1140
1145
|
/**
|
|
1141
1146
|
* Do not edit directly, this file was auto-generated.
|
|
1142
|
-
* Generated on
|
|
1147
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
1143
1148
|
*/
|
|
1144
1149
|
|
|
1145
1150
|
.np-theme-platform {
|
|
@@ -1232,6 +1237,7 @@
|
|
|
1232
1237
|
--radius-small: 10px;
|
|
1233
1238
|
--radius-medium: 16px;
|
|
1234
1239
|
--radius-large: 24px;
|
|
1240
|
+
--radius-xlarge: 32px;
|
|
1235
1241
|
--size-4: 4px;
|
|
1236
1242
|
--size-5: 5px;
|
|
1237
1243
|
--size-8: 8px;
|
|
@@ -1322,7 +1328,7 @@
|
|
|
1322
1328
|
|
|
1323
1329
|
/**
|
|
1324
1330
|
* Do not edit directly, this file was auto-generated.
|
|
1325
|
-
* Generated on
|
|
1331
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
1326
1332
|
*/
|
|
1327
1333
|
|
|
1328
1334
|
.np-theme-platform--forest-green {
|
|
@@ -1415,6 +1421,7 @@
|
|
|
1415
1421
|
--radius-small: 10px;
|
|
1416
1422
|
--radius-medium: 16px;
|
|
1417
1423
|
--radius-large: 24px;
|
|
1424
|
+
--radius-xlarge: 32px;
|
|
1418
1425
|
--size-4: 4px;
|
|
1419
1426
|
--size-5: 5px;
|
|
1420
1427
|
--size-8: 8px;
|
|
@@ -1505,7 +1512,7 @@
|
|
|
1505
1512
|
|
|
1506
1513
|
/**
|
|
1507
1514
|
* Do not edit directly, this file was auto-generated.
|
|
1508
|
-
* Generated on
|
|
1515
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
1509
1516
|
*/
|
|
1510
1517
|
|
|
1511
1518
|
.np-theme-business {
|
|
@@ -1599,6 +1606,7 @@
|
|
|
1599
1606
|
--radius-small: 10px;
|
|
1600
1607
|
--radius-medium: 16px;
|
|
1601
1608
|
--radius-large: 24px;
|
|
1609
|
+
--radius-xlarge: 32px;
|
|
1602
1610
|
--size-4: 4px;
|
|
1603
1611
|
--size-5: 5px;
|
|
1604
1612
|
--size-8: 8px;
|
|
@@ -1689,7 +1697,7 @@
|
|
|
1689
1697
|
|
|
1690
1698
|
/**
|
|
1691
1699
|
* Do not edit directly, this file was auto-generated.
|
|
1692
|
-
* Generated on
|
|
1700
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
1693
1701
|
*/
|
|
1694
1702
|
|
|
1695
1703
|
.np-theme-business--dark {
|
|
@@ -1783,6 +1791,7 @@
|
|
|
1783
1791
|
--radius-small: 10px;
|
|
1784
1792
|
--radius-medium: 16px;
|
|
1785
1793
|
--radius-large: 24px;
|
|
1794
|
+
--radius-xlarge: 32px;
|
|
1786
1795
|
--size-4: 4px;
|
|
1787
1796
|
--size-5: 5px;
|
|
1788
1797
|
--size-8: 8px;
|
|
@@ -1873,7 +1882,7 @@
|
|
|
1873
1882
|
|
|
1874
1883
|
/**
|
|
1875
1884
|
* Do not edit directly, this file was auto-generated.
|
|
1876
|
-
* Generated on
|
|
1885
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
1877
1886
|
*/
|
|
1878
1887
|
|
|
1879
1888
|
.np-theme-business--forest-green {
|
|
@@ -1967,6 +1976,7 @@
|
|
|
1967
1976
|
--radius-small: 10px;
|
|
1968
1977
|
--radius-medium: 16px;
|
|
1969
1978
|
--radius-large: 24px;
|
|
1979
|
+
--radius-xlarge: 32px;
|
|
1970
1980
|
--size-4: 4px;
|
|
1971
1981
|
--size-5: 5px;
|
|
1972
1982
|
--size-8: 8px;
|
|
@@ -2057,7 +2067,7 @@
|
|
|
2057
2067
|
|
|
2058
2068
|
/**
|
|
2059
2069
|
* Do not edit directly, this file was auto-generated.
|
|
2060
|
-
* Generated on
|
|
2070
|
+
* Generated on Fri, 10 Apr 2026 14:46:01 GMT
|
|
2061
2071
|
*/
|
|
2062
2072
|
|
|
2063
2073
|
.np-theme-business--bright-green {
|
|
@@ -2151,6 +2161,7 @@
|
|
|
2151
2161
|
--radius-small: 10px;
|
|
2152
2162
|
--radius-medium: 16px;
|
|
2153
2163
|
--radius-large: 24px;
|
|
2164
|
+
--radius-xlarge: 32px;
|
|
2154
2165
|
--size-4: 4px;
|
|
2155
2166
|
--size-5: 5px;
|
|
2156
2167
|
--size-8: 8px;
|
|
@@ -31053,8 +31064,8 @@ button.np-link {
|
|
|
31053
31064
|
box-shadow: none;
|
|
31054
31065
|
background: #ffffff;
|
|
31055
31066
|
background: var(--color-background-elevated);
|
|
31056
|
-
border-radius:
|
|
31057
|
-
border-radius: var(--radius-
|
|
31067
|
+
border-radius: 32px;
|
|
31068
|
+
border-radius: var(--radius-xlarge);
|
|
31058
31069
|
}
|
|
31059
31070
|
|
|
31060
31071
|
.tw-modal.in .tw-modal-dialog {
|
|
@@ -32717,8 +32728,8 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
32717
32728
|
}
|
|
32718
32729
|
|
|
32719
32730
|
.np-dropdown-menu-desktop {
|
|
32720
|
-
max-height: 70vh;
|
|
32721
32731
|
max-height: 70svh;
|
|
32732
|
+
max-height: var(--np-panel-available-height, 70svh);
|
|
32722
32733
|
min-width: 160px;
|
|
32723
32734
|
max-width: calc(100vw - 32px);
|
|
32724
32735
|
}
|
|
@@ -32726,6 +32737,7 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
32726
32737
|
@media (min-height: 592px) {
|
|
32727
32738
|
.np-dropdown-menu-desktop {
|
|
32728
32739
|
max-height: 592px;
|
|
32740
|
+
max-height: var(--np-panel-available-height, 592px);
|
|
32729
32741
|
}
|
|
32730
32742
|
}
|
|
32731
32743
|
|
package/src/modal/Modal.css
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
box-shadow: none;
|
|
10
10
|
background: #ffffff;
|
|
11
11
|
background: var(--color-background-elevated);
|
|
12
|
-
border-radius:
|
|
13
|
-
border-radius: var(--radius-
|
|
12
|
+
border-radius: 32px;
|
|
13
|
+
border-radius: var(--radius-xlarge);
|
|
14
14
|
}
|
|
15
15
|
.tw-modal.in .tw-modal-dialog {
|
|
16
16
|
transform: translate(0);
|
package/src/modal/Modal.less
CHANGED
package/src/select/Select.css
CHANGED
|
@@ -123,14 +123,15 @@
|
|
|
123
123
|
max-width: calc(100% - 32px);
|
|
124
124
|
}
|
|
125
125
|
.np-dropdown-menu-desktop {
|
|
126
|
-
max-height: 70vh;
|
|
127
126
|
max-height: 70svh;
|
|
127
|
+
max-height: var(--np-panel-available-height, 70svh);
|
|
128
128
|
min-width: 160px;
|
|
129
129
|
max-width: calc(100vw - 32px);
|
|
130
130
|
}
|
|
131
131
|
@media (min-height: 592px) {
|
|
132
132
|
.np-dropdown-menu-desktop {
|
|
133
133
|
max-height: 592px;
|
|
134
|
+
max-height: var(--np-panel-available-height, 592px);
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
.np-dropdown-menu {
|
package/src/select/Select.less
CHANGED
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
|
|
82
82
|
// Override some of Button component styles
|
|
83
83
|
.btn {
|
|
84
|
-
&:not(.disabled
|
|
84
|
+
&:not(.disabled, :disabled, .btn-loading) {
|
|
85
85
|
color: var(--color-content-primary);
|
|
86
86
|
|
|
87
87
|
&:hover {
|
|
@@ -108,15 +108,14 @@
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
.np-dropdown-menu-desktop {
|
|
111
|
-
max-height:
|
|
112
|
-
max-height: 70svh;
|
|
111
|
+
max-height: var(--np-panel-available-height, 70svh);
|
|
113
112
|
min-width: 160px;
|
|
114
113
|
max-width: ~"calc(100vw - 32px)";
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
@media (min-height: 592px) {
|
|
118
117
|
.np-dropdown-menu-desktop {
|
|
119
|
-
max-height: 592px;
|
|
118
|
+
max-height: var(--np-panel-available-height, 592px);
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
|
|
@@ -270,7 +269,9 @@
|
|
|
270
269
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
271
270
|
.np-select .np-dropdown-toggle {
|
|
272
271
|
background-color: unset;
|
|
273
|
-
transition:
|
|
272
|
+
transition:
|
|
273
|
+
background-color 0.3s ease-in-out,
|
|
274
|
+
box-shadow 0.3s ease-in-out;
|
|
274
275
|
border: none;
|
|
275
276
|
box-shadow: inset 0 0 0 1px var(--color-interactive-secondary);
|
|
276
277
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { userEvent, within } from 'storybook/test';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { withVariantConfig } from '../../.storybook/helpers';
|
|
6
|
+
import Select, { SelectOptionItem } from './Select';
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Forms/Select/Tests',
|
|
10
|
+
component: Select,
|
|
11
|
+
tags: ['!autodocs', '!manifest'],
|
|
12
|
+
} satisfies Meta<typeof Select>;
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof Select>;
|
|
16
|
+
|
|
17
|
+
const options: SelectOptionItem[] = Array.from({ length: 10 }, (_, i) => ({
|
|
18
|
+
value: i + 1,
|
|
19
|
+
label: `Option ${i + 1}`,
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Visual regression story: Select placed at the bottom of the viewport so the dropdown
|
|
24
|
+
* flips to the top when opened. The play function opens the dropdown automatically.
|
|
25
|
+
*/
|
|
26
|
+
export const DropdownFlipsToTop: Story = {
|
|
27
|
+
render: function Render() {
|
|
28
|
+
const [selected, setSelected] = useState<SelectOptionItem>(options[0]);
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
style={{
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
justifyContent: 'flex-end',
|
|
35
|
+
minHeight: '50vh',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<Select
|
|
39
|
+
id="flip-test-select"
|
|
40
|
+
size="md"
|
|
41
|
+
block
|
|
42
|
+
options={options}
|
|
43
|
+
selected={selected}
|
|
44
|
+
onChange={(option) => {
|
|
45
|
+
if (option && 'value' in option) {
|
|
46
|
+
setSelected(option as SelectOptionItem);
|
|
47
|
+
}
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
play: async ({ canvasElement }) => {
|
|
54
|
+
const canvas = within(canvasElement);
|
|
55
|
+
const trigger = canvas.getByRole('button', { name: /Option 1/i });
|
|
56
|
+
await userEvent.click(trigger);
|
|
57
|
+
},
|
|
58
|
+
...withVariantConfig(['default']),
|
|
59
|
+
};
|
package/src/select/Select.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly, this file was auto-generated.
|
|
3
|
-
* Generated on
|
|
3
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root {
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
--radius-small: 10px;
|
|
54
54
|
--radius-medium: 16px;
|
|
55
55
|
--radius-large: 24px;
|
|
56
|
+
--radius-xlarge: 32px;
|
|
56
57
|
--size-4: 4px;
|
|
57
58
|
--size-5: 5px;
|
|
58
59
|
--size-8: 8px;
|
|
@@ -143,7 +144,7 @@
|
|
|
143
144
|
|
|
144
145
|
/**
|
|
145
146
|
* Do not edit directly, this file was auto-generated.
|
|
146
|
-
* Generated on
|
|
147
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
147
148
|
*/
|
|
148
149
|
|
|
149
150
|
.np-theme-personal {
|
|
@@ -236,6 +237,7 @@
|
|
|
236
237
|
--radius-small: 10px;
|
|
237
238
|
--radius-medium: 16px;
|
|
238
239
|
--radius-large: 24px;
|
|
240
|
+
--radius-xlarge: 32px;
|
|
239
241
|
--size-4: 4px;
|
|
240
242
|
--size-5: 5px;
|
|
241
243
|
--size-8: 8px;
|
|
@@ -392,7 +394,7 @@
|
|
|
392
394
|
|
|
393
395
|
/**
|
|
394
396
|
* Do not edit directly, this file was auto-generated.
|
|
395
|
-
* Generated on
|
|
397
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
396
398
|
*/
|
|
397
399
|
|
|
398
400
|
.np-theme-personal--forest-green {
|
|
@@ -485,6 +487,7 @@
|
|
|
485
487
|
--radius-small: 10px;
|
|
486
488
|
--radius-medium: 16px;
|
|
487
489
|
--radius-large: 24px;
|
|
490
|
+
--radius-xlarge: 32px;
|
|
488
491
|
--size-4: 4px;
|
|
489
492
|
--size-5: 5px;
|
|
490
493
|
--size-8: 8px;
|
|
@@ -641,7 +644,7 @@
|
|
|
641
644
|
|
|
642
645
|
/**
|
|
643
646
|
* Do not edit directly, this file was auto-generated.
|
|
644
|
-
* Generated on
|
|
647
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
645
648
|
*/
|
|
646
649
|
|
|
647
650
|
.np-theme-personal--bright-green {
|
|
@@ -734,6 +737,7 @@
|
|
|
734
737
|
--radius-small: 10px;
|
|
735
738
|
--radius-medium: 16px;
|
|
736
739
|
--radius-large: 24px;
|
|
740
|
+
--radius-xlarge: 32px;
|
|
737
741
|
--size-4: 4px;
|
|
738
742
|
--size-5: 5px;
|
|
739
743
|
--size-8: 8px;
|
|
@@ -890,7 +894,7 @@
|
|
|
890
894
|
|
|
891
895
|
/**
|
|
892
896
|
* Do not edit directly, this file was auto-generated.
|
|
893
|
-
* Generated on
|
|
897
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
894
898
|
*/
|
|
895
899
|
|
|
896
900
|
.np-theme-personal--dark {
|
|
@@ -983,6 +987,7 @@
|
|
|
983
987
|
--radius-small: 10px;
|
|
984
988
|
--radius-medium: 16px;
|
|
985
989
|
--radius-large: 24px;
|
|
990
|
+
--radius-xlarge: 32px;
|
|
986
991
|
--size-4: 4px;
|
|
987
992
|
--size-5: 5px;
|
|
988
993
|
--size-8: 8px;
|
|
@@ -1139,7 +1144,7 @@
|
|
|
1139
1144
|
|
|
1140
1145
|
/**
|
|
1141
1146
|
* Do not edit directly, this file was auto-generated.
|
|
1142
|
-
* Generated on
|
|
1147
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
1143
1148
|
*/
|
|
1144
1149
|
|
|
1145
1150
|
.np-theme-platform {
|
|
@@ -1232,6 +1237,7 @@
|
|
|
1232
1237
|
--radius-small: 10px;
|
|
1233
1238
|
--radius-medium: 16px;
|
|
1234
1239
|
--radius-large: 24px;
|
|
1240
|
+
--radius-xlarge: 32px;
|
|
1235
1241
|
--size-4: 4px;
|
|
1236
1242
|
--size-5: 5px;
|
|
1237
1243
|
--size-8: 8px;
|
|
@@ -1322,7 +1328,7 @@
|
|
|
1322
1328
|
|
|
1323
1329
|
/**
|
|
1324
1330
|
* Do not edit directly, this file was auto-generated.
|
|
1325
|
-
* Generated on
|
|
1331
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
1326
1332
|
*/
|
|
1327
1333
|
|
|
1328
1334
|
.np-theme-platform--forest-green {
|
|
@@ -1415,6 +1421,7 @@
|
|
|
1415
1421
|
--radius-small: 10px;
|
|
1416
1422
|
--radius-medium: 16px;
|
|
1417
1423
|
--radius-large: 24px;
|
|
1424
|
+
--radius-xlarge: 32px;
|
|
1418
1425
|
--size-4: 4px;
|
|
1419
1426
|
--size-5: 5px;
|
|
1420
1427
|
--size-8: 8px;
|
|
@@ -1505,7 +1512,7 @@
|
|
|
1505
1512
|
|
|
1506
1513
|
/**
|
|
1507
1514
|
* Do not edit directly, this file was auto-generated.
|
|
1508
|
-
* Generated on
|
|
1515
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
1509
1516
|
*/
|
|
1510
1517
|
|
|
1511
1518
|
.np-theme-business {
|
|
@@ -1599,6 +1606,7 @@
|
|
|
1599
1606
|
--radius-small: 10px;
|
|
1600
1607
|
--radius-medium: 16px;
|
|
1601
1608
|
--radius-large: 24px;
|
|
1609
|
+
--radius-xlarge: 32px;
|
|
1602
1610
|
--size-4: 4px;
|
|
1603
1611
|
--size-5: 5px;
|
|
1604
1612
|
--size-8: 8px;
|
|
@@ -1689,7 +1697,7 @@
|
|
|
1689
1697
|
|
|
1690
1698
|
/**
|
|
1691
1699
|
* Do not edit directly, this file was auto-generated.
|
|
1692
|
-
* Generated on
|
|
1700
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
1693
1701
|
*/
|
|
1694
1702
|
|
|
1695
1703
|
.np-theme-business--dark {
|
|
@@ -1783,6 +1791,7 @@
|
|
|
1783
1791
|
--radius-small: 10px;
|
|
1784
1792
|
--radius-medium: 16px;
|
|
1785
1793
|
--radius-large: 24px;
|
|
1794
|
+
--radius-xlarge: 32px;
|
|
1786
1795
|
--size-4: 4px;
|
|
1787
1796
|
--size-5: 5px;
|
|
1788
1797
|
--size-8: 8px;
|
|
@@ -1873,7 +1882,7 @@
|
|
|
1873
1882
|
|
|
1874
1883
|
/**
|
|
1875
1884
|
* Do not edit directly, this file was auto-generated.
|
|
1876
|
-
* Generated on
|
|
1885
|
+
* Generated on Fri, 10 Apr 2026 14:46:00 GMT
|
|
1877
1886
|
*/
|
|
1878
1887
|
|
|
1879
1888
|
.np-theme-business--forest-green {
|
|
@@ -1967,6 +1976,7 @@
|
|
|
1967
1976
|
--radius-small: 10px;
|
|
1968
1977
|
--radius-medium: 16px;
|
|
1969
1978
|
--radius-large: 24px;
|
|
1979
|
+
--radius-xlarge: 32px;
|
|
1970
1980
|
--size-4: 4px;
|
|
1971
1981
|
--size-5: 5px;
|
|
1972
1982
|
--size-8: 8px;
|
|
@@ -2057,7 +2067,7 @@
|
|
|
2057
2067
|
|
|
2058
2068
|
/**
|
|
2059
2069
|
* Do not edit directly, this file was auto-generated.
|
|
2060
|
-
* Generated on
|
|
2070
|
+
* Generated on Fri, 10 Apr 2026 14:46:01 GMT
|
|
2061
2071
|
*/
|
|
2062
2072
|
|
|
2063
2073
|
.np-theme-business--bright-green {
|
|
@@ -2151,6 +2161,7 @@
|
|
|
2151
2161
|
--radius-small: 10px;
|
|
2152
2162
|
--radius-medium: 16px;
|
|
2153
2163
|
--radius-large: 24px;
|
|
2164
|
+
--radius-xlarge: 32px;
|
|
2154
2165
|
--size-4: 4px;
|
|
2155
2166
|
--size-5: 5px;
|
|
2156
2167
|
--size-8: 8px;
|