@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.
Files changed (92) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/cjs/components/accordion/AccordionProvider.js +1 -3
  3. package/cjs/components/autocomplete/Autocomplete.js +4 -1
  4. package/cjs/components/button/Button.d.ts +6 -1
  5. package/cjs/components/button/Button.js +3 -3
  6. package/cjs/components/dropdown/Dropdown.d.ts +2 -2
  7. package/cjs/components/help-button/HelpButtonInstance.js +1 -3
  8. package/cjs/components/icon/Icon.js +1 -3
  9. package/cjs/components/icon-primary/IconPrimary.js +1 -3
  10. package/cjs/components/input-masked/InputMasked.js +13 -1
  11. package/cjs/components/input-masked/InputMaskedHooks.js +1 -1
  12. package/cjs/components/input-masked/InputMaskedUtils.js +3 -3
  13. package/cjs/components/logo/Logo.js +1 -3
  14. package/cjs/components/modal/Modal.js +1 -3
  15. package/cjs/components/pagination/Pagination.js +1 -3
  16. package/cjs/components/progress-indicator/ProgressIndicator.js +1 -3
  17. package/cjs/components/step-indicator/StepIndicatorContext.js +1 -3
  18. package/cjs/components/upload/Upload.js +0 -1
  19. package/cjs/components/upload/UploadFileInput.js +2 -10
  20. package/cjs/components/upload/UploadFileList.js +0 -1
  21. package/cjs/components/upload/UploadFileListCell.js +22 -23
  22. package/cjs/components/upload/UploadInfo.js +1 -9
  23. package/cjs/components/upload/UploadVerify.d.ts +3 -0
  24. package/cjs/components/upload/UploadVerify.js +27 -3
  25. package/cjs/elements/Element.js +1 -3
  26. package/cjs/fragments/drawer-list/DrawerList.js +1 -3
  27. package/cjs/shared/Eufemia.js +1 -1
  28. package/components/accordion/AccordionProvider.js +1 -2
  29. package/components/autocomplete/Autocomplete.js +4 -1
  30. package/components/button/Button.d.ts +6 -1
  31. package/components/button/Button.js +3 -2
  32. package/components/dropdown/Dropdown.d.ts +2 -2
  33. package/components/help-button/HelpButtonInstance.js +1 -2
  34. package/components/icon/Icon.js +1 -2
  35. package/components/icon-primary/IconPrimary.js +1 -2
  36. package/components/input-masked/InputMasked.js +13 -1
  37. package/components/input-masked/InputMaskedHooks.js +1 -1
  38. package/components/input-masked/InputMaskedUtils.js +3 -3
  39. package/components/logo/Logo.js +1 -2
  40. package/components/modal/Modal.js +1 -2
  41. package/components/pagination/Pagination.js +1 -2
  42. package/components/progress-indicator/ProgressIndicator.js +1 -2
  43. package/components/step-indicator/StepIndicatorContext.js +1 -2
  44. package/components/upload/Upload.js +0 -1
  45. package/components/upload/UploadFileInput.js +3 -10
  46. package/components/upload/UploadFileList.js +0 -1
  47. package/components/upload/UploadFileListCell.js +17 -19
  48. package/components/upload/UploadInfo.js +1 -9
  49. package/components/upload/UploadVerify.d.ts +3 -0
  50. package/components/upload/UploadVerify.js +18 -1
  51. package/elements/Element.js +1 -2
  52. package/es/components/accordion/AccordionProvider.js +1 -2
  53. package/es/components/autocomplete/Autocomplete.js +4 -1
  54. package/es/components/button/Button.d.ts +6 -1
  55. package/es/components/button/Button.js +3 -2
  56. package/es/components/dropdown/Dropdown.d.ts +2 -2
  57. package/es/components/help-button/HelpButtonInstance.js +1 -2
  58. package/es/components/icon/Icon.js +1 -2
  59. package/es/components/icon-primary/IconPrimary.js +1 -2
  60. package/es/components/input-masked/InputMasked.js +12 -1
  61. package/es/components/input-masked/InputMaskedHooks.js +1 -1
  62. package/es/components/input-masked/InputMaskedUtils.js +3 -3
  63. package/es/components/logo/Logo.js +1 -2
  64. package/es/components/modal/Modal.js +1 -2
  65. package/es/components/pagination/Pagination.js +1 -2
  66. package/es/components/progress-indicator/ProgressIndicator.js +1 -2
  67. package/es/components/step-indicator/StepIndicatorContext.js +1 -2
  68. package/es/components/upload/Upload.js +0 -1
  69. package/es/components/upload/UploadFileInput.js +3 -7
  70. package/es/components/upload/UploadFileList.js +0 -1
  71. package/es/components/upload/UploadFileListCell.js +14 -18
  72. package/es/components/upload/UploadInfo.js +1 -9
  73. package/es/components/upload/UploadVerify.d.ts +3 -0
  74. package/es/components/upload/UploadVerify.js +11 -1
  75. package/es/elements/Element.js +1 -2
  76. package/es/fragments/drawer-list/DrawerList.js +1 -2
  77. package/es/shared/Eufemia.js +1 -1
  78. package/esm/dnb-ui-basis.min.mjs +1 -1
  79. package/esm/dnb-ui-components.min.mjs +1 -1
  80. package/esm/dnb-ui-elements.min.mjs +2 -2
  81. package/esm/dnb-ui-extensions.min.mjs +1 -1
  82. package/esm/dnb-ui-lib.min.mjs +2 -2
  83. package/esm/dnb-ui-web-components.min.mjs +2 -2
  84. package/fragments/drawer-list/DrawerList.js +1 -2
  85. package/package.json +1 -1
  86. package/shared/Eufemia.js +1 -1
  87. package/umd/dnb-ui-basis.min.js +1 -1
  88. package/umd/dnb-ui-components.min.js +1 -1
  89. package/umd/dnb-ui-elements.min.js +2 -2
  90. package/umd/dnb-ui-extensions.min.js +1 -1
  91. package/umd/dnb-ui-lib.min.js +2 -2
  92. package/umd/dnb-ui-web-components.min.js +2 -2
