@rescui/tab-list 0.17.1 → 0.18.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/index.css +180 -194
- package/lib/index.d.ts +6 -6
- package/lib/index.js +1 -1
- package/lib/parts/deep-map.d.ts +2 -2
- package/lib/parts/separator.p.module.css.js +3 -3
- package/lib/parts/tab-list-context.d.ts +13 -13
- package/lib/parts/tab-list.p.module.css.js +25 -16
- package/lib/parts/tab-separator.d.ts +8 -8
- package/lib/parts/tab.d.ts +35 -35
- package/lib/parts/use-indicator.d.ts +13 -13
- package/lib/parts/use-roving-tab-index.d.ts +8 -8
- package/lib/parts/use-scrollable-list.d.ts +18 -18
- package/lib/parts/use-scrollable-list.js +5 -8
- package/lib/tab-list.d.ts +43 -42
- package/lib/tab-list.js +78 -23
- package/package.json +7 -7
- package/lib/parts/with-scroll-arrows.d.ts +0 -28
- package/lib/parts/with-scroll-arrows.js +0 -101
- package/lib/parts/with-scroll-arrows.p.module.css.js +0 -14
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import cn from 'classnames';
|
|
4
|
-
import { Button } from '@rescui/button';
|
|
5
|
-
import { useThemeWithUndefined } from '@rescui/ui-contexts';
|
|
6
|
-
import LeftOutlineIcon from '../_virtual/left-outline.js';
|
|
7
|
-
import RightOutlineIcon from '../_virtual/right-outline.js';
|
|
8
|
-
import { useScrollableList } from './use-scrollable-list.js';
|
|
9
|
-
import styles from './with-scroll-arrows.p.module.css.js';
|
|
10
|
-
|
|
11
|
-
const compareTabsDefault = (activeValue, tabValue) => activeValue === tabValue;
|
|
12
|
-
|
|
13
|
-
const withScrollArrows = function (WrappedComponent, CompareItem) {
|
|
14
|
-
let arrowHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '100%';
|
|
15
|
-
|
|
16
|
-
const WithScrollArrowsComponent = _ref => {
|
|
17
|
-
let {
|
|
18
|
-
compareValues = compareTabsDefault,
|
|
19
|
-
value,
|
|
20
|
-
onChange,
|
|
21
|
-
children,
|
|
22
|
-
theme: themeFromProps,
|
|
23
|
-
['data-e2e']: e2eId,
|
|
24
|
-
...restProps
|
|
25
|
-
} = _ref;
|
|
26
|
-
const theme = useThemeWithUndefined(themeFromProps);
|
|
27
|
-
const {
|
|
28
|
-
selectedId,
|
|
29
|
-
prepareDirectionScroller,
|
|
30
|
-
activeNodeRef,
|
|
31
|
-
tabRefs,
|
|
32
|
-
scrollableRef,
|
|
33
|
-
containerRef,
|
|
34
|
-
childrenWithValues,
|
|
35
|
-
showLeftArrow,
|
|
36
|
-
showRightArrow
|
|
37
|
-
} = useScrollableList({
|
|
38
|
-
children,
|
|
39
|
-
compareValues,
|
|
40
|
-
value,
|
|
41
|
-
CompareItem
|
|
42
|
-
});
|
|
43
|
-
const arrowStyles = {
|
|
44
|
-
height: arrowHeight
|
|
45
|
-
};
|
|
46
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
-
className: cn(styles.wrapper, styles[theme])
|
|
48
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
49
|
-
className: cn(styles.arrow, styles.arrowLeft, showLeftArrow && styles.shown),
|
|
50
|
-
"data-e2e": e2eId,
|
|
51
|
-
style: arrowStyles,
|
|
52
|
-
"data-test": 'scrollable-list-arrow-left-wrapper'
|
|
53
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
54
|
-
theme: theme,
|
|
55
|
-
mode: "clear",
|
|
56
|
-
notFocusable: true,
|
|
57
|
-
onClick: prepareDirectionScroller('left'),
|
|
58
|
-
icon: /*#__PURE__*/React.createElement(LeftOutlineIcon, {
|
|
59
|
-
"data-render-all-sizes": true
|
|
60
|
-
}),
|
|
61
|
-
size: "s",
|
|
62
|
-
"data-e2e": e2eId ? `${e2eId}__left-arrow` : null,
|
|
63
|
-
"data-test": 'scrollable-list-arrow-left'
|
|
64
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
65
|
-
className: cn(styles.scrollable, showLeftArrow && styles.withLeftArrow, showRightArrow && styles.withRightArrow),
|
|
66
|
-
ref: scrollableRef,
|
|
67
|
-
tabIndex: -1
|
|
68
|
-
}, /*#__PURE__*/React.createElement(WrappedComponent, {
|
|
69
|
-
selectedId: selectedId,
|
|
70
|
-
activeNodeRef: activeNodeRef,
|
|
71
|
-
tabRefs: tabRefs,
|
|
72
|
-
value: value,
|
|
73
|
-
onChange: onChange,
|
|
74
|
-
theme: theme,
|
|
75
|
-
"data-e2e": e2eId,
|
|
76
|
-
containerRef: containerRef,
|
|
77
|
-
...restProps
|
|
78
|
-
}, childrenWithValues)), /*#__PURE__*/React.createElement("div", {
|
|
79
|
-
className: cn(styles.arrow, styles.arrowRight, showRightArrow && styles.shown),
|
|
80
|
-
style: arrowStyles,
|
|
81
|
-
"data-test": 'scrollable-list-arrow-right-wrapper'
|
|
82
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
83
|
-
theme: theme,
|
|
84
|
-
mode: "clear",
|
|
85
|
-
notFocusable: true,
|
|
86
|
-
onClick: prepareDirectionScroller('right'),
|
|
87
|
-
icon: /*#__PURE__*/React.createElement(RightOutlineIcon, {
|
|
88
|
-
"data-render-all-sizes": true
|
|
89
|
-
}),
|
|
90
|
-
className: styles.arrowButton,
|
|
91
|
-
size: "s",
|
|
92
|
-
"data-e2e": e2eId ? `${e2eId}__right-arrow` : null,
|
|
93
|
-
"data-test": 'scrollable-list-arrow-right'
|
|
94
|
-
})));
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
WithScrollArrowsComponent.displayName = `withScrollArrows(${WrappedComponent.displayName || WrappedComponent.name})`;
|
|
98
|
-
return WithScrollArrowsComponent;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export { withScrollArrows };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
var styles = {
|
|
2
|
-
"light": "_light_mwv45g_9",
|
|
3
|
-
"dark": "_dark_mwv45g_12",
|
|
4
|
-
"wrapper": "_wrapper_mwv45g_16",
|
|
5
|
-
"scrollable": "_scrollable_mwv45g_23",
|
|
6
|
-
"arrow": "_arrow_mwv45g_52",
|
|
7
|
-
"shown": "_shown_mwv45g_72",
|
|
8
|
-
"arrowLeft": "_arrowLeft_mwv45g_80",
|
|
9
|
-
"arrowRight": "_arrowRight_mwv45g_85",
|
|
10
|
-
"withLeftArrow": "_withLeftArrow_mwv45g_91",
|
|
11
|
-
"withRightArrow": "_withRightArrow_mwv45g_100",
|
|
12
|
-
"arrowButton": "_arrowButton_mwv45g_121"
|
|
13
|
-
};
|
|
14
|
-
export { styles as default };
|