@rescui/tab-list 0.13.3 → 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,53 +1,37 @@
1
- import "core-js/modules/web.dom-collections.for-each.js";
2
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
3
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
4
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
5
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
6
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
7
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
8
- import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
9
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
10
- var _excluded = ["child", "itemId", "childValue", "ref"],
11
- _excluded2 = ["value", "onFocus"];
12
- import "core-js/modules/es.object.to-string.js";
13
- import "core-js/modules/es.promise.js";
14
-
15
- 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; }
16
-
17
- 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; }
18
-
19
1
  import React, { useRef, useState, useCallback, useMemo, useEffect, cloneElement } from 'react';
20
- import { deepMap } from './deep-map.js';
21
- import { useResizeObserver } from './use-resize-observer.js'; // arrow (32) + shadow (10) + shadow blur (~8) + item focus outline (4)
2
+ import { useResizeObserver } from '@rescui/use-resize-observer';
3
+ import { deepMap } from './deep-map.js'; // arrow (32) + shadow (10) + shadow blur (~8) + item focus outline (4)
22
4
 
23
- var ARROW_AREA_WIDTH_IN_PX = 54;
5
+ const ARROW_AREA_WIDTH_IN_PX = 54;
24
6
 
25
7
  function patchItemIfNeeded(_ref) {
26
- var child = _ref.child,
27
- itemId = _ref.itemId,
28
- childValue = _ref.childValue,
29
- ref = _ref.ref,
30
- restProps = _objectWithoutProperties(_ref, _excluded);
31
-
32
- return /*#__PURE__*/cloneElement(child, _objectSpread({
33
- itemId: itemId,
8
+ let {
9
+ child,
10
+ itemId,
11
+ childValue,
12
+ ref,
13
+ ...restProps
14
+ } = _ref;
15
+ return /*#__PURE__*/cloneElement(child, {
16
+ itemId,
34
17
  value: childValue,
35
- ref: ref
36
- }, restProps));
18
+ ref,
19
+ ...restProps
20
+ });
37
21
  }
38
22
 
39
23
  function calculateArrowsVisibility(scrollContainerEl) {
40
24
  // doing this because scrollContainerEl.scrollWidth returns a rounded value
41
- var scrollLeft = Math.round(scrollContainerEl.scrollLeft);
42
- var shouldShowAnyArrow = scrollContainerEl.offsetWidth < scrollContainerEl.scrollWidth; // in some browsers, fully scrolled element has `scrollLeft + offsetWidth === scrollWidth - 1`
25
+ const scrollLeft = Math.round(scrollContainerEl.scrollLeft);
26
+ const shouldShowAnyArrow = scrollContainerEl.offsetWidth < scrollContainerEl.scrollWidth; // in some browsers, fully scrolled element has `scrollLeft + offsetWidth === scrollWidth - 1`
43
27
  // so we take this measurement error into account
44
28
 
45
- var delta = 1;
46
- var showLeftArrow = shouldShowAnyArrow && scrollLeft > 0;
47
- var showRightArrow = shouldShowAnyArrow && scrollLeft + scrollContainerEl.offsetWidth < scrollContainerEl.scrollWidth - delta;
29
+ const delta = 1;
30
+ const showLeftArrow = shouldShowAnyArrow && scrollLeft > 0;
31
+ const showRightArrow = shouldShowAnyArrow && scrollLeft + scrollContainerEl.offsetWidth < scrollContainerEl.scrollWidth - delta;
48
32
  return {
49
- showLeftArrow: showLeftArrow,
50
- showRightArrow: showRightArrow
33
+ showLeftArrow,
34
+ showRightArrow
51
35
  };
52
36
  }
53
37
 
@@ -76,30 +60,30 @@ function scrollElementLeft(element, to) {
76
60
  }
77
61
 
