@matbea-ui/matbea-ui 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/matbea-ui.cjs.js +2289 -1
- package/dist/matbea-ui.cjs.js.map +1 -0
- package/dist/matbea-ui.es.js +2257 -59
- package/dist/matbea-ui.es.js.map +1 -0
- package/dist/types/index.d.ts +330 -0
- package/package.json +23 -13
- package/dist/fonts/ProximaNova-Bold.woff2 +0 -0
- package/dist/fonts/ProximaNova-RegularIt.woff2 +0 -0
- package/dist/fonts/ProximaNova-Semibold.woff2 +0 -0
- package/dist/matbea-ui.cjs10.js +0 -1
- package/dist/matbea-ui.cjs11.js +0 -1
- package/dist/matbea-ui.cjs12.js +0 -1
- package/dist/matbea-ui.cjs13.js +0 -1
- package/dist/matbea-ui.cjs14.js +0 -1
- package/dist/matbea-ui.cjs15.js +0 -1
- package/dist/matbea-ui.cjs16.js +0 -1
- package/dist/matbea-ui.cjs17.js +0 -1
- package/dist/matbea-ui.cjs18.js +0 -1
- package/dist/matbea-ui.cjs19.js +0 -1
- package/dist/matbea-ui.cjs2.js +0 -1
- package/dist/matbea-ui.cjs20.js +0 -1
- package/dist/matbea-ui.cjs21.js +0 -1
- package/dist/matbea-ui.cjs22.js +0 -1
- package/dist/matbea-ui.cjs23.js +0 -1
- package/dist/matbea-ui.cjs24.js +0 -1
- package/dist/matbea-ui.cjs25.js +0 -1
- package/dist/matbea-ui.cjs26.js +0 -1
- package/dist/matbea-ui.cjs27.js +0 -1
- package/dist/matbea-ui.cjs28.js +0 -1
- package/dist/matbea-ui.cjs29.js +0 -1
- package/dist/matbea-ui.cjs3.js +0 -1
- package/dist/matbea-ui.cjs30.js +0 -1
- package/dist/matbea-ui.cjs31.js +0 -1
- package/dist/matbea-ui.cjs32.js +0 -63
- package/dist/matbea-ui.cjs33.js +0 -34
- package/dist/matbea-ui.cjs34.js +0 -44
- package/dist/matbea-ui.cjs35.js +0 -1
- package/dist/matbea-ui.cjs36.js +0 -11
- package/dist/matbea-ui.cjs37.js +0 -71
- package/dist/matbea-ui.cjs38.js +0 -14
- package/dist/matbea-ui.cjs39.js +0 -11
- package/dist/matbea-ui.cjs4.js +0 -1
- package/dist/matbea-ui.cjs40.js +0 -1
- package/dist/matbea-ui.cjs41.js +0 -1
- package/dist/matbea-ui.cjs42.js +0 -37
- package/dist/matbea-ui.cjs43.js +0 -62
- package/dist/matbea-ui.cjs44.js +0 -102
- package/dist/matbea-ui.cjs45.js +0 -103
- package/dist/matbea-ui.cjs46.js +0 -7
- package/dist/matbea-ui.cjs47.js +0 -1
- package/dist/matbea-ui.cjs48.js +0 -1
- package/dist/matbea-ui.cjs49.js +0 -55
- package/dist/matbea-ui.cjs5.js +0 -1
- package/dist/matbea-ui.cjs50.js +0 -23
- package/dist/matbea-ui.cjs51.js +0 -38
- package/dist/matbea-ui.cjs52.js +0 -51
- package/dist/matbea-ui.cjs53.js +0 -1
- package/dist/matbea-ui.cjs54.js +0 -1
- package/dist/matbea-ui.cjs55.js +0 -27
- package/dist/matbea-ui.cjs56.js +0 -48
- package/dist/matbea-ui.cjs57.js +0 -1
- package/dist/matbea-ui.cjs58.js +0 -1
- package/dist/matbea-ui.cjs59.js +0 -1
- package/dist/matbea-ui.cjs6.js +0 -1
- package/dist/matbea-ui.cjs60.js +0 -34
- package/dist/matbea-ui.cjs61.js +0 -11
- package/dist/matbea-ui.cjs62.js +0 -24
- package/dist/matbea-ui.cjs63.js +0 -27
- package/dist/matbea-ui.cjs64.js +0 -29
- package/dist/matbea-ui.cjs65.js +0 -1
- package/dist/matbea-ui.cjs66.js +0 -20
- package/dist/matbea-ui.cjs67.js +0 -1
- package/dist/matbea-ui.cjs68.js +0 -1
- package/dist/matbea-ui.cjs69.js +0 -1
- package/dist/matbea-ui.cjs7.js +0 -1
- package/dist/matbea-ui.cjs70.js +0 -6
- package/dist/matbea-ui.cjs71.js +0 -6
- package/dist/matbea-ui.cjs72.js +0 -1
- package/dist/matbea-ui.cjs73.js +0 -1
- package/dist/matbea-ui.cjs74.js +0 -1
- package/dist/matbea-ui.cjs75.js +0 -1
- package/dist/matbea-ui.cjs8.js +0 -1
- package/dist/matbea-ui.cjs9.js +0 -1
- package/dist/matbea-ui.es10.js +0 -10
- package/dist/matbea-ui.es11.js +0 -47
- package/dist/matbea-ui.es12.js +0 -178
- package/dist/matbea-ui.es13.js +0 -188
- package/dist/matbea-ui.es14.js +0 -12
- package/dist/matbea-ui.es15.js +0 -31
- package/dist/matbea-ui.es16.js +0 -25
- package/dist/matbea-ui.es17.js +0 -40
- package/dist/matbea-ui.es18.js +0 -43
- package/dist/matbea-ui.es19.js +0 -59
- package/dist/matbea-ui.es2.js +0 -38
- package/dist/matbea-ui.es20.js +0 -25
- package/dist/matbea-ui.es21.js +0 -13
- package/dist/matbea-ui.es22.js +0 -33
- package/dist/matbea-ui.es23.js +0 -16
- package/dist/matbea-ui.es24.js +0 -25
- package/dist/matbea-ui.es25.js +0 -36
- package/dist/matbea-ui.es26.js +0 -29
- package/dist/matbea-ui.es27.js +0 -30
- package/dist/matbea-ui.es28.js +0 -20
- package/dist/matbea-ui.es29.js +0 -13
- package/dist/matbea-ui.es3.js +0 -24
- package/dist/matbea-ui.es30.js +0 -41
- package/dist/matbea-ui.es31.js +0 -5
- package/dist/matbea-ui.es32.js +0 -163
- package/dist/matbea-ui.es33.js +0 -40
- package/dist/matbea-ui.es34.js +0 -330
- package/dist/matbea-ui.es35.js +0 -15
- package/dist/matbea-ui.es36.js +0 -26
- package/dist/matbea-ui.es37.js +0 -85
- package/dist/matbea-ui.es38.js +0 -18
- package/dist/matbea-ui.es39.js +0 -18
- package/dist/matbea-ui.es4.js +0 -31
- package/dist/matbea-ui.es40.js +0 -24
- package/dist/matbea-ui.es41.js +0 -10
- package/dist/matbea-ui.es42.js +0 -42
- package/dist/matbea-ui.es43.js +0 -70
- package/dist/matbea-ui.es44.js +0 -119
- package/dist/matbea-ui.es45.js +0 -131
- package/dist/matbea-ui.es46.js +0 -13
- package/dist/matbea-ui.es47.js +0 -25
- package/dist/matbea-ui.es48.js +0 -34
- package/dist/matbea-ui.es49.js +0 -64
- package/dist/matbea-ui.es5.js +0 -19
- package/dist/matbea-ui.es50.js +0 -39
- package/dist/matbea-ui.es51.js +0 -44
- package/dist/matbea-ui.es52.js +0 -58
- package/dist/matbea-ui.es53.js +0 -17
- package/dist/matbea-ui.es54.js +0 -26
- package/dist/matbea-ui.es55.js +0 -58
- package/dist/matbea-ui.es56.js +0 -62
- package/dist/matbea-ui.es57.js +0 -12
- package/dist/matbea-ui.es58.js +0 -12
- package/dist/matbea-ui.es59.js +0 -15
- package/dist/matbea-ui.es6.js +0 -62
- package/dist/matbea-ui.es60.js +0 -74
- package/dist/matbea-ui.es61.js +0 -17
- package/dist/matbea-ui.es62.js +0 -55
- package/dist/matbea-ui.es63.js +0 -57
- package/dist/matbea-ui.es64.js +0 -59
- package/dist/matbea-ui.es65.js +0 -21
- package/dist/matbea-ui.es66.js +0 -34
- package/dist/matbea-ui.es67.js +0 -10
- package/dist/matbea-ui.es68.js +0 -4
- package/dist/matbea-ui.es69.js +0 -26
- package/dist/matbea-ui.es7.js +0 -5
- package/dist/matbea-ui.es70.js +0 -236
- package/dist/matbea-ui.es71.js +0 -10
- package/dist/matbea-ui.es72.js +0 -9
- package/dist/matbea-ui.es73.js +0 -12
- package/dist/matbea-ui.es74.js +0 -4
- package/dist/matbea-ui.es75.js +0 -4
- package/dist/matbea-ui.es8.js +0 -6
- package/dist/matbea-ui.es9.js +0 -27
- package/dist/vite.svg +0 -1
package/dist/matbea-ui.es.js
CHANGED
|
@@ -1,60 +1,2258 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
v as ApplicationData,
|
|
31
|
-
G as ApplicationInfo,
|
|
32
|
-
K as ApplicationStatus,
|
|
33
|
-
O as BalanceRow,
|
|
34
|
-
t as Button,
|
|
35
|
-
E as Checkbox,
|
|
36
|
-
l as Container,
|
|
37
|
-
p as CopyTooltip,
|
|
38
|
-
s as Counter,
|
|
39
|
-
Q as CurrencyName,
|
|
40
|
-
W as CurrencyRate,
|
|
41
|
-
T as HamburgerButton,
|
|
42
|
-
a as Informer,
|
|
43
|
-
d as Loader,
|
|
44
|
-
U as Logo,
|
|
45
|
-
h as RadioButton,
|
|
46
|
-
Y as Requisites,
|
|
47
|
-
B as SelectField,
|
|
48
|
-
q as Switcher,
|
|
49
|
-
w as TabList,
|
|
50
|
-
I as Table,
|
|
51
|
-
n as TextField,
|
|
52
|
-
S as Tooltip,
|
|
53
|
-
_ as TransactionStatus,
|
|
54
|
-
f as Typography,
|
|
55
|
-
L as UserAccount,
|
|
56
|
-
oo as copyToClipboard,
|
|
57
|
-
ro as formatCardNumber,
|
|
58
|
-
to as maskEmail,
|
|
59
|
-
po as theme
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import styled, { css, styled as styled$1, keyframes } from 'styled-components';
|
|
3
|
+
import { useState, forwardRef, useCallback, useId, useRef, useMemo, useLayoutEffect, useEffect } from 'react';
|
|
4
|
+
|
|
5
|
+
const sizeMap = {
|
|
6
|
+
default: {
|
|
7
|
+
padding: "15px 22px",
|
|
8
|
+
minHeight: "48px",
|
|
9
|
+
fontSize: "15px",
|
|
10
|
+
lineHeight: "18px",
|
|
11
|
+
gap: "10px",
|
|
12
|
+
iconGap: "6px",
|
|
13
|
+
},
|
|
14
|
+
medium: {
|
|
15
|
+
padding: "12px 16px",
|
|
16
|
+
minHeight: "42px",
|
|
17
|
+
fontSize: "15px",
|
|
18
|
+
lineHeight: "18px",
|
|
19
|
+
gap: "10px",
|
|
20
|
+
iconGap: "6px",
|
|
21
|
+
},
|
|
22
|
+
small: {
|
|
23
|
+
padding: "10px",
|
|
24
|
+
minHeight: "36px",
|
|
25
|
+
fontSize: "14px",
|
|
26
|
+
lineHeight: "17px",
|
|
27
|
+
gap: "4px",
|
|
28
|
+
iconGap: "4px",
|
|
29
|
+
},
|
|
60
30
|
};
|
|
31
|
+
const getVariantStyles$1 = (variant) => {
|
|
32
|
+
return ({ theme }) => {
|
|
33
|
+
const colors = theme.colors;
|
|
34
|
+
const palette = {
|
|
35
|
+
primary: {
|
|
36
|
+
default: {
|
|
37
|
+
bg: colors.primary.primaryBlue,
|
|
38
|
+
color: colors.primary.white,
|
|
39
|
+
border: colors.primary.primaryBlue,
|
|
40
|
+
},
|
|
41
|
+
hover: {
|
|
42
|
+
bg: colors.primary.hoverBlue,
|
|
43
|
+
color: colors.primary.white,
|
|
44
|
+
border: colors.primary.hoverBlue,
|
|
45
|
+
},
|
|
46
|
+
active: {
|
|
47
|
+
bg: colors.primary.activeBlue,
|
|
48
|
+
color: colors.primary.white,
|
|
49
|
+
border: colors.primary.activeBlue,
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
bg: colors.gray.lightGray2,
|
|
53
|
+
color: colors.gray.darkGray,
|
|
54
|
+
border: colors.gray.lightGray2,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
secondary: {
|
|
58
|
+
default: {
|
|
59
|
+
bg: "transparent",
|
|
60
|
+
color: colors.primary.primaryBlue,
|
|
61
|
+
border: colors.primary.primaryBlue,
|
|
62
|
+
},
|
|
63
|
+
hover: {
|
|
64
|
+
bg: colors.primary.primaryBlue,
|
|
65
|
+
color: colors.primary.white,
|
|
66
|
+
border: colors.primary.primaryBlue,
|
|
67
|
+
},
|
|
68
|
+
active: {
|
|
69
|
+
bg: colors.primary.activeBlue,
|
|
70
|
+
color: colors.primary.white,
|
|
71
|
+
border: colors.primary.activeBlue,
|
|
72
|
+
},
|
|
73
|
+
disabled: {
|
|
74
|
+
bg: "transparent",
|
|
75
|
+
color: colors.gray.darkGray,
|
|
76
|
+
border: colors.gray.lightGray2,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
tertiary: {
|
|
80
|
+
default: {
|
|
81
|
+
bg: "transparent",
|
|
82
|
+
color: colors.primary.primaryBlue,
|
|
83
|
+
border: "transparent",
|
|
84
|
+
},
|
|
85
|
+
hover: {
|
|
86
|
+
bg: colors.gray.lightBlueGray,
|
|
87
|
+
color: colors.primary.primaryBlue,
|
|
88
|
+
border: "transparent",
|
|
89
|
+
},
|
|
90
|
+
active: {
|
|
91
|
+
bg: colors.gray.lightBlueGray2,
|
|
92
|
+
color: colors.primary.primaryBlue,
|
|
93
|
+
border: "transparent",
|
|
94
|
+
},
|
|
95
|
+
disabled: {
|
|
96
|
+
bg: "transparent",
|
|
97
|
+
color: colors.gray.darkGray,
|
|
98
|
+
border: "transparent",
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
const tokens = palette[variant];
|
|
103
|
+
return css `
|
|
104
|
+
background-color: ${tokens.default.bg};
|
|
105
|
+
color: ${tokens.default.color};
|
|
106
|
+
border-color: ${tokens.default.border};
|
|
107
|
+
|
|
108
|
+
&:hover:not(:disabled) {
|
|
109
|
+
background-color: ${tokens.hover.bg};
|
|
110
|
+
color: ${tokens.hover.color};
|
|
111
|
+
border-color: ${tokens.hover.border};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&:active:not(:disabled) {
|
|
115
|
+
background-color: ${tokens.active.bg};
|
|
116
|
+
color: ${tokens.active.color};
|
|
117
|
+
border-color: ${tokens.active.border};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&:disabled {
|
|
121
|
+
background-color: ${tokens.disabled.bg};
|
|
122
|
+
color: ${tokens.disabled.color};
|
|
123
|
+
border-color: ${tokens.disabled.border};
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const StyledButton = styled.button `
|
|
129
|
+
display: inline-flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
border: 1px solid transparent;
|
|
133
|
+
border-radius: ${({ $form }) => $form === "brick-right" ? "0 5px 5px 0" : "5px"};
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
transition: background-color 0.15s ease, border-color 0.15s ease,
|
|
136
|
+
color 0.15s ease, opacity 0.15s ease;
|
|
137
|
+
font-weight: 600;
|
|
138
|
+
|
|
139
|
+
${({ $size }) => css `
|
|
140
|
+
padding: ${sizeMap[$size].padding};
|
|
141
|
+
min-height: ${sizeMap[$size].minHeight};
|
|
142
|
+
font-size: ${sizeMap[$size].fontSize};
|
|
143
|
+
line-height: ${sizeMap[$size].lineHeight};
|
|
144
|
+
`}
|
|
145
|
+
|
|
146
|
+
${({ $hasIcon, $iconOnly, $size }) => css `
|
|
147
|
+
gap: ${$iconOnly
|
|
148
|
+
? "0"
|
|
149
|
+
: $hasIcon
|
|
150
|
+
? sizeMap[$size].iconGap
|
|
151
|
+
: sizeMap[$size].gap};
|
|
152
|
+
`}
|
|
153
|
+
|
|
154
|
+
${({ $fullWidth }) => $fullWidth &&
|
|
155
|
+
css `
|
|
156
|
+
width: 100%;
|
|
157
|
+
`}
|
|
158
|
+
|
|
159
|
+
${({ $variant }) => getVariantStyles$1($variant)}
|
|
160
|
+
|
|
161
|
+
&:disabled {
|
|
162
|
+
cursor: not-allowed;
|
|
163
|
+
}
|
|
164
|
+
`;
|
|
165
|
+
const IconSlot = styled.span `
|
|
166
|
+
display: inline-flex;
|
|
167
|
+
align-items: center;
|
|
168
|
+
justify-content: center;
|
|
169
|
+
line-height: 0;
|
|
170
|
+
${({ $iconOnly }) => $iconOnly &&
|
|
171
|
+
css `
|
|
172
|
+
width: 18px;
|
|
173
|
+
height: 18px;
|
|
174
|
+
`}
|
|
175
|
+
`;
|
|
176
|
+
|
|
177
|
+
const Button = ({ variant = "primary", size = "default", form = "default", fullWidth = false, icon, iconPosition = "left", children, disabled, ...rest }) => {
|
|
178
|
+
const hasText = Boolean(children);
|
|
179
|
+
const iconOnly = !!icon && (!hasText || iconPosition === "only");
|
|
180
|
+
const showLeftIcon = !!icon && !iconOnly && iconPosition === "left";
|
|
181
|
+
const showRightIcon = !!icon && !iconOnly && iconPosition === "right";
|
|
182
|
+
return (jsxs(StyledButton, { type: "button", "$variant": variant, "$size": size, "$form": form, "$fullWidth": fullWidth, "$hasIcon": !!icon && hasText, "$iconOnly": iconOnly, disabled: disabled, ...rest, children: [showLeftIcon && jsx(IconSlot, { "$iconOnly": false, children: icon }), (!iconOnly || !icon) && children, iconOnly && icon && jsx(IconSlot, { "$iconOnly": true, children: icon }), showRightIcon && jsx(IconSlot, { "$iconOnly": false, children: icon })] }));
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const Wrapper$2 = styled$1.div `
|
|
186
|
+
position: relative;
|
|
187
|
+
display: inline-flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
cursor: pointer;
|
|
190
|
+
`;
|
|
191
|
+
const Trigger = styled$1.button `
|
|
192
|
+
border: none;
|
|
193
|
+
background: transparent;
|
|
194
|
+
padding: 4px 8px;
|
|
195
|
+
font: inherit;
|
|
196
|
+
color: inherit;
|
|
197
|
+
cursor: pointer;
|
|
198
|
+
`;
|
|
199
|
+
const Bubble = styled$1.span `
|
|
200
|
+
position: absolute;
|
|
201
|
+
bottom: 100%;
|
|
202
|
+
left: 50%;
|
|
203
|
+
transform: translate(-50%, -6px);
|
|
204
|
+
white-space: nowrap;
|
|
205
|
+
background: rgba(0, 0, 0, 0.85);
|
|
206
|
+
color: #fff;
|
|
207
|
+
font-size: 12px;
|
|
208
|
+
padding: 4px 8px;
|
|
209
|
+
border-radius: 4px;
|
|
210
|
+
opacity: 0;
|
|
211
|
+
pointer-events: none;
|
|
212
|
+
transition: opacity 0.15s ease, transform 0.15s ease;
|
|
213
|
+
|
|
214
|
+
${Wrapper$2}:hover &,
|
|
215
|
+
${Wrapper$2}:focus-within &,
|
|
216
|
+
${Wrapper$2}:active & {
|
|
217
|
+
opacity: 1;
|
|
218
|
+
transform: translate(-50%, -10px);
|
|
219
|
+
}
|
|
220
|
+
`;
|
|
221
|
+
|
|
222
|
+
const CopyTooltip = ({ label, children, copiedText = "Скопировано!", copyDuration = 1500, }) => {
|
|
223
|
+
const [copied, setCopied] = useState(false);
|
|
224
|
+
const handleCopy = async () => {
|
|
225
|
+
try {
|
|
226
|
+
await navigator.clipboard.writeText(label);
|
|
227
|
+
setCopied(true);
|
|
228
|
+
setTimeout(() => setCopied(false), copyDuration);
|
|
229
|
+
}
|
|
230
|
+
catch (err) {
|
|
231
|
+
console.error("Copy failed", err);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
return (jsxs(Wrapper$2, { onClick: handleCopy, children: [children ?? jsx(Trigger, { type: "button", children: label }), jsx(Bubble, { children: copied ? copiedText : label })] }));
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const weights = {
|
|
238
|
+
regular: 400,
|
|
239
|
+
semibold: 600,
|
|
240
|
+
bold: 700,
|
|
241
|
+
};
|
|
242
|
+
const variantMap = {
|
|
243
|
+
h1: {
|
|
244
|
+
mobile: {
|
|
245
|
+
fontSize: "26px",
|
|
246
|
+
lineHeight: "32px",
|
|
247
|
+
fontWeight: weights.semibold,
|
|
248
|
+
},
|
|
249
|
+
tablet: {
|
|
250
|
+
fontSize: "34px",
|
|
251
|
+
lineHeight: "42px",
|
|
252
|
+
fontWeight: weights.semibold,
|
|
253
|
+
},
|
|
254
|
+
desktop: {
|
|
255
|
+
fontSize: "44px",
|
|
256
|
+
lineHeight: "54px",
|
|
257
|
+
fontWeight: weights.semibold,
|
|
258
|
+
textTransform: "uppercase",
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
h2: {
|
|
262
|
+
mobile: {
|
|
263
|
+
fontSize: "22px",
|
|
264
|
+
lineHeight: "28px",
|
|
265
|
+
fontWeight: weights.semibold,
|
|
266
|
+
},
|
|
267
|
+
tablet: {
|
|
268
|
+
fontSize: "30px",
|
|
269
|
+
lineHeight: "37px",
|
|
270
|
+
fontWeight: weights.semibold,
|
|
271
|
+
},
|
|
272
|
+
desktop: {
|
|
273
|
+
fontSize: "32px",
|
|
274
|
+
lineHeight: "40px",
|
|
275
|
+
fontWeight: weights.semibold,
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
h3: {
|
|
279
|
+
mobile: {
|
|
280
|
+
fontSize: "20px",
|
|
281
|
+
lineHeight: "24px",
|
|
282
|
+
fontWeight: weights.semibold,
|
|
283
|
+
},
|
|
284
|
+
tablet: {
|
|
285
|
+
fontSize: "28px",
|
|
286
|
+
lineHeight: "34px",
|
|
287
|
+
fontWeight: weights.semibold,
|
|
288
|
+
},
|
|
289
|
+
desktop: {
|
|
290
|
+
fontSize: "30px",
|
|
291
|
+
lineHeight: "38px",
|
|
292
|
+
fontWeight: weights.semibold,
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
h4: {
|
|
296
|
+
mobile: {
|
|
297
|
+
fontSize: "18px",
|
|
298
|
+
lineHeight: "22px",
|
|
299
|
+
fontWeight: weights.semibold,
|
|
300
|
+
},
|
|
301
|
+
tablet: {
|
|
302
|
+
fontSize: "24px",
|
|
303
|
+
lineHeight: "30px",
|
|
304
|
+
fontWeight: weights.semibold,
|
|
305
|
+
},
|
|
306
|
+
desktop: {
|
|
307
|
+
fontSize: "24px",
|
|
308
|
+
lineHeight: "30px",
|
|
309
|
+
fontWeight: weights.semibold,
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
h5: {
|
|
313
|
+
mobile: {
|
|
314
|
+
fontSize: "16px",
|
|
315
|
+
lineHeight: "20px",
|
|
316
|
+
fontWeight: weights.semibold,
|
|
317
|
+
},
|
|
318
|
+
tablet: {
|
|
319
|
+
fontSize: "20px",
|
|
320
|
+
lineHeight: "24px",
|
|
321
|
+
fontWeight: weights.semibold,
|
|
322
|
+
},
|
|
323
|
+
desktop: {
|
|
324
|
+
fontSize: "20px",
|
|
325
|
+
lineHeight: "24px",
|
|
326
|
+
fontWeight: weights.semibold,
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
"body-xl-semibold": {
|
|
330
|
+
mobile: {
|
|
331
|
+
fontSize: "18px",
|
|
332
|
+
lineHeight: "22px",
|
|
333
|
+
fontWeight: weights.semibold,
|
|
334
|
+
},
|
|
335
|
+
tablet: {
|
|
336
|
+
fontSize: "22px",
|
|
337
|
+
lineHeight: "28px",
|
|
338
|
+
fontWeight: weights.semibold,
|
|
339
|
+
},
|
|
340
|
+
desktop: {
|
|
341
|
+
fontSize: "24px",
|
|
342
|
+
lineHeight: "30px",
|
|
343
|
+
fontWeight: weights.semibold,
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
"body-xl": {
|
|
347
|
+
mobile: {
|
|
348
|
+
fontSize: "18px",
|
|
349
|
+
lineHeight: "22px",
|
|
350
|
+
fontWeight: weights.regular,
|
|
351
|
+
},
|
|
352
|
+
tablet: {
|
|
353
|
+
fontSize: "22px",
|
|
354
|
+
lineHeight: "28px",
|
|
355
|
+
fontWeight: weights.regular,
|
|
356
|
+
},
|
|
357
|
+
desktop: {
|
|
358
|
+
fontSize: "24px",
|
|
359
|
+
lineHeight: "30px",
|
|
360
|
+
fontWeight: weights.regular,
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
"body-l-semibold": {
|
|
364
|
+
mobile: {
|
|
365
|
+
fontSize: "16px",
|
|
366
|
+
lineHeight: "19px",
|
|
367
|
+
fontWeight: weights.semibold,
|
|
368
|
+
},
|
|
369
|
+
tablet: {
|
|
370
|
+
fontSize: "18px",
|
|
371
|
+
lineHeight: "22px",
|
|
372
|
+
fontWeight: weights.semibold,
|
|
373
|
+
},
|
|
374
|
+
desktop: {
|
|
375
|
+
fontSize: "18px",
|
|
376
|
+
lineHeight: "22px",
|
|
377
|
+
fontWeight: weights.semibold,
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
"body-l": {
|
|
381
|
+
mobile: {
|
|
382
|
+
fontSize: "16px",
|
|
383
|
+
lineHeight: "19px",
|
|
384
|
+
fontWeight: weights.regular,
|
|
385
|
+
},
|
|
386
|
+
tablet: {
|
|
387
|
+
fontSize: "18px",
|
|
388
|
+
lineHeight: "22px",
|
|
389
|
+
fontWeight: weights.regular,
|
|
390
|
+
},
|
|
391
|
+
desktop: {
|
|
392
|
+
fontSize: "18px",
|
|
393
|
+
lineHeight: "22px",
|
|
394
|
+
fontWeight: weights.regular,
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
"body-m-bold": {
|
|
398
|
+
mobile: {
|
|
399
|
+
fontSize: "14px",
|
|
400
|
+
lineHeight: "17px",
|
|
401
|
+
fontWeight: weights.bold,
|
|
402
|
+
},
|
|
403
|
+
tablet: {
|
|
404
|
+
fontSize: "16px",
|
|
405
|
+
lineHeight: "20px",
|
|
406
|
+
fontWeight: weights.bold,
|
|
407
|
+
},
|
|
408
|
+
desktop: {
|
|
409
|
+
fontSize: "16px",
|
|
410
|
+
lineHeight: "20px",
|
|
411
|
+
fontWeight: weights.bold,
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
"body-m-semibold": {
|
|
415
|
+
mobile: {
|
|
416
|
+
fontSize: "14px",
|
|
417
|
+
lineHeight: "17px",
|
|
418
|
+
fontWeight: weights.semibold,
|
|
419
|
+
},
|
|
420
|
+
tablet: {
|
|
421
|
+
fontSize: "16px",
|
|
422
|
+
lineHeight: "20px",
|
|
423
|
+
fontWeight: weights.semibold,
|
|
424
|
+
},
|
|
425
|
+
desktop: {
|
|
426
|
+
fontSize: "16px",
|
|
427
|
+
lineHeight: "20px",
|
|
428
|
+
fontWeight: weights.semibold,
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
"body-m": {
|
|
432
|
+
mobile: {
|
|
433
|
+
fontSize: "14px",
|
|
434
|
+
lineHeight: "17px",
|
|
435
|
+
fontWeight: weights.regular,
|
|
436
|
+
},
|
|
437
|
+
tablet: {
|
|
438
|
+
fontSize: "16px",
|
|
439
|
+
lineHeight: "20px",
|
|
440
|
+
fontWeight: weights.regular,
|
|
441
|
+
},
|
|
442
|
+
desktop: {
|
|
443
|
+
fontSize: "16px",
|
|
444
|
+
lineHeight: "20px",
|
|
445
|
+
fontWeight: weights.regular,
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
"body-s-semibold": {
|
|
449
|
+
mobile: {
|
|
450
|
+
fontSize: "12px",
|
|
451
|
+
lineHeight: "15px",
|
|
452
|
+
fontWeight: weights.semibold,
|
|
453
|
+
},
|
|
454
|
+
tablet: {
|
|
455
|
+
fontSize: "14px",
|
|
456
|
+
lineHeight: "17px",
|
|
457
|
+
fontWeight: weights.semibold,
|
|
458
|
+
},
|
|
459
|
+
desktop: {
|
|
460
|
+
fontSize: "14px",
|
|
461
|
+
lineHeight: "17px",
|
|
462
|
+
fontWeight: weights.semibold,
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
"body-s": {
|
|
466
|
+
mobile: {
|
|
467
|
+
fontSize: "12px",
|
|
468
|
+
lineHeight: "15px",
|
|
469
|
+
fontWeight: weights.regular,
|
|
470
|
+
},
|
|
471
|
+
tablet: {
|
|
472
|
+
fontSize: "14px",
|
|
473
|
+
lineHeight: "17px",
|
|
474
|
+
fontWeight: weights.regular,
|
|
475
|
+
},
|
|
476
|
+
desktop: {
|
|
477
|
+
fontSize: "14px",
|
|
478
|
+
lineHeight: "17px",
|
|
479
|
+
fontWeight: weights.regular,
|
|
480
|
+
},
|
|
481
|
+
},
|
|
482
|
+
button: {
|
|
483
|
+
desktop: {
|
|
484
|
+
fontSize: "15px",
|
|
485
|
+
lineHeight: "18px",
|
|
486
|
+
fontWeight: weights.semibold,
|
|
487
|
+
},
|
|
488
|
+
},
|
|
489
|
+
"form-input": {
|
|
490
|
+
desktop: {
|
|
491
|
+
fontSize: "15px",
|
|
492
|
+
lineHeight: "18px",
|
|
493
|
+
fontWeight: weights.regular,
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
"avatar-basic": {
|
|
497
|
+
desktop: {
|
|
498
|
+
fontSize: "16px",
|
|
499
|
+
lineHeight: "18px",
|
|
500
|
+
fontWeight: weights.semibold,
|
|
501
|
+
},
|
|
502
|
+
},
|
|
503
|
+
"avatar-m": {
|
|
504
|
+
desktop: {
|
|
505
|
+
fontSize: "14px",
|
|
506
|
+
lineHeight: "16px",
|
|
507
|
+
fontWeight: weights.semibold,
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
"avatar-s": {
|
|
511
|
+
desktop: {
|
|
512
|
+
fontSize: "12px",
|
|
513
|
+
lineHeight: "14px",
|
|
514
|
+
fontWeight: weights.semibold,
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
};
|
|
518
|
+
const getVariantStyles = (variant) => {
|
|
519
|
+
const { mobile, tablet, desktop } = variantMap[variant];
|
|
520
|
+
return css `
|
|
521
|
+
${({ theme }) => css `
|
|
522
|
+
${css `
|
|
523
|
+
font-size: ${desktop.fontSize};
|
|
524
|
+
font-weight: ${desktop.fontWeight};
|
|
525
|
+
line-height: ${desktop.lineHeight};
|
|
526
|
+
`}
|
|
527
|
+
|
|
528
|
+
${tablet &&
|
|
529
|
+
css `
|
|
530
|
+
${theme.media.maxWidth.tablet} {
|
|
531
|
+
font-size: ${tablet.fontSize};
|
|
532
|
+
font-weight: ${tablet.fontWeight};
|
|
533
|
+
line-height: ${tablet.lineHeight};
|
|
534
|
+
}
|
|
535
|
+
`}
|
|
536
|
+
|
|
537
|
+
${mobile &&
|
|
538
|
+
css `
|
|
539
|
+
${theme.media.maxWidth.mobile} {
|
|
540
|
+
font-size: ${mobile.fontSize};
|
|
541
|
+
font-weight: ${mobile.fontWeight};
|
|
542
|
+
line-height: ${mobile.lineHeight};
|
|
543
|
+
}
|
|
544
|
+
`}
|
|
545
|
+
`}
|
|
546
|
+
`;
|
|
547
|
+
};
|
|
548
|
+
const StyledTypography = styled$1.span `
|
|
549
|
+
margin: 0;
|
|
550
|
+
color: ${({ $color }) => $color ?? "inherit"};
|
|
551
|
+
${({ $variant }) => getVariantStyles($variant)};
|
|
552
|
+
text-align: ${({ $align }) => $align ?? "inherit"};
|
|
553
|
+
${({ $inline }) => $inline
|
|
554
|
+
? css `
|
|
555
|
+
display: inline;
|
|
556
|
+
`
|
|
557
|
+
: css `
|
|
558
|
+
display: block;
|
|
559
|
+
`};
|
|
560
|
+
${({ $uppercase }) => $uppercase &&
|
|
561
|
+
css `
|
|
562
|
+
text-transform: uppercase;
|
|
563
|
+
letter-spacing: 0.04em;
|
|
564
|
+
`}
|
|
565
|
+
${({ $truncate }) => $truncate &&
|
|
566
|
+
css `
|
|
567
|
+
overflow: hidden;
|
|
568
|
+
text-overflow: ellipsis;
|
|
569
|
+
white-space: nowrap;
|
|
570
|
+
`}
|
|
571
|
+
`;
|
|
572
|
+
|
|
573
|
+
const Typography = ({ as = "span", forwardedAs, variant = "body-m-semibold", color, align, uppercase = false, truncate = false, inline = false, children, ...rest }) => (jsx(StyledTypography, { as: as, forwardedAs: forwardedAs, "$variant": variant, "$color": color, "$align": align, "$uppercase": uppercase, "$truncate": truncate, "$inline": inline, ...rest, children: children }));
|
|
574
|
+
|
|
575
|
+
const Icon = ({ size = 24, children, ...rest }) => {
|
|
576
|
+
return (jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: children }));
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
const CheckIcon$1 = (props) => (jsxs(Icon, { ...props, children: [jsx("circle", { cx: "12", cy: "12", r: "9", stroke: "#5E6F8D", "stroke-width": "2" }), jsx("path", { d: "M7 12L10.3333 15L17 9", stroke: "#5E6F8D", "stroke-width": "2" })] }));
|
|
580
|
+
|
|
581
|
+
const CloseIcon = (props) => (jsxs(Icon, { ...props, children: [jsxs("g", { "clip-path": "url(#clip0_487_8651)", children: [jsx("path", { d: "M4.99543 4.85076C5.38596 4.46024 6.01912 4.46024 6.40965 4.85076L19.265 17.7061C19.6555 18.0966 19.6555 18.7298 19.265 19.1203L19.0937 19.2916C18.7032 19.6821 18.07 19.6821 17.6795 19.2916L4.82414 6.43627C4.43362 6.04574 4.43362 5.41258 4.82414 5.02206L4.99543 4.85076Z", fill: "#9296A5" }), jsx("path", { d: "M4.85129 19.1203C4.46077 18.7298 4.46077 18.0966 4.85129 17.7061L17.7066 4.85075C18.0971 4.46023 18.7303 4.46023 19.1208 4.85075L19.2921 5.02205C19.6827 5.41257 19.6827 6.04574 19.2921 6.43626L6.4368 19.2916C6.04627 19.6821 5.41311 19.6821 5.02258 19.2916L4.85129 19.1203Z", fill: "#9296A5" })] }), jsx("defs", { children: jsx("clipPath", { id: "clip0_487_8651", children: jsx("rect", { width: "24", height: "24", fill: "white" }) }) })] }));
|
|
582
|
+
|
|
583
|
+
const HamburgerIcon = (props) => (jsxs(Icon, { ...props, children: [jsx("rect", { x: "3", y: "5", width: "18", height: "2", rx: "1", fill: "#9296A5" }), jsx("rect", { x: "3", y: "11", width: "18", height: "2", rx: "1", fill: "#9296A5" }), jsx("rect", { x: "3", y: "17", width: "18", height: "2", rx: "1", fill: "#9296A5" })] }));
|
|
584
|
+
|
|
585
|
+
const UserIcon = (props) => (jsxs(Icon, { ...props, children: [jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 15C15.3137 15 18 12.3137 18 9C18 5.68629 15.3137 3 12 3C8.68629 3 6 5.68629 6 9C6 12.3137 8.68629 15 12 15Z", fill: "#202D52" }), jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M12 15C8.13401 15 5 18.134 5 22H3C3 17.0294 7.02944 13 12 13C16.9706 13 21 17.0294 21 22H19C19 18.134 15.866 15 12 15Z", fill: "#202D52" })] }));
|
|
586
|
+
|
|
587
|
+
const ClockIcon = (props) => (jsx(Icon, { ...props, viewBox: "0 0 18 18", children: jsx("path", { d: "M9 16.5C4.85786 16.5 1.5 13.1421 1.5 9C1.5 4.85786 4.85786 1.5 9 1.5C13.1421 1.5 16.5 4.85786 16.5 9C16.4954 13.1402 13.1402 16.4954 9 16.5ZM9 3C5.68629 3 3 5.68629 3 9C3 12.3137 5.68629 15 9 15C12.3137 15 15 12.3137 15 9C14.9963 5.68783 12.3122 3.00372 9 3ZM12.75 9.75H8.25V5.25H9.75V8.25H12.75V9.75Z", fill: "#9296A5" }) }));
|
|
588
|
+
|
|
589
|
+
const CopyIcon = (props) => (jsx(Icon, { ...props, viewBox: "0 0 18 18", children: jsx("path", { d: "M10.4999 16.5H2.9999C2.59796 16.514 2.20826 16.3604 1.92387 16.076C1.63948 15.7916 1.48593 15.4019 1.4999 15V7.50001C1.48593 7.09807 1.63948 6.70837 1.92387 6.42399C2.20826 6.1396 2.59796 5.98605 2.9999 6.00002H5.9999V3.00002C5.98593 2.59807 6.13948 2.20837 6.42387 1.92399C6.70826 1.6396 7.09796 1.48605 7.49991 1.50002H14.9999C15.4018 1.48605 15.7915 1.6396 16.0759 1.92399C16.3603 2.20837 16.5139 2.59807 16.4999 3.00002V10.5C16.5136 10.9019 16.36 11.2915 16.0757 11.5758C15.7914 11.8601 15.4018 12.0137 14.9999 12H11.9999V15C12.0136 15.4019 11.86 15.7915 11.5757 16.0758C11.2914 16.3601 10.9018 16.5137 10.4999 16.5ZM2.9999 7.50001V15H10.4999V12H7.49991C7.09802 12.0137 6.70845 11.8601 6.42411 11.5758C6.13977 11.2915 5.98616 10.9019 5.9999 10.5V7.50001H2.9999ZM7.49991 3.00002V10.5H14.9999V3.00002H7.49991Z", fill: "#5E6F8D" }) }));
|
|
590
|
+
|
|
591
|
+
const InfoIcon = (props) => (jsxs(Icon, { ...props, viewBox: "0 0 18 18", children: [jsx("g", { "clip-path": "url(#clip0_309_1899)", children: jsx("path", { d: "M9 16.5C4.85786 16.5 1.5 13.1421 1.5 9C1.5 4.85786 4.85786 1.5 9 1.5C13.1421 1.5 16.5 4.85786 16.5 9C16.4955 13.1403 13.1403 16.4955 9 16.5ZM3 9.129C3.03549 12.4299 5.73083 15.0822 9.0319 15.0645C12.333 15.0467 14.9997 12.3656 14.9997 9.0645C14.9997 5.76338 12.333 3.08233 9.0319 3.0645C5.73083 3.04684 3.03549 5.69907 3 9V9.129ZM10.5 12.75H8.25V9.75H7.5V8.25H9.75V11.25H10.5V12.75ZM9.75 6.75H8.25V5.25H9.75V6.75Z", fill: props.color || "#9296A5" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_309_1899", children: jsx("rect", { width: "18", height: "18", fill: "white" }) }) })] }));
|
|
592
|
+
|
|
593
|
+
const SuccessfullSmallIcon = (props) => (jsx(Icon, { ...props, viewBox: "0 0 18 18", children: jsx("path", { d: "M9 16.5C4.85975 16.4954 1.50454 13.1402 1.5 9.00001V8.85001C1.58245 4.72841 4.97594 1.44598 9.09803 1.50067C13.2201 1.55537 16.5253 4.92668 16.4984 9.04899C16.4714 13.1714 13.1224 16.4992 9 16.5ZM5.5575 8.69251L4.5 9.75001L7.5 12.75L13.5 6.75001L12.4425 5.68501L7.5 10.6275L5.5575 8.69251Z", fill: "#1CD850" }) }));
|
|
594
|
+
|
|
595
|
+
const WarningIcon = (props) => (jsxs(Icon, { ...props, viewBox: "0 0 18 18", children: [jsx("path", { d: "M15.9495 15.7485H2.04978C1.78184 15.7485 1.53426 15.6056 1.40028 15.3735C1.26631 15.1415 1.26631 14.8556 1.40028 14.6235L8.3498 2.62349C8.4839 2.39183 8.73125 2.24918 8.99892 2.24918C9.2666 2.24918 9.51395 2.39183 9.64805 2.62349L16.5975 14.6235C16.7314 14.8554 16.7315 15.1412 16.5977 15.3731C16.464 15.6052 16.2166 15.7482 15.9488 15.7485H15.9495ZM9.00005 4.49849L3.35178 14.2485H14.6498L9.00005 4.49849ZM9.7463 11.2493H8.2463V7.49849H9.7463V11.2493Z", fill: "#FFA63E" }), jsx("path", { d: "M8.25 12H9.75V13.5H8.25V12Z", fill: "#FFA63E" })] }));
|
|
596
|
+
|
|
597
|
+
const WithdrawIcon = (props) => (jsxs(Icon, { ...props, viewBox: "0 0 18 18", children: [jsx("circle", { cx: "9", cy: "9", r: "9", fill: "#EFF2FB" }), jsx("path", { d: "M13 9L9 12L5 9", stroke: "#5E6F8D", "stroke-linecap": "round", "stroke-linejoin": "round" }), jsx("path", { d: "M13 6L9 9L5 6", stroke: "#5E6F8D", "stroke-linecap": "round", "stroke-linejoin": "round" })] }));
|
|
598
|
+
|
|
599
|
+
const InformerStyled = styled$1.div `
|
|
600
|
+
display: grid;
|
|
601
|
+
align-items: center;
|
|
602
|
+
grid-template-columns: ${({ $icon }) => ($icon ? "auto 1fr" : "1fr")};
|
|
603
|
+
gap: 12px;
|
|
604
|
+
width: 458px;
|
|
605
|
+
height: auto;
|
|
606
|
+
border-radius: 12px;
|
|
607
|
+
padding: 24px;
|
|
608
|
+
background-color: ${({ $type, theme }) => {
|
|
609
|
+
switch ($type) {
|
|
610
|
+
case "success":
|
|
611
|
+
return theme.colors.accent.green2Light;
|
|
612
|
+
case "error":
|
|
613
|
+
return theme.colors.accent.red;
|
|
614
|
+
case "info":
|
|
615
|
+
return theme.colors.primary.lightBlue2;
|
|
616
|
+
case "warning":
|
|
617
|
+
return theme.colors.accent.orange;
|
|
618
|
+
}
|
|
619
|
+
}};
|
|
620
|
+
`;
|
|
621
|
+
|
|
622
|
+
const Informer = ({ label, description, type, icon, }) => {
|
|
623
|
+
return (jsxs(InformerStyled, { "$icon": icon, "$type": type, children: [icon && jsx(InfoIcon, { size: 18, color: "#fff" }), label && (jsx(Typography, { color: "#fff", variant: "body-l-semibold", children: label })), icon && jsx("div", {}), description && (jsx(Typography, { color: "#fff", variant: "body-m-semibold", children: description }))] }));
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
const Wrapper$1 = styled$1.div `
|
|
627
|
+
display: flex;
|
|
628
|
+
flex-direction: column;
|
|
629
|
+
gap: 4px;
|
|
630
|
+
width: 100%;
|
|
631
|
+
`;
|
|
632
|
+
const Label$2 = styled$1(Typography).attrs({
|
|
633
|
+
variant: "form-input",
|
|
634
|
+
forwardedAs: "label",
|
|
635
|
+
}) `
|
|
636
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
637
|
+
`;
|
|
638
|
+
const FieldContainer$1 = styled$1.div `
|
|
639
|
+
display: flex;
|
|
640
|
+
align-items: center;
|
|
641
|
+
gap: 8px;
|
|
642
|
+
overflow: hidden;
|
|
643
|
+
height: 48px;
|
|
644
|
+
padding-left: 12px;
|
|
645
|
+
border-radius: 5px;
|
|
646
|
+
outline: 1px solid ${({ theme }) => theme.colors.gray.lightGray2};
|
|
647
|
+
outline-offset: -1px;
|
|
648
|
+
background: ${({ theme }) => theme.colors.primary.white};
|
|
649
|
+
width: 100%;
|
|
650
|
+
box-sizing: border-box;
|
|
651
|
+
transition: border-color 140ms ease;
|
|
652
|
+
|
|
653
|
+
${({ $disabled }) => $disabled &&
|
|
654
|
+
css `
|
|
655
|
+
opacity: 0.6;
|
|
656
|
+
cursor: not-allowed;
|
|
657
|
+
`}
|
|
658
|
+
|
|
659
|
+
${({ $hasError, theme }) => $hasError &&
|
|
660
|
+
css `
|
|
661
|
+
outline-color: ${theme.colors.accent.red};
|
|
662
|
+
`}
|
|
663
|
+
|
|
664
|
+
&:hover {
|
|
665
|
+
outline-color: ${({ theme, $hasError }) => $hasError ? theme.colors.accent.red : theme.colors.primary.lightBlue2};
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
&[data-state="active"] {
|
|
669
|
+
outline-color: ${({ theme, $hasError }) => $hasError ? theme.colors.accent.red : theme.colors.primary.primaryBlue};
|
|
670
|
+
}
|
|
671
|
+
`;
|
|
672
|
+
const LeadingIcon$1 = styled$1.span `
|
|
673
|
+
display: inline-flex;
|
|
674
|
+
width: 24px;
|
|
675
|
+
height: 24px;
|
|
676
|
+
`;
|
|
677
|
+
const ActionSlot = styled$1.span `
|
|
678
|
+
display: inline-flex;
|
|
679
|
+
align-items: center;
|
|
680
|
+
justify-content: center;
|
|
681
|
+
min-width: 48px;
|
|
682
|
+
& > button {
|
|
683
|
+
border-radius: 0px;
|
|
684
|
+
}
|
|
685
|
+
`;
|
|
686
|
+
const Input = styled$1.input `
|
|
687
|
+
flex: 1;
|
|
688
|
+
border: none;
|
|
689
|
+
outline: none;
|
|
690
|
+
background: transparent;
|
|
691
|
+
font-family: "Proxima Nova", sans-serif;
|
|
692
|
+
padding-right: 12px;
|
|
693
|
+
height: 100%;
|
|
694
|
+
font-size: 15px;
|
|
695
|
+
line-height: 18px;
|
|
696
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
697
|
+
|
|
698
|
+
&::placeholder {
|
|
699
|
+
color: ${({ theme }) => theme.colors.gray.darkGray};
|
|
700
|
+
}
|
|
701
|
+
`;
|
|
702
|
+
const ErrorText$1 = styled$1.span `
|
|
703
|
+
font-family: "Proxima Nova", sans-serif;
|
|
704
|
+
font-size: 15px;
|
|
705
|
+
line-height: 18px;
|
|
706
|
+
color: ${({ theme }) => theme.colors.accent.red};
|
|
707
|
+
`;
|
|
708
|
+
|
|
709
|
+
const TextField = forwardRef(({ value, defaultValue, placeholder = "Text", label, error, disabled = false, icon, action, name, type = "text", onChange, onFocus, onBlur, className, }, ref) => {
|
|
710
|
+
const [focused, setFocused] = useState(false);
|
|
711
|
+
const hasError = Boolean(error);
|
|
712
|
+
const handleFocus = (evt) => {
|
|
713
|
+
setFocused(true);
|
|
714
|
+
onFocus?.(evt);
|
|
715
|
+
};
|
|
716
|
+
const handleBlur = (evt) => {
|
|
717
|
+
setFocused(false);
|
|
718
|
+
onBlur?.(evt);
|
|
719
|
+
};
|
|
720
|
+
return (jsxs(Wrapper$1, { className: className, children: [label && jsx(Label$2, { children: label }), jsxs(FieldContainer$1, { "$hasError": hasError, "$disabled": disabled, "data-state": hasError ? "error" : focused ? "active" : undefined, children: [icon && jsx(LeadingIcon$1, { children: icon }), jsx(Input, { ref: ref, type: type, name: name, value: value, defaultValue: defaultValue, placeholder: placeholder, disabled: disabled, onChange: onChange, onFocus: handleFocus, onBlur: handleBlur }), action && jsx(ActionSlot, { children: action })] }), error && jsx(ErrorText$1, { children: error })] }));
|
|
721
|
+
});
|
|
722
|
+
TextField.displayName = "TextField";
|
|
723
|
+
|
|
724
|
+
const ContainerStyled = styled$1.div `
|
|
725
|
+
display: flex;
|
|
726
|
+
flex-direction: column;
|
|
727
|
+
width: 100%;
|
|
728
|
+
padding: 24px 28px;
|
|
729
|
+
background-color: ${({ theme }) => theme.colors.primary.white};
|
|
730
|
+
border-radius: 10px;
|
|
731
|
+
${({ theme }) => theme.media.maxWidth.tablet} {
|
|
732
|
+
padding: 24px 20px;
|
|
733
|
+
}
|
|
734
|
+
${({ theme }) => theme.media.maxWidth.mobile} {
|
|
735
|
+
padding: 16px;
|
|
736
|
+
}
|
|
737
|
+
`;
|
|
738
|
+
|
|
739
|
+
const Container = ContainerStyled;
|
|
740
|
+
|
|
741
|
+
const CounterStyled = styled$1(Typography).attrs({
|
|
742
|
+
forwardedAs: "div",
|
|
743
|
+
}) `
|
|
744
|
+
display: flex;
|
|
745
|
+
align-items: center;
|
|
746
|
+
justify-content: center;
|
|
747
|
+
padding: 0px;
|
|
748
|
+
width: 22px;
|
|
749
|
+
height: 22px;
|
|
750
|
+
border-radius: 50%;
|
|
751
|
+
color: #fff;
|
|
752
|
+
background-color: ${({ theme }) => theme.colors.primary.primaryBlue};
|
|
753
|
+
`;
|
|
754
|
+
|
|
755
|
+
const Counter = ({ count = 0 }) => {
|
|
756
|
+
return jsx(CounterStyled, { variant: "body-s-semibold", children: count });
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
const HamburgerButton = ({ open, onToggle, }) => {
|
|
760
|
+
const [internalOpen, setInternalOpen] = useState(false);
|
|
761
|
+
const isControlled = open !== undefined;
|
|
762
|
+
const isOpen = isControlled ? open : internalOpen;
|
|
763
|
+
const handleClick = useCallback(() => {
|
|
764
|
+
const next = !isOpen;
|
|
765
|
+
if (!isControlled) {
|
|
766
|
+
setInternalOpen(next);
|
|
767
|
+
}
|
|
768
|
+
onToggle?.(next);
|
|
769
|
+
}, [isControlled, isOpen, onToggle]);
|
|
770
|
+
return (jsx(Button, { iconPosition: "only", variant: "tertiary", icon: isOpen ? jsx(CloseIcon, {}) : jsx(HamburgerIcon, {}), size: "small", onClick: handleClick }));
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
const scaleDot = keyframes `
|
|
774
|
+
0% {
|
|
775
|
+
transform: scale(0.5);
|
|
776
|
+
}
|
|
777
|
+
25% {
|
|
778
|
+
transform: scale(1);
|
|
779
|
+
}
|
|
780
|
+
75% {
|
|
781
|
+
transform: scale(0.5);
|
|
782
|
+
}
|
|
783
|
+
100% {
|
|
784
|
+
transform: scale(0.5);
|
|
785
|
+
}
|
|
786
|
+
`;
|
|
787
|
+
const LoaderDots = styled$1.div `
|
|
788
|
+
display: flex;
|
|
789
|
+
`;
|
|
790
|
+
const LoaderDot = styled$1.div `
|
|
791
|
+
margin: 2px;
|
|
792
|
+
width: 6px;
|
|
793
|
+
height: 6px;
|
|
794
|
+
border-radius: 50%;
|
|
795
|
+
background-color: ${({ theme }) => theme.colors.primary.primaryBlue};
|
|
796
|
+
transform: scale(0.5);
|
|
797
|
+
animation: ${scaleDot} 1.2s ease-out infinite;
|
|
798
|
+
|
|
799
|
+
&:nth-of-type(2) {
|
|
800
|
+
animation-delay: 0.2s;
|
|
801
|
+
}
|
|
802
|
+
&:nth-of-type(3) {
|
|
803
|
+
animation-delay: 0.3s;
|
|
804
|
+
}
|
|
805
|
+
&:nth-of-type(4) {
|
|
806
|
+
animation-delay: 0.4s;
|
|
807
|
+
}
|
|
808
|
+
&:nth-of-type(5) {
|
|
809
|
+
animation-delay: 0.5s;
|
|
810
|
+
}
|
|
811
|
+
`;
|
|
812
|
+
|
|
813
|
+
const Loader = () => (jsxs(LoaderDots, { children: [jsx(LoaderDot, {}), jsx(LoaderDot, {}), jsx(LoaderDot, {})] }));
|
|
814
|
+
|
|
815
|
+
const RadioLabel = styled$1.label `
|
|
816
|
+
display: inline-flex;
|
|
817
|
+
align-items: center;
|
|
818
|
+
gap: 8px;
|
|
819
|
+
cursor: ${({ disabled }) => (disabled ? "not-allowed" : "pointer")};
|
|
820
|
+
`;
|
|
821
|
+
const HiddenInput$2 = styled$1.input `
|
|
822
|
+
position: absolute;
|
|
823
|
+
opacity: 0;
|
|
824
|
+
pointer-events: none;
|
|
825
|
+
`;
|
|
826
|
+
const VisualRadio = styled$1.span `
|
|
827
|
+
width: 16px;
|
|
828
|
+
height: 16px;
|
|
829
|
+
border-radius: 50%;
|
|
830
|
+
border: 2px solid ${({ theme }) => theme.colors.gray.darkGray2};
|
|
831
|
+
background-color: transparent;
|
|
832
|
+
transition: border-color 160ms ease, background-color 160ms ease;
|
|
833
|
+
position: relative;
|
|
834
|
+
display: inline-flex;
|
|
835
|
+
justify-content: center;
|
|
836
|
+
align-items: center;
|
|
837
|
+
|
|
838
|
+
${({ $checked, theme }) => $checked &&
|
|
839
|
+
css `
|
|
840
|
+
border-color: ${theme.colors.primary.primaryBlue};
|
|
841
|
+
&::after {
|
|
842
|
+
content: "";
|
|
843
|
+
width: 8px;
|
|
844
|
+
height: 8px;
|
|
845
|
+
border-radius: 50%;
|
|
846
|
+
background-color: ${theme.colors.primary.primaryBlue};
|
|
847
|
+
transition: background-color 160ms ease;
|
|
848
|
+
}
|
|
849
|
+
`}
|
|
850
|
+
|
|
851
|
+
${({ $checked, theme }) => !$checked &&
|
|
852
|
+
css `
|
|
853
|
+
&:hover {
|
|
854
|
+
border-color: ${theme.colors.primary.hoverBlue};
|
|
855
|
+
}
|
|
856
|
+
`}
|
|
857
|
+
|
|
858
|
+
${({ $checked, $disabled, theme }) => !$disabled &&
|
|
859
|
+
$checked &&
|
|
860
|
+
css `
|
|
861
|
+
&:hover {
|
|
862
|
+
border-color: ${theme.colors.primary.hoverBlue};
|
|
863
|
+
&::after {
|
|
864
|
+
background-color: ${theme.colors.primary.hoverBlue};
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
`}
|
|
868
|
+
|
|
869
|
+
${({ $disabled, theme }) => $disabled &&
|
|
870
|
+
css `
|
|
871
|
+
border-color: ${theme.colors.icon.iconSecondary};
|
|
872
|
+
background-color: ${theme.colors.gray.lightGray2};
|
|
873
|
+
&::after {
|
|
874
|
+
content: "";
|
|
875
|
+
width: 8px;
|
|
876
|
+
height: 8px;
|
|
877
|
+
border-radius: 50%;
|
|
878
|
+
background-color: ${theme.colors.icon.iconSecondary};
|
|
879
|
+
}
|
|
880
|
+
`}
|
|
881
|
+
`;
|
|
882
|
+
const LabelText = styled$1(Typography) `
|
|
883
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
884
|
+
`;
|
|
885
|
+
|
|
886
|
+
const RadioButton = ({ checked, defaultChecked = false, disabled = false, name, value, label, onChange, className, }) => {
|
|
887
|
+
const generatedId = useId();
|
|
888
|
+
const [innerChecked, setInnerChecked] = useState(defaultChecked);
|
|
889
|
+
const isControlled = checked !== undefined;
|
|
890
|
+
const isChecked = isControlled ? checked : innerChecked;
|
|
891
|
+
const handleChange = useCallback((e) => {
|
|
892
|
+
if (disabled)
|
|
893
|
+
return;
|
|
894
|
+
if (!isControlled) {
|
|
895
|
+
setInnerChecked(e.target.checked);
|
|
896
|
+
}
|
|
897
|
+
onChange?.(e.target.checked);
|
|
898
|
+
}, [disabled, isControlled, onChange]);
|
|
899
|
+
return (jsxs(RadioLabel, { className: className, htmlFor: generatedId, disabled: disabled, children: [jsx(HiddenInput$2, { id: generatedId, type: "radio", checked: isChecked, onChange: handleChange, disabled: disabled, name: name, value: value }), jsx(VisualRadio, { "$checked": isChecked, "$disabled": disabled }), label && jsx(LabelText, { variant: "button", children: label })] }));
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
const Wrapper = styled$1.div `
|
|
903
|
+
position: relative;
|
|
904
|
+
display: flex;
|
|
905
|
+
flex-direction: column;
|
|
906
|
+
gap: 12px;
|
|
907
|
+
width: 100%;
|
|
908
|
+
`;
|
|
909
|
+
const Label$1 = styled$1(Typography).attrs({
|
|
910
|
+
variant: "form-input",
|
|
911
|
+
forwardedAs: "label",
|
|
912
|
+
}) `
|
|
913
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
914
|
+
`;
|
|
915
|
+
const FieldContainer = styled$1.div `
|
|
916
|
+
display: flex;
|
|
917
|
+
align-items: center;
|
|
918
|
+
gap: 8px;
|
|
919
|
+
overflow: hidden;
|
|
920
|
+
height: 48px;
|
|
921
|
+
padding: 0 12px;
|
|
922
|
+
border-radius: 5px;
|
|
923
|
+
outline: 1px solid ${({ theme }) => theme.colors.gray.lightGray2};
|
|
924
|
+
outline-offset: -1px;
|
|
925
|
+
background: ${({ theme }) => theme.colors.primary.white};
|
|
926
|
+
width: 100%;
|
|
927
|
+
box-sizing: border-box;
|
|
928
|
+
transition: outline-color 140ms ease;
|
|
929
|
+
cursor: pointer;
|
|
930
|
+
|
|
931
|
+
${({ $disabled }) => $disabled &&
|
|
932
|
+
css `
|
|
933
|
+
opacity: 0.6;
|
|
934
|
+
cursor: not-allowed;
|
|
935
|
+
`}
|
|
936
|
+
|
|
937
|
+
${({ $hasError, theme }) => $hasError &&
|
|
938
|
+
css `
|
|
939
|
+
outline-color: ${theme.colors.accent.red};
|
|
940
|
+
`}
|
|
941
|
+
|
|
942
|
+
&:hover {
|
|
943
|
+
outline-color: ${({ theme, $hasError }) => $hasError ? theme.colors.accent.red : theme.colors.primary.lightBlue2};
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
&[data-state="active"] {
|
|
947
|
+
outline-color: ${({ theme, $hasError }) => $hasError ? theme.colors.accent.red : theme.colors.primary.primaryBlue};
|
|
948
|
+
}
|
|
949
|
+
`;
|
|
950
|
+
const LeadingIcon = styled$1.span `
|
|
951
|
+
display: inline-flex;
|
|
952
|
+
width: 24px;
|
|
953
|
+
height: 24px;
|
|
954
|
+
color: ${({ theme }) => theme.colors.primary.primaryBlue};
|
|
955
|
+
`;
|
|
956
|
+
const Value = styled$1.span `
|
|
957
|
+
flex: 1;
|
|
958
|
+
font-family: "Proxima Nova", sans-serif;
|
|
959
|
+
font-size: 15px;
|
|
960
|
+
line-height: 18px;
|
|
961
|
+
color: ${({ theme, $placeholder }) => $placeholder ? theme.colors.gray.darkGray : theme.colors.primary.darkBlue};
|
|
962
|
+
user-select: none;
|
|
963
|
+
`;
|
|
964
|
+
const HiddenInput$1 = styled$1.input `
|
|
965
|
+
position: absolute;
|
|
966
|
+
opacity: 0;
|
|
967
|
+
pointer-events: none;
|
|
968
|
+
`;
|
|
969
|
+
const ErrorText = styled$1.span `
|
|
970
|
+
font-family: "Proxima Nova", sans-serif;
|
|
971
|
+
font-size: 13px;
|
|
972
|
+
line-height: 16px;
|
|
973
|
+
color: ${({ theme }) => theme.colors.accent.red};
|
|
974
|
+
`;
|
|
975
|
+
const List = styled$1.div `
|
|
976
|
+
position: fixed;
|
|
977
|
+
top: ${({ $top }) => `${$top}px`};
|
|
978
|
+
left: ${({ $left }) => `${$left}px`};
|
|
979
|
+
width: ${({ $width }) => `${$width}px`};
|
|
980
|
+
z-index: 999;
|
|
981
|
+
border-radius: 5px;
|
|
982
|
+
border: 1px solid ${({ theme }) => theme.colors.gray.lightGray2};
|
|
983
|
+
background: ${({ theme }) => theme.colors.primary.white};
|
|
984
|
+
box-shadow: 0px 8px 24px rgba(15, 23, 42, 0.12);
|
|
985
|
+
display: flex;
|
|
986
|
+
flex-direction: column;
|
|
987
|
+
max-height: 260px;
|
|
988
|
+
overflow-y: auto;
|
|
989
|
+
`;
|
|
990
|
+
const Option = styled$1.button `
|
|
991
|
+
display: flex;
|
|
992
|
+
align-items: center;
|
|
993
|
+
gap: 10px;
|
|
994
|
+
padding: 0 13px;
|
|
995
|
+
height: 40px;
|
|
996
|
+
border: none;
|
|
997
|
+
background: transparent;
|
|
998
|
+
width: 100%;
|
|
999
|
+
text-align: left;
|
|
1000
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
1001
|
+
cursor: pointer;
|
|
1002
|
+
transition: background 140ms ease;
|
|
1003
|
+
|
|
1004
|
+
&[data-hovered="true"],
|
|
1005
|
+
&:hover {
|
|
1006
|
+
background: ${({ theme }) => theme.colors.gray.lightBlueGray};
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
&[data-active="true"] {
|
|
1010
|
+
background: ${({ theme }) => theme.colors.gray.lightGray};
|
|
1011
|
+
}
|
|
1012
|
+
`;
|
|
1013
|
+
const OptionIcon = styled$1.span `
|
|
1014
|
+
display: inline-flex;
|
|
1015
|
+
width: 24px;
|
|
1016
|
+
height: 24px;
|
|
1017
|
+
`;
|
|
1018
|
+
|
|
1019
|
+
const DROPDOWN_OFFSET = 8;
|
|
1020
|
+
const SelectField = forwardRef(({ options, value, defaultValue, placeholder = "Text", label, error, disabled = false, icon, name, onChange, onFocus, onBlur, className, }, ref) => {
|
|
1021
|
+
const wrapperRef = useRef(null);
|
|
1022
|
+
const fieldRef = useRef(null);
|
|
1023
|
+
const listRef = useRef(null);
|
|
1024
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
1025
|
+
const [focused, setFocused] = useState(false);
|
|
1026
|
+
const [internalValue, setInternalValue] = useState(defaultValue ?? "");
|
|
1027
|
+
const [hoveredIndex, setHoveredIndex] = useState(null);
|
|
1028
|
+
const [dropdownRect, setDropdownRect] = useState({
|
|
1029
|
+
top: 0,
|
|
1030
|
+
left: 0,
|
|
1031
|
+
width: 0,
|
|
1032
|
+
});
|
|
1033
|
+
const selectedValue = value ?? internalValue;
|
|
1034
|
+
const selectedOption = useMemo(() => options.find((opt) => opt.value === selectedValue), [options, selectedValue]);
|
|
1035
|
+
const hasError = Boolean(error);
|
|
1036
|
+
const displayPlaceholder = !selectedOption;
|
|
1037
|
+
const displayText = selectedOption?.label ?? placeholder;
|
|
1038
|
+
const updateDropdownPosition = useCallback(() => {
|
|
1039
|
+
if (!fieldRef.current)
|
|
1040
|
+
return;
|
|
1041
|
+
const rect = fieldRef.current.getBoundingClientRect();
|
|
1042
|
+
setDropdownRect({
|
|
1043
|
+
top: rect.bottom + DROPDOWN_OFFSET,
|
|
1044
|
+
left: rect.left,
|
|
1045
|
+
width: rect.width,
|
|
1046
|
+
});
|
|
1047
|
+
}, []);
|
|
1048
|
+
useLayoutEffect(() => {
|
|
1049
|
+
if (!isOpen)
|
|
1050
|
+
return;
|
|
1051
|
+
updateDropdownPosition();
|
|
1052
|
+
const handleRecalc = () => updateDropdownPosition();
|
|
1053
|
+
window.addEventListener("resize", handleRecalc);
|
|
1054
|
+
window.addEventListener("scroll", handleRecalc, true);
|
|
1055
|
+
return () => {
|
|
1056
|
+
window.removeEventListener("resize", handleRecalc);
|
|
1057
|
+
window.removeEventListener("scroll", handleRecalc, true);
|
|
1058
|
+
};
|
|
1059
|
+
}, [isOpen, updateDropdownPosition]);
|
|
1060
|
+
const closeDropdown = useCallback(() => {
|
|
1061
|
+
setIsOpen(false);
|
|
1062
|
+
setHoveredIndex(null);
|
|
1063
|
+
}, []);
|
|
1064
|
+
const openDropdown = useCallback(() => {
|
|
1065
|
+
if (disabled)
|
|
1066
|
+
return;
|
|
1067
|
+
setIsOpen(true);
|
|
1068
|
+
setHoveredIndex((prev) => {
|
|
1069
|
+
if (prev !== null)
|
|
1070
|
+
return prev;
|
|
1071
|
+
const currentIndex = options.findIndex((opt) => opt.value === selectedValue);
|
|
1072
|
+
return currentIndex >= 0 ? currentIndex : 0;
|
|
1073
|
+
});
|
|
1074
|
+
}, [disabled, options, selectedValue]);
|
|
1075
|
+
const toggleDropdown = useCallback(() => {
|
|
1076
|
+
if (isOpen) {
|
|
1077
|
+
closeDropdown();
|
|
1078
|
+
}
|
|
1079
|
+
else {
|
|
1080
|
+
openDropdown();
|
|
1081
|
+
}
|
|
1082
|
+
}, [isOpen, closeDropdown, openDropdown]);
|
|
1083
|
+
const handleSelect = (option) => {
|
|
1084
|
+
if (disabled)
|
|
1085
|
+
return;
|
|
1086
|
+
setInternalValue(option.value);
|
|
1087
|
+
onChange?.(option.value);
|
|
1088
|
+
closeDropdown();
|
|
1089
|
+
};
|
|
1090
|
+
const handleKeyDown = (evt) => {
|
|
1091
|
+
if (disabled)
|
|
1092
|
+
return;
|
|
1093
|
+
switch (evt.key) {
|
|
1094
|
+
case "ArrowDown":
|
|
1095
|
+
evt.preventDefault();
|
|
1096
|
+
openDropdown();
|
|
1097
|
+
setHoveredIndex((prev) => prev === null ? 0 : Math.min(prev + 1, options.length - 1));
|
|
1098
|
+
break;
|
|
1099
|
+
case "ArrowUp":
|
|
1100
|
+
evt.preventDefault();
|
|
1101
|
+
openDropdown();
|
|
1102
|
+
setHoveredIndex((prev) => prev === null ? options.length - 1 : Math.max(prev - 1, 0));
|
|
1103
|
+
break;
|
|
1104
|
+
case "Enter":
|
|
1105
|
+
case " ":
|
|
1106
|
+
evt.preventDefault();
|
|
1107
|
+
if (!isOpen) {
|
|
1108
|
+
openDropdown();
|
|
1109
|
+
}
|
|
1110
|
+
else if (hoveredIndex !== null && options[hoveredIndex]) {
|
|
1111
|
+
handleSelect(options[hoveredIndex]);
|
|
1112
|
+
}
|
|
1113
|
+
break;
|
|
1114
|
+
case "Escape":
|
|
1115
|
+
case "Tab":
|
|
1116
|
+
closeDropdown();
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
useEffect(() => {
|
|
1121
|
+
if (!isOpen)
|
|
1122
|
+
return;
|
|
1123
|
+
const handleClickOutside = (evt) => {
|
|
1124
|
+
const target = evt.target;
|
|
1125
|
+
const isInsideField = wrapperRef.current && wrapperRef.current.contains(target);
|
|
1126
|
+
const isInsideList = listRef.current && listRef.current.contains(target);
|
|
1127
|
+
if (!isInsideField && !isInsideList) {
|
|
1128
|
+
closeDropdown();
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1132
|
+
return () => {
|
|
1133
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
1134
|
+
};
|
|
1135
|
+
}, [isOpen, closeDropdown]);
|
|
1136
|
+
const handleFocus = (evt) => {
|
|
1137
|
+
setFocused(true);
|
|
1138
|
+
onFocus?.(evt);
|
|
1139
|
+
};
|
|
1140
|
+
const handleBlur = (evt) => {
|
|
1141
|
+
setFocused(false);
|
|
1142
|
+
onBlur?.(evt);
|
|
1143
|
+
};
|
|
1144
|
+
return (jsxs(Wrapper, { className: className, ref: wrapperRef, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, children: [label && jsx(Label$1, { children: label }), jsxs(FieldContainer, { ref: fieldRef, role: "button", tabIndex: disabled ? -1 : 0, "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-invalid": hasError, "aria-disabled": disabled, "$hasError": hasError, "$disabled": disabled, "data-state": hasError ? "error" : isOpen || focused ? "active" : undefined, onClick: toggleDropdown, children: [icon && jsx(LeadingIcon, { children: icon }), jsx(Value, { "$placeholder": displayPlaceholder, children: displayText }), jsx(HiddenInput$1, { ref: ref, readOnly: true, name: name, value: selectedValue, tabIndex: -1, "aria-hidden": true })] }), error && jsx(ErrorText, { children: error }), isOpen && (jsx(List, { ref: listRef, role: "listbox", "$top": dropdownRect.top, "$left": dropdownRect.left, "$width": dropdownRect.width, children: options.map((option, index) => {
|
|
1145
|
+
const isActiveOption = option.value === selectedValue;
|
|
1146
|
+
const isHovered = index === hoveredIndex;
|
|
1147
|
+
return (jsxs(Option, { role: "option", "aria-selected": isActiveOption, "data-active": isActiveOption || undefined, "data-hovered": isHovered || undefined, onMouseEnter: () => setHoveredIndex(index), onMouseLeave: () => setHoveredIndex(null), onMouseDown: (evt) => evt.preventDefault(), onClick: () => handleSelect(option), children: [option.icon && jsx(OptionIcon, { children: option.icon }), jsx(Typography, { variant: "form-input", children: option.label })] }, option.value));
|
|
1148
|
+
}) }))] }));
|
|
1149
|
+
});
|
|
1150
|
+
SelectField.displayName = "SelectField";
|
|
1151
|
+
|
|
1152
|
+
const hiddenShift = {
|
|
1153
|
+
top: "translate3d(0, 6px, 0)",
|
|
1154
|
+
bottom: "translate3d(0, -6px, 0)",
|
|
1155
|
+
left: "translate3d(6px, 0, 0)",
|
|
1156
|
+
right: "translate3d(-6px, 0, 0)",
|
|
1157
|
+
};
|
|
1158
|
+
const TooltipWrapper = styled.div `
|
|
1159
|
+
display: inline-flex;
|
|
1160
|
+
position: relative;
|
|
1161
|
+
`;
|
|
1162
|
+
const TooltipTrigger = styled.div `
|
|
1163
|
+
display: inline-flex;
|
|
1164
|
+
align-items: center;
|
|
1165
|
+
justify-content: center;
|
|
1166
|
+
cursor: pointer;
|
|
1167
|
+
outline: none;
|
|
1168
|
+
|
|
1169
|
+
&:focus-visible {
|
|
1170
|
+
box-shadow: inset 0 0 0 2px rgba(84, 132, 255, 0.65);
|
|
1171
|
+
border-radius: 6px;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
&[data-open="true"] {
|
|
1175
|
+
cursor: default;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
&[data-disabled="true"] {
|
|
1179
|
+
cursor: not-allowed;
|
|
1180
|
+
}
|
|
1181
|
+
`;
|
|
1182
|
+
const TooltipBubble = styled.div `
|
|
1183
|
+
position: fixed;
|
|
1184
|
+
top: -9999px;
|
|
1185
|
+
left: -9999px;
|
|
1186
|
+
padding: 10px 14px;
|
|
1187
|
+
border-radius: 8px;
|
|
1188
|
+
font-size: 13px;
|
|
1189
|
+
line-height: 1.35;
|
|
1190
|
+
max-width: min(320px, calc(100vw - 16px));
|
|
1191
|
+
box-shadow: 0px 8px 24px 0px #0000001f;
|
|
1192
|
+
filter: drop-shadow(0px 8px 24px 0px #0000001f);
|
|
1193
|
+
background: ${({ theme }) => theme.colors.primary.white};
|
|
1194
|
+
z-index: 9999;
|
|
1195
|
+
opacity: ${({ $visible }) => ($visible ? 1 : 0)};
|
|
1196
|
+
visibility: ${({ $visible }) => ($visible ? "visible" : "hidden")};
|
|
1197
|
+
transform: ${({ $visible, $placement }) => $visible ? "translate3d(0, 0, 0)" : hiddenShift[$placement]};
|
|
1198
|
+
transition: opacity 0.18s ease, transform 0.18s ease;
|
|
1199
|
+
|
|
1200
|
+
pointer-events: ${({ $visible, $interactive }) => $visible && $interactive ? "auto" : "none"};
|
|
1201
|
+
|
|
1202
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1203
|
+
transition: none;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
&::after {
|
|
1207
|
+
content: "";
|
|
1208
|
+
position: absolute;
|
|
1209
|
+
inset: 0;
|
|
1210
|
+
border-radius: inherit;
|
|
1211
|
+
pointer-events: none;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
&[data-placement="top"] {
|
|
1215
|
+
--tooltip-arrow-x: 0px;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
&[data-placement="bottom"] {
|
|
1219
|
+
--tooltip-arrow-x: 0px;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
&[data-placement="left"] {
|
|
1223
|
+
--tooltip-arrow-y: 0px;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
&[data-placement="right"] {
|
|
1227
|
+
--tooltip-arrow-y: 0px;
|
|
1228
|
+
}
|
|
1229
|
+
`;
|
|
1230
|
+
const TooltipArrow = styled.span `
|
|
1231
|
+
position: absolute;
|
|
1232
|
+
width: 10px;
|
|
1233
|
+
height: 10px;
|
|
1234
|
+
background: inherit;
|
|
1235
|
+
border: inherit;
|
|
1236
|
+
border-radius: 2px;
|
|
1237
|
+
transform: rotate(45deg);
|
|
1238
|
+
pointer-events: none;
|
|
1239
|
+
|
|
1240
|
+
${({ $placement }) => {
|
|
1241
|
+
switch ($placement) {
|
|
1242
|
+
case "top":
|
|
1243
|
+
return css `
|
|
1244
|
+
bottom: -5px;
|
|
1245
|
+
left: 50%;
|
|
1246
|
+
transform: translateX(-50%) translateX(var(--tooltip-arrow-x, 0px))
|
|
1247
|
+
rotate(45deg);
|
|
1248
|
+
`;
|
|
1249
|
+
case "bottom":
|
|
1250
|
+
return css `
|
|
1251
|
+
top: -5px;
|
|
1252
|
+
left: 50%;
|
|
1253
|
+
transform: translateX(-50%) translateX(var(--tooltip-arrow-x, 0px))
|
|
1254
|
+
rotate(45deg);
|
|
1255
|
+
`;
|
|
1256
|
+
case "left":
|
|
1257
|
+
return css `
|
|
1258
|
+
right: -5px;
|
|
1259
|
+
top: 50%;
|
|
1260
|
+
transform: translateY(-50%) translateY(var(--tooltip-arrow-y, 0px))
|
|
1261
|
+
rotate(45deg);
|
|
1262
|
+
`;
|
|
1263
|
+
case "right":
|
|
1264
|
+
default:
|
|
1265
|
+
return css `
|
|
1266
|
+
left: -5px;
|
|
1267
|
+
top: 50%;
|
|
1268
|
+
transform: translateY(-50%) translateY(var(--tooltip-arrow-y, 0px))
|
|
1269
|
+
rotate(45deg);
|
|
1270
|
+
`;
|
|
1271
|
+
}
|
|
1272
|
+
}}
|
|
1273
|
+
`;
|
|
1274
|
+
const TooltipContentText = styled(Typography).attrs({
|
|
1275
|
+
variant: "body-s",
|
|
1276
|
+
}) `
|
|
1277
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
1278
|
+
`;
|
|
1279
|
+
|
|
1280
|
+
const VIEWPORT_PADDING = 8;
|
|
1281
|
+
const GUTTER = 12;
|
|
1282
|
+
const ARROW_SAFE_ZONE = 12;
|
|
1283
|
+
const fallbackOrder = {
|
|
1284
|
+
top: ["top", "bottom", "right", "left"],
|
|
1285
|
+
bottom: ["bottom", "top", "right", "left"],
|
|
1286
|
+
left: ["left", "right", "top", "bottom"],
|
|
1287
|
+
right: ["right", "left", "top", "bottom"],
|
|
1288
|
+
};
|
|
1289
|
+
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
1290
|
+
const Tooltip = ({ content, children, position = "top", open, defaultOpen = false, onOpenChange, showDelay = 150, hideDelay = 150, interactive = false, disabled = false, hideOnClick = false, maxWidth, }) => {
|
|
1291
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
1292
|
+
const isControlled = typeof open === "boolean";
|
|
1293
|
+
const isOpen = isControlled ? !!open : internalOpen;
|
|
1294
|
+
const wrapperRef = useRef(null);
|
|
1295
|
+
const triggerRef = useRef(null);
|
|
1296
|
+
const bubbleRef = useRef(null);
|
|
1297
|
+
const showTimer = useRef(null);
|
|
1298
|
+
const hideTimer = useRef(null);
|
|
1299
|
+
const rafRef = useRef(null);
|
|
1300
|
+
const tooltipId = useId();
|
|
1301
|
+
const INITIAL_LAYOUT = useMemo(() => ({
|
|
1302
|
+
top: -9999,
|
|
1303
|
+
left: -9999,
|
|
1304
|
+
arrowX: 0,
|
|
1305
|
+
arrowY: 0,
|
|
1306
|
+
placement: position,
|
|
1307
|
+
}), [position]);
|
|
1308
|
+
const [layout, setLayout] = useState(INITIAL_LAYOUT);
|
|
1309
|
+
const clearTimers = () => {
|
|
1310
|
+
if (showTimer.current) {
|
|
1311
|
+
clearTimeout(showTimer.current);
|
|
1312
|
+
showTimer.current = null;
|
|
1313
|
+
}
|
|
1314
|
+
if (hideTimer.current) {
|
|
1315
|
+
clearTimeout(hideTimer.current);
|
|
1316
|
+
hideTimer.current = null;
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
const commitState = useCallback((next) => {
|
|
1320
|
+
if (!isControlled) {
|
|
1321
|
+
setInternalOpen(next);
|
|
1322
|
+
}
|
|
1323
|
+
if (!next) {
|
|
1324
|
+
setLayout(INITIAL_LAYOUT);
|
|
1325
|
+
}
|
|
1326
|
+
onOpenChange?.(next);
|
|
1327
|
+
}, [INITIAL_LAYOUT, isControlled, onOpenChange]);
|
|
1328
|
+
const scheduleShow = useCallback(() => {
|
|
1329
|
+
if (disabled)
|
|
1330
|
+
return;
|
|
1331
|
+
clearTimers();
|
|
1332
|
+
showTimer.current = setTimeout(() => commitState(true), showDelay);
|
|
1333
|
+
}, [disabled, commitState, showDelay]);
|
|
1334
|
+
const scheduleHide = useCallback(() => {
|
|
1335
|
+
if (disabled)
|
|
1336
|
+
return;
|
|
1337
|
+
clearTimers();
|
|
1338
|
+
hideTimer.current = setTimeout(() => commitState(false), hideDelay);
|
|
1339
|
+
}, [disabled, commitState, hideDelay]);
|
|
1340
|
+
const handlePointerEnter = () => {
|
|
1341
|
+
if (!disabled)
|
|
1342
|
+
scheduleShow();
|
|
1343
|
+
};
|
|
1344
|
+
const handlePointerLeave = () => {
|
|
1345
|
+
if (!disabled)
|
|
1346
|
+
scheduleHide();
|
|
1347
|
+
};
|
|
1348
|
+
const handleFocus = () => {
|
|
1349
|
+
if (!disabled)
|
|
1350
|
+
scheduleShow();
|
|
1351
|
+
};
|
|
1352
|
+
const handleBlur = () => {
|
|
1353
|
+
if (!disabled)
|
|
1354
|
+
scheduleHide();
|
|
1355
|
+
};
|
|
1356
|
+
const handleClick = () => {
|
|
1357
|
+
if (hideOnClick) {
|
|
1358
|
+
commitState(false);
|
|
1359
|
+
}
|
|
1360
|
+
};
|
|
1361
|
+
const handleInteractiveEnter = () => {
|
|
1362
|
+
if (!interactive)
|
|
1363
|
+
return;
|
|
1364
|
+
clearTimers();
|
|
1365
|
+
};
|
|
1366
|
+
const handleInteractiveLeave = () => {
|
|
1367
|
+
if (!interactive)
|
|
1368
|
+
return;
|
|
1369
|
+
scheduleHide();
|
|
1370
|
+
};
|
|
1371
|
+
const recomputePosition = useCallback(() => {
|
|
1372
|
+
if (typeof window === "undefined" ||
|
|
1373
|
+
!triggerRef.current ||
|
|
1374
|
+
!bubbleRef.current) {
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
1378
|
+
const bubbleRect = bubbleRef.current.getBoundingClientRect();
|
|
1379
|
+
const viewportWidth = window.innerWidth;
|
|
1380
|
+
const viewportHeight = window.innerHeight;
|
|
1381
|
+
const anchorX = triggerRect.left + triggerRect.width / 2;
|
|
1382
|
+
const anchorY = triggerRect.top + triggerRect.height / 2;
|
|
1383
|
+
const fits = (placement) => {
|
|
1384
|
+
switch (placement) {
|
|
1385
|
+
case "top":
|
|
1386
|
+
return (triggerRect.top >= bubbleRect.height + GUTTER + VIEWPORT_PADDING);
|
|
1387
|
+
case "bottom":
|
|
1388
|
+
return (viewportHeight - triggerRect.bottom >=
|
|
1389
|
+
bubbleRect.height + GUTTER + VIEWPORT_PADDING);
|
|
1390
|
+
case "left":
|
|
1391
|
+
return (triggerRect.left >= bubbleRect.width + GUTTER + VIEWPORT_PADDING);
|
|
1392
|
+
case "right":
|
|
1393
|
+
return (viewportWidth - triggerRect.right >=
|
|
1394
|
+
bubbleRect.width + GUTTER + VIEWPORT_PADDING);
|
|
1395
|
+
default:
|
|
1396
|
+
return true;
|
|
1397
|
+
}
|
|
1398
|
+
};
|
|
1399
|
+
const nextPlacement = fallbackOrder[position].find((option) => fits(option)) ?? position;
|
|
1400
|
+
let top = 0;
|
|
1401
|
+
let left = 0;
|
|
1402
|
+
switch (nextPlacement) {
|
|
1403
|
+
case "top":
|
|
1404
|
+
top = triggerRect.top - bubbleRect.height - GUTTER;
|
|
1405
|
+
left = anchorX - bubbleRect.width / 2;
|
|
1406
|
+
break;
|
|
1407
|
+
case "bottom":
|
|
1408
|
+
top = triggerRect.bottom + GUTTER;
|
|
1409
|
+
left = anchorX - bubbleRect.width / 2;
|
|
1410
|
+
break;
|
|
1411
|
+
case "left":
|
|
1412
|
+
top = anchorY - bubbleRect.height / 2;
|
|
1413
|
+
left = triggerRect.left - bubbleRect.width - GUTTER;
|
|
1414
|
+
break;
|
|
1415
|
+
case "right":
|
|
1416
|
+
default:
|
|
1417
|
+
top = anchorY - bubbleRect.height / 2;
|
|
1418
|
+
left = triggerRect.right + GUTTER;
|
|
1419
|
+
break;
|
|
1420
|
+
}
|
|
1421
|
+
const horizontalSpace = Math.max(viewportWidth - VIEWPORT_PADDING * 2, 0);
|
|
1422
|
+
const verticalSpace = Math.max(viewportHeight - VIEWPORT_PADDING * 2, 0);
|
|
1423
|
+
const minLeft = VIEWPORT_PADDING;
|
|
1424
|
+
const maxLeft = viewportWidth - bubbleRect.width - VIEWPORT_PADDING;
|
|
1425
|
+
const minTop = VIEWPORT_PADDING;
|
|
1426
|
+
const maxTop = viewportHeight - bubbleRect.height - VIEWPORT_PADDING;
|
|
1427
|
+
const clampedLeft = bubbleRect.width >= horizontalSpace
|
|
1428
|
+
? VIEWPORT_PADDING
|
|
1429
|
+
: clamp(left, minLeft, maxLeft);
|
|
1430
|
+
const clampedTop = bubbleRect.height >= verticalSpace
|
|
1431
|
+
? VIEWPORT_PADDING
|
|
1432
|
+
: clamp(top, minTop, maxTop);
|
|
1433
|
+
let arrowX = 0;
|
|
1434
|
+
let arrowY = 0;
|
|
1435
|
+
if (nextPlacement === "top" || nextPlacement === "bottom") {
|
|
1436
|
+
const arrowLimit = Math.max(bubbleRect.width / 2 - ARROW_SAFE_ZONE, 0);
|
|
1437
|
+
arrowX = clamp(anchorX - (clampedLeft + bubbleRect.width / 2), -arrowLimit, arrowLimit);
|
|
1438
|
+
arrowY = 0;
|
|
1439
|
+
}
|
|
1440
|
+
else {
|
|
1441
|
+
const arrowLimit = Math.max(bubbleRect.height / 2 - ARROW_SAFE_ZONE, 0);
|
|
1442
|
+
arrowY = clamp(anchorY - (clampedTop + bubbleRect.height / 2), -arrowLimit, arrowLimit);
|
|
1443
|
+
arrowX = 0;
|
|
1444
|
+
}
|
|
1445
|
+
setLayout((prev) => {
|
|
1446
|
+
if (prev.top === clampedTop &&
|
|
1447
|
+
prev.left === clampedLeft &&
|
|
1448
|
+
prev.arrowX === arrowX &&
|
|
1449
|
+
prev.arrowY === arrowY &&
|
|
1450
|
+
prev.placement === nextPlacement) {
|
|
1451
|
+
return prev;
|
|
1452
|
+
}
|
|
1453
|
+
return {
|
|
1454
|
+
top: clampedTop,
|
|
1455
|
+
left: clampedLeft,
|
|
1456
|
+
arrowX,
|
|
1457
|
+
arrowY,
|
|
1458
|
+
placement: nextPlacement,
|
|
1459
|
+
};
|
|
1460
|
+
});
|
|
1461
|
+
}, [position]);
|
|
1462
|
+
useLayoutEffect(() => {
|
|
1463
|
+
if (!isOpen) {
|
|
1464
|
+
return; // никакого setLayout здесь
|
|
1465
|
+
}
|
|
1466
|
+
const bubbleEl = bubbleRef.current;
|
|
1467
|
+
const triggerEl = triggerRef.current;
|
|
1468
|
+
if (!bubbleEl || !triggerEl)
|
|
1469
|
+
return;
|
|
1470
|
+
const schedule = () => {
|
|
1471
|
+
if (rafRef.current !== null) {
|
|
1472
|
+
cancelAnimationFrame(rafRef.current);
|
|
1473
|
+
}
|
|
1474
|
+
rafRef.current = window.requestAnimationFrame(() => {
|
|
1475
|
+
rafRef.current = null;
|
|
1476
|
+
recomputePosition();
|
|
1477
|
+
});
|
|
1478
|
+
};
|
|
1479
|
+
schedule();
|
|
1480
|
+
const canObserve = typeof window !== "undefined" && "ResizeObserver" in window;
|
|
1481
|
+
const resizeObserver = canObserve ? new ResizeObserver(schedule) : null;
|
|
1482
|
+
resizeObserver?.observe(bubbleEl);
|
|
1483
|
+
resizeObserver?.observe(triggerEl);
|
|
1484
|
+
window.addEventListener("resize", schedule);
|
|
1485
|
+
window.addEventListener("scroll", schedule, true);
|
|
1486
|
+
return () => {
|
|
1487
|
+
window.removeEventListener("resize", schedule);
|
|
1488
|
+
window.removeEventListener("scroll", schedule, true);
|
|
1489
|
+
resizeObserver?.disconnect();
|
|
1490
|
+
if (rafRef.current !== null) {
|
|
1491
|
+
cancelAnimationFrame(rafRef.current);
|
|
1492
|
+
rafRef.current = null;
|
|
1493
|
+
}
|
|
1494
|
+
};
|
|
1495
|
+
}, [isOpen, recomputePosition]);
|
|
1496
|
+
useEffect(() => clearTimers, []);
|
|
1497
|
+
useEffect(() => {
|
|
1498
|
+
if (!isOpen)
|
|
1499
|
+
return;
|
|
1500
|
+
const handleKeyDown = (event) => {
|
|
1501
|
+
if (event.key === "Escape") {
|
|
1502
|
+
commitState(false);
|
|
1503
|
+
}
|
|
1504
|
+
};
|
|
1505
|
+
const handlePointerDown = (event) => {
|
|
1506
|
+
const target = event.target;
|
|
1507
|
+
if (wrapperRef.current?.contains(target) ||
|
|
1508
|
+
bubbleRef.current?.contains(target)) {
|
|
1509
|
+
return;
|
|
1510
|
+
}
|
|
1511
|
+
commitState(false);
|
|
1512
|
+
};
|
|
1513
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
1514
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
1515
|
+
return () => {
|
|
1516
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
1517
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
1518
|
+
};
|
|
1519
|
+
}, [isOpen, commitState]);
|
|
1520
|
+
const bubbleStyle = {
|
|
1521
|
+
top: layout.top,
|
|
1522
|
+
left: layout.left,
|
|
1523
|
+
["--tooltip-arrow-x"]: `${layout.arrowX}px`,
|
|
1524
|
+
["--tooltip-arrow-y"]: `${layout.arrowY}px`,
|
|
1525
|
+
};
|
|
1526
|
+
if (maxWidth !== undefined) {
|
|
1527
|
+
bubbleStyle.maxWidth =
|
|
1528
|
+
typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
|
|
1529
|
+
}
|
|
1530
|
+
return (jsxs(TooltipWrapper, { ref: wrapperRef, "data-disabled": disabled, children: [jsx(TooltipTrigger, { ref: triggerRef, tabIndex: disabled ? -1 : 0, "aria-describedby": isOpen ? tooltipId : undefined, onMouseEnter: handlePointerEnter, onMouseLeave: handlePointerLeave, onFocus: handleFocus, onBlur: handleBlur, onClick: handleClick, "data-open": isOpen, children: children }), jsxs(TooltipBubble, { ref: bubbleRef, id: tooltipId, role: "tooltip", "aria-hidden": !isOpen, "$visible": isOpen, "$interactive": interactive, "$placement": layout.placement, style: bubbleStyle, "data-placement": layout.placement, onMouseEnter: handleInteractiveEnter, onMouseLeave: handleInteractiveLeave, children: [["string", "number"].includes(typeof content) ? (jsx(TooltipContentText, { variant: "body-m", children: content })) : (content), jsx(TooltipArrow, { "$placement": layout.placement })] })] }));
|
|
1531
|
+
};
|
|
1532
|
+
|
|
1533
|
+
const maskEmail = (email, keep = 4, stars = 7) => {
|
|
1534
|
+
const trimmed = email.trim();
|
|
1535
|
+
if (!trimmed)
|
|
1536
|
+
return trimmed;
|
|
1537
|
+
const lastDotIndex = trimmed.lastIndexOf(".");
|
|
1538
|
+
if (lastDotIndex <= 0 || lastDotIndex === trimmed.length - 1) {
|
|
1539
|
+
return trimmed;
|
|
1540
|
+
}
|
|
1541
|
+
const tld = trimmed.slice(lastDotIndex + 1);
|
|
1542
|
+
const core = trimmed.slice(0, lastDotIndex).replace(/[@.]/g, "");
|
|
1543
|
+
const visible = core.slice(0, keep);
|
|
1544
|
+
const mask = "*".repeat(stars);
|
|
1545
|
+
return `${visible}${mask}${tld}`;
|
|
1546
|
+
};
|
|
1547
|
+
const formatCardNumber = (cardNum) => {
|
|
1548
|
+
const digits = cardNum.toString().padStart(16, "0");
|
|
1549
|
+
return digits.replace(/(\d{4})(?=\d)/g, "$1 ");
|
|
1550
|
+
};
|
|
1551
|
+
const copyToClipboard = async (text) => {
|
|
1552
|
+
try {
|
|
1553
|
+
await navigator.clipboard.writeText(text);
|
|
1554
|
+
console.log("Скопировано в буфер обмена");
|
|
1555
|
+
}
|
|
1556
|
+
catch (err) {
|
|
1557
|
+
console.error("Ошибка копирования:", err);
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
|
|
1561
|
+
const UserAccountStyled = styled$1.div `
|
|
1562
|
+
display: flex;
|
|
1563
|
+
gap: 10px;
|
|
1564
|
+
align-items: center;
|
|
1565
|
+
`;
|
|
1566
|
+
const UserAccountText = styled$1(Typography) `
|
|
1567
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
1568
|
+
`;
|
|
1569
|
+
|
|
1570
|
+
const UserAccount = ({ email }) => (jsxs(UserAccountStyled, { children: [jsx(UserIcon, {}), jsx(UserAccountText, { variant: "body-m-semibold", children: maskEmail(email) })] }));
|
|
1571
|
+
|
|
1572
|
+
const sizeTokens = {
|
|
1573
|
+
m: { minWidth: 55, height: 46, fontSize: 16, lineHeight: 20, paddingX: 14 },
|
|
1574
|
+
l: { minWidth: 58, height: 48, fontSize: 18, lineHeight: 22, paddingX: 14 },
|
|
1575
|
+
xl: { minWidth: 68, height: 56, fontSize: 24, lineHeight: 30, paddingX: 14 },
|
|
1576
|
+
};
|
|
1577
|
+
const TabButton = styled.button `
|
|
1578
|
+
${({ $size }) => css `
|
|
1579
|
+
min-width: ${sizeTokens[$size].minWidth}px;
|
|
1580
|
+
height: ${sizeTokens[$size].height}px;
|
|
1581
|
+
padding: 0 ${sizeTokens[$size].paddingX}px;
|
|
1582
|
+
font-size: ${sizeTokens[$size].fontSize}px;
|
|
1583
|
+
line-height: ${sizeTokens[$size].lineHeight}px;
|
|
1584
|
+
`}
|
|
1585
|
+
position: relative;
|
|
1586
|
+
background: transparent;
|
|
1587
|
+
border: none;
|
|
1588
|
+
display: inline-flex;
|
|
1589
|
+
align-items: flex-end;
|
|
1590
|
+
justify-content: center;
|
|
1591
|
+
font-weight: 700;
|
|
1592
|
+
cursor: pointer;
|
|
1593
|
+
text-transform: none;
|
|
1594
|
+
color: ${({ theme, $active }) => $active ? theme.colors.primary.darkBlue : theme.colors.gray.darkGray};
|
|
1595
|
+
transition: color 120ms ease;
|
|
1596
|
+
padding-bottom: 25px;
|
|
1597
|
+
&::after {
|
|
1598
|
+
content: "";
|
|
1599
|
+
position: absolute;
|
|
1600
|
+
inset-inline: 0;
|
|
1601
|
+
bottom: 0;
|
|
1602
|
+
height: ${({ $active }) => ($active ? 2 : 1)}px;
|
|
1603
|
+
background: ${({ theme, $active }) => $active
|
|
1604
|
+
? theme.colors.primary.primaryBlue
|
|
1605
|
+
: theme.colors.gray.lightGray2};
|
|
1606
|
+
transition: height 120ms ease, background 120ms ease;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
&:hover:not(:disabled) {
|
|
1610
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue2};
|
|
1611
|
+
|
|
1612
|
+
&::after {
|
|
1613
|
+
height: 2px;
|
|
1614
|
+
background: ${({ theme }) => theme.colors.primary.hoverBlue};
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
&:focus-visible {
|
|
1619
|
+
outline: none;
|
|
1620
|
+
box-shadow: inset 0 -2px 0 ${({ theme }) => theme.colors.primary.hoverBlue};
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
&:disabled {
|
|
1624
|
+
cursor: not-allowed;
|
|
1625
|
+
color: ${({ theme }) => theme.colors.gray.darkGray + "80"};
|
|
1626
|
+
&::after {
|
|
1627
|
+
background: ${({ theme }) => theme.colors.gray.lightGray2};
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
`;
|
|
1631
|
+
const TabRow = styled.div `
|
|
1632
|
+
display: flex;
|
|
1633
|
+
box-shadow: inset 0 -1px 0 ${({ theme }) => theme.colors.gray.lightGray2};
|
|
1634
|
+
`;
|
|
1635
|
+
|
|
1636
|
+
const Tab = ({ id, label, active = false, disabled = false, size = "m", onSelect, className, }) => {
|
|
1637
|
+
const handleClick = useCallback(() => {
|
|
1638
|
+
if (disabled)
|
|
1639
|
+
return;
|
|
1640
|
+
onSelect?.(id);
|
|
1641
|
+
}, [disabled, id, onSelect]);
|
|
1642
|
+
return (jsx(TabButton, { type: "button", role: "tab", "aria-selected": active, "aria-disabled": disabled, disabled: disabled, "$size": size, "$active": active, className: className, onClick: handleClick, children: label }));
|
|
1643
|
+
};
|
|
1644
|
+
|
|
1645
|
+
const TabList = ({ size = "m", activeId, items, onChange, className, }) => {
|
|
1646
|
+
const handleSelect = useCallback((id) => {
|
|
1647
|
+
onChange(id);
|
|
1648
|
+
}, [onChange]);
|
|
1649
|
+
return (jsx(TabRow, { role: "tablist", className: className, children: items.map((tab) => (jsx(Tab, { ...tab, size: size, active: tab.id === activeId, onSelect: handleSelect }, tab.id))) }));
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1652
|
+
const TableStyled = styled.table `
|
|
1653
|
+
width: 100%;
|
|
1654
|
+
border-collapse: collapse;
|
|
1655
|
+
overflow: hidden;
|
|
1656
|
+
`;
|
|
1657
|
+
const TableRow = styled.tr `
|
|
1658
|
+
&:nth-child(2n) {
|
|
1659
|
+
background: ${({ theme }) => theme.colors.gray.lightBlueGray};
|
|
1660
|
+
}
|
|
1661
|
+
`;
|
|
1662
|
+
const TableCell = styled(Typography).attrs({
|
|
1663
|
+
forwardedAs: "td",
|
|
1664
|
+
variant: "body-m",
|
|
1665
|
+
}) `
|
|
1666
|
+
display: table-cell;
|
|
1667
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
1668
|
+
padding: 16px 14px;
|
|
1669
|
+
&:first-child {
|
|
1670
|
+
border-radius: 10px 0 0 10px;
|
|
1671
|
+
}
|
|
1672
|
+
&:last-child {
|
|
1673
|
+
border-radius: 0 10px 10px 0;
|
|
1674
|
+
}
|
|
1675
|
+
`;
|
|
1676
|
+
const TableHeader = styled(Typography).attrs({
|
|
1677
|
+
forwardedAs: "th",
|
|
1678
|
+
variant: "body-s",
|
|
1679
|
+
}) `
|
|
1680
|
+
display: table-cell;
|
|
1681
|
+
color: ${({ theme }) => theme.colors.gray.darkGray2};
|
|
1682
|
+
padding: 16px 14px;
|
|
1683
|
+
`;
|
|
1684
|
+
const TableBody = styled.tbody ``;
|
|
1685
|
+
const TableHead = styled.thead ``;
|
|
1686
|
+
|
|
1687
|
+
const Table = ({ columns, data }) => {
|
|
1688
|
+
return (jsxs(TableStyled, { children: [jsx(TableHead, { children: jsx(TableRow, { children: columns.map((column) => (jsx(TableHeader, { width: column.width, align: column.align || "left", children: column.name }, column.id))) }) }), jsx(TableBody, { children: data.map((row) => (jsx(TableRow, { children: columns.map((column) => (jsx(TableCell, { width: column.width, align: column.align || "left", children: column.render ? column.render(row) : row[column.id] }, column.id))) }, row.id))) })] }));
|
|
1689
|
+
};
|
|
1690
|
+
|
|
1691
|
+
const SwitcherRoot = styled$1.div `
|
|
1692
|
+
display: inline-flex;
|
|
1693
|
+
`;
|
|
1694
|
+
const Track = styled$1.button `
|
|
1695
|
+
position: relative;
|
|
1696
|
+
width: 56px;
|
|
1697
|
+
height: 26px;
|
|
1698
|
+
padding: 4px;
|
|
1699
|
+
border: none;
|
|
1700
|
+
border-radius: 22px;
|
|
1701
|
+
background: ${({ $checked, theme }) => !$checked ? theme.colors.gray.darkGray2 : theme.colors.primary.primaryBlue};
|
|
1702
|
+
cursor: pointer;
|
|
1703
|
+
transition: background 150ms ease;
|
|
1704
|
+
outline: none;
|
|
1705
|
+
|
|
1706
|
+
&:focus-visible {
|
|
1707
|
+
box-shadow: 0 0 0 2px rgba(49, 99, 240, 0.4);
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
&:hover {
|
|
1711
|
+
background: ${({ $checked, theme }) => $checked ? theme.colors.primary.hoverBlue : theme.colors.gray.darkGray};
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
&:disabled {
|
|
1715
|
+
cursor: not-allowed;
|
|
1716
|
+
background: ${({ theme }) => theme.colors.gray.darkGray};
|
|
1717
|
+
}
|
|
1718
|
+
`;
|
|
1719
|
+
const Thumb = styled$1.span `
|
|
1720
|
+
position: absolute;
|
|
1721
|
+
top: 50%;
|
|
1722
|
+
left: 4px;
|
|
1723
|
+
width: 18px;
|
|
1724
|
+
height: 18px;
|
|
1725
|
+
border-radius: 50%;
|
|
1726
|
+
background: ${({ $disabled, theme }) => $disabled ? theme.colors.primary.darkBlue2 : "#ffffff"};
|
|
1727
|
+
box-shadow: ${({ $disabled }) => $disabled ? "none" : "0 3px 6px rgba(0, 0, 0, 0.25)"};
|
|
1728
|
+
transform: translate(${({ $checked }) => ($checked ? "30px" : "0")}, -50%);
|
|
1729
|
+
transition: transform 180ms ease, background 150ms ease, box-shadow 150ms ease;
|
|
1730
|
+
`;
|
|
1731
|
+
|
|
1732
|
+
const Switcher = ({ checked, defaultChecked = false, disabled = false, onChange, id, className, }) => {
|
|
1733
|
+
const generatedId = useId();
|
|
1734
|
+
const controlId = id ?? generatedId;
|
|
1735
|
+
const isControlled = checked !== undefined;
|
|
1736
|
+
const [innerValue, setInnerValue] = useState(defaultChecked);
|
|
1737
|
+
const value = isControlled ? checked : innerValue;
|
|
1738
|
+
const toggle = useCallback(() => {
|
|
1739
|
+
if (disabled)
|
|
1740
|
+
return;
|
|
1741
|
+
const next = !value;
|
|
1742
|
+
if (!isControlled)
|
|
1743
|
+
setInnerValue(next);
|
|
1744
|
+
onChange?.(next);
|
|
1745
|
+
}, [value, isControlled, disabled, onChange]);
|
|
1746
|
+
const handleKeyDown = useCallback((event) => {
|
|
1747
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1748
|
+
event.preventDefault();
|
|
1749
|
+
toggle();
|
|
1750
|
+
}
|
|
1751
|
+
}, [toggle]);
|
|
1752
|
+
return (jsx(SwitcherRoot, { className: className, children: jsx(Track, { id: controlId, role: "switch", "aria-checked": value, "aria-disabled": disabled, tabIndex: disabled ? -1 : 0, onClick: toggle, onKeyDown: handleKeyDown, disabled: disabled, "$checked": value, children: jsx(Thumb, { "$checked": value, "$disabled": disabled }) }) }));
|
|
1753
|
+
};
|
|
1754
|
+
|
|
1755
|
+
const Label = styled.label `
|
|
1756
|
+
display: inline-flex;
|
|
1757
|
+
align-items: center;
|
|
1758
|
+
gap: 12px;
|
|
1759
|
+
cursor: ${({ disabled }) => (disabled ? "not-allowed" : "pointer")};
|
|
1760
|
+
`;
|
|
1761
|
+
const HiddenInput = styled.input `
|
|
1762
|
+
position: absolute;
|
|
1763
|
+
opacity: 0;
|
|
1764
|
+
pointer-events: none;
|
|
1765
|
+
`;
|
|
1766
|
+
const Box = styled.span `
|
|
1767
|
+
width: 24px;
|
|
1768
|
+
height: 24px;
|
|
1769
|
+
border-radius: 3px;
|
|
1770
|
+
border: 1px solid ${({ theme }) => theme.colors.gray.lightGray3};
|
|
1771
|
+
background-color: ${({ theme }) => theme.colors.primary.white};
|
|
1772
|
+
display: inline-flex;
|
|
1773
|
+
align-items: center;
|
|
1774
|
+
justify-content: center;
|
|
1775
|
+
transition: background-color 140ms ease, border-color 140ms ease;
|
|
1776
|
+
|
|
1777
|
+
${({ $checked, theme }) => $checked &&
|
|
1778
|
+
css `
|
|
1779
|
+
border-color: ${theme.colors.primary.primaryBlue};
|
|
1780
|
+
background-color: ${theme.colors.primary.primaryBlue};
|
|
1781
|
+
`}
|
|
1782
|
+
|
|
1783
|
+
${({ $checked, $disabled, theme }) => !$disabled &&
|
|
1784
|
+
!$checked &&
|
|
1785
|
+
css `
|
|
1786
|
+
&:hover {
|
|
1787
|
+
border-color: ${theme.colors.primary.hoverBlue};
|
|
1788
|
+
}
|
|
1789
|
+
`}
|
|
1790
|
+
|
|
1791
|
+
${({ $checked, $disabled, theme }) => !$disabled &&
|
|
1792
|
+
$checked &&
|
|
1793
|
+
css `
|
|
1794
|
+
&:hover {
|
|
1795
|
+
border-color: ${theme.colors.primary.hoverBlue};
|
|
1796
|
+
background-color: ${theme.colors.primary.hoverBlue};
|
|
1797
|
+
}
|
|
1798
|
+
`}
|
|
1799
|
+
|
|
1800
|
+
${({ $disabled, theme }) => $disabled &&
|
|
1801
|
+
css `
|
|
1802
|
+
border-color: ${theme.colors.gray.lightGray2};
|
|
1803
|
+
background-color: ${theme.colors.gray.lightGray};
|
|
1804
|
+
`}
|
|
1805
|
+
`;
|
|
1806
|
+
const CheckIcon = styled.svg `
|
|
1807
|
+
width: 12px;
|
|
1808
|
+
height: 9px;
|
|
1809
|
+
fill: none;
|
|
1810
|
+
stroke-linecap: round;
|
|
1811
|
+
stroke-linejoin: round;
|
|
1812
|
+
transition: opacity 120ms ease;
|
|
1813
|
+
stroke: ${({ theme }) => theme.colors.primary.white};
|
|
1814
|
+
`;
|
|
1815
|
+
|
|
1816
|
+
const Checkbox = ({ checked, defaultChecked = false, disabled = false, name, value, onChange, className, }) => {
|
|
1817
|
+
const generatedId = useId();
|
|
1818
|
+
const isControlled = checked !== undefined;
|
|
1819
|
+
const [innerChecked, setInnerChecked] = useState(defaultChecked);
|
|
1820
|
+
const isChecked = isControlled ? checked : innerChecked;
|
|
1821
|
+
const handleChange = useCallback((event) => {
|
|
1822
|
+
if (disabled)
|
|
1823
|
+
return;
|
|
1824
|
+
if (!isControlled) {
|
|
1825
|
+
setInnerChecked(event.target.checked);
|
|
1826
|
+
}
|
|
1827
|
+
onChange?.(event.target.checked);
|
|
1828
|
+
}, [disabled, isControlled, onChange]);
|
|
1829
|
+
return (jsxs(Label, { htmlFor: generatedId, disabled: disabled, className: className, children: [jsx(HiddenInput, { id: generatedId, type: "checkbox", checked: isChecked, disabled: disabled, onChange: handleChange, name: name, value: value }), jsx(Box, { "$checked": isChecked, "$disabled": disabled, children: isChecked && (jsx(CheckIcon, { viewBox: "0 0 15 11", children: jsx("path", { d: "M5.00034 11L0 6.18738L1.42838 4.81262L5.00185 8.24806L5.00034 8.24951L13.5716 0L15 1.37476L6.42872 9.62524L5.00135 10.999L5.00034 11Z", fill: "#fff" }) })) })] }));
|
|
1830
|
+
};
|
|
1831
|
+
|
|
1832
|
+
const Logo = () => (jsxs(Icon, { width: "201", height: "32", viewBox: "0 0 201 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M178.7 1.20835C178.453 1.86745 177.971 3.0758 177.655 3.91341C177.325 4.73728 176.83 6.01429 176.554 6.72832C176.279 7.44234 175.77 8.74681 175.44 9.61188C175.11 10.4769 174.739 11.3969 174.629 11.6441C174.519 11.8913 174.422 12.1659 174.422 12.262C174.409 12.3581 174.298 12.674 174.147 12.976C173.996 13.2781 173.886 13.5939 173.872 13.6901C173.872 13.7862 173.79 14.0608 173.679 14.308C173.281 15.2142 172.496 17.2465 172.496 17.37C172.483 17.4524 172.373 17.7545 172.221 18.0566C172.07 18.3587 171.96 18.6745 171.946 18.7706C171.946 18.9217 171.85 19.1688 171.286 20.4596C171.176 20.7205 171.038 21.1187 170.983 21.3521C170.915 21.5718 170.612 22.4094 170.296 23.2058C169.979 24.0022 169.663 24.8673 169.58 25.1282C169.511 25.3891 169.388 25.6637 169.333 25.7461C169.278 25.8148 169.154 26.1031 169.085 26.364C169.002 26.6249 168.81 27.1879 168.645 27.5998C168.48 28.0118 168.177 28.8219 167.957 29.3986C167.751 29.9891 167.544 30.5246 167.489 30.5932C167.448 30.6756 167.462 30.7717 167.544 30.8267C167.613 30.8679 169.759 30.9091 172.318 30.9091H176.967L177.49 29.1515C177.792 28.1903 178.15 26.9819 178.301 26.4601L178.577 25.5401H184.065H189.54L189.746 25.9383C189.87 26.158 190.241 27.3389 190.572 28.561C190.916 29.7831 191.218 30.8129 191.246 30.8541C191.287 30.8816 193.502 30.9091 196.17 30.9091C199.678 30.9091 201.026 30.8541 200.999 30.7443C200.985 30.6619 200.104 28.3001 199.059 25.4989C198 22.684 196.693 19.1826 196.156 17.7133C195.606 16.2441 195.042 14.7199 194.891 14.3492C194.74 13.9647 194.451 13.1683 194.231 12.5641C194.011 11.9599 193.653 10.9987 193.419 10.4358C193.185 9.87277 192.993 9.35098 192.993 9.29606C192.993 9.2274 192.91 8.98024 192.8 8.74681C192.442 7.89547 192.03 6.79697 192.03 6.65966C192.016 6.57727 191.906 6.27518 191.755 5.9731C191.603 5.67101 191.493 5.32773 191.48 5.20415C191.48 5.0943 191.383 4.8746 191.273 4.72355C191.163 4.58624 191.067 4.36654 191.067 4.25669C191.067 4.02326 190.585 2.73252 190.297 2.16954C190.186 1.9773 190.104 1.68894 190.104 1.55163C190.104 1.41432 190.021 1.18089 189.911 1.02984C189.815 0.878801 189.691 0.590445 189.636 0.370745L189.554 0H184.354H179.168L178.7 1.20835ZM184.602 8.26622C184.767 8.81547 185.482 11.2184 186.184 13.5939C186.885 15.9695 187.559 18.2488 187.683 18.6333L187.889 19.3611H184.244C182.249 19.3611 180.612 19.3061 180.612 19.2512C180.612 19.1963 181.286 16.8345 182.112 14.0059C182.937 11.1772 183.707 8.49965 183.831 8.06025C183.955 7.63458 184.12 7.27757 184.189 7.27757C184.258 7.27757 184.45 7.7307 184.602 8.26622Z", fill: "white" }), jsx("path", { d: "M0 15.586V31.02L3.48022 31.0611C5.37852 31.0886 7.05673 31.0474 7.19429 30.9925C7.44189 30.8826 7.45565 30.3883 7.42814 19.0463C7.41438 12.5377 7.41438 7.11385 7.41438 7.004C7.45565 6.59206 7.84081 7.31982 7.84081 7.78668C7.84081 8.03384 7.9371 8.47324 8.04715 8.74787C8.1572 9.03623 8.30851 9.54428 8.37729 9.88756C8.44607 10.2308 8.76245 11.4941 9.07883 12.7025C9.39522 13.9108 9.82165 15.5723 10.0417 16.4099C10.2481 17.2338 10.6883 18.8815 10.9909 20.0487C11.2935 21.2158 12.0638 24.1543 12.6966 26.571L13.8521 30.965L17.1397 31.0337C18.9418 31.0749 20.4824 31.0611 20.5374 31.02C20.5924 30.9788 20.8263 30.2647 21.0464 29.4409C21.4591 27.8618 23.9076 18.5108 24.7192 15.3801C24.9806 14.3639 25.4482 12.5926 25.7371 11.4667C26.0397 10.327 26.3561 9.06369 26.4387 8.65175C26.5212 8.23981 26.7 7.64937 26.8376 7.34728C27.0852 6.81176 27.0852 7.11385 27.0989 18.909C27.0989 25.5824 27.1402 31.0337 27.209 31.0337C27.264 31.0337 28.9422 31.0474 30.9506 31.0474L34.5959 31.0611L34.6371 15.5998L34.6646 0.138376H28.5571H22.4357L22.2294 0.852402C22.0643 1.45658 20.2623 8.22608 18.9005 13.4577C18.0201 16.7669 17.4424 18.8953 17.3461 19.06C17.2635 19.1973 17.1948 19.1424 17.0985 18.8541C17.0159 18.6481 15.9155 14.4463 14.6637 9.54428C13.3982 4.6285 12.339 0.509121 12.2977 0.371807C12.2289 0.152107 11.8162 0.138376 6.10758 0.138376H0V15.586Z", fill: "white" }), jsx("path", { d: "M49.2589 1.34428C49.0113 2.00338 48.5299 3.21173 48.2135 4.04934C47.8833 4.87321 47.3881 6.15022 47.113 6.86424C46.8379 7.57827 46.3289 8.88274 45.9988 9.7478C45.6687 10.6129 45.2972 11.5329 45.1872 11.78C45.0772 12.0272 44.9809 12.3018 44.9809 12.3979C44.9671 12.4941 44.8571 12.8099 44.7057 13.112C44.5544 13.414 44.4444 13.7299 44.4306 13.826C44.4306 13.9221 44.3481 14.1967 44.238 14.4439C43.8391 15.3502 43.055 17.3824 43.055 17.506C43.0413 17.5883 42.9312 17.8904 42.7799 18.1925C42.6286 18.4946 42.5186 18.8104 42.5048 18.9065C42.5048 19.0576 42.4085 19.3047 41.8445 20.5955C41.7345 20.8564 41.5969 21.2546 41.5419 21.488C41.4731 21.7077 41.1705 22.5453 40.8541 23.3417C40.5377 24.1381 40.2213 25.0032 40.1388 25.2641C40.07 25.525 39.9462 25.7996 39.8912 25.882C39.8362 25.9507 39.7124 26.239 39.6436 26.4999C39.5611 26.7608 39.3685 27.3238 39.2034 27.7357C39.0383 28.1477 38.7357 28.9578 38.5156 29.5345C38.3093 30.125 38.1029 30.6605 38.0479 30.7291C38.0067 30.8115 38.0204 30.9077 38.1029 30.9626C38.1717 31.0038 40.3176 31.045 42.8762 31.045H47.5257L48.0484 29.2874C48.351 28.3262 48.7087 27.1178 48.86 26.596L49.1351 25.676H54.6237H60.0985L60.3049 26.0743C60.5249 26.4725 60.8688 27.6533 61.3778 29.5895C61.5291 30.1936 61.6942 30.7703 61.7492 30.8665C61.8868 31.1136 71.6259 31.1274 71.5571 30.8802C71.5434 30.7978 70.663 28.436 69.6175 25.6349C68.5583 22.8199 67.2515 19.3185 66.7151 17.8492C66.1648 16.38 65.6008 14.8558 65.4495 14.4851C65.2982 14.1006 65.0093 13.3042 64.7893 12.7C64.5692 12.0958 64.2115 11.1347 63.9777 10.5717C63.7438 10.0087 63.5512 9.48691 63.5512 9.43199C63.5512 9.36333 63.4687 9.11617 63.3586 8.88274C63.001 8.0314 62.5883 6.9329 62.5883 6.79559C62.5746 6.7132 62.4645 6.41111 62.3132 6.10903C62.1619 5.80694 62.0518 5.46366 62.0381 5.34007C62.0381 5.23022 61.9418 5.01052 61.8317 4.85948C61.7217 4.72217 61.6254 4.50247 61.6254 4.39262C61.6254 4.15919 61.144 2.86845 60.8551 2.30547C60.745 2.11323 60.6625 1.82487 60.6625 1.68756C60.6625 1.55025 60.58 1.31682 60.4699 1.16578C60.3736 1.01473 60.2498 0.726376 60.1948 0.506676L60.1123 0.135933H54.9126H49.7266L49.2589 1.34428ZM55.1602 8.40214C55.3252 8.95139 56.0405 11.3544 56.7421 13.7299C57.4436 16.1054 58.1177 18.3848 58.2415 18.7692L58.4478 19.497H54.8025C52.8079 19.497 51.171 19.4421 51.171 19.3871C51.171 19.3322 51.845 16.9704 52.6704 14.1418C53.4957 11.3132 54.266 8.63557 54.3898 8.19617C54.5136 7.77051 54.6787 7.41349 54.7475 7.41349C54.8163 7.41349 55.0089 7.86662 55.1602 8.40214Z", fill: "white" }), jsx("path", { d: "M72.5197 3.73433L72.561 7.34565L77.3893 7.38684L82.2313 7.4143L82.3138 7.73012C82.3551 7.8949 82.3964 13.2089 82.3964 19.539V31.032L87.0183 31.0046L91.6265 30.9634V19.4978C91.6128 12.3713 91.6678 7.94982 91.7503 7.82624C91.8604 7.64773 92.6169 7.60654 96.7299 7.55161L101.586 7.48296L101.627 3.80298L101.654 0.136742H87.0733H72.4922L72.5197 3.73433Z", fill: "white" }), jsx("path", { d: "M107.185 0.302076C106.951 0.535509 106.951 30.909 107.185 31.1425C107.405 31.3622 120.762 31.3759 122.922 31.1562C129.47 30.4971 132.881 27.3252 132.881 21.9013C132.881 18.853 131.767 16.4638 129.745 15.1867L129.153 14.816L129.786 14.102C131.492 12.1521 132.235 9.25485 131.739 6.49487C131.052 2.74624 128.369 0.810133 123.128 0.274614C121.051 0.0686455 107.405 0.0823765 107.185 0.302076ZM122.028 7.14024C123.692 7.45606 124.256 8.0465 124.325 9.52947C124.38 10.5319 124.38 10.5456 123.871 11.0948C123.004 12.0698 122.55 12.1521 118.162 12.1521H114.379L114.338 9.57067L114.311 7.00292H117.791C119.717 7.00292 121.615 7.07158 122.028 7.14024ZM123.183 19.0178C124.132 19.2649 124.573 19.5396 125.013 20.1987C125.302 20.6106 125.329 20.8028 125.288 21.6954C125.233 22.9174 124.944 23.4392 124.036 23.8786C123.059 24.3592 122.138 24.4416 118.149 24.4416H114.311V21.6267V18.8118H118.341C121.505 18.8118 122.55 18.853 123.183 19.0178Z", fill: "white" }), jsx("path", { d: "M139.002 0.301773C138.96 0.397892 138.946 7.40082 138.96 15.8593L139.002 31.2383L150.955 31.2795C159.676 31.2932 162.95 31.2657 163.088 31.1559C163.239 31.0323 163.28 30.332 163.28 27.8604C163.28 24.9082 163.267 24.7159 163.019 24.5786C162.84 24.4962 159.897 24.4413 154.422 24.4413H146.086V21.6264V18.8115L153.83 18.784L161.561 18.7428V15.516V12.2891L153.83 12.248L146.086 12.2205V9.61156V7.00262L154.38 6.97516L162.661 6.93396V3.56981V0.205654L150.859 0.164461C141.491 0.136997 139.043 0.164461 139.002 0.301773Z", fill: "white" })] }));
|
|
1833
|
+
|
|
1834
|
+
const ApplicationDataStyled = styled$1.div `
|
|
1835
|
+
display: flex;
|
|
1836
|
+
column-gap: 10px;
|
|
1837
|
+
row-gap: 12px;
|
|
1838
|
+
width: 100%;
|
|
1839
|
+
flex: 1;
|
|
1840
|
+
flex-direction: column;
|
|
1841
|
+
${({ theme }) => theme.media.maxWidth.tablet} {
|
|
1842
|
+
flex-direction: row;
|
|
1843
|
+
justify-content: space-between;
|
|
1844
|
+
}
|
|
1845
|
+
${({ theme }) => theme.media.maxWidth.mobile} {
|
|
1846
|
+
flex-direction: column;
|
|
1847
|
+
}
|
|
1848
|
+
`;
|
|
1849
|
+
const ApplicationDataLabel = styled$1(Typography).attrs({
|
|
1850
|
+
forwardedAs: "p",
|
|
1851
|
+
variant: "body-s-semibold",
|
|
1852
|
+
}) `
|
|
1853
|
+
white-space: nowrap;
|
|
1854
|
+
color: ${({ theme }) => theme.colors.gray.darkGray};
|
|
1855
|
+
`;
|
|
1856
|
+
const ApplicationDataContent = styled$1.div `
|
|
1857
|
+
display: flex;
|
|
1858
|
+
align-items: center;
|
|
1859
|
+
gap: 8px;
|
|
1860
|
+
height: 100%;
|
|
1861
|
+
`;
|
|
1862
|
+
const ApplicationDataValue = styled$1(Typography).attrs({
|
|
1863
|
+
forwardedAs: "p",
|
|
1864
|
+
variant: "body-m-semibold",
|
|
1865
|
+
}) `
|
|
1866
|
+
margin: 0;
|
|
1867
|
+
white-space: nowrap;
|
|
1868
|
+
color: ${({ theme }) => `${theme.colors.primary.darkBlue}`};
|
|
1869
|
+
`;
|
|
1870
|
+
|
|
1871
|
+
const ApplicationData = ({ label, statusValue, withdraw, info, }) => {
|
|
1872
|
+
return (jsxs(ApplicationDataStyled, { children: [jsxs(ApplicationDataContent, { children: [jsx(ApplicationDataLabel, { children: label }), info && (jsx(Tooltip, { content: info, children: jsx(InfoIcon, { size: 18 }) }))] }), jsxs(ApplicationDataContent, { children: [["number", "string"].includes(typeof statusValue) && (jsx(ApplicationDataValue, { children: statusValue })), !["number", "string"].includes(typeof statusValue) && statusValue, withdraw && jsx(WithdrawIcon, { size: 18 })] })] }));
|
|
1873
|
+
};
|
|
1874
|
+
|
|
1875
|
+
const ApplicationInfoStyled = styled$1.div `
|
|
1876
|
+
display: flex;
|
|
1877
|
+
width: fit-content;
|
|
1878
|
+
align-items: center;
|
|
1879
|
+
gap: 22px;
|
|
1880
|
+
${({ $variant }) => {
|
|
1881
|
+
switch ($variant) {
|
|
1882
|
+
case "secondary":
|
|
1883
|
+
return css `
|
|
1884
|
+
padding: 24px;
|
|
1885
|
+
background: #f5f5f5;
|
|
1886
|
+
`;
|
|
1887
|
+
case "primary":
|
|
1888
|
+
default:
|
|
1889
|
+
return css `
|
|
1890
|
+
padding: 24px 20px;
|
|
1891
|
+
background: ${({ theme }) => theme.colors.primary.white};
|
|
1892
|
+
border: 1px solid ${({ theme }) => theme.colors.gray.lightGray2};
|
|
1893
|
+
`;
|
|
1894
|
+
}
|
|
1895
|
+
}}
|
|
1896
|
+
|
|
1897
|
+
border-radius: 6px;
|
|
1898
|
+
${({ theme }) => theme.media.maxWidth.tablet} {
|
|
1899
|
+
width: 100%;
|
|
1900
|
+
flex-direction: column;
|
|
1901
|
+
gap: 18px;
|
|
1902
|
+
padding: 18px 20px;
|
|
1903
|
+
}
|
|
1904
|
+
${({ theme }) => theme.media.maxWidth.mobile} {
|
|
1905
|
+
flex-direction: column;
|
|
1906
|
+
gap: 16px;
|
|
1907
|
+
padding: 16px 20px;
|
|
1908
|
+
}
|
|
1909
|
+
`;
|
|
1910
|
+
const ApplicationInfoDataContainer = styled$1.div `
|
|
1911
|
+
display: flex;
|
|
1912
|
+
gap: 56px;
|
|
1913
|
+
width: fit-content;
|
|
1914
|
+
${({ theme }) => theme.media.maxWidth.tablet} {
|
|
1915
|
+
width: 100%;
|
|
1916
|
+
flex-direction: column;
|
|
1917
|
+
gap: 12px;
|
|
1918
|
+
}
|
|
1919
|
+
${({ theme }) => theme.media.maxWidth.mobile} {
|
|
1920
|
+
flex-direction: column;
|
|
1921
|
+
gap: 8px;
|
|
1922
|
+
}
|
|
1923
|
+
`;
|
|
1924
|
+
const ApplicationDataActions = styled$1.div `
|
|
1925
|
+
display: flex;
|
|
1926
|
+
gap: 22px;
|
|
1927
|
+
width: fit-content;
|
|
1928
|
+
${({ theme }) => theme.media.maxWidth.tablet} {
|
|
1929
|
+
width: 100%;
|
|
1930
|
+
gap: 20px;
|
|
1931
|
+
}
|
|
1932
|
+
`;
|
|
1933
|
+
|
|
1934
|
+
const ApplicationInfo = ({ children, actions, variant = "primary", }) => (jsxs(ApplicationInfoStyled, { "$variant": variant, children: [jsx(ApplicationInfoDataContainer, { children: children }), actions && jsx(ApplicationDataActions, { children: actions })] }));
|
|
1935
|
+
|
|
1936
|
+
const ApplicationStatusStyled = styled$1.div `
|
|
1937
|
+
display: flex;
|
|
1938
|
+
column-gap: 10px;
|
|
1939
|
+
row-gap: 12px;
|
|
1940
|
+
width: 100%;
|
|
1941
|
+
flex: 1;
|
|
1942
|
+
flex-direction: column;
|
|
1943
|
+
${({ theme }) => theme.media.maxWidth.tablet} {
|
|
1944
|
+
flex-direction: row;
|
|
1945
|
+
justify-content: space-between;
|
|
1946
|
+
}
|
|
1947
|
+
${({ theme }) => theme.media.maxWidth.mobile} {
|
|
1948
|
+
flex-direction: column;
|
|
1949
|
+
}
|
|
1950
|
+
`;
|
|
1951
|
+
const ApplicationStatusLabel = styled$1(Typography).attrs({
|
|
1952
|
+
forwardedAs: "p",
|
|
1953
|
+
variant: "body-s-semibold",
|
|
1954
|
+
}) `
|
|
1955
|
+
margin: 0;
|
|
1956
|
+
white-space: nowrap;
|
|
1957
|
+
color: ${({ theme }) => theme.colors.gray.darkGray};
|
|
1958
|
+
`;
|
|
1959
|
+
const ApplicationStatusContent = styled$1.div `
|
|
1960
|
+
display: flex;
|
|
1961
|
+
align-items: center;
|
|
1962
|
+
gap: 8px;
|
|
1963
|
+
height: 100%;
|
|
1964
|
+
`;
|
|
1965
|
+
const ApplicationStatusValue = styled$1(Typography).attrs({
|
|
1966
|
+
forwardedAs: "p",
|
|
1967
|
+
variant: "body-m-semibold",
|
|
1968
|
+
}) `
|
|
1969
|
+
white-space: nowrap;
|
|
1970
|
+
margin: 0;
|
|
1971
|
+
${({ $type, theme }) => {
|
|
1972
|
+
switch ($type) {
|
|
1973
|
+
case "success":
|
|
1974
|
+
return `
|
|
1975
|
+
color: ${theme.colors.accent.green};
|
|
1976
|
+
`;
|
|
1977
|
+
case "pending":
|
|
1978
|
+
return `
|
|
1979
|
+
color: ${theme.colors.primary.darkBlue};
|
|
1980
|
+
`;
|
|
1981
|
+
case "warning":
|
|
1982
|
+
return `
|
|
1983
|
+
color: ${theme.colors.accent.orange};
|
|
1984
|
+
`;
|
|
1985
|
+
}
|
|
1986
|
+
}}
|
|
1987
|
+
`;
|
|
1988
|
+
|
|
1989
|
+
const ApplicationStatus = ({ label, statusValue, type, }) => {
|
|
1990
|
+
const icon = useMemo(() => {
|
|
1991
|
+
switch (type) {
|
|
1992
|
+
case "success":
|
|
1993
|
+
return jsx(SuccessfullSmallIcon, { size: 18 });
|
|
1994
|
+
case "warning":
|
|
1995
|
+
return jsx(WarningIcon, { size: 18 });
|
|
1996
|
+
case "pending":
|
|
1997
|
+
default:
|
|
1998
|
+
return jsx(ClockIcon, { size: 18 });
|
|
1999
|
+
}
|
|
2000
|
+
}, [type]);
|
|
2001
|
+
return (jsxs(ApplicationStatusStyled, { children: [jsx(ApplicationStatusContent, { children: jsx(ApplicationStatusLabel, { children: label }) }), jsxs(ApplicationStatusContent, { children: [icon, jsx(ApplicationStatusValue, { "$type": type, children: statusValue })] })] }));
|
|
2002
|
+
};
|
|
2003
|
+
|
|
2004
|
+
const BalanceRowStyled = styled$1.tr `
|
|
2005
|
+
position: relative;
|
|
2006
|
+
`;
|
|
2007
|
+
const BalanceCell = styled$1.td `
|
|
2008
|
+
padding: 14px 16px;
|
|
2009
|
+
border-collapse: separate;
|
|
2010
|
+
border-spacing: 0;
|
|
2011
|
+
white-space: nowrap;
|
|
2012
|
+
background: ${({ theme }) => theme.colors.gray.lightBlueGray};
|
|
2013
|
+
`;
|
|
2014
|
+
const BalanceCellActions = styled$1.td `
|
|
2015
|
+
background: ${({ theme }) => theme.colors.gray.lightBlueGray};
|
|
2016
|
+
`;
|
|
2017
|
+
|
|
2018
|
+
const BalanceRow = ({ valueLabel, count, amount, actions, }) => {
|
|
2019
|
+
return (jsxs(BalanceRowStyled, { children: [jsx(BalanceCell, { children: valueLabel }), jsx(BalanceCell, { children: count }), jsx(BalanceCell, { children: amount }), jsx(BalanceCellActions, { children: actions })] }));
|
|
2020
|
+
};
|
|
2021
|
+
|
|
2022
|
+
const CurrencyNameStyled = styled.div `
|
|
2023
|
+
display: grid;
|
|
2024
|
+
grid-template-columns: ${({ $longname, $shortname, $network, $icon }) => `
|
|
2025
|
+
${$icon ? "auto" : ""}
|
|
2026
|
+
${$longname || $network ? "1fr" : ""}
|
|
2027
|
+
${$shortname ? "auto" : ""}
|
|
2028
|
+
`};
|
|
2029
|
+
grid-template-areas: ${({ $network, $icon }) => `
|
|
2030
|
+
"${$icon ? "icon " : ""}longname shortname"
|
|
2031
|
+
${$network ? `"${!$icon ? "" : "."} network ."` : ""}
|
|
2032
|
+
`};
|
|
2033
|
+
width: 100%;
|
|
2034
|
+
column-gap: 10px;
|
|
2035
|
+
align-items: center;
|
|
2036
|
+
`;
|
|
2037
|
+
const CurrencyNameLongname = styled(Typography).attrs({
|
|
2038
|
+
variant: "body-m-bold",
|
|
2039
|
+
}) `
|
|
2040
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
2041
|
+
grid-area: longname;
|
|
2042
|
+
`;
|
|
2043
|
+
const CurrencyNameShortname = styled(Typography).attrs({
|
|
2044
|
+
variant: "body-m",
|
|
2045
|
+
}) `
|
|
2046
|
+
color: ${({ theme }) => theme.colors.gray.darkGray};
|
|
2047
|
+
grid-area: shortname;
|
|
2048
|
+
`;
|
|
2049
|
+
const CurrencyNameNetwork = styled(Typography).attrs({
|
|
2050
|
+
variant: "body-s",
|
|
2051
|
+
}) `
|
|
2052
|
+
color: ${({ theme }) => theme.colors.gray.darkGray2};
|
|
2053
|
+
grid-area: network;
|
|
2054
|
+
`;
|
|
2055
|
+
|
|
2056
|
+
const CurrencyName = ({ icon, network, longName, shortName, }) => (jsxs(CurrencyNameStyled, { "$icon": !!icon, "$longname": !!longName, "$shortname": !!shortName, "$network": !!network, children: [icon, jsx(CurrencyNameLongname, { children: longName }), shortName && jsx(CurrencyNameShortname, { children: shortName }), network && jsx(CurrencyNameNetwork, { children: network })] }));
|
|
2057
|
+
|
|
2058
|
+
const CurrencyRateCard = styled$1.div `
|
|
2059
|
+
display: flex;
|
|
2060
|
+
flex-direction: column;
|
|
2061
|
+
align-items: flex-start;
|
|
2062
|
+
padding: 16px;
|
|
2063
|
+
background: ${({ theme }) => theme.colors.gray.lightBlueGray};
|
|
2064
|
+
border-radius: 10px;
|
|
2065
|
+
gap: 14px;
|
|
2066
|
+
`;
|
|
2067
|
+
const CurrencyRateBody = styled$1.div `
|
|
2068
|
+
display: flex;
|
|
2069
|
+
flex-direction: row;
|
|
2070
|
+
align-items: flex-start;
|
|
2071
|
+
padding: 0px;
|
|
2072
|
+
gap: 10px;
|
|
2073
|
+
width: 100%;
|
|
2074
|
+
`;
|
|
2075
|
+
const CurrencyRateBox = styled$1.div `
|
|
2076
|
+
display: flex;
|
|
2077
|
+
flex-direction: column;
|
|
2078
|
+
align-items: flex-start;
|
|
2079
|
+
gap: 8px;
|
|
2080
|
+
padding: 0px;
|
|
2081
|
+
width: 100%;
|
|
2082
|
+
`;
|
|
2083
|
+
const CurrencyRatePriceLabel = styled$1(Typography).attrs({
|
|
2084
|
+
variant: "body-s",
|
|
2085
|
+
}) `
|
|
2086
|
+
color: ${({ theme }) => theme.colors.gray.darkGray};
|
|
2087
|
+
`;
|
|
2088
|
+
const CurrencyRateAmount = styled$1(Typography).attrs({
|
|
2089
|
+
variant: "body-m-bold",
|
|
2090
|
+
}) `
|
|
2091
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
2092
|
+
`;
|
|
2093
|
+
|
|
2094
|
+
const CurrencyRate = ({ longName, shortName, network, icon, buyLabel, sellLabel, buyValue, sellValue, }) => (jsxs(CurrencyRateCard, { children: [jsx(CurrencyName, { longName: longName, shortName: shortName, network: network, icon: icon }), (buyValue || sellValue) && (jsxs(CurrencyRateBody, { children: [buyValue && (jsxs(CurrencyRateBox, { children: [jsx(CurrencyRatePriceLabel, { children: buyLabel }), jsx(CurrencyRateAmount, { children: buyValue })] })), sellValue && (jsxs(CurrencyRateBox, { children: [jsx(CurrencyRatePriceLabel, { children: sellLabel }), jsx(CurrencyRateAmount, { children: sellValue })] }))] }))] }));
|
|
2095
|
+
|
|
2096
|
+
const RequisitesStyled = styled$1.div `
|
|
2097
|
+
display: grid;
|
|
2098
|
+
grid-template-columns: auto 1fr;
|
|
2099
|
+
row-gap: 12px;
|
|
2100
|
+
column-gap: 10px;
|
|
2101
|
+
width: 100%;
|
|
2102
|
+
background: #f5f5f5;
|
|
2103
|
+
border-radius: 10px;
|
|
2104
|
+
padding: 18px 24px;
|
|
2105
|
+
${({ theme }) => theme.media.maxWidth.tablet} {
|
|
2106
|
+
grid-template-columns: 1fr 1fr;
|
|
2107
|
+
padding: 18px 20px;
|
|
2108
|
+
}
|
|
2109
|
+
${({ theme }) => theme.media.maxWidth.mobile} {
|
|
2110
|
+
padding: 16px 14px;
|
|
2111
|
+
grid-template-columns: auto;
|
|
2112
|
+
row-gap: 8px;
|
|
2113
|
+
& > *:not(:nth-child(2n)) {
|
|
2114
|
+
margin-top: 4px;
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
`;
|
|
2118
|
+
const RequisitesItemLabel = styled$1(Typography).attrs({
|
|
2119
|
+
variant: "body-m",
|
|
2120
|
+
forwardedAs: "p",
|
|
2121
|
+
}) `
|
|
2122
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
2123
|
+
`;
|
|
2124
|
+
const RequisitesItemValue = styled$1(Typography).attrs({
|
|
2125
|
+
variant: "body-m-bold",
|
|
2126
|
+
forwardedAs: "p",
|
|
2127
|
+
}) `
|
|
2128
|
+
display: flex;
|
|
2129
|
+
gap: 8px;
|
|
2130
|
+
align-items: center;
|
|
2131
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
2132
|
+
`;
|
|
2133
|
+
|
|
2134
|
+
const CopyButtonStyled = styled$1.button `
|
|
2135
|
+
border: none;
|
|
2136
|
+
background: none;
|
|
2137
|
+
cursor: pointer;
|
|
2138
|
+
padding: 0;
|
|
2139
|
+
`;
|
|
2140
|
+
|
|
2141
|
+
const CopyButton = ({ text, size = 18 }) => {
|
|
2142
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
2143
|
+
const ref = useRef(null);
|
|
2144
|
+
useEffect(() => {
|
|
2145
|
+
if (isCopied) {
|
|
2146
|
+
ref.current = setTimeout(() => {
|
|
2147
|
+
setIsCopied(false);
|
|
2148
|
+
}, 1500);
|
|
2149
|
+
}
|
|
2150
|
+
return () => {
|
|
2151
|
+
if (ref.current) {
|
|
2152
|
+
clearTimeout(ref.current);
|
|
2153
|
+
}
|
|
2154
|
+
};
|
|
2155
|
+
}, [isCopied]);
|
|
2156
|
+
const handleClick = async () => {
|
|
2157
|
+
await copyToClipboard(text);
|
|
2158
|
+
setIsCopied(true);
|
|
2159
|
+
};
|
|
2160
|
+
return (jsx(CopyButtonStyled, { onClick: handleClick, children: isCopied ? jsx(CheckIcon$1, { size: size }) : jsx(CopyIcon, { size: size }) }));
|
|
2161
|
+
};
|
|
2162
|
+
|
|
2163
|
+
const Requisites = ({ cardHolderLabel, cardHolderName, cardNumberLabel, cardNumber, merchantLabel, merchantName, descriptionLabel, description, }) => (jsxs(RequisitesStyled, { children: [jsx(RequisitesItemLabel, { children: cardHolderLabel }), jsx(RequisitesItemValue, { children: cardHolderName }), jsx(RequisitesItemLabel, { children: cardNumberLabel }), jsxs(RequisitesItemValue, { children: [cardNumber && formatCardNumber(cardNumber), cardNumber && jsx(CopyButton, { text: cardNumber.toString() })] }), jsx(RequisitesItemLabel, { children: merchantLabel }), jsx(RequisitesItemValue, { children: merchantName }), jsx(RequisitesItemLabel, { children: descriptionLabel }), jsx(RequisitesItemValue, { children: description })] }));
|
|
2164
|
+
|
|
2165
|
+
const TransactionStatusStyled = styled$1.div `
|
|
2166
|
+
display: flex;
|
|
2167
|
+
align-items: center;
|
|
2168
|
+
gap: 12px;
|
|
2169
|
+
flex-wrap: wrap;
|
|
2170
|
+
width: 100%;
|
|
2171
|
+
justify-content: space-between;
|
|
2172
|
+
`;
|
|
2173
|
+
const TransactionStatusLabel = styled$1(Typography).attrs({
|
|
2174
|
+
forwardedAs: "p",
|
|
2175
|
+
variant: "body-m-semibold",
|
|
2176
|
+
}) `
|
|
2177
|
+
margin: 0;
|
|
2178
|
+
flex: 1 1 auto;
|
|
2179
|
+
color: ${({ theme }) => theme.colors.gray.darkGray};
|
|
2180
|
+
`;
|
|
2181
|
+
const TransactionStatusContent = styled$1.div `
|
|
2182
|
+
display: flex;
|
|
2183
|
+
align-items: center;
|
|
2184
|
+
gap: 8px;
|
|
2185
|
+
flex: 1 1 auto;
|
|
2186
|
+
`;
|
|
2187
|
+
const TransactionStatusValue = styled$1(Typography).attrs({
|
|
2188
|
+
forwardedAs: "p",
|
|
2189
|
+
variant: "body-s-semibold",
|
|
2190
|
+
}) `
|
|
2191
|
+
margin: 0;
|
|
2192
|
+
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
2193
|
+
`;
|
|
2194
|
+
|
|
2195
|
+
const TransactionStatus = ({ label, statusValue, type, }) => {
|
|
2196
|
+
const icon = useMemo(() => {
|
|
2197
|
+
switch (type) {
|
|
2198
|
+
case "success":
|
|
2199
|
+
return jsx(SuccessfullSmallIcon, { size: 18 });
|
|
2200
|
+
case "pending":
|
|
2201
|
+
default:
|
|
2202
|
+
return jsx(ClockIcon, { size: 18 });
|
|
2203
|
+
}
|
|
2204
|
+
}, [type]);
|
|
2205
|
+
return (jsxs(TransactionStatusStyled, { children: [jsx(TransactionStatusLabel, { children: label }), jsxs(TransactionStatusContent, { children: [icon, jsx(TransactionStatusValue, { children: statusValue })] })] }));
|
|
2206
|
+
};
|
|
2207
|
+
|
|
2208
|
+
const colors = {
|
|
2209
|
+
primary: {
|
|
2210
|
+
primaryBlue: "#2D58B6",
|
|
2211
|
+
hoverBlue: "#3163F0",
|
|
2212
|
+
activeBlue: "#244AB7",
|
|
2213
|
+
lightBlue2: "#6D93FF",
|
|
2214
|
+
darkBlue: "#202D52",
|
|
2215
|
+
darkBlue2: "#1F2635",
|
|
2216
|
+
darkBlue3: "#131A2A",
|
|
2217
|
+
white: "#FFFFFF",
|
|
2218
|
+
},
|
|
2219
|
+
gray: {
|
|
2220
|
+
lightGray2: "#D9D9D9",
|
|
2221
|
+
lightGray3: "#D0D1D8",
|
|
2222
|
+
darkGray: "#9296A5",
|
|
2223
|
+
lightGray: "#F3F3F5",
|
|
2224
|
+
darkGray2: "#5E6F8D",
|
|
2225
|
+
lightBlueGray: "#EFF2FB",
|
|
2226
|
+
lightBlueGray2: "#F1F4F9",
|
|
2227
|
+
},
|
|
2228
|
+
accent: {
|
|
2229
|
+
red: "#F84545",
|
|
2230
|
+
green: "#1CD850",
|
|
2231
|
+
greenLight: "#A7FFC0",
|
|
2232
|
+
green2: "#00BC9E",
|
|
2233
|
+
green2Light: "#00D6B3",
|
|
2234
|
+
green2Dark: "#009E85",
|
|
2235
|
+
orange: "#FFA63E",
|
|
2236
|
+
purple: "#843CF0",
|
|
2237
|
+
},
|
|
2238
|
+
icon: {
|
|
2239
|
+
iconPrimary: "#202D52",
|
|
2240
|
+
iconSecondary: "#202D52",
|
|
2241
|
+
iconThirty: "#5E6F8D",
|
|
2242
|
+
iconFourth: "#FFA63E",
|
|
2243
|
+
iconFive: "#2D5B86",
|
|
2244
|
+
},
|
|
2245
|
+
};
|
|
2246
|
+
|
|
2247
|
+
const theme = {
|
|
2248
|
+
colors,
|
|
2249
|
+
media: {
|
|
2250
|
+
maxWidth: {
|
|
2251
|
+
mobile: "@media (max-width: 375px)",
|
|
2252
|
+
tablet: "@media (max-width: 834px)",
|
|
2253
|
+
},
|
|
2254
|
+
},
|
|
2255
|
+
};
|
|
2256
|
+
|
|
2257
|
+
export { ApplicationData, ApplicationInfo, ApplicationStatus, BalanceRow, Button, Checkbox, Container, CopyTooltip, Counter, CurrencyName, CurrencyRate, HamburgerButton, Informer, Loader, Logo, RadioButton, Requisites, SelectField, Switcher, TabList, Table, TextField, Tooltip, TransactionStatus, Typography, UserAccount, copyToClipboard, formatCardNumber, maskEmail, theme };
|
|
2258
|
+
//# sourceMappingURL=matbea-ui.es.js.map
|