@dnb/eufemia 9.47.0 → 9.47.2
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 +18 -0
- package/cjs/components/accordion/AccordionProvider.js +1 -3
- package/cjs/components/autocomplete/Autocomplete.js +4 -1
- package/cjs/components/button/Button.d.ts +6 -1
- package/cjs/components/button/Button.js +3 -3
- package/cjs/components/dropdown/Dropdown.d.ts +2 -2
- package/cjs/components/help-button/HelpButtonInstance.js +1 -3
- package/cjs/components/icon/Icon.js +1 -3
- package/cjs/components/icon-primary/IconPrimary.js +1 -3
- package/cjs/components/input-masked/InputMasked.js +13 -1
- package/cjs/components/input-masked/InputMaskedHooks.js +1 -1
- package/cjs/components/input-masked/InputMaskedUtils.js +3 -3
- package/cjs/components/logo/Logo.js +1 -3
- package/cjs/components/modal/Modal.js +1 -3
- package/cjs/components/pagination/Pagination.js +1 -3
- package/cjs/components/progress-indicator/ProgressIndicator.js +1 -3
- package/cjs/components/step-indicator/StepIndicatorContext.js +1 -3
- package/cjs/components/upload/Upload.js +0 -1
- package/cjs/components/upload/UploadFileInput.js +2 -10
- package/cjs/components/upload/UploadFileList.js +0 -1
- package/cjs/components/upload/UploadFileListCell.js +22 -23
- package/cjs/components/upload/UploadInfo.js +1 -9
- package/cjs/components/upload/UploadVerify.d.ts +3 -0
- package/cjs/components/upload/UploadVerify.js +27 -3
- package/cjs/elements/Element.js +1 -3
- package/cjs/fragments/drawer-list/DrawerList.js +1 -3
- package/cjs/shared/Eufemia.js +1 -1
- package/components/accordion/AccordionProvider.js +1 -2
- package/components/autocomplete/Autocomplete.js +4 -1
- package/components/button/Button.d.ts +6 -1
- package/components/button/Button.js +3 -2
- package/components/dropdown/Dropdown.d.ts +2 -2
- package/components/help-button/HelpButtonInstance.js +1 -2
- package/components/icon/Icon.js +1 -2
- package/components/icon-primary/IconPrimary.js +1 -2
- package/components/input-masked/InputMasked.js +13 -1
- package/components/input-masked/InputMaskedHooks.js +1 -1
- package/components/input-masked/InputMaskedUtils.js +3 -3
- package/components/logo/Logo.js +1 -2
- package/components/modal/Modal.js +1 -2
- package/components/pagination/Pagination.js +1 -2
- package/components/progress-indicator/ProgressIndicator.js +1 -2
- package/components/step-indicator/StepIndicatorContext.js +1 -2
- package/components/upload/Upload.js +0 -1
- package/components/upload/UploadFileInput.js +3 -10
- package/components/upload/UploadFileList.js +0 -1
- package/components/upload/UploadFileListCell.js +17 -19
- package/components/upload/UploadInfo.js +1 -9
- package/components/upload/UploadVerify.d.ts +3 -0
- package/components/upload/UploadVerify.js +18 -1
- package/elements/Element.js +1 -2
- package/es/components/accordion/AccordionProvider.js +1 -2
- package/es/components/autocomplete/Autocomplete.js +4 -1
- package/es/components/button/Button.d.ts +6 -1
- package/es/components/button/Button.js +3 -2
- package/es/components/dropdown/Dropdown.d.ts +2 -2
- package/es/components/help-button/HelpButtonInstance.js +1 -2
- package/es/components/icon/Icon.js +1 -2
- package/es/components/icon-primary/IconPrimary.js +1 -2
- package/es/components/input-masked/InputMasked.js +12 -1
- package/es/components/input-masked/InputMaskedHooks.js +1 -1
- package/es/components/input-masked/InputMaskedUtils.js +3 -3
- package/es/components/logo/Logo.js +1 -2
- package/es/components/modal/Modal.js +1 -2
- package/es/components/pagination/Pagination.js +1 -2
- package/es/components/progress-indicator/ProgressIndicator.js +1 -2
- package/es/components/step-indicator/StepIndicatorContext.js +1 -2
- package/es/components/upload/Upload.js +0 -1
- package/es/components/upload/UploadFileInput.js +3 -7
- package/es/components/upload/UploadFileList.js +0 -1
- package/es/components/upload/UploadFileListCell.js +14 -18
- package/es/components/upload/UploadInfo.js +1 -9
- package/es/components/upload/UploadVerify.d.ts +3 -0
- package/es/components/upload/UploadVerify.js +11 -1
- package/es/elements/Element.js +1 -2
- package/es/fragments/drawer-list/DrawerList.js +1 -2
- package/es/shared/Eufemia.js +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 +2 -2
- 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/fragments/drawer-list/DrawerList.js +1 -2
- package/package.json +1 -1
- package/shared/Eufemia.js +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 +2 -2
- 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 +2 -2
package/cjs/elements/Element.js
CHANGED
|
@@ -31,8 +31,6 @@ var _SpacingHelper = require("../components/space/SpacingHelper");
|
|
|
31
31
|
|
|
32
32
|
var _SkeletonHelper = require("../components/skeleton/SkeletonHelper");
|
|
33
33
|
|
|
34
|
-
var _FormRowHelpers = require("../components/form-row/FormRowHelpers");
|
|
35
|
-
|
|
36
34
|
var _excluded = ["className", "class", "internalClass", "css", "as", "is", "innerRef", "skeleton", "skeletonMethod"];
|
|
37
35
|
|
|
38
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -59,7 +57,7 @@ function ElementInstance(localProps) {
|
|
|
59
57
|
|
|
60
58
|
var props = (0, _componentHelper.extendPropsWithContext)(localProps, defaultProps, {
|
|
61
59
|
skeleton: context === null || context === void 0 ? void 0 : context.skeleton
|
|
62
|
-
}
|
|
60
|
+
});
|
|
63
61
|
|
|
64
62
|
if (typeof props.inner_ref !== 'undefined') {
|
|
65
63
|
props.innerRef = props.inner_ref;
|
|
@@ -70,8 +70,6 @@ var _componentHelper = require("../../shared/component-helper");
|
|
|
70
70
|
|
|
71
71
|
var _SpacingHelper = require("../../components/space/SpacingHelper");
|
|
72
72
|
|
|
73
|
-
var _FormRowHelpers = require("../../components/form-row/FormRowHelpers");
|
|
74
|
-
|
|
75
73
|
var _DrawerListContext = _interopRequireDefault(require("./DrawerListContext"));
|
|
76
74
|
|
|
77
75
|
var _DrawerListProvider = _interopRequireDefault(require("./DrawerListProvider"));
|
|
@@ -265,7 +263,7 @@ var DrawerListInstance = function (_React$PureComponent2) {
|
|
|
265
263
|
value: function render() {
|
|
266
264
|
var _this3 = this;
|
|
267
265
|
|
|
268
|
-
var props = (0, _componentHelper.extendPropsWithContextInClassComponent)(this.props, DrawerList.defaultProps, this.context.getTranslation(this.props).DrawerList
|
|
266
|
+
var props = (0, _componentHelper.extendPropsWithContextInClassComponent)(this.props, DrawerList.defaultProps, this.context.getTranslation(this.props).DrawerList);
|
|
269
267
|
|
|
270
268
|
var role = props.role,
|
|
271
269
|
align_drawer = props.align_drawer,
|
package/cjs/shared/Eufemia.js
CHANGED
|
@@ -31,7 +31,6 @@ import classnames from 'classnames';
|
|
|
31
31
|
import { isTrue, makeUniqueId, extendPropsWithContextInClassComponent, registerElement, validateDOMAttributes, dispatchCustomElementEvent } from '../../shared/component-helper';
|
|
32
32
|
import { createSpacingClasses } from '../space/SpacingHelper';
|
|
33
33
|
import { accordionPropTypes, accordionDefaultProps } from './AccordionPropTypes';
|
|
34
|
-
import { includeValidProps } from '../form-row/FormRowHelpers';
|
|
35
34
|
import Context from '../../shared/Context';
|
|
36
35
|
import AccordionGroupContext from './AccordionProviderContext';
|
|
37
36
|
|
|
@@ -65,7 +64,7 @@ var AccordionGroup = function (_React$PureComponent) {
|
|
|
65
64
|
_createClass(AccordionGroup, [{
|
|
66
65
|
key: "render",
|
|
67
66
|
value: function render() {
|
|
68
|
-
var props = extendPropsWithContextInClassComponent(this.props, AccordionGroup.defaultProps,
|
|
67
|
+
var props = extendPropsWithContextInClassComponent(this.props, AccordionGroup.defaultProps, this.context.Accordion, this.context.getTranslation(this.props).Accordion);
|
|
69
68
|
|
|
70
69
|
var expanded = props.expanded,
|
|
71
70
|
expanded_id = props.expanded_id,
|
|
@@ -1647,7 +1647,10 @@ var AutocompleteInstance = function (_React$PureComponent2) {
|
|
|
1647
1647
|
icon_size: icon_size || (size === 'large' ? 'medium' : 'default'),
|
|
1648
1648
|
variant: "secondary",
|
|
1649
1649
|
size: size === 'default' ? 'medium' : size,
|
|
1650
|
-
type: "button"
|
|
1650
|
+
type: "button",
|
|
1651
|
+
status: status,
|
|
1652
|
+
status_state: status_state,
|
|
1653
|
+
status_props: status_props
|
|
1651
1654
|
}, triggerParams));
|
|
1652
1655
|
}
|
|
1653
1656
|
|
|
@@ -150,10 +150,15 @@ export type ButtonProps = {
|
|
|
150
150
|
href?: string;
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
|
-
* When button behaves as a link. Used to
|
|
153
|
+
* When button behaves as a link. Used to specify where to open the linked document, specified by `href`. Possible values are `_self`, `_blank`, `_parent` and `_top`.
|
|
154
154
|
*/
|
|
155
155
|
target?: string;
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* When button behaves as a link. Used to specify the relationship between a linked resource and the current document. Examples(non-exhaustive list) of values are `nofollow`, `search`, and `tag`.
|
|
159
|
+
*/
|
|
160
|
+
rel?: string;
|
|
161
|
+
|
|
157
162
|
/**
|
|
158
163
|
* Use this prop only if you are using a router Link component as the `element` that uses the `to` property to declare the navigation url.
|
|
159
164
|
*/
|
|
@@ -38,7 +38,6 @@ import Context from '../../shared/Context';
|
|
|
38
38
|
import { warn, makeUniqueId, isTrue, extendPropsWithContextInClassComponent, registerElement, validateDOMAttributes, processChildren, getStatusState, dispatchCustomElementEvent } from '../../shared/component-helper';
|
|
39
39
|
import { spacingPropTypes, createSpacingClasses } from '../space/SpacingHelper';
|
|
40
40
|
import { skeletonDOMAttributes, createSkeletonClass } from '../skeleton/SkeletonHelper';
|
|
41
|
-
import { includeValidProps } from '../form-row/FormRowHelpers';
|
|
42
41
|
import IconPrimary from '../icon-primary/IconPrimary';
|
|
43
42
|
import { launch, launch_medium } from '../../icons';
|
|
44
43
|
import FormStatus from '../form-status/FormStatus';
|
|
@@ -98,7 +97,7 @@ var Button = function (_React$PureComponent) {
|
|
|
98
97
|
|
|
99
98
|
var props = extendPropsWithContextInClassComponent(this.props, Button.defaultProps, {
|
|
100
99
|
skeleton: (_this$context = this.context) === null || _this$context === void 0 ? void 0 : _this$context.skeleton
|
|
101
|
-
},
|
|
100
|
+
}, this.context.Button);
|
|
102
101
|
|
|
103
102
|
var class_name = props.class,
|
|
104
103
|
className = props.className,
|
|
@@ -260,6 +259,7 @@ process.env.NODE_ENV !== "production" ? Button.propTypes = _objectSpread(_object
|
|
|
260
259
|
class: PropTypes.string,
|
|
261
260
|
href: PropTypes.string,
|
|
262
261
|
target: PropTypes.string,
|
|
262
|
+
rel: PropTypes.string,
|
|
263
263
|
to: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]),
|
|
264
264
|
custom_content: PropTypes.node,
|
|
265
265
|
wrap: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
@@ -288,6 +288,7 @@ Button.defaultProps = {
|
|
|
288
288
|
icon_size: null,
|
|
289
289
|
href: null,
|
|
290
290
|
target: null,
|
|
291
|
+
rel: null,
|
|
291
292
|
to: null,
|
|
292
293
|
id: null,
|
|
293
294
|
class: null,
|
|
@@ -433,12 +433,12 @@ export interface DropdownProps extends React.HTMLProps<HTMLElement> {
|
|
|
433
433
|
on_hide?: (...args: any[]) => any;
|
|
434
434
|
|
|
435
435
|
/**
|
|
436
|
-
* Will be called on state changes made by the user. Returns an object with the new selected `data` item `{ data, event, attributes,
|
|
436
|
+
* Will be called on state changes made by the user. Returns an object with the new selected `data` item `{ data, event, attributes, value }`.
|
|
437
437
|
*/
|
|
438
438
|
on_change?: (...args: any[]) => any;
|
|
439
439
|
|
|
440
440
|
/**
|
|
441
|
-
* Will be called once the user selects an item by a click or keyboard navigation. Returns an object with the new selected `data` item `{ data, event, attributes,
|
|
441
|
+
* Will be called once the user selects an item by a click or keyboard navigation. Returns an object with the new selected `data` item `{ data, event, attributes, value, active_item }`. The "active_item" property is the currently selected item by keyboard navigation
|
|
442
442
|
*/
|
|
443
443
|
on_select?: (...args: any[]) => any;
|
|
444
444
|
on_state_update?: (...args: any[]) => any;
|
|
@@ -19,7 +19,6 @@ import React from 'react';
|
|
|
19
19
|
import classnames from 'classnames';
|
|
20
20
|
import { convertJsxToString, extendPropsWithContext } from '../../shared/component-helper';
|
|
21
21
|
import Context from '../../shared/Context';
|
|
22
|
-
import { includeValidProps } from '../form-row/FormRowHelpers';
|
|
23
22
|
import { createSpacingClasses } from '../space/SpacingHelper';
|
|
24
23
|
import Button from '../button/Button';
|
|
25
24
|
var defaultProps = {
|
|
@@ -28,7 +27,7 @@ var defaultProps = {
|
|
|
28
27
|
};
|
|
29
28
|
export default function HelpButtonInstance(localProps) {
|
|
30
29
|
var context = React.useContext(Context);
|
|
31
|
-
var props = extendPropsWithContext(localProps, defaultProps,
|
|
30
|
+
var props = extendPropsWithContext(localProps, defaultProps, context.HelpButton);
|
|
32
31
|
|
|
33
32
|
var size = props.size,
|
|
34
33
|
icon = props.icon,
|
package/components/icon/Icon.js
CHANGED
|
@@ -44,7 +44,6 @@ import { spacingPropTypes, createSpacingClasses } from '../space/SpacingHelper';
|
|
|
44
44
|
import { createSkeletonClass } from '../skeleton/SkeletonHelper';
|
|
45
45
|
import Context from '../../shared/Context';
|
|
46
46
|
import { iconCase } from './IconHelpers';
|
|
47
|
-
import { includeValidProps } from '../form-row/FormRowHelpers';
|
|
48
47
|
export var DefaultIconSize = 16;
|
|
49
48
|
export var DefaultIconSizes = {
|
|
50
49
|
default: 16,
|
|
@@ -88,7 +87,7 @@ var Icon = function (_React$PureComponent) {
|
|
|
88
87
|
|
|
89
88
|
var props = extendPropsWithContextInClassComponent(this.props, Icon.defaultProps, {
|
|
90
89
|
skeleton: (_this$context = this.context) === null || _this$context === void 0 ? void 0 : _this$context.skeleton
|
|
91
|
-
},
|
|
90
|
+
}, this.context.Icon);
|
|
92
91
|
|
|
93
92
|
var _prepareIcon = prepareIcon(props, this.context),
|
|
94
93
|
icon = _prepareIcon.icon,
|
|
@@ -24,7 +24,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
24
24
|
import React from 'react';
|
|
25
25
|
import Context from '../../shared/Context';
|
|
26
26
|
import { extendPropsWithContextInClassComponent } from '../../shared/component-helper';
|
|
27
|
-
import { includeValidProps } from '../form-row/FormRowHelpers';
|
|
28
27
|
import DefaultIcon, { iconPropTypes, DefaultIconSize, prerenderIcon, prepareIcon } from '../icon/Icon';
|
|
29
28
|
import * as primary_icons from '../../icons/primary_icons.js';
|
|
30
29
|
import * as primary_icons_medium from '../../icons/primary_icons_medium.js';
|
|
@@ -51,7 +50,7 @@ var IconPrimary = function (_React$PureComponent) {
|
|
|
51
50
|
|
|
52
51
|
var props = extendPropsWithContextInClassComponent(this.props, IconPrimary.defaultProps, {
|
|
53
52
|
skeleton: (_this$context = this.context) === null || _this$context === void 0 ? void 0 : _this$context.skeleton
|
|
54
|
-
},
|
|
53
|
+
}, this.context.Icon, this.context.IconPrimary);
|
|
55
54
|
|
|
56
55
|
var _prepareIcon = prepareIcon(props, this.context),
|
|
57
56
|
icon = _prepareIcon.icon,
|
|
@@ -13,6 +13,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
13
13
|
|
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
15
15
|
|
|
16
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
16
17
|
import React from 'react';
|
|
17
18
|
import PropTypes from 'prop-types';
|
|
18
19
|
import { registerElement, extendPropsWithContext } from '../../shared/component-helper';
|
|
@@ -22,6 +23,17 @@ import Input, { inputPropTypes } from '../input/Input';
|
|
|
22
23
|
import Context from '../../shared/Context';
|
|
23
24
|
var InputMasked = React.forwardRef(function (props, ref) {
|
|
24
25
|
var context = React.useContext(Context);
|
|
26
|
+
|
|
27
|
+
if (props !== null && props !== void 0 && props.mask) {
|
|
28
|
+
var alias = context === null || context === void 0 ? void 0 : context.InputMasked;
|
|
29
|
+
|
|
30
|
+
for (var key in alias) {
|
|
31
|
+
if (/^as[_A-Z]|number_mask|currency_mask/.test(key)) {
|
|
32
|
+
delete alias[key];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
25
37
|
var contextAndProps = React.useCallback(extendPropsWithContext(props, InputMasked.defaultProps, context === null || context === void 0 ? void 0 : context.InputMasked), [props, InputMasked.defaultProps, context === null || context === void 0 ? void 0 : context.InputMasked]);
|
|
26
38
|
return React.createElement(InputMaskedContext.Provider, {
|
|
27
39
|
value: {
|
|
@@ -62,7 +74,7 @@ process.env.NODE_ENV !== "production" ? InputMasked.propTypes = _objectSpread({
|
|
|
62
74
|
on_submit_blur: PropTypes.func
|
|
63
75
|
}, inputPropTypes) : void 0;
|
|
64
76
|
InputMasked.defaultProps = _objectSpread(_objectSpread({}, Input.defaultProps), {}, {
|
|
65
|
-
mask:
|
|
77
|
+
mask: null,
|
|
66
78
|
number_mask: null,
|
|
67
79
|
currency_mask: null,
|
|
68
80
|
mask_options: null,
|
|
@@ -198,7 +198,7 @@ export var useInputElement = function useInputElement() {
|
|
|
198
198
|
inputRef: ref,
|
|
199
199
|
inputElement: inputElementRef.current,
|
|
200
200
|
pipe: pipe,
|
|
201
|
-
mask: mask,
|
|
201
|
+
mask: mask || [],
|
|
202
202
|
showMask: showMask,
|
|
203
203
|
guide: showGuide,
|
|
204
204
|
keepCharPositions: keepCharPositions,
|
|
@@ -94,8 +94,8 @@ export var correctNumberValue = function correctNumberValue(_ref5) {
|
|
|
94
94
|
value = value.replace('.', decimalSymbol);
|
|
95
95
|
|
|
96
96
|
if (localValue !== null) {
|
|
97
|
-
var localNumberValue = localValue.replace(/[^\d
|
|
98
|
-
var numberValue = value.replace(/[^\d
|
|
97
|
+
var localNumberValue = localValue.replace(/[^\d,.-]/g, '');
|
|
98
|
+
var numberValue = value.replace(/[^\d,.-]/g, '');
|
|
99
99
|
var endsWithDecimal = localNumberValue.endsWith(decimalSymbol);
|
|
100
100
|
var endsWithZeroAndDecimal = localNumberValue.endsWith("".concat(decimalSymbol, "0"));
|
|
101
101
|
|
|
@@ -109,7 +109,7 @@ export var correctNumberValue = function correctNumberValue(_ref5) {
|
|
|
109
109
|
value = localValue;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
if (
|
|
112
|
+
if (/^(-|-0)$/.test(localValue.replace(/[^\d-0]/g, ''))) {
|
|
113
113
|
value = localValue;
|
|
114
114
|
} else if (localNumberValue === '' && numberValue === '0') {
|
|
115
115
|
value = '';
|
package/components/logo/Logo.js
CHANGED
|
@@ -33,7 +33,6 @@ import PropTypes from 'prop-types';
|
|
|
33
33
|
import classnames from 'classnames';
|
|
34
34
|
import Context from '../../shared/Context';
|
|
35
35
|
import { validateDOMAttributes, registerElement, extendPropsWithContextInClassComponent } from '../../shared/component-helper';
|
|
36
|
-
import { includeValidProps } from '../form-row/FormRowHelpers';
|
|
37
36
|
import { spacingPropTypes, createSpacingClasses } from '../space/SpacingHelper';
|
|
38
37
|
|
|
39
38
|
var Logo = function (_React$PureComponent) {
|
|
@@ -52,7 +51,7 @@ var Logo = function (_React$PureComponent) {
|
|
|
52
51
|
value: function render() {
|
|
53
52
|
var _objectSpread2;
|
|
54
53
|
|
|
55
|
-
var props = extendPropsWithContextInClassComponent(this.props, Logo.defaultProps, this.context.getTranslation(this.props).Logo,
|
|
54
|
+
var props = extendPropsWithContextInClassComponent(this.props, Logo.defaultProps, this.context.getTranslation(this.props).Logo, this.context.Logo);
|
|
56
55
|
|
|
57
56
|
var ratio = props.ratio,
|
|
58
57
|
size = props.size,
|
|
@@ -42,7 +42,6 @@ import ModalHeaderBar from './parts/ModalHeaderBar';
|
|
|
42
42
|
import CloseButton from './parts/CloseButton';
|
|
43
43
|
import ModalRoot from './ModalRoot';
|
|
44
44
|
import { classWithCamelCaseProps } from '../../shared/helpers/withCamelCaseProps';
|
|
45
|
-
import { includeValidProps } from '../form-row/FormRowHelpers';
|
|
46
45
|
export var ANIMATION_DURATION = 300;
|
|
47
46
|
|
|
48
47
|
var Modal = function (_React$PureComponent) {
|
|
@@ -311,7 +310,7 @@ var Modal = function (_React$PureComponent) {
|
|
|
311
310
|
value: function render() {
|
|
312
311
|
var _this2 = this;
|
|
313
312
|
|
|
314
|
-
var props = extendPropsWithContextInClassComponent(this.props, Modal.defaultProps, this.context.getTranslation(this.props).Modal,
|
|
313
|
+
var props = extendPropsWithContextInClassComponent(this.props, Modal.defaultProps, this.context.getTranslation(this.props).Modal, this.context.Modal);
|
|
315
314
|
|
|
316
315
|
var _props$root_id = props.root_id,
|
|
317
316
|
root_id = _props$root_id === void 0 ? 'root' : _props$root_id,
|
|
@@ -36,7 +36,6 @@ import classnames from 'classnames';
|
|
|
36
36
|
import PaginationContext from './PaginationContext';
|
|
37
37
|
import PaginationProvider from './PaginationProvider';
|
|
38
38
|
import { registerElement, validateDOMAttributes, extendPropsWithContextInClassComponent } from '../../shared/component-helper';
|
|
39
|
-
import { includeValidProps } from '../form-row/FormRowHelpers';
|
|
40
39
|
import { spacingPropTypes, createSpacingClasses } from '../space/SpacingHelper';
|
|
41
40
|
import { PaginationIndicator } from './PaginationHelpers';
|
|
42
41
|
import InfinityScroller from './PaginationInfinity';
|
|
@@ -169,7 +168,7 @@ var PaginationInstance = function (_React$PureComponent2) {
|
|
|
169
168
|
_createClass(PaginationInstance, [{
|
|
170
169
|
key: "render",
|
|
171
170
|
value: function render() {
|
|
172
|
-
var props = extendPropsWithContextInClassComponent(this.props, paginationDefaultProps, this.context.getTranslation(this.props).Pagination,
|
|
171
|
+
var props = extendPropsWithContextInClassComponent(this.props, paginationDefaultProps, this.context.getTranslation(this.props).Pagination, this.context.Pagination);
|
|
173
172
|
|
|
174
173
|
var align = props.align,
|
|
175
174
|
children = props.children,
|
|
@@ -33,7 +33,6 @@ import PropTypes from 'prop-types';
|
|
|
33
33
|
import classnames from 'classnames';
|
|
34
34
|
import Context from '../../shared/Context';
|
|
35
35
|
import { isTrue, registerElement, validateDOMAttributes, dispatchCustomElementEvent, extendPropsWithContextInClassComponent } from '../../shared/component-helper';
|
|
36
|
-
import { includeValidProps } from '../form-row/FormRowHelpers';
|
|
37
36
|
import { spacingPropTypes, createSpacingClasses } from '../space/SpacingHelper';
|
|
38
37
|
import ProgressIndicatorCircular from './ProgressIndicatorCircular';
|
|
39
38
|
import ProgressIndicatorLinear from './ProgressIndicatorLinear';
|
|
@@ -85,7 +84,7 @@ var ProgressIndicator = function (_React$PureComponent) {
|
|
|
85
84
|
}, {
|
|
86
85
|
key: "render",
|
|
87
86
|
value: function render() {
|
|
88
|
-
var props = extendPropsWithContextInClassComponent(this.props, ProgressIndicator.defaultProps, this.context.getTranslation(this.props).ProgressIndicator,
|
|
87
|
+
var props = extendPropsWithContextInClassComponent(this.props, ProgressIndicator.defaultProps, this.context.getTranslation(this.props).ProgressIndicator, this.context.ProgressIndicator);
|
|
89
88
|
|
|
90
89
|
var type = props.type,
|
|
91
90
|
size = props.size,
|
|
@@ -38,7 +38,6 @@ import Context from '../../shared/Context';
|
|
|
38
38
|
import { stepIndicatorDefaultProps } from './StepIndicatorProps';
|
|
39
39
|
import { processChildren, extendPropsWithContextInClassComponent } from '../../shared/component-helper';
|
|
40
40
|
import { onMediaQueryChange } from '../../shared/MediaQueryUtils';
|
|
41
|
-
import { includeValidProps } from '../form-row/FormRowHelpers';
|
|
42
41
|
var filterAttributes = Object.keys(stepIndicatorDefaultProps).filter(function (item) {
|
|
43
42
|
return !['class', 'className'].includes(item);
|
|
44
43
|
}).concat(['internalId', 'isSidebar', 'hasSidebar', 'hideSidebar', 'sidebarIsVisible', 'mainTitle', 'stepsLabel', 'stepsLabelExtended', 'listOfReachedSteps', 'setActiveStep', 'activeStep', 'countSteps', 'openState', 'onChangeState', 'openHandler', 'closeHandler', 'innerRef', 'hasSkeletonData', 'filterAttributes', 'listAttributes', 'onChangeState', 'isV1', 'activeUrl']);
|
|
@@ -141,7 +140,7 @@ export var StepIndicatorProvider = function (_React$PureComponent) {
|
|
|
141
140
|
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.context;
|
|
142
141
|
var data = extendPropsWithContextInClassComponent(this.props, stepIndicatorDefaultProps, {
|
|
143
142
|
skeleton: context === null || context === void 0 ? void 0 : context.skeleton
|
|
144
|
-
}, context.getTranslation(context).StepIndicator,
|
|
143
|
+
}, context.getTranslation(context).StepIndicator, context.StepIndicator);
|
|
145
144
|
return data;
|
|
146
145
|
}
|
|
147
146
|
}, {
|
|
@@ -85,7 +85,6 @@ var Upload = function Upload(localProps) {
|
|
|
85
85
|
}, React.createElement(Provider, {
|
|
86
86
|
skeleton: skeleton
|
|
87
87
|
}, React.createElement(UploadDropzone, _extends({
|
|
88
|
-
"data-testid": "upload",
|
|
89
88
|
className: classnames('dnb-upload', spacingClasses, className)
|
|
90
89
|
}, props), _UploadInfo || (_UploadInfo = React.createElement(UploadInfo, null)), _UploadFileInput || (_UploadFileInput = React.createElement(UploadFileInput, null)), _UploadFileList || (_UploadFileList = React.createElement(UploadFileList, null)))));
|
|
91
90
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
var _UploadStatus;
|
|
2
2
|
|
|
3
|
-
import "core-js/modules/es.array.join.js";
|
|
4
3
|
import "core-js/modules/es.array.map.js";
|
|
5
4
|
import "core-js/modules/es.array.from.js";
|
|
6
5
|
import "core-js/modules/es.string.iterator.js";
|
|
@@ -10,7 +9,7 @@ import { folder as FolderIcon } from '../../icons';
|
|
|
10
9
|
import { makeUniqueId } from '../../shared/component-helper';
|
|
11
10
|
import { UploadContext } from './UploadContext';
|
|
12
11
|
import UploadStatus from './UploadStatus';
|
|
13
|
-
import {
|
|
12
|
+
import { getAcceptedFileTypes } from './UploadVerify';
|
|
14
13
|
|
|
15
14
|
var UploadFileInput = function UploadFileInput() {
|
|
16
15
|
var fileInput = useRef(null);
|
|
@@ -28,15 +27,10 @@ var UploadFileInput = function UploadFileInput() {
|
|
|
28
27
|
};
|
|
29
28
|
|
|
30
29
|
var sharedId = id || makeUniqueId();
|
|
31
|
-
var accept =
|
|
32
|
-
|
|
33
|
-
}).join(',');
|
|
34
|
-
return React.createElement("div", {
|
|
35
|
-
"data-testid": "upload-file-input"
|
|
36
|
-
}, React.createElement(Button, {
|
|
30
|
+
var accept = getAcceptedFileTypes(acceptedFileTypes);
|
|
31
|
+
return React.createElement("div", null, React.createElement(Button, {
|
|
37
32
|
top: "medium",
|
|
38
33
|
id: "".concat(sharedId, "-input"),
|
|
39
|
-
"data-testid": "upload-file-input-button",
|
|
40
34
|
className: "dnb-upload__file-input-button",
|
|
41
35
|
icon: FolderIcon,
|
|
42
36
|
icon_position: "left",
|
|
@@ -45,7 +39,6 @@ var UploadFileInput = function UploadFileInput() {
|
|
|
45
39
|
onClick: openFileDialog
|
|
46
40
|
}, buttonText), _UploadStatus || (_UploadStatus = React.createElement(UploadStatus, null)), React.createElement("input", {
|
|
47
41
|
"aria-labelledby": "".concat(sharedId, "-input"),
|
|
48
|
-
"data-testid": "upload-file-input-input",
|
|
49
42
|
ref: fileInput,
|
|
50
43
|
accept: accept,
|
|
51
44
|
className: "dnb-upload__file-input",
|
|
@@ -2,15 +2,15 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
|
|
3
3
|
var _ProgressIndicator, _Icon;
|
|
4
4
|
|
|
5
|
-
import "core-js/modules/es.function.name.js";
|
|
6
|
-
import "core-js/modules/es.regexp.exec.js";
|
|
7
|
-
import "core-js/modules/es.string.split.js";
|
|
8
5
|
import "core-js/modules/es.array.iterator.js";
|
|
9
6
|
import "core-js/modules/es.object.to-string.js";
|
|
10
7
|
import "core-js/modules/es.string.iterator.js";
|
|
11
8
|
import "core-js/modules/web.dom-collections.iterator.js";
|
|
12
9
|
import "core-js/modules/web.url.js";
|
|
13
10
|
import "core-js/modules/web.url-search-params.js";
|
|
11
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
12
|
+
import "core-js/modules/es.string.split.js";
|
|
13
|
+
import "core-js/modules/es.function.name.js";
|
|
14
14
|
import React, { useRef } from 'react';
|
|
15
15
|
import classnames from 'classnames';
|
|
16
16
|
import Button from '../button/Button';
|
|
@@ -21,6 +21,7 @@ import P from '../../elements/P';
|
|
|
21
21
|
import { trash as TrashIcon, exclamation_medium as ExclamationIcon, file_pdf_medium as pdf, file_xls_medium as xls, file_ppt_medium as ppt, file_csv_medium as csv, file_txt_medium as txt, file_xml_medium as xml, file_medium as file } from '../../icons';
|
|
22
22
|
import { getPreviousSibling, warn } from '../../shared/component-helper';
|
|
23
23
|
import useUpload from './useUpload';
|
|
24
|
+
import { getFileTypeFromExtension } from './UploadVerify';
|
|
24
25
|
var images = {
|
|
25
26
|
pdf: pdf,
|
|
26
27
|
xls: xls,
|
|
@@ -32,7 +33,7 @@ var images = {
|
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
var UploadFileListCell = function UploadFileListCell(_ref) {
|
|
35
|
-
var _div,
|
|
36
|
+
var _div, _P, _FormStatus;
|
|
36
37
|
|
|
37
38
|
var id = _ref.id,
|
|
38
39
|
uploadFile = _ref.uploadFile,
|
|
@@ -42,10 +43,9 @@ var UploadFileListCell = function UploadFileListCell(_ref) {
|
|
|
42
43
|
var file = uploadFile.file,
|
|
43
44
|
errorMessage = uploadFile.errorMessage,
|
|
44
45
|
isLoading = uploadFile.isLoading;
|
|
45
|
-
var name = file.name,
|
|
46
|
-
type = file.type;
|
|
47
|
-
var fileType = type.split('/')[1] || '';
|
|
48
46
|
var hasWarning = errorMessage != null;
|
|
47
|
+
var fileType = getFileTypeFromExtension(file);
|
|
48
|
+
var humanFileType = fileType.toUpperCase();
|
|
49
49
|
var imageUrl = URL.createObjectURL(file);
|
|
50
50
|
var cellRef = useRef();
|
|
51
51
|
var exists = useExistsHighlight(id, file);
|
|
@@ -66,7 +66,6 @@ var UploadFileListCell = function UploadFileListCell(_ref) {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
return React.createElement("li", {
|
|
69
|
-
"data-testid": "upload-file-list-cell",
|
|
70
69
|
className: classnames('dnb-upload__file-cell', hasWarning && 'dnb-upload__file-cell--warning', exists && 'dnb-upload__file-cell--highlight'),
|
|
71
70
|
ref: cellRef
|
|
72
71
|
}, React.createElement("div", {
|
|
@@ -74,7 +73,6 @@ var UploadFileListCell = function UploadFileListCell(_ref) {
|
|
|
74
73
|
}, React.createElement("div", {
|
|
75
74
|
className: "dnb-upload__file-cell__content__left"
|
|
76
75
|
}, getIcon(), getTitle()), React.createElement("div", null, React.createElement(Button, {
|
|
77
|
-
"data-testid": "upload-delete-button",
|
|
78
76
|
icon: TrashIcon,
|
|
79
77
|
variant: "tertiary",
|
|
80
78
|
onClick: onDeleteHandler,
|
|
@@ -83,9 +81,7 @@ var UploadFileListCell = function UploadFileListCell(_ref) {
|
|
|
83
81
|
|
|
84
82
|
function getIcon() {
|
|
85
83
|
if (isLoading) {
|
|
86
|
-
return _ProgressIndicator || (_ProgressIndicator = React.createElement(ProgressIndicator,
|
|
87
|
-
"data-testid": "upload-progress-indicator"
|
|
88
|
-
}));
|
|
84
|
+
return _ProgressIndicator || (_ProgressIndicator = React.createElement(ProgressIndicator, null));
|
|
89
85
|
}
|
|
90
86
|
|
|
91
87
|
if (hasWarning) return _Icon || (_Icon = React.createElement(Icon, {
|
|
@@ -93,7 +89,12 @@ var UploadFileListCell = function UploadFileListCell(_ref) {
|
|
|
93
89
|
}));
|
|
94
90
|
var iconFileType = fileType;
|
|
95
91
|
|
|
96
|
-
if (!
|
|
92
|
+
if (!iconFileType) {
|
|
93
|
+
var mimeParts = file.type.split('/');
|
|
94
|
+
iconFileType = images[mimeParts[0]] || images[mimeParts[1]];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (!Object.prototype.hasOwnProperty.call(images, iconFileType)) {
|
|
97
98
|
iconFileType = 'file';
|
|
98
99
|
}
|
|
99
100
|
|
|
@@ -107,23 +108,20 @@ var UploadFileListCell = function UploadFileListCell(_ref) {
|
|
|
107
108
|
className: "dnb-upload__file-cell__text-container dnb-upload__file-cell__text-container--loading"
|
|
108
109
|
}, loadingText)) : React.createElement("div", {
|
|
109
110
|
className: "dnb-upload__file-cell__text-container"
|
|
110
|
-
},
|
|
111
|
-
"data-testid": "upload-file-anchor",
|
|
111
|
+
}, React.createElement("a", {
|
|
112
112
|
target: "_blank",
|
|
113
113
|
href: imageUrl,
|
|
114
114
|
className: "dnb-anchor dnb-upload__file-cell__title",
|
|
115
115
|
rel: "noopener noreferrer"
|
|
116
|
-
}, name)
|
|
117
|
-
"data-testid": "upload-subtitle",
|
|
116
|
+
}, file.name), _P || (_P = React.createElement(P, {
|
|
118
117
|
className: "dnb-upload__file-cell__subtitle",
|
|
119
118
|
size: "x-small",
|
|
120
119
|
top: "xx-small"
|
|
121
|
-
},
|
|
120
|
+
}, humanFileType)));
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
function getWarning() {
|
|
125
124
|
return hasWarning ? _FormStatus || (_FormStatus = React.createElement(FormStatus, {
|
|
126
|
-
"data-testid": "upload-warning",
|
|
127
125
|
top: "small",
|
|
128
126
|
text: errorMessage,
|
|
129
127
|
stretch: true
|
|
@@ -25,10 +25,8 @@ var UploadInfo = function UploadInfo() {
|
|
|
25
25
|
fileMaxSize = context.fileMaxSize;
|
|
26
26
|
var prettyfiedAcceptedFileFormats = acceptedFileTypes.join(', ').toUpperCase();
|
|
27
27
|
return React.createElement(React.Fragment, null, React.createElement(Lead, {
|
|
28
|
-
"data-testid": "upload-title",
|
|
29
28
|
space: "0"
|
|
30
29
|
}, title), React.createElement(P, {
|
|
31
|
-
"data-testid": "upload-text",
|
|
32
30
|
top: "xx-small",
|
|
33
31
|
className: "dnb-upload__text"
|
|
34
32
|
}, text), React.createElement(Dl, {
|
|
@@ -36,13 +34,7 @@ var UploadInfo = function UploadInfo() {
|
|
|
36
34
|
bottom: 0,
|
|
37
35
|
direction: "horizontal",
|
|
38
36
|
className: "dnb-upload__condition-list"
|
|
39
|
-
}, React.createElement(Dl.Item, null, React.createElement(Dt,
|
|
40
|
-
"data-testid": "upload-accepted-formats"
|
|
41
|
-
}, fileTypeDescription), React.createElement(Dd, null, prettyfiedAcceptedFileFormats)), React.createElement(Dl.Item, null, React.createElement(Dt, {
|
|
42
|
-
"data-testid": "upload-file-size"
|
|
43
|
-
}, fileSizeDescription), React.createElement(Dd, null, String(fileSizeContent).replace('%size', format(fileMaxSize).toString()))), filesAmountLimit < defaultProps.filesAmountLimit && React.createElement(Dl.Item, null, React.createElement(Dt, {
|
|
44
|
-
"data-testid": "upload-file-amount-limit"
|
|
45
|
-
}, fileAmountDescription), React.createElement(Dd, null, filesAmountLimit))));
|
|
37
|
+
}, prettyfiedAcceptedFileFormats && React.createElement(Dl.Item, null, React.createElement(Dt, null, fileTypeDescription), React.createElement(Dd, null, prettyfiedAcceptedFileFormats)), React.createElement(Dl.Item, null, React.createElement(Dt, null, fileSizeDescription), React.createElement(Dd, null, String(fileSizeContent).replace('%size', format(fileMaxSize).toString()))), filesAmountLimit < defaultProps.filesAmountLimit && React.createElement(Dl.Item, null, React.createElement(Dt, null, fileAmountDescription), React.createElement(Dd, null, filesAmountLimit))));
|
|
46
38
|
};
|
|
47
39
|
|
|
48
40
|
export default UploadInfo;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { UploadFile, UploadContextProps, UploadAcceptedFileTypes } from './types';
|
|
2
2
|
export declare function verifyFiles(files: UploadFile[], context: Pick<UploadContextProps, 'errorUnsupportedFile' | 'errorLargeFile' | 'acceptedFileTypes' | 'fileMaxSize'>): UploadFile[];
|
|
3
|
+
export declare function getFileTypeFromExtension(file: File): string;
|
|
4
|
+
export declare function getAcceptedFileTypes(acceptedFileTypes: UploadAcceptedFileTypes): string;
|
|
5
|
+
export declare function hasPreferredMimeType(acceptedFileTypes: UploadAcceptedFileTypes, file: File): boolean;
|
|
3
6
|
export declare function extendWithAbbreviation(acceptedFileTypes: UploadAcceptedFileTypes, abbreviations?: {
|
|
4
7
|
jpg: string;
|
|
5
8
|
}): string[];
|
|
@@ -7,6 +7,9 @@ import "core-js/modules/es.regexp.to-string.js";
|
|
|
7
7
|
import "core-js/modules/es.array.includes.js";
|
|
8
8
|
import "core-js/modules/es.string.includes.js";
|
|
9
9
|
import "core-js/modules/es.array.map.js";
|
|
10
|
+
import "core-js/modules/es.function.name.js";
|
|
11
|
+
import "core-js/modules/es.array.join.js";
|
|
12
|
+
import "core-js/modules/es.string.split.js";
|
|
10
13
|
import "core-js/modules/web.dom-collections.for-each.js";
|
|
11
14
|
import "core-js/modules/es.object.entries.js";
|
|
12
15
|
import { format } from '../number-format/NumberUtils';
|
|
@@ -26,8 +29,9 @@ export function verifyFiles(files, context) {
|
|
|
26
29
|
return false;
|
|
27
30
|
}
|
|
28
31
|
|
|
32
|
+
var fileType = hasPreferredMimeType(acceptedFileTypes, file) ? file.type : getFileTypeFromExtension(file) || file.type;
|
|
29
33
|
var foundType = extendWithAbbreviation(acceptedFileTypes).some(function (type) {
|
|
30
|
-
return
|
|
34
|
+
return fileType.includes(type);
|
|
31
35
|
});
|
|
32
36
|
return !foundType ? errorUnsupportedFile : null;
|
|
33
37
|
};
|
|
@@ -44,6 +48,19 @@ export function verifyFiles(files, context) {
|
|
|
44
48
|
});
|
|
45
49
|
return cleanedFiles;
|
|
46
50
|
}
|
|
51
|
+
export function getFileTypeFromExtension(file) {
|
|
52
|
+
return file.name.includes('.') && file.name.replace(/.*\.([^.]+)$/, '$1') || null;
|
|
53
|
+
}
|
|
54
|
+
export function getAcceptedFileTypes(acceptedFileTypes) {
|
|
55
|
+
return extendWithAbbreviation(acceptedFileTypes).map(function (type) {
|
|
56
|
+
return type.includes('/') ? type : ".".concat(type);
|
|
57
|
+
}).join(',');
|
|
58
|
+
}
|
|
59
|
+
export function hasPreferredMimeType(acceptedFileTypes, file) {
|
|
60
|
+
return file.type.split('/')[1] && (!(acceptedFileTypes !== null && acceptedFileTypes !== void 0 && acceptedFileTypes.length) || (acceptedFileTypes === null || acceptedFileTypes === void 0 ? void 0 : acceptedFileTypes.some(function (type) {
|
|
61
|
+
return type.toLowerCase() === file.type.toLowerCase();
|
|
62
|
+
})));
|
|
63
|
+
}
|
|
47
64
|
export function extendWithAbbreviation(acceptedFileTypes) {
|
|
48
65
|
var abbreviations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
49
66
|
jpg: 'jpeg'
|
package/elements/Element.js
CHANGED
|
@@ -10,7 +10,6 @@ import Context from '../shared/Context';
|
|
|
10
10
|
import { validateDOMAttributes, extendPropsWithContext } from '../shared/component-helper';
|
|
11
11
|
import { createSpacingClasses } from '../components/space/SpacingHelper';
|
|
12
12
|
import { createSkeletonClass, skeletonDOMAttributes } from '../components/skeleton/SkeletonHelper';
|
|
13
|
-
import { includeValidProps } from '../components/form-row/FormRowHelpers';
|
|
14
13
|
export var defaultProps = {
|
|
15
14
|
skeletonMethod: 'font'
|
|
16
15
|
};
|
|
@@ -24,7 +23,7 @@ function ElementInstance(localProps) {
|
|
|
24
23
|
var context = React.useContext(Context);
|
|
25
24
|
var props = extendPropsWithContext(localProps, defaultProps, {
|
|
26
25
|
skeleton: context === null || context === void 0 ? void 0 : context.skeleton
|
|
27
|
-
}
|
|
26
|
+
});
|
|
28
27
|
|
|
29
28
|
if (typeof props.inner_ref !== 'undefined') {
|
|
30
29
|
props.innerRef = props.inner_ref;
|