78
62
  function scrollIntoView(activeNode, parentNode) {
79
- var childWidth = activeNode.offsetWidth;
80
- var parentWidth = parentNode.offsetWidth;
81
- var parentStyles = getComputedStyle(parentNode);
82
- var parentMarginsOffset = parseInt(parentStyles.marginLeft, 10) + parseInt(parentStyles.marginRight, 10);
83
- var parentScrollLeft = parentNode.scrollLeft;
84
- var parentScrollWidth = parentNode.scrollWidth; // position of the left border in the container
63
+ const childWidth = activeNode.offsetWidth;
64
+ const parentWidth = parentNode.offsetWidth;
65
+ const parentStyles = getComputedStyle(parentNode);
66
+ const parentMarginsOffset = parseInt(parentStyles.marginLeft, 10) + parseInt(parentStyles.marginRight, 10);
67
+ const parentScrollLeft = parentNode.scrollLeft;
68
+ const parentScrollWidth = parentNode.scrollWidth; // position of the left border in the container
85
69
 
86
- var activeNodeLeft = parentNode.offsetLeft + activeNode.offsetLeft; // position of the right border in the container
70
+ const activeNodeLeft = parentNode.offsetLeft + activeNode.offsetLeft; // position of the right border in the container
87
71
 
88
- var activeNodeRight = activeNodeLeft + childWidth; // position of the left border in relation to the viewport
72
+ const activeNodeRight = activeNodeLeft + childWidth; // position of the left border in relation to the viewport
89
73
 
90
- var activeNodeLeftOffset = activeNodeLeft - parentScrollLeft; // position of the right border in relation to the viewport
74
+ const activeNodeLeftOffset = activeNodeLeft - parentScrollLeft; // position of the right border in relation to the viewport
91
75
 
92
- var activeNodeRightOffset = parentWidth - (activeNodeLeftOffset + childWidth); // by default, don't scroll at all
76
+ const activeNodeRightOffset = parentWidth - (activeNodeLeftOffset + childWidth); // by default, don't scroll at all
93
77
 
94
- var scrollTo = -1; // if before the element there is a space larger than arrow area
78
+ let scrollTo = -1; // if before the element there is a space larger than arrow area
95
79
 
96
- var isElHasWorkSpaceLeft = activeNodeLeft > ARROW_AREA_WIDTH_IN_PX; // if after the element there is a space larger than arrow area
80
+ const isElHasWorkSpaceLeft = activeNodeLeft > ARROW_AREA_WIDTH_IN_PX; // if after the element there is a space larger than arrow area
97
81
 
98
- var isElHasWorkSpaceRight = activeNodeRight < parentScrollWidth - ARROW_AREA_WIDTH_IN_PX;
82
+ const isElHasWorkSpaceRight = activeNodeRight < parentScrollWidth - ARROW_AREA_WIDTH_IN_PX;
99
83
 
100
84
  if (activeNodeRightOffset <= ARROW_AREA_WIDTH_IN_PX) {
101
85
  if (isElHasWorkSpaceRight) {
102
- var sideOffset = parentWidth - childWidth + parentMarginsOffset;
86
+ const sideOffset = parentWidth - childWidth + parentMarginsOffset;
103
87
  scrollTo = activeNodeLeft + ARROW_AREA_WIDTH_IN_PX - sideOffset;
104
88
  } else {
105
89
  scrollTo = parentScrollWidth - parentWidth; // right edge
@@ -120,67 +104,60 @@ function scrollIntoView(activeNode, parentNode) {
120
104
  }
121
105
  }
122
106
 
123
- var useScrollableList = function useScrollableList(_ref2) {
124
- var children = _ref2.children,
125
- compareValues = _ref2.compareValues,
126
- value = _ref2.value,
127
- CompareItem = _ref2.CompareItem;
128
- var activeNodeRef = useRef(null);
129
- var scrollableRef = useRef(null);
130
- var containerRef = useRef(null); // reset targeted element on scrolling by arrows
107
+ const useScrollableList = _ref2 => {
108
+ let {
109
+ children,
110
+ compareValues,
111
+ value,
112
+ CompareItem
113
+ } = _ref2;
114
+ const activeNodeRef = useRef(null);
115
+ const scrollableRef = useRef(null);
116
+ const containerRef = useRef(null); // reset targeted element on scrolling by arrows
131
117
  // so on window resize there wouldn't scroll to it
132
118
 
133
- var _useState = useState(null),
134
- _useState2 = _slicedToArray(_useState, 2),
135
- targetedEl = _useState2[0],
136
- setTargetedEl = _useState2[1];
137
-
138
- var _useState3 = useState({
119
+ const [targetedEl, setTargetedEl] = useState(null);
120
+ const [{
121
+ showLeftArrow,
122
+ showRightArrow
123
+ }, setShowArrows] = useState({
139
124
  showLeftArrow: false,
140
125
  showRightArrow: false
141
- }),
142
- _useState4 = _slicedToArray(_useState3, 2),
143
- _useState4$ = _useState4[0],
144
- showLeftArrow = _useState4$.showLeftArrow,
145
- showRightArrow = _useState4$.showRightArrow,
146
- setShowArrows = _useState4[1];
147
-
148
- var _onFocus = useCallback(function (e) {
126
+ });
127
+ const onFocus = useCallback(e => {
149
128
  setTargetedEl(e.target);
150
129
  }, []);
151
-
152
- var _useMemo = useMemo(function () {
153
- var counter = 0;
154
- var currentSelectedItemId = null;
155
- var items = deepMap(children, function (child) {
130
+ const [childrenWithValues, selectedId] = useMemo(() => {
131
+ let counter = 0;
132
+ let currentSelectedItemId = null;
133
+ const items = deepMap(children, child => {
156
134
  if (child.type === CompareItem) {
157
- var _child$props = child.props,
158
- _child$props$value = _child$props.value,
159
- childValue = _child$props$value === void 0 ? counter : _child$props$value,
160
- onFocusFromProps = _child$props.onFocus,
161
- restProps = _objectWithoutProperties(_child$props, _excluded2);
162
-
163
- var hasAlreadySelectedItem = currentSelectedItemId === null;
164
- var isSelectedItem = hasAlreadySelectedItem && compareValues(value, childValue);
135
+ const {
136
+ value: childValue = counter,
137
+ onFocus: onFocusFromProps,
138
+ ...restProps
139
+ } = child.props;
140
+ const hasAlreadySelectedItem = currentSelectedItemId === null;
141
+ const isSelectedItem = hasAlreadySelectedItem && compareValues(value, childValue);
165
142
 
166
143
  if (isSelectedItem) {
167
144
  currentSelectedItemId = counter;
168
145
  }
169
146
 
170
- var patchedItem = patchItemIfNeeded(_objectSpread(_objectSpread({
171
- child: child,
147
+ const patchedItem = patchItemIfNeeded({
148
+ child,
172
149
  itemId: counter,
173
- childValue: childValue
174
- }, restProps), {}, {
175
- onFocus: function onFocus(e) {
150
+ childValue,
151
+ ...restProps,
152
+ onFocus: e => {
176
153
  if (onFocusFromProps) {
177
154
  onFocusFromProps(e);
178
155
  }
179
156
 
180
- _onFocus(e);
157
+ onFocus(e);
181
158
  },
182
159
  ref: isSelectedItem ? activeNodeRef : null
183
- }));
160
+ });
184
161
  counter += 1;
185
162
  return patchedItem;
186
163
  } else {
@@ -188,36 +165,47 @@ var useScrollableList = function useScrollableList(_ref2) {
188
165
  }
189
166
  });
190
167
  return [React.Children.toArray(items), currentSelectedItemId];
191
- }, [children, value, compareValues, _onFocus, CompareItem]),
192
- _useMemo2 = _slicedToArray(_useMemo, 2),
193
- childrenWithValues = _useMemo2[0],
194
- selectedId = _useMemo2[1];
195
-
196
- var prepareDirectionScroller = function prepareDirectionScroller(direction) {
197
- return function () {
198
- var current = scrollableRef.current;
199
- var left = Math.max(current.clientWidth - 2 * ARROW_AREA_WIDTH_IN_PX, 30) * (direction === 'right' ? 1 : -1);
200
- setTargetedEl(null);
201
- scrollElementBy(current, left);
202
- };
168
+ }, [children, value, compareValues, onFocus, CompareItem]);
169
+
170
+ const prepareDirectionScroller = direction => () => {
171
+ const {
172
+ current
173
+ } = scrollableRef;
174
+ const left = Math.max(current.clientWidth - 2 * ARROW_AREA_WIDTH_IN_PX, 30) * (direction === 'right' ? 1 : -1);
175
+ setTargetedEl(null);
176
+ scrollElementBy(current, left);
203
177
  };
204
178
 
205
- useEffect(function () {
179
+ useEffect(() => {
206
180
  if (!activeNodeRef.current) {
207
181
  return;
208
182
  }
209
183
 
210
184
  setTargetedEl(activeNodeRef.current);
211
185
  }, [value, childrenWithValues]);
212
- var setArrowsVisibility = useCallback(function () {
186
+ const setArrowsVisibility = useCallback(() => {
213
187
  if (!scrollableRef.current) {
214
188
  return;
215
189
  }
216
190
 
217
191
  setShowArrows(calculateArrowsVisibility(scrollableRef.current));
218
- }, []);
219
- var onPartsResize = useCallback(function () {
220
- var scrollableEl = scrollableRef.current;
192
+ }, []); // update arrows while smooth scrolling
193
+
194
+ useEffect(() => {
195
+ const scrollContainer = scrollableRef.current;
196
+
197
+ if (!scrollContainer) {
198
+ return null;
199
+ }
200
+
201
+ scrollContainer.addEventListener('scroll', setArrowsVisibility, {
202
+ passive: true
203
+ });
204
+ return () => scrollContainer.removeEventListener('scroll', setArrowsVisibility);
205
+ }, [setArrowsVisibility]); // scrollIntoView active element when it changes or the component resizes
206
+
207
+ const updateScrollState = () => {
208
+ const scrollableEl = scrollableRef.current;
221
209
 
222
210
  if (!scrollableEl) {
223
211
  return;
@@ -228,35 +216,25 @@ var useScrollableList = function useScrollableList(_ref2) {
228
216
  }
229
217
 
230
218
  setArrowsVisibility();
231
- }, [targetedEl, setArrowsVisibility]); // update arrows while smooth scrolling
219
+ }; // look at the containers resizes
232
220
 
233
- useEffect(function () {
234
- var scrollContainer = scrollableRef.current;
235
221
 
236
- if (!scrollContainer) {
237
- return null;
238
- }
239
-
240
- scrollContainer.addEventListener('scroll', setArrowsVisibility, {
241
- passive: true
242
- });
243
- return function () {
244
- return scrollContainer.removeEventListener('scroll', setArrowsVisibility);
245
- };
246
- }, [setArrowsVisibility]); // look at the containers resizes
247
- // onPartsResize will be called when its updates
248
-
249
- useResizeObserver(containerRef, onPartsResize);
250
- useResizeObserver(scrollableRef, onPartsResize);
222
+ useResizeObserver(containerRef, updateScrollState, {
223
+ ignoreFirstCall: true
224
+ });
225
+ useResizeObserver(scrollableRef, updateScrollState, {
226
+ ignoreFirstCall: true
227
+ });
228
+ useEffect(updateScrollState, [targetedEl, setArrowsVisibility]);
251
229
  return {
252
- selectedId: selectedId,
253
- prepareDirectionScroller: prepareDirectionScroller,
254
- activeNodeRef: activeNodeRef,
255
- scrollableRef: scrollableRef,
256
- containerRef: containerRef,
257
- childrenWithValues: childrenWithValues,
258
- showLeftArrow: showLeftArrow,
259
- showRightArrow: showRightArrow
230
+ selectedId,
231
+ prepareDirectionScroller,
232
+ activeNodeRef,
233
+ scrollableRef,
234
+ containerRef,
235
+ childrenWithValues,
236
+ showLeftArrow,
237
+ showRightArrow
260
238
  };
261
239
  };
262
240
 
@@ -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_1h7x0dd_9",
3
- "dark": "_dark_1h7x0dd_12",
4
- "wrapper": "_wrapper_1h7x0dd_16",
5
- "scrollable": "_scrollable_1h7x0dd_23",
6
- "arrow": "_arrow_1h7x0dd_52",
7
- "shown": "_shown_1h7x0dd_72",
8
- "arrowLeft": "_arrowLeft_1h7x0dd_80",
9
- "arrowRight": "_arrowRight_1h7x0dd_85",
10
- "withLeftArrow": "_withLeftArrow_1h7x0dd_91",
11
- "withRightArrow": "_withRightArrow_1h7x0dd_100",
12
- "arrowButton": "_arrowButton_1h7x0dd_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.3",
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
- "@juggle/resize-observer": "3.3.0",
19
- "@rescui/button": "^0.18.0",
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": "d9e048366cc911a0868bca9bb6974b2b667174a5"
39
+ "gitHead": "67627f69be3de4b4c6a21244fd7de36e841f01f0"
41
40
  }
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare function useResizeObserver(nodeRef: React.MutableRefObject<HTMLElement>, onResize: () => void, deps?: any[]): void;