@dnb/eufemia 9.23.0-beta.3 → 9.23.0-beta.4
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 +16 -0
- 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 +1870 -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/style/dnb-drawer.css +1870 -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/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/dnb-modal.css +268 -0
- 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 +147 -151
- package/cjs/components/tabs/style/_tabs.scss +83 -60
- package/cjs/components/tabs/style/dnb-tabs.css +189 -181
- package/cjs/components/tabs/style/dnb-tabs.min.css +1 -1
- package/cjs/components/tag/style/dnb-tag.css +192 -0
- 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/style/dnb-ui-components.css +189 -181
- package/cjs/style/dnb-ui-components.min.css +1 -1
- 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 +1870 -79
- package/components/dialog/style/dnb-dialog.min.css +1 -1
- package/components/dialog/style/dnb-dialog.scss +1 -1
- package/components/drawer/style/dnb-drawer.css +1870 -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/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/dnb-modal.css +268 -0
- 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 +146 -150
- package/components/tabs/style/_tabs.scss +83 -60
- package/components/tabs/style/dnb-tabs.css +189 -181
- package/components/tabs/style/dnb-tabs.min.css +1 -1
- package/components/tag/style/dnb-tag.css +192 -0
- 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 +1870 -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/style/dnb-drawer.css +1870 -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/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/dnb-modal.css +268 -0
- 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 +110 -114
- package/es/components/tabs/style/_tabs.scss +83 -60
- package/es/components/tabs/style/dnb-tabs.css +189 -181
- package/es/components/tabs/style/dnb-tabs.min.css +1 -1
- package/es/components/tag/style/dnb-tag.css +192 -0
- 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/style/dnb-ui-components.css +189 -181
- package/es/style/dnb-ui-components.min.css +1 -1
- 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 +2 -2
- package/esm/dnb-ui-web-components.min.mjs +2 -2
- package/package.json +1 -1
- package/shared/Eufemia.js +1 -1
- package/style/dnb-ui-components.css +189 -181
- package/style/dnb-ui-components.min.css +1 -1
- 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 +1 -1
- 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 +2 -2
- package/umd/dnb-ui-web-components.min.js +4 -4
|
@@ -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,18 +153,26 @@ var Tabs = function (_React$PureComponent) {
|
|
|
153
153
|
if (_this._isMounted) {
|
|
154
154
|
_this.addScrollBehaviour();
|
|
155
155
|
|
|
156
|
-
_this.
|
|
156
|
+
_this.setScrollbarState();
|
|
157
157
|
|
|
158
|
-
_this.scrollToTab(
|
|
158
|
+
_this.scrollToTab({
|
|
159
|
+
type: 'focus',
|
|
160
|
+
behavior: 'auto'
|
|
161
|
+
});
|
|
159
162
|
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
_this.scrollToTab({
|
|
164
|
+
type: 'selected',
|
|
165
|
+
behavior: 'auto'
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
if (_this.hasLastUsedTab() !== null) {
|
|
169
|
+
_this.setState(null, _this.setFocusOnTabButton);
|
|
162
170
|
}
|
|
163
171
|
}
|
|
164
172
|
});
|
|
165
173
|
|
|
166
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
167
|
-
var hasScrollbar = _this.
|
|
174
|
+
_defineProperty(_assertThisInitialized(_this), "setScrollbarState", function () {
|
|
175
|
+
var hasScrollbar = _this.hasScrollbar();
|
|
168
176
|
|
|
169
177
|
if (hasScrollbar !== _this.state.hasScrollbar) {
|
|
170
178
|
_this.setState({
|
|
@@ -172,42 +180,14 @@ var Tabs = function (_React$PureComponent) {
|
|
|
172
180
|
});
|
|
173
181
|
}
|
|
174
182
|
|
|
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
|
-
}
|
|
204
|
-
|
|
205
|
-
_this.setState({
|
|
206
|
-
atEdge: _this.isAtEdge()
|
|
207
|
-
});
|
|
183
|
+
return hasScrollbar;
|
|
184
|
+
});
|
|
208
185
|
|
|
209
|
-
|
|
210
|
-
|
|
186
|
+
_defineProperty(_assertThisInitialized(_this), "onResizeHandler", function () {
|
|
187
|
+
if (_this.setScrollbarState()) {
|
|
188
|
+
_this.scrollToTab({
|
|
189
|
+
type: 'selected'
|
|
190
|
+
});
|
|
211
191
|
}
|
|
212
192
|
});
|
|
213
193
|
|
|
@@ -252,7 +232,9 @@ var Tabs = function (_React$PureComponent) {
|
|
|
252
232
|
|
|
253
233
|
_this.focusTab(key, e, 'step');
|
|
254
234
|
|
|
255
|
-
_this.scrollToTab(
|
|
235
|
+
_this.scrollToTab({
|
|
236
|
+
type: 'focus'
|
|
237
|
+
});
|
|
256
238
|
});
|
|
257
239
|
|
|
258
240
|
_defineProperty(_assertThisInitialized(_this), "focusLastTab", function (e) {
|
|
@@ -260,31 +242,41 @@ var Tabs = function (_React$PureComponent) {
|
|
|
260
242
|
|
|
261
243
|
_this.focusTab(key, e, 'step');
|
|
262
244
|
|
|
263
|
-
_this.scrollToTab(
|
|
245
|
+
_this.scrollToTab({
|
|
246
|
+
type: 'focus'
|
|
247
|
+
});
|
|
264
248
|
});
|
|
265
249
|
|
|
266
250
|
_defineProperty(_assertThisInitialized(_this), "focusPrevTab", function (e) {
|
|
267
251
|
_this.focusTab(-1, e, 'step');
|
|
268
252
|
|
|
269
|
-
_this.scrollToTab(
|
|
253
|
+
_this.scrollToTab({
|
|
254
|
+
type: 'focus'
|
|
255
|
+
});
|
|
270
256
|
});
|
|
271
257
|
|
|
272
258
|
_defineProperty(_assertThisInitialized(_this), "focusNextTab", function (e) {
|
|
273
259
|
_this.focusTab(+1, e, 'step');
|
|
274
260
|
|
|
275
|
-
_this.scrollToTab(
|
|
261
|
+
_this.scrollToTab({
|
|
262
|
+
type: 'focus'
|
|
263
|
+
});
|
|
276
264
|
});
|
|
277
265
|
|
|
278
266
|
_defineProperty(_assertThisInitialized(_this), "openPrevTab", function (e) {
|
|
279
267
|
_this.openTab(-1, e, 'step');
|
|
280
268
|
|
|
281
|
-
_this.scrollToTab(
|
|
269
|
+
_this.scrollToTab({
|
|
270
|
+
type: 'selected'
|
|
271
|
+
});
|
|
282
272
|
});
|
|
283
273
|
|
|
284
274
|
_defineProperty(_assertThisInitialized(_this), "openNextTab", function (e) {
|
|
285
275
|
_this.openTab(+1, e, 'step');
|
|
286
276
|
|
|
287
|
-
_this.scrollToTab(
|
|
277
|
+
_this.scrollToTab({
|
|
278
|
+
type: 'selected'
|
|
279
|
+
});
|
|
288
280
|
});
|
|
289
281
|
|
|
290
282
|
_defineProperty(_assertThisInitialized(_this), "handleVerticalScroll", function () {
|
|
@@ -296,14 +288,20 @@ var Tabs = function (_React$PureComponent) {
|
|
|
296
288
|
}
|
|
297
289
|
});
|
|
298
290
|
|
|
291
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseDown", function (event) {
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
});
|
|
294
|
+
|
|
299
295
|
_defineProperty(_assertThisInitialized(_this), "onKeyDownHandler", function (event) {
|
|
300
296
|
switch ((0, _keycode.default)(event)) {
|
|
301
297
|
case 'enter':
|
|
302
298
|
try {
|
|
303
299
|
var elem = document.getElementById("".concat(_this._id, "-content"));
|
|
304
|
-
elem.focus(
|
|
300
|
+
elem.focus({
|
|
301
|
+
preventScroll: true
|
|
302
|
+
});
|
|
305
303
|
} catch (e) {
|
|
306
|
-
|
|
304
|
+
_this.warnAboutMissingContainer();
|
|
307
305
|
}
|
|
308
306
|
|
|
309
307
|
break;
|
|
@@ -333,7 +331,9 @@ var Tabs = function (_React$PureComponent) {
|
|
|
333
331
|
if (ret !== false) {
|
|
334
332
|
_this.openTab(selected_key, event);
|
|
335
333
|
|
|
336
|
-
_this.scrollToTab(
|
|
334
|
+
_this.scrollToTab({
|
|
335
|
+
type: 'selected'
|
|
336
|
+
});
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
});
|
|
@@ -376,7 +376,7 @@ var Tabs = function (_React$PureComponent) {
|
|
|
376
376
|
_this.setState({
|
|
377
377
|
focus_key: focus_key,
|
|
378
378
|
_listenForPropChanges: false
|
|
379
|
-
}, _this.
|
|
379
|
+
}, _this.setFocusOnTabButton);
|
|
380
380
|
|
|
381
381
|
(0, _componentHelper.dispatchCustomElementEvent)(_assertThisInitialized(_this), 'on_focus', _this.getEventArgs({
|
|
382
382
|
event: event,
|
|
@@ -386,14 +386,16 @@ var Tabs = function (_React$PureComponent) {
|
|
|
386
386
|
_this.setWhatInput();
|
|
387
387
|
});
|
|
388
388
|
|
|
389
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
389
|
+
_defineProperty(_assertThisInitialized(_this), "setFocusOnTabButton", function () {
|
|
390
390
|
try {
|
|
391
391
|
var elem = _this._tablistRef.current.querySelector('.dnb-tabs__button.focus');
|
|
392
392
|
|
|
393
|
-
elem.focus(
|
|
393
|
+
elem.focus({
|
|
394
|
+
preventScroll: true
|
|
395
|
+
});
|
|
394
396
|
|
|
395
397
|
if (!document.getElementById("".concat(_this._id, "-content")) && typeof process !== 'undefined' && process.env.NODE_ENV !== 'test') {
|
|
396
|
-
|
|
398
|
+
_this.warnAboutMissingContainer();
|
|
397
399
|
}
|
|
398
400
|
} catch (e) {
|
|
399
401
|
(0, _componentHelper.warn)(e);
|
|
@@ -516,21 +518,20 @@ var Tabs = function (_React$PureComponent) {
|
|
|
516
518
|
align = _this$props3.align,
|
|
517
519
|
tabs_style = _this$props3.tabs_style,
|
|
518
520
|
tabs_spacing = _this$props3.tabs_spacing,
|
|
519
|
-
no_border = _this$props3.no_border
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
atEdge = _this$state.atEdge;
|
|
521
|
+
no_border = _this$props3.no_border,
|
|
522
|
+
nav_button_edge = _this$props3.nav_button_edge;
|
|
523
|
+
var hasScrollbar = _this.state.hasScrollbar;
|
|
523
524
|
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',
|
|
525
|
+
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
526
|
ref: _this._tabsRef
|
|
526
527
|
}, rest), _react.default.createElement(ScrollNavButton, {
|
|
527
528
|
onMouseDown: _this.openPrevTab,
|
|
528
529
|
icon: "chevron_left",
|
|
529
|
-
className: (0, _classnames.default)(hasScrollbar && 'dnb-tabs__scroll-nav-button--visible', _this.state.isFirst && 'dnb-tabs__scroll-nav-button--hide')
|
|
530
|
+
className: (0, _classnames.default)(hasScrollbar && typeof _this.state.isFirst !== 'undefined' && 'dnb-tabs__scroll-nav-button--visible', _this.state.isFirst && 'dnb-tabs__scroll-nav-button--hide')
|
|
530
531
|
}), children, _react.default.createElement(ScrollNavButton, {
|
|
531
532
|
onMouseDown: _this.openNextTab,
|
|
532
533
|
icon: "chevron_right",
|
|
533
|
-
className: (0, _classnames.default)(hasScrollbar && 'dnb-tabs__scroll-nav-button--visible', _this.state.isLast && 'dnb-tabs__scroll-nav-button--hide')
|
|
534
|
+
className: (0, _classnames.default)(hasScrollbar && typeof _this.state.isLast !== 'undefined' && 'dnb-tabs__scroll-nav-button--visible', _this.state.isLast && 'dnb-tabs__scroll-nav-button--hide')
|
|
534
535
|
}));
|
|
535
536
|
});
|
|
536
537
|
|
|
@@ -602,6 +603,7 @@ var Tabs = function (_React$PureComponent) {
|
|
|
602
603
|
onMouseEnter: _this.onMouseEnterHandler,
|
|
603
604
|
onClick: _this.onClickHandler,
|
|
604
605
|
onKeyUp: _this.onKeyDownHandler,
|
|
606
|
+
onMouseDown: _this.onMouseDown,
|
|
605
607
|
"data-tab-key": key
|
|
606
608
|
}, itemParams), _react.default.createElement("span", {
|
|
607
609
|
className: (0, _classnames.default)('dnb-tabs__button__title', (0, _SkeletonHelper.createSkeletonClass)('font', skeleton, _this.context))
|
|
@@ -646,7 +648,6 @@ var Tabs = function (_React$PureComponent) {
|
|
|
646
648
|
|
|
647
649
|
_this.state = {
|
|
648
650
|
data: data,
|
|
649
|
-
lastPosition: lastPosition,
|
|
650
651
|
selected_key: _selected_key,
|
|
651
652
|
focus_key: _selected_key,
|
|
652
653
|
atEdge: false,
|
|
@@ -692,8 +693,6 @@ var Tabs = function (_React$PureComponent) {
|
|
|
692
693
|
this._eventEmitter = null;
|
|
693
694
|
}
|
|
694
695
|
|
|
695
|
-
clearTimeout(this._scrollToTabTimeout);
|
|
696
|
-
|
|
697
696
|
if (typeof window !== 'undefined') {
|
|
698
697
|
window.removeEventListener('resize', this.onResizeHandler);
|
|
699
698
|
window.removeEventListener('load', this.init);
|
|
@@ -702,14 +701,16 @@ var Tabs = function (_React$PureComponent) {
|
|
|
702
701
|
}, {
|
|
703
702
|
key: "componentDidUpdate",
|
|
704
703
|
value: function componentDidUpdate(props) {
|
|
705
|
-
this.
|
|
704
|
+
if (this._eventEmitter && (this.props.selected_key !== props.selected_key || this.props.data !== props.data)) {
|
|
705
|
+
this.onResizeHandler();
|
|
706
706
|
|
|
707
|
-
|
|
708
|
-
|
|
707
|
+
if (this._eventEmitter) {
|
|
708
|
+
var selected_key = this.state.selected_key;
|
|
709
709
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
710
|
+
this._eventEmitter.update(this.getEventArgs({
|
|
711
|
+
selected_key: selected_key
|
|
712
|
+
}));
|
|
713
|
+
}
|
|
713
714
|
}
|
|
714
715
|
}
|
|
715
716
|
}, {
|
|
@@ -717,8 +718,8 @@ var Tabs = function (_React$PureComponent) {
|
|
|
717
718
|
value: function getLastPosition() {
|
|
718
719
|
if (typeof window !== 'undefined') {
|
|
719
720
|
try {
|
|
720
|
-
var pos = parseFloat(window.localStorage.getItem(
|
|
721
|
-
window.localStorage.removeItem(
|
|
721
|
+
var pos = parseFloat(window.localStorage.getItem("tabs-pos-".concat(this._id))) || -1;
|
|
722
|
+
window.localStorage.removeItem("tabs-pos-".concat(this._id));
|
|
722
723
|
return pos;
|
|
723
724
|
} catch (e) {
|
|
724
725
|
(0, _componentHelper.warn)(e);
|
|
@@ -728,12 +729,12 @@ var Tabs = function (_React$PureComponent) {
|
|
|
728
729
|
return -1;
|
|
729
730
|
}
|
|
730
731
|
}, {
|
|
731
|
-
key: "
|
|
732
|
-
value: function
|
|
732
|
+
key: "hasLastUsedTab",
|
|
733
|
+
value: function hasLastUsedTab() {
|
|
733
734
|
if (typeof window !== 'undefined') {
|
|
734
735
|
try {
|
|
735
|
-
var key = window.localStorage.getItem(
|
|
736
|
-
window.localStorage.removeItem(
|
|
736
|
+
var key = window.localStorage.getItem("tabs-last-".concat(this._id)) || null;
|
|
737
|
+
window.localStorage.removeItem("tabs-last-".concat(this._id));
|
|
737
738
|
return key;
|
|
738
739
|
} catch (e) {
|
|
739
740
|
(0, _componentHelper.warn)(e);
|
|
@@ -747,7 +748,7 @@ var Tabs = function (_React$PureComponent) {
|
|
|
747
748
|
value: function saveLastUsedTab() {
|
|
748
749
|
if (typeof window !== 'undefined') {
|
|
749
750
|
try {
|
|
750
|
-
window.localStorage.setItem(
|
|
751
|
+
window.localStorage.setItem("tabs-last-".concat(this._id), this.state.selected_key);
|
|
751
752
|
} catch (e) {
|
|
752
753
|
(0, _componentHelper.warn)(e);
|
|
753
754
|
}
|
|
@@ -760,7 +761,7 @@ var Tabs = function (_React$PureComponent) {
|
|
|
760
761
|
|
|
761
762
|
if (typeof window !== 'undefined') {
|
|
762
763
|
try {
|
|
763
|
-
window.localStorage.setItem(
|
|
764
|
+
window.localStorage.setItem("tabs-pos-".concat(this._id), pos);
|
|
764
765
|
} catch (e) {
|
|
765
766
|
(0, _componentHelper.warn)(e);
|
|
766
767
|
}
|
|
@@ -771,53 +772,33 @@ var Tabs = function (_React$PureComponent) {
|
|
|
771
772
|
value: function hasScrollbar() {
|
|
772
773
|
return this._tablistRef.current.scrollWidth - 1 > this._tablistRef.current.offsetWidth;
|
|
773
774
|
}
|
|
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
775
|
}, {
|
|
791
776
|
key: "addScrollBehaviour",
|
|
792
777
|
value: function addScrollBehaviour() {
|
|
793
|
-
this.onResizeHandler();
|
|
794
|
-
|
|
795
778
|
if (typeof window !== 'undefined') {
|
|
796
779
|
window.addEventListener('resize', this.onResizeHandler);
|
|
797
780
|
}
|
|
798
781
|
}
|
|
799
|
-
}, {
|
|
800
|
-
key: "scrollToLastPosition",
|
|
801
|
-
value: function scrollToLastPosition() {
|
|
802
|
-
try {
|
|
803
|
-
this._tablistRef.current.style.scrollBehavior = 'auto';
|
|
804
|
-
this._tablistRef.current.scrollLeft = this.state.lastPosition;
|
|
805
|
-
this._tablistRef.current.style.scrollBehavior = 'smooth';
|
|
806
|
-
} catch (e) {}
|
|
807
|
-
}
|
|
808
782
|
}, {
|
|
809
783
|
key: "scrollToTab",
|
|
810
|
-
value: function scrollToTab(
|
|
784
|
+
value: function scrollToTab(_ref7) {
|
|
811
785
|
var _this2 = this;
|
|
812
786
|
|
|
787
|
+
var type = _ref7.type,
|
|
788
|
+
_ref7$behavior = _ref7.behavior,
|
|
789
|
+
behavior = _ref7$behavior === void 0 ? 'smooth' : _ref7$behavior;
|
|
790
|
+
|
|
813
791
|
if (typeof window === 'undefined') {
|
|
814
792
|
return;
|
|
815
793
|
}
|
|
816
794
|
|
|
817
|
-
|
|
818
|
-
|
|
795
|
+
if (window.IS_TEST) {
|
|
796
|
+
behavior = 'auto';
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
var delay = function delay() {
|
|
819
800
|
try {
|
|
820
|
-
if (
|
|
801
|
+
if (_this2.state.hasScrollbar && _this2._tablistRef.current) {
|
|
821
802
|
var first = _this2._tablistRef.current.querySelector('.dnb-tabs__button__snap:first-of-type');
|
|
822
803
|
|
|
823
804
|
var isFirst = first.classList.contains(type);
|
|
@@ -831,21 +812,23 @@ var Tabs = function (_React$PureComponent) {
|
|
|
831
812
|
var style = window.getComputedStyle(_this2._tabsRef.current);
|
|
832
813
|
var margin = parseFloat(style.marginLeft);
|
|
833
814
|
var padding = margin < 0 ? parseFloat(style.paddingLeft) : 0;
|
|
815
|
+
var leftPadding = (margin < 0 ? Math.abs(margin) : 0) + padding + parseFloat(window.getComputedStyle(first).paddingLeft);
|
|
816
|
+
var offsetLeft = elem.offsetLeft;
|
|
817
|
+
var left = elem && !isFirst ? offsetLeft - leftPadding : 0;
|
|
834
818
|
|
|
835
|
-
if (
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
padding = parseFloat(window.getComputedStyle(navButton).width);
|
|
819
|
+
if (behavior === 'auto') {
|
|
820
|
+
_this2._tablistRef.current.style.scrollBehavior = 'auto';
|
|
839
821
|
}
|
|
840
822
|
|
|
841
|
-
var leftPadding = (margin < 0 ? Math.abs(margin) : 0) + padding + parseFloat(window.getComputedStyle(first).paddingLeft);
|
|
842
|
-
var left = elem && !isFirst ? elem.offsetLeft - leftPadding : 0;
|
|
843
|
-
|
|
844
823
|
_this2._tablistRef.current.scrollTo({
|
|
845
824
|
left: left,
|
|
846
|
-
behavior:
|
|
825
|
+
behavior: behavior
|
|
847
826
|
});
|
|
848
827
|
|
|
828
|
+
if (behavior === 'auto') {
|
|
829
|
+
_this2._tablistRef.current.style.scrollBehavior = '';
|
|
830
|
+
}
|
|
831
|
+
|
|
849
832
|
_this2.setState({
|
|
850
833
|
isFirst: isFirst,
|
|
851
834
|
isLast: isLast
|
|
@@ -854,17 +837,23 @@ var Tabs = function (_React$PureComponent) {
|
|
|
854
837
|
} catch (e) {
|
|
855
838
|
(0, _componentHelper.warn)(e);
|
|
856
839
|
}
|
|
857
|
-
}
|
|
840
|
+
};
|
|
841
|
+
|
|
842
|
+
if (window.IS_TEST) {
|
|
843
|
+
delay();
|
|
844
|
+
} else {
|
|
845
|
+
window.requestAnimationFrame(delay);
|
|
846
|
+
}
|
|
858
847
|
}
|
|
859
848
|
}, {
|
|
860
849
|
key: "getStepKey",
|
|
861
850
|
value: function getStepKey(useKey, stateKey) {
|
|
862
|
-
var currentData = this.state.data.filter(function (
|
|
863
|
-
var disabled =
|
|
851
|
+
var currentData = this.state.data.filter(function (_ref8) {
|
|
852
|
+
var disabled = _ref8.disabled;
|
|
864
853
|
return !disabled;
|
|
865
854
|
});
|
|
866
|
-
var currentIndex = currentData.reduce(function (acc,
|
|
867
|
-
var key =
|
|
855
|
+
var currentIndex = currentData.reduce(function (acc, _ref9, i) {
|
|
856
|
+
var key = _ref9.key;
|
|
868
857
|
return key == stateKey ? i : acc;
|
|
869
858
|
}, -1);
|
|
870
859
|
var nextIndex = currentIndex + useKey;
|
|
@@ -877,8 +866,8 @@ var Tabs = function (_React$PureComponent) {
|
|
|
877
866
|
nextIndex = 0;
|
|
878
867
|
}
|
|
879
868
|
|
|
880
|
-
return currentData.reduce(function (acc,
|
|
881
|
-
var key =
|
|
869
|
+
return currentData.reduce(function (acc, _ref10, i) {
|
|
870
|
+
var key = _ref10.key;
|
|
882
871
|
return i === nextIndex ? key : acc;
|
|
883
872
|
}, null);
|
|
884
873
|
}
|
|
@@ -892,12 +881,17 @@ var Tabs = function (_React$PureComponent) {
|
|
|
892
881
|
value: function resetWhatInput() {
|
|
893
882
|
_whatInput.default.specificKeys([9]);
|
|
894
883
|
}
|
|
884
|
+
}, {
|
|
885
|
+
key: "warnAboutMissingContainer",
|
|
886
|
+
value: function warnAboutMissingContainer() {
|
|
887
|
+
(0, _componentHelper.warn)("Could not find the required <Tabs.Content id=\"".concat(this._id, "-content\" ... /> that provides role=\"tabpanel\""));
|
|
888
|
+
}
|
|
895
889
|
}, {
|
|
896
890
|
key: "getEventArgs",
|
|
897
891
|
value: function getEventArgs(args) {
|
|
898
|
-
var _this$
|
|
899
|
-
selected_key = _this$
|
|
900
|
-
focus_key = _this$
|
|
892
|
+
var _this$state = this.state,
|
|
893
|
+
selected_key = _this$state.selected_key,
|
|
894
|
+
focus_key = _this$state.focus_key;
|
|
901
895
|
var key = typeof args.selected_key !== 'undefined' ? args.selected_key : selected_key;
|
|
902
896
|
return _objectSpread({
|
|
903
897
|
key: key,
|
|
@@ -921,18 +915,18 @@ var Tabs = function (_React$PureComponent) {
|
|
|
921
915
|
value: function renderCachedContent() {
|
|
922
916
|
var _this3 = this;
|
|
923
917
|
|
|
924
|
-
var _this$
|
|
925
|
-
selected_key = _this$
|
|
926
|
-
data = _this$
|
|
918
|
+
var _this$state2 = this.state,
|
|
919
|
+
selected_key = _this$state2.selected_key,
|
|
920
|
+
data = _this$state2.data;
|
|
927
921
|
var _this$props4 = this.props,
|
|
928
922
|
prevent_rerender = _this$props4.prevent_rerender,
|
|
929
923
|
prerender = _this$props4.prerender;
|
|
930
924
|
|
|
931
925
|
if ((0, _componentHelper.isTrue)(prerender)) {
|
|
932
|
-
this._cache = Object.entries(data).reduce(function (acc,
|
|
933
|
-
var
|
|
934
|
-
idx =
|
|
935
|
-
cur =
|
|
926
|
+
this._cache = Object.entries(data).reduce(function (acc, _ref11) {
|
|
927
|
+
var _ref12 = _slicedToArray(_ref11, 2),
|
|
928
|
+
idx = _ref12[0],
|
|
929
|
+
cur = _ref12[1];
|
|
936
930
|
|
|
937
931
|
acc[cur.key] = _objectSpread(_objectSpread({}, cur), {}, {
|
|
938
932
|
content: _this3.getContent(cur.key)
|
|
@@ -945,10 +939,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
945
939
|
}));
|
|
946
940
|
}
|
|
947
941
|
|
|
948
|
-
var cachedContent = Object.entries(this._cache).map(function (
|
|
949
|
-
var
|
|
950
|
-
key =
|
|
951
|
-
content =
|
|
942
|
+
var cachedContent = Object.entries(this._cache).map(function (_ref13) {
|
|
943
|
+
var _ref14 = _slicedToArray(_ref13, 2),
|
|
944
|
+
key = _ref14[0],
|
|
945
|
+
content = _ref14[1].content;
|
|
952
946
|
|
|
953
947
|
var params = {};
|
|
954
948
|
|
|
@@ -1017,14 +1011,14 @@ var Tabs = function (_React$PureComponent) {
|
|
|
1017
1011
|
var useKey = selected_key;
|
|
1018
1012
|
|
|
1019
1013
|
if (!useKey) {
|
|
1020
|
-
useKey = data.reduce(function (acc,
|
|
1021
|
-
var selected =
|
|
1022
|
-
key =
|
|
1014
|
+
useKey = data.reduce(function (acc, _ref15) {
|
|
1015
|
+
var selected = _ref15.selected,
|
|
1016
|
+
key = _ref15.key;
|
|
1023
1017
|
return selected ? key : acc;
|
|
1024
1018
|
}, null) || data[0] && data[0].key;
|
|
1025
1019
|
} else {
|
|
1026
|
-
var keyExists = data.findIndex(function (
|
|
1027
|
-
var key =
|
|
1020
|
+
var keyExists = data.findIndex(function (_ref16) {
|
|
1021
|
+
var key = _ref16.key;
|
|
1028
1022
|
return key == selected_key;
|
|
1029
1023
|
});
|
|
1030
1024
|
|
|
@@ -1101,10 +1095,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
1101
1095
|
} else if (typeof data === 'string') {
|
|
1102
1096
|
res = data[0] === '[' ? JSON.parse(data) : [];
|
|
1103
1097
|
} else if (data && _typeof(data) === 'object') {
|
|
1104
|
-
res = Object.entries(data).reduce(function (acc,
|
|
1105
|
-
var
|
|
1106
|
-
key =
|
|
1107
|
-
obj =
|
|
1098
|
+
res = Object.entries(data).reduce(function (acc, _ref17) {
|
|
1099
|
+
var _ref18 = _slicedToArray(_ref17, 2),
|
|
1100
|
+
key = _ref18[0],
|
|
1101
|
+
obj = _ref18[1];
|
|
1108
1102
|
|
|
1109
1103
|
if (obj) {
|
|
1110
1104
|
acc.push(_objectSpread({
|
|
@@ -1142,6 +1136,7 @@ _defineProperty(Tabs, "defaultProps", {
|
|
|
1142
1136
|
tabs_style: null,
|
|
1143
1137
|
tabs_spacing: null,
|
|
1144
1138
|
no_border: false,
|
|
1139
|
+
nav_button_edge: false,
|
|
1145
1140
|
use_hash: false,
|
|
1146
1141
|
prerender: false,
|
|
1147
1142
|
prevent_rerender: false,
|
|
@@ -1183,6 +1178,7 @@ process.env.NODE_ENV !== "production" ? Tabs.propTypes = _objectSpread(_objectSp
|
|
|
1183
1178
|
tabs_style: _propTypes.default.string,
|
|
1184
1179
|
tabs_spacing: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
1185
1180
|
no_border: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
1181
|
+
nav_button_edge: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
1186
1182
|
use_hash: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
1187
1183
|
prerender: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
1188
1184
|
prevent_rerender: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
@@ -1200,8 +1196,8 @@ process.env.NODE_ENV !== "production" ? Tabs.propTypes = _objectSpread(_objectSp
|
|
|
1200
1196
|
on_focus: _propTypes.default.func
|
|
1201
1197
|
}) : void 0;
|
|
1202
1198
|
|
|
1203
|
-
var Dummy = function Dummy(
|
|
1204
|
-
var children =
|
|
1199
|
+
var Dummy = function Dummy(_ref19) {
|
|
1200
|
+
var children = _ref19.children;
|
|
1205
1201
|
return _react.default.createElement("span", {
|
|
1206
1202
|
"aria-hidden": true,
|
|
1207
1203
|
hidden: true,
|