@jetbrains/ring-ui 4.1.0-beta.3 → 4.1.1
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/CHANGELOG.md +13 -0
- package/README.md +17 -15
- package/babel.config.js +3 -2
- package/components/alert/alert.js +9 -3
- package/components/alert/alert.test.js +21 -48
- package/components/alert/container.css +1 -1
- package/components/alert/container.test.js +3 -13
- package/components/alert-service/alert-service.examples.css +18 -0
- package/components/alert-service/alert-service.examples.js +21 -0
- package/components/alert-service/alert-service.js +10 -3
- package/components/analytics/analytics__fus-plugin.js +3 -3
- package/components/analytics/analytics__ga-plugin.js +2 -2
- package/components/auth/auth.test.js +14 -7
- package/components/auth/auth__core.js +64 -33
- package/components/auth-dialog/auth-dialog.css +2 -3
- package/components/auth-dialog/auth-dialog.js +4 -1
- package/components/auth-dialog/auth-dialog.test.js +3 -19
- package/components/avatar/avatar.css +4 -1
- package/components/avatar/avatar.examples.js +3 -2
- package/components/avatar/avatar.js +34 -6
- package/components/avatar/avatar.test.js +20 -17
- package/components/avatar/fallback-avatar.js +136 -0
- package/components/avatar-editor-ng/avatar-editor-ng.css +2 -2
- package/components/avatar-editor-ng/avatar-editor-ng.js +2 -1
- package/components/avatar-editor-ng/{avatar-editor-ng.html → avatar-editor-ng__template.js} +2 -2
- package/components/badge/badge.test.js +13 -20
- package/components/button/button.css +2 -2
- package/components/button/button.js +4 -1
- package/components/button/button.test.js +32 -33
- package/components/button-group/button-group.js +1 -1
- package/components/button-group/caption.js +1 -1
- package/components/button-ng/button-ng.js +1 -1
- package/components/button-set-ng/button-set-ng.js +3 -1
- package/components/checkbox/checkbox.css +1 -1
- package/components/code/code.js +2 -5
- package/components/confirm/confirm.js +1 -0
- package/components/confirm-service/confirm-service.js +5 -5
- package/components/content-layout/content-layout.css +1 -1
- package/components/data-list/data-list.css +1 -1
- package/components/date-picker/date-input.js +5 -4
- package/components/date-picker/date-picker.css +34 -22
- package/components/date-picker/date-picker.js +16 -14
- package/components/date-picker/date-popup.js +22 -7
- package/components/date-picker/month-names.js +8 -5
- package/components/date-picker/month.js +6 -2
- package/components/date-picker/weekdays.js +10 -2
- package/components/dialog/dialog.examples.js +3 -1
- package/components/dialog/dialog.js +10 -5
- package/components/dialog/dialog.test.js +1 -1
- package/components/dialog/dialog__body-scroll-preventer.js +51 -31
- package/components/dialog-ng/dialog-ng.js +10 -10
- package/components/dialog-ng/{dialog-ng.html → dialog-ng__template.js} +2 -2
- package/components/dropdown/dropdown.examples.js +36 -1
- package/components/dropdown/dropdown.test.js +2 -2
- package/components/dropdown-menu/dropdown-menu.examples.js +47 -0
- package/components/dropdown-menu/dropdown-menu.js +117 -0
- package/components/dropdown-menu/dropdown-menu.test.js +76 -0
- package/components/error-bubble/error-bubble-legacy.css +1 -1
- package/components/error-bubble/error-bubble.css +1 -1
- package/components/error-bubble/error-bubble.examples.js +1 -1
- package/components/error-page/error-page.css +2 -2
- package/components/footer-ng/footer-ng.js +13 -3
- package/components/form/form.css +2 -2
- package/components/form-ng/form-ng.js +3 -1
- package/components/global/global.css +1 -1
- package/components/global/theme.js +1 -1
- package/components/global/variables.css +8 -1
- package/components/grid/grid.css +10 -9
- package/components/header/header.css +1 -1
- package/components/header/header.examples.js +7 -8
- package/components/header/profile.js +10 -11
- package/components/http/http.js +1 -1
- package/components/icon/icon.css +5 -4
- package/components/input/input-legacy.css +7 -7
- package/components/island/header.js +2 -2
- package/components/island/island.css +8 -3
- package/components/island-legacy/island-legacy.css +3 -1
- package/components/list/list.js +6 -1
- package/components/list/list__custom.js +9 -3
- package/components/list/list__item.js +8 -2
- package/components/list/list__link.js +2 -1
- package/components/loader-inline/loader-inline.css +1 -1
- package/components/loader-screen/loader-screen.css +1 -1
- package/components/message/message.css +1 -1
- package/components/message/message.examples.js +8 -7
- package/components/pager/pager.js +5 -3
- package/components/permissions/permissions.js +1 -1
- package/components/popup/popup.js +1 -1
- package/components/popup/popup.test.js +15 -13
- package/components/progress-bar/progress-bar.css +1 -1
- package/components/progress-bar/progress-bar.examples.js +3 -3
- package/components/progress-bar/progress-bar.js +5 -2
- package/components/progress-bar/progress-bar.test.js +12 -13
- package/components/progress-bar-ng/progress-bar-ng.examples.js +3 -3
- package/components/query-assist/query-assist.css +13 -3
- package/components/query-assist/query-assist.examples.js +3 -4
- package/components/query-assist/query-assist.js +56 -12
- package/components/query-assist/query-assist.test.js +37 -5
- package/components/save-field-ng/save-field-ng.css +0 -3
- package/components/save-field-ng/save-field-ng.js +3 -1
- package/components/save-field-ng/{save-field-ng.html → save-field-ng__template.js} +2 -2
- package/components/select/select.css +12 -7
- package/components/select/select.examples.js +13 -0
- package/components/select/select.js +30 -43
- package/components/select/select.test.js +4 -5
- package/components/select/select__popup.js +1 -0
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.css +1 -1
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.js +1 -1
- package/components/shortcuts-hint-ng/{shortcuts-hint-ng.html → shortcuts-hint-ng__template.js} +2 -2
- package/components/sidebar/sidebar.css +1 -0
- package/components/sidebar-ng/sidebar-ng.js +6 -2
- package/components/sidebar-ng/{sidebar-ng__button.html → sidebar-ng__button-template.js} +2 -2
- package/components/sidebar-ng/{sidebar-ng.html → sidebar-ng__template.js} +2 -2
- package/components/table/header.js +9 -1
- package/components/table/row.js +2 -1
- package/components/table/table.css +2 -1
- package/components/table-legacy/table-legacy.css +2 -2
- package/components/table-legacy/table-legacy__toolbar.css +2 -2
- package/components/table-legacy-ng/table-legacy-ng.js +38 -5
- package/components/table-legacy-ng/table-legacy-ng__pager.js +7 -1
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.js +5 -9
- package/components/tabs/tab-link.js +4 -2
- package/components/tabs/tabs.css +32 -5
- package/components/tabs-ng/tabs-ng.js +4 -2
- package/components/tabs-ng/{tabs-ng.html → tabs-ng__template.js} +6 -2
- package/components/tag/tag.css +5 -2
- package/components/tag/tag.examples.js +3 -0
- package/components/tag/tag.js +19 -16
- package/components/tags-input/tag-input.examples.js +1 -1
- package/components/tags-input/tags-input.js +5 -2
- package/components/template-ng/template-ng.js +1 -1
- package/components/tooltip/tooltip.js +7 -2
- package/components/user-agreement/user-agreement.css +1 -5
- package/components/user-agreement/user-agreement.examples.js +7 -6
- package/components/user-agreement/user-agreement.js +11 -3
- package/package.json +85 -83
- package/webpack.config.js +14 -10
- package/components/button-set-ng/button-set-ng.html +0 -1
- package/components/footer-ng/footer-ng.html +0 -13
- package/components/form-ng/form-ng__error-bubble.html +0 -3
- package/components/table-legacy-ng/table-legacy-ng.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__column.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__header.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__pager.html +0 -7
- package/components/table-legacy-ng/table-legacy-ng__row.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__title.html +0 -9
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -123
- package/dist/_helpers/background-flow.js +0 -232
- package/dist/_helpers/badge.js +0 -3
- package/dist/_helpers/button.js +0 -145
- package/dist/_helpers/clickableLink.js +0 -65
- package/dist/_helpers/data-tests.js +0 -15
- package/dist/_helpers/disable-hover-hoc.js +0 -407
- package/dist/_helpers/dom.js +0 -101
- package/dist/_helpers/get-uid.js +0 -15
- package/dist/_helpers/linear-function.js +0 -17
- package/dist/_helpers/list.js +0 -1327
- package/dist/_helpers/logo.js +0 -36
- package/dist/_helpers/memoize.js +0 -17
- package/dist/_helpers/popup.js +0 -691
- package/dist/_helpers/popup.target.js +0 -27
- package/dist/_helpers/rerender-hoc.js +0 -49
- package/dist/_helpers/schedule-raf.js +0 -31
- package/dist/_helpers/sniffer.js +0 -6
- package/dist/_helpers/theme.js +0 -40
- package/dist/_helpers/url.js +0 -125
- package/dist/alert-service.js +0 -149
- package/dist/alert.js +0 -284
- package/dist/analytics.js +0 -116
- package/dist/auth-dialog-service.js +0 -56
- package/dist/auth-dialog.js +0 -122
- package/dist/auth.js +0 -1744
- package/dist/avatar.js +0 -152
- package/dist/badge.js +0 -52
- package/dist/button-group.js +0 -48
- package/dist/button-set.js +0 -27
- package/dist/button-toolbar.js +0 -30
- package/dist/button.js +0 -12
- package/dist/caret.js +0 -262
- package/dist/checkbox.js +0 -108
- package/dist/confirm-service.js +0 -102
- package/dist/confirm.js +0 -113
- package/dist/content-layout.js +0 -184
- package/dist/contenteditable.js +0 -81
- package/dist/data-list.js +0 -466
- package/dist/date-picker.js +0 -1398
- package/dist/dialog.js +0 -223
- package/dist/dropdown.js +0 -250
- package/dist/error-bubble.js +0 -56
- package/dist/error-message.js +0 -53
- package/dist/footer.js +0 -124
- package/dist/grid.js +0 -148
- package/dist/group.js +0 -34
- package/dist/header.js +0 -658
- package/dist/heading.js +0 -76
- package/dist/http.js +0 -207
- package/dist/hub-source.js +0 -130
- package/dist/icon.js +0 -211
- package/dist/input.js +0 -228
- package/dist/island.js +0 -314
- package/dist/link.js +0 -117
- package/dist/list.js +0 -29
- package/dist/loader-inline.js +0 -165
- package/dist/loader-screen.js +0 -45
- package/dist/loader.js +0 -338
- package/dist/login-dialog.js +0 -173
- package/dist/logo.js +0 -8
- package/dist/message.js +0 -226
- package/dist/old-browsers-message.js +0 -129
- package/dist/pager.js +0 -325
- package/dist/panel.js +0 -34
- package/dist/permissions.js +0 -466
- package/dist/popup-menu.js +0 -93
- package/dist/popup.js +0 -16
- package/dist/progress-bar.js +0 -111
- package/dist/proxy-attrs.js +0 -19
- package/dist/query-assist.js +0 -1081
- package/dist/radio.js +0 -112
- package/dist/select.js +0 -1920
- package/dist/selection.js +0 -213
- package/dist/shortcuts.js +0 -307
- package/dist/storage.js +0 -373
- package/dist/style.css +0 -1
- package/dist/tab-trap.js +0 -174
- package/dist/table.js +0 -903
- package/dist/tabs.js +0 -721
- package/dist/tag.js +0 -187
- package/dist/tags-input.js +0 -440
- package/dist/tags-list.js +0 -91
- package/dist/text.js +0 -38
- package/dist/toggle.js +0 -80
- package/dist/tooltip.js +0 -202
- package/dist/user-card.js +0 -218
package/dist/tabs.js
DELETED
|
@@ -1,721 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import { _ as _objectWithoutProperties, a as _extends, c as _objectSpread2, b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
3
|
-
import React, { memo, PureComponent } from 'react';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { m as memoize } from './_helpers/memoize.js';
|
|
6
|
-
import { w as withTheme, T as Theme } from './_helpers/theme.js';
|
|
7
|
-
import { j as joinDataTestAttributes } from './_helpers/data-tests.js';
|
|
8
|
-
import Link from './link.js';
|
|
9
|
-
import fastdom from 'fastdom';
|
|
10
|
-
import chevronDown from '@jetbrains/icons/chevron-10px';
|
|
11
|
-
import { D as Directions } from './_helpers/popup.js';
|
|
12
|
-
import PopupMenu, { ListProps } from './popup-menu.js';
|
|
13
|
-
import Dropdown from './dropdown.js';
|
|
14
|
-
import Icon from './icon.js';
|
|
15
|
-
import 'focus-visible';
|
|
16
|
-
import './_helpers/clickableLink.js';
|
|
17
|
-
import 'react-dom';
|
|
18
|
-
import './_helpers/get-uid.js';
|
|
19
|
-
import './_helpers/schedule-raf.js';
|
|
20
|
-
import './_helpers/dom.js';
|
|
21
|
-
import './shortcuts.js';
|
|
22
|
-
import 'combokeys';
|
|
23
|
-
import './_helpers/sniffer.js';
|
|
24
|
-
import 'sniffr';
|
|
25
|
-
import './tab-trap.js';
|
|
26
|
-
import './_helpers/popup.target.js';
|
|
27
|
-
import './_helpers/list.js';
|
|
28
|
-
import 'react-virtualized/dist/es/List';
|
|
29
|
-
import 'react-virtualized/dist/es/AutoSizer';
|
|
30
|
-
import 'react-virtualized/dist/es/WindowScroller';
|
|
31
|
-
import 'react-virtualized/dist/es/CellMeasurer';
|
|
32
|
-
import 'util-deprecate';
|
|
33
|
-
import 'memoize-one';
|
|
34
|
-
import './avatar.js';
|
|
35
|
-
import './_helpers/url.js';
|
|
36
|
-
import './checkbox.js';
|
|
37
|
-
import '@jetbrains/icons/checkmark';
|
|
38
|
-
import '@jetbrains/icons/remove-10px';
|
|
39
|
-
import './_helpers/button.js';
|
|
40
|
-
|
|
41
|
-
const CustomItem = ({
|
|
42
|
-
children
|
|
43
|
-
}) => children;
|
|
44
|
-
CustomItem.propTypes = {
|
|
45
|
-
children: PropTypes.node.isRequired
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
var modules_02138f4a = {"unit":"8px","line-shadow":"inset 0 -1px 0 0","selected-line-shadow":"inset 0 -3px 0 0","title":"tabs_title__96faf57d global_font__0f8f4370","selected":"tabs_selected__96faf57d","collapsed":"tabs_collapsed__96faf57d","tabs":"tabs_tabs__96faf57d global_font__0f8f4370","titles":"tabs_titles__96faf57d","light":"tabs_light__96faf57d","dark":"tabs_dark__96faf57d","visible":"tabs_visible__96faf57d","hidden":"tabs_hidden__96faf57d","tabCounter":"tabs_tabCounter__96faf57d","autoCollapseContainer":"tabs_autoCollapseContainer__96faf57d","autoCollapse":"tabs_autoCollapse__96faf57d","adjusted":"tabs_adjusted__96faf57d","measure":"tabs_measure__96faf57d","morePopup":"tabs_morePopup__96faf57d","chevron":"tabs_chevron__96faf57d","morePopupBeforeEnd":"tabs_morePopupBeforeEnd__96faf57d"};
|
|
49
|
-
|
|
50
|
-
function TabLink(_ref) {
|
|
51
|
-
let {
|
|
52
|
-
isSelected,
|
|
53
|
-
title,
|
|
54
|
-
collapsed
|
|
55
|
-
} = _ref,
|
|
56
|
-
restProps = _objectWithoutProperties(_ref, ["isSelected", "title", "collapsed"]);
|
|
57
|
-
|
|
58
|
-
const renderedTitle = typeof title === 'function' ? title(isSelected, collapsed) : title;
|
|
59
|
-
return /*#__PURE__*/React.createElement(Link, restProps, () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
60
|
-
className: modules_02138f4a.visible
|
|
61
|
-
}, renderedTitle), /*#__PURE__*/React.createElement("span", {
|
|
62
|
-
className: modules_02138f4a.hidden
|
|
63
|
-
}, renderedTitle)));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
TabLink.propTypes = {
|
|
67
|
-
isSelected: PropTypes.bool,
|
|
68
|
-
collapsed: PropTypes.bool,
|
|
69
|
-
title: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.node])
|
|
70
|
-
};
|
|
71
|
-
var TabLink$1 = /*#__PURE__*/memo(TabLink);
|
|
72
|
-
|
|
73
|
-
function noop() {}
|
|
74
|
-
|
|
75
|
-
const TabTitle = /*#__PURE__*/React.memo(({
|
|
76
|
-
selected,
|
|
77
|
-
child,
|
|
78
|
-
handleSelect = noop,
|
|
79
|
-
collapsed = false,
|
|
80
|
-
tabIndex
|
|
81
|
-
}) => {
|
|
82
|
-
if (child == null || typeof child !== 'object' || child.type === CustomItem) {
|
|
83
|
-
return child;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const {
|
|
87
|
-
title,
|
|
88
|
-
disabled,
|
|
89
|
-
href,
|
|
90
|
-
className,
|
|
91
|
-
activeClassName,
|
|
92
|
-
collapsedClassName,
|
|
93
|
-
collapsedActiveClassName
|
|
94
|
-
} = child.props;
|
|
95
|
-
const titleClasses = classNames(modules_02138f4a.title, className, {
|
|
96
|
-
[modules_02138f4a.selected]: selected,
|
|
97
|
-
[modules_02138f4a.collapsed]: collapsed,
|
|
98
|
-
[activeClassName]: selected,
|
|
99
|
-
[collapsedClassName]: collapsed,
|
|
100
|
-
[collapsedActiveClassName]: collapsed && selected
|
|
101
|
-
});
|
|
102
|
-
return /*#__PURE__*/React.createElement(TabLink$1, {
|
|
103
|
-
title: title,
|
|
104
|
-
isSelected: selected,
|
|
105
|
-
active: true,
|
|
106
|
-
href: href,
|
|
107
|
-
innerClassName: titleClasses,
|
|
108
|
-
className: titleClasses,
|
|
109
|
-
disabled: disabled,
|
|
110
|
-
onPlainLeftClick: handleSelect,
|
|
111
|
-
tabIndex: tabIndex,
|
|
112
|
-
collapsed: collapsed
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
TabTitle.propTypes = {
|
|
116
|
-
child: PropTypes.element,
|
|
117
|
-
handleSelect: PropTypes.func,
|
|
118
|
-
selected: PropTypes.bool,
|
|
119
|
-
collapsed: PropTypes.bool,
|
|
120
|
-
tabIndex: PropTypes.number
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const getTabTitles = (_ref) => {
|
|
124
|
-
let {
|
|
125
|
-
items,
|
|
126
|
-
selected = 0,
|
|
127
|
-
collapsed,
|
|
128
|
-
onSelect = noop
|
|
129
|
-
} = _ref,
|
|
130
|
-
props = _objectWithoutProperties(_ref, ["items", "selected", "collapsed", "onSelect"]);
|
|
131
|
-
|
|
132
|
-
return items.map((tab, index) => {
|
|
133
|
-
const key = tab.props.id || String(index);
|
|
134
|
-
const isSelected = selected === key;
|
|
135
|
-
return /*#__PURE__*/React.createElement(TabTitle, _extends({
|
|
136
|
-
key: key,
|
|
137
|
-
handleSelect: onSelect(key),
|
|
138
|
-
selected: isSelected,
|
|
139
|
-
child: tab,
|
|
140
|
-
index: index,
|
|
141
|
-
collapsed: collapsed,
|
|
142
|
-
disabled: tab.props.disabled
|
|
143
|
-
}, props));
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const AnchorLink = (_ref) => {
|
|
148
|
-
let {
|
|
149
|
-
hasActiveChildren,
|
|
150
|
-
moreClassName,
|
|
151
|
-
moreActiveClassName
|
|
152
|
-
} = _ref,
|
|
153
|
-
restProps = _objectWithoutProperties(_ref, ["hasActiveChildren", "moreClassName", "moreActiveClassName"]);
|
|
154
|
-
|
|
155
|
-
const classnames = classNames(modules_02138f4a.title, hasActiveChildren && modules_02138f4a.selected, hasActiveChildren && moreActiveClassName, moreClassName);
|
|
156
|
-
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
157
|
-
title: 'More',
|
|
158
|
-
innerClassName: classnames,
|
|
159
|
-
className: classnames
|
|
160
|
-
}, restProps), 'More', /*#__PURE__*/React.createElement(Icon, {
|
|
161
|
-
glyph: chevronDown,
|
|
162
|
-
className: modules_02138f4a.chevron
|
|
163
|
-
}));
|
|
164
|
-
};
|
|
165
|
-
AnchorLink.propTypes = {
|
|
166
|
-
hasActiveChildren: PropTypes.bool,
|
|
167
|
-
moreClassName: PropTypes.string,
|
|
168
|
-
moreActiveClassName: PropTypes.string
|
|
169
|
-
};
|
|
170
|
-
const morePopupDirections = [Directions.BOTTOM_CENTER, Directions.BOTTOM_LEFT, Directions.BOTTOM_RIGHT];
|
|
171
|
-
const MoreButton = /*#__PURE__*/React.memo(({
|
|
172
|
-
items,
|
|
173
|
-
selected,
|
|
174
|
-
onSelect,
|
|
175
|
-
moreClassName,
|
|
176
|
-
moreActiveClassName,
|
|
177
|
-
morePopupClassName,
|
|
178
|
-
morePopupItemClassName,
|
|
179
|
-
morePopupBeforeEnd
|
|
180
|
-
}) => {
|
|
181
|
-
const onSelectHandler = React.useCallback(listItem => {
|
|
182
|
-
if (listItem.disabled === true || listItem.custom === true) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const cb = onSelect(listItem.key);
|
|
187
|
-
cb();
|
|
188
|
-
}, [onSelect]);
|
|
189
|
-
const hasActiveChild = React.useMemo(() => items.some(item => item.props.alwaysHidden && item.props.id === selected), [items, selected]);
|
|
190
|
-
const data = React.useMemo(() => {
|
|
191
|
-
const popupItems = getTabTitles({
|
|
192
|
-
items,
|
|
193
|
-
selected,
|
|
194
|
-
collapsed: true
|
|
195
|
-
}).map(tab => {
|
|
196
|
-
const disabled = tab.props.disabled === true;
|
|
197
|
-
const custom = tab.props.child.type === CustomItem;
|
|
198
|
-
return {
|
|
199
|
-
template: tab,
|
|
200
|
-
key: tab.key,
|
|
201
|
-
rgItemType: ListProps.Type.CUSTOM,
|
|
202
|
-
className: morePopupItemClassName,
|
|
203
|
-
disabled,
|
|
204
|
-
custom
|
|
205
|
-
};
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
if (morePopupBeforeEnd) {
|
|
209
|
-
popupItems.push({
|
|
210
|
-
template: morePopupBeforeEnd,
|
|
211
|
-
key: 'before-end-content',
|
|
212
|
-
className: modules_02138f4a.morePopupBeforeEnd,
|
|
213
|
-
rgItemType: ListProps.Type.CUSTOM
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return popupItems;
|
|
218
|
-
}, [items, morePopupBeforeEnd, morePopupItemClassName, selected]);
|
|
219
|
-
const popupAnchor = React.useMemo(() => /*#__PURE__*/React.createElement(AnchorLink, {
|
|
220
|
-
moreClassName: moreClassName,
|
|
221
|
-
moreActiveClassName: moreActiveClassName,
|
|
222
|
-
hasActiveChildren: hasActiveChild
|
|
223
|
-
}), [hasActiveChild, moreActiveClassName, moreClassName]);
|
|
224
|
-
const popup = React.useMemo(() => /*#__PURE__*/React.createElement(PopupMenu, {
|
|
225
|
-
directions: morePopupDirections,
|
|
226
|
-
className: morePopupClassName,
|
|
227
|
-
onSelect: onSelectHandler,
|
|
228
|
-
data: data
|
|
229
|
-
}), [data, morePopupClassName, onSelectHandler]);
|
|
230
|
-
|
|
231
|
-
if (items.length === 0) {
|
|
232
|
-
return null;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
236
|
-
className: classNames(modules_02138f4a.title, moreClassName, hasActiveChild && moreActiveClassName)
|
|
237
|
-
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
238
|
-
hoverMode: true,
|
|
239
|
-
anchor: popupAnchor
|
|
240
|
-
}, popup));
|
|
241
|
-
});
|
|
242
|
-
MoreButton.propTypes = {
|
|
243
|
-
children: PropTypes.node,
|
|
244
|
-
items: PropTypes.array,
|
|
245
|
-
selected: PropTypes.string,
|
|
246
|
-
onSelect: PropTypes.func,
|
|
247
|
-
toMeasure: PropTypes.bool,
|
|
248
|
-
moreClassName: PropTypes.string,
|
|
249
|
-
moreActiveClassName: PropTypes.string,
|
|
250
|
-
morePopupClassName: PropTypes.string,
|
|
251
|
-
morePopupItemClassName: PropTypes.string,
|
|
252
|
-
morePopupBeforeEnd: PropTypes.element
|
|
253
|
-
};
|
|
254
|
-
MoreButton.displayName = 'MoreButton';
|
|
255
|
-
const FakeMoreButton = /*#__PURE__*/React.memo(({
|
|
256
|
-
moreClassName,
|
|
257
|
-
moreActiveClassName,
|
|
258
|
-
hasActiveChildren
|
|
259
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
260
|
-
className: classNames(modules_02138f4a.moreButton, modules_02138f4a.title)
|
|
261
|
-
}, /*#__PURE__*/React.createElement(AnchorLink, {
|
|
262
|
-
moreClassName: moreClassName,
|
|
263
|
-
moreActiveClassName: moreActiveClassName,
|
|
264
|
-
hasActiveChildren: hasActiveChildren,
|
|
265
|
-
tabIndex: -1,
|
|
266
|
-
disabled: true
|
|
267
|
-
})));
|
|
268
|
-
FakeMoreButton.propTypes = {
|
|
269
|
-
moreClassName: PropTypes.string,
|
|
270
|
-
moreActiveClassName: PropTypes.string,
|
|
271
|
-
hasActiveChildren: PropTypes.bool
|
|
272
|
-
};
|
|
273
|
-
FakeMoreButton.displayName = 'FakeMoreButton';
|
|
274
|
-
|
|
275
|
-
const DEFAULT_DEBOUNCE_INTERVAL = 100;
|
|
276
|
-
const MEASURE_TOLERANCE = 0.5;
|
|
277
|
-
const DEFAULT_STATE = {
|
|
278
|
-
lastVisibleIndex: null,
|
|
279
|
-
sizes: {
|
|
280
|
-
tabs: [],
|
|
281
|
-
more: null
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
const ACTIONS = {
|
|
285
|
-
MEASURE_TABS: 'MEASURE_TABS',
|
|
286
|
-
DEFINE_LAST_VISIBLE_INDEX: 'DEFINE_LAST_VISIBLE_INDEX'
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
function visibilityReducer(state, action) {
|
|
290
|
-
switch (action.type) {
|
|
291
|
-
case ACTIONS.MEASURE_TABS:
|
|
292
|
-
{
|
|
293
|
-
const {
|
|
294
|
-
more,
|
|
295
|
-
tabs
|
|
296
|
-
} = action;
|
|
297
|
-
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
298
|
-
sizes: {
|
|
299
|
-
more,
|
|
300
|
-
tabs
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
case ACTIONS.DEFINE_LAST_VISIBLE_INDEX:
|
|
306
|
-
{
|
|
307
|
-
const {
|
|
308
|
-
lastVisibleIndex
|
|
309
|
-
} = action;
|
|
310
|
-
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
311
|
-
lastVisibleIndex
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
default:
|
|
316
|
-
throw new Error();
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
const useAdjustHandler = ({
|
|
321
|
-
elements,
|
|
322
|
-
children,
|
|
323
|
-
selectedIndex,
|
|
324
|
-
dispatch
|
|
325
|
-
}) => React.useCallback(entry => {
|
|
326
|
-
const containerWidth = entry.contentRect.width;
|
|
327
|
-
const {
|
|
328
|
-
tabs: tabsSizes,
|
|
329
|
-
more = 0
|
|
330
|
-
} = elements.sizes;
|
|
331
|
-
let renderMore = children.some(tab => tab.props.alwaysHidden);
|
|
332
|
-
const tabsToRender = [];
|
|
333
|
-
let filledWidth = renderMore ? more !== null && more !== void 0 ? more : 0 : 0;
|
|
334
|
-
|
|
335
|
-
for (let i = 0; i < tabsSizes.length; i++) {
|
|
336
|
-
if (filledWidth + tabsSizes[i] < containerWidth + MEASURE_TOLERANCE) {
|
|
337
|
-
filledWidth += tabsSizes[i];
|
|
338
|
-
tabsToRender.push(tabsSizes[i]);
|
|
339
|
-
} else {
|
|
340
|
-
break;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
if (tabsToRender.length < tabsSizes.length && !renderMore) {
|
|
345
|
-
for (let i = tabsToRender.length - 1; i >= 0; i--) {
|
|
346
|
-
if (filledWidth + more < containerWidth + MEASURE_TOLERANCE) {
|
|
347
|
-
filledWidth += more;
|
|
348
|
-
renderMore = true;
|
|
349
|
-
break;
|
|
350
|
-
} else {
|
|
351
|
-
filledWidth -= tabsToRender[i];
|
|
352
|
-
tabsToRender.pop();
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
if (selectedIndex > tabsToRender.length - 1) {
|
|
358
|
-
const selectedWidth = tabsSizes[selectedIndex];
|
|
359
|
-
|
|
360
|
-
for (let i = tabsToRender.length - 1; i >= 0; i--) {
|
|
361
|
-
if (filledWidth + selectedWidth < containerWidth + MEASURE_TOLERANCE) {
|
|
362
|
-
filledWidth += selectedWidth;
|
|
363
|
-
break;
|
|
364
|
-
} else {
|
|
365
|
-
filledWidth -= tabsToRender[i];
|
|
366
|
-
tabsToRender.pop();
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
if (elements.lastVisibleIndex !== tabsToRender.length - 1) {
|
|
372
|
-
dispatch({
|
|
373
|
-
type: ACTIONS.DEFINE_LAST_VISIBLE_INDEX,
|
|
374
|
-
lastVisibleIndex: tabsToRender.length - 1
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
}, [children, dispatch, elements.lastVisibleIndex, elements.sizes, selectedIndex]);
|
|
378
|
-
|
|
379
|
-
const CollapsibleTabs = ({
|
|
380
|
-
children,
|
|
381
|
-
selected,
|
|
382
|
-
onSelect,
|
|
383
|
-
moreClassName,
|
|
384
|
-
moreActiveClassName,
|
|
385
|
-
morePopupClassName,
|
|
386
|
-
morePopupBeforeEnd,
|
|
387
|
-
morePopupItemClassName,
|
|
388
|
-
initialVisibleItems
|
|
389
|
-
}) => {
|
|
390
|
-
const [elements, dispatch] = React.useReducer(visibilityReducer, DEFAULT_STATE);
|
|
391
|
-
const [preparedElements, setPreparedElements] = React.useState({
|
|
392
|
-
visible: [],
|
|
393
|
-
hidden: []
|
|
394
|
-
});
|
|
395
|
-
const measureRef = React.useRef(null);
|
|
396
|
-
const selectedIndex = React.useMemo(() => {
|
|
397
|
-
var _children$filter$find;
|
|
398
|
-
|
|
399
|
-
return (_children$filter$find = children.filter(tab => tab.props.alwaysHidden !== true).findIndex(tab => tab.props.id === selected)) !== null && _children$filter$find !== void 0 ? _children$filter$find : null;
|
|
400
|
-
}, [children, selected]);
|
|
401
|
-
const visibleElements = React.useMemo(() => {
|
|
402
|
-
let items;
|
|
403
|
-
|
|
404
|
-
if (preparedElements.ready) {
|
|
405
|
-
items = preparedElements.visible;
|
|
406
|
-
} else {
|
|
407
|
-
items = initialVisibleItems ? children.filter(item => item.props.alwaysHidden !== true).slice(0, initialVisibleItems) : [];
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
return getTabTitles({
|
|
411
|
-
items,
|
|
412
|
-
selected,
|
|
413
|
-
onSelect
|
|
414
|
-
});
|
|
415
|
-
}, [initialVisibleItems, children, preparedElements.ready, preparedElements.visible, onSelect, selected]);
|
|
416
|
-
const adjustTabs = useAdjustHandler({
|
|
417
|
-
dispatch,
|
|
418
|
-
elements,
|
|
419
|
-
children,
|
|
420
|
-
selectedIndex
|
|
421
|
-
}); // Prepare list of visible and hidden elements
|
|
422
|
-
|
|
423
|
-
React.useEffect(() => {
|
|
424
|
-
const timeout = setTimeout(() => {
|
|
425
|
-
var _elements$lastVisible2;
|
|
426
|
-
|
|
427
|
-
const res = children.reduce((accumulator, tab) => {
|
|
428
|
-
var _elements$lastVisible;
|
|
429
|
-
|
|
430
|
-
if (tab.props.alwaysHidden !== true && accumulator.visible.length - 1 < ((_elements$lastVisible = elements.lastVisibleIndex) !== null && _elements$lastVisible !== void 0 ? _elements$lastVisible : 0)) {
|
|
431
|
-
accumulator.visible.push(tab);
|
|
432
|
-
} else {
|
|
433
|
-
accumulator.hidden.push(tab);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
return accumulator;
|
|
437
|
-
}, {
|
|
438
|
-
visible: [],
|
|
439
|
-
hidden: [],
|
|
440
|
-
ready: elements.lastVisibleIndex !== null
|
|
441
|
-
});
|
|
442
|
-
|
|
443
|
-
if (selectedIndex > ((_elements$lastVisible2 = elements.lastVisibleIndex) !== null && _elements$lastVisible2 !== void 0 ? _elements$lastVisible2 : 0)) {
|
|
444
|
-
const selectedItem = children.find(tab => !tab.props.alwaysHidden && tab.props.id === selected);
|
|
445
|
-
res.visible.push(selectedItem);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
const allVisibleTheSame = res.visible.length === preparedElements.visible.length && res.visible.every((item, index) => item === preparedElements.visible[index]);
|
|
449
|
-
const allHiddenTheSame = res.hidden.length === preparedElements.hidden.length && res.hidden.every((item, index) => item === preparedElements.hidden[index]);
|
|
450
|
-
|
|
451
|
-
if (!allVisibleTheSame || !allHiddenTheSame || preparedElements.ready !== res.ready) {
|
|
452
|
-
fastdom.mutate(() => setPreparedElements(res));
|
|
453
|
-
}
|
|
454
|
-
}, DEFAULT_DEBOUNCE_INTERVAL);
|
|
455
|
-
return () => {
|
|
456
|
-
clearTimeout(timeout);
|
|
457
|
-
};
|
|
458
|
-
}, [children, elements.lastVisibleIndex, preparedElements, selected, selectedIndex]); // Get list of all possibly visible elements to render in a measure container
|
|
459
|
-
|
|
460
|
-
const childrenToMeasure = React.useMemo(() => {
|
|
461
|
-
const items = children.filter(tab => tab.props.alwaysHidden !== true);
|
|
462
|
-
return getTabTitles({
|
|
463
|
-
items,
|
|
464
|
-
tabIndex: -1
|
|
465
|
-
});
|
|
466
|
-
}, [children]); // Initial measure for tabs and more button sizes
|
|
467
|
-
|
|
468
|
-
React.useEffect(() => {
|
|
469
|
-
if (measureRef.current == null) {
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
const measureTask = fastdom.measure(() => {
|
|
474
|
-
const container = measureRef.current;
|
|
475
|
-
const descendants = [...container.children];
|
|
476
|
-
const moreButton = descendants.pop();
|
|
477
|
-
let moreButtonWidth = moreButton.offsetWidth;
|
|
478
|
-
const {
|
|
479
|
-
marginLeft: moreButtonMarginLeft,
|
|
480
|
-
marginRight: moreButtonMarginRight
|
|
481
|
-
} = getComputedStyle(moreButton);
|
|
482
|
-
moreButtonWidth += +moreButtonMarginLeft.replace('px', '') + +moreButtonMarginRight.replace('px', '');
|
|
483
|
-
const tabsWidth = descendants.map(node => {
|
|
484
|
-
const {
|
|
485
|
-
marginLeft,
|
|
486
|
-
marginRight
|
|
487
|
-
} = getComputedStyle(node);
|
|
488
|
-
const width = node.getBoundingClientRect().width;
|
|
489
|
-
return width + +marginLeft.replace('px', '') + +marginRight.replace('px', '');
|
|
490
|
-
}); // eslint-disable-next-line no-param-reassign
|
|
491
|
-
|
|
492
|
-
const newSummaryWidth = tabsWidth.reduce((acc, curr) => acc += curr, 0); // eslint-disable-next-line no-param-reassign
|
|
493
|
-
|
|
494
|
-
const oldSummaryWidth = elements.sizes.tabs.reduce((acc, curr) => acc += curr, 0);
|
|
495
|
-
|
|
496
|
-
if (elements.sizes.more !== moreButtonWidth || newSummaryWidth !== oldSummaryWidth) {
|
|
497
|
-
fastdom.mutate(() => dispatch({
|
|
498
|
-
type: ACTIONS.MEASURE_TABS,
|
|
499
|
-
more: moreButtonWidth,
|
|
500
|
-
tabs: tabsWidth
|
|
501
|
-
}));
|
|
502
|
-
}
|
|
503
|
-
}); // eslint-disable-next-line consistent-return
|
|
504
|
-
|
|
505
|
-
return () => {
|
|
506
|
-
fastdom.clear(measureTask);
|
|
507
|
-
};
|
|
508
|
-
}, [children, elements.sizes.more, elements.sizes.tabs]); // Start observers to listen resizing and mutation
|
|
509
|
-
|
|
510
|
-
React.useEffect(() => {
|
|
511
|
-
let measureTask = null;
|
|
512
|
-
let resizeObserver = null;
|
|
513
|
-
|
|
514
|
-
if (measureRef.current === null) {
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
resizeObserver = new ResizeObserver(entries => {
|
|
519
|
-
entries.forEach(entry => {
|
|
520
|
-
fastdom.clear(measureTask);
|
|
521
|
-
measureTask = fastdom.mutate(() => adjustTabs(entry));
|
|
522
|
-
});
|
|
523
|
-
});
|
|
524
|
-
resizeObserver.observe(measureRef.current); // eslint-disable-next-line consistent-return
|
|
525
|
-
|
|
526
|
-
return () => {
|
|
527
|
-
fastdom.clear(measureTask);
|
|
528
|
-
resizeObserver.disconnect();
|
|
529
|
-
};
|
|
530
|
-
}, [adjustTabs]);
|
|
531
|
-
const isAdjusted = elements.lastVisibleIndex !== null && preparedElements.ready === true || initialVisibleItems;
|
|
532
|
-
const className = classNames(modules_02138f4a.titles, modules_02138f4a.autoCollapse, isAdjusted && modules_02138f4a.adjusted);
|
|
533
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
534
|
-
className: modules_02138f4a.autoCollapseContainer
|
|
535
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
536
|
-
className: className
|
|
537
|
-
}, visibleElements, /*#__PURE__*/React.createElement(MoreButton, {
|
|
538
|
-
moreClassName: moreClassName,
|
|
539
|
-
moreActiveClassName: moreActiveClassName,
|
|
540
|
-
morePopupClassName: morePopupClassName,
|
|
541
|
-
morePopupBeforeEnd: morePopupBeforeEnd,
|
|
542
|
-
morePopupItemClassName: morePopupItemClassName,
|
|
543
|
-
items: preparedElements.hidden,
|
|
544
|
-
selected: selected,
|
|
545
|
-
onSelect: onSelect
|
|
546
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
547
|
-
ref: measureRef,
|
|
548
|
-
className: classNames(className, modules_02138f4a.measure)
|
|
549
|
-
}, childrenToMeasure, /*#__PURE__*/React.createElement(FakeMoreButton, {
|
|
550
|
-
hasActiveChildren: preparedElements.hidden.some(item => item.props.alwaysHidden && item.props.id === selected),
|
|
551
|
-
moreClassName: moreClassName,
|
|
552
|
-
moreActiveClassName: moreActiveClassName
|
|
553
|
-
})));
|
|
554
|
-
};
|
|
555
|
-
CollapsibleTabs.propTypes = {
|
|
556
|
-
children: PropTypes.node.isRequired,
|
|
557
|
-
selected: PropTypes.string,
|
|
558
|
-
onSelect: PropTypes.func.isRequired,
|
|
559
|
-
moreClassName: PropTypes.string,
|
|
560
|
-
moreActiveClassName: PropTypes.string,
|
|
561
|
-
morePopupClassName: PropTypes.string,
|
|
562
|
-
morePopupItemClassName: PropTypes.string,
|
|
563
|
-
initialVisibleItems: PropTypes.number,
|
|
564
|
-
morePopupBeforeEnd: PropTypes.element
|
|
565
|
-
};
|
|
566
|
-
var CollapsibleTabs$1 = /*#__PURE__*/React.memo(CollapsibleTabs);
|
|
567
|
-
|
|
568
|
-
class Tabs extends PureComponent {
|
|
569
|
-
constructor(...args) {
|
|
570
|
-
super(...args);
|
|
571
|
-
|
|
572
|
-
_defineProperty(this, "handleSelect", memoize(key => () => this.props.onSelect(key)));
|
|
573
|
-
|
|
574
|
-
_defineProperty(this, "getTabTitle", (child, i) => {
|
|
575
|
-
if (child == null || typeof child !== 'object' || child.type === CustomItem) {
|
|
576
|
-
return child;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
const {
|
|
580
|
-
selected
|
|
581
|
-
} = this.props;
|
|
582
|
-
const {
|
|
583
|
-
title,
|
|
584
|
-
id,
|
|
585
|
-
disabled,
|
|
586
|
-
href,
|
|
587
|
-
className,
|
|
588
|
-
activeClassName
|
|
589
|
-
} = child.props;
|
|
590
|
-
const key = id || String(i);
|
|
591
|
-
const isSelected = key === selected;
|
|
592
|
-
const titleClasses = classNames(modules_02138f4a.title, className, isSelected && activeClassName, {
|
|
593
|
-
[modules_02138f4a.selected]: isSelected
|
|
594
|
-
});
|
|
595
|
-
return /*#__PURE__*/React.createElement(TabLink$1, {
|
|
596
|
-
title: title,
|
|
597
|
-
isSelected: isSelected,
|
|
598
|
-
active: true,
|
|
599
|
-
key: key,
|
|
600
|
-
href: href,
|
|
601
|
-
innerClassName: titleClasses,
|
|
602
|
-
className: titleClasses,
|
|
603
|
-
disabled: disabled,
|
|
604
|
-
onPlainLeftClick: this.handleSelect(key)
|
|
605
|
-
});
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
render() {
|
|
610
|
-
const _this$props = this.props,
|
|
611
|
-
{
|
|
612
|
-
className,
|
|
613
|
-
children,
|
|
614
|
-
selected,
|
|
615
|
-
theme,
|
|
616
|
-
autoCollapse,
|
|
617
|
-
'data-test': dataTest
|
|
618
|
-
} = _this$props,
|
|
619
|
-
restProps = _objectWithoutProperties(_this$props, ["className", "children", "selected", "theme", "autoCollapse", "data-test"]);
|
|
620
|
-
|
|
621
|
-
const classes = classNames(modules_02138f4a.tabs, className, modules_02138f4a[theme]);
|
|
622
|
-
const childrenArray = React.Children.toArray(children).filter(Boolean);
|
|
623
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
624
|
-
className: classes,
|
|
625
|
-
"data-test": joinDataTestAttributes('ring-dumb-tabs', dataTest)
|
|
626
|
-
}, autoCollapse === true ? /*#__PURE__*/React.createElement(CollapsibleTabs$1, _extends({}, restProps, {
|
|
627
|
-
onSelect: this.handleSelect,
|
|
628
|
-
selected: selected
|
|
629
|
-
}), childrenArray) : /*#__PURE__*/React.createElement("div", {
|
|
630
|
-
className: modules_02138f4a.titles
|
|
631
|
-
}, childrenArray.map(this.getTabTitle)), /*#__PURE__*/React.createElement("div", {
|
|
632
|
-
className: modules_02138f4a.tab
|
|
633
|
-
}, childrenArray.find(({
|
|
634
|
-
props
|
|
635
|
-
}, i) => (props.id || String(i)) === selected)));
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
_defineProperty(Tabs, "propTypes", {
|
|
641
|
-
theme: PropTypes.string,
|
|
642
|
-
selected: PropTypes.string,
|
|
643
|
-
className: PropTypes.string,
|
|
644
|
-
href: PropTypes.string,
|
|
645
|
-
children: PropTypes.node.isRequired,
|
|
646
|
-
onSelect: PropTypes.func,
|
|
647
|
-
'data-test': PropTypes.string,
|
|
648
|
-
autoCollapse: PropTypes.bool
|
|
649
|
-
});
|
|
650
|
-
|
|
651
|
-
_defineProperty(Tabs, "defaultProps", {
|
|
652
|
-
onSelect() {}
|
|
653
|
-
|
|
654
|
-
});
|
|
655
|
-
|
|
656
|
-
_defineProperty(Tabs, "Theme", Theme);
|
|
657
|
-
|
|
658
|
-
var Tabs$1 = withTheme()(Tabs);
|
|
659
|
-
|
|
660
|
-
class SmartTabs extends PureComponent {
|
|
661
|
-
constructor(...args) {
|
|
662
|
-
super(...args);
|
|
663
|
-
|
|
664
|
-
_defineProperty(this, "state", {
|
|
665
|
-
selected: this.props.initSelected || this.props.children[0].props.id || '0'
|
|
666
|
-
});
|
|
667
|
-
|
|
668
|
-
_defineProperty(this, "handleSelect", selected => this.setState({
|
|
669
|
-
selected
|
|
670
|
-
}));
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
render() {
|
|
674
|
-
const _this$props = this.props,
|
|
675
|
-
{
|
|
676
|
-
children,
|
|
677
|
-
initSelected,
|
|
678
|
-
'data-test': dataTest
|
|
679
|
-
} = _this$props,
|
|
680
|
-
restProps = _objectWithoutProperties(_this$props, ["children", "initSelected", "data-test"]);
|
|
681
|
-
|
|
682
|
-
return /*#__PURE__*/React.createElement(Tabs$1, _extends({
|
|
683
|
-
"data-test": joinDataTestAttributes('ring-smart-tabs', dataTest),
|
|
684
|
-
selected: this.state.selected,
|
|
685
|
-
onSelect: this.handleSelect
|
|
686
|
-
}, restProps), children);
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
_defineProperty(SmartTabs, "propTypes", {
|
|
692
|
-
children: PropTypes.arrayOf(PropTypes.element).isRequired,
|
|
693
|
-
initSelected: PropTypes.string,
|
|
694
|
-
'data-test': PropTypes.string
|
|
695
|
-
});
|
|
696
|
-
|
|
697
|
-
class Tab extends PureComponent {
|
|
698
|
-
render() {
|
|
699
|
-
const {
|
|
700
|
-
className,
|
|
701
|
-
children,
|
|
702
|
-
'data-test': dataTest
|
|
703
|
-
} = this.props;
|
|
704
|
-
const classes = classNames(modules_02138f4a.tab, className);
|
|
705
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
706
|
-
"data-test": joinDataTestAttributes('ring-tab', dataTest),
|
|
707
|
-
className: classes
|
|
708
|
-
}, children);
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
_defineProperty(Tab, "propTypes", {
|
|
714
|
-
title: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
715
|
-
id: PropTypes.string,
|
|
716
|
-
className: PropTypes.string,
|
|
717
|
-
children: PropTypes.node,
|
|
718
|
-
'data-test': PropTypes.string
|
|
719
|
-
});
|
|
720
|
-
|
|
721
|
-
export { CustomItem, SmartTabs, Tab, Tabs$1 as Tabs };
|