@dnb/eufemia 9.23.0-beta.3 → 9.23.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 +15 -11
- package/cjs/components/accordion/style/dnb-accordion.css +92 -0
- package/cjs/components/accordion/style/dnb-accordion.min.css +1 -1
- package/cjs/components/accordion/style/dnb-accordion.scss +3 -0
- package/cjs/components/autocomplete/style/dnb-autocomplete.css +1652 -64
- package/cjs/components/autocomplete/style/dnb-autocomplete.min.css +2 -2
- package/cjs/components/autocomplete/style/dnb-autocomplete.scss +1 -2
- package/cjs/components/button/style/dnb-button.css +192 -0
- package/cjs/components/button/style/dnb-button.min.css +1 -1
- package/cjs/components/button/style/dnb-button.scss +1 -1
- package/cjs/components/date-picker/style/dnb-date-picker.css +729 -0
- package/cjs/components/date-picker/style/dnb-date-picker.min.css +2 -2
- package/cjs/components/dialog/style/dnb-dialog.css +1883 -79
- package/cjs/components/dialog/style/dnb-dialog.min.css +1 -1
- package/cjs/components/dialog/style/dnb-dialog.scss +1 -1
- package/cjs/components/drawer/Drawer.js +2 -1
- package/cjs/components/drawer/style/dnb-drawer.css +1883 -79
- package/cjs/components/drawer/style/dnb-drawer.min.css +1 -1
- package/cjs/components/drawer/style/dnb-drawer.scss +1 -1
- package/cjs/components/dropdown/style/dnb-dropdown.css +192 -0
- package/cjs/components/dropdown/style/dnb-dropdown.min.css +1 -1
- package/cjs/components/dropdown/style/themes/dnb-dropdown-theme-ui.css +12 -11
- package/cjs/components/dropdown/style/themes/dnb-dropdown-theme-ui.min.css +1 -1
- package/cjs/components/dropdown/style/themes/dnb-dropdown-theme-ui.scss +4 -1
- package/cjs/components/global-error/style/dnb-global-error.css +192 -0
- package/cjs/components/global-error/style/dnb-global-error.min.css +1 -1
- package/cjs/components/global-status/style/dnb-global-status.css +192 -0
- package/cjs/components/global-status/style/dnb-global-status.min.css +1 -1
- package/cjs/components/help-button/style/dnb-help-button.css +773 -0
- package/cjs/components/help-button/style/dnb-help-button.min.css +1 -1
- package/cjs/components/help-button/style/dnb-help-button.scss +3 -0
- package/cjs/components/icon/Icon.d.ts +1 -1
- package/cjs/components/icon-primary/IconPrimary.d.ts +1 -1
- package/cjs/components/info-card/InfoCard.js +2 -2
- package/cjs/components/info-card/style/_info-card.scss +3 -0
- package/cjs/components/info-card/style/dnb-info-card.css +4 -1
- package/cjs/components/info-card/style/dnb-info-card.min.css +1 -1
- package/cjs/components/input/style/dnb-input.css +371 -0
- package/cjs/components/input/style/dnb-input.min.css +1 -1
- package/cjs/components/input/style/dnb-input.scss +1 -0
- package/cjs/components/input-masked/style/dnb-input-masked.css +371 -0
- package/cjs/components/input-masked/style/dnb-input-masked.min.css +1 -1
- package/cjs/components/modal/style/_modal.scss +6 -0
- package/cjs/components/modal/style/dnb-modal.css +282 -1
- package/cjs/components/modal/style/dnb-modal.min.css +1 -1
- package/cjs/components/modal/style/dnb-modal.scss +1 -1
- package/cjs/components/pagination/style/dnb-pagination.css +192 -0
- package/cjs/components/pagination/style/dnb-pagination.min.css +1 -1
- package/cjs/components/slider/style/dnb-slider.css +192 -0
- package/cjs/components/slider/style/dnb-slider.min.css +1 -1
- package/cjs/components/step-indicator/style/dnb-step-indicator.css +773 -0
- package/cjs/components/step-indicator/style/dnb-step-indicator.min.css +1 -1
- package/cjs/components/step-indicator/style/dnb-step-indicator.scss +2 -0
- package/cjs/components/tabs/Tabs.d.ts +6 -0
- package/cjs/components/tabs/Tabs.js +193 -162
- package/cjs/components/tabs/style/_tabs.scss +59 -61
- package/cjs/components/tabs/style/dnb-tabs.css +176 -180
- package/cjs/components/tabs/style/dnb-tabs.min.css +1 -1
- package/cjs/components/tag/style/_tag.scss +10 -6
- package/cjs/components/tag/style/dnb-tag.css +205 -5
- package/cjs/components/tag/style/dnb-tag.min.css +1 -1
- package/cjs/components/toggle-button/style/dnb-toggle-button.css +192 -0
- package/cjs/components/toggle-button/style/dnb-toggle-button.min.css +1 -1
- package/cjs/components/toggle-button/style/dnb-toggle-button.scss +2 -0
- package/cjs/shared/Eufemia.js +1 -1
- package/cjs/shared/hooks/usePropsWithContext.js +1 -1
- package/cjs/style/dnb-ui-components.css +207 -187
- package/cjs/style/dnb-ui-components.min.css +3 -3
- package/cjs/style/themes/theme-open-banking/dnb-theme-open-banking.css +12 -11
- package/cjs/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/cjs/style/themes/theme-ui/dnb-theme-ui.css +12 -11
- package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/components/accordion/style/dnb-accordion.css +92 -0
- package/components/accordion/style/dnb-accordion.min.css +1 -1
- package/components/accordion/style/dnb-accordion.scss +3 -0
- package/components/autocomplete/style/dnb-autocomplete.css +1652 -64
- package/components/autocomplete/style/dnb-autocomplete.min.css +2 -2
- package/components/autocomplete/style/dnb-autocomplete.scss +1 -2
- package/components/button/style/dnb-button.css +192 -0
- package/components/button/style/dnb-button.min.css +1 -1
- package/components/button/style/dnb-button.scss +1 -1
- package/components/date-picker/style/dnb-date-picker.css +729 -0
- package/components/date-picker/style/dnb-date-picker.min.css +2 -2
- package/components/dialog/style/dnb-dialog.css +1883 -79
- package/components/dialog/style/dnb-dialog.min.css +1 -1
- package/components/dialog/style/dnb-dialog.scss +1 -1
- package/components/drawer/Drawer.js +2 -1
- package/components/drawer/style/dnb-drawer.css +1883 -79
- package/components/drawer/style/dnb-drawer.min.css +1 -1
- package/components/drawer/style/dnb-drawer.scss +1 -1
- package/components/dropdown/style/dnb-dropdown.css +192 -0
- package/components/dropdown/style/dnb-dropdown.min.css +1 -1
- package/components/dropdown/style/themes/dnb-dropdown-theme-ui.css +12 -11
- package/components/dropdown/style/themes/dnb-dropdown-theme-ui.min.css +1 -1
- package/components/dropdown/style/themes/dnb-dropdown-theme-ui.scss +4 -1
- package/components/global-error/style/dnb-global-error.css +192 -0
- package/components/global-error/style/dnb-global-error.min.css +1 -1
- package/components/global-status/style/dnb-global-status.css +192 -0
- package/components/global-status/style/dnb-global-status.min.css +1 -1
- package/components/help-button/style/dnb-help-button.css +773 -0
- package/components/help-button/style/dnb-help-button.min.css +1 -1
- package/components/help-button/style/dnb-help-button.scss +3 -0
- package/components/icon/Icon.d.ts +1 -1
- package/components/icon-primary/IconPrimary.d.ts +1 -1
- package/components/info-card/InfoCard.js +2 -2
- package/components/info-card/style/_info-card.scss +3 -0
- package/components/info-card/style/dnb-info-card.css +4 -1
- package/components/info-card/style/dnb-info-card.min.css +1 -1
- package/components/input/style/dnb-input.css +371 -0
- package/components/input/style/dnb-input.min.css +1 -1
- package/components/input/style/dnb-input.scss +1 -0
- package/components/input-masked/style/dnb-input-masked.css +371 -0
- package/components/input-masked/style/dnb-input-masked.min.css +1 -1
- package/components/modal/style/_modal.scss +6 -0
- package/components/modal/style/dnb-modal.css +282 -1
- package/components/modal/style/dnb-modal.min.css +1 -1
- package/components/modal/style/dnb-modal.scss +1 -1
- package/components/pagination/style/dnb-pagination.css +192 -0
- package/components/pagination/style/dnb-pagination.min.css +1 -1
- package/components/slider/style/dnb-slider.css +192 -0
- package/components/slider/style/dnb-slider.min.css +1 -1
- package/components/step-indicator/style/dnb-step-indicator.css +773 -0
- package/components/step-indicator/style/dnb-step-indicator.min.css +1 -1
- package/components/step-indicator/style/dnb-step-indicator.scss +2 -0
- package/components/tabs/Tabs.d.ts +6 -0
- package/components/tabs/Tabs.js +192 -161
- package/components/tabs/style/_tabs.scss +59 -61
- package/components/tabs/style/dnb-tabs.css +176 -180
- package/components/tabs/style/dnb-tabs.min.css +1 -1
- package/components/tag/style/_tag.scss +10 -6
- package/components/tag/style/dnb-tag.css +205 -5
- package/components/tag/style/dnb-tag.min.css +1 -1
- package/components/toggle-button/style/dnb-toggle-button.css +192 -0
- package/components/toggle-button/style/dnb-toggle-button.min.css +1 -1
- package/components/toggle-button/style/dnb-toggle-button.scss +2 -0
- package/es/components/accordion/style/dnb-accordion.css +92 -0
- package/es/components/accordion/style/dnb-accordion.min.css +1 -1
- package/es/components/accordion/style/dnb-accordion.scss +3 -0
- package/es/components/autocomplete/style/dnb-autocomplete.css +1652 -64
- package/es/components/autocomplete/style/dnb-autocomplete.min.css +2 -2
- package/es/components/autocomplete/style/dnb-autocomplete.scss +1 -2
- package/es/components/button/style/dnb-button.css +192 -0
- package/es/components/button/style/dnb-button.min.css +1 -1
- package/es/components/button/style/dnb-button.scss +1 -1
- package/es/components/date-picker/style/dnb-date-picker.css +729 -0
- package/es/components/date-picker/style/dnb-date-picker.min.css +2 -2
- package/es/components/dialog/style/dnb-dialog.css +1883 -79
- package/es/components/dialog/style/dnb-dialog.min.css +1 -1
- package/es/components/dialog/style/dnb-dialog.scss +1 -1
- package/es/components/drawer/Drawer.js +2 -1
- package/es/components/drawer/style/dnb-drawer.css +1883 -79
- package/es/components/drawer/style/dnb-drawer.min.css +1 -1
- package/es/components/drawer/style/dnb-drawer.scss +1 -1
- package/es/components/dropdown/style/dnb-dropdown.css +192 -0
- package/es/components/dropdown/style/dnb-dropdown.min.css +1 -1
- package/es/components/dropdown/style/themes/dnb-dropdown-theme-ui.css +12 -11
- package/es/components/dropdown/style/themes/dnb-dropdown-theme-ui.min.css +1 -1
- package/es/components/dropdown/style/themes/dnb-dropdown-theme-ui.scss +4 -1
- package/es/components/global-error/style/dnb-global-error.css +192 -0
- package/es/components/global-error/style/dnb-global-error.min.css +1 -1
- package/es/components/global-status/style/dnb-global-status.css +192 -0
- package/es/components/global-status/style/dnb-global-status.min.css +1 -1
- package/es/components/help-button/style/dnb-help-button.css +773 -0
- package/es/components/help-button/style/dnb-help-button.min.css +1 -1
- package/es/components/help-button/style/dnb-help-button.scss +3 -0
- package/es/components/icon/Icon.d.ts +1 -1
- package/es/components/icon-primary/IconPrimary.d.ts +1 -1
- package/es/components/info-card/InfoCard.js +2 -2
- package/es/components/info-card/style/_info-card.scss +3 -0
- package/es/components/info-card/style/dnb-info-card.css +4 -1
- package/es/components/info-card/style/dnb-info-card.min.css +1 -1
- package/es/components/input/style/dnb-input.css +371 -0
- package/es/components/input/style/dnb-input.min.css +1 -1
- package/es/components/input/style/dnb-input.scss +1 -0
- package/es/components/input-masked/style/dnb-input-masked.css +371 -0
- package/es/components/input-masked/style/dnb-input-masked.min.css +1 -1
- package/es/components/modal/style/_modal.scss +6 -0
- package/es/components/modal/style/dnb-modal.css +282 -1
- package/es/components/modal/style/dnb-modal.min.css +1 -1
- package/es/components/modal/style/dnb-modal.scss +1 -1
- package/es/components/pagination/style/dnb-pagination.css +192 -0
- package/es/components/pagination/style/dnb-pagination.min.css +1 -1
- package/es/components/slider/style/dnb-slider.css +192 -0
- package/es/components/slider/style/dnb-slider.min.css +1 -1
- package/es/components/step-indicator/style/dnb-step-indicator.css +773 -0
- package/es/components/step-indicator/style/dnb-step-indicator.min.css +1 -1
- package/es/components/step-indicator/style/dnb-step-indicator.scss +2 -0
- package/es/components/tabs/Tabs.d.ts +6 -0
- package/es/components/tabs/Tabs.js +134 -108
- package/es/components/tabs/style/_tabs.scss +59 -61
- package/es/components/tabs/style/dnb-tabs.css +176 -180
- package/es/components/tabs/style/dnb-tabs.min.css +1 -1
- package/es/components/tag/style/_tag.scss +10 -6
- package/es/components/tag/style/dnb-tag.css +205 -5
- package/es/components/tag/style/dnb-tag.min.css +1 -1
- package/es/components/toggle-button/style/dnb-toggle-button.css +192 -0
- package/es/components/toggle-button/style/dnb-toggle-button.min.css +1 -1
- package/es/components/toggle-button/style/dnb-toggle-button.scss +2 -0
- package/es/shared/Eufemia.js +1 -1
- package/es/shared/hooks/usePropsWithContext.js +1 -1
- package/es/style/dnb-ui-components.css +207 -187
- package/es/style/dnb-ui-components.min.css +3 -3
- package/es/style/themes/theme-open-banking/dnb-theme-open-banking.css +12 -11
- package/es/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/es/style/themes/theme-ui/dnb-theme-ui.css +12 -11
- package/es/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/esm/dnb-ui-basis.min.mjs +1 -1
- package/esm/dnb-ui-components.min.mjs +1 -1
- package/esm/dnb-ui-elements.min.mjs +1 -1
- package/esm/dnb-ui-extensions.min.mjs +1 -1
- package/esm/dnb-ui-lib.min.mjs +3 -3
- package/esm/dnb-ui-web-components.min.mjs +2 -2
- package/package.json +1 -1
- package/shared/Eufemia.js +1 -1
- package/shared/hooks/usePropsWithContext.js +1 -1
- package/style/dnb-ui-components.css +207 -187
- package/style/dnb-ui-components.min.css +3 -3
- package/style/themes/theme-open-banking/dnb-theme-open-banking.css +12 -11
- package/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/style/themes/theme-ui/dnb-theme-ui.css +12 -11
- package/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/umd/dnb-ui-basis.min.js +1 -1
- package/umd/dnb-ui-components.min.js +3 -3
- package/umd/dnb-ui-elements.min.js +1 -1
- package/umd/dnb-ui-extensions.min.js +1 -1
- package/umd/dnb-ui-lib.min.js +3 -3
- package/umd/dnb-ui-web-components.min.js +3 -3
package/components/tabs/Tabs.js
CHANGED
|
@@ -23,9 +23,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
23
23
|
|
|
24
24
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
25
25
|
|
|
26
|
-
import "core-js/modules/es.parse-float.js";
|
|
27
26
|
import "core-js/modules/es.array.filter.js";
|
|
28
27
|
import "core-js/modules/es.object.to-string.js";
|
|
28
|
+
import "core-js/modules/es.parse-float.js";
|
|
29
29
|
import "core-js/modules/es.array.reduce.js";
|
|
30
30
|
import "core-js/modules/es.array.map.js";
|
|
31
31
|
import "core-js/modules/es.array.concat.js";
|
|
@@ -68,61 +68,54 @@ var Tabs = function (_React$PureComponent) {
|
|
|
68
68
|
if (_this._isMounted) {
|
|
69
69
|
_this.addScrollBehaviour();
|
|
70
70
|
|
|
71
|
-
_this.
|
|
71
|
+
var hasScrollbar = _this.hasScrollbar();
|
|
72
|
+
|
|
73
|
+
var hasLastPosition = _this.hasLastPosition();
|
|
72
74
|
|
|
73
|
-
_this.
|
|
75
|
+
_this.setScrollbarState({
|
|
76
|
+
hasScrollbar: hasScrollbar
|
|
77
|
+
});
|
|
74
78
|
|
|
75
|
-
if (
|
|
76
|
-
_this.
|
|
79
|
+
if (hasLastPosition) {
|
|
80
|
+
_this.setLeftPosition(_this.state.lastPosition);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (hasScrollbar) {
|
|
84
|
+
_this.scrollToTab({
|
|
85
|
+
type: 'selected',
|
|
86
|
+
behavior: hasLastPosition ? 'smooth' : 'auto'
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (_this.hasLastUsedTab() !== null) {
|
|
91
|
+
_this.setState(null, _this.setFocusOnTabButton);
|
|
77
92
|
}
|
|
78
93
|
}
|
|
79
94
|
});
|
|
80
95
|
|
|
81
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
82
|
-
var
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "setScrollbarState", function () {
|
|
97
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
98
|
+
_ref$hasScrollbar = _ref.hasScrollbar,
|
|
99
|
+
hasScrollbar = _ref$hasScrollbar === void 0 ? _this.hasScrollbar() : _ref$hasScrollbar;
|
|
83
100
|
|
|
84
101
|
if (hasScrollbar !== _this.state.hasScrollbar) {
|
|
85
102
|
_this.setState({
|
|
86
103
|
hasScrollbar: hasScrollbar
|
|
87
104
|
});
|
|
88
105
|
}
|
|
106
|
+
});
|
|
89
107
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (Math.ceil(window.innerWidth / 16) <= 40 || _this.isAtEdge()) {
|
|
93
|
-
if (!_this._tabsRef.current.style.marginLeft) {
|
|
94
|
-
var tabsStyle = window.getComputedStyle(_this._tabsRef.current);
|
|
95
|
-
|
|
96
|
-
if (!(Math.abs(parseFloat(tabsStyle.marginLeft)) > 0)) {
|
|
97
|
-
var diff = window.innerWidth - _this._tabsRef.current.offsetWidth;
|
|
98
|
-
var val = Math.round(diff / 16) / 2 * 16;
|
|
99
|
-
_this._tabsRef.current.style.marginLeft = "-".concat(val, "px");
|
|
100
|
-
_this._tabsRef.current.style.marginRight = "-".concat(val, "px");
|
|
101
|
-
|
|
102
|
-
if (val < 32) {
|
|
103
|
-
val = 32;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
var tablistStyle = window.getComputedStyle(_this._tablistRef.current);
|
|
107
|
-
_this._tablistRef.current.style.paddingLeft = "".concat((parseFloat(tablistStyle.paddingLeft) || 0) + val, "px");
|
|
108
|
-
_this._tablistRef.current.style.paddingRight = "".concat((parseFloat(tablistStyle.paddingRight) || 0) + val, "px");
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
_this._tabsRef.current.style.marginLeft = '';
|
|
113
|
-
_this._tabsRef.current.style.marginRight = '';
|
|
114
|
-
_this._tablistRef.current.style.paddingLeft = '';
|
|
115
|
-
_this._tablistRef.current.style.paddingRight = '';
|
|
116
|
-
}
|
|
117
|
-
} catch (e) {}
|
|
118
|
-
}
|
|
108
|
+
_defineProperty(_assertThisInitialized(_this), "onResizeHandler", function () {
|
|
109
|
+
var hasScrollbar = _this.hasScrollbar();
|
|
119
110
|
|
|
120
|
-
_this.
|
|
121
|
-
|
|
111
|
+
_this.setScrollbarState({
|
|
112
|
+
hasScrollbar: hasScrollbar
|
|
122
113
|
});
|
|
123
114
|
|
|
124
115
|
if (hasScrollbar) {
|
|
125
|
-
_this.scrollToTab(
|
|
116
|
+
_this.scrollToTab({
|
|
117
|
+
type: 'selected'
|
|
118
|
+
});
|
|
126
119
|
}
|
|
127
120
|
});
|
|
128
121
|
|
|
@@ -167,7 +160,9 @@ var Tabs = function (_React$PureComponent) {
|
|
|
167
160
|
|
|
168
161
|
_this.focusTab(key, e, 'step');
|
|
169
162
|
|
|
170
|
-
_this.scrollToTab(
|
|
163
|
+
_this.scrollToTab({
|
|
164
|
+
type: 'focus'
|
|
165
|
+
});
|
|
171
166
|
});
|
|
172
167
|
|
|
173
168
|
_defineProperty(_assertThisInitialized(_this), "focusLastTab", function (e) {
|
|
@@ -175,31 +170,41 @@ var Tabs = function (_React$PureComponent) {
|
|
|
175
170
|
|
|
176
171
|
_this.focusTab(key, e, 'step');
|
|
177
172
|
|
|
178
|
-
_this.scrollToTab(
|
|
173
|
+
_this.scrollToTab({
|
|
174
|
+
type: 'focus'
|
|
175
|
+
});
|
|
179
176
|
});
|
|
180
177
|
|
|
181
178
|
_defineProperty(_assertThisInitialized(_this), "focusPrevTab", function (e) {
|
|
182
179
|
_this.focusTab(-1, e, 'step');
|
|
183
180
|
|
|
184
|
-
_this.scrollToTab(
|
|
181
|
+
_this.scrollToTab({
|
|
182
|
+
type: 'focus'
|
|
183
|
+
});
|
|
185
184
|
});
|
|
186
185
|
|
|
187
186
|
_defineProperty(_assertThisInitialized(_this), "focusNextTab", function (e) {
|
|
188
187
|
_this.focusTab(+1, e, 'step');
|
|
189
188
|
|
|
190
|
-
_this.scrollToTab(
|
|
189
|
+
_this.scrollToTab({
|
|
190
|
+
type: 'focus'
|
|
191
|
+
});
|
|
191
192
|
});
|
|
192
193
|
|
|
193
194
|
_defineProperty(_assertThisInitialized(_this), "openPrevTab", function (e) {
|
|
194
195
|
_this.openTab(-1, e, 'step');
|
|
195
196
|
|
|
196
|
-
_this.scrollToTab(
|
|
197
|
+
_this.scrollToTab({
|
|
198
|
+
type: 'selected'
|
|
199
|
+
});
|
|
197
200
|
});
|
|
198
201
|
|
|
199
202
|
_defineProperty(_assertThisInitialized(_this), "openNextTab", function (e) {
|
|
200
203
|
_this.openTab(+1, e, 'step');
|
|
201
204
|
|
|
202
|
-
_this.scrollToTab(
|
|
205
|
+
_this.scrollToTab({
|
|
206
|
+
type: 'selected'
|
|
207
|
+
});
|
|
203
208
|
});
|
|
204
209
|
|
|
205
210
|
_defineProperty(_assertThisInitialized(_this), "handleVerticalScroll", function () {
|
|
@@ -211,14 +216,20 @@ var Tabs = function (_React$PureComponent) {
|
|
|
211
216
|
}
|
|
212
217
|
});
|
|
213
218
|
|
|
219
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseDown", function (event) {
|
|
220
|
+
event.preventDefault();
|
|
221
|
+
});
|
|
222
|
+
|
|
214
223
|
_defineProperty(_assertThisInitialized(_this), "onKeyDownHandler", function (event) {
|
|
215
224
|
switch (keycode(event)) {
|
|
216
225
|
case 'enter':
|
|
217
226
|
try {
|
|
218
227
|
var elem = document.getElementById("".concat(_this._id, "-content"));
|
|
219
|
-
elem.focus(
|
|
228
|
+
elem.focus({
|
|
229
|
+
preventScroll: true
|
|
230
|
+
});
|
|
220
231
|
} catch (e) {
|
|
221
|
-
|
|
232
|
+
_this.warnAboutMissingContainer();
|
|
222
233
|
}
|
|
223
234
|
|
|
224
235
|
break;
|
|
@@ -248,7 +259,9 @@ var Tabs = function (_React$PureComponent) {
|
|
|
248
259
|
if (ret !== false) {
|
|
249
260
|
_this.openTab(selected_key, event);
|
|
250
261
|
|
|
251
|
-
_this.scrollToTab(
|
|
262
|
+
_this.scrollToTab({
|
|
263
|
+
type: 'selected'
|
|
264
|
+
});
|
|
252
265
|
}
|
|
253
266
|
}
|
|
254
267
|
});
|
|
@@ -272,8 +285,8 @@ var Tabs = function (_React$PureComponent) {
|
|
|
272
285
|
_defineProperty(_assertThisInitialized(_this), "getCurrentTitle", function () {
|
|
273
286
|
var selected_key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.state.selected_key;
|
|
274
287
|
|
|
275
|
-
var current = _this.state.data.filter(function (
|
|
276
|
-
var key =
|
|
288
|
+
var current = _this.state.data.filter(function (_ref2) {
|
|
289
|
+
var key = _ref2.key;
|
|
277
290
|
return key == selected_key;
|
|
278
291
|
})[0];
|
|
279
292
|
|
|
@@ -291,7 +304,7 @@ var Tabs = function (_React$PureComponent) {
|
|
|
291
304
|
_this.setState({
|
|
292
305
|
focus_key: focus_key,
|
|
293
306
|
_listenForPropChanges: false
|
|
294
|
-
}, _this.
|
|
307
|
+
}, _this.setFocusOnTabButton);
|
|
295
308
|
|
|
296
309
|
dispatchCustomElementEvent(_assertThisInitialized(_this), 'on_focus', _this.getEventArgs({
|
|
297
310
|
event: event,
|
|
@@ -301,14 +314,16 @@ var Tabs = function (_React$PureComponent) {
|
|
|
301
314
|
_this.setWhatInput();
|
|
302
315
|
});
|
|
303
316
|
|
|
304
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
317
|
+
_defineProperty(_assertThisInitialized(_this), "setFocusOnTabButton", function () {
|
|
305
318
|
try {
|
|
306
319
|
var elem = _this._tablistRef.current.querySelector('.dnb-tabs__button.focus');
|
|
307
320
|
|
|
308
|
-
elem.focus(
|
|
321
|
+
elem.focus({
|
|
322
|
+
preventScroll: true
|
|
323
|
+
});
|
|
309
324
|
|
|
310
325
|
if (!document.getElementById("".concat(_this._id, "-content")) && typeof process !== 'undefined' && process.env.NODE_ENV !== 'test') {
|
|
311
|
-
|
|
326
|
+
_this.warnAboutMissingContainer();
|
|
312
327
|
}
|
|
313
328
|
} catch (e) {
|
|
314
329
|
warn(e);
|
|
@@ -385,11 +400,11 @@ var Tabs = function (_React$PureComponent) {
|
|
|
385
400
|
}
|
|
386
401
|
|
|
387
402
|
if (items) {
|
|
388
|
-
content = items.filter(function (
|
|
389
|
-
var key =
|
|
403
|
+
content = items.filter(function (_ref3) {
|
|
404
|
+
var key = _ref3.key;
|
|
390
405
|
return key && selected_key && key == selected_key;
|
|
391
|
-
}).reduce(function (acc,
|
|
392
|
-
var content =
|
|
406
|
+
}).reduce(function (acc, _ref4) {
|
|
407
|
+
var content = _ref4.content;
|
|
393
408
|
return content || acc;
|
|
394
409
|
}, null);
|
|
395
410
|
}
|
|
@@ -403,9 +418,9 @@ var Tabs = function (_React$PureComponent) {
|
|
|
403
418
|
return content;
|
|
404
419
|
});
|
|
405
420
|
|
|
406
|
-
_defineProperty(_assertThisInitialized(_this), "TabsWrapperHandler", function (
|
|
407
|
-
var children =
|
|
408
|
-
rest = _objectWithoutProperties(
|
|
421
|
+
_defineProperty(_assertThisInitialized(_this), "TabsWrapperHandler", function (_ref5) {
|
|
422
|
+
var children = _ref5.children,
|
|
423
|
+
rest = _objectWithoutProperties(_ref5, _excluded);
|
|
409
424
|
|
|
410
425
|
var _this$props2 = _this.props,
|
|
411
426
|
className = _this$props2.className,
|
|
@@ -422,30 +437,29 @@ var Tabs = function (_React$PureComponent) {
|
|
|
422
437
|
return React.createElement("div", _extends({}, params, rest), children);
|
|
423
438
|
});
|
|
424
439
|
|
|
425
|
-
_defineProperty(_assertThisInitialized(_this), "TabsListHandler", function (
|
|
426
|
-
var children =
|
|
427
|
-
className =
|
|
428
|
-
rest = _objectWithoutProperties(
|
|
440
|
+
_defineProperty(_assertThisInitialized(_this), "TabsListHandler", function (_ref6) {
|
|
441
|
+
var children = _ref6.children,
|
|
442
|
+
className = _ref6.className,
|
|
443
|
+
rest = _objectWithoutProperties(_ref6, _excluded2);
|
|
429
444
|
|
|
430
445
|
var _this$props3 = _this.props,
|
|
431
446
|
align = _this$props3.align,
|
|
432
447
|
tabs_style = _this$props3.tabs_style,
|
|
433
448
|
tabs_spacing = _this$props3.tabs_spacing,
|
|
434
|
-
no_border = _this$props3.no_border
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
atEdge = _this$state.atEdge;
|
|
449
|
+
no_border = _this$props3.no_border,
|
|
450
|
+
nav_button_edge = _this$props3.nav_button_edge;
|
|
451
|
+
var hasScrollbar = _this.state.hasScrollbar;
|
|
438
452
|
return React.createElement("div", _extends({
|
|
439
|
-
className: classnames('dnb-tabs__tabs', className, align && "dnb-tabs__tabs--".concat(align), tabs_style && "dnb-section dnb-section--".concat(tabs_style), tabs_spacing && "dnb-section--spacing-".concat(isTrue(tabs_spacing) ? 'default' : tabs_spacing), hasScrollbar && 'dnb-tabs--has-scrollbar',
|
|
453
|
+
className: classnames('dnb-tabs__tabs', className, align && "dnb-tabs__tabs--".concat(align), tabs_style && "dnb-section dnb-section--".concat(tabs_style), tabs_spacing && "dnb-section--spacing-".concat(isTrue(tabs_spacing) ? 'default' : tabs_spacing), hasScrollbar && 'dnb-tabs--has-scrollbar', nav_button_edge && 'dnb-tabs--at-edge', no_border && 'dnb-tabs__tabs--no-border'),
|
|
440
454
|
ref: _this._tabsRef
|
|
441
455
|
}, rest), React.createElement(ScrollNavButton, {
|
|
442
456
|
onMouseDown: _this.openPrevTab,
|
|
443
457
|
icon: "chevron_left",
|
|
444
|
-
className: classnames(hasScrollbar && 'dnb-tabs__scroll-nav-button--visible', _this.state.isFirst && 'dnb-tabs__scroll-nav-button--hide')
|
|
458
|
+
className: classnames(hasScrollbar && (typeof _this.state.isFirst !== 'undefined' || _this.hasLastPosition()) && 'dnb-tabs__scroll-nav-button--visible', _this.state.isFirst && 'dnb-tabs__scroll-nav-button--hide')
|
|
445
459
|
}), children, React.createElement(ScrollNavButton, {
|
|
446
460
|
onMouseDown: _this.openNextTab,
|
|
447
461
|
icon: "chevron_right",
|
|
448
|
-
className: classnames(hasScrollbar && 'dnb-tabs__scroll-nav-button--visible', _this.state.isLast && 'dnb-tabs__scroll-nav-button--hide')
|
|
462
|
+
className: classnames(hasScrollbar && (typeof _this.state.isLast !== 'undefined' || _this.hasLastPosition()) && 'dnb-tabs__scroll-nav-button--visible', _this.state.isLast && 'dnb-tabs__scroll-nav-button--hide')
|
|
449
463
|
}));
|
|
450
464
|
});
|
|
451
465
|
|
|
@@ -475,13 +489,13 @@ var Tabs = function (_React$PureComponent) {
|
|
|
475
489
|
var selected_key = _this.state.selected_key;
|
|
476
490
|
var TabElement = tab_element || 'button';
|
|
477
491
|
|
|
478
|
-
var tabs = _this.state.data.map(function (
|
|
479
|
-
var title =
|
|
480
|
-
key =
|
|
481
|
-
|
|
482
|
-
disabled =
|
|
483
|
-
to =
|
|
484
|
-
href =
|
|
492
|
+
var tabs = _this.state.data.map(function (_ref7) {
|
|
493
|
+
var title = _ref7.title,
|
|
494
|
+
key = _ref7.key,
|
|
495
|
+
_ref7$disabled = _ref7.disabled,
|
|
496
|
+
disabled = _ref7$disabled === void 0 ? false : _ref7$disabled,
|
|
497
|
+
to = _ref7.to,
|
|
498
|
+
href = _ref7.href;
|
|
485
499
|
var itemParams = {
|
|
486
500
|
to: to,
|
|
487
501
|
href: href
|
|
@@ -517,6 +531,7 @@ var Tabs = function (_React$PureComponent) {
|
|
|
517
531
|
onMouseEnter: _this.onMouseEnterHandler,
|
|
518
532
|
onClick: _this.onClickHandler,
|
|
519
533
|
onKeyUp: _this.onKeyDownHandler,
|
|
534
|
+
onMouseDown: _this.onMouseDown,
|
|
520
535
|
"data-tab-key": key
|
|
521
536
|
}, itemParams), React.createElement("span", {
|
|
522
537
|
className: classnames('dnb-tabs__button__title', createSkeletonClass('font', skeleton, _this.context))
|
|
@@ -561,10 +576,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
561
576
|
|
|
562
577
|
_this.state = {
|
|
563
578
|
data: data,
|
|
564
|
-
lastPosition: lastPosition,
|
|
565
579
|
selected_key: _selected_key,
|
|
566
580
|
focus_key: _selected_key,
|
|
567
581
|
atEdge: false,
|
|
582
|
+
lastPosition: lastPosition,
|
|
568
583
|
hasScrollbar: lastPosition > -1,
|
|
569
584
|
_selected_key: _selected_key,
|
|
570
585
|
_data: _props.data || _props.children,
|
|
@@ -607,8 +622,6 @@ var Tabs = function (_React$PureComponent) {
|
|
|
607
622
|
this._eventEmitter = null;
|
|
608
623
|
}
|
|
609
624
|
|
|
610
|
-
clearTimeout(this._scrollToTabTimeout);
|
|
611
|
-
|
|
612
625
|
if (typeof window !== 'undefined') {
|
|
613
626
|
window.removeEventListener('resize', this.onResizeHandler);
|
|
614
627
|
window.removeEventListener('load', this.init);
|
|
@@ -617,24 +630,31 @@ var Tabs = function (_React$PureComponent) {
|
|
|
617
630
|
}, {
|
|
618
631
|
key: "componentDidUpdate",
|
|
619
632
|
value: function componentDidUpdate(props) {
|
|
620
|
-
this.
|
|
633
|
+
if (this._eventEmitter && (this.props.selected_key !== props.selected_key || this.props.data !== props.data)) {
|
|
634
|
+
this.onResizeHandler();
|
|
621
635
|
|
|
622
|
-
|
|
623
|
-
|
|
636
|
+
if (this._eventEmitter) {
|
|
637
|
+
var selected_key = this.state.selected_key;
|
|
624
638
|
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
639
|
+
this._eventEmitter.update(this.getEventArgs({
|
|
640
|
+
selected_key: selected_key
|
|
641
|
+
}));
|
|
642
|
+
}
|
|
628
643
|
}
|
|
629
644
|
}
|
|
645
|
+
}, {
|
|
646
|
+
key: "hasLastPosition",
|
|
647
|
+
value: function hasLastPosition() {
|
|
648
|
+
return this.state.lastPosition > -1;
|
|
649
|
+
}
|
|
630
650
|
}, {
|
|
631
651
|
key: "getLastPosition",
|
|
632
652
|
value: function getLastPosition() {
|
|
633
653
|
if (typeof window !== 'undefined') {
|
|
634
654
|
try {
|
|
635
|
-
var pos = parseFloat(window.localStorage.getItem(
|
|
636
|
-
window.localStorage.removeItem(
|
|
637
|
-
return pos;
|
|
655
|
+
var pos = parseFloat(window.localStorage.getItem("tabs-pos-".concat(this._id)));
|
|
656
|
+
window.localStorage.removeItem("tabs-pos-".concat(this._id));
|
|
657
|
+
return isNaN(pos) ? -1 : pos;
|
|
638
658
|
} catch (e) {
|
|
639
659
|
warn(e);
|
|
640
660
|
}
|
|
@@ -643,12 +663,12 @@ var Tabs = function (_React$PureComponent) {
|
|
|
643
663
|
return -1;
|
|
644
664
|
}
|
|
645
665
|
}, {
|
|
646
|
-
key: "
|
|
647
|
-
value: function
|
|
666
|
+
key: "hasLastUsedTab",
|
|
667
|
+
value: function hasLastUsedTab() {
|
|
648
668
|
if (typeof window !== 'undefined') {
|
|
649
669
|
try {
|
|
650
|
-
var key = window.localStorage.getItem(
|
|
651
|
-
window.localStorage.removeItem(
|
|
670
|
+
var key = window.localStorage.getItem("tabs-last-".concat(this._id)) || null;
|
|
671
|
+
window.localStorage.removeItem("tabs-last-".concat(this._id));
|
|
652
672
|
return key;
|
|
653
673
|
} catch (e) {
|
|
654
674
|
warn(e);
|
|
@@ -662,7 +682,7 @@ var Tabs = function (_React$PureComponent) {
|
|
|
662
682
|
value: function saveLastUsedTab() {
|
|
663
683
|
if (typeof window !== 'undefined') {
|
|
664
684
|
try {
|
|
665
|
-
window.localStorage.setItem(
|
|
685
|
+
window.localStorage.setItem("tabs-last-".concat(this._id), this.state.selected_key);
|
|
666
686
|
} catch (e) {
|
|
667
687
|
warn(e);
|
|
668
688
|
}
|
|
@@ -671,11 +691,11 @@ var Tabs = function (_React$PureComponent) {
|
|
|
671
691
|
}, {
|
|
672
692
|
key: "saveLastPosition",
|
|
673
693
|
value: function saveLastPosition() {
|
|
674
|
-
var
|
|
694
|
+
var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._tablistRef.current.scrollLeft;
|
|
675
695
|
|
|
676
696
|
if (typeof window !== 'undefined') {
|
|
677
697
|
try {
|
|
678
|
-
window.localStorage.setItem(
|
|
698
|
+
window.localStorage.setItem("tabs-pos-".concat(this._id), position);
|
|
679
699
|
} catch (e) {
|
|
680
700
|
warn(e);
|
|
681
701
|
}
|
|
@@ -686,53 +706,42 @@ var Tabs = function (_React$PureComponent) {
|
|
|
686
706
|
value: function hasScrollbar() {
|
|
687
707
|
return this._tablistRef.current.scrollWidth - 1 > this._tablistRef.current.offsetWidth;
|
|
688
708
|
}
|
|
689
|
-
}, {
|
|
690
|
-
key: "isAtEdge",
|
|
691
|
-
value: function isAtEdge() {
|
|
692
|
-
if (!this._hasScrollbar || typeof window === 'undefined') {
|
|
693
|
-
return false;
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
try {
|
|
697
|
-
var padding = parseFloat(window.getComputedStyle(this._tablistRef.current).paddingLeft);
|
|
698
|
-
var width = this._tablistRef.current.offsetWidth + 2 + 64 - padding;
|
|
699
|
-
var screenWidth = window.innerWidth;
|
|
700
|
-
return width >= screenWidth;
|
|
701
|
-
} catch (e) {}
|
|
702
|
-
|
|
703
|
-
return false;
|
|
704
|
-
}
|
|
705
709
|
}, {
|
|
706
710
|
key: "addScrollBehaviour",
|
|
707
711
|
value: function addScrollBehaviour() {
|
|
708
|
-
this.onResizeHandler();
|
|
709
|
-
|
|
710
712
|
if (typeof window !== 'undefined') {
|
|
711
713
|
window.addEventListener('resize', this.onResizeHandler);
|
|
712
714
|
}
|
|
713
715
|
}
|
|
714
716
|
}, {
|
|
715
|
-
key: "
|
|
716
|
-
value: function
|
|
717
|
+
key: "setLeftPosition",
|
|
718
|
+
value: function setLeftPosition(scrollLeft) {
|
|
717
719
|
try {
|
|
718
720
|
this._tablistRef.current.style.scrollBehavior = 'auto';
|
|
719
|
-
this._tablistRef.current.scrollLeft =
|
|
721
|
+
this._tablistRef.current.scrollLeft = scrollLeft;
|
|
720
722
|
this._tablistRef.current.style.scrollBehavior = 'smooth';
|
|
721
723
|
} catch (e) {}
|
|
722
724
|
}
|
|
723
725
|
}, {
|
|
724
726
|
key: "scrollToTab",
|
|
725
|
-
value: function scrollToTab(
|
|
727
|
+
value: function scrollToTab(_ref8) {
|
|
726
728
|
var _this2 = this;
|
|
727
729
|
|
|
730
|
+
var type = _ref8.type,
|
|
731
|
+
_ref8$behavior = _ref8.behavior,
|
|
732
|
+
behavior = _ref8$behavior === void 0 ? 'smooth' : _ref8$behavior;
|
|
733
|
+
|
|
728
734
|
if (typeof window === 'undefined') {
|
|
729
735
|
return;
|
|
730
736
|
}
|
|
731
737
|
|
|
732
|
-
|
|
733
|
-
|
|
738
|
+
if (window.IS_TEST) {
|
|
739
|
+
behavior = 'auto';
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
var delay = function delay() {
|
|
734
743
|
try {
|
|
735
|
-
if (
|
|
744
|
+
if (_this2.state.hasScrollbar && _this2._tablistRef.current) {
|
|
736
745
|
var first = _this2._tablistRef.current.querySelector('.dnb-tabs__button__snap:first-of-type');
|
|
737
746
|
|
|
738
747
|
var isFirst = first.classList.contains(type);
|
|
@@ -747,20 +756,30 @@ var Tabs = function (_React$PureComponent) {
|
|
|
747
756
|
var margin = parseFloat(style.marginLeft);
|
|
748
757
|
var padding = margin < 0 ? parseFloat(style.paddingLeft) : 0;
|
|
749
758
|
|
|
750
|
-
if (!isFirst &&
|
|
759
|
+
if (!isFirst && !isLast && parseFloat(style.paddingLeft) < 16) {
|
|
751
760
|
var navButton = _this2._tabsRef.current.querySelector('.dnb-tabs__scroll-nav-button:first-of-type');
|
|
752
761
|
|
|
753
|
-
|
|
762
|
+
var additionalSpace = parseFloat(window.getComputedStyle(navButton).width) * 1.5;
|
|
763
|
+
padding += additionalSpace;
|
|
754
764
|
}
|
|
755
765
|
|
|
756
766
|
var leftPadding = (margin < 0 ? Math.abs(margin) : 0) + padding + parseFloat(window.getComputedStyle(first).paddingLeft);
|
|
757
|
-
var
|
|
767
|
+
var offsetLeft = elem.offsetLeft;
|
|
768
|
+
var left = elem && !isFirst ? offsetLeft - leftPadding : 0;
|
|
769
|
+
|
|
770
|
+
if (behavior === 'auto') {
|
|
771
|
+
_this2._tablistRef.current.style.scrollBehavior = 'auto';
|
|
772
|
+
}
|
|
758
773
|
|
|
759
774
|
_this2._tablistRef.current.scrollTo({
|
|
760
775
|
left: left,
|
|
761
|
-
behavior:
|
|
776
|
+
behavior: behavior
|
|
762
777
|
});
|
|
763
778
|
|
|
779
|
+
if (behavior === 'auto') {
|
|
780
|
+
_this2._tablistRef.current.style.scrollBehavior = '';
|
|
781
|
+
}
|
|
782
|
+
|
|
764
783
|
_this2.setState({
|
|
765
784
|
isFirst: isFirst,
|
|
766
785
|
isLast: isLast
|
|
@@ -769,17 +788,23 @@ var Tabs = function (_React$PureComponent) {
|
|
|
769
788
|
} catch (e) {
|
|
770
789
|
warn(e);
|
|
771
790
|
}
|
|
772
|
-
}
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
if (window.IS_TEST) {
|
|
794
|
+
delay();
|
|
795
|
+
} else {
|
|
796
|
+
window.requestAnimationFrame(delay);
|
|
797
|
+
}
|
|
773
798
|
}
|
|
774
799
|
}, {
|
|
775
800
|
key: "getStepKey",
|
|
776
801
|
value: function getStepKey(useKey, stateKey) {
|
|
777
|
-
var currentData = this.state.data.filter(function (
|
|
778
|
-
var disabled =
|
|
802
|
+
var currentData = this.state.data.filter(function (_ref9) {
|
|
803
|
+
var disabled = _ref9.disabled;
|
|
779
804
|
return !disabled;
|
|
780
805
|
});
|
|
781
|
-
var currentIndex = currentData.reduce(function (acc,
|
|
782
|
-
var key =
|
|
806
|
+
var currentIndex = currentData.reduce(function (acc, _ref10, i) {
|
|
807
|
+
var key = _ref10.key;
|
|
783
808
|
return key == stateKey ? i : acc;
|
|
784
809
|
}, -1);
|
|
785
810
|
var nextIndex = currentIndex + useKey;
|
|
@@ -792,8 +817,8 @@ var Tabs = function (_React$PureComponent) {
|
|
|
792
817
|
nextIndex = 0;
|
|
793
818
|
}
|
|
794
819
|
|
|
795
|
-
return currentData.reduce(function (acc,
|
|
796
|
-
var key =
|
|
820
|
+
return currentData.reduce(function (acc, _ref11, i) {
|
|
821
|
+
var key = _ref11.key;
|
|
797
822
|
return i === nextIndex ? key : acc;
|
|
798
823
|
}, null);
|
|
799
824
|
}
|
|
@@ -807,12 +832,17 @@ var Tabs = function (_React$PureComponent) {
|
|
|
807
832
|
value: function resetWhatInput() {
|
|
808
833
|
whatInput.specificKeys([9]);
|
|
809
834
|
}
|
|
835
|
+
}, {
|
|
836
|
+
key: "warnAboutMissingContainer",
|
|
837
|
+
value: function warnAboutMissingContainer() {
|
|
838
|
+
warn("Could not find the required <Tabs.Content id=\"".concat(this._id, "-content\" ... /> that provides role=\"tabpanel\""));
|
|
839
|
+
}
|
|
810
840
|
}, {
|
|
811
841
|
key: "getEventArgs",
|
|
812
842
|
value: function getEventArgs(args) {
|
|
813
|
-
var _this$
|
|
814
|
-
selected_key = _this$
|
|
815
|
-
focus_key = _this$
|
|
843
|
+
var _this$state = this.state,
|
|
844
|
+
selected_key = _this$state.selected_key,
|
|
845
|
+
focus_key = _this$state.focus_key;
|
|
816
846
|
var key = typeof args.selected_key !== 'undefined' ? args.selected_key : selected_key;
|
|
817
847
|
return _objectSpread({
|
|
818
848
|
key: key,
|
|
@@ -836,18 +866,18 @@ var Tabs = function (_React$PureComponent) {
|
|
|
836
866
|
value: function renderCachedContent() {
|
|
837
867
|
var _this3 = this;
|
|
838
868
|
|
|
839
|
-
var _this$
|
|
840
|
-
selected_key = _this$
|
|
841
|
-
data = _this$
|
|
869
|
+
var _this$state2 = this.state,
|
|
870
|
+
selected_key = _this$state2.selected_key,
|
|
871
|
+
data = _this$state2.data;
|
|
842
872
|
var _this$props4 = this.props,
|
|
843
873
|
prevent_rerender = _this$props4.prevent_rerender,
|
|
844
874
|
prerender = _this$props4.prerender;
|
|
845
875
|
|
|
846
876
|
if (isTrue(prerender)) {
|
|
847
|
-
this._cache = Object.entries(data).reduce(function (acc,
|
|
848
|
-
var
|
|
849
|
-
idx =
|
|
850
|
-
cur =
|
|
877
|
+
this._cache = Object.entries(data).reduce(function (acc, _ref12) {
|
|
878
|
+
var _ref13 = _slicedToArray(_ref12, 2),
|
|
879
|
+
idx = _ref13[0],
|
|
880
|
+
cur = _ref13[1];
|
|
851
881
|
|
|
852
882
|
acc[cur.key] = _objectSpread(_objectSpread({}, cur), {}, {
|
|
853
883
|
content: _this3.getContent(cur.key)
|
|
@@ -860,10 +890,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
860
890
|
}));
|
|
861
891
|
}
|
|
862
892
|
|
|
863
|
-
var cachedContent = Object.entries(this._cache).map(function (
|
|
864
|
-
var
|
|
865
|
-
key =
|
|
866
|
-
content =
|
|
893
|
+
var cachedContent = Object.entries(this._cache).map(function (_ref14) {
|
|
894
|
+
var _ref15 = _slicedToArray(_ref14, 2),
|
|
895
|
+
key = _ref15[0],
|
|
896
|
+
content = _ref15[1].content;
|
|
867
897
|
|
|
868
898
|
var params = {};
|
|
869
899
|
|
|
@@ -932,14 +962,14 @@ var Tabs = function (_React$PureComponent) {
|
|
|
932
962
|
var useKey = selected_key;
|
|
933
963
|
|
|
934
964
|
if (!useKey) {
|
|
935
|
-
useKey = data.reduce(function (acc,
|
|
936
|
-
var selected =
|
|
937
|
-
key =
|
|
965
|
+
useKey = data.reduce(function (acc, _ref16) {
|
|
966
|
+
var selected = _ref16.selected,
|
|
967
|
+
key = _ref16.key;
|
|
938
968
|
return selected ? key : acc;
|
|
939
969
|
}, null) || data[0] && data[0].key;
|
|
940
970
|
} else {
|
|
941
|
-
var keyExists = data.findIndex(function (
|
|
942
|
-
var key =
|
|
971
|
+
var keyExists = data.findIndex(function (_ref17) {
|
|
972
|
+
var key = _ref17.key;
|
|
943
973
|
return key == selected_key;
|
|
944
974
|
});
|
|
945
975
|
|
|
@@ -1016,10 +1046,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
1016
1046
|
} else if (typeof data === 'string') {
|
|
1017
1047
|
res = data[0] === '[' ? JSON.parse(data) : [];
|
|
1018
1048
|
} else if (data && _typeof(data) === 'object') {
|
|
1019
|
-
res = Object.entries(data).reduce(function (acc,
|
|
1020
|
-
var
|
|
1021
|
-
key =
|
|
1022
|
-
obj =
|
|
1049
|
+
res = Object.entries(data).reduce(function (acc, _ref18) {
|
|
1050
|
+
var _ref19 = _slicedToArray(_ref18, 2),
|
|
1051
|
+
key = _ref19[0],
|
|
1052
|
+
obj = _ref19[1];
|
|
1023
1053
|
|
|
1024
1054
|
if (obj) {
|
|
1025
1055
|
acc.push(_objectSpread({
|
|
@@ -1055,6 +1085,7 @@ _defineProperty(Tabs, "defaultProps", {
|
|
|
1055
1085
|
tabs_style: null,
|
|
1056
1086
|
tabs_spacing: null,
|
|
1057
1087
|
no_border: false,
|
|
1088
|
+
nav_button_edge: false,
|
|
1058
1089
|
use_hash: false,
|
|
1059
1090
|
prerender: false,
|
|
1060
1091
|
prevent_rerender: false,
|
|
@@ -1097,6 +1128,7 @@ process.env.NODE_ENV !== "production" ? Tabs.propTypes = _objectSpread(_objectSp
|
|
|
1097
1128
|
tabs_style: PropTypes.string,
|
|
1098
1129
|
tabs_spacing: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
1099
1130
|
no_border: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
1131
|
+
nav_button_edge: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
1100
1132
|
use_hash: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
1101
1133
|
prerender: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
1102
1134
|
prevent_rerender: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
@@ -1113,8 +1145,8 @@ process.env.NODE_ENV !== "production" ? Tabs.propTypes = _objectSpread(_objectSp
|
|
|
1113
1145
|
on_click: PropTypes.func,
|
|
1114
1146
|
on_focus: PropTypes.func
|
|
1115
1147
|
}) : void 0;
|
|
1116
|
-
export var Dummy = function Dummy(
|
|
1117
|
-
var children =
|
|
1148
|
+
export var Dummy = function Dummy(_ref20) {
|
|
1149
|
+
var children = _ref20.children;
|
|
1118
1150
|
return React.createElement("span", {
|
|
1119
1151
|
"aria-hidden": true,
|
|
1120
1152
|
hidden: true,
|
|
@@ -1131,8 +1163,7 @@ var ScrollNavButton = function ScrollNavButton(props) {
|
|
|
1131
1163
|
variant: "primary",
|
|
1132
1164
|
tabIndex: "-1",
|
|
1133
1165
|
bounding: true,
|
|
1134
|
-
"aria-hidden": true
|
|
1135
|
-
icon_size: "medium"
|
|
1166
|
+
"aria-hidden": true
|
|
1136
1167
|
}, props, {
|
|
1137
1168
|
className: classnames('dnb-tabs__scroll-nav-button', props.className)
|
|
1138
1169
|
}));
|