@transferwise/components 46.97.5 → 46.98.1
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/build/alert/Alert.js +8 -0
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +8 -0
- package/build/alert/Alert.mjs.map +1 -1
- package/build/common/closeButton/CloseButton.js +3 -1
- package/build/common/closeButton/CloseButton.js.map +1 -1
- package/build/common/closeButton/CloseButton.mjs +3 -1
- package/build/common/closeButton/CloseButton.mjs.map +1 -1
- package/build/dateInput/DateInput.js +4 -4
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +4 -4
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +4 -4
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +4 -4
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.js +3 -3
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.js.map +1 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs +3 -3
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs.map +1 -1
- package/build/i18n/cs.json +3 -2
- package/build/i18n/cs.json.js +3 -2
- package/build/i18n/cs.json.js.map +1 -1
- package/build/i18n/cs.json.mjs +3 -2
- package/build/i18n/cs.json.mjs.map +1 -1
- package/build/i18n/de.json +3 -2
- package/build/i18n/de.json.js +3 -2
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +3 -2
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/en.json +3 -2
- package/build/i18n/en.json.js +3 -2
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +3 -2
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/i18n/es.json +3 -2
- package/build/i18n/es.json.js +3 -2
- package/build/i18n/es.json.js.map +1 -1
- package/build/i18n/es.json.mjs +3 -2
- package/build/i18n/es.json.mjs.map +1 -1
- package/build/i18n/fr.json +3 -2
- package/build/i18n/fr.json.js +3 -2
- package/build/i18n/fr.json.js.map +1 -1
- package/build/i18n/fr.json.mjs +3 -2
- package/build/i18n/fr.json.mjs.map +1 -1
- package/build/i18n/hu.json +3 -2
- package/build/i18n/hu.json.js +3 -2
- package/build/i18n/hu.json.js.map +1 -1
- package/build/i18n/hu.json.mjs +3 -2
- package/build/i18n/hu.json.mjs.map +1 -1
- package/build/i18n/id.json +3 -2
- package/build/i18n/id.json.js +3 -2
- package/build/i18n/id.json.js.map +1 -1
- package/build/i18n/id.json.mjs +3 -2
- package/build/i18n/id.json.mjs.map +1 -1
- package/build/i18n/it.json +3 -2
- package/build/i18n/it.json.js +3 -2
- package/build/i18n/it.json.js.map +1 -1
- package/build/i18n/it.json.mjs +3 -2
- package/build/i18n/it.json.mjs.map +1 -1
- package/build/i18n/ja.json +3 -2
- package/build/i18n/ja.json.js +3 -2
- package/build/i18n/ja.json.js.map +1 -1
- package/build/i18n/ja.json.mjs +3 -2
- package/build/i18n/ja.json.mjs.map +1 -1
- package/build/i18n/nl.json +6 -5
- package/build/i18n/pl.json +3 -2
- package/build/i18n/pl.json.js +3 -2
- package/build/i18n/pl.json.js.map +1 -1
- package/build/i18n/pl.json.mjs +3 -2
- package/build/i18n/pl.json.mjs.map +1 -1
- package/build/i18n/pt.json +3 -2
- package/build/i18n/pt.json.js +3 -2
- package/build/i18n/pt.json.js.map +1 -1
- package/build/i18n/pt.json.mjs +3 -2
- package/build/i18n/pt.json.mjs.map +1 -1
- package/build/i18n/ro.json +3 -2
- package/build/i18n/ro.json.js +3 -2
- package/build/i18n/ro.json.js.map +1 -1
- package/build/i18n/ro.json.mjs +3 -2
- package/build/i18n/ro.json.mjs.map +1 -1
- package/build/i18n/ru.json +3 -2
- package/build/i18n/ru.json.js +3 -2
- package/build/i18n/ru.json.js.map +1 -1
- package/build/i18n/ru.json.mjs +3 -2
- package/build/i18n/ru.json.mjs.map +1 -1
- package/build/i18n/th.json +3 -2
- package/build/i18n/th.json.js +3 -2
- package/build/i18n/th.json.js.map +1 -1
- package/build/i18n/th.json.mjs +3 -2
- package/build/i18n/th.json.mjs.map +1 -1
- package/build/i18n/tr.json +3 -2
- package/build/i18n/tr.json.js +3 -2
- package/build/i18n/tr.json.js.map +1 -1
- package/build/i18n/tr.json.mjs +3 -2
- package/build/i18n/tr.json.mjs.map +1 -1
- package/build/i18n/zh-CN.json +3 -2
- package/build/i18n/zh-CN.json.js +3 -2
- package/build/i18n/zh-CN.json.js.map +1 -1
- package/build/i18n/zh-CN.json.mjs +3 -2
- package/build/i18n/zh-CN.json.mjs.map +1 -1
- package/build/i18n/zh-HK.json +3 -2
- package/build/i18n/zh-HK.json.js +3 -2
- package/build/i18n/zh-HK.json.js.map +1 -1
- package/build/i18n/zh-HK.json.mjs +3 -2
- package/build/i18n/zh-HK.json.mjs.map +1 -1
- package/build/image/Image.js +9 -10
- package/build/image/Image.js.map +1 -1
- package/build/image/Image.mjs +11 -11
- package/build/image/Image.mjs.map +1 -1
- package/build/index.js +0 -2
- package/build/index.js.map +1 -1
- package/build/index.mjs +0 -1
- package/build/index.mjs.map +1 -1
- package/build/main.css +16 -45
- package/build/moneyInput/MoneyInput.js +4 -8
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.messages.js +3 -0
- package/build/moneyInput/MoneyInput.messages.js.map +1 -1
- package/build/moneyInput/MoneyInput.messages.mjs +3 -0
- package/build/moneyInput/MoneyInput.messages.mjs.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +4 -8
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +36 -2
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.messages.js +6 -0
- package/build/phoneNumberInput/PhoneNumberInput.messages.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.messages.mjs +6 -0
- package/build/phoneNumberInput/PhoneNumberInput.messages.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +36 -2
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/snackbar/Snackbar.js +1 -1
- package/build/snackbar/Snackbar.js.map +1 -1
- package/build/snackbar/Snackbar.mjs +1 -1
- package/build/snackbar/Snackbar.mjs.map +1 -1
- package/build/styles/circularButton/CircularButton.css +1 -0
- package/build/styles/dateInput/DateInput.css +13 -0
- package/build/styles/main.css +16 -45
- package/build/styles/uploadInput/uploadItem/UploadItem.css +2 -1
- package/build/tabs/Tabs.js +3 -3
- package/build/tabs/Tabs.js.map +1 -1
- package/build/tabs/Tabs.mjs +3 -3
- package/build/tabs/Tabs.mjs.map +1 -1
- package/build/test-utils/assets/apple-pay-logo.svg +84 -0
- package/build/typeahead/Typeahead.js +2 -2
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +2 -2
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.js +2 -2
- package/build/typeahead/typeaheadInput/TypeaheadInput.js.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs +2 -2
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs.map +1 -1
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/common/closeButton/CloseButton.d.ts +2 -0
- package/build/types/common/closeButton/CloseButton.d.ts.map +1 -1
- package/build/types/image/Image.d.ts +0 -1
- package/build/types/image/Image.d.ts.map +1 -1
- package/build/types/index.d.ts +0 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.messages.d.ts +5 -0
- package/build/types/moneyInput/MoneyInput.messages.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.messages.d.ts +8 -0
- package/build/types/phoneNumberInput/PhoneNumberInput.messages.d.ts.map +1 -1
- package/build/types/test-utils/fake-data.d.ts +2 -0
- package/build/types/test-utils/fake-data.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +6 -4
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts +1 -2
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/upload/steps/processingStep/processingStep.d.ts +1 -3
- package/build/types/upload/steps/processingStep/processingStep.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
- package/build/upload/Upload.js +29 -45
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.mjs +29 -45
- package/build/upload/Upload.mjs.map +1 -1
- package/build/upload/steps/processingStep/processingStep.js +1 -3
- package/build/upload/steps/processingStep/processingStep.js.map +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +1 -3
- package/build/upload/steps/processingStep/processingStep.mjs.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js +54 -6
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +54 -6
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +12 -6
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +12 -6
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.js +3 -2
- package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.mjs +3 -2
- package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
- package/package.json +14 -17
- package/src/alert/Alert.spec.tsx +11 -0
- package/src/alert/Alert.story.tsx +23 -9
- package/src/alert/Alert.tsx +14 -1
- package/src/circularButton/CircularButton.css +1 -0
- package/src/circularButton/CircularButton.less +1 -0
- package/src/circularButton/CircularButton.tests.story.tsx +23 -0
- package/src/common/closeButton/CloseButton.spec.tsx +13 -1
- package/src/common/closeButton/CloseButton.tsx +3 -0
- package/src/dateInput/DateInput.css +13 -0
- package/src/dateInput/DateInput.less +20 -0
- package/src/dateInput/DateInput.tests.story.tsx +14 -3
- package/src/dateInput/DateInput.tsx +4 -4
- package/src/i18n/cs.json +3 -2
- package/src/i18n/de.json +3 -2
- package/src/i18n/en.json +3 -2
- package/src/i18n/es.json +3 -2
- package/src/i18n/fr.json +3 -2
- package/src/i18n/hu.json +3 -2
- package/src/i18n/id.json +3 -2
- package/src/i18n/it.json +3 -2
- package/src/i18n/ja.json +3 -2
- package/src/i18n/nl.json +6 -5
- package/src/i18n/pl.json +3 -2
- package/src/i18n/pt.json +3 -2
- package/src/i18n/ro.json +3 -2
- package/src/i18n/ru.json +3 -2
- package/src/i18n/th.json +3 -2
- package/src/i18n/tr.json +3 -2
- package/src/i18n/zh-CN.json +3 -2
- package/src/i18n/zh-HK.json +3 -2
- package/src/image/Image.spec.tsx +3 -3
- package/src/image/Image.tsx +10 -12
- package/src/index.ts +0 -2
- package/src/legacylistItem/LegacyListItem.story.tsx +5 -5
- package/src/legacylistItem/LegacyListItem.tests.story.tsx +6 -6
- package/src/main.css +16 -45
- package/src/main.less +0 -1
- package/src/moneyInput/MoneyInput.messages.ts +5 -0
- package/src/moneyInput/MoneyInput.spec.tsx +42 -5
- package/src/moneyInput/MoneyInput.story.tsx +11 -2
- package/src/moneyInput/MoneyInput.tsx +5 -7
- package/src/phoneNumberInput/PhoneNumberInput.messages.ts +8 -0
- package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +77 -43
- package/src/phoneNumberInput/PhoneNumberInput.tsx +34 -2
- package/src/promoCard/__snapshots__/PromoCard.spec.tsx.snap +1 -0
- package/src/promoCard/__snapshots__/PromoCardGroup.spec.tsx.snap +2 -0
- package/src/ssr.spec.tsx +0 -1
- package/src/test-utils/assets/apple-pay-logo.svg +84 -0
- package/src/test-utils/fake-data.ts +5 -0
- package/src/test-utils/jest.setup.ts +0 -4
- package/src/typeahead/Typeahead.spec.tsx +182 -0
- package/src/typeahead/typeaheadInput/TypeaheadInput.spec.tsx +103 -0
- package/src/typeahead/util/highlight.spec.tsx +43 -0
- package/src/upload/Upload.spec.tsx +63 -0
- package/src/upload/Upload.story.tsx +0 -51
- package/src/upload/Upload.tests.story.tsx +93 -0
- package/src/upload/Upload.tsx +28 -49
- package/src/upload/steps/processingStep/processingStep.tsx +2 -7
- package/src/uploadInput/UploadInput.tsx +74 -10
- package/src/uploadInput/uploadItem/UploadItem.css +2 -1
- package/src/uploadInput/uploadItem/UploadItem.less +1 -1
- package/src/uploadInput/uploadItem/UploadItem.tsx +11 -6
- package/src/withDisplayFormat/WithDisplayFormat.spec.js +11 -15
- package/src/withDisplayFormat/WithDisplayFormat.tsx +3 -2
- package/build/selectOption/SelectOption.js +0 -131
- package/build/selectOption/SelectOption.js.map +0 -1
- package/build/selectOption/SelectOption.messages.js +0 -17
- package/build/selectOption/SelectOption.messages.js.map +0 -1
- package/build/selectOption/SelectOption.messages.mjs +0 -13
- package/build/selectOption/SelectOption.messages.mjs.map +0 -1
- package/build/selectOption/SelectOption.mjs +0 -127
- package/build/selectOption/SelectOption.mjs.map +0 -1
- package/build/styles/selectOption/SelectOption.css +0 -44
- package/build/types/selectOption/SelectOption.d.ts +0 -21
- package/build/types/selectOption/SelectOption.d.ts.map +0 -1
- package/build/types/selectOption/SelectOption.messages.d.ts +0 -12
- package/build/types/selectOption/SelectOption.messages.d.ts.map +0 -1
- package/build/types/selectOption/index.d.ts +0 -3
- package/build/types/selectOption/index.d.ts.map +0 -1
- package/src/selectOption/SelectOption.css +0 -44
- package/src/selectOption/SelectOption.less +0 -40
- package/src/selectOption/SelectOption.messages.ts +0 -12
- package/src/selectOption/SelectOption.spec.tsx +0 -83
- package/src/selectOption/SelectOption.story.tsx +0 -277
- package/src/selectOption/SelectOption.tsx +0 -151
- package/src/selectOption/index.ts +0 -2
- package/src/typeahead/Typeahead.rtl.spec.tsx +0 -54
- package/src/typeahead/Typeahead.spec.js +0 -404
- package/src/typeahead/typeaheadInput/TypeaheadInput.spec.js +0 -74
- package/src/typeahead/typeaheadOption/TypeaheadOption.spec.js +0 -75
- package/src/typeahead/util/highlight.spec.js +0 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoneyInput.messages.d.ts","sourceRoot":"","sources":["../../../src/moneyInput/MoneyInput.messages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MoneyInput.messages.d.ts","sourceRoot":"","sources":["../../../src/moneyInput/MoneyInput.messages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,wBAeG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneNumberInput.d.ts","sourceRoot":"","sources":["../../../src/phoneNumberInput/PhoneNumberInput.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAQ,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEnE,OAAO,EAAyC,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"PhoneNumberInput.d.ts","sourceRoot":"","sources":["../../../src/phoneNumberInput/PhoneNumberInput.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAQ,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEnE,OAAO,EAAyC,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAkBhG,MAAM,WAAW,qBAAqB;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACpD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IACvD,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAKD,QAAA,MAAM,gBAAgB,GAAI,gMAevB,qBAAqB,gCA4LvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -3,6 +3,14 @@ declare const _default: {
|
|
|
3
3
|
id: string;
|
|
4
4
|
defaultMessage: string;
|
|
5
5
|
};
|
|
6
|
+
countryCodeLabel: {
|
|
7
|
+
id: string;
|
|
8
|
+
defaultMessage: string;
|
|
9
|
+
};
|
|
10
|
+
phoneNumberLabel: {
|
|
11
|
+
id: string;
|
|
12
|
+
defaultMessage: string;
|
|
13
|
+
};
|
|
6
14
|
};
|
|
7
15
|
export default _default;
|
|
8
16
|
//# sourceMappingURL=PhoneNumberInput.messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneNumberInput.messages.d.ts","sourceRoot":"","sources":["../../../src/phoneNumberInput/PhoneNumberInput.messages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PhoneNumberInput.messages.d.ts","sourceRoot":"","sources":["../../../src/phoneNumberInput/PhoneNumberInput.messages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,wBAaG"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export declare const lorem5 = "Lorem ipsum dolor sit amet.";
|
|
1
2
|
export declare const lorem10 = "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Iste, architecto?";
|
|
3
|
+
export declare const lorem20 = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum non explicabo doloribus rerum saepe ut beatae adipisci rem vero optio.";
|
|
2
4
|
export declare const lorem40 = "Lorem ipsum dolor sit amet consectetur, adipisicing elit. Illo esse quod et iure deserunt facilis similique voluptatem reprehenderit mollitia inventore, ab voluptate dignissimos autem repellat accusamus perferendis sed pariatur tempore possimus ipsam praesentium ipsum? Nesciunt cumque repellendus impedit aliquam! Error?";
|
|
3
5
|
export declare const lorem100 = "Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ipsum quisquam fuga dolore veritatis assumenda rerum, non, sint aliquam, excepturi architecto temporibus quis? Quo, deleniti nobis, illo necessitatibus accusamus commodi error fuga culpa sequi, incidunt voluptatum tempore quisquam quos eos modi impedit sit! Eveniet libero optio assumenda rem accusantium quod quas, recusandae, incidunt mollitia harum dolorum. Dolor porro hic mollitia accusantium vel commodi, ipsam a suscipit iusto placeat numquam excepturi amet nostrum aliquid aperiam sequi deleniti asperiores fugit cumque ipsa voluptatem culpa non libero iste. Placeat rem dolore quisquam aperiam, eligendi facere quos minima totam a ut corporis culpa! Veniam, illo!";
|
|
4
6
|
export declare const lorem500 = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Modi commodi eos placeat aut quidem et error ex qui. Reprehenderit animi officiis magnam dicta, alias eligendi facilis sit fuga suscipit qui voluptatibus, quam harum beatae omnis sint sapiente dolorum cum officia dignissimos ab ipsa, deleniti voluptates exercitationem tempore! Fugit consequuntur ullam, similique tenetur corporis laborum sed sint, necessitatibus natus voluptatem, eius eveniet placeat quos quaerat officia officiis magni reprehenderit eaque! Dolorum odio iste vitae magnam, voluptatum pariatur unde, quod at adipisci reprehenderit dignissimos id modi quaerat rerum et dolorem. Rerum ratione beatae, repudiandae temporibus ipsam accusamus deserunt! Maiores, eos nisi laboriosam soluta rem minus expedita repudiandae accusamus aperiam rerum facere ducimus voluptas! Rerum fugit eum quasi. At sapiente quaerat, similique inventore quia magni cupiditate molestias odio voluptate quasi culpa ullam sit unde veritatis ut dicta ad nihil veniam accusamus eveniet vel placeat minus numquam nostrum! Delectus quas adipisci debitis cumque doloremque, nobis, obcaecati dolorem commodi possimus nesciunt vero? Excepturi saepe explicabo dolorem facere itaque optio, totam tempore earum culpa fugit ullam officia maiores dolores facilis voluptate consequuntur a voluptas, asperiores obcaecati voluptatem. Rerum suscipit quod nulla harum illum sequi praesentium tenetur neque architecto, molestias earum! Necessitatibus, ullam molestiae voluptas, esse dolorem officiis aut, inventore dolore provident beatae error nesciunt incidunt neque quam molestias iusto minus rem nam. Eum, provident id. Molestias vitae ex sequi veritatis totam minima labore quasi eligendi nemo, ipsa accusamus eaque quae maiores eum ipsam inventore illo voluptatem sapiente velit, quos aspernatur commodi quibusdam. A expedita, adipisci aut voluptatum repellat fugit saepe accusamus debitis, quis dolorem, incidunt corrupti magni? Inventore nulla fugit quisquam dolorum temporibus corporis error voluptates? Impedit possimus provident a vero exercitationem doloribus est voluptatibus distinctio, ipsum iste sit repellat sapiente tenetur deleniti ullam dolorem soluta accusantium! Ab, placeat rerum explicabo corporis impedit quam quos veritatis expedita hic veniam harum qui dolor neque! Laboriosam officiis, dignissimos corporis, ducimus iure nemo quisquam pariatur molestias repellat aliquam tempore impedit dolore tempora eaque accusamus fugiat facilis dolor sint laborum molestiae sapiente deserunt quasi obcaecati! Veniam, doloribus! Unde, fugiat odit sunt facere maiores nobis tempora, natus quam consectetur deleniti nesciunt perferendis aut praesentium. Libero, neque cumque beatae recusandae qui repudiandae sunt quod dolorum nemo voluptates et culpa temporibus perferendis est expedita vel laboriosam! Accusamus incidunt consectetur delectus voluptate sunt repudiandae deleniti ut consequuntur, facilis assumenda nostrum soluta unde repellat reiciendis ipsum quidem quam numquam optio voluptates eius. Molestias quibusdam assumenda earum atque ullam delectus explicabo recusandae quasi aperiam, est placeat? Officia molestiae accusamus rem placeat adipisci officiis harum vel. Neque sit qui alias magni illum! Ipsam, necessitatibus unde sit possimus ipsum quis neque voluptate reprehenderit tempore nobis quo sunt molestiae atque rerum similique natus minus eum? Maiores aspernatur ut ullam eos vitae aperiam odit deleniti eveniet delectus totam harum iste, blanditiis ab laboriosam mollitia. Esse incidunt odit voluptate minus cum molestiae reprehenderit minima voluptatibus id. Molestias aliquid repellendus dolores cupiditate, nemo reiciendis ad facilis quo est, a error culpa similique libero dolor labore! Facere laborum cupiditate iste laboriosam culpa consectetur.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fake-data.d.ts","sourceRoot":"","sources":["../../../src/test-utils/fake-data.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,gFAC2D,CAAC;AAEhF,eAAO,MAAM,OAAO,sUACiT,CAAC;AAEtU,eAAO,MAAM,QAAQ,+tBACysB,CAAC;AAE/tB,eAAO,MAAM,QAAQ,2uHACqtH,CAAC;AAE3uH,eAAO,MAAM,SAAS,28OACo7O,CAAC"}
|
|
1
|
+
{"version":3,"file":"fake-data.d.ts","sourceRoot":"","sources":["../../../src/test-utils/fake-data.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,gCAAgC,CAAC;AAEpD,eAAO,MAAM,OAAO,gFAC2D,CAAC;AAEhF,eAAO,MAAM,OAAO,4IACuH,CAAC;AAE5I,eAAO,MAAM,OAAO,sUACiT,CAAC;AAEtU,eAAO,MAAM,QAAQ,+tBACysB,CAAC;AAE/tB,eAAO,MAAM,QAAQ,2uHACqtH,CAAC;AAE3uH,eAAO,MAAM,SAAS,28OACo7O,CAAC"}
|
|
@@ -31,12 +31,13 @@ declare function customRender(ui: ReactElement, { locale, messages, ...renderOpt
|
|
|
31
31
|
"neptune.Label.optional": string;
|
|
32
32
|
"neptune.Link.opensInNewTab": string;
|
|
33
33
|
"neptune.MoneyInput.Select.placeholder": string;
|
|
34
|
+
"neptune.MoneyInput.Select.searchPlaceholder": string;
|
|
34
35
|
"neptune.MoneyInput.Select.selectCurrencyLabel": string;
|
|
35
36
|
"neptune.PhoneNumberInput.SelectInput.placeholder": string;
|
|
37
|
+
"neptune.PhoneNumberInput.countryCodeLabel": string;
|
|
38
|
+
"neptune.PhoneNumberInput.phoneNumberLabel": string;
|
|
36
39
|
"neptune.Select.searchPlaceholder": string;
|
|
37
40
|
"neptune.SelectInput.noResultsFound": string;
|
|
38
|
-
"neptune.SelectOption.action.label": string;
|
|
39
|
-
"neptune.SelectOption.selected.action.label": string;
|
|
40
41
|
"neptune.StatusIcon.iconLabel.error": string;
|
|
41
42
|
"neptune.StatusIcon.iconLabel.information": string;
|
|
42
43
|
"neptune.StatusIcon.iconLabel.pending": string;
|
|
@@ -111,12 +112,13 @@ declare function customRenderHook(callback: () => unknown, { locale, messages }?
|
|
|
111
112
|
"neptune.Label.optional": string;
|
|
112
113
|
"neptune.Link.opensInNewTab": string;
|
|
113
114
|
"neptune.MoneyInput.Select.placeholder": string;
|
|
115
|
+
"neptune.MoneyInput.Select.searchPlaceholder": string;
|
|
114
116
|
"neptune.MoneyInput.Select.selectCurrencyLabel": string;
|
|
115
117
|
"neptune.PhoneNumberInput.SelectInput.placeholder": string;
|
|
118
|
+
"neptune.PhoneNumberInput.countryCodeLabel": string;
|
|
119
|
+
"neptune.PhoneNumberInput.phoneNumberLabel": string;
|
|
116
120
|
"neptune.Select.searchPlaceholder": string;
|
|
117
121
|
"neptune.SelectInput.noResultsFound": string;
|
|
118
|
-
"neptune.SelectOption.action.label": string;
|
|
119
|
-
"neptune.SelectOption.selected.action.label": string;
|
|
120
122
|
"neptune.StatusIcon.iconLabel.error": string;
|
|
121
123
|
"neptune.StatusIcon.iconLabel.information": string;
|
|
122
124
|
"neptune.StatusIcon.iconLabel.pending": string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,GAChE,UAAU,CAAC,OAAO,MAAM,CAAC,CAK3B;AAED;;;GAGG;AACH,iBAAS,gBAAgB,CACvB,QAAQ,EAAE,MAAM,OAAO,EACvB,EAAE,MAAuB,EAAE,QAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,uEAKhD;AAED,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,gBAAgB,IAAI,UAAU,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { Component } from 'react';
|
|
|
2
2
|
import { WrappedComponentProps } from 'react-intl';
|
|
3
3
|
import { Size } from '../common';
|
|
4
4
|
import { PostDataFetcher, PostDataHTTPOptions } from './utils/postData/postData';
|
|
5
|
-
import { ProcessIndicatorStatus } from '../processIndicator';
|
|
6
5
|
export declare const MAX_SIZE_DEFAULT = 5000000;
|
|
7
6
|
export declare enum UploadStep {
|
|
8
7
|
UPLOAD_IMAGE_STEP = "uploadImageStep"
|
|
@@ -81,8 +80,8 @@ export declare class Upload extends Component<UploadProps, UploadState> {
|
|
|
81
80
|
onDragLeave(event: React.DragEvent<HTMLDivElement>): void;
|
|
82
81
|
onDragEnter(event: React.DragEvent<HTMLDivElement>): void;
|
|
83
82
|
onDrop(event: React.DragEvent<HTMLDivElement>): Promise<void>;
|
|
84
|
-
onAnimationCompleted: (status: ProcessIndicatorStatus) => Promise<void>;
|
|
85
83
|
asyncPost: (file: File) => Promise<Response>;
|
|
84
|
+
handleUploadComplete: (type: "success" | "error", response: unknown) => void;
|
|
86
85
|
asyncResponse: (response: unknown, type: "success" | "error") => void;
|
|
87
86
|
handleOnClear: React.MouseEventHandler<HTMLButtonElement>;
|
|
88
87
|
reset: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Upload.d.ts","sourceRoot":"","sources":["../../../src/upload/Upload.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAc,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,IAAI,EAAc,MAAM,WAAW,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IAChB,QAAQ,SAAK;gBAED,KAAK,EAAE,WAAW;IAgB9B,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM;IAiB/B,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IAQlD,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IAU5C,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IAYnD,SAAS,GAAU,MAAM,IAAI,uBAY3B;IAEF,oBAAoB,GAAI,MAAM,SAAS,GAAG,OAAO,EAAE,UAAU,OAAO,UAoBlE;IAEF,aAAa,GAAI,UAAU,OAAO,EAAE,MAAM,SAAS,GAAG,OAAO,UAS3D;IAEF,aAAa,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAMvD;IAEF,KAAK,aASH;IAEF,aAAa,GAAI,SAAS,MAAM,UAO9B;IAEF,WAAW,GAAU,MAAM,IAAI,sBA+E7B;IAEF,MAAM;CAkIP;;;;AAED,wBAAkC"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { ProcessIndicatorStatus } from '../../../processIndicator';
|
|
2
1
|
export interface ProcessingStepProps {
|
|
3
2
|
isComplete: boolean;
|
|
4
3
|
isError: boolean;
|
|
5
4
|
isSuccess: boolean;
|
|
6
|
-
onAnimationCompleted: (status: ProcessIndicatorStatus) => void;
|
|
7
5
|
onClear: React.MouseEventHandler<HTMLButtonElement>;
|
|
8
6
|
psButtonText: string;
|
|
9
7
|
psProcessingText: string;
|
|
10
8
|
psButtonDisabled: boolean;
|
|
11
9
|
}
|
|
12
|
-
export default function ProcessingStep({ isComplete, isError, isSuccess,
|
|
10
|
+
export default function ProcessingStep({ isComplete, isError, isSuccess, onClear, psButtonText, psProcessingText, psButtonDisabled, }: ProcessingStepProps): import("react").JSX.Element;
|
|
13
11
|
//# sourceMappingURL=processingStep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processingStep.d.ts","sourceRoot":"","sources":["../../../../../src/upload/steps/processingStep/processingStep.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processingStep.d.ts","sourceRoot":"","sources":["../../../../../src/upload/steps/processingStep/processingStep.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,UAAU,EACV,OAAO,EACP,SAAS,EACT,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GACjB,EAAE,mBAAmB,+BAwBrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadInput.d.ts","sourceRoot":"","sources":["../../../src/uploadInput/UploadInput.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAiC,MAAM,WAAW,CAAC;AAOvE,OAAO,EAAE,YAAY,EAAe,cAAc,EAAE,MAAM,SAAS,CAAC;AACpE,OAAqB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAE9E,OAAmB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAEhC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,YAAY,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAE9D;;;;;OAKG;IAC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B,gCAkXlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -7,7 +7,7 @@ export type UploadItemProps = React.JSX.IntrinsicAttributes & {
|
|
|
7
7
|
singleFileUpload: boolean;
|
|
8
8
|
canDelete: boolean;
|
|
9
9
|
onDelete: () => void;
|
|
10
|
-
onFocus: () => void;
|
|
10
|
+
onFocus: (target?: 'button' | 'link') => void;
|
|
11
11
|
/**
|
|
12
12
|
* Callback to be called when the file link is clicked.
|
|
13
13
|
* When provided, you need to manually trigger actions to load/download the file.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAe,MAAM,UAAU,CAAC;AAKrD,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,mBAAmB,GAAG;IAC5D,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAe,MAAM,UAAU,CAAC;AAKrD,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,mBAAmB,GAAG;IAC5D,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,KAAK,IAAI,CAAC;IAE9C;;;;;OAKG;IACH,UAAU,CAAC,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AAY,CAAC,CAAC,CAAC;IACzF,MAAM,CAAC,YAAY;;;;MAIjB;gBAEU,KAAK,EAAE,sBAAsB;IAezC,MAAM,CAAC,wBAAwB,CAC7B,EAAE,cAAc,EAAE,EAAE,sBAAsB,EAC1C,EAAE,kBAAmC,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,sBAAsB;;;;;;;IAiB1F,aAAa,GAAI,kBAAkB,MAAM,KAAG,SAAS,GAAG,MAAM,CA6B5D;IAEF,UAAU,aAMR;IAEF,cAAc,GAAI,OAAO,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,4BAK3D;IAEF,eAAe,EAAE,KAAK,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAuB1D;IAEF,aAAa,EAAE,KAAK,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAQzD;IAEF,WAAW,EAAE,KAAK,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAEvD;IAEF,YAAY,GAAI,QAAQ,SAAS,GAAG,MAAM,aAKxC;IAEF,cAAc,EAAE,KAAK,CAAC,kBAAkB,CAAC,eAAe,CAAC,CA0BvD;IAEF,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAEpD;IAEF,aAAa,EAAE,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAMrD;IAEF,YAAY,GAAI,kBAAkB,MAAM,EAAE,QAAQ,SAAS,YAuBzD;IAEF,uBAAuB,GAAI,QAAQ,MAAM,UAkBvC;IAEF,MAAM;CAqCP;AAED,eAAe,iBAAiB,CAAC"}
|
package/build/upload/Upload.js
CHANGED
|
@@ -38,22 +38,21 @@ var isSizeValid = require('./utils/isSizeValid/isSizeValid.js');
|
|
|
38
38
|
var isTypeValid = require('./utils/isTypeValid/isTypeValid.js');
|
|
39
39
|
var getFileType = require('./utils/getFileType/getFileType.js');
|
|
40
40
|
|
|
41
|
-
const ANIMATION_FIX = 10;
|
|
42
41
|
const MAX_SIZE_DEFAULT = 5000000;
|
|
43
42
|
exports.UploadStep = void 0;
|
|
44
43
|
(function (UploadStep) {
|
|
45
44
|
UploadStep["UPLOAD_IMAGE_STEP"] = "uploadImageStep";
|
|
46
45
|
})(exports.UploadStep || (exports.UploadStep = {}));
|
|
47
46
|
class Upload extends React.Component {
|
|
48
|
-
static defaultProps =
|
|
49
|
-
animationDelay:
|
|
47
|
+
static defaultProps = {
|
|
48
|
+
animationDelay: 300,
|
|
50
49
|
maxSize: MAX_SIZE_DEFAULT,
|
|
51
50
|
psButtonDisabled: false,
|
|
52
51
|
size: 'md',
|
|
53
52
|
usAccept: 'image/*',
|
|
54
53
|
usDisabled: false,
|
|
55
54
|
usLabel: ''
|
|
56
|
-
}
|
|
55
|
+
};
|
|
57
56
|
dragCounter = 0;
|
|
58
57
|
timeouts = 0;
|
|
59
58
|
constructor(props) {
|
|
@@ -125,40 +124,6 @@ class Upload extends React.Component {
|
|
|
125
124
|
await this.fileDropped(event.dataTransfer.files[0]);
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
|
-
onAnimationCompleted = async status => {
|
|
129
|
-
const {
|
|
130
|
-
response,
|
|
131
|
-
isProcessing,
|
|
132
|
-
fileName
|
|
133
|
-
} = this.state;
|
|
134
|
-
const {
|
|
135
|
-
animationDelay
|
|
136
|
-
} = this.props;
|
|
137
|
-
if (isProcessing && status === 'succeeded') {
|
|
138
|
-
const {
|
|
139
|
-
onSuccess
|
|
140
|
-
} = this.props;
|
|
141
|
-
this.timeouts = window.setTimeout(() => {
|
|
142
|
-
this.setState({
|
|
143
|
-
isProcessing: false,
|
|
144
|
-
isComplete: true
|
|
145
|
-
}, onSuccess ? () => {
|
|
146
|
-
onSuccess(response, fileName);
|
|
147
|
-
} : undefined);
|
|
148
|
-
}, animationDelay);
|
|
149
|
-
}
|
|
150
|
-
if (isProcessing && status === 'failed') {
|
|
151
|
-
const {
|
|
152
|
-
onFailure
|
|
153
|
-
} = this.props;
|
|
154
|
-
this.timeouts = window.setTimeout(() => {
|
|
155
|
-
this.setState({
|
|
156
|
-
isProcessing: false,
|
|
157
|
-
isComplete: true
|
|
158
|
-
}, onFailure ? () => onFailure(response) : undefined);
|
|
159
|
-
}, animationDelay);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
127
|
asyncPost = async file => {
|
|
163
128
|
const {
|
|
164
129
|
httpOptions,
|
|
@@ -176,15 +141,35 @@ class Upload extends React.Component {
|
|
|
176
141
|
Object.keys(data).forEach(key => formData.append(key, data[key]));
|
|
177
142
|
return postData.postData(httpOptions, formData, fetcher);
|
|
178
143
|
};
|
|
179
|
-
|
|
180
|
-
|
|
144
|
+
handleUploadComplete = (type, response) => {
|
|
145
|
+
const {
|
|
146
|
+
animationDelay,
|
|
147
|
+
onSuccess,
|
|
148
|
+
onFailure
|
|
149
|
+
} = this.props;
|
|
150
|
+
const {
|
|
151
|
+
fileName
|
|
152
|
+
} = this.state;
|
|
153
|
+
window.clearTimeout(this.timeouts);
|
|
181
154
|
this.timeouts = window.setTimeout(() => {
|
|
182
155
|
this.setState({
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
156
|
+
isProcessing: false,
|
|
157
|
+
isComplete: true
|
|
158
|
+
}, () => {
|
|
159
|
+
if (type === 'success') {
|
|
160
|
+
onSuccess?.(response, fileName);
|
|
161
|
+
} else {
|
|
162
|
+
onFailure?.(response);
|
|
163
|
+
}
|
|
186
164
|
});
|
|
187
|
-
},
|
|
165
|
+
}, animationDelay);
|
|
166
|
+
};
|
|
167
|
+
asyncResponse = (response, type) => {
|
|
168
|
+
this.setState({
|
|
169
|
+
response,
|
|
170
|
+
isError: type === 'error',
|
|
171
|
+
isSuccess: type === 'success'
|
|
172
|
+
}, () => this.handleUploadComplete(type, response));
|
|
188
173
|
};
|
|
189
174
|
handleOnClear = event => {
|
|
190
175
|
event.preventDefault();
|
|
@@ -369,7 +354,6 @@ class Upload extends React.Component {
|
|
|
369
354
|
psButtonText: psButtonText || intl.formatMessage(Upload_messages.default.psButtonText),
|
|
370
355
|
psProcessingText: psProcessingText || intl.formatMessage(Upload_messages.default.psProcessingText),
|
|
371
356
|
psButtonDisabled: psButtonDisabled,
|
|
372
|
-
onAnimationCompleted: async status => this.onAnimationCompleted(status),
|
|
373
357
|
onClear: event => this.handleOnClear(event)
|
|
374
358
|
}), !isProcessing && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
375
359
|
className: "droppable-dropping-card droppable-card",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Upload.js","sources":["../../src/upload/Upload.tsx"],"sourcesContent":["import { Plus as PlusIcon } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { Component } from 'react';\nimport { injectIntl, WrappedComponentProps } from 'react-intl';\n\nimport { Size, Typography } from '../common';\nimport Title from '../title';\n\nimport messages from './Upload.messages';\nimport { UploadImageStep, ProcessingStep, CompleteStep } from './steps';\nimport { postData, asyncFileRead, isSizeValid, isTypeValid, getFileType } from './utils';\nimport { PostDataFetcher, PostDataHTTPOptions, ResponseError } from './utils/postData/postData';\nimport { ProcessIndicatorStatus } from '../processIndicator';\n\n/*\n * This delay is required for the isError/isSuccess to be fired after isProcessing so the processIndicator, will be\n * rendered first and then updated with the right status.\n */\nconst ANIMATION_FIX = 10;\nexport const MAX_SIZE_DEFAULT = 5000000;\n\nexport enum UploadStep {\n UPLOAD_IMAGE_STEP = 'uploadImageStep',\n}\n\nexport interface UploadProps extends WrappedComponentProps {\n animationDelay?: number;\n csButtonText?: string;\n csFailureText?: string;\n csSuccessText?: string;\n csTooLargeMessage?: string;\n csWrongTypeMessage?: string;\n httpOptions?: PostDataHTTPOptions & {\n fileInputName?: string;\n data?: Record<string, string | Blob>;\n };\n /**\n * You can provide a fetcher function with the same interface as the global fetch function, which is used by default.\n * function fetcher(input: RequestInfo, init?: RequestInit): Promise<Response>\n */\n fetcher?: PostDataFetcher;\n maxSize?: number;\n psButtonText?: string;\n psButtonDisabled?: boolean;\n psProcessingText?: string;\n size?: `${Size.SMALL | Size.MEDIUM | Size.LARGE}`;\n /**\n * You can provide multiple rules separated by comma, e.g.: \"application/pdf,image/*\".\n * Using \"*\" will allow every file type to be uploaded.\n */\n usAccept?: string;\n usButtonText?: string;\n usButtonRetryText?: string;\n usDisabled?: boolean;\n usDropMessage?: string;\n usHelpImage?: React.ReactNode;\n usLabel?: string;\n usPlaceholder?: string;\n /**\n * Override for the [InlineAlert icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n errorIconLabel?: string;\n /** @deprecated Only a single variant exists, please remove this prop. */\n uploadStep?: `${UploadStep}`;\n onCancel?: () => void;\n onFailure?: (error: unknown) => void;\n onStart?: (file: File) => void;\n onSuccess?: (response: string | Response, fileName: string) => void;\n}\n\ninterface UploadState {\n fileName: string;\n isDroppable: boolean;\n isComplete: boolean;\n isError: boolean;\n isImage: boolean;\n isProcessing: boolean;\n isSuccess: boolean;\n response: unknown;\n uploadedImage: string | undefined;\n}\n\nexport class Upload extends Component<UploadProps, UploadState> {\n declare props: UploadProps & Required<Pick<UploadProps, keyof typeof Upload.defaultProps>>;\n\n static defaultProps = {\n animationDelay: 700,\n maxSize: MAX_SIZE_DEFAULT,\n psButtonDisabled: false,\n size: 'md',\n usAccept: 'image/*',\n usDisabled: false,\n usLabel: '',\n } satisfies Partial<UploadProps>;\n\n dragCounter = 0;\n timeouts = 0;\n\n constructor(props: UploadProps) {\n super(props);\n\n this.state = {\n fileName: '',\n isDroppable: false,\n isComplete: false,\n isError: false,\n isImage: false,\n isProcessing: false,\n isSuccess: false,\n response: undefined,\n uploadedImage: undefined,\n };\n }\n\n getErrorMessage(status?: number) {\n const { csFailureText, csTooLargeMessage, csWrongTypeMessage, maxSize, intl } = this.props;\n switch (status) {\n case 413:\n return (\n csTooLargeMessage ||\n intl.formatMessage(messages.csTooLargeMessage, {\n maxSize: roundFileSize(maxSize),\n })\n );\n case 415:\n return csWrongTypeMessage || intl.formatMessage(messages.csWrongTypeMessage);\n default:\n return csFailureText || intl.formatMessage(messages.csFailureText);\n }\n }\n\n onDragLeave(event: React.DragEvent<HTMLDivElement>) {\n event.preventDefault();\n this.dragCounter -= 1;\n if (this.dragCounter === 0) {\n this.setState({ isDroppable: false });\n }\n }\n\n onDragEnter(event: React.DragEvent<HTMLDivElement>) {\n event.preventDefault();\n this.dragCounter += 1;\n const { usDisabled } = this.props;\n const { isProcessing } = this.state;\n if (this.dragCounter === 1 && !usDisabled && !isProcessing) {\n this.setState({ isDroppable: true });\n }\n }\n\n async onDrop(event: React.DragEvent<HTMLDivElement>) {\n const { isProcessing } = this.state;\n event.preventDefault();\n if (!isProcessing) {\n this.reset();\n }\n\n if (event.dataTransfer?.files?.[0]) {\n await this.fileDropped(event.dataTransfer.files[0]);\n }\n }\n\n onAnimationCompleted = async (status: ProcessIndicatorStatus) => {\n const { response, isProcessing, fileName } = this.state;\n const { animationDelay } = this.props;\n\n if (isProcessing && status === 'succeeded') {\n const { onSuccess } = this.props;\n this.timeouts = window.setTimeout(() => {\n this.setState(\n {\n isProcessing: false,\n isComplete: true,\n },\n onSuccess\n ? () => {\n onSuccess(response as string | Response, fileName);\n }\n : undefined,\n );\n }, animationDelay);\n }\n\n if (isProcessing && status === 'failed') {\n const { onFailure } = this.props;\n this.timeouts = window.setTimeout(() => {\n this.setState(\n {\n isProcessing: false,\n isComplete: true,\n },\n onFailure ? () => onFailure(response) : undefined,\n );\n }, animationDelay);\n }\n };\n\n asyncPost = async (file: File) => {\n const { httpOptions, fetcher } = this.props;\n if (httpOptions == null) {\n throw new Error('Cannot find HTTP options');\n }\n\n const { fileInputName = file.name, data = {} } = httpOptions;\n\n const formData = new FormData();\n formData.append(fileInputName, file);\n Object.keys(data).forEach((key) => formData.append(key, data[key]));\n return postData(httpOptions, formData, fetcher);\n };\n\n asyncResponse = (response: unknown, type: 'success' | 'error') => {\n // Gives time to the animation callback to fire.\n this.timeouts = window.setTimeout(() => {\n this.setState({\n response,\n isError: type === 'error',\n isSuccess: type === 'success',\n });\n }, ANIMATION_FIX);\n };\n\n handleOnClear: React.MouseEventHandler<HTMLButtonElement> = (event) => {\n event.preventDefault();\n const { onCancel } = this.props;\n onCancel?.();\n\n this.reset();\n };\n\n reset = () => {\n this.dragCounter = 0;\n window.clearTimeout(this.timeouts);\n this.setState({\n isComplete: false,\n isError: false,\n isProcessing: false,\n isSuccess: false,\n });\n };\n\n showDataImage = (dataUrl: string) => {\n const { isImage } = this.state;\n if (isImage) {\n this.setState({\n uploadedImage: dataUrl,\n });\n }\n };\n\n fileDropped = async (file: File) => {\n const { httpOptions, maxSize, onStart, usDisabled, usAccept } = this.props;\n const { isProcessing } = this.state;\n\n if (usDisabled || isProcessing) {\n return false;\n }\n\n if (!file) {\n throw new Error('Could not retrieve file');\n }\n\n this.setState({\n fileName: file.name,\n isDroppable: false,\n isProcessing: true,\n });\n\n onStart?.(file);\n\n let file64 = null;\n\n try {\n file64 = await asyncFileRead(file);\n } catch (error) {\n this.asyncResponse(error, 'error');\n }\n\n if (!file64) {\n return false;\n }\n\n this.setState({\n isImage: getFileType(file, file64).includes('image'),\n });\n\n if (!isTypeValid(file, usAccept, file64)) {\n this.asyncResponse(\n new ResponseError(\n new Response(null, {\n status: 415,\n statusText: 'Unsupported Media Type',\n }),\n ),\n 'error',\n );\n return false;\n }\n\n if (!isSizeValid(file, maxSize)) {\n this.asyncResponse(\n new ResponseError(\n new Response(null, {\n status: 413,\n statusText: 'Request Entity Too Large',\n }),\n ),\n 'error',\n );\n return false;\n }\n\n if (httpOptions) {\n // Post the file to provided endpoint\n let response;\n try {\n response = await this.asyncPost(file);\n } catch (error) {\n this.asyncResponse(error, 'error');\n return false;\n }\n this.asyncResponse(response, 'success');\n this.showDataImage(file64);\n return true;\n }\n // Post on form submit. And return the encoded image.\n this.showDataImage(file64);\n this.asyncResponse(file64, 'success');\n return true;\n };\n\n render() {\n const {\n maxSize,\n usDropMessage,\n usAccept,\n usButtonText,\n usButtonRetryText,\n usDisabled,\n usHelpImage,\n usLabel,\n usPlaceholder,\n psButtonText,\n psProcessingText,\n psButtonDisabled,\n csButtonText,\n csSuccessText,\n size,\n intl,\n errorIconLabel,\n } = this.props;\n\n const {\n response,\n fileName,\n isComplete,\n isDroppable,\n isError,\n isImage,\n isProcessing,\n isSuccess,\n uploadedImage,\n } = this.state;\n\n return (\n <div\n className={clsx('droppable-area', {\n droppable: true,\n 'tw-droppable-sm droppable-sm': size === 'sm',\n 'tw-droppable-md droppable-md': size === 'md' || !size,\n 'tw-droppable-lg droppable-lg': size === 'lg',\n 'droppable-dropping': isDroppable,\n 'droppable-processing': isProcessing,\n 'droppable-complete': isComplete && !isError,\n 'droppable-negative': isError && !isProcessing,\n })}\n onDragEnter={(event) => this.onDragEnter(event)}\n onDragLeave={(event) => this.onDragLeave(event)}\n onDrop={async (event) => this.onDrop(event)}\n onDragOver={(event) => event.preventDefault()}\n >\n {!isProcessing && !isComplete && (\n <UploadImageStep\n fileDropped={async (file) => this.fileDropped(file)}\n isComplete={isComplete}\n usAccept={usAccept}\n usButtonText={usButtonText || intl.formatMessage(messages.usButtonText)}\n usDisabled={usDisabled}\n usHelpImage={usHelpImage}\n usLabel={usLabel}\n usPlaceholder={\n usPlaceholder ||\n intl.formatMessage(messages.usPlaceholder, { maxSize: roundFileSize(maxSize) })\n }\n />\n )}\n\n {/* Starts render the step when isSuccess is true so markup is there when css transition kicks in\n css transition to work properly */}\n {(isSuccess || isComplete) && !isError && (\n <CompleteStep\n fileName={fileName}\n isComplete={isComplete}\n isImage={isImage}\n csButtonText={csButtonText || intl.formatMessage(messages.csButtonText)}\n csSuccessText={csSuccessText || intl.formatMessage(messages.csSuccessText)}\n uploadedImage={uploadedImage}\n onClear={(event) => this.handleOnClear(event)}\n />\n )}\n {isError && !isProcessing && (\n <UploadImageStep\n fileDropped={async (file) => {\n this.reset();\n await this.fileDropped(file);\n }}\n isComplete={!isError}\n usAccept={usAccept}\n usButtonText={usButtonRetryText || intl.formatMessage(messages.retry)}\n usDisabled={usDisabled}\n usHelpImage={null}\n usLabel={usLabel}\n usPlaceholder={\n usPlaceholder ||\n intl.formatMessage(messages.usPlaceholder, { maxSize: roundFileSize(maxSize) })\n }\n errorMessage={this.getErrorMessage(\n response != null &&\n typeof response === 'object' &&\n 'status' in response &&\n typeof response.status === 'number'\n ? response.status\n : undefined,\n )}\n errorIconLabel={errorIconLabel}\n />\n )}\n {isProcessing && (\n <ProcessingStep\n isComplete={isComplete}\n isError={isError}\n isSuccess={isSuccess}\n psButtonText={psButtonText || intl.formatMessage(messages.psButtonText)}\n psProcessingText={psProcessingText || intl.formatMessage(messages.psProcessingText)}\n psButtonDisabled={psButtonDisabled}\n onAnimationCompleted={async (status) => this.onAnimationCompleted(status)}\n onClear={(event) => this.handleOnClear(event)}\n />\n )}\n {!isProcessing && (\n <div className=\"droppable-dropping-card droppable-card\" aria-live=\"polite\">\n <div className=\"droppable-card-content\">\n <div className=\"circle circle-sm text-primary\">\n <PlusIcon size=\"16\" />\n </div>\n <Title type={Typography.TITLE_BODY} className=\"m-t-3\">\n {usDropMessage || intl.formatMessage(messages.usDropMessage)}\n </Title>\n </div>\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default injectIntl(Upload);\n\nconst roundFileSize = (bytes: number) => {\n const megabytes = bytes / 1000000;\n if (megabytes >= 0.1) {\n const isRound = Math.floor(megabytes) === megabytes;\n return isRound ? `${megabytes}` : megabytes.toFixed(1);\n }\n if (megabytes >= 0.01) {\n return megabytes.toFixed(2);\n }\n return megabytes.toFixed(3);\n};\n"],"names":["ANIMATION_FIX","MAX_SIZE_DEFAULT","UploadStep","Upload","Component","defaultProps","animationDelay","maxSize","psButtonDisabled","size","usAccept","usDisabled","usLabel","dragCounter","timeouts","constructor","props","state","fileName","isDroppable","isComplete","isError","isImage","isProcessing","isSuccess","response","undefined","uploadedImage","getErrorMessage","status","csFailureText","csTooLargeMessage","csWrongTypeMessage","intl","formatMessage","messages","roundFileSize","onDragLeave","event","preventDefault","setState","onDragEnter","onDrop","reset","dataTransfer","files","fileDropped","onAnimationCompleted","onSuccess","window","setTimeout","onFailure","asyncPost","file","httpOptions","fetcher","Error","fileInputName","name","data","formData","FormData","append","Object","keys","forEach","key","postData","asyncResponse","type","handleOnClear","onCancel","clearTimeout","showDataImage","dataUrl","onStart","file64","asyncFileRead","error","getFileType","includes","isTypeValid","ResponseError","Response","statusText","isSizeValid","render","usDropMessage","usButtonText","usButtonRetryText","usHelpImage","usPlaceholder","psButtonText","psProcessingText","csButtonText","csSuccessText","errorIconLabel","_jsxs","className","clsx","droppable","onDragOver","children","_jsx","UploadImageStep","CompleteStep","onClear","retry","errorMessage","ProcessingStep","PlusIcon","Title","Typography","TITLE_BODY","injectIntl","bytes","megabytes","isRound","Math","floor","toFixed"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAMA,aAAa,GAAG,EAAE;AACjB,MAAMC,gBAAgB,GAAG;AAEpBC;AAAZ,CAAA,UAAYA,UAAU,EAAA;AACpBA,EAAAA,UAAA,CAAA,mBAAA,CAAA,GAAA,iBAAqC;AACvC,CAAC,EAFWA,kBAAU,KAAVA,kBAAU,GAErB,EAAA,CAAA,CAAA;AA4DK,MAAOC,MAAO,SAAQC,eAAmC,CAAA;AAG7D,EAAA,OAAOC,YAAY,GAAG,CAAA,OAAA;AACpBC,IAAAA,cAAc,EAAE,GAAG;AACnBC,IAAAA,OAAO,EAAEN,gBAAgB;AACzBO,IAAAA,gBAAgB,EAAE,KAAK;AACvBC,IAAAA,IAAI,EAAE,IAAI;AACVC,IAAAA,QAAQ,EAAE,SAAS;AACnBC,IAAAA,UAAU,EAAE,KAAK;AACjBC,IAAAA,OAAO,EAAE;GACqB,CAAA,GAAA;AAEhCC,EAAAA,WAAW,GAAG,CAAC;AACfC,EAAAA,QAAQ,GAAG,CAAC;EAEZC,WAAAA,CAAYC,KAAkB,EAAA;IAC5B,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,KAAK,GAAG;AACXC,MAAA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jC,IAAIC,SAAS,IAAI,GAAG,EAAE;IACpB,MAAMC,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,SAAS,CAAC,KAAKA,SAAS;IACnD,OAAOC,OAAO,GAAG,CAAA,EAAGD,SAAS,CAAA,CAAE,GAAGA,SAAS,CAACI,OAAO,CAAC,CAAC,CAAC;AACxD;EACA,IAAIJ,SAAS,IAAI,IAAI,EAAE;AACrB,IAAA,OAAOA,SAAS,CAACI,OAAO,CAAC,CAAC,CAAC;AAC7B;AACA,EAAA,OAAOJ,SAAS,CAACI,OAAO,CAAC,CAAC,CAAC;AAC7B,CAAC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Upload.js","sources":["../../src/upload/Upload.tsx"],"sourcesContent":["import { Plus as PlusIcon } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { Component } from 'react';\nimport { injectIntl, WrappedComponentProps } from 'react-intl';\n\nimport { Size, Typography } from '../common';\nimport Title from '../title';\n\nimport messages from './Upload.messages';\nimport { UploadImageStep, ProcessingStep, CompleteStep } from './steps';\nimport { postData, asyncFileRead, isSizeValid, isTypeValid, getFileType } from './utils';\nimport { PostDataFetcher, PostDataHTTPOptions, ResponseError } from './utils/postData/postData';\nimport { ProcessIndicatorStatus } from '../processIndicator';\n\nexport const MAX_SIZE_DEFAULT = 5000000;\n\nexport enum UploadStep {\n UPLOAD_IMAGE_STEP = 'uploadImageStep',\n}\n\nexport interface UploadProps extends WrappedComponentProps {\n animationDelay?: number;\n csButtonText?: string;\n csFailureText?: string;\n csSuccessText?: string;\n csTooLargeMessage?: string;\n csWrongTypeMessage?: string;\n httpOptions?: PostDataHTTPOptions & {\n fileInputName?: string;\n data?: Record<string, string | Blob>;\n };\n /**\n * You can provide a fetcher function with the same interface as the global fetch function, which is used by default.\n * function fetcher(input: RequestInfo, init?: RequestInit): Promise<Response>\n */\n fetcher?: PostDataFetcher;\n maxSize?: number;\n psButtonText?: string;\n psButtonDisabled?: boolean;\n psProcessingText?: string;\n size?: `${Size.SMALL | Size.MEDIUM | Size.LARGE}`;\n /**\n * You can provide multiple rules separated by comma, e.g.: \"application/pdf,image/*\".\n * Using \"*\" will allow every file type to be uploaded.\n */\n usAccept?: string;\n usButtonText?: string;\n usButtonRetryText?: string;\n usDisabled?: boolean;\n usDropMessage?: string;\n usHelpImage?: React.ReactNode;\n usLabel?: string;\n usPlaceholder?: string;\n /**\n * Override for the [InlineAlert icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n errorIconLabel?: string;\n /** @deprecated Only a single variant exists, please remove this prop. */\n uploadStep?: `${UploadStep}`;\n onCancel?: () => void;\n onFailure?: (error: unknown) => void;\n onStart?: (file: File) => void;\n onSuccess?: (response: string | Response, fileName: string) => void;\n}\n\ninterface UploadState {\n fileName: string;\n isDroppable: boolean;\n isComplete: boolean;\n isError: boolean;\n isImage: boolean;\n isProcessing: boolean;\n isSuccess: boolean;\n response: unknown;\n uploadedImage: string | undefined;\n}\n\nexport class Upload extends Component<UploadProps, UploadState> {\n declare props: UploadProps & Required<Pick<UploadProps, keyof typeof Upload.defaultProps>>;\n\n static defaultProps = {\n animationDelay: 300,\n maxSize: MAX_SIZE_DEFAULT,\n psButtonDisabled: false,\n size: 'md',\n usAccept: 'image/*',\n usDisabled: false,\n usLabel: '',\n } satisfies Partial<UploadProps>;\n\n dragCounter = 0;\n timeouts = 0;\n\n constructor(props: UploadProps) {\n super(props);\n\n this.state = {\n fileName: '',\n isDroppable: false,\n isComplete: false,\n isError: false,\n isImage: false,\n isProcessing: false,\n isSuccess: false,\n response: undefined,\n uploadedImage: undefined,\n };\n }\n\n getErrorMessage(status?: number) {\n const { csFailureText, csTooLargeMessage, csWrongTypeMessage, maxSize, intl } = this.props;\n switch (status) {\n case 413:\n return (\n csTooLargeMessage ||\n intl.formatMessage(messages.csTooLargeMessage, {\n maxSize: roundFileSize(maxSize),\n })\n );\n case 415:\n return csWrongTypeMessage || intl.formatMessage(messages.csWrongTypeMessage);\n default:\n return csFailureText || intl.formatMessage(messages.csFailureText);\n }\n }\n\n onDragLeave(event: React.DragEvent<HTMLDivElement>) {\n event.preventDefault();\n this.dragCounter -= 1;\n if (this.dragCounter === 0) {\n this.setState({ isDroppable: false });\n }\n }\n\n onDragEnter(event: React.DragEvent<HTMLDivElement>) {\n event.preventDefault();\n this.dragCounter += 1;\n const { usDisabled } = this.props;\n const { isProcessing } = this.state;\n if (this.dragCounter === 1 && !usDisabled && !isProcessing) {\n this.setState({ isDroppable: true });\n }\n }\n\n async onDrop(event: React.DragEvent<HTMLDivElement>) {\n const { isProcessing } = this.state;\n event.preventDefault();\n if (!isProcessing) {\n this.reset();\n }\n\n if (event.dataTransfer?.files?.[0]) {\n await this.fileDropped(event.dataTransfer.files[0]);\n }\n }\n\n asyncPost = async (file: File) => {\n const { httpOptions, fetcher } = this.props;\n if (httpOptions == null) {\n throw new Error('Cannot find HTTP options');\n }\n\n const { fileInputName = file.name, data = {} } = httpOptions;\n\n const formData = new FormData();\n formData.append(fileInputName, file);\n Object.keys(data).forEach((key) => formData.append(key, data[key]));\n return postData(httpOptions, formData, fetcher);\n };\n\n handleUploadComplete = (type: 'success' | 'error', response: unknown) => {\n const { animationDelay, onSuccess, onFailure } = this.props;\n const { fileName } = this.state;\n\n window.clearTimeout(this.timeouts);\n this.timeouts = window.setTimeout(() => {\n this.setState(\n {\n isProcessing: false,\n isComplete: true,\n },\n () => {\n if (type === 'success') {\n onSuccess?.(response as string | Response, fileName);\n } else {\n onFailure?.(response);\n }\n },\n );\n }, animationDelay);\n };\n\n asyncResponse = (response: unknown, type: 'success' | 'error') => {\n this.setState(\n {\n response,\n isError: type === 'error',\n isSuccess: type === 'success',\n },\n () => this.handleUploadComplete(type, response),\n );\n };\n\n handleOnClear: React.MouseEventHandler<HTMLButtonElement> = (event) => {\n event.preventDefault();\n const { onCancel } = this.props;\n onCancel?.();\n\n this.reset();\n };\n\n reset = () => {\n this.dragCounter = 0;\n window.clearTimeout(this.timeouts);\n this.setState({\n isComplete: false,\n isError: false,\n isProcessing: false,\n isSuccess: false,\n });\n };\n\n showDataImage = (dataUrl: string) => {\n const { isImage } = this.state;\n if (isImage) {\n this.setState({\n uploadedImage: dataUrl,\n });\n }\n };\n\n fileDropped = async (file: File) => {\n const { httpOptions, maxSize, onStart, usDisabled, usAccept } = this.props;\n const { isProcessing } = this.state;\n\n if (usDisabled || isProcessing) {\n return false;\n }\n\n if (!file) {\n throw new Error('Could not retrieve file');\n }\n\n this.setState({\n fileName: file.name,\n isDroppable: false,\n isProcessing: true,\n });\n\n onStart?.(file);\n\n let file64 = null;\n\n try {\n file64 = await asyncFileRead(file);\n } catch (error) {\n this.asyncResponse(error, 'error');\n }\n\n if (!file64) {\n return false;\n }\n\n this.setState({\n isImage: getFileType(file, file64).includes('image'),\n });\n\n if (!isTypeValid(file, usAccept, file64)) {\n this.asyncResponse(\n new ResponseError(\n new Response(null, {\n status: 415,\n statusText: 'Unsupported Media Type',\n }),\n ),\n 'error',\n );\n return false;\n }\n\n if (!isSizeValid(file, maxSize)) {\n this.asyncResponse(\n new ResponseError(\n new Response(null, {\n status: 413,\n statusText: 'Request Entity Too Large',\n }),\n ),\n 'error',\n );\n return false;\n }\n\n if (httpOptions) {\n // Post the file to provided endpoint\n let response;\n try {\n response = await this.asyncPost(file);\n } catch (error) {\n this.asyncResponse(error, 'error');\n return false;\n }\n this.asyncResponse(response, 'success');\n this.showDataImage(file64);\n return true;\n }\n // Post on form submit. And return the encoded image.\n this.showDataImage(file64);\n this.asyncResponse(file64, 'success');\n return true;\n };\n\n render() {\n const {\n maxSize,\n usDropMessage,\n usAccept,\n usButtonText,\n usButtonRetryText,\n usDisabled,\n usHelpImage,\n usLabel,\n usPlaceholder,\n psButtonText,\n psProcessingText,\n psButtonDisabled,\n csButtonText,\n csSuccessText,\n size,\n intl,\n errorIconLabel,\n } = this.props;\n\n const {\n response,\n fileName,\n isComplete,\n isDroppable,\n isError,\n isImage,\n isProcessing,\n isSuccess,\n uploadedImage,\n } = this.state;\n\n return (\n <div\n className={clsx('droppable-area', {\n droppable: true,\n 'tw-droppable-sm droppable-sm': size === 'sm',\n 'tw-droppable-md droppable-md': size === 'md' || !size,\n 'tw-droppable-lg droppable-lg': size === 'lg',\n 'droppable-dropping': isDroppable,\n 'droppable-processing': isProcessing,\n 'droppable-complete': isComplete && !isError,\n 'droppable-negative': isError && !isProcessing,\n })}\n onDragEnter={(event) => this.onDragEnter(event)}\n onDragLeave={(event) => this.onDragLeave(event)}\n onDrop={async (event) => this.onDrop(event)}\n onDragOver={(event) => event.preventDefault()}\n >\n {!isProcessing && !isComplete && (\n <UploadImageStep\n fileDropped={async (file) => this.fileDropped(file)}\n isComplete={isComplete}\n usAccept={usAccept}\n usButtonText={usButtonText || intl.formatMessage(messages.usButtonText)}\n usDisabled={usDisabled}\n usHelpImage={usHelpImage}\n usLabel={usLabel}\n usPlaceholder={\n usPlaceholder ||\n intl.formatMessage(messages.usPlaceholder, { maxSize: roundFileSize(maxSize) })\n }\n />\n )}\n\n {(isSuccess || isComplete) && !isError && (\n <CompleteStep\n fileName={fileName}\n isComplete={isComplete}\n isImage={isImage}\n csButtonText={csButtonText || intl.formatMessage(messages.csButtonText)}\n csSuccessText={csSuccessText || intl.formatMessage(messages.csSuccessText)}\n uploadedImage={uploadedImage}\n onClear={(event) => this.handleOnClear(event)}\n />\n )}\n {isError && !isProcessing && (\n <UploadImageStep\n fileDropped={async (file) => {\n this.reset();\n await this.fileDropped(file);\n }}\n isComplete={!isError}\n usAccept={usAccept}\n usButtonText={usButtonRetryText || intl.formatMessage(messages.retry)}\n usDisabled={usDisabled}\n usHelpImage={null}\n usLabel={usLabel}\n usPlaceholder={\n usPlaceholder ||\n intl.formatMessage(messages.usPlaceholder, { maxSize: roundFileSize(maxSize) })\n }\n errorMessage={this.getErrorMessage(\n response != null &&\n typeof response === 'object' &&\n 'status' in response &&\n typeof response.status === 'number'\n ? response.status\n : undefined,\n )}\n errorIconLabel={errorIconLabel}\n />\n )}\n {isProcessing && (\n <ProcessingStep\n isComplete={isComplete}\n isError={isError}\n isSuccess={isSuccess}\n psButtonText={psButtonText || intl.formatMessage(messages.psButtonText)}\n psProcessingText={psProcessingText || intl.formatMessage(messages.psProcessingText)}\n psButtonDisabled={psButtonDisabled}\n onClear={(event) => this.handleOnClear(event)}\n />\n )}\n {!isProcessing && (\n <div className=\"droppable-dropping-card droppable-card\" aria-live=\"polite\">\n <div className=\"droppable-card-content\">\n <div className=\"circle circle-sm text-primary\">\n <PlusIcon size=\"16\" />\n </div>\n <Title type={Typography.TITLE_BODY} className=\"m-t-3\">\n {usDropMessage || intl.formatMessage(messages.usDropMessage)}\n </Title>\n </div>\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default injectIntl(Upload);\n\nconst roundFileSize = (bytes: number) => {\n const megabytes = bytes / 1000000;\n if (megabytes >= 0.1) {\n const isRound = Math.floor(megabytes) === megabytes;\n return isRound ? `${megabytes}` : megabytes.toFixed(1);\n }\n if (megabytes >= 0.01) {\n return megabytes.toFixed(2);\n }\n return megabytes.toFixed(3);\n};\n"],"names":["MAX_SIZE_DEFAULT","UploadStep","Upload","Component","defaultProps","animationDelay","maxSize","psButtonDisabled","size","usAccept","usDisabled","usLabel","dragCounter","timeouts","constructor","props","state","fileName","isDroppable","isComplete","isError","isImage","isProcessing","isSuccess","response","undefined","uploadedImage","getErrorMessage","status","csFailureText","csTooLargeMessage","csWrongTypeMessage","intl","formatMessage","messages","roundFileSize","onDragLeave","event","preventDefault","setState","onDragEnter","onDrop","reset","dataTransfer","files","fileDropped","asyncPost","file","httpOptions","fetcher","Error","fileInputName","name","data","formData","FormData","append","Object","keys","forEach","key","postData","handleUploadComplete","type","onSuccess","onFailure","window","clearTimeout","setTimeout","asyncResponse","handleOnClear","onCancel","showDataImage","dataUrl","onStart","file64","asyncFileRead","error","getFileType","includes","isTypeValid","ResponseError","Response","statusText","isSizeValid","render","usDropMessage","usButtonText","usButtonRetryText","usHelpImage","usPlaceholder","psButtonText","psProcessingText","csButtonText","csSuccessText","errorIconLabel","_jsxs","className","clsx","droppable","onDragOver","children","_jsx","UploadImageStep","CompleteStep","onClear","retry","errorMessage","ProcessingStep","PlusIcon","Title","Typography","TITLE_BODY","injectIntl","bytes","megabytes","isRound","Math","floor","toFixed"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcO,MAAMA,gBAAgB,GAAG;AAEpBC;AAAZ,CAAA,UAAYA,UAAU,EAAA;AACpBA,EAAAA,UAAA,CAAA,mBAAA,CAAA,GAAA,iBAAqC;AACvC,CAAC,EAFWA,kBAAU,KAAVA,kBAAU,GAErB,EAAA,CAAA,CAAA;AA4DK,MAAOC,MAAO,SAAQC,eAAmC,CAAA;AAG7D,EAAA,OAAOC,YAAY,GAAG;AACpBC,IAAAA,cAAc,EAAE,GAAG;AACnBC,IAAAA,OAAO,EAAEN,gBAAgB;AACzBO,IAAAA,gBAAgB,EAAE,KAAK;AACvBC,IAAAA,IAAI,EAAE,IAAI;AACVC,IAAAA,QAAQ,EAAE,SAAS;AACnBC,IAAAA,UAAU,EAAE,KAAK;AACjBC,IAAAA,OAAO,EAAE;GACqB;AAEhCC,EAAAA,WAAW,GAAG,CAAC;AACfC,EAAAA,QAAQ,GAAG,CAAC;EAEZC,WAAAA,CAAYC,KAAkB,EAAA;IAC5B,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,KAAK,GAAG;AACXC,MAAAA,QAAQ,EAAE,EAAE;AACZC,MAAAA,WAAW,EAAE,KAAK;AAClBC,MAAAA,UAAU,EAAE,KAAK;AACjBC,MAAAA,OAAO,EAAE,KAAK;AACdC,MAAAA,OAAO,EAAE,KAAK;AACdC,MAAAA,YAAY,EAAE,KAAK;AACnBC,MAAAA,SAAS,EAAE,KAAK;AAChBC,MAAAA,QAAQ,EAAEC,SAAS;AACnBC,MAAAA,aAAa,EAAED;KAChB;AACH;EAEAE,eAAeA,CAACC,MAAe,EAAA;IA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AQ,EAAA;AAACrG,cAAAA,IAAI,EAAC;aACjB;AAAA,WAAK,CACL,eAAA8F,cAAA,CAACQ,aAAK,EAAA;YAAC/C,IAAI,EAAEgD,qBAAU,CAACC,UAAW;AAACf,YAAAA,SAAS,EAAC,OAAO;YAAAI,QAAA,EAClDf,aAAa,IAAItD,IAAI,CAACC,aAAa,CAACC,uBAAQ,CAACoD,aAAa;AAAC,WACvD,CACT;SAAK;AACP,OAAK,CACN;AAAA,KACE,CAAC;AAEV;;AAGF,eAAe2B,oBAAU,CAAC/G,MAAM,CAAC;AAEjC,MAAMiC,aAAa,GAAI+E,KAAa,IAAI;AACtC,EAAA,MAAMC,SAAS,GAAGD,KAAK,GAAG,OAAO;EACjC,IAAIC,SAAS,IAAI,GAAG,EAAE;IACpB,MAAMC,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,SAAS,CAAC,KAAKA,SAAS;IACnD,OAAOC,OAAO,GAAG,CAAA,EAAGD,SAAS,CAAA,CAAE,GAAGA,SAAS,CAACI,OAAO,CAAC,CAAC,CAAC;AACxD;EACA,IAAIJ,SAAS,IAAI,IAAI,EAAE;AACrB,IAAA,OAAOA,SAAS,CAACI,OAAO,CAAC,CAAC,CAAC;AAC7B;AACA,EAAA,OAAOJ,SAAS,CAACI,OAAO,CAAC,CAAC,CAAC;AAC7B,CAAC;;;;;;"}
|
package/build/upload/Upload.mjs
CHANGED
|
@@ -34,22 +34,21 @@ import { isSizeValid } from './utils/isSizeValid/isSizeValid.mjs';
|
|
|
34
34
|
import { isTypeValid } from './utils/isTypeValid/isTypeValid.mjs';
|
|
35
35
|
import { getFileType } from './utils/getFileType/getFileType.mjs';
|
|
36
36
|
|
|
37
|
-
const ANIMATION_FIX = 10;
|
|
38
37
|
const MAX_SIZE_DEFAULT = 5000000;
|
|
39
38
|
var UploadStep;
|
|
40
39
|
(function (UploadStep) {
|
|
41
40
|
UploadStep["UPLOAD_IMAGE_STEP"] = "uploadImageStep";
|
|
42
41
|
})(UploadStep || (UploadStep = {}));
|
|
43
42
|
class Upload extends Component {
|
|
44
|
-
static defaultProps =
|
|
45
|
-
animationDelay:
|
|
43
|
+
static defaultProps = {
|
|
44
|
+
animationDelay: 300,
|
|
46
45
|
maxSize: MAX_SIZE_DEFAULT,
|
|
47
46
|
psButtonDisabled: false,
|
|
48
47
|
size: 'md',
|
|
49
48
|
usAccept: 'image/*',
|
|
50
49
|
usDisabled: false,
|
|
51
50
|
usLabel: ''
|
|
52
|
-
}
|
|
51
|
+
};
|
|
53
52
|
dragCounter = 0;
|
|
54
53
|
timeouts = 0;
|
|
55
54
|
constructor(props) {
|
|
@@ -121,40 +120,6 @@ class Upload extends Component {
|
|
|
121
120
|
await this.fileDropped(event.dataTransfer.files[0]);
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
|
-
onAnimationCompleted = async status => {
|
|
125
|
-
const {
|
|
126
|
-
response,
|
|
127
|
-
isProcessing,
|
|
128
|
-
fileName
|
|
129
|
-
} = this.state;
|
|
130
|
-
const {
|
|
131
|
-
animationDelay
|
|
132
|
-
} = this.props;
|
|
133
|
-
if (isProcessing && status === 'succeeded') {
|
|
134
|
-
const {
|
|
135
|
-
onSuccess
|
|
136
|
-
} = this.props;
|
|
137
|
-
this.timeouts = window.setTimeout(() => {
|
|
138
|
-
this.setState({
|
|
139
|
-
isProcessing: false,
|
|
140
|
-
isComplete: true
|
|
141
|
-
}, onSuccess ? () => {
|
|
142
|
-
onSuccess(response, fileName);
|
|
143
|
-
} : undefined);
|
|
144
|
-
}, animationDelay);
|
|
145
|
-
}
|
|
146
|
-
if (isProcessing && status === 'failed') {
|
|
147
|
-
const {
|
|
148
|
-
onFailure
|
|
149
|
-
} = this.props;
|
|
150
|
-
this.timeouts = window.setTimeout(() => {
|
|
151
|
-
this.setState({
|
|
152
|
-
isProcessing: false,
|
|
153
|
-
isComplete: true
|
|
154
|
-
}, onFailure ? () => onFailure(response) : undefined);
|
|
155
|
-
}, animationDelay);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
123
|
asyncPost = async file => {
|
|
159
124
|
const {
|
|
160
125
|
httpOptions,
|
|
@@ -172,15 +137,35 @@ class Upload extends Component {
|
|
|
172
137
|
Object.keys(data).forEach(key => formData.append(key, data[key]));
|
|
173
138
|
return postData(httpOptions, formData, fetcher);
|
|
174
139
|
};
|
|
175
|
-
|
|
176
|
-
|
|
140
|
+
handleUploadComplete = (type, response) => {
|
|
141
|
+
const {
|
|
142
|
+
animationDelay,
|
|
143
|
+
onSuccess,
|
|
144
|
+
onFailure
|
|
145
|
+
} = this.props;
|
|
146
|
+
const {
|
|
147
|
+
fileName
|
|
148
|
+
} = this.state;
|
|
149
|
+
window.clearTimeout(this.timeouts);
|
|
177
150
|
this.timeouts = window.setTimeout(() => {
|
|
178
151
|
this.setState({
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
152
|
+
isProcessing: false,
|
|
153
|
+
isComplete: true
|
|
154
|
+
}, () => {
|
|
155
|
+
if (type === 'success') {
|
|
156
|
+
onSuccess?.(response, fileName);
|
|
157
|
+
} else {
|
|
158
|
+
onFailure?.(response);
|
|
159
|
+
}
|
|
182
160
|
});
|
|
183
|
-
},
|
|
161
|
+
}, animationDelay);
|
|
162
|
+
};
|
|
163
|
+
asyncResponse = (response, type) => {
|
|
164
|
+
this.setState({
|
|
165
|
+
response,
|
|
166
|
+
isError: type === 'error',
|
|
167
|
+
isSuccess: type === 'success'
|
|
168
|
+
}, () => this.handleUploadComplete(type, response));
|
|
184
169
|
};
|
|
185
170
|
handleOnClear = event => {
|
|
186
171
|
event.preventDefault();
|
|
@@ -365,7 +350,6 @@ class Upload extends Component {
|
|
|
365
350
|
psButtonText: psButtonText || intl.formatMessage(messages.psButtonText),
|
|
366
351
|
psProcessingText: psProcessingText || intl.formatMessage(messages.psProcessingText),
|
|
367
352
|
psButtonDisabled: psButtonDisabled,
|
|
368
|
-
onAnimationCompleted: async status => this.onAnimationCompleted(status),
|
|
369
353
|
onClear: event => this.handleOnClear(event)
|
|
370
354
|
}), !isProcessing && /*#__PURE__*/jsx("div", {
|
|
371
355
|
className: "droppable-dropping-card droppable-card",
|