@dnb/eufemia 9.23.0-beta.4 → 9.24.0
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 +23 -18
- package/cjs/components/avatar/Avatar.d.ts +6 -5
- package/cjs/components/avatar/Avatar.js +4 -8
- package/cjs/components/breadcrumb/Breadcrumb.d.ts +0 -6
- package/cjs/components/breadcrumb/Breadcrumb.js +1 -7
- package/cjs/components/dialog/Dialog.d.ts +2 -1
- package/cjs/components/dialog/Dialog.js +79 -51
- package/cjs/components/dialog/DialogContent.d.ts +1 -1
- package/cjs/components/dialog/DialogContent.js +50 -12
- package/cjs/components/dialog/parts/DialogAction.d.ts +34 -0
- package/cjs/components/dialog/parts/DialogAction.js +136 -0
- package/cjs/components/dialog/style/_dialog.scss +152 -72
- package/cjs/components/dialog/style/dnb-dialog.css +366 -200
- package/cjs/components/dialog/style/dnb-dialog.min.css +1 -1
- package/cjs/components/dialog/types.d.ts +20 -2
- package/cjs/components/drawer/Drawer.js +2 -1
- package/cjs/components/drawer/style/dnb-drawer.css +191 -101
- package/cjs/components/drawer/style/dnb-drawer.min.css +1 -1
- package/cjs/components/form-status/FormStatus.d.ts +19 -2
- package/cjs/components/form-status/FormStatus.js +27 -3
- package/cjs/components/form-status/style/themes/dnb-form-status-theme-ui.css +16 -0
- package/cjs/components/form-status/style/themes/dnb-form-status-theme-ui.min.css +1 -1
- package/cjs/components/form-status/style/themes/dnb-form-status-theme-ui.scss +7 -0
- package/cjs/components/info-card/InfoCard.d.ts +0 -9
- package/cjs/components/info-card/InfoCard.js +2 -11
- 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/modal/Modal.d.ts +1 -0
- package/cjs/components/modal/Modal.js +1 -1
- package/cjs/components/modal/ModalContent.js +13 -5
- package/cjs/components/modal/parts/CloseButton.d.ts +1 -0
- package/cjs/components/modal/style/_modal.scss +7 -0
- package/cjs/components/modal/style/dnb-modal.css +191 -101
- package/cjs/components/modal/style/dnb-modal.min.css +1 -1
- package/cjs/components/modal/types.d.ts +9 -1
- package/cjs/components/number-format/NumberFormat.d.ts +7 -1
- package/cjs/components/number-format/NumberFormat.js +5 -1
- package/cjs/components/number-format/NumberUtils.d.ts +12 -3
- package/cjs/components/number-format/NumberUtils.js +106 -7
- package/cjs/components/tabs/Tabs.js +104 -69
- package/cjs/components/tabs/style/_tabs.scss +10 -35
- package/cjs/components/tabs/style/dnb-tabs.css +13 -25
- package/cjs/components/tabs/style/dnb-tabs.min.css +1 -1
- package/cjs/components/tag/Tag.d.ts +5 -6
- package/cjs/components/tag/Tag.js +3 -8
- package/cjs/components/tag/style/_tag.scss +10 -6
- package/cjs/components/tag/style/dnb-tag.css +13 -5
- package/cjs/components/tag/style/dnb-tag.min.css +1 -1
- package/cjs/fragments/drawer-list/DrawerList.js +1 -1
- package/cjs/fragments/drawer-list/DrawerListHelpers.js +3 -1
- package/cjs/shared/Context.d.ts +2 -0
- package/cjs/shared/Context.js +1 -0
- package/cjs/shared/Eufemia.js +1 -1
- package/cjs/shared/hooks/usePropsWithContext.js +1 -1
- package/cjs/shared/locales/en-GB.d.ts +4 -0
- package/cjs/shared/locales/en-GB.js +4 -0
- package/cjs/shared/locales/en-US.d.ts +4 -0
- package/cjs/shared/locales/index.d.ts +8 -0
- package/cjs/shared/locales/nb-NO.d.ts +4 -0
- package/cjs/shared/locales/nb-NO.js +4 -0
- package/cjs/shared/useTranslation.d.ts +1 -0
- package/cjs/style/dnb-ui-components.css +221 -132
- package/cjs/style/dnb-ui-components.min.css +3 -3
- package/cjs/style/themes/theme-open-banking/dnb-theme-open-banking.css +16 -0
- 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 +16 -0
- package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/components/avatar/Avatar.d.ts +6 -5
- package/components/avatar/Avatar.js +4 -8
- package/components/breadcrumb/Breadcrumb.d.ts +0 -6
- package/components/breadcrumb/Breadcrumb.js +1 -7
- package/components/dialog/Dialog.d.ts +2 -1
- package/components/dialog/Dialog.js +78 -52
- package/components/dialog/DialogContent.d.ts +1 -1
- package/components/dialog/DialogContent.js +46 -9
- package/components/dialog/parts/DialogAction.d.ts +34 -0
- package/components/dialog/parts/DialogAction.js +96 -0
- package/components/dialog/style/_dialog.scss +152 -72
- package/components/dialog/style/dnb-dialog.css +366 -200
- package/components/dialog/style/dnb-dialog.min.css +1 -1
- package/components/dialog/types.d.ts +20 -2
- package/components/drawer/Drawer.js +2 -1
- package/components/drawer/style/dnb-drawer.css +191 -101
- package/components/drawer/style/dnb-drawer.min.css +1 -1
- package/components/form-status/FormStatus.d.ts +19 -2
- package/components/form-status/FormStatus.js +23 -2
- package/components/form-status/style/themes/dnb-form-status-theme-ui.css +16 -0
- package/components/form-status/style/themes/dnb-form-status-theme-ui.min.css +1 -1
- package/components/form-status/style/themes/dnb-form-status-theme-ui.scss +7 -0
- package/components/info-card/InfoCard.d.ts +0 -9
- package/components/info-card/InfoCard.js +2 -11
- 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/modal/Modal.d.ts +1 -0
- package/components/modal/Modal.js +1 -1
- package/components/modal/ModalContent.js +13 -5
- package/components/modal/parts/CloseButton.d.ts +1 -0
- package/components/modal/style/_modal.scss +7 -0
- package/components/modal/style/dnb-modal.css +191 -101
- package/components/modal/style/dnb-modal.min.css +1 -1
- package/components/modal/types.d.ts +9 -1
- package/components/number-format/NumberFormat.d.ts +7 -1
- package/components/number-format/NumberFormat.js +5 -1
- package/components/number-format/NumberUtils.d.ts +12 -3
- package/components/number-format/NumberUtils.js +105 -7
- package/components/tabs/Tabs.js +104 -69
- package/components/tabs/style/_tabs.scss +10 -35
- package/components/tabs/style/dnb-tabs.css +13 -25
- package/components/tabs/style/dnb-tabs.min.css +1 -1
- package/components/tag/Tag.d.ts +5 -6
- package/components/tag/Tag.js +3 -8
- package/components/tag/style/_tag.scss +10 -6
- package/components/tag/style/dnb-tag.css +13 -5
- package/components/tag/style/dnb-tag.min.css +1 -1
- package/es/components/avatar/Avatar.d.ts +6 -5
- package/es/components/avatar/Avatar.js +5 -9
- package/es/components/breadcrumb/Breadcrumb.d.ts +0 -6
- package/es/components/breadcrumb/Breadcrumb.js +1 -7
- package/es/components/dialog/Dialog.d.ts +2 -1
- package/es/components/dialog/Dialog.js +50 -22
- package/es/components/dialog/DialogContent.d.ts +1 -1
- package/es/components/dialog/DialogContent.js +40 -8
- package/es/components/dialog/parts/DialogAction.d.ts +34 -0
- package/es/components/dialog/parts/DialogAction.js +82 -0
- package/es/components/dialog/style/_dialog.scss +152 -72
- package/es/components/dialog/style/dnb-dialog.css +366 -200
- package/es/components/dialog/style/dnb-dialog.min.css +1 -1
- package/es/components/dialog/types.d.ts +20 -2
- package/es/components/drawer/Drawer.js +2 -1
- package/es/components/drawer/style/dnb-drawer.css +191 -101
- package/es/components/drawer/style/dnb-drawer.min.css +1 -1
- package/es/components/form-status/FormStatus.d.ts +19 -2
- package/es/components/form-status/FormStatus.js +21 -2
- package/es/components/form-status/style/themes/dnb-form-status-theme-ui.css +16 -0
- package/es/components/form-status/style/themes/dnb-form-status-theme-ui.min.css +1 -1
- package/es/components/form-status/style/themes/dnb-form-status-theme-ui.scss +7 -0
- package/es/components/info-card/InfoCard.d.ts +0 -9
- package/es/components/info-card/InfoCard.js +2 -11
- 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/modal/Modal.d.ts +1 -0
- package/es/components/modal/Modal.js +1 -1
- package/es/components/modal/ModalContent.js +13 -6
- package/es/components/modal/parts/CloseButton.d.ts +1 -0
- package/es/components/modal/style/_modal.scss +7 -0
- package/es/components/modal/style/dnb-modal.css +191 -101
- package/es/components/modal/style/dnb-modal.min.css +1 -1
- package/es/components/modal/types.d.ts +9 -1
- package/es/components/number-format/NumberFormat.d.ts +7 -1
- package/es/components/number-format/NumberFormat.js +5 -1
- package/es/components/number-format/NumberUtils.d.ts +12 -3
- package/es/components/number-format/NumberUtils.js +101 -7
- package/es/components/tabs/Tabs.js +53 -23
- package/es/components/tabs/style/_tabs.scss +10 -35
- package/es/components/tabs/style/dnb-tabs.css +13 -25
- package/es/components/tabs/style/dnb-tabs.min.css +1 -1
- package/es/components/tag/Tag.d.ts +5 -6
- package/es/components/tag/Tag.js +3 -8
- package/es/components/tag/style/_tag.scss +10 -6
- package/es/components/tag/style/dnb-tag.css +13 -5
- package/es/components/tag/style/dnb-tag.min.css +1 -1
- package/es/fragments/drawer-list/DrawerList.js +1 -1
- package/es/fragments/drawer-list/DrawerListHelpers.js +3 -1
- package/es/shared/Context.d.ts +2 -0
- package/es/shared/Context.js +1 -0
- package/es/shared/Eufemia.js +1 -1
- package/es/shared/hooks/usePropsWithContext.js +1 -1
- package/es/shared/locales/en-GB.d.ts +4 -0
- package/es/shared/locales/en-GB.js +4 -0
- package/es/shared/locales/en-US.d.ts +4 -0
- package/es/shared/locales/index.d.ts +8 -0
- package/es/shared/locales/nb-NO.d.ts +4 -0
- package/es/shared/locales/nb-NO.js +4 -0
- package/es/shared/useTranslation.d.ts +1 -0
- package/es/style/dnb-ui-components.css +221 -132
- package/es/style/dnb-ui-components.min.css +3 -3
- package/es/style/themes/theme-open-banking/dnb-theme-open-banking.css +16 -0
- 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 +16 -0
- 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 +3 -3
- package/esm/dnb-ui-lib.min.mjs +3 -3
- package/esm/dnb-ui-web-components.min.mjs +2 -2
- package/fragments/drawer-list/DrawerList.js +1 -1
- package/fragments/drawer-list/DrawerListHelpers.js +3 -1
- package/package.json +1 -1
- package/shared/Context.d.ts +2 -0
- package/shared/Context.js +1 -0
- package/shared/Eufemia.js +1 -1
- package/shared/hooks/usePropsWithContext.js +1 -1
- package/shared/locales/en-GB.d.ts +4 -0
- package/shared/locales/en-GB.js +4 -0
- package/shared/locales/en-US.d.ts +4 -0
- package/shared/locales/index.d.ts +8 -0
- package/shared/locales/nb-NO.d.ts +4 -0
- package/shared/locales/nb-NO.js +4 -0
- package/shared/useTranslation.d.ts +1 -0
- package/style/dnb-ui-components.css +221 -132
- package/style/dnb-ui-components.min.css +3 -3
- package/style/themes/theme-open-banking/dnb-theme-open-banking.css +16 -0
- package/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/style/themes/theme-ui/dnb-theme-ui.css +16 -0
- 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 +2 -2
- package/umd/dnb-ui-lib.min.js +4 -4
- package/umd/dnb-ui-web-components.min.js +4 -4
|
@@ -15,7 +15,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
15
15
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
16
16
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
17
17
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
18
|
-
var _excluded = ["id", "value", "prefix", "suffix", "children", "currency", "currency_display", "currency_position", "ban", "nin", "phone", "org", "percent", "link", "tooltip", "skeleton", "options", "locale", "decimals", "omit_rounding", "clean", "selectall", "copy_selection", "clean_copy_value", "element", "class", "className"];
|
|
18
|
+
var _excluded = ["id", "value", "prefix", "suffix", "children", "currency", "currency_display", "currency_position", "compact", "ban", "nin", "phone", "org", "percent", "link", "tooltip", "skeleton", "options", "locale", "decimals", "omit_rounding", "clean", "selectall", "copy_selection", "clean_copy_value", "element", "class", "className"];
|
|
19
19
|
|
|
20
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
21
21
|
|
|
@@ -163,6 +163,7 @@ var NumberFormat = function (_React$PureComponent) {
|
|
|
163
163
|
currency = props.currency,
|
|
164
164
|
currency_display = props.currency_display,
|
|
165
165
|
currency_position = props.currency_position,
|
|
166
|
+
compact = props.compact,
|
|
166
167
|
ban = props.ban,
|
|
167
168
|
nin = props.nin,
|
|
168
169
|
phone = props.phone,
|
|
@@ -198,6 +199,7 @@ var NumberFormat = function (_React$PureComponent) {
|
|
|
198
199
|
currency_display: currency_display,
|
|
199
200
|
currency_position: currency_position,
|
|
200
201
|
omit_currency_sign: this.state.omitCurrencySign,
|
|
202
|
+
compact: compact,
|
|
201
203
|
ban: ban,
|
|
202
204
|
nin: nin,
|
|
203
205
|
phone: phone,
|
|
@@ -320,6 +322,7 @@ _defineProperty(NumberFormat, "defaultProps", {
|
|
|
320
322
|
currency: null,
|
|
321
323
|
currency_display: null,
|
|
322
324
|
currency_position: null,
|
|
325
|
+
compact: null,
|
|
323
326
|
ban: null,
|
|
324
327
|
nin: null,
|
|
325
328
|
phone: null,
|
|
@@ -352,6 +355,7 @@ process.env.NODE_ENV !== "production" ? NumberFormat.propTypes = _objectSpread(_
|
|
|
352
355
|
currency: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
353
356
|
currency_display: PropTypes.string,
|
|
354
357
|
currency_position: PropTypes.oneOf(['auto', 'before', 'after']),
|
|
358
|
+
compact: PropTypes.oneOfType([PropTypes.oneOf(['short', 'long']), PropTypes.bool]),
|
|
355
359
|
ban: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
356
360
|
nin: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
357
361
|
phone: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
@@ -34,6 +34,9 @@ export interface formatOptionParams {
|
|
|
34
34
|
/** Should the number be cleaned */
|
|
35
35
|
clean?: boolean;
|
|
36
36
|
|
|
37
|
+
/** shortens any number or currency including an abbreviation. You can combine `compact` with `currency`. It gives you zero decimal by default `decimals={0}`. Use either a boolean, or a string with "short" or "long" */
|
|
38
|
+
compact?: boolean | 'short' | 'long';
|
|
39
|
+
|
|
37
40
|
/** How many decimals */
|
|
38
41
|
decimals?: number;
|
|
39
42
|
|
|
@@ -53,13 +56,19 @@ export interface formatOptionParams {
|
|
|
53
56
|
/** Currency code (ISO 4217) or `true` to use the default, `NOK`. */
|
|
54
57
|
currency?: string | boolean;
|
|
55
58
|
|
|
56
|
-
/** Intl.NumberFormat currency option – you can use false or empty string to hide the sign/name */
|
|
57
|
-
currency_display?:
|
|
59
|
+
/** Intl.NumberFormat currency option – you can use false or empty string to hide the sign/name. Defaults to narrowSymbol when the locale is no else we default to code. */
|
|
60
|
+
currency_display?:
|
|
61
|
+
| boolean
|
|
62
|
+
| ''
|
|
63
|
+
| 'code'
|
|
64
|
+
| 'name'
|
|
65
|
+
| 'symbol'
|
|
66
|
+
| 'narrowSymbol';
|
|
58
67
|
/** currency option */
|
|
59
68
|
currency_position?: formatCurrencyPosition;
|
|
60
69
|
/** hides the currency sign */
|
|
61
70
|
omit_currency_sign?: boolean;
|
|
62
|
-
/** will remove all extra signs,like a currency sign or percent sign for the cleanedValue return when returnAria is true */
|
|
71
|
+
/** will remove all extra signs, like a currency sign or percent sign for the cleanedValue return when returnAria is true */
|
|
63
72
|
clean_copy_value?: boolean;
|
|
64
73
|
|
|
65
74
|
/** Intl.NumberFormat options (NumberFormatOptions) */
|
|
@@ -31,6 +31,7 @@ import "core-js/modules/es.array.filter.js";
|
|
|
31
31
|
import "core-js/modules/es.string.starts-with.js";
|
|
32
32
|
import "core-js/modules/es.string.ends-with.js";
|
|
33
33
|
import "core-js/modules/es.array.find.js";
|
|
34
|
+
import "core-js/modules/es.parse-int.js";
|
|
34
35
|
import React from 'react';
|
|
35
36
|
import Context from '../../shared/Context';
|
|
36
37
|
import { LOCALE, CURRENCY, CURRENCY_DISPLAY } from '../../shared/defaults';
|
|
@@ -43,6 +44,8 @@ export var format = function format(value) {
|
|
|
43
44
|
locale = _ref$locale === void 0 ? null : _ref$locale,
|
|
44
45
|
_ref$clean = _ref.clean,
|
|
45
46
|
clean = _ref$clean === void 0 ? false : _ref$clean,
|
|
47
|
+
_ref$compact = _ref.compact,
|
|
48
|
+
compact = _ref$compact === void 0 ? null : _ref$compact,
|
|
46
49
|
_ref$phone = _ref.phone,
|
|
47
50
|
phone = _ref$phone === void 0 ? null : _ref$phone,
|
|
48
51
|
_ref$org = _ref.org,
|
|
@@ -94,7 +97,7 @@ export var format = function format(value) {
|
|
|
94
97
|
|
|
95
98
|
if (parseFloat(decimals) >= 0) {
|
|
96
99
|
value = formatDecimals(value, decimals, omit_rounding, opts);
|
|
97
|
-
} else {
|
|
100
|
+
} else if (typeof opts.maximumFractionDigits === 'undefined') {
|
|
98
101
|
opts.maximumFractionDigits = 20;
|
|
99
102
|
}
|
|
100
103
|
|
|
@@ -152,6 +155,13 @@ export var format = function format(value) {
|
|
|
152
155
|
} else if (isTrue(currency) || typeof currency === 'string') {
|
|
153
156
|
type = 'currency';
|
|
154
157
|
opts.currency = opts.currency || (isTrue(currency) ? CURRENCY : currency);
|
|
158
|
+
handleCompactBeforeDisplay({
|
|
159
|
+
value: value,
|
|
160
|
+
locale: locale,
|
|
161
|
+
compact: compact,
|
|
162
|
+
decimals: decimals,
|
|
163
|
+
opts: opts
|
|
164
|
+
});
|
|
155
165
|
|
|
156
166
|
if (decimals === null) {
|
|
157
167
|
decimals = 2;
|
|
@@ -165,7 +175,7 @@ export var format = function format(value) {
|
|
|
165
175
|
}
|
|
166
176
|
|
|
167
177
|
opts.style = 'currency';
|
|
168
|
-
opts.currencyDisplay = getFallbackCurrencyDisplay(locale, opts.
|
|
178
|
+
opts.currencyDisplay = getFallbackCurrencyDisplay(locale, opts.currencyDisplay || currency_display);
|
|
169
179
|
|
|
170
180
|
if (typeof opts.minimumFractionDigits === 'undefined' && String(value).indexOf('.') === -1 && cleanedNumber % 1 === 0) {
|
|
171
181
|
opts.minimumFractionDigits = 0;
|
|
@@ -214,6 +224,11 @@ export var format = function format(value) {
|
|
|
214
224
|
}
|
|
215
225
|
}
|
|
216
226
|
|
|
227
|
+
handleCompactBeforeAria({
|
|
228
|
+
value: value,
|
|
229
|
+
compact: compact,
|
|
230
|
+
opts: opts
|
|
231
|
+
});
|
|
217
232
|
aria = formatNumber(cleanedNumber, locale, _objectSpread(_objectSpread({
|
|
218
233
|
minimumFractionDigits: 0,
|
|
219
234
|
maximumFractionDigits: 2
|
|
@@ -229,12 +244,21 @@ export var format = function format(value) {
|
|
|
229
244
|
aria = prepareMinus(aria, locale);
|
|
230
245
|
}
|
|
231
246
|
} else {
|
|
247
|
+
handleCompactBeforeDisplay({
|
|
248
|
+
value: value,
|
|
249
|
+
locale: locale,
|
|
250
|
+
compact: compact,
|
|
251
|
+
decimals: decimals,
|
|
252
|
+
opts: opts
|
|
253
|
+
});
|
|
232
254
|
display = formatNumber(value, locale, opts);
|
|
233
255
|
display = prepareMinus(display, locale);
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
256
|
+
handleCompactBeforeAria({
|
|
257
|
+
value: value,
|
|
258
|
+
compact: compact,
|
|
259
|
+
opts: opts
|
|
260
|
+
});
|
|
261
|
+
aria = formatNumber(value, locale, opts);
|
|
238
262
|
aria = enhanceSR(value, aria, locale);
|
|
239
263
|
}
|
|
240
264
|
|
|
@@ -261,7 +285,7 @@ export var format = function format(value) {
|
|
|
261
285
|
});
|
|
262
286
|
} else {
|
|
263
287
|
var thousandsSeparator = getThousandsSeparator(locale);
|
|
264
|
-
cleanedValue = display.replace(new RegExp("".concat(thousandsSeparator, "(?=\\d{3})"), 'g'), '');
|
|
288
|
+
cleanedValue = String(display).replace(new RegExp("".concat(thousandsSeparator, "(?=\\d{3})"), 'g'), '');
|
|
265
289
|
}
|
|
266
290
|
|
|
267
291
|
return {
|
|
@@ -878,4 +902,78 @@ function formatToParts(_ref9) {
|
|
|
878
902
|
return [{
|
|
879
903
|
value: number
|
|
880
904
|
}];
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
function handleCompactBeforeDisplay() {
|
|
908
|
+
var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
909
|
+
value = _ref10.value,
|
|
910
|
+
locale = _ref10.locale,
|
|
911
|
+
compact = _ref10.compact,
|
|
912
|
+
_ref10$decimals = _ref10.decimals,
|
|
913
|
+
decimals = _ref10$decimals === void 0 ? 0 : _ref10$decimals,
|
|
914
|
+
opts = _ref10.opts;
|
|
915
|
+
|
|
916
|
+
if (!canHandleCompact({
|
|
917
|
+
value: value,
|
|
918
|
+
compact: compact
|
|
919
|
+
})) {
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
value = parseInt(Math.abs(value));
|
|
924
|
+
opts.notation = 'compact';
|
|
925
|
+
|
|
926
|
+
if (isTrue(compact) && locale && /(no|nb|nn)$/i.test(locale)) {
|
|
927
|
+
opts.compactDisplay = Math.abs(value) < 1000000 ? 'long' : 'short';
|
|
928
|
+
} else {
|
|
929
|
+
opts.compactDisplay = !isTrue(compact) ? compact : 'short';
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
if (typeof opts.maximumSignificantDigits === 'undefined') {
|
|
933
|
+
if (isNaN(parseFloat(decimals))) {
|
|
934
|
+
decimals = 0;
|
|
935
|
+
} else {
|
|
936
|
+
decimals = parseFloat(decimals);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
var ref = String(value).length % 3;
|
|
940
|
+
|
|
941
|
+
if (ref === 2) {
|
|
942
|
+
decimals += 1;
|
|
943
|
+
} else if (ref === 0) {
|
|
944
|
+
decimals += 2;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
opts.maximumSignificantDigits = decimals + 1;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
function handleCompactBeforeAria(_ref11) {
|
|
952
|
+
var value = _ref11.value,
|
|
953
|
+
compact = _ref11.compact,
|
|
954
|
+
opts = _ref11.opts;
|
|
955
|
+
|
|
956
|
+
if (!canHandleCompact({
|
|
957
|
+
value: value,
|
|
958
|
+
compact: compact
|
|
959
|
+
})) {
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
opts.compactDisplay = 'long';
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
function canHandleCompact(_ref12) {
|
|
967
|
+
var value = _ref12.value,
|
|
968
|
+
compact = _ref12.compact;
|
|
969
|
+
|
|
970
|
+
if (IS_IE11) {
|
|
971
|
+
return false;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
if (compact && Math.abs(value) >= 1000) {
|
|
975
|
+
return true;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
return false;
|
|
881
979
|
}
|
package/components/tabs/Tabs.js
CHANGED
|
@@ -68,18 +68,25 @@ var Tabs = function (_React$PureComponent) {
|
|
|
68
68
|
if (_this._isMounted) {
|
|
69
69
|
_this.addScrollBehaviour();
|
|
70
70
|
|
|
71
|
-
_this.
|
|
71
|
+
var hasScrollbar = _this.hasScrollbar();
|
|
72
72
|
|
|
73
|
-
_this.
|
|
74
|
-
type: 'focus',
|
|
75
|
-
behavior: 'auto'
|
|
76
|
-
});
|
|
73
|
+
var hasLastPosition = _this.hasLastPosition();
|
|
77
74
|
|
|
78
|
-
_this.
|
|
79
|
-
|
|
80
|
-
behavior: 'auto'
|
|
75
|
+
_this.setScrollbarState({
|
|
76
|
+
hasScrollbar: hasScrollbar
|
|
81
77
|
});
|
|
82
78
|
|
|
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
|
+
|
|
83
90
|
if (_this.hasLastUsedTab() !== null) {
|
|
84
91
|
_this.setState(null, _this.setFocusOnTabButton);
|
|
85
92
|
}
|
|
@@ -87,19 +94,25 @@ var Tabs = function (_React$PureComponent) {
|
|
|
87
94
|
});
|
|
88
95
|
|
|
89
96
|
_defineProperty(_assertThisInitialized(_this), "setScrollbarState", function () {
|
|
90
|
-
var
|
|
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;
|
|
91
100
|
|
|
92
101
|
if (hasScrollbar !== _this.state.hasScrollbar) {
|
|
93
102
|
_this.setState({
|
|
94
103
|
hasScrollbar: hasScrollbar
|
|
95
104
|
});
|
|
96
105
|
}
|
|
97
|
-
|
|
98
|
-
return hasScrollbar;
|
|
99
106
|
});
|
|
100
107
|
|
|
101
108
|
_defineProperty(_assertThisInitialized(_this), "onResizeHandler", function () {
|
|
102
|
-
|
|
109
|
+
var hasScrollbar = _this.hasScrollbar();
|
|
110
|
+
|
|
111
|
+
_this.setScrollbarState({
|
|
112
|
+
hasScrollbar: hasScrollbar
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (hasScrollbar) {
|
|
103
116
|
_this.scrollToTab({
|
|
104
117
|
type: 'selected'
|
|
105
118
|
});
|
|
@@ -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
|
|
|
@@ -387,11 +400,11 @@ var Tabs = function (_React$PureComponent) {
|
|
|
387
400
|
}
|
|
388
401
|
|
|
389
402
|
if (items) {
|
|
390
|
-
content = items.filter(function (
|
|
391
|
-
var key =
|
|
403
|
+
content = items.filter(function (_ref3) {
|
|
404
|
+
var key = _ref3.key;
|
|
392
405
|
return key && selected_key && key == selected_key;
|
|
393
|
-
}).reduce(function (acc,
|
|
394
|
-
var content =
|
|
406
|
+
}).reduce(function (acc, _ref4) {
|
|
407
|
+
var content = _ref4.content;
|
|
395
408
|
return content || acc;
|
|
396
409
|
}, null);
|
|
397
410
|
}
|
|
@@ -405,9 +418,9 @@ var Tabs = function (_React$PureComponent) {
|
|
|
405
418
|
return content;
|
|
406
419
|
});
|
|
407
420
|
|
|
408
|
-
_defineProperty(_assertThisInitialized(_this), "TabsWrapperHandler", function (
|
|
409
|
-
var children =
|
|
410
|
-
rest = _objectWithoutProperties(
|
|
421
|
+
_defineProperty(_assertThisInitialized(_this), "TabsWrapperHandler", function (_ref5) {
|
|
422
|
+
var children = _ref5.children,
|
|
423
|
+
rest = _objectWithoutProperties(_ref5, _excluded);
|
|
411
424
|
|
|
412
425
|
var _this$props2 = _this.props,
|
|
413
426
|
className = _this$props2.className,
|
|
@@ -424,10 +437,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
424
437
|
return React.createElement("div", _extends({}, params, rest), children);
|
|
425
438
|
});
|
|
426
439
|
|
|
427
|
-
_defineProperty(_assertThisInitialized(_this), "TabsListHandler", function (
|
|
428
|
-
var children =
|
|
429
|
-
className =
|
|
430
|
-
rest = _objectWithoutProperties(
|
|
440
|
+
_defineProperty(_assertThisInitialized(_this), "TabsListHandler", function (_ref6) {
|
|
441
|
+
var children = _ref6.children,
|
|
442
|
+
className = _ref6.className,
|
|
443
|
+
rest = _objectWithoutProperties(_ref6, _excluded2);
|
|
431
444
|
|
|
432
445
|
var _this$props3 = _this.props,
|
|
433
446
|
align = _this$props3.align,
|
|
@@ -442,11 +455,11 @@ var Tabs = function (_React$PureComponent) {
|
|
|
442
455
|
}, rest), React.createElement(ScrollNavButton, {
|
|
443
456
|
onMouseDown: _this.openPrevTab,
|
|
444
457
|
icon: "chevron_left",
|
|
445
|
-
className: classnames(hasScrollbar && typeof _this.state.isFirst !== 'undefined' && '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')
|
|
446
459
|
}), children, React.createElement(ScrollNavButton, {
|
|
447
460
|
onMouseDown: _this.openNextTab,
|
|
448
461
|
icon: "chevron_right",
|
|
449
|
-
className: classnames(hasScrollbar && typeof _this.state.isLast !== 'undefined' && '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')
|
|
450
463
|
}));
|
|
451
464
|
});
|
|
452
465
|
|
|
@@ -476,13 +489,13 @@ var Tabs = function (_React$PureComponent) {
|
|
|
476
489
|
var selected_key = _this.state.selected_key;
|
|
477
490
|
var TabElement = tab_element || 'button';
|
|
478
491
|
|
|
479
|
-
var tabs = _this.state.data.map(function (
|
|
480
|
-
var title =
|
|
481
|
-
key =
|
|
482
|
-
|
|
483
|
-
disabled =
|
|
484
|
-
to =
|
|
485
|
-
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;
|
|
486
499
|
var itemParams = {
|
|
487
500
|
to: to,
|
|
488
501
|
href: href
|
|
@@ -566,6 +579,7 @@ var Tabs = function (_React$PureComponent) {
|
|
|
566
579
|
selected_key: _selected_key,
|
|
567
580
|
focus_key: _selected_key,
|
|
568
581
|
atEdge: false,
|
|
582
|
+
lastPosition: lastPosition,
|
|
569
583
|
hasScrollbar: lastPosition > -1,
|
|
570
584
|
_selected_key: _selected_key,
|
|
571
585
|
_data: _props.data || _props.children,
|
|
@@ -628,14 +642,19 @@ var Tabs = function (_React$PureComponent) {
|
|
|
628
642
|
}
|
|
629
643
|
}
|
|
630
644
|
}
|
|
645
|
+
}, {
|
|
646
|
+
key: "hasLastPosition",
|
|
647
|
+
value: function hasLastPosition() {
|
|
648
|
+
return this.state.lastPosition > -1;
|
|
649
|
+
}
|
|
631
650
|
}, {
|
|
632
651
|
key: "getLastPosition",
|
|
633
652
|
value: function getLastPosition() {
|
|
634
653
|
if (typeof window !== 'undefined') {
|
|
635
654
|
try {
|
|
636
|
-
var pos = parseFloat(window.localStorage.getItem("tabs-pos-".concat(this._id)))
|
|
655
|
+
var pos = parseFloat(window.localStorage.getItem("tabs-pos-".concat(this._id)));
|
|
637
656
|
window.localStorage.removeItem("tabs-pos-".concat(this._id));
|
|
638
|
-
return pos;
|
|
657
|
+
return isNaN(pos) ? -1 : pos;
|
|
639
658
|
} catch (e) {
|
|
640
659
|
warn(e);
|
|
641
660
|
}
|
|
@@ -672,11 +691,11 @@ var Tabs = function (_React$PureComponent) {
|
|
|
672
691
|
}, {
|
|
673
692
|
key: "saveLastPosition",
|
|
674
693
|
value: function saveLastPosition() {
|
|
675
|
-
var
|
|
694
|
+
var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._tablistRef.current.scrollLeft;
|
|
676
695
|
|
|
677
696
|
if (typeof window !== 'undefined') {
|
|
678
697
|
try {
|
|
679
|
-
window.localStorage.setItem("tabs-pos-".concat(this._id),
|
|
698
|
+
window.localStorage.setItem("tabs-pos-".concat(this._id), position);
|
|
680
699
|
} catch (e) {
|
|
681
700
|
warn(e);
|
|
682
701
|
}
|
|
@@ -694,14 +713,23 @@ var Tabs = function (_React$PureComponent) {
|
|
|
694
713
|
window.addEventListener('resize', this.onResizeHandler);
|
|
695
714
|
}
|
|
696
715
|
}
|
|
716
|
+
}, {
|
|
717
|
+
key: "setLeftPosition",
|
|
718
|
+
value: function setLeftPosition(scrollLeft) {
|
|
719
|
+
try {
|
|
720
|
+
this._tablistRef.current.style.scrollBehavior = 'auto';
|
|
721
|
+
this._tablistRef.current.scrollLeft = scrollLeft;
|
|
722
|
+
this._tablistRef.current.style.scrollBehavior = 'smooth';
|
|
723
|
+
} catch (e) {}
|
|
724
|
+
}
|
|
697
725
|
}, {
|
|
698
726
|
key: "scrollToTab",
|
|
699
|
-
value: function scrollToTab(
|
|
727
|
+
value: function scrollToTab(_ref8) {
|
|
700
728
|
var _this2 = this;
|
|
701
729
|
|
|
702
|
-
var type =
|
|
703
|
-
|
|
704
|
-
behavior =
|
|
730
|
+
var type = _ref8.type,
|
|
731
|
+
_ref8$behavior = _ref8.behavior,
|
|
732
|
+
behavior = _ref8$behavior === void 0 ? 'smooth' : _ref8$behavior;
|
|
705
733
|
|
|
706
734
|
if (typeof window === 'undefined') {
|
|
707
735
|
return;
|
|
@@ -727,6 +755,14 @@ var Tabs = function (_React$PureComponent) {
|
|
|
727
755
|
var style = window.getComputedStyle(_this2._tabsRef.current);
|
|
728
756
|
var margin = parseFloat(style.marginLeft);
|
|
729
757
|
var padding = margin < 0 ? parseFloat(style.paddingLeft) : 0;
|
|
758
|
+
|
|
759
|
+
if (!isFirst && !isLast && parseFloat(style.paddingLeft) < 16) {
|
|
760
|
+
var navButton = _this2._tabsRef.current.querySelector('.dnb-tabs__scroll-nav-button:first-of-type');
|
|
761
|
+
|
|
762
|
+
var additionalSpace = parseFloat(window.getComputedStyle(navButton).width) * 1.5;
|
|
763
|
+
padding += additionalSpace;
|
|
764
|
+
}
|
|
765
|
+
|
|
730
766
|
var leftPadding = (margin < 0 ? Math.abs(margin) : 0) + padding + parseFloat(window.getComputedStyle(first).paddingLeft);
|
|
731
767
|
var offsetLeft = elem.offsetLeft;
|
|
732
768
|
var left = elem && !isFirst ? offsetLeft - leftPadding : 0;
|
|
@@ -763,12 +799,12 @@ var Tabs = function (_React$PureComponent) {
|
|
|
763
799
|
}, {
|
|
764
800
|
key: "getStepKey",
|
|
765
801
|
value: function getStepKey(useKey, stateKey) {
|
|
766
|
-
var currentData = this.state.data.filter(function (
|
|
767
|
-
var disabled =
|
|
802
|
+
var currentData = this.state.data.filter(function (_ref9) {
|
|
803
|
+
var disabled = _ref9.disabled;
|
|
768
804
|
return !disabled;
|
|
769
805
|
});
|
|
770
|
-
var currentIndex = currentData.reduce(function (acc,
|
|
771
|
-
var key =
|
|
806
|
+
var currentIndex = currentData.reduce(function (acc, _ref10, i) {
|
|
807
|
+
var key = _ref10.key;
|
|
772
808
|
return key == stateKey ? i : acc;
|
|
773
809
|
}, -1);
|
|
774
810
|
var nextIndex = currentIndex + useKey;
|
|
@@ -781,8 +817,8 @@ var Tabs = function (_React$PureComponent) {
|
|
|
781
817
|
nextIndex = 0;
|
|
782
818
|
}
|
|
783
819
|
|
|
784
|
-
return currentData.reduce(function (acc,
|
|
785
|
-
var key =
|
|
820
|
+
return currentData.reduce(function (acc, _ref11, i) {
|
|
821
|
+
var key = _ref11.key;
|
|
786
822
|
return i === nextIndex ? key : acc;
|
|
787
823
|
}, null);
|
|
788
824
|
}
|
|
@@ -838,10 +874,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
838
874
|
prerender = _this$props4.prerender;
|
|
839
875
|
|
|
840
876
|
if (isTrue(prerender)) {
|
|
841
|
-
this._cache = Object.entries(data).reduce(function (acc,
|
|
842
|
-
var
|
|
843
|
-
idx =
|
|
844
|
-
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];
|
|
845
881
|
|
|
846
882
|
acc[cur.key] = _objectSpread(_objectSpread({}, cur), {}, {
|
|
847
883
|
content: _this3.getContent(cur.key)
|
|
@@ -854,10 +890,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
854
890
|
}));
|
|
855
891
|
}
|
|
856
892
|
|
|
857
|
-
var cachedContent = Object.entries(this._cache).map(function (
|
|
858
|
-
var
|
|
859
|
-
key =
|
|
860
|
-
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;
|
|
861
897
|
|
|
862
898
|
var params = {};
|
|
863
899
|
|
|
@@ -926,14 +962,14 @@ var Tabs = function (_React$PureComponent) {
|
|
|
926
962
|
var useKey = selected_key;
|
|
927
963
|
|
|
928
964
|
if (!useKey) {
|
|
929
|
-
useKey = data.reduce(function (acc,
|
|
930
|
-
var selected =
|
|
931
|
-
key =
|
|
965
|
+
useKey = data.reduce(function (acc, _ref16) {
|
|
966
|
+
var selected = _ref16.selected,
|
|
967
|
+
key = _ref16.key;
|
|
932
968
|
return selected ? key : acc;
|
|
933
969
|
}, null) || data[0] && data[0].key;
|
|
934
970
|
} else {
|
|
935
|
-
var keyExists = data.findIndex(function (
|
|
936
|
-
var key =
|
|
971
|
+
var keyExists = data.findIndex(function (_ref17) {
|
|
972
|
+
var key = _ref17.key;
|
|
937
973
|
return key == selected_key;
|
|
938
974
|
});
|
|
939
975
|
|
|
@@ -1010,10 +1046,10 @@ var Tabs = function (_React$PureComponent) {
|
|
|
1010
1046
|
} else if (typeof data === 'string') {
|
|
1011
1047
|
res = data[0] === '[' ? JSON.parse(data) : [];
|
|
1012
1048
|
} else if (data && _typeof(data) === 'object') {
|
|
1013
|
-
res = Object.entries(data).reduce(function (acc,
|
|
1014
|
-
var
|
|
1015
|
-
key =
|
|
1016
|
-
obj =
|
|
1049
|
+
res = Object.entries(data).reduce(function (acc, _ref18) {
|
|
1050
|
+
var _ref19 = _slicedToArray(_ref18, 2),
|
|
1051
|
+
key = _ref19[0],
|
|
1052
|
+
obj = _ref19[1];
|
|
1017
1053
|
|
|
1018
1054
|
if (obj) {
|
|
1019
1055
|
acc.push(_objectSpread({
|
|
@@ -1109,8 +1145,8 @@ process.env.NODE_ENV !== "production" ? Tabs.propTypes = _objectSpread(_objectSp
|
|
|
1109
1145
|
on_click: PropTypes.func,
|
|
1110
1146
|
on_focus: PropTypes.func
|
|
1111
1147
|
}) : void 0;
|
|
1112
|
-
export var Dummy = function Dummy(
|
|
1113
|
-
var children =
|
|
1148
|
+
export var Dummy = function Dummy(_ref20) {
|
|
1149
|
+
var children = _ref20.children;
|
|
1114
1150
|
return React.createElement("span", {
|
|
1115
1151
|
"aria-hidden": true,
|
|
1116
1152
|
hidden: true,
|
|
@@ -1127,8 +1163,7 @@ var ScrollNavButton = function ScrollNavButton(props) {
|
|
|
1127
1163
|
variant: "primary",
|
|
1128
1164
|
tabIndex: "-1",
|
|
1129
1165
|
bounding: true,
|
|
1130
|
-
"aria-hidden": true
|
|
1131
|
-
icon_size: "medium"
|
|
1166
|
+
"aria-hidden": true
|
|
1132
1167
|
}, props, {
|
|
1133
1168
|
className: classnames('dnb-tabs__scroll-nav-button', props.className)
|
|
1134
1169
|
}));
|
|
@@ -58,11 +58,13 @@
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
&__scroll-nav-button {
|
|
61
|
-
position:
|
|
61
|
+
position: absolute;
|
|
62
62
|
z-index: 2;
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
right: -2px;
|
|
65
|
+
&:first-of-type {
|
|
66
|
+
left: -2px;
|
|
67
|
+
right: auto;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
display: none; // use "none" to remove it from markup by default
|
|
@@ -155,39 +157,19 @@
|
|
|
155
157
|
padding-right: 0.5rem;
|
|
156
158
|
}
|
|
157
159
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
&:first-of-type.selected.focus,
|
|
161
|
-
&:last-of-type.focus,
|
|
162
|
-
&:last-of-type.selected {
|
|
163
|
-
transition: padding 1s #{$defaultEasing} 10ms;
|
|
164
|
-
}
|
|
160
|
+
will-change: padding;
|
|
161
|
+
transition: padding 1s #{$defaultEasing};
|
|
165
162
|
}
|
|
166
163
|
|
|
167
|
-
|
|
168
|
-
&:first-of-type {
|
|
169
|
-
margin-left: -3rem;
|
|
170
|
-
padding-left: 3rem;
|
|
171
|
-
}
|
|
172
|
-
&:last-of-type {
|
|
173
|
-
margin-right: -3rem;
|
|
174
|
-
padding-right: 3rem;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
&:first-of-type.focus,
|
|
178
|
-
&:first-of-type.selected.focus {
|
|
179
|
-
padding-left: 0;
|
|
180
|
-
|
|
164
|
+
html[data-whatinput='keyboard'] &__button__snap {
|
|
165
|
+
&:first-of-type.focus {
|
|
181
166
|
// add space so the focus ring is visible within our overflow
|
|
182
167
|
.dnb-tabs__button:focus {
|
|
183
168
|
margin-left: 0.5rem;
|
|
184
169
|
}
|
|
185
170
|
}
|
|
186
171
|
|
|
187
|
-
&:last-of-type.focus
|
|
188
|
-
&:last-of-type.selected.focus {
|
|
189
|
-
padding-right: 0;
|
|
190
|
-
|
|
172
|
+
&:last-of-type.focus {
|
|
191
173
|
// add space so the focus ring is visible within our overflow
|
|
192
174
|
/* stylelint-disable */
|
|
193
175
|
.dnb-tabs__button:focus {
|
|
@@ -197,13 +179,6 @@
|
|
|
197
179
|
}
|
|
198
180
|
}
|
|
199
181
|
|
|
200
|
-
// Do this in order to have the selected tab to be nice aligned during scrollTo
|
|
201
|
-
&--has-scrollbar &__tabs__tablist {
|
|
202
|
-
margin: 0 -2rem; // The width of the nav-button
|
|
203
|
-
padding-left: 3rem;
|
|
204
|
-
padding-right: 3rem;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
182
|
/* stylelint-disable */
|
|
208
183
|
html[data-visual-test] & &__button,
|
|
209
184
|
html[data-visual-test] & &__button__snap,
|