@rescui/tab-list 0.18.4 → 0.19.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/lib/_virtual/index.css.js +12 -12
- package/lib/_virtual/left-outline.js +294 -63
- package/lib/_virtual/right-outline.js +294 -63
- package/lib/index.css +79 -79
- package/lib/parts/separator.p.module.css.js +3 -3
- package/lib/parts/tab-list-context.js +3 -1
- package/lib/parts/tab-list.p.module.css.js +25 -25
- package/lib/parts/tab-separator.js +30 -6
- package/lib/parts/tab.js +191 -47
- package/lib/parts/use-indicator.js +130 -44
- package/lib/parts/use-roving-tab-index.js +51 -27
- package/lib/parts/use-scrollable-list.js +272 -131
- package/lib/tab-list.d.ts +1 -1
- package/lib/tab-list.js +377 -79
- package/package.json +10 -9
package/lib/tab-list.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
|
|
3
|
+
import { c } from 'react-compiler-runtime';
|
|
2
4
|
import React, { useRef } from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import cn from 'classnames';
|
|
@@ -20,24 +22,91 @@ const STYLES_SIZES = {
|
|
|
20
22
|
const compareTabsDefault = (activeValue, tabValue) => activeValue === tabValue; // eslint-disable-next-line complexity
|
|
21
23
|
|
|
22
24
|
|
|
23
|
-
const TabList =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
const TabList = t0 => {
|
|
26
|
+
const $ = c(80);
|
|
27
|
+
let children;
|
|
28
|
+
let className;
|
|
29
|
+
let e2eId;
|
|
30
|
+
let onChange;
|
|
31
|
+
let restProps;
|
|
32
|
+
let t1;
|
|
33
|
+
let t2;
|
|
34
|
+
let t3;
|
|
35
|
+
let t4;
|
|
36
|
+
let t5;
|
|
37
|
+
let themeFromProps;
|
|
38
|
+
let value;
|
|
39
|
+
|
|
40
|
+
if ($[0] !== t0) {
|
|
41
|
+
({
|
|
42
|
+
size: t1,
|
|
43
|
+
sparse: t2,
|
|
44
|
+
className,
|
|
45
|
+
mode: t3,
|
|
46
|
+
short: t4,
|
|
47
|
+
"data-e2e": e2eId,
|
|
48
|
+
compareValues: t5,
|
|
49
|
+
value,
|
|
50
|
+
onChange,
|
|
51
|
+
children,
|
|
52
|
+
theme: themeFromProps,
|
|
53
|
+
...restProps
|
|
54
|
+
} = t0);
|
|
55
|
+
$[0] = t0;
|
|
56
|
+
$[1] = children;
|
|
57
|
+
$[2] = className;
|
|
58
|
+
$[3] = e2eId;
|
|
59
|
+
$[4] = onChange;
|
|
60
|
+
$[5] = restProps;
|
|
61
|
+
$[6] = t1;
|
|
62
|
+
$[7] = t2;
|
|
63
|
+
$[8] = t3;
|
|
64
|
+
$[9] = t4;
|
|
65
|
+
$[10] = t5;
|
|
66
|
+
$[11] = themeFromProps;
|
|
67
|
+
$[12] = value;
|
|
68
|
+
} else {
|
|
69
|
+
children = $[1];
|
|
70
|
+
className = $[2];
|
|
71
|
+
e2eId = $[3];
|
|
72
|
+
onChange = $[4];
|
|
73
|
+
restProps = $[5];
|
|
74
|
+
t1 = $[6];
|
|
75
|
+
t2 = $[7];
|
|
76
|
+
t3 = $[8];
|
|
77
|
+
t4 = $[9];
|
|
78
|
+
t5 = $[10];
|
|
79
|
+
themeFromProps = $[11];
|
|
80
|
+
value = $[12];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const size = t1 === undefined ? "m" : t1;
|
|
84
|
+
const sparse = t2 === undefined ? false : t2;
|
|
85
|
+
const mode = t3 === undefined ? "classic" : t3;
|
|
86
|
+
const short = t4 === undefined ? false : t4;
|
|
87
|
+
const compareValues = t5 === undefined ? compareTabsDefault : t5;
|
|
38
88
|
const scrollableRef = useRef(null);
|
|
39
89
|
const containerRef = useRef(null);
|
|
40
90
|
const theme = useThemeWithUndefined(themeFromProps);
|
|
91
|
+
let t6;
|
|
92
|
+
|
|
93
|
+
if ($[13] !== children || $[14] !== compareValues || $[15] !== value) {
|
|
94
|
+
t6 = {
|
|
95
|
+
children,
|
|
96
|
+
compareValues,
|
|
97
|
+
value,
|
|
98
|
+
CompareItem: Tab,
|
|
99
|
+
scrollableRef,
|
|
100
|
+
containerRef
|
|
101
|
+
};
|
|
102
|
+
$[13] = children;
|
|
103
|
+
$[14] = compareValues;
|
|
104
|
+
$[15] = value;
|
|
105
|
+
$[16] = t6;
|
|
106
|
+
} else {
|
|
107
|
+
t6 = $[16];
|
|
108
|
+
}
|
|
109
|
+
|
|
41
110
|
const {
|
|
42
111
|
selectedId,
|
|
43
112
|
activeNode,
|
|
@@ -46,78 +115,307 @@ const TabList = _ref => {
|
|
|
46
115
|
childrenWithValues,
|
|
47
116
|
showLeftArrow,
|
|
48
117
|
showRightArrow
|
|
49
|
-
} = useScrollableList(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
118
|
+
} = useScrollableList(t6);
|
|
119
|
+
let t7;
|
|
120
|
+
|
|
121
|
+
if ($[17] !== activeNode) {
|
|
122
|
+
t7 = {
|
|
123
|
+
activeNode,
|
|
124
|
+
containerRef
|
|
125
|
+
};
|
|
126
|
+
$[17] = activeNode;
|
|
127
|
+
$[18] = t7;
|
|
128
|
+
} else {
|
|
129
|
+
t7 = $[18];
|
|
130
|
+
}
|
|
131
|
+
|
|
57
132
|
const {
|
|
58
133
|
indicator,
|
|
59
134
|
isIndicatorHidden
|
|
60
|
-
} = useIndicator(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
135
|
+
} = useIndicator(t7);
|
|
136
|
+
let t8;
|
|
137
|
+
|
|
138
|
+
if ($[19] !== selectedId || $[20] !== tabRefs) {
|
|
139
|
+
t8 = {
|
|
140
|
+
selectedId,
|
|
141
|
+
tabRefs
|
|
142
|
+
};
|
|
143
|
+
$[19] = selectedId;
|
|
144
|
+
$[20] = tabRefs;
|
|
145
|
+
$[21] = t8;
|
|
146
|
+
} else {
|
|
147
|
+
t8 = $[21];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const rovingTabIndex = useRovingTabIndex(t8);
|
|
151
|
+
let t9;
|
|
152
|
+
|
|
153
|
+
if ($[22] !== onChange || $[23] !== rovingTabIndex || $[24] !== selectedId) {
|
|
154
|
+
t9 = {
|
|
70
155
|
onChange,
|
|
71
156
|
selectedId,
|
|
72
157
|
rovingTabIndex
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
158
|
+
};
|
|
159
|
+
$[22] = onChange;
|
|
160
|
+
$[23] = rovingTabIndex;
|
|
161
|
+
$[24] = selectedId;
|
|
162
|
+
$[25] = t9;
|
|
163
|
+
} else {
|
|
164
|
+
t9 = $[25];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const t10 = styles[theme];
|
|
168
|
+
const t11 = styles[mode];
|
|
169
|
+
const t12 = STYLES_SIZES[size];
|
|
170
|
+
const t13 = sparse && styles.sparse;
|
|
171
|
+
const t14 = short && styles.short;
|
|
172
|
+
const t15 = isIndicatorHidden && styles.isIndicatorHidden;
|
|
173
|
+
let t16;
|
|
174
|
+
|
|
175
|
+
if ($[26] !== className || $[27] !== t10 || $[28] !== t11 || $[29] !== t12 || $[30] !== t13 || $[31] !== t14 || $[32] !== t15) {
|
|
176
|
+
t16 = cn(className, styles.wrapper, t10, t11, t12, t13, t14, t15);
|
|
177
|
+
$[26] = className;
|
|
178
|
+
$[27] = t10;
|
|
179
|
+
$[28] = t11;
|
|
180
|
+
$[29] = t12;
|
|
181
|
+
$[30] = t13;
|
|
182
|
+
$[31] = t14;
|
|
183
|
+
$[32] = t15;
|
|
184
|
+
$[33] = t16;
|
|
185
|
+
} else {
|
|
186
|
+
t16 = $[33];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const t17 = showLeftArrow && styles.shown;
|
|
190
|
+
let t18;
|
|
191
|
+
|
|
192
|
+
if ($[34] !== t17) {
|
|
193
|
+
t18 = cn(styles.arrow, styles.arrowLeft, t17);
|
|
194
|
+
$[34] = t17;
|
|
195
|
+
$[35] = t18;
|
|
196
|
+
} else {
|
|
197
|
+
t18 = $[35];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
let t19;
|
|
201
|
+
|
|
202
|
+
if ($[36] !== prepareDirectionScroller) {
|
|
203
|
+
t19 = prepareDirectionScroller("left");
|
|
204
|
+
$[36] = prepareDirectionScroller;
|
|
205
|
+
$[37] = t19;
|
|
206
|
+
} else {
|
|
207
|
+
t19 = $[37];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
let t20;
|
|
211
|
+
|
|
212
|
+
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
213
|
+
t20 = /*#__PURE__*/React.createElement(LeftOutlineIcon, {
|
|
88
214
|
"data-render-all-sizes": true
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
215
|
+
});
|
|
216
|
+
$[38] = t20;
|
|
217
|
+
} else {
|
|
218
|
+
t20 = $[38];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const t21 = e2eId ? `${e2eId}__left-arrow` : null;
|
|
222
|
+
let t22;
|
|
223
|
+
|
|
224
|
+
if ($[39] !== t19 || $[40] !== t21 || $[41] !== theme) {
|
|
225
|
+
t22 = /*#__PURE__*/React.createElement(Button, {
|
|
226
|
+
theme: theme,
|
|
227
|
+
mode: "clear",
|
|
228
|
+
notFocusable: true,
|
|
229
|
+
onClick: t19,
|
|
230
|
+
icon: t20,
|
|
231
|
+
size: "s",
|
|
232
|
+
"data-e2e": t21,
|
|
233
|
+
"data-test": "scrollable-list-arrow-left"
|
|
234
|
+
});
|
|
235
|
+
$[39] = t19;
|
|
236
|
+
$[40] = t21;
|
|
237
|
+
$[41] = theme;
|
|
238
|
+
$[42] = t22;
|
|
239
|
+
} else {
|
|
240
|
+
t22 = $[42];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
let t23;
|
|
244
|
+
|
|
245
|
+
if ($[43] !== t18 || $[44] !== t22) {
|
|
246
|
+
t23 = /*#__PURE__*/React.createElement("div", {
|
|
247
|
+
className: t18,
|
|
248
|
+
"data-test": "scrollable-list-arrow-left-wrapper"
|
|
249
|
+
}, t22);
|
|
250
|
+
$[43] = t18;
|
|
251
|
+
$[44] = t22;
|
|
252
|
+
$[45] = t23;
|
|
253
|
+
} else {
|
|
254
|
+
t23 = $[45];
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const t24 = showLeftArrow && styles.withLeftArrow;
|
|
258
|
+
const t25 = showRightArrow && styles.withRightArrow;
|
|
259
|
+
let t26;
|
|
260
|
+
|
|
261
|
+
if ($[46] !== t24 || $[47] !== t25) {
|
|
262
|
+
t26 = cn(styles.scrollable, t24, t25);
|
|
263
|
+
$[46] = t24;
|
|
264
|
+
$[47] = t25;
|
|
265
|
+
$[48] = t26;
|
|
266
|
+
} else {
|
|
267
|
+
t26 = $[48];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const t27 = e2eId ? `${e2eId}__tabs-container` : null;
|
|
271
|
+
let t28;
|
|
272
|
+
|
|
273
|
+
if ($[49] !== indicator) {
|
|
274
|
+
t28 = /*#__PURE__*/React.createElement("span", {
|
|
275
|
+
style: indicator,
|
|
276
|
+
className: styles.indicator
|
|
277
|
+
});
|
|
278
|
+
$[49] = indicator;
|
|
279
|
+
$[50] = t28;
|
|
280
|
+
} else {
|
|
281
|
+
t28 = $[50];
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
let t29;
|
|
285
|
+
|
|
286
|
+
if ($[51] !== childrenWithValues || $[52] !== t27 || $[53] !== t28) {
|
|
287
|
+
t29 = /*#__PURE__*/React.createElement("div", {
|
|
288
|
+
className: styles.tabsContainer,
|
|
289
|
+
"data-e2e": t27,
|
|
290
|
+
ref: containerRef,
|
|
291
|
+
"data-test": "tab-list__tabs-container"
|
|
292
|
+
}, childrenWithValues, t28);
|
|
293
|
+
$[51] = childrenWithValues;
|
|
294
|
+
$[52] = t27;
|
|
295
|
+
$[53] = t28;
|
|
296
|
+
$[54] = t29;
|
|
297
|
+
} else {
|
|
298
|
+
t29 = $[54];
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
let t30;
|
|
302
|
+
|
|
303
|
+
if ($[55] !== t26 || $[56] !== t29) {
|
|
304
|
+
t30 = /*#__PURE__*/React.createElement("div", {
|
|
305
|
+
className: t26,
|
|
306
|
+
ref: scrollableRef,
|
|
307
|
+
tabIndex: -1
|
|
308
|
+
}, t29);
|
|
309
|
+
$[55] = t26;
|
|
310
|
+
$[56] = t29;
|
|
311
|
+
$[57] = t30;
|
|
312
|
+
} else {
|
|
313
|
+
t30 = $[57];
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const t31 = showRightArrow && styles.shown;
|
|
317
|
+
let t32;
|
|
318
|
+
|
|
319
|
+
if ($[58] !== t31) {
|
|
320
|
+
t32 = cn(styles.arrow, styles.arrowRight, t31);
|
|
321
|
+
$[58] = t31;
|
|
322
|
+
$[59] = t32;
|
|
323
|
+
} else {
|
|
324
|
+
t32 = $[59];
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
let t33;
|
|
328
|
+
|
|
329
|
+
if ($[60] !== prepareDirectionScroller) {
|
|
330
|
+
t33 = prepareDirectionScroller("right");
|
|
331
|
+
$[60] = prepareDirectionScroller;
|
|
332
|
+
$[61] = t33;
|
|
333
|
+
} else {
|
|
334
|
+
t33 = $[61];
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
let t34;
|
|
338
|
+
|
|
339
|
+
if ($[62] === Symbol.for("react.memo_cache_sentinel")) {
|
|
340
|
+
t34 = /*#__PURE__*/React.createElement(RightOutlineIcon, {
|
|
114
341
|
"data-render-all-sizes": true
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
342
|
+
});
|
|
343
|
+
$[62] = t34;
|
|
344
|
+
} else {
|
|
345
|
+
t34 = $[62];
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
const t35 = e2eId ? `${e2eId}__right-arrow` : null;
|
|
349
|
+
let t36;
|
|
350
|
+
|
|
351
|
+
if ($[63] !== t33 || $[64] !== t35 || $[65] !== theme) {
|
|
352
|
+
t36 = /*#__PURE__*/React.createElement(Button, {
|
|
353
|
+
theme: theme,
|
|
354
|
+
mode: "clear",
|
|
355
|
+
notFocusable: true,
|
|
356
|
+
onClick: t33,
|
|
357
|
+
icon: t34,
|
|
358
|
+
className: styles.arrowButton,
|
|
359
|
+
size: "s",
|
|
360
|
+
"data-e2e": t35,
|
|
361
|
+
"data-test": "scrollable-list-arrow-right"
|
|
362
|
+
});
|
|
363
|
+
$[63] = t33;
|
|
364
|
+
$[64] = t35;
|
|
365
|
+
$[65] = theme;
|
|
366
|
+
$[66] = t36;
|
|
367
|
+
} else {
|
|
368
|
+
t36 = $[66];
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
let t37;
|
|
372
|
+
|
|
373
|
+
if ($[67] !== t32 || $[68] !== t36) {
|
|
374
|
+
t37 = /*#__PURE__*/React.createElement("div", {
|
|
375
|
+
className: t32,
|
|
376
|
+
"data-test": "scrollable-list-arrow-right-wrapper"
|
|
377
|
+
}, t36);
|
|
378
|
+
$[67] = t32;
|
|
379
|
+
$[68] = t36;
|
|
380
|
+
$[69] = t37;
|
|
381
|
+
} else {
|
|
382
|
+
t37 = $[69];
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
let t38;
|
|
386
|
+
|
|
387
|
+
if ($[70] !== e2eId || $[71] !== restProps || $[72] !== t16 || $[73] !== t23 || $[74] !== t30 || $[75] !== t37) {
|
|
388
|
+
t38 = /*#__PURE__*/React.createElement("div", _extends({}, restProps, {
|
|
389
|
+
className: t16,
|
|
390
|
+
"data-e2e": e2eId,
|
|
391
|
+
"data-test": "tab-list",
|
|
392
|
+
role: "tablist"
|
|
393
|
+
}), t23, t30, t37);
|
|
394
|
+
$[70] = e2eId;
|
|
395
|
+
$[71] = restProps;
|
|
396
|
+
$[72] = t16;
|
|
397
|
+
$[73] = t23;
|
|
398
|
+
$[74] = t30;
|
|
399
|
+
$[75] = t37;
|
|
400
|
+
$[76] = t38;
|
|
401
|
+
} else {
|
|
402
|
+
t38 = $[76];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
let t39;
|
|
406
|
+
|
|
407
|
+
if ($[77] !== t38 || $[78] !== t9) {
|
|
408
|
+
t39 = /*#__PURE__*/React.createElement(TabListContext.Provider, {
|
|
409
|
+
value: t9
|
|
410
|
+
}, t38);
|
|
411
|
+
$[77] = t38;
|
|
412
|
+
$[78] = t9;
|
|
413
|
+
$[79] = t39;
|
|
414
|
+
} else {
|
|
415
|
+
t39 = $[79];
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
return t39;
|
|
121
419
|
};
|
|
122
420
|
|
|
123
421
|
TabList.displayName = 'TabList';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/tab-list",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
@@ -17,20 +17,21 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime-corejs3": "^7.26.0",
|
|
20
|
-
"@rescui/button": "^0.
|
|
21
|
-
"@rescui/use-resize-observer": "^0.
|
|
22
|
-
"classnames": "^2.2.6"
|
|
20
|
+
"@rescui/button": "^0.25.0",
|
|
21
|
+
"@rescui/use-resize-observer": "^0.4.0",
|
|
22
|
+
"classnames": "^2.2.6",
|
|
23
|
+
"react-compiler-runtime": "^1.0.0"
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
26
|
"@rescui/ui-contexts": "^0.6.0",
|
|
26
27
|
"prop-types": "^15",
|
|
27
|
-
"react": ">=
|
|
28
|
+
"react": ">=17.0.0 <20"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@rescui/colors": "^0.3.
|
|
31
|
+
"@rescui/colors": "^0.3.4",
|
|
31
32
|
"@rescui/postcss-preset-library": "^0.2.3",
|
|
32
|
-
"@rescui/scripts": "^0.5.
|
|
33
|
-
"@rescui/typography": "^0.
|
|
33
|
+
"@rescui/scripts": "^0.5.3",
|
|
34
|
+
"@rescui/typography": "^0.28.0",
|
|
34
35
|
"@rescui/visual-regression": "^0.1.4"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
@@ -38,5 +39,5 @@
|
|
|
38
39
|
"build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
|
|
39
40
|
},
|
|
40
41
|
"nx": {},
|
|
41
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "8ffbbe20b8bcbb9ea15204113ab603675d4c03cd"
|
|
42
43
|
}
|