@sima-land/ui-nucleons 40.1.0 → 40.3.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/_internal/custom-scrollbar/index.js +3 -3
- package/alert/index.d.ts +2 -0
- package/alert/index.js +3 -3
- package/autocomplete/index.js +12 -17
- package/avatar/index.d.ts +1 -1
- package/avatar/index.js +2 -4
- package/avatar/user.d.ts +1 -1
- package/avatar/user.js +2 -2
- package/avatar/utils.js +7 -1
- package/base-input/index.d.ts +1 -1
- package/base-input/index.js +1 -1
- package/bordered-layout/index.d.ts +1 -1
- package/bordered-layout/index.js +1 -1
- package/box/index.js +17 -36
- package/button/index.d.ts +3 -3
- package/button/index.js +4 -4
- package/card/slots.js +1 -1
- package/carousel/draggable.js +14 -16
- package/carousel/index.d.ts +1 -1
- package/carousel/index.js +17 -37
- package/chips/index.js +1 -1
- package/clean-buttons/index.js +1 -3
- package/dot-nav/dot-nav.module.scss +2 -2
- package/dropdown/dropdown.module.scss +1 -3
- package/field-grid/index.d.ts +2 -2
- package/field-grid/index.js +3 -3
- package/file-icon/index.js +5 -6
- package/helpers/bounds-of.js +1 -3
- package/helpers/find-child-element.js +1 -3
- package/helpers/find-offset-parent.js +4 -3
- package/helpers/fit-element-height.js +1 -1
- package/helpers/format-date.js +3 -1
- package/helpers/get-fraction-depth.js +1 -3
- package/hooks/identity.d.ts +1 -0
- package/hooks/identity.js +1 -0
- package/layout/index.js +1 -1
- package/link/index.js +1 -3
- package/loading-overlay/index.d.ts +1 -1
- package/loading-overlay/index.js +1 -1
- package/nav-bar/index.d.ts +1 -0
- package/nav-bar/index.js +1 -1
- package/package.json +17 -14
- package/pagination/base-pagination.js +18 -20
- package/pagination/index.js +1 -3
- package/pagination/utils.d.ts +2 -2
- package/pagination/utils.js +7 -6
- package/panel/index.js +1 -3
- package/phone-input/index.js +19 -20
- package/price/utils.js +1 -3
- package/range/index.js +11 -14
- package/rating/index.js +2 -2
- package/readme.md +1 -1
- package/screen/index.js +14 -16
- package/screen/screen-layout.js +10 -4
- package/select/index.js +5 -7
- package/side-page/index.d.ts +3 -2
- package/side-page/index.js +48 -6
- package/spinner/index.d.ts +1 -1
- package/spinner/index.js +1 -1
- package/spinner/spinner.module.scss +1 -4
- package/styling/fonts.js +1 -3
- package/styling/utils.js +1 -3
- package/text-field/index.js +3 -10
- package/timer/index.d.ts +3 -3
- package/timer/index.js +4 -4
- package/timer/utils.js +1 -4
- package/top-bar/index.js +1 -1
- package/unknown-content/index.d.ts +4 -2
- package/unknown-content/index.js +28 -2
- package/unknown-content/unknown-content.module.scss +214 -120
- package/unknown-content/utils.d.ts +6 -0
- package/unknown-content/utils.js +18 -0
- package/upload/area.js +3 -1
- package/upload/utils.d.ts +2 -2
- package/upload/utils.js +2 -2
- package/with-hint/positioning-hint.d.ts +1 -1
- package/with-hint/positioning-hint.js +1 -1
- package/with-hint/utils.js +5 -7
- package/with-in-viewport-observer/index.js +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@use '../colors';
|
|
2
|
+
@use '../breakpoints';
|
|
2
3
|
|
|
3
4
|
.root {
|
|
4
5
|
color: colors.$gray87;
|
|
@@ -12,149 +13,260 @@
|
|
|
12
13
|
padding: 0;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
// ссылки
|
|
17
|
+
a {
|
|
18
|
+
color: colors.$brand-blue;
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
&:hover {
|
|
21
|
+
color: colors.$brand-deep-blue;
|
|
22
|
+
}
|
|
20
23
|
}
|
|
21
|
-
|
|
24
|
+
|
|
25
|
+
// параграф
|
|
26
|
+
p {
|
|
27
|
+
margin-bottom: 24px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// курсив
|
|
31
|
+
i,
|
|
32
|
+
em {
|
|
33
|
+
font-style: normal; // да, вот так по гайдам
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// заголовки
|
|
37
|
+
h1 {
|
|
22
38
|
font-weight: 600;
|
|
23
39
|
font-size: 24px;
|
|
24
40
|
line-height: 32px;
|
|
41
|
+
margin-bottom: 32px;
|
|
25
42
|
}
|
|
26
|
-
|
|
43
|
+
h2 {
|
|
27
44
|
font-weight: 600;
|
|
28
45
|
font-size: 20px;
|
|
29
46
|
line-height: 28px;
|
|
47
|
+
margin-bottom: 24px;
|
|
48
|
+
}
|
|
49
|
+
h3 {
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
font-size: 16px;
|
|
52
|
+
line-height: 24px;
|
|
53
|
+
margin-bottom: 24px;
|
|
30
54
|
}
|
|
31
55
|
h4 {
|
|
32
|
-
font-weight:
|
|
56
|
+
font-weight: 600;
|
|
33
57
|
font-size: 16px;
|
|
34
58
|
line-height: 24px;
|
|
59
|
+
color: colors.$gray38;
|
|
60
|
+
margin-bottom: 16px;
|
|
35
61
|
}
|
|
36
62
|
h5 {
|
|
37
63
|
font-weight: normal;
|
|
38
64
|
font-size: 14px;
|
|
39
65
|
line-height: 20px;
|
|
66
|
+
color: colors.$gray38;
|
|
67
|
+
margin-bottom: 24px;
|
|
40
68
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
* + h3 {
|
|
47
|
-
margin-top: 64px;
|
|
48
|
-
}
|
|
49
|
-
* + h4 {
|
|
50
|
-
margin-top: 24px;
|
|
51
|
-
}
|
|
52
|
-
h1 + * {
|
|
53
|
-
margin-top: 80px;
|
|
54
|
-
}
|
|
55
|
-
h2 + * {
|
|
56
|
-
margin-top: 32px;
|
|
57
|
-
}
|
|
58
|
-
h3 + * {
|
|
59
|
-
margin-top: 24px;
|
|
60
|
-
}
|
|
61
|
-
h4 + * {
|
|
62
|
-
margin-top: 16px;
|
|
69
|
+
h6 {
|
|
70
|
+
font-weight: normal;
|
|
71
|
+
font-size: 12px;
|
|
72
|
+
line-height: 16px;
|
|
73
|
+
margin-bottom: 24px;
|
|
63
74
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
|
|
76
|
+
@include breakpoints.up('xs') {
|
|
77
|
+
h1 {
|
|
78
|
+
font-weight: bold;
|
|
79
|
+
font-size: 32px;
|
|
80
|
+
line-height: 40px;
|
|
81
|
+
margin-bottom: 32px;
|
|
82
|
+
}
|
|
83
|
+
h2 {
|
|
84
|
+
font-weight: 600;
|
|
85
|
+
font-size: 24px;
|
|
86
|
+
line-height: 32px;
|
|
87
|
+
margin-bottom: 24px;
|
|
88
|
+
}
|
|
89
|
+
h3 {
|
|
90
|
+
font-weight: 600;
|
|
91
|
+
font-size: 20px;
|
|
92
|
+
line-height: 28px;
|
|
93
|
+
margin-bottom: 24px;
|
|
94
|
+
}
|
|
95
|
+
h4 {
|
|
96
|
+
font-weight: 600;
|
|
97
|
+
font-size: 16px;
|
|
98
|
+
line-height: 24px;
|
|
99
|
+
color: colors.$gray38;
|
|
100
|
+
margin-bottom: 16px;
|
|
101
|
+
}
|
|
102
|
+
h5 {
|
|
103
|
+
font-size: 14px;
|
|
104
|
+
line-height: 20px;
|
|
105
|
+
color: colors.$gray38;
|
|
106
|
+
margin-bottom: 24px;
|
|
107
|
+
}
|
|
108
|
+
h6 {
|
|
109
|
+
font-size: 12px;
|
|
110
|
+
line-height: 16px;
|
|
72
111
|
}
|
|
73
|
-
}
|
|
74
|
-
h1 + h2 {
|
|
75
|
-
margin-top: 80px;
|
|
76
|
-
}
|
|
77
|
-
h2 + h3 {
|
|
78
|
-
margin-top: 24px;
|
|
79
|
-
}
|
|
80
|
-
h3 + h4 {
|
|
81
|
-
margin-top: 24px;
|
|
82
112
|
}
|
|
83
113
|
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
114
|
+
// списки
|
|
115
|
+
ol,
|
|
116
|
+
ul {
|
|
117
|
+
margin-bottom: 24px;
|
|
118
|
+
li + li {
|
|
119
|
+
margin-top: 16px;
|
|
120
|
+
}
|
|
87
121
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
122
|
+
ol {
|
|
123
|
+
display: block;
|
|
124
|
+
counter-reset: ordered-list;
|
|
125
|
+
list-style: none;
|
|
126
|
+
li {
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-direction: row;
|
|
129
|
+
list-style-position: inside;
|
|
130
|
+
counter-increment: ordered-list;
|
|
131
|
+
}
|
|
132
|
+
li::before {
|
|
133
|
+
content: counter(ordered-list) '.';
|
|
134
|
+
display: block;
|
|
135
|
+
flex-grow: 0;
|
|
136
|
+
margin-right: 12px;
|
|
95
137
|
}
|
|
96
138
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
139
|
+
ul {
|
|
140
|
+
list-style: none;
|
|
141
|
+
li {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: row;
|
|
144
|
+
list-style-position: inside;
|
|
145
|
+
counter-increment: ordered-list;
|
|
146
|
+
}
|
|
147
|
+
li::before {
|
|
148
|
+
display: block;
|
|
149
|
+
content: '—';
|
|
150
|
+
margin-right: 12px;
|
|
151
|
+
}
|
|
103
152
|
}
|
|
104
153
|
|
|
105
154
|
// таблицы
|
|
106
155
|
table {
|
|
107
|
-
border-collapse: collapse;
|
|
108
156
|
width: 100%;
|
|
109
|
-
margin:
|
|
110
|
-
|
|
111
|
-
|
|
157
|
+
margin-bottom: 40px;
|
|
158
|
+
border-collapse: collapse;
|
|
159
|
+
}
|
|
160
|
+
@include breakpoints.up('xs') {
|
|
161
|
+
table {
|
|
162
|
+
thead {
|
|
163
|
+
color: colors.$gray38;
|
|
164
|
+
font-size: 14px;
|
|
165
|
+
line-height: 20px;
|
|
166
|
+
td,
|
|
167
|
+
th {
|
|
168
|
+
padding-top: 0;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
112
171
|
td {
|
|
113
|
-
|
|
172
|
+
border: 0;
|
|
173
|
+
padding: 24px 0;
|
|
174
|
+
|
|
175
|
+
// накидываем именно сюда чтобы работало в Safari
|
|
176
|
+
box-shadow: inset 0 -1px 0 colors.$gray12;
|
|
177
|
+
&:not(:last-child) {
|
|
178
|
+
padding-right: 32px;
|
|
179
|
+
}
|
|
114
180
|
}
|
|
115
181
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
182
|
+
}
|
|
183
|
+
@include breakpoints.down('xs') {
|
|
184
|
+
table,
|
|
185
|
+
tr,
|
|
186
|
+
th,
|
|
187
|
+
td,
|
|
188
|
+
thead,
|
|
189
|
+
tbody {
|
|
190
|
+
display: block;
|
|
191
|
+
}
|
|
192
|
+
table {
|
|
193
|
+
box-shadow: inset 0 1px 0 colors.$gray12;
|
|
194
|
+
}
|
|
195
|
+
thead {
|
|
196
|
+
position: absolute;
|
|
197
|
+
top: -9999px;
|
|
198
|
+
left: -9999px;
|
|
199
|
+
}
|
|
200
|
+
tr {
|
|
201
|
+
padding: 32px 0;
|
|
121
202
|
box-shadow: inset 0 -1px 0 colors.$gray12;
|
|
122
|
-
&:not(:last-child) {
|
|
123
|
-
padding-right: 48px;
|
|
124
|
-
}
|
|
125
203
|
}
|
|
126
|
-
|
|
127
|
-
|
|
204
|
+
td + td {
|
|
205
|
+
margin-top: 24px;
|
|
206
|
+
}
|
|
207
|
+
td::before {
|
|
208
|
+
content: attr(data-table-column-title);
|
|
209
|
+
display: block;
|
|
210
|
+
font-size: 14px;
|
|
211
|
+
line-height: 20px;
|
|
212
|
+
color: colors.$gray38;
|
|
213
|
+
margin-bottom: 8px;
|
|
128
214
|
}
|
|
129
215
|
}
|
|
130
216
|
|
|
131
|
-
//
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
li::before {
|
|
138
|
-
display: inline-block;
|
|
139
|
-
content: '—';
|
|
140
|
-
margin-right: 10px;
|
|
141
|
-
}
|
|
217
|
+
// медиа
|
|
218
|
+
img,
|
|
219
|
+
video {
|
|
220
|
+
display: block;
|
|
221
|
+
max-width: 100%;
|
|
222
|
+
margin-bottom: 32px;
|
|
142
223
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
224
|
+
@include breakpoints.up('xs') {
|
|
225
|
+
margin-bottom: 40px;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// цитата
|
|
229
|
+
blockquote {
|
|
230
|
+
position: relative;
|
|
231
|
+
display: block;
|
|
232
|
+
font-weight: 600;
|
|
233
|
+
font-size: 16px;
|
|
234
|
+
line-height: 24px;
|
|
235
|
+
padding-left: 40px;
|
|
236
|
+
&::before {
|
|
146
237
|
content: '';
|
|
147
|
-
|
|
148
|
-
|
|
238
|
+
position: absolute;
|
|
239
|
+
left: 0;
|
|
240
|
+
|
|
241
|
+
/* stylelint-disable-next-line function-url-quotes */
|
|
242
|
+
background-image: url('data:image/svg+xml,%3Csvg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="32" height="32"/%3E%3Cpath d="M15.1665 5.33301H8.36963L2.6665 26.0361H12.1196L15.1665 5.33301ZM28.9165 5.33301H22.1196L16.4165 26.0361H25.8696L28.9165 5.33301Z" fill="%23E0E0E0"/%3E%3C/svg%3E%0A');
|
|
243
|
+
width: 32px;
|
|
244
|
+
height: 32px;
|
|
149
245
|
}
|
|
150
|
-
|
|
246
|
+
@include breakpoints.up('xs') {
|
|
247
|
+
font-size: 20px;
|
|
248
|
+
line-height: 28px;
|
|
249
|
+
padding-left: 72px;
|
|
250
|
+
&::before {
|
|
251
|
+
/* stylelint-disable-next-line function-url-quotes */
|
|
252
|
+
background-image: url('data:image/svg+xml,%3Csvg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="48" height="48"/%3E%3Cpath d="M22.75 8H12.5547L4 39.0547H18.1797L22.75 8ZM43.375 8H33.1797L24.625 39.0547H38.8047L43.375 8Z" fill="%23E0E0E0"/%3E%3C/svg%3E%0A');
|
|
253
|
+
width: 48px;
|
|
254
|
+
height: 48px;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
* {
|
|
258
|
+
margin: 0;
|
|
259
|
+
}
|
|
260
|
+
cite {
|
|
261
|
+
display: block;
|
|
151
262
|
margin-top: 16px;
|
|
263
|
+
font-style: normal;
|
|
264
|
+
font-weight: normal;
|
|
265
|
+
font-size: 16px;
|
|
266
|
+
line-height: 24px;
|
|
267
|
+
color: colors.$gray38;
|
|
152
268
|
}
|
|
153
269
|
}
|
|
154
|
-
ul,
|
|
155
|
-
ol {
|
|
156
|
-
margin: 16px 0;
|
|
157
|
-
}
|
|
158
270
|
|
|
159
271
|
// горизонтальная черта
|
|
160
272
|
hr {
|
|
@@ -162,27 +274,9 @@
|
|
|
162
274
|
width: 100%;
|
|
163
275
|
height: 1px;
|
|
164
276
|
background: colors.$gray12;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// цитата
|
|
171
|
-
blockquote {
|
|
172
|
-
display: block;
|
|
173
|
-
padding-left: 32px;
|
|
174
|
-
border-left: 4px solid colors.$brand-blue;
|
|
175
|
-
margin: 40px 0;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// @todo неопознанные стили оставшиеся при переносе из карточки товара, выяснить что это и зачем нужно
|
|
179
|
-
div {
|
|
180
|
-
font-weight: 600;
|
|
181
|
-
+ p {
|
|
182
|
-
margin-top: 8px;
|
|
277
|
+
margin-bottom: 32px;
|
|
278
|
+
@include breakpoints.up('xs') {
|
|
279
|
+
margin-bottom: 40px;
|
|
183
280
|
}
|
|
184
281
|
}
|
|
185
|
-
p + div {
|
|
186
|
-
margin-top: 16px;
|
|
187
|
-
}
|
|
188
282
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setTableRowLabels = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Ищет в заданном элементе все ячейки таблиц и задает им атрибут "data-table-column-title".
|
|
6
|
+
* Необходимо для стилизации адаптивных таблиц по гайдам.
|
|
7
|
+
* @param element Элемент.
|
|
8
|
+
*/
|
|
9
|
+
const setTableRowLabels = (element) => {
|
|
10
|
+
element.querySelectorAll('tbody td').forEach(td => {
|
|
11
|
+
var _a;
|
|
12
|
+
// считаем, что parentNode есть всегда т.к. селектор это подразумевает
|
|
13
|
+
const index = [...td.parentNode.children].indexOf(td);
|
|
14
|
+
// считаем, что index не может быть равен -1 т.к. поиск внутри родительского элемента
|
|
15
|
+
td.setAttribute('data-table-column-title', ((_a = td.closest('table').querySelector(`thead td:nth-child(${index + 1})`)) === null || _a === void 0 ? void 0 : _a.textContent) || '');
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
exports.setTableRowLabels = setTableRowLabels;
|
package/upload/area.js
CHANGED
|
@@ -33,7 +33,9 @@ const cx = bind_1.default.bind(area_module_scss_1.default);
|
|
|
33
33
|
const UploadArea = (_a) => {
|
|
34
34
|
var { onSelect, className, fileRole = 'файл', formats, sizeLimit = '2 Mb', multiple, countLimit = multiple ? undefined : 1, failed, 'data-testid': testId = 'upload-area' } = _a, restProps = __rest(_a, ["onSelect", "className", "fileRole", "formats", "sizeLimit", "multiple", "countLimit", "failed", 'data-testid']);
|
|
35
35
|
const secondaryInfo = (0, lodash_1.upperFirst)([
|
|
36
|
-
countLimit &&
|
|
36
|
+
countLimit &&
|
|
37
|
+
countLimit > 0 &&
|
|
38
|
+
`${countLimit} ${(0, get_declination_1.default)(countLimit, ['файл', 'файла', 'файлов'])}`,
|
|
37
39
|
formats && `формат ${formats}`,
|
|
38
40
|
`до ${sizeLimit}`,
|
|
39
41
|
]
|
package/upload/utils.d.ts
CHANGED
|
@@ -16,13 +16,13 @@ declare type DnDResult<T> = {
|
|
|
16
16
|
* @param options Опции.
|
|
17
17
|
* @return Данные.
|
|
18
18
|
*/
|
|
19
|
-
export declare const useDragAndDrop: <T extends HTMLElement = HTMLElement>({ onDrop }: DnDProps<T>) => DnDResult<T>;
|
|
19
|
+
export declare const useDragAndDrop: <T extends HTMLElement = HTMLElement>({ onDrop, }: DnDProps<T>) => DnDResult<T>;
|
|
20
20
|
/**
|
|
21
21
|
* Возвращает функцию обработки FileList по заданным ограничениям.
|
|
22
22
|
* @param props Свойства.
|
|
23
23
|
* @return Функция.
|
|
24
24
|
*/
|
|
25
|
-
export declare const getFilesPreparer: ({ multiple, countLimit
|
|
25
|
+
export declare const getFilesPreparer: ({ multiple, countLimit }: {
|
|
26
26
|
multiple?: boolean | undefined;
|
|
27
27
|
countLimit?: number | undefined;
|
|
28
28
|
}) => (list: File[] | FileList) => File[];
|
package/upload/utils.js
CHANGED
|
@@ -11,7 +11,7 @@ const with_prevent_1 = __importDefault(require("../helpers/with-prevent"));
|
|
|
11
11
|
* @param options Опции.
|
|
12
12
|
* @return Данные.
|
|
13
13
|
*/
|
|
14
|
-
const useDragAndDrop = ({ onDrop }) => {
|
|
14
|
+
const useDragAndDrop = ({ onDrop, }) => {
|
|
15
15
|
const [active, setActive] = (0, react_1.useState)(false);
|
|
16
16
|
return {
|
|
17
17
|
active,
|
|
@@ -35,7 +35,7 @@ exports.useDragAndDrop = useDragAndDrop;
|
|
|
35
35
|
* @param props Свойства.
|
|
36
36
|
* @return Функция.
|
|
37
37
|
*/
|
|
38
|
-
const getFilesPreparer = ({ multiple, countLimit
|
|
38
|
+
const getFilesPreparer = ({ multiple, countLimit }) => (list) => {
|
|
39
39
|
const files = [...list];
|
|
40
40
|
multiple
|
|
41
41
|
? countLimit && Number.isFinite(countLimit) && files.splice(countLimit)
|
|
@@ -8,5 +8,5 @@ interface Props extends HintProps {
|
|
|
8
8
|
* @param props Свойства.
|
|
9
9
|
* @return Элемент.
|
|
10
10
|
*/
|
|
11
|
-
export declare const PositioningHint: ({ children, direction, openerRef
|
|
11
|
+
export declare const PositioningHint: ({ children, direction, openerRef }: Props) => JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -35,7 +35,7 @@ const cx = bind_1.default.bind(positioning_hint_module_scss_1.default);
|
|
|
35
35
|
* @param props Свойства.
|
|
36
36
|
* @return Элемент.
|
|
37
37
|
*/
|
|
38
|
-
const PositioningHint = ({ children, direction, openerRef
|
|
38
|
+
const PositioningHint = ({ children, direction, openerRef }) => {
|
|
39
39
|
const layer = (0, layer_1.useLayer)();
|
|
40
40
|
const ref = (0, react_1.useRef)(null);
|
|
41
41
|
(0, react_1.useEffect)(() => {
|
package/with-hint/utils.js
CHANGED
|
@@ -16,23 +16,23 @@ exports.PlaceAt = {
|
|
|
16
16
|
],
|
|
17
17
|
top: (hint, opener) => {
|
|
18
18
|
const [hintRect, openerRect, correct] = exports.PlaceAt.commons(hint, opener);
|
|
19
|
-
hint.style.left = `${correct.x + openerRect.left +
|
|
19
|
+
hint.style.left = `${correct.x + openerRect.left + openerRect.width / 2 - hintRect.width / 2}px`;
|
|
20
20
|
hint.style.top = `${correct.y - SPACE + openerRect.top - hintRect.height}px`;
|
|
21
21
|
},
|
|
22
22
|
right: (hint, opener) => {
|
|
23
23
|
const [hintRect, openerRect, correct] = exports.PlaceAt.commons(hint, opener);
|
|
24
24
|
hint.style.left = `${correct.x + SPACE + openerRect.right}px`;
|
|
25
|
-
hint.style.top = `${correct.y + openerRect.top +
|
|
25
|
+
hint.style.top = `${correct.y + openerRect.top + openerRect.height / 2 - hintRect.height / 2}px`;
|
|
26
26
|
},
|
|
27
27
|
bottom: (hint, opener) => {
|
|
28
28
|
const [hintRect, openerRect, correct] = exports.PlaceAt.commons(hint, opener);
|
|
29
|
-
hint.style.left = `${correct.x + openerRect.left +
|
|
29
|
+
hint.style.left = `${correct.x + openerRect.left + openerRect.width / 2 - hintRect.width / 2}px`;
|
|
30
30
|
hint.style.top = `${correct.y + SPACE + openerRect.bottom}px`;
|
|
31
31
|
},
|
|
32
32
|
left: (hint, opener) => {
|
|
33
33
|
const [hintRect, openerRect, correct] = exports.PlaceAt.commons(hint, opener);
|
|
34
34
|
hint.style.left = `${correct.x - SPACE + openerRect.left - hintRect.width}px`;
|
|
35
|
-
hint.style.top = `${correct.y + openerRect.top +
|
|
35
|
+
hint.style.top = `${correct.y + openerRect.top + openerRect.height / 2 - hintRect.height / 2}px`;
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
@@ -44,9 +44,7 @@ exports.PlaceAt = {
|
|
|
44
44
|
const onParentScroll = (element, callback) => {
|
|
45
45
|
let scrollParent = (0, get_scroll_parent_1.getScrollParent)(element);
|
|
46
46
|
// прокрутка на body не работает с addEventListener, https://stackoverflow.com/a/43632204/13166471
|
|
47
|
-
scrollParent = scrollParent === document.body
|
|
48
|
-
? document
|
|
49
|
-
: scrollParent;
|
|
47
|
+
scrollParent = scrollParent === document.body ? document : scrollParent;
|
|
50
48
|
return (0, on_1.default)(scrollParent, 'scroll', callback);
|
|
51
49
|
};
|
|
52
50
|
exports.onParentScroll = onParentScroll;
|
|
@@ -32,7 +32,7 @@ function makeInViewportObserverHOC(observersDataList) {
|
|
|
32
32
|
* @param props Свойства для оборачиваемого компонента.
|
|
33
33
|
* @return Компонент высшего порядка.
|
|
34
34
|
*/
|
|
35
|
-
const Wrapper = (props) => react_1.default.createElement(Component, Object.assign({}, { [propName]: addObserve }, props));
|
|
35
|
+
const Wrapper = (props) => (react_1.default.createElement(Component, Object.assign({}, { [propName]: addObserve }, props)));
|
|
36
36
|
Wrapper.displayName = `withInViewportObserver(${Component.displayName || Component.name})`;
|
|
37
37
|
return Wrapper;
|
|
38
38
|
};
|