@dnb/eufemia 9.34.2 → 9.35.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.
Files changed (154) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/cjs/components/breadcrumb/Breadcrumb.d.ts +1 -1
  3. package/cjs/components/breadcrumb/BreadcrumbMultiple.d.ts +1 -1
  4. package/cjs/components/breadcrumb/BreadcrumbMultiple.js +3 -1
  5. package/cjs/components/breadcrumb/style/dnb-breadcrumb.css +6 -0
  6. package/cjs/components/breadcrumb/style/dnb-breadcrumb.min.css +1 -1
  7. package/cjs/components/global-status/style/dnb-global-status.css +6 -0
  8. package/cjs/components/global-status/style/dnb-global-status.min.css +1 -1
  9. package/cjs/components/section/Section.d.ts +2 -2
  10. package/cjs/components/section/style/_section.scss +8 -0
  11. package/cjs/components/section/style/dnb-section.css +6 -0
  12. package/cjs/components/section/style/dnb-section.min.css +1 -1
  13. package/cjs/components/space/Space.d.ts +0 -2
  14. package/cjs/components/space/Space.js +16 -10
  15. package/cjs/components/table/TableTr.d.ts +1 -1
  16. package/cjs/components/tabs/Tabs.d.ts +2 -2
  17. package/cjs/components/tabs/Tabs.js +6 -11
  18. package/cjs/components/tabs/TabsContentWrapper.d.ts +1 -1
  19. package/cjs/components/tabs/TabsContentWrapper.js +6 -4
  20. package/cjs/components/tabs/style/_tabs.scss +15 -2
  21. package/cjs/components/tabs/style/dnb-tabs.css +14 -2
  22. package/cjs/components/tabs/style/dnb-tabs.min.css +1 -1
  23. package/cjs/components/tabs/style/themes/dnb-tabs-theme-eiendom.css +3 -3
  24. package/cjs/components/tabs/style/themes/dnb-tabs-theme-eiendom.min.css +1 -1
  25. package/cjs/components/tabs/style/themes/dnb-tabs-theme-ui.css +3 -3
  26. package/cjs/components/tabs/style/themes/dnb-tabs-theme-ui.min.css +1 -1
  27. package/cjs/components/tabs/style/themes/dnb-tabs-theme-ui.scss +4 -1
  28. package/cjs/components/upload/Upload.js +14 -17
  29. package/cjs/components/upload/UploadFileInput.js +17 -22
  30. package/cjs/components/upload/UploadFileList.js +1 -0
  31. package/cjs/components/upload/UploadFileListCell.d.ts +2 -1
  32. package/cjs/components/upload/UploadFileListCell.js +65 -7
  33. package/cjs/components/upload/UploadVerify.d.ts +4 -1
  34. package/cjs/components/upload/UploadVerify.js +67 -1
  35. package/cjs/components/upload/style/themes/dnb-upload-theme-ui.css +16 -3
  36. package/cjs/components/upload/style/themes/dnb-upload-theme-ui.min.css +1 -1
  37. package/cjs/components/upload/style/themes/dnb-upload-theme-ui.scss +9 -0
  38. package/cjs/components/upload/types.d.ts +3 -1
  39. package/cjs/components/upload/useUpload.d.ts +1 -2
  40. package/cjs/components/upload/useUpload.js +19 -3
  41. package/cjs/shared/Eufemia.js +1 -1
  42. package/cjs/style/dnb-ui-components.css +20 -2
  43. package/cjs/style/dnb-ui-components.min.css +2 -2
  44. package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.css +22 -9
  45. package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
  46. package/cjs/style/themes/theme-ui/dnb-theme-ui.css +19 -6
  47. package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
  48. package/components/breadcrumb/Breadcrumb.d.ts +1 -1
  49. package/components/breadcrumb/BreadcrumbMultiple.d.ts +1 -1
  50. package/components/breadcrumb/BreadcrumbMultiple.js +2 -1
  51. package/components/breadcrumb/style/dnb-breadcrumb.css +6 -0
  52. package/components/breadcrumb/style/dnb-breadcrumb.min.css +1 -1
  53. package/components/global-status/style/dnb-global-status.css +6 -0
  54. package/components/global-status/style/dnb-global-status.min.css +1 -1
  55. package/components/section/Section.d.ts +2 -2
  56. package/components/section/style/_section.scss +8 -0
  57. package/components/section/style/dnb-section.css +6 -0
  58. package/components/section/style/dnb-section.min.css +1 -1
  59. package/components/space/Space.d.ts +0 -2
  60. package/components/space/Space.js +15 -9
  61. package/components/table/TableTr.d.ts +1 -1
  62. package/components/tabs/Tabs.d.ts +2 -2
  63. package/components/tabs/Tabs.js +6 -11
  64. package/components/tabs/TabsContentWrapper.d.ts +1 -1
  65. package/components/tabs/TabsContentWrapper.js +5 -4
  66. package/components/tabs/style/_tabs.scss +15 -2
  67. package/components/tabs/style/dnb-tabs.css +14 -2
  68. package/components/tabs/style/dnb-tabs.min.css +1 -1
  69. package/components/tabs/style/themes/dnb-tabs-theme-eiendom.css +3 -3
  70. package/components/tabs/style/themes/dnb-tabs-theme-eiendom.min.css +1 -1
  71. package/components/tabs/style/themes/dnb-tabs-theme-ui.css +3 -3
  72. package/components/tabs/style/themes/dnb-tabs-theme-ui.min.css +1 -1
  73. package/components/tabs/style/themes/dnb-tabs-theme-ui.scss +4 -1
  74. package/components/upload/Upload.js +11 -15
  75. package/components/upload/UploadFileInput.js +16 -21
  76. package/components/upload/UploadFileList.js +1 -0
  77. package/components/upload/UploadFileListCell.d.ts +2 -1
  78. package/components/upload/UploadFileListCell.js +44 -3
  79. package/components/upload/UploadVerify.d.ts +4 -1
  80. package/components/upload/UploadVerify.js +27 -1
  81. package/components/upload/style/themes/dnb-upload-theme-ui.css +16 -3
  82. package/components/upload/style/themes/dnb-upload-theme-ui.min.css +1 -1
  83. package/components/upload/style/themes/dnb-upload-theme-ui.scss +9 -0
  84. package/components/upload/types.d.ts +3 -1
  85. package/components/upload/useUpload.d.ts +1 -2
  86. package/components/upload/useUpload.js +17 -3
  87. package/es/components/breadcrumb/Breadcrumb.d.ts +1 -1
  88. package/es/components/breadcrumb/BreadcrumbMultiple.d.ts +1 -1
  89. package/es/components/breadcrumb/BreadcrumbMultiple.js +1 -1
  90. package/es/components/breadcrumb/style/dnb-breadcrumb.css +6 -0
  91. package/es/components/breadcrumb/style/dnb-breadcrumb.min.css +1 -1
  92. package/es/components/global-status/style/dnb-global-status.css +6 -0
  93. package/es/components/global-status/style/dnb-global-status.min.css +1 -1
  94. package/es/components/section/Section.d.ts +2 -2
  95. package/es/components/section/style/_section.scss +8 -0
  96. package/es/components/section/style/dnb-section.css +6 -0
  97. package/es/components/section/style/dnb-section.min.css +1 -1
  98. package/es/components/space/Space.d.ts +0 -2
  99. package/es/components/space/Space.js +15 -9
  100. package/es/components/table/TableTr.d.ts +1 -1
  101. package/es/components/tabs/Tabs.d.ts +2 -2
  102. package/es/components/tabs/Tabs.js +6 -11
  103. package/es/components/tabs/TabsContentWrapper.d.ts +1 -1
  104. package/es/components/tabs/TabsContentWrapper.js +5 -4
  105. package/es/components/tabs/style/_tabs.scss +15 -2
  106. package/es/components/tabs/style/dnb-tabs.css +14 -2
  107. package/es/components/tabs/style/dnb-tabs.min.css +1 -1
  108. package/es/components/tabs/style/themes/dnb-tabs-theme-eiendom.css +3 -3
  109. package/es/components/tabs/style/themes/dnb-tabs-theme-eiendom.min.css +1 -1
  110. package/es/components/tabs/style/themes/dnb-tabs-theme-ui.css +3 -3
  111. package/es/components/tabs/style/themes/dnb-tabs-theme-ui.min.css +1 -1
  112. package/es/components/tabs/style/themes/dnb-tabs-theme-ui.scss +4 -1
  113. package/es/components/upload/Upload.js +11 -13
  114. package/es/components/upload/UploadFileInput.js +13 -17
  115. package/es/components/upload/UploadFileList.js +1 -0
  116. package/es/components/upload/UploadFileListCell.d.ts +2 -1
  117. package/es/components/upload/UploadFileListCell.js +36 -2
  118. package/es/components/upload/UploadVerify.d.ts +4 -1
  119. package/es/components/upload/UploadVerify.js +12 -1
  120. package/es/components/upload/style/themes/dnb-upload-theme-ui.css +16 -3
  121. package/es/components/upload/style/themes/dnb-upload-theme-ui.min.css +1 -1
  122. package/es/components/upload/style/themes/dnb-upload-theme-ui.scss +9 -0
  123. package/es/components/upload/types.d.ts +3 -1
  124. package/es/components/upload/useUpload.d.ts +1 -2
  125. package/es/components/upload/useUpload.js +15 -3
  126. package/es/shared/Eufemia.js +1 -1
  127. package/es/style/dnb-ui-components.css +20 -2
  128. package/es/style/dnb-ui-components.min.css +2 -2
  129. package/es/style/themes/theme-eiendom/dnb-theme-eiendom.css +22 -9
  130. package/es/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
  131. package/es/style/themes/theme-ui/dnb-theme-ui.css +19 -6
  132. package/es/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
  133. package/esm/dnb-ui-lib.min.mjs +2 -2
  134. package/package.json +1 -1
  135. package/shared/Eufemia.js +1 -1
  136. package/style/dnb-ui-components.css +20 -2
  137. package/style/dnb-ui-components.min.css +2 -2
  138. package/style/themes/theme-eiendom/dnb-theme-eiendom.css +22 -9
  139. package/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
  140. package/style/themes/theme-ui/dnb-theme-ui.css +19 -6
  141. package/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
  142. package/umd/dnb-ui-lib.min.js +3 -3
  143. package/esm/dnb-ui-basis.min.mjs +0 -5
  144. package/esm/dnb-ui-components.min.mjs +0 -17
  145. package/esm/dnb-ui-elements.min.mjs +0 -16
  146. package/esm/dnb-ui-extensions.min.mjs +0 -17
  147. package/esm/dnb-ui-icons.min.mjs +0 -1
  148. package/esm/dnb-ui-web-components.min.mjs +0 -17
  149. package/umd/dnb-ui-basis.min.js +0 -12
  150. package/umd/dnb-ui-components.min.js +0 -24
  151. package/umd/dnb-ui-elements.min.js +0 -23
  152. package/umd/dnb-ui-extensions.min.js +0 -24
  153. package/umd/dnb-ui-icons.min.js +0 -1
  154. package/umd/dnb-ui-web-components.min.js +0 -24
