@rescui/tab-list 0.13.4 → 0.13.5

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.
@@ -1,19 +1,3 @@
1
- import "core-js/modules/es.object.to-string.js";
2
- import "core-js/modules/web.dom-collections.for-each.js";
3
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
4
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
5
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
6
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
7
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
8
- import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
9
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
10
- var _excluded = ["compareValues", "value", "onChange", "children", "theme", "data-e2e"];
11
- import "core-js/modules/es.function.name.js";
12
-
13
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
-
15
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
16
-
17
1
  import React from 'react';
18
2
  import cn from 'classnames';
19
3
  import { Button } from '@rescui/button';
@@ -23,41 +7,38 @@ import RightIcon from '../_virtual/right.js';
23
7
  import { useScrollableList } from './use-scrollable-list.js';
24
8
  import styles from './with-scroll-arrows.p.module.css.js';
25
9
 
26
- var compareTabsDefault = function compareTabsDefault(activeValue, tabValue) {
27
- return activeValue === tabValue;
28
- };
29
-
30
- var withScrollArrows = function withScrollArrows(WrappedComponent, CompareItem) {
31
- var arrowHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '100%';
32
-
33
- var WithScrollArrowsComponent = function WithScrollArrowsComponent(_ref) {
34
- var _ref$compareValues = _ref.compareValues,
35
- compareValues = _ref$compareValues === void 0 ? compareTabsDefault : _ref$compareValues,
36
- value = _ref.value,
37
- onChange = _ref.onChange,
38
- children = _ref.children,
39
- themeFromProps = _ref.theme,
40
- e2eId = _ref['data-e2e'],
41
- restProps = _objectWithoutProperties(_ref, _excluded);
10
+ const compareTabsDefault = (activeValue, tabValue) => activeValue === tabValue;
42
11
 
43
- var theme = useThemeWithUndefined(themeFromProps);
44
-
45
- var _useScrollableList = useScrollableList({
46
- children: children,
47
- compareValues: compareValues,
48
- value: value,
49
- CompareItem: CompareItem
50
- }),
51
- selectedId = _useScrollableList.selectedId,
52
- prepareDirectionScroller = _useScrollableList.prepareDirectionScroller,
53
- activeNodeRef = _useScrollableList.activeNodeRef,
54
- scrollableRef = _useScrollableList.scrollableRef,
55
- containerRef = _useScrollableList.containerRef,
56
- childrenWithValues = _useScrollableList.childrenWithValues,
57
- showLeftArrow = _useScrollableList.showLeftArrow,
58
- showRightArrow = _useScrollableList.showRightArrow;
12
+ const withScrollArrows = function (WrappedComponent, CompareItem) {
13
+ let arrowHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '100%';
59
14
 
60
- var arrowStyles = {
15
+ const WithScrollArrowsComponent = _ref => {
16
+ let {
17
+ compareValues = compareTabsDefault,
18
+ value,
19
+ onChange,
20
+ children,
21
+ theme: themeFromProps,
22
+ ['data-e2e']: e2eId,
23
+ ...restProps
24
+ } = _ref;
25
+ const theme = useThemeWithUndefined(themeFromProps);
26
+ const {
27
+ selectedId,
28
+ prepareDirectionScroller,
29
+ activeNodeRef,
30
+ scrollableRef,
31
+ containerRef,
32
+ childrenWithValues,
33
+ showLeftArrow,
34
+ showRightArrow
35
+ } = useScrollableList({
36
+ children,
37
+ compareValues,
38
+ value,
39
+ CompareItem
40
+ });
41
+ const arrowStyles = {
61
42
  height: arrowHeight
62
43
  };
63
44
  return /*#__PURE__*/React.createElement("div", {
@@ -74,21 +55,22 @@ var withScrollArrows = function withScrollArrows(WrappedComponent, CompareItem)
74
55
  onClick: prepareDirectionScroller('left'),
75
56
  icon: /*#__PURE__*/React.createElement(LeftIcon, null),
76
57
  size: "s",
77
- "data-e2e": e2eId ? "".concat(e2eId, "__left-arrow") : null,
58
+ "data-e2e": e2eId ? `${e2eId}__left-arrow` : null,
78
59
  "data-test": 'scrollable-list-arrow-left'
79
60
  })), /*#__PURE__*/React.createElement("div", {
80
61
  className: cn(styles.scrollable, showLeftArrow && styles.withLeftArrow, showRightArrow && styles.withRightArrow),
81
62
  ref: scrollableRef,
82
63
  tabIndex: -1
83
- }, /*#__PURE__*/React.createElement(WrappedComponent, _objectSpread({
64
+ }, /*#__PURE__*/React.createElement(WrappedComponent, {
84
65
  selectedId: selectedId,
85
66
  activeNodeRef: activeNodeRef,
86
67
  value: value,
87
68
  onChange: onChange,
88
69
  theme: theme,
89
70
  "data-e2e": e2eId,
90
- containerRef: containerRef
91
- }, restProps), childrenWithValues)), /*#__PURE__*/React.createElement("div", {
71
+ containerRef: containerRef,
72
+ ...restProps
73
+ }, childrenWithValues)), /*#__PURE__*/React.createElement("div", {
92
74
  className: cn(styles.arrow, styles.arrowRight, showRightArrow && styles.shown),
93
75
  style: arrowStyles,
94
76
  "data-test": 'scrollable-list-arrow-right-wrapper'
@@ -100,12 +82,12 @@ var withScrollArrows = function withScrollArrows(WrappedComponent, CompareItem)
100
82
  icon: /*#__PURE__*/React.createElement(RightIcon, null),
101
83
  className: styles.arrowButton,
102
84
  size: "s",
103
- "data-e2e": e2eId ? "".concat(e2eId, "__right-arrow") : null,
85
+ "data-e2e": e2eId ? `${e2eId}__right-arrow` : null,
104
86
  "data-test": 'scrollable-list-arrow-right'
105
87
  })));
106
88
  };
107
89
 
108
- WithScrollArrowsComponent.displayName = "withScrollArrows(".concat(WrappedComponent.displayName || WrappedComponent.name, ")");
90
+ WithScrollArrowsComponent.displayName = `withScrollArrows(${WrappedComponent.displayName || WrappedComponent.name})`;
109
91
  return WithScrollArrowsComponent;
110
92
  };