@@ -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
- }, (0, _FormRowHelpers.includeValidProps)(context === null || context === void 0 ? void 0 : context.FormRow));
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, (0, _FormRowHelpers.includeValidProps)(this.context.FormRow), this.context.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,
@@ -21,7 +21,7 @@ function init() {
21
21
  _createClass(Eufemia, [{
22
22
  key: "version",
23
23
  get: function get() {
24
- return '9.47.0';
24
+ return '9.47.2';
25
25
  }
26
26
  }]);
27
27
 
@@ -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, includeValidProps(this.context.FormRow), this.context.Accordion, this.context.getTranslation(this.props).Accordion);
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 specifiy where to open the linked document, specified by `href`. Possible values are `_self`, `_blank`, `_parent` and `_top`.
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
- }, includeValidProps(this.context.FormRow), this.context.Button);
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, selected_key, value }`.
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, selected_key, value, active_item }`. The "active_item" property is the currently selected item by keyboard navigation
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, includeValidProps(context.FormRow), context.HelpButton);
30
+ var props = extendPropsWithContext(localProps, defaultProps, context.HelpButton);
32
31
 
33
32
  var size = props.size,
34
33
  icon = props.icon,
@@ -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
- }, includeValidProps(this.context.FormRow), this.context.Icon);
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
- }, includeValidProps(this.context.FormRow), this.context.Icon, this.context.IconPrimary);
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,.]/g, '');
98
- var numberValue = value.replace(/[^\d,.]/g, '');
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 (/^-|-0$/.test(localValue)) {
112
+ if (/^(-|-0)$/.test(localValue.replace(/[^\d-0]/g, ''))) {
113
113
  value = localValue;
114
114
  } else if (localNumberValue === '' && numberValue === '0') {
115
115
  value = '';
@@ -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, includeValidProps(this.context.FormRow), this.context.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, includeValidProps(this.context.FormRow), this.context.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, includeValidProps(this.context.FormRow), this.context.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, includeValidProps(this.context.FormRow), this.context.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, includeValidProps(context.FormRow), 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 { extendWithAbbreviation } from './UploadVerify';
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 = extendWithAbbreviation(acceptedFileTypes).map(function (type) {
32
- return ".".concat(type);
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",
@@ -25,7 +25,6 @@ function UploadFileList() {
25
25
  }
26
26
 
27
27
  return React.createElement("ul", {
28
- "data-testid": "upload-file-list",
29
28
  className: "dnb-upload__file-list",
30
29
  "aria-label": fileListAriaLabel
31
30
  }, files.map(function (uploadFile, index) {
@@ -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, _a, _FormStatus;
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 (!Object.prototype.hasOwnProperty.call(images, fileType)) {
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
- }, _a || (_a = React.createElement("a", {
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)), React.createElement(P, {
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
- }, fileType.toUpperCase()));
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 file.type.includes(type);
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'
@@ -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
- }, includeValidProps(context === null || context === void 0 ? void 0 : context.FormRow));
26
+ });
28
27
 
29
28
  if (typeof props.inner_ref !== 'undefined') {
30
29
  props.innerRef = props.inner_ref;