@dnb/eufemia 9.34.3 → 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.
- package/CHANGELOG.md +15 -0
- package/cjs/components/breadcrumb/style/dnb-breadcrumb.css +6 -0
- package/cjs/components/breadcrumb/style/dnb-breadcrumb.min.css +1 -1
- package/cjs/components/global-status/style/dnb-global-status.css +6 -0
- package/cjs/components/global-status/style/dnb-global-status.min.css +1 -1
- package/cjs/components/section/Section.d.ts +2 -2
- package/cjs/components/section/style/_section.scss +8 -0
- package/cjs/components/section/style/dnb-section.css +6 -0
- package/cjs/components/section/style/dnb-section.min.css +1 -1
- package/cjs/components/space/Space.d.ts +0 -2
- package/cjs/components/space/Space.js +16 -10
- package/cjs/components/tabs/Tabs.d.ts +2 -2
- package/cjs/components/tabs/Tabs.js +6 -11
- package/cjs/components/tabs/TabsContentWrapper.d.ts +1 -1
- package/cjs/components/tabs/TabsContentWrapper.js +6 -4
- package/cjs/components/tabs/style/_tabs.scss +15 -2
- package/cjs/components/tabs/style/dnb-tabs.css +14 -2
- package/cjs/components/tabs/style/dnb-tabs.min.css +1 -1
- package/cjs/components/tabs/style/themes/dnb-tabs-theme-eiendom.css +3 -3
- package/cjs/components/tabs/style/themes/dnb-tabs-theme-eiendom.min.css +1 -1
- package/cjs/components/tabs/style/themes/dnb-tabs-theme-ui.css +3 -3
- package/cjs/components/tabs/style/themes/dnb-tabs-theme-ui.min.css +1 -1
- package/cjs/components/tabs/style/themes/dnb-tabs-theme-ui.scss +4 -1
- package/cjs/components/upload/Upload.js +14 -17
- package/cjs/components/upload/UploadFileInput.js +17 -22
- package/cjs/components/upload/UploadFileList.js +1 -0
- package/cjs/components/upload/UploadFileListCell.d.ts +2 -1
- package/cjs/components/upload/UploadFileListCell.js +65 -7
- package/cjs/components/upload/UploadVerify.d.ts +4 -1
- package/cjs/components/upload/UploadVerify.js +67 -1
- package/cjs/components/upload/style/themes/dnb-upload-theme-ui.css +16 -3
- package/cjs/components/upload/style/themes/dnb-upload-theme-ui.min.css +1 -1
- package/cjs/components/upload/style/themes/dnb-upload-theme-ui.scss +9 -0
- package/cjs/components/upload/types.d.ts +3 -1
- package/cjs/components/upload/useUpload.d.ts +1 -2
- package/cjs/components/upload/useUpload.js +19 -3
- package/cjs/shared/Eufemia.js +1 -1
- package/cjs/style/dnb-ui-components.css +20 -2
- package/cjs/style/dnb-ui-components.min.css +2 -2
- package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.css +22 -9
- package/cjs/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/cjs/style/themes/theme-ui/dnb-theme-ui.css +19 -6
- package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/components/breadcrumb/style/dnb-breadcrumb.css +6 -0
- package/components/breadcrumb/style/dnb-breadcrumb.min.css +1 -1
- package/components/global-status/style/dnb-global-status.css +6 -0
- package/components/global-status/style/dnb-global-status.min.css +1 -1
- package/components/section/Section.d.ts +2 -2
- package/components/section/style/_section.scss +8 -0
- package/components/section/style/dnb-section.css +6 -0
- package/components/section/style/dnb-section.min.css +1 -1
- package/components/space/Space.d.ts +0 -2
- package/components/space/Space.js +15 -9
- package/components/tabs/Tabs.d.ts +2 -2
- package/components/tabs/Tabs.js +6 -11
- package/components/tabs/TabsContentWrapper.d.ts +1 -1
- package/components/tabs/TabsContentWrapper.js +5 -4
- package/components/tabs/style/_tabs.scss +15 -2
- package/components/tabs/style/dnb-tabs.css +14 -2
- package/components/tabs/style/dnb-tabs.min.css +1 -1
- package/components/tabs/style/themes/dnb-tabs-theme-eiendom.css +3 -3
- package/components/tabs/style/themes/dnb-tabs-theme-eiendom.min.css +1 -1
- package/components/tabs/style/themes/dnb-tabs-theme-ui.css +3 -3
- package/components/tabs/style/themes/dnb-tabs-theme-ui.min.css +1 -1
- package/components/tabs/style/themes/dnb-tabs-theme-ui.scss +4 -1
- package/components/upload/Upload.js +11 -15
- package/components/upload/UploadFileInput.js +16 -21
- package/components/upload/UploadFileList.js +1 -0
- package/components/upload/UploadFileListCell.d.ts +2 -1
- package/components/upload/UploadFileListCell.js +44 -3
- package/components/upload/UploadVerify.d.ts +4 -1
- package/components/upload/UploadVerify.js +27 -1
- package/components/upload/style/themes/dnb-upload-theme-ui.css +16 -3
- package/components/upload/style/themes/dnb-upload-theme-ui.min.css +1 -1
- package/components/upload/style/themes/dnb-upload-theme-ui.scss +9 -0
- package/components/upload/types.d.ts +3 -1
- package/components/upload/useUpload.d.ts +1 -2
- package/components/upload/useUpload.js +17 -3
- package/es/components/breadcrumb/style/dnb-breadcrumb.css +6 -0
- package/es/components/breadcrumb/style/dnb-breadcrumb.min.css +1 -1
- package/es/components/global-status/style/dnb-global-status.css +6 -0
- package/es/components/global-status/style/dnb-global-status.min.css +1 -1
- package/es/components/section/Section.d.ts +2 -2
- package/es/components/section/style/_section.scss +8 -0
- package/es/components/section/style/dnb-section.css +6 -0
- package/es/components/section/style/dnb-section.min.css +1 -1
- package/es/components/space/Space.d.ts +0 -2
- package/es/components/space/Space.js +15 -9
- package/es/components/tabs/Tabs.d.ts +2 -2
- package/es/components/tabs/Tabs.js +6 -11
- package/es/components/tabs/TabsContentWrapper.d.ts +1 -1
- package/es/components/tabs/TabsContentWrapper.js +5 -4
- package/es/components/tabs/style/_tabs.scss +15 -2
- package/es/components/tabs/style/dnb-tabs.css +14 -2
- package/es/components/tabs/style/dnb-tabs.min.css +1 -1
- package/es/components/tabs/style/themes/dnb-tabs-theme-eiendom.css +3 -3
- package/es/components/tabs/style/themes/dnb-tabs-theme-eiendom.min.css +1 -1
- package/es/components/tabs/style/themes/dnb-tabs-theme-ui.css +3 -3
- package/es/components/tabs/style/themes/dnb-tabs-theme-ui.min.css +1 -1
- package/es/components/tabs/style/themes/dnb-tabs-theme-ui.scss +4 -1
- package/es/components/upload/Upload.js +11 -13
- package/es/components/upload/UploadFileInput.js +13 -17
- package/es/components/upload/UploadFileList.js +1 -0
- package/es/components/upload/UploadFileListCell.d.ts +2 -1
- package/es/components/upload/UploadFileListCell.js +36 -2
- package/es/components/upload/UploadVerify.d.ts +4 -1
- package/es/components/upload/UploadVerify.js +12 -1
- package/es/components/upload/style/themes/dnb-upload-theme-ui.css +16 -3
- package/es/components/upload/style/themes/dnb-upload-theme-ui.min.css +1 -1
- package/es/components/upload/style/themes/dnb-upload-theme-ui.scss +9 -0
- package/es/components/upload/types.d.ts +3 -1
- package/es/components/upload/useUpload.d.ts +1 -2
- package/es/components/upload/useUpload.js +15 -3
- package/es/shared/Eufemia.js +1 -1
- package/es/style/dnb-ui-components.css +20 -2
- package/es/style/dnb-ui-components.min.css +2 -2
- package/es/style/themes/theme-eiendom/dnb-theme-eiendom.css +22 -9
- package/es/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/es/style/themes/theme-ui/dnb-theme-ui.css +19 -6
- package/es/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/esm/dnb-ui-lib.min.mjs +2 -2
- package/package.json +1 -1
- package/shared/Eufemia.js +1 -1
- package/style/dnb-ui-components.css +20 -2
- package/style/dnb-ui-components.min.css +2 -2
- package/style/themes/theme-eiendom/dnb-theme-eiendom.css +22 -9
- package/style/themes/theme-eiendom/dnb-theme-eiendom.min.css +2 -2
- package/style/themes/theme-ui/dnb-theme-ui.css +19 -6
- package/style/themes/theme-ui/dnb-theme-ui.min.css +2 -2
- package/umd/dnb-ui-lib.min.js +3 -3
- package/esm/dnb-ui-basis.min.mjs +0 -5
- package/esm/dnb-ui-components.min.mjs +0 -17
- package/esm/dnb-ui-elements.min.mjs +0 -16
- package/esm/dnb-ui-extensions.min.mjs +0 -17
- package/esm/dnb-ui-icons.min.mjs +0 -1
- package/esm/dnb-ui-web-components.min.mjs +0 -17
- package/umd/dnb-ui-basis.min.js +0 -12
- package/umd/dnb-ui-components.min.js +0 -24
- package/umd/dnb-ui-elements.min.js +0 -23
- package/umd/dnb-ui-extensions.min.js +0 -24
- package/umd/dnb-ui-icons.min.js +0 -1
- package/umd/dnb-ui-web-components.min.js +0 -24
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
.dnb-tabs__content:focus {
|
|
42
42
|
position: relative; }
|
|
43
|
-
.dnb-tabs__content:focus::
|
|
43
|
+
.dnb-tabs__content:focus::before {
|
|
44
44
|
content: '';
|
|
45
45
|
position: absolute;
|
|
46
46
|
z-index: -1;
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
max-width: 100vw;
|
|
52
52
|
border-radius: 0.5rem;
|
|
53
53
|
outline: none; }
|
|
54
|
-
html[data-whatinput='keyboard'] .dnb-tabs__content:focus::
|
|
54
|
+
html[data-whatinput='keyboard'] .dnb-tabs__content:focus::before {
|
|
55
55
|
--border-color: var(--color-emerald-green);
|
|
56
56
|
-webkit-box-shadow: 0 0 0 0.125rem var(--border-color);
|
|
57
57
|
box-shadow: 0 0 0 0.125rem var(--border-color);
|
|
58
58
|
border-color: transparent; }
|
|
59
59
|
@media screen and (-ms-high-contrast: none) {
|
|
60
|
-
html[data-whatinput='keyboard'] .dnb-tabs__content:focus::
|
|
60
|
+
html[data-whatinput='keyboard'] .dnb-tabs__content:focus::before {
|
|
61
61
|
-webkit-box-shadow: 0 0 0 0.125rem #14555a;
|
|
62
62
|
box-shadow: 0 0 0 0.125rem #14555a;
|
|
63
63
|
-webkit-box-shadow: 0 0 0 0.125rem var(--color-emerald-green);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.dnb-tabs__tabs:not(.dnb-section):before{background-color:#ebebeb;background-color:var(--color-black-8);-webkit-box-shadow:100vw 0 0 0 #ebebeb;box-shadow:100vw 0 0 0 #ebebeb;-webkit-box-shadow:100vw 0 0 0 var(--color-black-8);box-shadow:100vw 0 0 0 var(--color-black-8)}.dnb-tabs__tabs__tablist:focus{border-radius:.5rem}.dnb-tabs--at-edge .dnb-tabs__scroll-nav-button:first-of-type{border-radius:0 50% 50% 0}.dnb-tabs--at-edge .dnb-tabs__scroll-nav-button:last-of-type{border-radius:50% 0 0 50%}.dnb-tabs--at-edge .dnb-tabs__tabs__tablist:focus{border-radius:0}.dnb-tabs__content:focus{position:relative}.dnb-tabs__content:focus:
|
|
1
|
+
.dnb-tabs__tabs:not(.dnb-section):before{background-color:#ebebeb;background-color:var(--color-black-8);-webkit-box-shadow:100vw 0 0 0 #ebebeb;box-shadow:100vw 0 0 0 #ebebeb;-webkit-box-shadow:100vw 0 0 0 var(--color-black-8);box-shadow:100vw 0 0 0 var(--color-black-8)}.dnb-tabs__tabs__tablist:focus{border-radius:.5rem}.dnb-tabs--at-edge .dnb-tabs__scroll-nav-button:first-of-type{border-radius:0 50% 50% 0}.dnb-tabs--at-edge .dnb-tabs__scroll-nav-button:last-of-type{border-radius:50% 0 0 50%}.dnb-tabs--at-edge .dnb-tabs__tabs__tablist:focus{border-radius:0}.dnb-tabs__content:focus{position:relative}.dnb-tabs__content:focus:before{border-radius:.5rem;bottom:-.5rem;content:"";left:-.5rem;max-width:100vw;outline:none;position:absolute;right:-.5rem;top:.125rem;z-index:-1}html[data-whatinput=keyboard] .dnb-tabs__content:focus:before{--border-color:var(--color-emerald-green);border-color:transparent;-webkit-box-shadow:0 0 0 .125rem var(--border-color);box-shadow:0 0 0 .125rem var(--border-color)}@media screen and (-ms-high-contrast:none){html[data-whatinput=keyboard] .dnb-tabs__content:focus:before{-webkit-box-shadow:0 0 0 .125rem #14555a;box-shadow:0 0 0 .125rem #14555a;-webkit-box-shadow:0 0 0 .125rem var(--color-emerald-green);box-shadow:0 0 0 .125rem var(--color-emerald-green)}}.dnb-tabs__button__title{color:#007272;color:var(--color-sea-green);display:block;font-size:1.125rem;font-size:var(--font-size-basis);font-weight:400;font-weight:var(--font-weight-regular);padding:.5rem 0 .25rem;text-align:center}html:not([data-whatintent=touch]) .dnb-tabs__button:hover:not([disabled]){background-color:#d2f0e9;background-color:var(--color-mint-green-50)}html:not([data-whatintent=touch]) .dnb-tabs__button:hover:not([disabled]):after{background-color:#007272;background-color:var(--color-sea-green);border-radius:2px;height:2px}.dnb-tabs__button:focus{overflow:visible}.dnb-tabs__button:focus:before{border-radius:inherit;bottom:0;content:"";height:inherit;left:-.5rem;outline:none;position:absolute;right:-.5rem;top:0;z-index:1}html[data-whatinput=keyboard] .dnb-tabs__button:focus:before{--border-color:var(--color-emerald-green);border-color:transparent;-webkit-box-shadow:0 0 0 .125rem var(--border-color);box-shadow:0 0 0 .125rem var(--border-color)}@media screen and (-ms-high-contrast:none){html[data-whatinput=keyboard] .dnb-tabs__button:focus:before{-webkit-box-shadow:0 0 0 .125rem #14555a;box-shadow:0 0 0 .125rem #14555a;-webkit-box-shadow:0 0 0 .125rem var(--color-emerald-green);box-shadow:0 0 0 .125rem var(--color-emerald-green)}}.dnb-tabs__button:focus:before{border-radius:1.5rem;bottom:.5rem;left:-.375rem;right:-.375rem;top:.5rem}.dnb-tabs__button[disabled] .dnb-tabs__button__title{color:#b3dada;color:var(--color-sea-green-30)}.dnb-tabs__button:not([disabled]).selected:after,.dnb-tabs__button:not([disabled]):active:after{background-color:#007272;background-color:var(--color-sea-green);border-radius:2px;height:2px}.dnb-tabs__button:not([disabled]).selected .dnb-tabs__button__title,.dnb-tabs__button:not([disabled]):active .dnb-tabs__button__title{color:#14555a;color:var(--color-emerald-green)}.dnb-tabs__button:not([disabled]).selected .dnb-tabs__button__title,.dnb-tabs__button span[hidden]{font-weight:500;font-weight:var(--font-weight-medium)}html:not([data-whatintent=touch]) .dnb-tabs__button:hover[disabled]{cursor:not-allowed}html:not([data-whatintent=touch]) .dnb-tabs__button:hover:not([disabled]){background-color:#f2f4ec;background-color:var(--color-pistachio)}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
.dnb-tabs__content:focus {
|
|
38
38
|
position: relative; }
|
|
39
|
-
.dnb-tabs__content:focus::
|
|
39
|
+
.dnb-tabs__content:focus::before {
|
|
40
40
|
content: '';
|
|
41
41
|
position: absolute;
|
|
42
42
|
z-index: -1;
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
max-width: 100vw;
|
|
48
48
|
border-radius: 0.5rem;
|
|
49
49
|
outline: none; }
|
|
50
|
-
html[data-whatinput='keyboard'] .dnb-tabs__content:focus::
|
|
50
|
+
html[data-whatinput='keyboard'] .dnb-tabs__content:focus::before {
|
|
51
51
|
--border-color: var(--color-emerald-green);
|
|
52
52
|
-webkit-box-shadow: 0 0 0 0.125rem var(--border-color);
|
|
53
53
|
box-shadow: 0 0 0 0.125rem var(--border-color);
|
|
54
54
|
border-color: transparent; }
|
|
55
55
|
@media screen and (-ms-high-contrast: none) {
|
|
56
|
-
html[data-whatinput='keyboard'] .dnb-tabs__content:focus::
|
|
56
|
+
html[data-whatinput='keyboard'] .dnb-tabs__content:focus::before {
|
|
57
57
|
-webkit-box-shadow: 0 0 0 0.125rem #14555a;
|
|
58
58
|
box-shadow: 0 0 0 0.125rem #14555a;
|
|
59
59
|
-webkit-box-shadow: 0 0 0 0.125rem var(--color-emerald-green);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.dnb-tabs__tabs:not(.dnb-section):before{background-color:#ebebeb;background-color:var(--color-black-8);-webkit-box-shadow:100vw 0 0 0 #ebebeb;box-shadow:100vw 0 0 0 #ebebeb;-webkit-box-shadow:100vw 0 0 0 var(--color-black-8);box-shadow:100vw 0 0 0 var(--color-black-8)}.dnb-tabs__tabs__tablist:focus{border-radius:.5rem}.dnb-tabs--at-edge .dnb-tabs__scroll-nav-button:first-of-type{border-radius:0 50% 50% 0}.dnb-tabs--at-edge .dnb-tabs__scroll-nav-button:last-of-type{border-radius:50% 0 0 50%}.dnb-tabs--at-edge .dnb-tabs__tabs__tablist:focus{border-radius:0}.dnb-tabs__content:focus{position:relative}.dnb-tabs__content:focus:
|
|
1
|
+
.dnb-tabs__tabs:not(.dnb-section):before{background-color:#ebebeb;background-color:var(--color-black-8);-webkit-box-shadow:100vw 0 0 0 #ebebeb;box-shadow:100vw 0 0 0 #ebebeb;-webkit-box-shadow:100vw 0 0 0 var(--color-black-8);box-shadow:100vw 0 0 0 var(--color-black-8)}.dnb-tabs__tabs__tablist:focus{border-radius:.5rem}.dnb-tabs--at-edge .dnb-tabs__scroll-nav-button:first-of-type{border-radius:0 50% 50% 0}.dnb-tabs--at-edge .dnb-tabs__scroll-nav-button:last-of-type{border-radius:50% 0 0 50%}.dnb-tabs--at-edge .dnb-tabs__tabs__tablist:focus{border-radius:0}.dnb-tabs__content:focus{position:relative}.dnb-tabs__content:focus:before{border-radius:.5rem;bottom:-.5rem;content:"";left:-.5rem;max-width:100vw;outline:none;position:absolute;right:-.5rem;top:.125rem;z-index:-1}html[data-whatinput=keyboard] .dnb-tabs__content:focus:before{--border-color:var(--color-emerald-green);border-color:transparent;-webkit-box-shadow:0 0 0 .125rem var(--border-color);box-shadow:0 0 0 .125rem var(--border-color)}@media screen and (-ms-high-contrast:none){html[data-whatinput=keyboard] .dnb-tabs__content:focus:before{-webkit-box-shadow:0 0 0 .125rem #14555a;box-shadow:0 0 0 .125rem #14555a;-webkit-box-shadow:0 0 0 .125rem var(--color-emerald-green);box-shadow:0 0 0 .125rem var(--color-emerald-green)}}.dnb-tabs__button__title{color:#007272;color:var(--color-sea-green);display:block;font-size:1.125rem;font-size:var(--font-size-basis);font-weight:400;font-weight:var(--font-weight-regular);padding:.5rem 0 .25rem;text-align:center}html:not([data-whatintent=touch]) .dnb-tabs__button:hover[disabled]{cursor:not-allowed}html:not([data-whatintent=touch]) .dnb-tabs__button:hover:not([disabled]){background-color:#d2f0e9;background-color:var(--color-mint-green-50)}html:not([data-whatintent=touch]) .dnb-tabs__button:hover:not([disabled]):after{background-color:#007272;background-color:var(--color-sea-green);border-radius:2px;height:2px}.dnb-tabs__button:focus{overflow:visible}.dnb-tabs__button:focus:before{border-radius:inherit;bottom:0;content:"";height:inherit;left:-.5rem;outline:none;position:absolute;right:-.5rem;top:0;z-index:1}html[data-whatinput=keyboard] .dnb-tabs__button:focus:before{--border-color:var(--color-emerald-green);border-color:transparent;-webkit-box-shadow:0 0 0 .125rem var(--border-color);box-shadow:0 0 0 .125rem var(--border-color)}@media screen and (-ms-high-contrast:none){html[data-whatinput=keyboard] .dnb-tabs__button:focus:before{-webkit-box-shadow:0 0 0 .125rem #14555a;box-shadow:0 0 0 .125rem #14555a;-webkit-box-shadow:0 0 0 .125rem var(--color-emerald-green);box-shadow:0 0 0 .125rem var(--color-emerald-green)}}.dnb-tabs__button:focus:before{border-radius:1.5rem;bottom:.5rem;left:-.375rem;right:-.375rem;top:.5rem}.dnb-tabs__button[disabled] .dnb-tabs__button__title{color:#b3dada;color:var(--color-sea-green-30)}.dnb-tabs__button:not([disabled]).selected:after,.dnb-tabs__button:not([disabled]):active:after{background-color:#007272;background-color:var(--color-sea-green);border-radius:2px;height:2px}.dnb-tabs__button:not([disabled]).selected .dnb-tabs__button__title,.dnb-tabs__button:not([disabled]):active .dnb-tabs__button__title{color:#14555a;color:var(--color-emerald-green)}.dnb-tabs__button:not([disabled]).selected .dnb-tabs__button__title,.dnb-tabs__button span[hidden]{font-weight:500;font-weight:var(--font-weight-medium)}
|
|
@@ -36,9 +36,12 @@
|
|
|
36
36
|
border-radius: 0;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// Make focus ring when keyboard is used to navigate
|
|
39
40
|
&__content:focus {
|
|
40
41
|
position: relative;
|
|
41
|
-
|
|
42
|
+
|
|
43
|
+
// Use "before" (instead of after) in order to not collide with Section styles
|
|
44
|
+
&::before {
|
|
42
45
|
content: '';
|
|
43
46
|
position: absolute;
|
|
44
47
|
z-index: -1;
|
|
@@ -26,6 +26,8 @@ require("core-js/modules/web.dom-collections.iterator.js");
|
|
|
26
26
|
|
|
27
27
|
require("core-js/modules/es.array.from.js");
|
|
28
28
|
|
|
29
|
+
require("core-js/modules/es.function.name.js");
|
|
30
|
+
|
|
29
31
|
require("core-js/modules/es.regexp.exec.js");
|
|
30
32
|
|
|
31
33
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -39,16 +41,14 @@ Object.defineProperty(exports, "defaultProps", {
|
|
|
39
41
|
}
|
|
40
42
|
});
|
|
41
43
|
|
|
42
|
-
require("core-js/modules/es.object.to-string.js");
|
|
43
|
-
|
|
44
|
-
require("core-js/modules/es.function.name.js");
|
|
45
|
-
|
|
46
44
|
require("core-js/modules/es.array.concat.js");
|
|
47
45
|
|
|
48
46
|
require("core-js/modules/es.array.map.js");
|
|
49
47
|
|
|
50
48
|
require("core-js/modules/es.array.filter.js");
|
|
51
49
|
|
|
50
|
+
require("core-js/modules/es.object.to-string.js");
|
|
51
|
+
|
|
52
52
|
require("core-js/modules/es.array.slice.js");
|
|
53
53
|
|
|
54
54
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -142,7 +142,8 @@ var Upload = function Upload(localProps) {
|
|
|
142
142
|
var _useUpload = (0, _useUpload2.default)(id),
|
|
143
143
|
files = _useUpload.files,
|
|
144
144
|
setFiles = _useUpload.setFiles,
|
|
145
|
-
setInternalFiles = _useUpload.setInternalFiles
|
|
145
|
+
setInternalFiles = _useUpload.setInternalFiles,
|
|
146
|
+
existsInFiles = _useUpload.existsInFiles;
|
|
146
147
|
|
|
147
148
|
return _react.default.createElement(_UploadContext.UploadContext.Provider, {
|
|
148
149
|
value: _objectSpread(_objectSpread({}, extendedProps), {}, {
|
|
@@ -157,24 +158,20 @@ var Upload = function Upload(localProps) {
|
|
|
157
158
|
}, props), _UploadInfo || (_UploadInfo = _react.default.createElement(_UploadInfo2.default, null)), _UploadFileInput || (_UploadFileInput = _react.default.createElement(_UploadFileInput2.default, null)), _UploadFileList || (_UploadFileList = _react.default.createElement(_UploadFileList2.default, null)))));
|
|
158
159
|
|
|
159
160
|
function onInputUpload(newFiles) {
|
|
160
|
-
var
|
|
161
|
-
|
|
162
|
-
var f = _ref.file;
|
|
163
|
-
return f.name === file.name && f.size === file.size && f.lastModified === file.lastModified;
|
|
164
|
-
});
|
|
165
|
-
};
|
|
161
|
+
var mergedFiles = [].concat(_toConsumableArray(files), _toConsumableArray(newFiles.map(function (fileItem) {
|
|
162
|
+
var file = fileItem.file;
|
|
166
163
|
|
|
167
|
-
var uniqueFiles = [].concat(_toConsumableArray(files), _toConsumableArray(newFiles.filter(function (_ref2) {
|
|
168
|
-
var file = _ref2.file;
|
|
169
|
-
return !existsInFiles(file);
|
|
170
|
-
}).map(function (fileItem) {
|
|
171
164
|
if (!fileItem.id) {
|
|
172
165
|
fileItem.id = (0, _componentHelper.makeUniqueId)();
|
|
173
166
|
}
|
|
174
167
|
|
|
168
|
+
fileItem.exists = existsInFiles(file, files);
|
|
175
169
|
return fileItem;
|
|
176
170
|
})));
|
|
177
|
-
var verifiedFiles = (0, _UploadVerify.verifyFiles)(
|
|
171
|
+
var verifiedFiles = (0, _UploadVerify.verifyFiles)(mergedFiles.filter(function (_ref) {
|
|
172
|
+
var exists = _ref.exists;
|
|
173
|
+
return !exists;
|
|
174
|
+
}), {
|
|
178
175
|
fileMaxSize: fileMaxSize,
|
|
179
176
|
acceptedFileTypes: acceptedFileTypes,
|
|
180
177
|
errorUnsupportedFile: errorUnsupportedFile,
|
|
@@ -184,7 +181,7 @@ var Upload = function Upload(localProps) {
|
|
|
184
181
|
var validFiles = _toConsumableArray(verifiedFiles).slice(0, filesAmountLimit);
|
|
185
182
|
|
|
186
183
|
setFiles(validFiles);
|
|
187
|
-
setInternalFiles(
|
|
184
|
+
setInternalFiles(mergedFiles);
|
|
188
185
|
|
|
189
186
|
if (typeof onChange === 'function') {
|
|
190
187
|
onChange({
|
|
@@ -4,6 +4,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
4
4
|
|
|
5
5
|
require("core-js/modules/es.array.iterator.js");
|
|
6
6
|
|
|
7
|
+
require("core-js/modules/es.object.to-string.js");
|
|
8
|
+
|
|
7
9
|
require("core-js/modules/es.weak-map.js");
|
|
8
10
|
|
|
9
11
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
@@ -21,11 +23,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
21
23
|
});
|
|
22
24
|
exports.default = void 0;
|
|
23
25
|
|
|
24
|
-
require("core-js/modules/es.array.
|
|
25
|
-
|
|
26
|
-
require("core-js/modules/es.object.to-string.js");
|
|
27
|
-
|
|
28
|
-
require("core-js/modules/es.array.concat.js");
|
|
26
|
+
require("core-js/modules/es.array.join.js");
|
|
29
27
|
|
|
30
28
|
require("core-js/modules/es.array.map.js");
|
|
31
29
|
|
|
@@ -45,7 +43,7 @@ var _UploadContext = require("./UploadContext");
|
|
|
45
43
|
|
|
46
44
|
var _UploadStatus2 = _interopRequireDefault(require("./UploadStatus"));
|
|
47
45
|
|
|
48
|
-
var
|
|
46
|
+
var _UploadVerify = require("./UploadVerify");
|
|
49
47
|
|
|
50
48
|
var _UploadStatus;
|
|
51
49
|
|
|
@@ -66,18 +64,6 @@ var UploadFileInput = function UploadFileInput() {
|
|
|
66
64
|
onInputUpload = context.onInputUpload,
|
|
67
65
|
filesAmountLimit = context.filesAmountLimit;
|
|
68
66
|
|
|
69
|
-
var _useUpload = (0, _useUpload2.default)(id),
|
|
70
|
-
internalFiles = _useUpload.internalFiles;
|
|
71
|
-
|
|
72
|
-
var accept = acceptedFileTypes.reduce(function (accept, format, index) {
|
|
73
|
-
var previus = index === 0 ? '' : "".concat(accept, ",");
|
|
74
|
-
return "".concat(previus, " .").concat(format);
|
|
75
|
-
}, '');
|
|
76
|
-
(0, _react.useEffect)(function () {
|
|
77
|
-
fileInput.current.value = null;
|
|
78
|
-
fileInput.current.accept = accept;
|
|
79
|
-
}, []);
|
|
80
|
-
|
|
81
67
|
var openFileDialog = function openFileDialog() {
|
|
82
68
|
var _fileInput$current;
|
|
83
69
|
|
|
@@ -85,6 +71,9 @@ var UploadFileInput = function UploadFileInput() {
|
|
|
85
71
|
};
|
|
86
72
|
|
|
87
73
|
var sharedId = id || (0, _componentHelper.makeUniqueId)();
|
|
74
|
+
var accept = (0, _UploadVerify.extendWithAbbreviation)(acceptedFileTypes).map(function (type) {
|
|
75
|
+
return ".".concat(type);
|
|
76
|
+
}).join(',');
|
|
88
77
|
return _react.default.createElement("div", {
|
|
89
78
|
"data-testid": "upload-file-input"
|
|
90
79
|
}, _react.default.createElement(_Button.default, {
|
|
@@ -96,19 +85,20 @@ var UploadFileInput = function UploadFileInput() {
|
|
|
96
85
|
icon_position: "left",
|
|
97
86
|
variant: "secondary",
|
|
98
87
|
wrap: true,
|
|
99
|
-
onClick: openFileDialog
|
|
100
|
-
disabled: internalFiles.length > filesAmountLimit
|
|
88
|
+
onClick: openFileDialog
|
|
101
89
|
}, buttonText), _UploadStatus || (_UploadStatus = _react.default.createElement(_UploadStatus2.default, null)), _react.default.createElement("input", {
|
|
102
90
|
"aria-labelledby": "".concat(sharedId, "-input"),
|
|
103
91
|
"data-testid": "upload-file-input-input",
|
|
104
92
|
ref: fileInput,
|
|
93
|
+
accept: accept,
|
|
105
94
|
className: "dnb-upload__file-input",
|
|
106
95
|
type: "file",
|
|
107
|
-
onChange:
|
|
96
|
+
onChange: onChangeHandler,
|
|
97
|
+
onClick: onClickHandler,
|
|
108
98
|
multiple: filesAmountLimit > 1
|
|
109
99
|
}));
|
|
110
100
|
|
|
111
|
-
function
|
|
101
|
+
function onChangeHandler(event) {
|
|
112
102
|
var target = event.target;
|
|
113
103
|
var files = target.files;
|
|
114
104
|
onInputUpload(Array.from(files).map(function (file) {
|
|
@@ -117,6 +107,11 @@ var UploadFileInput = function UploadFileInput() {
|
|
|
117
107
|
};
|
|
118
108
|
}));
|
|
119
109
|
}
|
|
110
|
+
|
|
111
|
+
function onClickHandler(event) {
|
|
112
|
+
var target = event.target;
|
|
113
|
+
target.value = null;
|
|
114
|
+
}
|
|
120
115
|
};
|
|
121
116
|
|
|
122
117
|
var _default = UploadFileInput;
|
|
@@ -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;
|
|
@@ -2,16 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
4
|
|
|
5
|
-
require("core-js/modules/es.weak-map.js");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
8
|
-
|
|
9
5
|
require("core-js/modules/es.symbol.js");
|
|
10
6
|
|
|
11
7
|
require("core-js/modules/es.symbol.description.js");
|
|
12
8
|
|
|
13
9
|
require("core-js/modules/es.symbol.iterator.js");
|
|
14
10
|
|
|
11
|
+
require("core-js/modules/es.array.slice.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/es.array.from.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.weak-map.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
18
|
+
|
|
15
19
|
Object.defineProperty(exports, "__esModule", {
|
|
16
20
|
value: true
|
|
17
21
|
});
|
|
@@ -37,6 +41,8 @@ require("core-js/modules/web.url-search-params.js");
|
|
|
37
41
|
|
|
38
42
|
var _react = _interopRequireWildcard(require("react"));
|
|
39
43
|
|
|
44
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
45
|
+
|
|
40
46
|
var _Button = _interopRequireDefault(require("../button/Button"));
|
|
41
47
|
|
|
42
48
|
var _Icon2 = _interopRequireDefault(require("../../components/Icon"));
|
|
@@ -51,6 +57,8 @@ var _icons = require("../../icons");
|
|
|
51
57
|
|
|
52
58
|
var _componentHelper = require("../../shared/component-helper");
|
|
53
59
|
|
|
60
|
+
var _useUpload2 = _interopRequireDefault(require("./useUpload"));
|
|
61
|
+
|
|
54
62
|
var _ProgressIndicator, _Icon;
|
|
55
63
|
|
|
56
64
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -59,6 +67,18 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
59
67
|
|
|
60
68
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
61
69
|
|
|
70
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
71
|
+
|
|
72
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
73
|
+
|
|
74
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
75
|
+
|
|
76
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
77
|
+
|
|
78
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
79
|
+
|
|
80
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
81
|
+
|
|
62
82
|
var images = {
|
|
63
83
|
pdf: _icons.file_pdf_medium,
|
|
64
84
|
xls: _icons.file_xls_medium,
|
|
@@ -72,7 +92,8 @@ var images = {
|
|
|
72
92
|
var UploadFileListCell = function UploadFileListCell(_ref) {
|
|
73
93
|
var _div, _a, _FormStatus;
|
|
74
94
|
|
|
75
|
-
var
|
|
95
|
+
var id = _ref.id,
|
|
96
|
+
uploadFile = _ref.uploadFile,
|
|
76
97
|
onDelete = _ref.onDelete,
|
|
77
98
|
loadingText = _ref.loadingText,
|
|
78
99
|
deleteButtonText = _ref.deleteButtonText;
|
|
@@ -85,6 +106,7 @@ var UploadFileListCell = function UploadFileListCell(_ref) {
|
|
|
85
106
|
var hasWarning = errorMessage != null;
|
|
86
107
|
var imageUrl = URL.createObjectURL(file);
|
|
87
108
|
var cellRef = (0, _react.useRef)();
|
|
109
|
+
var exists = useExistsHighlight(id, file);
|
|
88
110
|
|
|
89
111
|
var handleDisappearFocus = function handleDisappearFocus() {
|
|
90
112
|
try {
|
|
@@ -103,7 +125,7 @@ var UploadFileListCell = function UploadFileListCell(_ref) {
|
|
|
103
125
|
|
|
104
126
|
return _react.default.createElement("li", {
|
|
105
127
|
"data-testid": "upload-file-list-cell",
|
|
106
|
-
className: 'dnb-upload__file-cell'
|
|
128
|
+
className: (0, _classnames.default)('dnb-upload__file-cell', hasWarning && 'dnb-upload__file-cell--warning', exists && 'dnb-upload__file-cell--highlight'),
|
|
107
129
|
ref: cellRef
|
|
108
130
|
}, _react.default.createElement("div", {
|
|
109
131
|
className: "dnb-upload__file-cell__content"
|
|
@@ -168,4 +190,40 @@ var UploadFileListCell = function UploadFileListCell(_ref) {
|
|
|
168
190
|
};
|
|
169
191
|
|
|
170
192
|
var _default = UploadFileListCell;
|
|
171
|
-
exports.default = _default;
|
|
193
|
+
exports.default = _default;
|
|
194
|
+
|
|
195
|
+
function useExistsHighlight(id, file) {
|
|
196
|
+
var _useUpload = (0, _useUpload2.default)(id),
|
|
197
|
+
internalFiles = _useUpload.internalFiles;
|
|
198
|
+
|
|
199
|
+
var _React$useState = _react.default.useState(false),
|
|
200
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
201
|
+
exists = _React$useState2[0],
|
|
202
|
+
updateExists = _React$useState2[1];
|
|
203
|
+
|
|
204
|
+
var timerRef = _react.default.useRef();
|
|
205
|
+
|
|
206
|
+
var clearTimers = function clearTimers() {
|
|
207
|
+
clearTimeout(timerRef.current);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
_react.default.useEffect(function () {
|
|
211
|
+
var exists = internalFiles.some(function (_ref2) {
|
|
212
|
+
var exists = _ref2.exists,
|
|
213
|
+
f = _ref2.file;
|
|
214
|
+
return exists && f.name === file.name && f.size === file.size;
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
if (exists) {
|
|
218
|
+
updateExists(true);
|
|
219
|
+
clearTimers();
|
|
220
|
+
timerRef.current = setTimeout(function () {
|
|
221
|
+
return updateExists(false);
|
|
222
|
+
}, 1500);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return clearTimers;
|
|
226
|
+
}, [file, internalFiles]);
|
|
227
|
+
|
|
228
|
+
return exists;
|
|
229
|
+
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { UploadContextProps,
|
|
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[];
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.symbol.description.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.symbol.iterator.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.array.iterator.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.string.iterator.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.array.from.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.array.slice.js");
|
|
18
|
+
|
|
19
|
+
require("core-js/modules/es.function.name.js");
|
|
20
|
+
|
|
3
21
|
Object.defineProperty(exports, "__esModule", {
|
|
4
22
|
value: true
|
|
5
23
|
});
|
|
24
|
+
exports.extendWithAbbreviation = extendWithAbbreviation;
|
|
6
25
|
exports.verifyFiles = verifyFiles;
|
|
7
26
|
|
|
8
27
|
require("core-js/modules/es.regexp.exec.js");
|
|
@@ -19,8 +38,32 @@ require("core-js/modules/es.string.includes.js");
|
|
|
19
38
|
|
|
20
39
|
require("core-js/modules/es.array.map.js");
|
|
21
40
|
|
|
41
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
42
|
+
|
|
43
|
+
require("core-js/modules/es.object.entries.js");
|
|
44
|
+
|
|
22
45
|
var _NumberUtils = require("../number-format/NumberUtils");
|
|
23
46
|
|
|
47
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
48
|
+
|
|
49
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
50
|
+
|
|
51
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
52
|
+
|
|
53
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
54
|
+
|
|
55
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
56
|
+
|
|
57
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
58
|
+
|
|
59
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
60
|
+
|
|
61
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
62
|
+
|
|
63
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
64
|
+
|
|
65
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
66
|
+
|
|
24
67
|
var BYTES_IN_A_MEGA_BYTE = 1048576;
|
|
25
68
|
|
|
26
69
|
function verifyFiles(files, context) {
|
|
@@ -38,7 +81,7 @@ function verifyFiles(files, context) {
|
|
|
38
81
|
return false;
|
|
39
82
|
}
|
|
40
83
|
|
|
41
|
-
var foundType = acceptedFileTypes.some(function (type) {
|
|
84
|
+
var foundType = extendWithAbbreviation(acceptedFileTypes).some(function (type) {
|
|
42
85
|
return file.type.includes(type);
|
|
43
86
|
});
|
|
44
87
|
return !foundType ? errorUnsupportedFile : null;
|
|
@@ -55,4 +98,27 @@ function verifyFiles(files, context) {
|
|
|
55
98
|
return item;
|
|
56
99
|
});
|
|
57
100
|
return cleanedFiles;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function extendWithAbbreviation(acceptedFileTypes) {
|
|
104
|
+
var abbreviations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
105
|
+
jpg: 'jpeg'
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
var list = _toConsumableArray(acceptedFileTypes);
|
|
109
|
+
|
|
110
|
+
Object.entries(abbreviations).forEach(function (_ref) {
|
|
111
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
112
|
+
type = _ref2[0],
|
|
113
|
+
abbr = _ref2[1];
|
|
114
|
+
|
|
115
|
+
if (list.some(function (t) {
|
|
116
|
+
return t === type;
|
|
117
|
+
}) && !list.some(function (t) {
|
|
118
|
+
return t === abbr;
|
|
119
|
+
})) {
|
|
120
|
+
list.push(abbr);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
return list;
|
|
58
124
|
}
|
|
@@ -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
|
|
31
|
-
|
|
32
|
-
|
|
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:
|
|
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;
|