111
93
 
@@ -1,14 +1,14 @@
1
1
  var styles = {
2
- "light": "_light_10fcasy_9",
3
- "dark": "_dark_10fcasy_12",
4
- "wrapper": "_wrapper_10fcasy_16",
5
- "scrollable": "_scrollable_10fcasy_23",
6
- "arrow": "_arrow_10fcasy_52",
7
- "shown": "_shown_10fcasy_72",
8
- "arrowLeft": "_arrowLeft_10fcasy_80",
9
- "arrowRight": "_arrowRight_10fcasy_85",
10
- "withLeftArrow": "_withLeftArrow_10fcasy_91",
11
- "withRightArrow": "_withRightArrow_10fcasy_100",
12
- "arrowButton": "_arrowButton_10fcasy_121"
2
+ "light": "_light_awzdsf_9",
3
+ "dark": "_dark_awzdsf_12",
4
+ "wrapper": "_wrapper_awzdsf_16",
5
+ "scrollable": "_scrollable_awzdsf_23",
6
+ "arrow": "_arrow_awzdsf_52",
7
+ "shown": "_shown_awzdsf_72",
8
+ "arrowLeft": "_arrowLeft_awzdsf_80",
9
+ "arrowRight": "_arrowRight_awzdsf_85",
10
+ "withLeftArrow": "_withLeftArrow_awzdsf_91",
11
+ "withRightArrow": "_withRightArrow_awzdsf_100",
12
+ "arrowButton": "_arrowButton_awzdsf_121"
13
13
  };
14
14
  export { styles as default };
package/lib/tab-list.js CHANGED
@@ -6,42 +6,40 @@ import { TabListContext } from './parts/tab-list-context.js';
6
6
  import { withScrollArrows } from './parts/with-scroll-arrows.js';
7
7
  import { useIndicator } from './parts/use-indicator.js';
8
8
  import styles from './parts/tab-list.p.module.css.js';
