@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
|
@@ -39,12 +39,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
39
39
|
});
|
|
40
40
|
exports.default = exports.Dummy = void 0;
|
|
41
41
|
|
|
42
|
-
require("core-js/modules/es.parse-float.js");
|
|
43
|
-
|
|
44
42
|
require("core-js/modules/es.array.filter.js");
|
|
45
43
|
|
|
46
44
|
require("core-js/modules/es.object.to-string.js");
|
|
47
45
|
|
|
46
|
+
require("core-js/modules/es.parse-float.js");
|
|
47
|
+
|
|
48
48
|
require("core-js/modules/es.array.reduce.js");
|
|
49
49
|
|
|
50
50
|
require("core-js/modules/es.array.map.js");
|
|
@@ -153,61 +153,54 @@ var Tabs = function (_React$PureComponent) {
|
|
|
153
153
|
if (_this._isMounted) {
|
|
154
154
|
_this.addScrollBehaviour();
|
|
155
155
|
|
|
156
|
-
_this.
|
|
156
|
+
var hasScrollbar = _this.hasScrollbar();
|
|
157
157
|
|
|
158
|
-
_this.
|
|
158
|
+
var hasLastPosition = _this.hasLastPosition();
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
_this.setScrollbarState({
|
|
161
|
+
hasScrollbar: hasScrollbar
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if (hasLastPosition) {
|
|
165
|
+
_this.setLeftPosition(_this.state.lastPosition);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (hasScrollbar) {
|
|
169
|
+
_this.scrollToTab({
|
|
170
|
+
type: 'selected',
|
|
171
|
+
behavior: hasLastPosition ? 'smooth' : 'auto'
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (_this.hasLastUsedTab() !== null) {
|
|
176
|
+
_this.setState(null, _this.setFocusOnTabButton);
|
|
162
177
|
}
|
|
163
178
|
}
|
|
164
179
|
});
|
|
165
180
|
|
|
166
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
167
|
-
var
|
|
181
|
+
_defineProperty(_assertThisInitialized(_this), "setScrollbarState", function () {
|
|
182
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
183
|
+
_ref$hasScrollbar = _ref.hasScrollbar,
|
|
184
|
+
hasScrollbar = _ref$hasScrollbar === void 0 ? _this.hasScrollbar() : _ref$hasScrollbar;
|
|
168
185
|
|
|
169
186
|
if (hasScrollbar !== _this.state.hasScrollbar) {
|
|
170
187
|
_this.setState({
|
|
171
188
|
hasScrollbar: hasScrollbar
|
|
172
189
|
});
|
|
173
190
|
}
|
|
191
|
+
});
|
|
174
192
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (Math.ceil(window.innerWidth / 16) <= 40 || _this.isAtEdge()) {
|
|
178
|
-
if (!_this._tabsRef.current.style.marginLeft) {
|
|
179
|
-
var tabsStyle = window.getComputedStyle(_this._tabsRef.current);
|
|
180
|
-
|
|
181
|
-
if (!(Math.abs(parseFloat(tabsStyle.marginLeft)) > 0)) {
|
|
182
|
-
var diff = window.innerWidth - _this._tabsRef.current.offsetWidth;
|
|
183
|
-
var val = Math.round(diff / 16) / 2 * 16;
|
|
184
|
-
_this._tabsRef.current.style.marginLeft = "-".concat(val, "px");
|
|
185
|
-
_this._tabsRef.current.style.marginRight = "-".concat(val, "px");
|
|
186
|
-
|
|
187
|
-
if (val < 32) {
|
|
188
|
-
val = 32;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
var tablistStyle = window.getComputedStyle(_this._tablistRef.current);
|
|
192
|
-
_this._tablistRef.current.style.paddingLeft = "".concat((parseFloat(tablistStyle.paddingLeft) || 0) + val, "px");
|
|
193
|
-
_this._tablistRef.current.style.paddingRight = "".concat((parseFloat(tablistStyle.paddingRight) || 0) + val, "px");
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
} else {
|
|
197
|
-
_this._tabsRef.current.style.marginLeft = '';
|
|
198
|
-
_this._tabsRef.current.style.marginRight = '';
|
|
199
|
-
_this._tablistRef.current.style.paddingLeft = '';
|
|
200
|
-
_this._tablistRef.current.style.paddingRight = '';
|
|
201
|
-
}
|
|
202
|
-
} catch (e) {}
|
|
203
|
-
}
|
|
193
|
+
_defineProperty(_assertThisInitialized(_this), "onResizeHandler", function () {
|
|
194
|
+
var hasScrollbar = _this.hasScrollbar();
|
|
204
195
|
|
|
205
|
-
_this.
|
|
206
|
-
|
|
196
|
+
_this.setScrollbarState({
|
|
197
|
+
hasScrollbar: hasScrollbar
|
|
207
198
|
});
|
|
208
199
|
|
|
209
200
|
if (hasScrollbar) {
|
|
210
|
-
_this.scrollToTab(
|
|
201
|
+
_this.scrollToTab({
|
|
202
|
+
type: 'selected'
|
|
203
|
+
});
|
|
211
204
|
}
|
|
212
205
|
});
|
|
213
206
|
|
|
@@ -252,7 +245,9 @@ var Tabs = function (_React$PureComponent) {
|
|
|
252
245
|
|
|
253
246
|
_this.focusTab(key, e, 'step');
|
|
254
247
|
|
|
255
|
-
_this.scrollToTab(
|
|
248
|
+
_this.scrollToTab({
|
|
249
|
+
type: 'focus'
|
|
250
|
+
});
|
|
256
251
|
});
|
|
257
252
|
|
|
258
253
|
_defineProperty(_assertThisInitialized(_this), "focusLastTab", function (e) {
|
|
@@ -260,31 +255,41 @@ var Tabs = function (_React$PureComponent) {
|
|
|
260
255
|
|
|
261
256
|
_this.focusTab(key, e, 'step');
|
|
262
257
|
|
|
263
|
-
_this.scrollToTab(
|
|
258
|
+
_this.scrollToTab({
|
|
259
|
+
type: 'focus'
|
|
260
|
+
});
|
|
264
261
|
});
|
|
265
262
|
|
|
266
263
|
_defineProperty(_assertThisInitialized(_this), "focusPrevTab", function (e) {
|
|
267
264
|
_this.focusTab(-1, e, 'step');
|
|
268
265
|
|
|
269
|
-
_this.scrollToTab(
|
|
266
|
+
_this.scrollToTab({
|
|
267
|
+
type: 'focus'
|
|
268
|
+
});
|
|
270
269
|
});
|
|
271
270
|
|
|
272
271
|
_defineProperty(_assertThisInitialized(_this), "focusNextTab", function (e) {
|
|
273
272
|
_this.focusTab(+1, e, 'step');
|
|
274
273
|
|
|
275
|
-
_this.scrollToTab(
|
|
274
|
+
_this.scrollToTab({
|
|
275
|
+
type: 'focus'
|
|
276
|
+
});
|
|
276
277
|
});
|
|
277
278
|
|
|
278
279
|
_defineProperty(_assertThisInitialized(_this), "openPrevTab", function (e) {
|
|
279
280
|
_this.openTab(-1, e, 'step');
|
|
280
281
|
|
|
281
|
-
_this.scrollToTab(
|
|
282
|
+
_this.scrollToTab({
|
|
283
|
+
type: 'selected'
|
|
284
|
+
});
|
|
282
285
|
});
|
|
283
286
|
|
|
284
287
|
_defineProperty(_assertThisInitialized(_this), "openNextTab", function (e) {
|
|
285
288
|
_this.openTab(+1, e, 'step');
|
|
286
289
|
|
|
287
|
-
_this.scrollToTab(
|
|
290
|
+
_this.scrollToTab({
|
|
291
|
+
type: 'selected'
|
|
292
|
+
});
|
|
288
293
|
});
|
|
289
294
|
|
|
290
295
|
_defineProperty(_assertThisInitialized(_this), "handleVerticalScroll", function () {
|
|
@@ -296,14 +301,20 @@ var Tabs = function (_React$PureComponent) {
|
|
|
296
301
|
}
|
|
297
302
|
});
|
|
298
303
|
|
|
304
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseDown", function (event) {
|
|
305
|
+
event.preventDefault();
|
|
306
|
+
});
|
|
307
|
+
|
|
299
308
|
_defineProperty(_assertThisInitialized(_this), "onKeyDownHandler", function (event) {
|
|
300
309
|
switch ((0, _keycode.default)(event)) {
|
|
301
310
|
case 'enter':
|
|
302
311
|
try {
|
|
303
312
|
var elem = document.getElementById("".concat(_this._id, "-content"));
|
|
304
|
-
elem.focus(
|
|
313
|
+
elem.focus({
|
|
314
|
+
preventScroll: true
|
|
315
|
+
});
|
|
305
316
|
} catch (e) {
|
|
306
|
-
|
|
317
|
+
_this.warnAboutMissingContainer();
|
|
307
318
|
}
|
|
308
319
|
|
|
309
320
|
break;
|
|
@@ -333,7 +344,9 @@ var Tabs = function (_React$PureComponent) {
|
|
|
333
344
|
if (ret !== false) {
|
|
334
345
|
_this.openTab(selected_key, event);
|
|
335
346
|
|
|
336
|
-
_this.scrollToTab(
|
|
347
|
+
_this.scrollToTab({
|
|
348
|
+
type: 'selected'
|
|
349
|
+
});
|
|
337
350
|
}
|
|
338
351
|
}
|
|
339
352
|
});
|
|
@@ -357,8 +370,8 @@ var Tabs = function (_React$PureComponent) {
|
|
|
357
370
|
_defineProperty(_assertThisInitialized(_this), "getCurrentTitle", function () {
|
|
358
371
|
var selected_key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.state.selected_key;
|
|
359
372
|
|
|
360
|
-
var current = _this.state.data.filter(function (
|
|
361
|
-
var key =
|
|
373
|
+
var current = _this.state.data.filter(function (_ref2) {
|
|
374
|
+
var key = _ref2.key;
|
|
362
375
|
return key == selected_key;
|
|
363
376
|
})[0];
|
|
364
377
|
|
|
@@ -376,7 +389,7 @@ var Tabs = function (_React$PureComponent) {
|
|
|
376
389
|
_this.setState({
|
|
377
390
|
focus_key: focus_key,
|
|
378
391
|
_listenForPropChanges: false
|
|
379
|
-
}, _this.
|
|
392
|
+
}, _this.setFocusOnTabButton);
|
|
380
393
|
|
|
381
394
|
(0, _componentHelper.dispatchCustomElementEvent)(_assertThisInitialized(_this), 'on_focus', _this.getEventArgs({
|
|
382
395
|
event: event,
|
|
@@ -386,14 +399,16 @@ var Tabs = function (_React$PureComponent) {
|
|
|
386
399
|
_this.setWhatInput();
|
|
387
400
|
});
|
|
388
401
|
|
|
389
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
402
|
+
_defineProperty(_assertThisInitialized(_this), "setFocusOnTabButton", function () {
|
|
390
403
|
try {
|
|
391
404
|
var elem = _this._tablistRef.current.querySelector('.dnb-tabs__button.focus');
|
|
392
405
|
|
|
393
|
-
elem.focus(
|
|
406
|
+
elem.focus({
|
|
407
|
+
preventScroll: true
|
|
408
|
+
});
|
|
394
409
|
|
|
395
410
|
if (!document.getElementById("".concat(_this._id, "-content")) && typeof process !== 'undefined' && process.env.NODE_ENV !== 'test') {
|
|
396
|
-
|
|
411
|
+
_this.warnAboutMissingContainer();
|
|
397
412
|
}
|
|
398
413
|
} catch (e) {
|
|
399
414
|
(0, _componentHelper.warn)(e);
|
|
@@ -470,11 +485,11 @@ var Tabs = function (_React$PureComponent) {
|
|
|
470
485
|
}
|
|
471
486
|
|
|
472
487
|
if (items) {
|
|
473
|
-
content = items.filter(function (
|
|
474
|
-
var key =
|
|
488
|
+
content = items.filter(function (_ref3) {
|
|
489
|
+
var key = _ref3.key;
|
|
475
490
|
return key && selected_key && key == selected_key;
|
|
476
|
-
}).reduce(function (acc,
|
|
477
|
-
var content =
|
|
491
|
+
}).reduce(function (acc, _ref4) {
|
|
492
|
+
var content = _ref4.content;
|
|
478
493
|
return content || acc;
|
|
479
494
|
}, null);
|
|
480
495
|
}
|
|
@@ -488,9 +503,9 @@ var Tabs = function (_React$PureComponent) {
|
|
|
488
503
|
return content;
|
|
489
504
|
});
|
|
490
505
|
|
|
491
|
-
_defineProperty(_assertThisInitialized(_this), "TabsWrapperHandler", function (
|
|
492
|
-
var children =
|
|
493
|
-
rest = _objectWithoutProperties(
|
|
506
|
+
_defineProperty(_assertThisInitialized(_this), "TabsWrapperHandler", function (_ref5) {
|
|
507
|
+
var children = _ref5.children,
|
|
508
|
+
rest = _objectWithoutProperties(_ref5, _excluded);
|
|
494
509
|
|
|
495
510
|
var _this$props2 = _this.props,
|
|
496
511
|
className = _this$props2.className,
|
|
@@ -507,30 +522,29 @@ var Tabs = function (_React$PureComponent) {
|
|
|
507
522
|
return _react.default.createElement("div", _extends({}, params, rest), children);
|
|
508
523
|
});
|
|
509
524
|
|
|
510
|
-
_defineProperty(_assertThisInitialized(_this), "TabsListHandler", function (
|
|
511
|
-
var children =
|
|
512
|
-
className =
|
|
513
|
-
rest = _objectWithoutProperties(
|
|
525
|
+
_defineProperty(_assertThisInitialized(_this), "TabsListHandler", function (_ref6) {
|
|
526
|
+
var children = _ref6.children,
|
|
527
|
+
className = _ref6.className,
|
|
528
|
+
rest = _objectWithoutProperties(_ref6, _excluded2);
|
|
514
529
|
|
|
515
530
|
var _this$props3 = _this.props,
|
|
516
531
|
align = _this$props3.align,
|
|
517
532
|
tabs_style = _this$props3.tabs_style,
|
|
518
533
|
tabs_spacing = _this$props3.tabs_spacing,
|
|
519
|
-
no_border = _this$props3.no_border
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
atEdge = _this$state.atEdge;
|
|
534
|
+
no_border = _this$props3.no_border,
|
|
535
|
+
nav_button_edge = _this$props3.nav_button_edge;
|
|
536
|
+
var hasScrollbar = _this.state.hasScrollbar;
|
|
523
537
|
return _react.default.createElement("div", _extends({
|
|
524
|
-
className: (0, _classnames.default)('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((0, _componentHelper.isTrue)(tabs_spacing) ? 'default' : tabs_spacing), hasScrollbar && 'dnb-tabs--has-scrollbar',
|
|
538
|
+
className: (0, _classnames.default)('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((0, _componentHelper.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'),
|
|
525
539
|
ref: _this._tabsRef
|
|
526
540
|
}, rest), _react.default.createElement(ScrollNavButton, {
|
|
527
541
|
onMouseDown: _this.openPrevTab,
|
|
528
542
|
icon: "chevron_left",
|
|
529
|
-
className: (0, _classnames.default)(hasScrollbar && 'dnb-tabs__scroll-nav-button--visible', _this.state.isFirst && 'dnb-tabs__scroll-nav-button--hide')
|
|
543
|
+
className: (0, _classnames.default)(hasScrollbar && (typeof _this.state.isFirst !== 'undefined' || _this.hasLastPosition()) && 'dnb-tabs__scroll-nav-button--visible', _this.state.isFirst && 'dnb-tabs__scroll-nav-button--hide')
|
|
530
544
|
}), children, _react.default.createElement(ScrollNavButton, {
|
|
531
545
|
onMouseDown: _this.openNextTab,
|
|
532
546
|
icon: "chevron_right",
|
|
533
|
-
className: (0, _classnames.default)(hasScrollbar && 'dnb-tabs__scroll-nav-button--visible', _this.state.isLast && 'dnb-tabs__scroll-nav-button--hide')
|
|
547
|
+
className: (0, _classnames.default)(hasScrollbar && (typeof _this.state.isLast !== 'undefined' || _this.hasLastPosition()) && 'dnb-tabs__scroll-nav-button--visible', _this.state.isLast && 'dnb-tabs__scroll-nav-button--hide')
|
|
534
548
|
}));
|
|
535
549
|
});
|
|
536
550
|
|
|
@@ -560,13 +574,13 @@ var Tabs = function (_React$PureComponent) {
|
|
|
560
574
|
var selected_key = _this.state.selected_key;
|
|
561
575
|
var TabElement = tab_element || 'button';
|
|
562
576
|
|
|
563
|
-
var tabs = _this.state.data.map(function (
|
|
564
|
-
var title =
|
|
565
|
-
key =
|
|
566
|
-
|
|
567
|
-
disabled =
|
|
568
|
-
to =
|
|
569
|
-
href =
|
|
577
|
+
var tabs = _this.state.data.map(function (_ref7) {
|
|
578
|
+
var title = _ref7.title,
|
|
579
|
+
key = _ref7.key,
|
|
580
|
+
_ref7$disabled = _ref7.disabled,
|
|
581
|
+
disabled = _ref7$disabled === void 0 ? false : _ref7$disabled,
|
|
582
|
+
to = _ref7.to,
|
|
583
|
+
href = _ref7.href;
|
|
570
584
|
var itemParams = {
|
|
571
585
|
to: to,
|
|
572
586
|
href: href
|
|
@@ -602,6 +616,7 @@ var Tabs = function (_React$PureComponent) {
|
|
|
602
616
|
onMouseEnter: _this.onMouseEnterHandler,
|
|
603
617
|
onClick: _this.onClickHandler,
|
|
604
618
|
onKeyUp: _this.onKeyDownHandler,
|
|
619
|
+
onMouseDown: _this.onMouseDown,
|
|
605
620
|
"data-tab-key": key
|
|
606
621
|
}, itemParams), _react.default.createElement("span", {
|
|
607
622
|
className: (0, _classnames.default)('dnb-tabs__button__title', (0, _SkeletonHelper.createSkeletonClass)('font', skeleton, _this.context))
|
|
@@ -646,10 +661,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
646
661
|
|
|
647
662
|
_this.state = {
|
|
648
663
|
data: data,
|
|
649
|
-
lastPosition: lastPosition,
|
|
650
664
|
selected_key: _selected_key,
|
|
651
665
|
focus_key: _selected_key,
|
|
652
666
|
atEdge: false,
|
|
667
|
+
lastPosition: lastPosition,
|
|
653
668
|
hasScrollbar: lastPosition > -1,
|
|
654
669
|
_selected_key: _selected_key,
|
|
655
670
|
_data: _props.data || _props.children,
|
|
@@ -692,8 +707,6 @@ var Tabs = function (_React$PureComponent) {
|
|
|
692
707
|
this._eventEmitter = null;
|
|
693
708
|
}
|
|
694
709
|
|
|
695
|
-
clearTimeout(this._scrollToTabTimeout);
|
|
696
|
-
|
|
697
710
|
if (typeof window !== 'undefined') {
|
|
698
711
|
window.removeEventListener('resize', this.onResizeHandler);
|
|
699
712
|
window.removeEventListener('load', this.init);
|
|
@@ -702,24 +715,31 @@ var Tabs = function (_React$PureComponent) {
|
|
|
702
715
|
}, {
|
|
703
716
|
key: "componentDidUpdate",
|
|
704
717
|
value: function componentDidUpdate(props) {
|
|
705
|
-
this.
|
|
718
|
+
if (this._eventEmitter && (this.props.selected_key !== props.selected_key || this.props.data !== props.data)) {
|
|
719
|
+
this.onResizeHandler();
|
|
706
720
|
|
|
707
|
-
|
|
708
|
-
|
|
721
|
+
if (this._eventEmitter) {
|
|
722
|
+
var selected_key = this.state.selected_key;
|
|
709
723
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
724
|
+
this._eventEmitter.update(this.getEventArgs({
|
|
725
|
+
selected_key: selected_key
|
|
726
|
+
}));
|
|
727
|
+
}
|
|
713
728
|
}
|
|
714
729
|
}
|
|
730
|
+
}, {
|
|
731
|
+
key: "hasLastPosition",
|
|
732
|
+
value: function hasLastPosition() {
|
|
733
|
+
return this.state.lastPosition > -1;
|
|
734
|
+
}
|
|
715
735
|
}, {
|
|
716
736
|
key: "getLastPosition",
|
|
717
737
|
value: function getLastPosition() {
|
|
718
738
|
if (typeof window !== 'undefined') {
|
|
719
739
|
try {
|
|
720
|
-
var pos = parseFloat(window.localStorage.getItem(
|
|
721
|
-
window.localStorage.removeItem(
|
|
722
|
-
return pos;
|
|
740
|
+
var pos = parseFloat(window.localStorage.getItem("tabs-pos-".concat(this._id)));
|
|
741
|
+
window.localStorage.removeItem("tabs-pos-".concat(this._id));
|
|
742
|
+
return isNaN(pos) ? -1 : pos;
|
|
723
743
|
} catch (e) {
|
|
724
744
|
(0, _componentHelper.warn)(e);
|
|
725
745
|
}
|
|
@@ -728,12 +748,12 @@ var Tabs = function (_React$PureComponent) {
|
|
|
728
748
|
return -1;
|
|
729
749
|
}
|
|
730
750
|
}, {
|
|
731
|
-
key: "
|
|
732
|
-
value: function
|
|
751
|
+
key: "hasLastUsedTab",
|
|
752
|
+
value: function hasLastUsedTab() {
|
|
733
753
|
if (typeof window !== 'undefined') {
|
|
734
754
|
try {
|
|
735
|
-
var key = window.localStorage.getItem(
|
|
736
|
-
window.localStorage.removeItem(
|
|
755
|
+
var key = window.localStorage.getItem("tabs-last-".concat(this._id)) || null;
|
|
756
|
+
window.localStorage.removeItem("tabs-last-".concat(this._id));
|
|
737
757
|
return key;
|
|
738
758
|
} catch (e) {
|
|
739
759
|
(0, _componentHelper.warn)(e);
|
|
@@ -747,7 +767,7 @@ var Tabs = function (_React$PureComponent) {
|
|
|
747
767
|
value: function saveLastUsedTab() {
|
|
748
768
|
if (typeof window !== 'undefined') {
|
|
749
769
|
try {
|
|
750
|
-
window.localStorage.setItem(
|
|
770
|
+
window.localStorage.setItem("tabs-last-".concat(this._id), this.state.selected_key);
|
|
751
771
|
} catch (e) {
|
|
752
772
|
(0, _componentHelper.warn)(e);
|
|
753
773
|
}
|
|
@@ -756,11 +776,11 @@ var Tabs = function (_React$PureComponent) {
|
|
|
756
776
|
}, {
|
|
757
777
|
key: "saveLastPosition",
|
|
758
778
|
value: function saveLastPosition() {
|
|
759
|
-
var
|
|
779
|
+
var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._tablistRef.current.scrollLeft;
|
|
760
780
|
|
|
761
781
|
if (typeof window !== 'undefined') {
|
|
762
782
|
try {
|
|
763
|
-
window.localStorage.setItem(
|
|
783
|
+
window.localStorage.setItem("tabs-pos-".concat(this._id), position);
|
|
764
784
|
} catch (e) {
|
|
765
785
|
(0, _componentHelper.warn)(e);
|
|
766
786
|
}
|
|
@@ -771,53 +791,42 @@ var Tabs = function (_React$PureComponent) {
|
|
|
771
791
|
value: function hasScrollbar() {
|
|
772
792
|
return this._tablistRef.current.scrollWidth - 1 > this._tablistRef.current.offsetWidth;
|
|
773
793
|
}
|
|
774
|
-
}, {
|
|
775
|
-
key: "isAtEdge",
|
|
776
|
-
value: function isAtEdge() {
|
|
777
|
-
if (!this._hasScrollbar || typeof window === 'undefined') {
|
|
778
|
-
return false;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
try {
|
|
782
|
-
var padding = parseFloat(window.getComputedStyle(this._tablistRef.current).paddingLeft);
|
|
783
|
-
var width = this._tablistRef.current.offsetWidth + 2 + 64 - padding;
|
|
784
|
-
var screenWidth = window.innerWidth;
|
|
785
|
-
return width >= screenWidth;
|
|
786
|
-
} catch (e) {}
|
|
787
|
-
|
|
788
|
-
return false;
|
|
789
|
-
}
|
|
790
794
|
}, {
|
|
791
795
|
key: "addScrollBehaviour",
|
|
792
796
|
value: function addScrollBehaviour() {
|
|
793
|
-
this.onResizeHandler();
|
|
794
|
-
|
|
795
797
|
if (typeof window !== 'undefined') {
|
|
796
798
|
window.addEventListener('resize', this.onResizeHandler);
|
|
797
799
|
}
|
|
798
800
|
}
|
|
799
801
|
}, {
|
|
800
|
-
key: "
|
|
801
|
-
value: function
|
|
802
|
+
key: "setLeftPosition",
|
|
803
|
+
value: function setLeftPosition(scrollLeft) {
|
|
802
804
|
try {
|
|
803
805
|
this._tablistRef.current.style.scrollBehavior = 'auto';
|
|
804
|
-
this._tablistRef.current.scrollLeft =
|
|
806
|
+
this._tablistRef.current.scrollLeft = scrollLeft;
|
|
805
807
|
this._tablistRef.current.style.scrollBehavior = 'smooth';
|
|
806
808
|
} catch (e) {}
|
|
807
809
|
}
|
|
808
810
|
}, {
|
|
809
811
|
key: "scrollToTab",
|
|
810
|
-
value: function scrollToTab(
|
|
812
|
+
value: function scrollToTab(_ref8) {
|
|
811
813
|
var _this2 = this;
|
|
812
814
|
|
|
815
|
+
var type = _ref8.type,
|
|
816
|
+
_ref8$behavior = _ref8.behavior,
|
|
817
|
+
behavior = _ref8$behavior === void 0 ? 'smooth' : _ref8$behavior;
|
|
818
|
+
|
|
813
819
|
if (typeof window === 'undefined') {
|
|
814
820
|
return;
|
|
815
821
|
}
|
|
816
822
|
|
|
817
|
-
|
|
818
|
-
|
|
823
|
+
if (window.IS_TEST) {
|
|
824
|
+
behavior = 'auto';
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
var delay = function delay() {
|
|
819
828
|
try {
|
|
820
|
-
if (
|
|
829
|
+
if (_this2.state.hasScrollbar && _this2._tablistRef.current) {
|
|
821
830
|
var first = _this2._tablistRef.current.querySelector('.dnb-tabs__button__snap:first-of-type');
|
|
822
831
|
|
|
823
832
|
var isFirst = first.classList.contains(type);
|
|
@@ -832,20 +841,30 @@ var Tabs = function (_React$PureComponent) {
|
|
|
832
841
|
var margin = parseFloat(style.marginLeft);
|
|
833
842
|
var padding = margin < 0 ? parseFloat(style.paddingLeft) : 0;
|
|
834
843
|
|
|
835
|
-
if (!isFirst &&
|
|
844
|
+
if (!isFirst && !isLast && parseFloat(style.paddingLeft) < 16) {
|
|
836
845
|
var navButton = _this2._tabsRef.current.querySelector('.dnb-tabs__scroll-nav-button:first-of-type');
|
|
837
846
|
|
|
838
|
-
|
|
847
|
+
var additionalSpace = parseFloat(window.getComputedStyle(navButton).width) * 1.5;
|
|
848
|
+
padding += additionalSpace;
|
|
839
849
|
}
|
|
840
850
|
|
|
841
851
|
var leftPadding = (margin < 0 ? Math.abs(margin) : 0) + padding + parseFloat(window.getComputedStyle(first).paddingLeft);
|
|
842
|
-
var
|
|
852
|
+
var offsetLeft = elem.offsetLeft;
|
|
853
|
+
var left = elem && !isFirst ? offsetLeft - leftPadding : 0;
|
|
854
|
+
|
|
855
|
+
if (behavior === 'auto') {
|
|
856
|
+
_this2._tablistRef.current.style.scrollBehavior = 'auto';
|
|
857
|
+
}
|
|
843
858
|
|
|
844
859
|
_this2._tablistRef.current.scrollTo({
|
|
845
860
|
left: left,
|
|
846
|
-
behavior:
|
|
861
|
+
behavior: behavior
|
|
847
862
|
});
|
|
848
863
|
|
|
864
|
+
if (behavior === 'auto') {
|
|
865
|
+
_this2._tablistRef.current.style.scrollBehavior = '';
|
|
866
|
+
}
|
|
867
|
+
|
|
849
868
|
_this2.setState({
|
|
850
869
|
isFirst: isFirst,
|
|
851
870
|
isLast: isLast
|
|
@@ -854,17 +873,23 @@ var Tabs = function (_React$PureComponent) {
|
|
|
854
873
|
} catch (e) {
|
|
855
874
|
(0, _componentHelper.warn)(e);
|
|
856
875
|
}
|
|
857
|
-
}
|
|
876
|
+
};
|
|
877
|
+
|
|
878
|
+
if (window.IS_TEST) {
|
|
879
|
+
delay();
|
|
880
|
+
} else {
|
|
881
|
+
window.requestAnimationFrame(delay);
|
|
882
|
+
}
|
|
858
883
|
}
|
|
859
884
|
}, {
|
|
860
885
|
key: "getStepKey",
|
|
861
886
|
value: function getStepKey(useKey, stateKey) {
|
|
862
|
-
var currentData = this.state.data.filter(function (
|
|
863
|
-
var disabled =
|
|
887
|
+
var currentData = this.state.data.filter(function (_ref9) {
|
|
888
|
+
var disabled = _ref9.disabled;
|
|
864
889
|
return !disabled;
|
|
865
890
|
});
|
|
866
|
-
var currentIndex = currentData.reduce(function (acc,
|
|
867
|
-
var key =
|
|
891
|
+
var currentIndex = currentData.reduce(function (acc, _ref10, i) {
|
|
892
|
+
var key = _ref10.key;
|
|
868
893
|
return key == stateKey ? i : acc;
|
|
869
894
|
}, -1);
|
|
870
895
|
var nextIndex = currentIndex + useKey;
|
|
@@ -877,8 +902,8 @@ var Tabs = function (_React$PureComponent) {
|
|
|
877
902
|
nextIndex = 0;
|
|
878
903
|
}
|
|
879
904
|
|
|
880
|
-
return currentData.reduce(function (acc,
|
|
881
|
-
var key =
|
|
905
|
+
return currentData.reduce(function (acc, _ref11, i) {
|
|
906
|
+
var key = _ref11.key;
|
|
882
907
|
return i === nextIndex ? key : acc;
|
|
883
908
|
}, null);
|
|
884
909
|
}
|
|
@@ -892,12 +917,17 @@ var Tabs = function (_React$PureComponent) {
|
|
|
892
917
|
value: function resetWhatInput() {
|
|
893
918
|
_whatInput.default.specificKeys([9]);
|
|
894
919
|
}
|
|
920
|
+
}, {
|
|
921
|
+
key: "warnAboutMissingContainer",
|
|
922
|
+
value: function warnAboutMissingContainer() {
|
|
923
|
+
(0, _componentHelper.warn)("Could not find the required <Tabs.Content id=\"".concat(this._id, "-content\" ... /> that provides role=\"tabpanel\""));
|
|
924
|
+
}
|
|
895
925
|
}, {
|
|
896
926
|
key: "getEventArgs",
|
|
897
927
|
value: function getEventArgs(args) {
|
|
898
|
-
var _this$
|
|
899
|
-
selected_key = _this$
|
|
900
|
-
focus_key = _this$
|
|
928
|
+
var _this$state = this.state,
|
|
929
|
+
selected_key = _this$state.selected_key,
|
|
930
|
+
focus_key = _this$state.focus_key;
|
|
901
931
|
var key = typeof args.selected_key !== 'undefined' ? args.selected_key : selected_key;
|
|
902
932
|
return _objectSpread({
|
|
903
933
|
key: key,
|
|
@@ -921,18 +951,18 @@ var Tabs = function (_React$PureComponent) {
|
|
|
921
951
|
value: function renderCachedContent() {
|
|
922
952
|
var _this3 = this;
|
|
923
953
|
|
|
924
|
-
var _this$
|
|
925
|
-
selected_key = _this$
|
|
926
|
-
data = _this$
|
|
954
|
+
var _this$state2 = this.state,
|
|
955
|
+
selected_key = _this$state2.selected_key,
|
|
956
|
+
data = _this$state2.data;
|
|
927
957
|
var _this$props4 = this.props,
|
|
928
958
|
prevent_rerender = _this$props4.prevent_rerender,
|
|
929
959
|
prerender = _this$props4.prerender;
|
|
930
960
|
|
|
931
961
|
if ((0, _componentHelper.isTrue)(prerender)) {
|
|
932
|
-
this._cache = Object.entries(data).reduce(function (acc,
|
|
933
|
-
var
|
|
934
|
-
idx =
|
|
935
|
-
cur =
|
|
962
|
+
this._cache = Object.entries(data).reduce(function (acc, _ref12) {
|
|
963
|
+
var _ref13 = _slicedToArray(_ref12, 2),
|
|
964
|
+
idx = _ref13[0],
|
|
965
|
+
cur = _ref13[1];
|
|
936
966
|
|
|
937
967
|
acc[cur.key] = _objectSpread(_objectSpread({}, cur), {}, {
|
|
938
968
|
content: _this3.getContent(cur.key)
|
|
@@ -945,10 +975,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
945
975
|
}));
|
|
946
976
|
}
|
|
947
977
|
|
|
948
|
-
var cachedContent = Object.entries(this._cache).map(function (
|
|
949
|
-
var
|
|
950
|
-
key =
|
|
951
|
-
content =
|
|
978
|
+
var cachedContent = Object.entries(this._cache).map(function (_ref14) {
|
|
979
|
+
var _ref15 = _slicedToArray(_ref14, 2),
|
|
980
|
+
key = _ref15[0],
|
|
981
|
+
content = _ref15[1].content;
|
|
952
982
|
|
|
953
983
|
var params = {};
|
|
954
984
|
|
|
@@ -1017,14 +1047,14 @@ var Tabs = function (_React$PureComponent) {
|
|
|
1017
1047
|
var useKey = selected_key;
|
|
1018
1048
|
|
|
1019
1049
|
if (!useKey) {
|
|
1020
|
-
useKey = data.reduce(function (acc,
|
|
1021
|
-
var selected =
|
|
1022
|
-
key =
|
|
1050
|
+
useKey = data.reduce(function (acc, _ref16) {
|
|
1051
|
+
var selected = _ref16.selected,
|
|
1052
|
+
key = _ref16.key;
|
|
1023
1053
|
return selected ? key : acc;
|
|
1024
1054
|
}, null) || data[0] && data[0].key;
|
|
1025
1055
|
} else {
|
|
1026
|
-
var keyExists = data.findIndex(function (
|
|
1027
|
-
var key =
|
|
1056
|
+
var keyExists = data.findIndex(function (_ref17) {
|
|
1057
|
+
var key = _ref17.key;
|
|
1028
1058
|
return key == selected_key;
|
|
1029
1059
|
});
|
|
1030
1060
|
|
|
@@ -1101,10 +1131,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
1101
1131
|
} else if (typeof data === 'string') {
|
|
1102
1132
|
res = data[0] === '[' ? JSON.parse(data) : [];
|
|
1103
1133
|
} else if (data && _typeof(data) === 'object') {
|
|
1104
|
-
res = Object.entries(data).reduce(function (acc,
|
|
1105
|
-
var
|
|
1106
|
-
key =
|
|
1107
|
-
obj =
|
|
1134
|
+
res = Object.entries(data).reduce(function (acc, _ref18) {
|
|
1135
|
+
var _ref19 = _slicedToArray(_ref18, 2),
|
|
1136
|
+
key = _ref19[0],
|
|
1137
|
+
obj = _ref19[1];
|
|
1108
1138
|
|
|
1109
1139
|
if (obj) {
|
|
1110
1140
|
acc.push(_objectSpread({
|
|
@@ -1142,6 +1172,7 @@ _defineProperty(Tabs, "defaultProps", {
|
|
|
1142
1172
|
tabs_style: null,
|
|
1143
1173
|
tabs_spacing: null,
|
|
1144
1174
|
no_border: false,
|
|
1175
|
+
nav_button_edge: false,
|
|
1145
1176
|
use_hash: false,
|
|
1146
1177
|
prerender: false,
|
|
1147
1178
|
prevent_rerender: false,
|
|
@@ -1183,6 +1214,7 @@ process.env.NODE_ENV !== "production" ? Tabs.propTypes = _objectSpread(_objectSp
|
|
|
1183
1214
|
tabs_style: _propTypes.default.string,
|
|
1184
1215
|
tabs_spacing: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
1185
1216
|
no_border: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
1217
|
+
nav_button_edge: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
1186
1218
|
use_hash: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
1187
1219
|
prerender: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
1188
1220
|
prevent_rerender: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
@@ -1200,8 +1232,8 @@ process.env.NODE_ENV !== "production" ? Tabs.propTypes = _objectSpread(_objectSp
|
|
|
1200
1232
|
on_focus: _propTypes.default.func
|
|
1201
1233
|
}) : void 0;
|
|
1202
1234
|
|
|
1203
|
-
var Dummy = function Dummy(
|
|
1204
|
-
var children =
|
|
1235
|
+
var Dummy = function Dummy(_ref20) {
|
|
1236
|
+
var children = _ref20.children;
|
|
1205
1237
|
return _react.default.createElement("span", {
|
|
1206
1238
|
"aria-hidden": true,
|
|
1207
1239
|
hidden: true,
|
|
@@ -1220,8 +1252,7 @@ var ScrollNavButton = function ScrollNavButton(props) {
|
|
|
1220
1252
|
variant: "primary",
|
|
1221
1253
|
tabIndex: "-1",
|
|
1222
1254
|
bounding: true,
|
|
1223
|
-
"aria-hidden": true
|
|
1224
|
-
icon_size: "medium"
|
|
1255
|
+
"aria-hidden": true
|
|
1225
1256
|
}, props, {
|
|
1226
1257
|
className: (0, _classnames.default)('dnb-tabs__scroll-nav-button', props.className)
|
|
1227
1258
|
}));
|