@@ -1,12 +1,12 @@
1
1
  var _UploadStatus;
2
2
 
3
- import React, { useEffect, useRef } from 'react';
3
+ import React, { useRef } from 'react';
4
4
  import Button from '../button/Button';
5
5
  import { folder as FolderIcon } from '../../icons';
6
6
  import { makeUniqueId } from '../../shared/component-helper';
7
7
  import { UploadContext } from './UploadContext';
8
8
  import UploadStatus from './UploadStatus';
9
- import useUpload from './useUpload';
9
+ import { extendWithAbbreviation } from './UploadVerify';
10
10
 
11
11
  const UploadFileInput = () => {
12
12
  const fileInput = useRef(null);
@@ -18,17 +18,6 @@ const UploadFileInput = () => {
18
18
  onInputUpload,
19
19
  filesAmountLimit
20
20
  } = context;
21
- const {
22
- internalFiles
23
- } = useUpload(id);
24
- const accept = acceptedFileTypes.reduce((accept, format, index) => {
25
- const previus = index === 0 ? '' : `${accept},`;
26
- return `${previus} .${format}`;
27
- }, '');
28
- useEffect(() => {
29
- fileInput.current.value = null;
30
- fileInput.current.accept = accept;
31
- }, []);
32
21
 
33
22
  const openFileDialog = () => {
34
23
  var _fileInput$current;
@@ -37,6 +26,7 @@ const UploadFileInput = () => {
37
26
  };
38
27
 
39
28
  const sharedId = id || makeUniqueId();
29
+ const accept = extendWithAbbreviation(acceptedFileTypes).map(type => `.${type}`).join(',');
40
30
  return React.createElement("div", {
41
31
  "data-testid": "upload-file-input"
42
32
  }, React.createElement(Button, {
@@ -48,19 +38,20 @@ const UploadFileInput = () => {
48
38
  icon_position: "left",
49
39
  variant: "secondary",
50
40
  wrap: true,
51
- onClick: openFileDialog,
52
- disabled: internalFiles.length > filesAmountLimit
41
+ onClick: openFileDialog
53
42
  }, buttonText), _UploadStatus || (_UploadStatus = React.createElement(UploadStatus, null)), React.createElement("input", {
54
43
  "aria-labelledby": `${sharedId}-input`,
55
44
  "data-testid": "upload-file-input-input",
56
45
  ref: fileInput,
46
+ accept: accept,
57
47
  className: "dnb-upload__file-input",
58
48
  type: "file",
59
- onChange: handleFileInput,
49
+ onChange: onChangeHandler,
50
+ onClick: onClickHandler,
60
51
  multiple: filesAmountLimit > 1
61
52
  }));
62
53
 
63
- function handleFileInput(event) {
54
+ function onChangeHandler(event) {
64
55
  const target = event.target;
65
56
  const {
66
57
  files
@@ -71,6 +62,11 @@ const UploadFileInput = () => {
71
62
  };
72
63
  }));
73
64
  }
65
+
66
+ function onClickHandler(event) {
67
+ const target = event.target;
68
+ target.value = null;
69
+ }
74
70
  };
75
71
 
76
72
  export default UploadFileInput;
@@ -48,6 +48,7 @@ function UploadFileList() {
48
48
 
49
49
  return React.createElement(UploadFileListCell, {
50
50
  key: index,
51
+ id: id,
51
52
  uploadFile: uploadFile,
52
53
  onDelete: onDeleteHandler,
53
54
  deleteButtonText: deleteButton,
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { UploadFile } from './types';
3
3
  export declare type UploadFileListCellProps = {
4
+ id: string;
4
5
  /**
5
6
  * Uploaded file
6
7
  */
@@ -15,5 +16,5 @@ export declare type UploadFileListCellProps = {
15
16
  loadingText: React.ReactNode;
16
17
  deleteButtonText: React.ReactNode;
17
18
  };
18
- declare const UploadFileListCell: ({ uploadFile, onDelete, loadingText, deleteButtonText, }: UploadFileListCellProps) => JSX.Element;
19
+ declare const UploadFileListCell: ({ id, uploadFile, onDelete, loadingText, deleteButtonText, }: UploadFileListCellProps) => JSX.Element;
19
20
  export default UploadFileListCell;
@@ -1,6 +1,7 @@
1
1
  var _ProgressIndicator, _Icon;
2
2
 
3
3
  import React, { useRef } from 'react';
4
+ import classnames from 'classnames';
4
5
  import Button from '../button/Button';
5
6
  import Icon from '../../components/Icon';
6
7
  import FormStatus from '../../components/FormStatus';
@@ -8,6 +9,7 @@ import ProgressIndicator from '../../components/progress-indicator';
8
9
  import P from '../../elements/P';
9
10
  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';
10
11
  import { getPreviousSibling, warn } from '../../shared/component-helper';
12
+ import useUpload from './useUpload';
11
13
  const images = {
12
14
  pdf,
13
15
  xls,
@@ -19,6 +21,7 @@ const images = {
19
21
  };
20
22
 
21
23
  const UploadFileListCell = ({
24
+ id,
22
25
  uploadFile,
23
26
  onDelete,
24
27
  loadingText,
@@ -39,6 +42,7 @@ const UploadFileListCell = ({
39
42
  const hasWarning = errorMessage != null;
40
43
  const imageUrl = URL.createObjectURL(file);
41
44
  const cellRef = useRef();
45
+ const exists = useExistsHighlight(id, file);
42
46
 
43
47
  const handleDisappearFocus = () => {
44
48
  try {
@@ -57,7 +61,7 @@ const UploadFileListCell = ({
57
61
 
58
62
  return React.createElement("li", {
59
63
  "data-testid": "upload-file-list-cell",
60
- className: 'dnb-upload__file-cell' + (hasWarning ? " dnb-upload__file-cell--warning" : ""),
64
+ className: classnames('dnb-upload__file-cell', hasWarning && 'dnb-upload__file-cell--warning', exists && 'dnb-upload__file-cell--highlight'),
61
65
  ref: cellRef
62
66
  }, React.createElement("div", {
63
67
  className: "dnb-upload__file-cell__content"
@@ -121,4 +125,34 @@ const UploadFileListCell = ({
121
125
  }
122
126
  };
123
127
 
124
- export default UploadFileListCell;
128
+ export default UploadFileListCell;
129
+
130
+ function useExistsHighlight(id, file) {
131
+ const {
132
+ internalFiles
133
+ } = useUpload(id);
134
+ const [exists, updateExists] = React.useState(false);
135
+ const timerRef = React.useRef();
136
+
137
+ const clearTimers = () => {
138
+ clearTimeout(timerRef.current);
139
+ };
140
+
141
+ React.useEffect(() => {
142
+ const exists = internalFiles.some(({
143
+ exists,
144
+ file: f
145
+ }) => {
146
+ return exists && f.name === file.name && f.size === file.size;
147
+ });
148
+
149
+ if (exists) {
150
+ updateExists(true);
151
+ clearTimers();
152
+ timerRef.current = setTimeout(() => updateExists(false), 1500);
153
+ }
154
+
155
+ return clearTimers;
156
+ }, [file, internalFiles]);
157
+ return exists;
158
+ }
@@ -1,2 +1,5 @@
1
- import { UploadContextProps, UploadFile } from './types';
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 extendWithAbbreviation(acceptedFileTypes: UploadAcceptedFileTypes, abbreviations?: {
4
+ jpg: string;
5
+ }): string[];
@@ -17,7 +17,7 @@ export function verifyFiles(files, context) {
17
17
  return false;
18
18
  }
19
19
 
20
- const foundType = acceptedFileTypes.some(type => {
20
+ const foundType = extendWithAbbreviation(acceptedFileTypes).some(type => {
21
21
  return file.type.includes(type);
22
22
  });
23
23
  return !foundType ? errorUnsupportedFile : null;
@@ -36,4 +36,15 @@ export function verifyFiles(files, context) {
36
36
  return item;
37
37
  });
38
38
  return cleanedFiles;
39
+ }
40
+ export function extendWithAbbreviation(acceptedFileTypes, abbreviations = {
41
+ jpg: 'jpeg'
42
+ }) {
43
+ const list = [...acceptedFileTypes];
44
+ Object.entries(abbreviations).forEach(([type, abbr]) => {
45
+ if (list.some(t => t === type) && !list.some(t => t === abbr)) {
46
+ list.push(abbr);
47
+ }
48
+ });
49
+ return list;
39
50
  }
@@ -27,9 +27,22 @@
27
27
  .dnb-upload--active {
28
28
  background-color: #f2f4ec;
29
29
  background-color: var(--color-pistachio); }
30
- .dnb-upload__file-cell--warning .dnb-upload__file-cell__content__left .dnb-icon {
31
- color: #dc2a2a;
32
- color: var(--color-fire-red); }
30
+ .dnb-upload__file-cell {
31
+ /** Highlight Animation */
32
+ -webkit-transition: background-color;
33
+ transition: background-color;
34
+ -webkit-transition-duration: 1.5s;
35
+ transition-duration: 1.5s;
36
+ -webkit-transition-timing-function: cubic-bezier(0.42, 0, 0, 1);
37
+ transition-timing-function: cubic-bezier(0.42, 0, 0, 1);
38
+ -webkit-transition-timing-function: var(--easing-default);
39
+ transition-timing-function: var(--easing-default); }
40
+ .dnb-upload__file-cell--warning .dnb-upload__file-cell__content__left .dnb-icon {
41
+ color: #dc2a2a;
42
+ color: var(--color-fire-red); }
43
+ .dnb-upload__file-cell--highlight {
44
+ background-color: #fbf6ec;
45
+ background-color: var(--color-sand-yellow); }
33
46
  .dnb-upload__text.dnb-p {
34
47
  color: #737373;
35
48
  color: var(--color-black-55); }
@@ -1 +1 @@
1
- .dnb-upload{background-color:#fff;background-color:var(--color-white);border-radius:.5rem}.dnb-upload__outline{stroke:#007272;stroke:var(--color-sea-green);stroke-width:.1875rem;border-radius:.5rem}.dnb-upload--active .dnb-upload__outline{stroke:#14555a;stroke:var(--color-emerald-green);bottom:-1px;height:calc(100% + 2px);inset:-1px;left:-1px;right:-1px;top:-1px;width:calc(100% + 2px)}.dnb-upload--active .dnb-upload__outline rect{stroke-width:.25rem;stroke-dasharray:0}.dnb-upload--active{background-color:#f2f4ec;background-color:var(--color-pistachio)}.dnb-upload__file-cell--warning .dnb-upload__file-cell__content__left .dnb-icon{color:#dc2a2a;color:var(--color-fire-red)}.dnb-upload__subtitle.dnb-p,.dnb-upload__text.dnb-p{color:#737373;color:var(--color-black-55)}
1
+ .dnb-upload{background-color:#fff;background-color:var(--color-white);border-radius:.5rem}.dnb-upload__outline{stroke:#007272;stroke:var(--color-sea-green);stroke-width:.1875rem;border-radius:.5rem}.dnb-upload--active .dnb-upload__outline{stroke:#14555a;stroke:var(--color-emerald-green);bottom:-1px;height:calc(100% + 2px);inset:-1px;left:-1px;right:-1px;top:-1px;width:calc(100% + 2px)}.dnb-upload--active .dnb-upload__outline rect{stroke-width:.25rem;stroke-dasharray:0}.dnb-upload--active{background-color:#f2f4ec;background-color:var(--color-pistachio)}.dnb-upload__file-cell{-webkit-transition:background-color;transition:background-color;-webkit-transition-duration:1.5s;transition-duration:1.5s;-webkit-transition-timing-function:cubic-bezier(.42,0,0,1);transition-timing-function:cubic-bezier(.42,0,0,1);-webkit-transition-timing-function:var(--easing-default);transition-timing-function:var(--easing-default)}.dnb-upload__file-cell--warning .dnb-upload__file-cell__content__left .dnb-icon{color:#dc2a2a;color:var(--color-fire-red)}.dnb-upload__file-cell--highlight{background-color:#fbf6ec;background-color:var(--color-sand-yellow)}.dnb-upload__subtitle.dnb-p,.dnb-upload__text.dnb-p{color:#737373;color:var(--color-black-55)}
@@ -35,6 +35,15 @@
35
35
  &--warning &__content__left .dnb-icon {
36
36
  color: var(--color-fire-red);
37
37
  }
38
+
39
+ /** Highlight Animation */
40
+ transition: background-color;
41
+ transition-duration: 1.5s;
42
+ transition-timing-function: var(--easing-default);
43
+
44
+ &--highlight {
45
+ background-color: var(--color-sand-yellow);
46
+ }
38
47
  }
39
48
 
40
49
  &__text.dnb-p {
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { SkeletonShow } from '../skeleton/Skeleton';
3
3
  import { LocaleProps, SpacingProps } from '../../shared/types';
4
+ export declare type UploadAcceptedFileTypes = string[];
4
5
  export declare type UploadProps = {
5
6
  /**
6
7
  * unique id used with the useUpload hook to manage the files
@@ -9,7 +10,7 @@ export declare type UploadProps = {
9
10
  /**
10
11
  * list of accepted file types.
11
12
  */
12
- acceptedFileTypes: string[];
13
+ acceptedFileTypes: UploadAcceptedFileTypes;
13
14
  /**
14
15
  * Skeleton should be applied when loading content
15
16
  * Default: null
@@ -63,5 +64,6 @@ export declare type UploadFile = {
63
64
  file: File;
64
65
  errorMessage?: React.ReactNode;
65
66
  isLoading?: boolean;
67
+ exists?: boolean;
66
68
  id?: string;
67
69
  };
@@ -4,11 +4,10 @@ export declare type useUploadReturn = {
4
4
  setFiles: (files: UploadFile[]) => void;
5
5
  internalFiles: UploadFile[];
6
6
  setInternalFiles: (files: UploadFile[]) => void;
7
+ existsInFiles: (file: File, fileItems?: UploadFile[]) => boolean;
7
8
  };
8
9
  /**
9
10
  * Use together with Upload with the same id to manage the files from outside the component.
10
- * @param id string, must match the id of the Upload component
11
- * @returns { files: UploadFile[], setFiles: (file: UploadFile[]) => void }
12
11
  */
13
12
  declare function useUpload(id: string): useUploadReturn;
14
13
  export default useUpload;
@@ -18,11 +18,23 @@ function useUpload(id) {
18
18
  });
19
19
  };
20
20
 
21
+ const files = (data === null || data === void 0 ? void 0 : data.files) || [];
22
+ const internalFiles = (data === null || data === void 0 ? void 0 : data.internalFiles) || [];
23
+
24
+ const existsInFiles = (file, fileItems = files) => {
25
+ return fileItems.some(({
26
+ file: f
27
+ }) => {
28
+ return f.name === file.name && f.size === file.size && f.lastModified === file.lastModified;
29
+ });
30
+ };
31
+
21
32
  return {
22
- files: (data === null || data === void 0 ? void 0 : data.files) || [],
33
+ files,
23
34
  setFiles,
24
- internalFiles: (data === null || data === void 0 ? void 0 : data.internalFiles) || [],
25
- setInternalFiles
35
+ internalFiles,
36
+ setInternalFiles,
37
+ existsInFiles
26
38
  };
27
39
  }
28
40
 
@@ -2,7 +2,7 @@ export function init() {
2
2
  if (typeof window !== 'undefined') {
3
3
  class Eufemia {
4
4
  get version() {
5
- return '9.34.2';
5
+ return '__VERSION__';
6
6
  }
7
7
 
8
8
  }
@@ -5394,6 +5394,12 @@ html[data-dnb-modal-active] {
5394
5394
  .dnb-section--spacing-medium {
5395
5395
  padding: 1.5rem 0;
5396
5396
  padding: var(--spacing-medium) 0; }
5397
+ .dnb-section--spacing-x-large {
5398
+ padding: 3rem 0;
5399
+ padding: var(--spacing-x-large) 0; }
5400
+ .dnb-section--spacing-xx-large {
5401
+ padding: 3.5rem 0;
5402
+ padding: var(--spacing-xx-large) 0; }
5397
5403
  .dnb-section--spacing, .dnb-section--spacing-large {
5398
5404
  padding: 2rem 0;
5399
5405
  padding: var(--spacing-large) 0; }
@@ -7536,13 +7542,25 @@ span.dnb-space--no-collapse > span {
7536
7542
  /* stylelint-enable */ }
7537
7543
  html[data-whatinput='keyboard'] .dnb-tabs__button__snap:last-of-type.focus .dnb-tabs__button:focus {
7538
7544
  margin-right: 0.5rem; }
7545
+ .dnb-tabs__cached {
7546
+ opacity: 1;
7547
+ -webkit-transition: opacity 1s cubic-bezier(0.42, 0, 0, 1);
7548
+ transition: opacity 1s cubic-bezier(0.42, 0, 0, 1);
7549
+ -webkit-transition: opacity 1s var(--easing-default);
7550
+ transition: opacity 1s var(--easing-default); }
7551
+ .dnb-tabs__cached--hidden {
7552
+ opacity: 0;
7553
+ visibility: hidden;
7554
+ height: 0 !important;
7555
+ overflow: hidden; }
7556
+ html[data-visual-test] .dnb-tabs .dnb-tabs__cached,
7539
7557
  html[data-visual-test] .dnb-tabs .dnb-tabs__button,
7540
7558
  html[data-visual-test] .dnb-tabs .dnb-tabs__button__snap,
7541
7559
  html[data-visual-test] .dnb-tabs .dnb-tabs__scroll-nav-button {
7542
7560
  -webkit-transition: none !important;
7543
7561
  transition: none !important; }
7544
- .dnb-tabs__content--spacing {
7545
- padding-top: 2rem; }
7562
+ .dnb-tabs__content {
7563
+ padding-bottom: 0; }
7546
7564
 
7547
7565
  /*
7548
7566
  * Tag component