9
- var STYLES_SIZES = {
9
+ const STYLES_SIZES = {
10
10
  m: styles.sizeM,
11
11
  l: styles.sizeL
12
12
  };
13
13
 
14
- var InnerTabList = function InnerTabList(_ref) {
15
- var _ref$size = _ref.size,
16
- size = _ref$size === void 0 ? 'm' : _ref$size,
17
- _ref$sparse = _ref.sparse,
18
- sparse = _ref$sparse === void 0 ? false : _ref$sparse,
19
- className = _ref.className,
20
- _ref$mode = _ref.mode,
21
- mode = _ref$mode === void 0 ? 'classic' : _ref$mode,
22
- _ref$short = _ref.short,
23
- short = _ref$short === void 0 ? false : _ref$short,
24
- theme = _ref.theme,
25
- value = _ref.value,
26
- onChange = _ref.onChange,
27
- children = _ref.children,
28
- selectedId = _ref.selectedId,
29
- activeNodeRef = _ref.activeNodeRef,
30
- containerRef = _ref.containerRef,
31
- e2eId = _ref['data-e2e'];
32
- var indicator = useIndicator({
33
- activeNodeRef: activeNodeRef,
34
- containerRef: containerRef,
14
+ const InnerTabList = _ref => {
15
+ let {
16
+ size = 'm',
17
+ sparse = false,
18
+ className,
19
+ mode = 'classic',
20
+ short = false,
21
+ theme,
22
+ value,
23
+ onChange,
24
+ children,
25
+ selectedId,
26
+ activeNodeRef,
27
+ containerRef,
28
+ ['data-e2e']: e2eId
29
+ } = _ref;
30
+ const indicator = useIndicator({
31
+ activeNodeRef,
32
+ containerRef,
35
33
  triggers: [value, children]
36
34
  });
37
35
  return /*#__PURE__*/React.createElement(TabListContext.Provider, {
38
36
  value: {
39
- onChange: onChange,
40
- selectedId: selectedId
37
+ onChange,
38
+ selectedId
41
39
  }
42
40
  }, /*#__PURE__*/React.createElement("div", {
43
41
  className: cn(styles.tabsContainer, styles[theme], styles[mode], STYLES_SIZES[size], sparse && styles.sparse, short && styles.short, className),
44
- "data-e2e": e2eId ? "".concat(e2eId, "__tabs-container") : null,
42
+ "data-e2e": e2eId ? `${e2eId}__tabs-container` : null,
45
43
  "data-test": 'tab-list',
46
44
  ref: containerRef
47
45
  }, children, /*#__PURE__*/React.createElement("span", {
@@ -51,7 +49,7 @@ var InnerTabList = function InnerTabList(_ref) {
51
49
  };
52
50
 
53
51
  InnerTabList.displayName = 'TabList';
54
- var TabList = withScrollArrows(InnerTabList, Tab); // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
52
+ const TabList = withScrollArrows(InnerTabList, Tab); // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
55
53
  // @ts-ignore
56
54
 
57
55
  TabList.propTypes = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rescui/tab-list",
3
- "version": "0.13.4",
3
+ "version": "0.13.5",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
@@ -14,11 +14,10 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@babel/runtime-corejs3": "^7.14.0",
18
- "@rescui/button": "^0.18.0",
19
- "@rescui/use-resize-observer": "^0.2.4",
20
- "classnames": "^2.2.6",
21
- "core-js": "^3.9.1"
17
+ "@babel/runtime-corejs3": "^7.26.0",
18
+ "@rescui/button": "^0.18.1",
19
+ "@rescui/use-resize-observer": "^0.2.5",
20
+ "classnames": "^2.2.6"
22
21
  },
23
22
  "peerDependencies": {
24
23
  "@rescui/ui-contexts": "^0.5.0",
@@ -26,10 +25,10 @@
26
25
  "react": ">=16.8.0 <19"
27
26
  },
28
27
  "devDependencies": {
29
- "@rescui/colors": "^0.2.5",
28
+ "@rescui/colors": "^0.2.6",
30
29
  "@rescui/postcss-preset-library": "^0.2.2",
31
- "@rescui/scripts": "^0.3.4",
32
- "@rescui/typography": "^0.19.0",
30
+ "@rescui/scripts": "^0.3.5",
31
+ "@rescui/typography": "^0.19.1",
33
32
  "@rescui/visual-regression": "^0.1.2"
34
33
  },
35
34
  "scripts": {
@@ -37,5 +36,5 @@
37
36
  "build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
38
37
  },
39
38
  "nx": {},
40
- "gitHead": "2c56accd194893854decb2f8a9f95583e14921f1"
39
+ "gitHead": "67627f69be3de4b4c6a21244fd7de36e841f01f0"
41
40
  }