@popsure/dirty-swan 0.38.3 → 0.38.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cjs/index.js +33 -1897
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/lib/components/autocompleteAddress/index.d.ts +18 -1
  4. package/dist/cjs/lib/components/autocompleteAddress/index.stories.d.ts +1 -1
  5. package/dist/cjs/lib/components/multiDropzone/UploadFileCell/index.d.ts +1 -1
  6. package/dist/cjs/lib/components/multiDropzone/index.d.ts +1 -1
  7. package/dist/esm/components/autocompleteAddress/index.js +24 -1888
  8. package/dist/esm/components/autocompleteAddress/index.js.map +1 -1
  9. package/dist/esm/components/autocompleteAddress/index.stories.js +14 -14
  10. package/dist/esm/components/autocompleteAddress/index.stories.js.map +1 -1
  11. package/dist/esm/components/cards/index.js +3 -3
  12. package/dist/esm/components/cards/index.js.map +1 -1
  13. package/dist/esm/components/multiDropzone/UploadFileCell/index.js +1 -1
  14. package/dist/esm/components/multiDropzone/index.js +2 -2
  15. package/dist/esm/components/multiDropzone/index.js.map +1 -1
  16. package/dist/esm/components/multiDropzone/index.stories.js +3 -3
  17. package/dist/esm/components/multiDropzone/index.stories.js.map +1 -1
  18. package/dist/esm/components/multiDropzone/index.test.js +1 -1
  19. package/dist/esm/{index-da10b7ad.js → index-3e39c956.js} +7 -7
  20. package/dist/esm/{index-da10b7ad.js.map → index-3e39c956.js.map} +1 -1
  21. package/dist/esm/index.js +1 -1
  22. package/dist/esm/lib/components/autocompleteAddress/index.d.ts +18 -1
  23. package/dist/esm/lib/components/autocompleteAddress/index.stories.d.ts +1 -1
  24. package/dist/esm/lib/components/multiDropzone/UploadFileCell/index.d.ts +1 -1
  25. package/dist/esm/lib/components/multiDropzone/index.d.ts +1 -1
  26. package/package.json +1 -1
  27. package/src/lib/components/autocompleteAddress/index.stories.tsx +41 -33
  28. package/src/lib/components/autocompleteAddress/index.tsx +55 -53
  29. package/src/lib/components/cards/cardWithLeftIcon/index.tsx +4 -6
  30. package/src/lib/components/cards/cardWithTopLeftIcon/index.tsx +6 -8
  31. package/src/lib/components/multiDropzone/UploadFileCell/index.tsx +15 -13
  32. package/src/lib/components/multiDropzone/UploadFileCell/style.module.scss +5 -2
  33. package/src/lib/components/multiDropzone/index.stories.tsx +2 -2
  34. package/src/lib/components/multiDropzone/index.tsx +3 -2
@@ -7,7 +7,7 @@ import '../../index-dd80248b.js';
7
7
  import '../../index-e27b50cf.js';
8
8
  import '../../index-fb46adf9.js';
9
9
  import '../../style-inject.es-1f59c1d0.js';
10
- import '../../index-da10b7ad.js';
10
+ import '../../index-3e39c956.js';
11
11
 
12
12
  var story = {
13
13
  title: 'JSX/MultiDropzone',
@@ -16,7 +16,7 @@ var story = {
16
16
  uploadedFiles: {
17
17
  defaultValue: [{
18
18
  id: '123456789',
19
- name: 'dummyfile.png'
19
+ name: 'my-code-doesnt-work-i-have-no-idea-why-my-code-works.jpg'
20
20
  }],
21
21
  description: 'List of files to be displayed on the component.',
22
22
  },
@@ -72,7 +72,7 @@ var MultiDropzoneStory = function (_a) {
72
72
  var onFileSelect = _a.onFileSelect, onRemoveFile = _a.onRemoveFile, uploading = _a.uploading, _b = _a.uploadedFiles, uploadedFiles = _b === void 0 ? [] : _b, isCondensed = _a.isCondensed, maxFiles = _a.maxFiles, maxSize = _a.maxSize, textOverrides = _a.textOverrides;
73
73
  var _c = useState(uploadedFiles), localFiles = _c[0], setLocalFiles = _c[1];
74
74
  var handleOnRemoveFile = function (id) {
75
- onRemoveFile(id);
75
+ onRemoveFile === null || onRemoveFile === void 0 ? void 0 : onRemoveFile(id);
76
76
  setLocalFiles(function (prevFiles) { return prevFiles.filter(function (file) { return file.id !== id; }); });
77
77
  };
78
78
  var handleOnFileSelect = function (files) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/multiDropzone/index.stories.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { MultiDropzone, MultiDropzoneProps } from '.';\nimport { UploadedFile } from './types';\n\nconst story = {\n title: 'JSX/MultiDropzone',\n component: MultiDropzone,\n argTypes: {\n uploadedFiles: {\n defaultValue: [{\n id: '123456789',\n name: 'dummyfile.png'\n }],\n description: 'List of files to be displayed on the component.',\n },\n uploading: {\n defaultValue: false,\n description: 'Property that allows to display component in an uploading state',\n },\n isCondensed: {\n defaultValue: false,\n description: 'Property that allows to display component in a smaller layout',\n },\n maxFiles: {\n description: 'Property that allows to display the maximum number of files allowed',\n table: {\n category: 'File Validation',\n },\n },\n maxSize: {\n description: 'Property that allows to display the maximum size of files allowed',\n table: {\n category: 'File Validation',\n },\n },\n accept: {\n description: 'Property that allows to define which file types are accepted',\n table: {\n category: 'File Validation',\n },\n },\n onRemoveFile: {\n description: 'Called when a file remove button is clicked',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n onFileSelect: {\n description: 'Called when a file is uploaded',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n textOverrides: {\n description: 'Properties that allow to localise component',\n },\n },\n parameters: {\n componentSubtitle: 'MultiDropzone component allows upload of multiple documents / files.',\n },\n};\n\nexport const MultiDropzoneStory = ({\n onFileSelect,\n onRemoveFile,\n uploading,\n uploadedFiles = [],\n isCondensed,\n maxFiles,\n maxSize,\n textOverrides,\n}: MultiDropzoneProps) => {\n const [localFiles, setLocalFiles] = useState<UploadedFile[]>(uploadedFiles);\n\n const handleOnRemoveFile = (id: string) => {\n onRemoveFile(id);\n setLocalFiles((prevFiles) => prevFiles.filter((file) => file.id !== id));\n };\n\n const handleOnFileSelect = (files: File[]) => {\n const newFiles = files.map((newFile) => ({\n id: String(new Date().getTime()),\n name: newFile.name,\n progress: 100,\n }));\n setLocalFiles((prevFiles) => [...prevFiles, ...newFiles]);\n onFileSelect(files);\n };\n\n return (\n <MultiDropzone \n onFileSelect={handleOnFileSelect} \n onRemoveFile={handleOnRemoveFile} \n uploadedFiles={localFiles} \n uploading={uploading} \n isCondensed={isCondensed}\n maxFiles={maxFiles}\n maxSize={maxSize}\n textOverrides={textOverrides}\n />\n );\n};\n\nMultiDropzoneStory.storyName = \"MultiDropzone\";\n\nexport const UploadingState = () => (\n <MultiDropzone\n uploadedFiles={[\n {\n id: '123',\n progress: 72,\n name: 'test_file_name.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name.pdf',\n },\n {\n id: '124',\n progress: 72,\n name: 'test_file_name.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name.pdf',\n showLoadingSpinner: true,\n showProgressBar: false,\n },\n {\n id: '125',\n progress: 72,\n name: 'test_file_name.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name.pdf',\n showLoadingSpinner: true,\n },\n {\n id: '456',\n progress: 100,\n name: 'test_file_name2.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name2.pdf',\n },\n ]}\n onFileSelect={() => {}}\n uploading={true}\n onRemoveFile={() => {}}\n />\n);\n\n\nexport const CondensedView = () => (\n <MultiDropzone\n uploadedFiles={[\n {\n id: '123',\n progress: 100,\n name: 'test_file_name.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name.pdf',\n },\n ]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n isCondensed\n />\n);\n\nexport const ErrorState = () => (\n <MultiDropzone\n uploadedFiles={[\n {\n id: '123',\n progress: 0,\n name: 'test_file_name.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name.pdf',\n error: 'File is too big!',\n },\n ]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n />\n);\n\nexport const AcceptingOnlyImages = () => (\n <MultiDropzone\n accept=\"image\"\n isCondensed\n uploadedFiles={[]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n />\n);\n\nexport const AcceptingOnlyDocuments = () => (\n <MultiDropzone\n accept=\"document\"\n isCondensed\n uploadedFiles={[]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n />\n);\n\nexport const LimitingFileSizeTo2MB = () => (\n <MultiDropzone\n isCondensed\n uploadedFiles={[]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n maxSize={2096000}\n />\n);\n\nexport const I18nSupport = () => (\n <MultiDropzone\n uploadedFiles={[]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n textOverrides={{\n instructionsText: 'Datei auswählen oder per Drag & Drop platzieren',\n supportsTextShort: 'Unterstützt werden',\n currentlyUploadingText:\n 'Bitte warten während die Datei hochgeladen wird...'\n }}\n />\n);\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;IAIM,KAAK,GAAG;IACZ,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE;QACR,aAAa,EAAE;YACb,YAAY,EAAE,CAAC;oBACb,EAAE,EAAE,WAAW;oBACf,IAAI,EAAE,eAAe;iBACtB,CAAC;YACF,WAAW,EAAE,iDAAiD;SAC/D;QACD,SAAS,EAAE;YACT,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,iEAAiE;SAC/E;QACD,WAAW,EAAE;YACX,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,+DAA+D;SAC7E;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,qEAAqE;YAClF,KAAK,EAAE;gBACL,QAAQ,EAAE,iBAAiB;aAC5B;SACF;QACD,OAAO,EAAE;YACP,WAAW,EAAE,mEAAmE;YAChF,KAAK,EAAE;gBACL,QAAQ,EAAE,iBAAiB;aAC5B;SACF;QACD,MAAM,EAAE;YACN,WAAW,EAAE,8DAA8D;YAC3E,KAAK,EAAE;gBACL,QAAQ,EAAE,iBAAiB;aAC5B;SACF;QACD,YAAY,EAAE;YACZ,WAAW,EAAE,6CAA6C;YAC1D,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE;gBACL,QAAQ,EAAE,WAAW;aACtB;SACF;QACD,YAAY,EAAE;YACZ,WAAW,EAAE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,QAAQ,EAAE,CAAC;YACX,IAAI,EAAE,oBAAoB;YAC1B,UAAU,EAAE,0CAA0C;YACtD,KAAK,EAAE,kBAAkB;SAC1B;KACF,EACD,YAAY,EAAE,eAAQ,EACtB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,eAAQ,WACtB,KACF;IAEW,mBAAmB,GAAG,cAAM,QACvCA,IAAC,aAAa,IACZ,MAAM,EAAC,OAAO,EACd,WAAW,QACX,aAAa,EAAE,EAAE,EACjB,YAAY,EAAE,eAAQ,EACtB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,eAAQ,WACtB,KACF;IAEW,sBAAsB,GAAG,cAAM,QAC1CA,IAAC,aAAa,IACZ,MAAM,EAAC,UAAU,EACjB,WAAW,QACX,aAAa,EAAE,EAAE,EACjB,YAAY,EAAE,eAAQ,EACtB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,eAAQ,WACtB,KACF;IAEW,qBAAqB,GAAG,cAAM,QACzCA,IAAC,aAAa,IACZ,WAAW,QACX,aAAa,EAAE,EAAE,EACjB,YAAY,EAAE,eAAQ,EACtB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,eAAQ,EACtB,OAAO,EAAE,OAAO,WAChB,KACF;IAEW,WAAW,GAAG,cAAM,QAC/BA,IAAC,aAAa,IACZ,aAAa,EAAE,EAAE,EACjB,YAAY,EAAE,eAAQ,EACtB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,eAAQ,EACtB,aAAa,EAAE;QACb,gBAAgB,EAAE,iDAAiD;QACnE,iBAAiB,EAAE,oBAAoB;QACvC,sBAAsB,EACpB,oDAAoD;KACvD,WACD;;;;;"}
1
+ {"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/multiDropzone/index.stories.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { MultiDropzone, MultiDropzoneProps } from '.';\nimport { UploadedFile } from './types';\n\nconst story = {\n title: 'JSX/MultiDropzone',\n component: MultiDropzone,\n argTypes: {\n uploadedFiles: {\n defaultValue: [{\n id: '123456789',\n name: 'my-code-doesnt-work-i-have-no-idea-why-my-code-works.jpg'\n }],\n description: 'List of files to be displayed on the component.',\n },\n uploading: {\n defaultValue: false,\n description: 'Property that allows to display component in an uploading state',\n },\n isCondensed: {\n defaultValue: false,\n description: 'Property that allows to display component in a smaller layout',\n },\n maxFiles: {\n description: 'Property that allows to display the maximum number of files allowed',\n table: {\n category: 'File Validation',\n },\n },\n maxSize: {\n description: 'Property that allows to display the maximum size of files allowed',\n table: {\n category: 'File Validation',\n },\n },\n accept: {\n description: 'Property that allows to define which file types are accepted',\n table: {\n category: 'File Validation',\n },\n },\n onRemoveFile: {\n description: 'Called when a file remove button is clicked',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n onFileSelect: {\n description: 'Called when a file is uploaded',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n textOverrides: {\n description: 'Properties that allow to localise component',\n },\n },\n parameters: {\n componentSubtitle: 'MultiDropzone component allows upload of multiple documents / files.',\n },\n};\n\nexport const MultiDropzoneStory = ({\n onFileSelect,\n onRemoveFile,\n uploading,\n uploadedFiles = [],\n isCondensed,\n maxFiles,\n maxSize,\n textOverrides,\n}: MultiDropzoneProps) => {\n const [localFiles, setLocalFiles] = useState<UploadedFile[]>(uploadedFiles);\n\n const handleOnRemoveFile = (id: string) => {\n onRemoveFile?.(id);\n setLocalFiles((prevFiles) => prevFiles.filter((file) => file.id !== id));\n };\n\n const handleOnFileSelect = (files: File[]) => {\n const newFiles = files.map((newFile) => ({\n id: String(new Date().getTime()),\n name: newFile.name,\n progress: 100,\n }));\n setLocalFiles((prevFiles) => [...prevFiles, ...newFiles]);\n onFileSelect(files);\n };\n\n return (\n <MultiDropzone \n onFileSelect={handleOnFileSelect} \n onRemoveFile={handleOnRemoveFile} \n uploadedFiles={localFiles} \n uploading={uploading} \n isCondensed={isCondensed}\n maxFiles={maxFiles}\n maxSize={maxSize}\n textOverrides={textOverrides}\n />\n );\n};\n\nMultiDropzoneStory.storyName = \"MultiDropzone\";\n\nexport const UploadingState = () => (\n <MultiDropzone\n uploadedFiles={[\n {\n id: '123',\n progress: 72,\n name: 'test_file_name.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name.pdf',\n },\n {\n id: '124',\n progress: 72,\n name: 'test_file_name.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name.pdf',\n showLoadingSpinner: true,\n showProgressBar: false,\n },\n {\n id: '125',\n progress: 72,\n name: 'test_file_name.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name.pdf',\n showLoadingSpinner: true,\n },\n {\n id: '456',\n progress: 100,\n name: 'test_file_name2.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name2.pdf',\n },\n ]}\n onFileSelect={() => {}}\n uploading={true}\n onRemoveFile={() => {}}\n />\n);\n\n\nexport const CondensedView = () => (\n <MultiDropzone\n uploadedFiles={[\n {\n id: '123',\n progress: 100,\n name: 'test_file_name.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name.pdf',\n },\n ]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n isCondensed\n />\n);\n\nexport const ErrorState = () => (\n <MultiDropzone\n uploadedFiles={[\n {\n id: '123',\n progress: 0,\n name: 'test_file_name.pdf',\n previewUrl: 'http://getpopsure.com/test_file_name.pdf',\n error: 'File is too big!',\n },\n ]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n />\n);\n\nexport const AcceptingOnlyImages = () => (\n <MultiDropzone\n accept=\"image\"\n isCondensed\n uploadedFiles={[]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n />\n);\n\nexport const AcceptingOnlyDocuments = () => (\n <MultiDropzone\n accept=\"document\"\n isCondensed\n uploadedFiles={[]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n />\n);\n\nexport const LimitingFileSizeTo2MB = () => (\n <MultiDropzone\n isCondensed\n uploadedFiles={[]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n maxSize={2096000}\n />\n);\n\nexport const I18nSupport = () => (\n <MultiDropzone\n uploadedFiles={[]}\n onFileSelect={() => {}}\n uploading={false}\n onRemoveFile={() => {}}\n textOverrides={{\n instructionsText: 'Datei auswählen oder per Drag & Drop platzieren',\n supportsTextShort: 'Unterstützt werden',\n currentlyUploadingText:\n 'Bitte warten während die Datei hochgeladen wird...'\n }}\n />\n);\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;IAIM,KAAK,GAAG;IACZ,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE;QACR,aAAa,EAAE;YACb,YAAY,EAAE,CAAC;oBACb,EAAE,EAAE,WAAW;oBACf,IAAI,EAAE,0DAA0D;iBACjE,CAAC;YACF,WAAW,EAAE,iDAAiD;SAC/D;QACD,SAAS,EAAE;YACT,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,iEAAiE;SAC/E;QACD,WAAW,EAAE;YACX,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,+DAA+D;SAC7E;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,qEAAqE;YAClF,KAAK,EAAE;gBACL,QAAQ,EAAE,iBAAiB;aAC5B;SACF;QACD,OAAO,EAAE;YACP,WAAW,EAAE,mEAAmE;YAChF,KAAK,EAAE;gBACL,QAAQ,EAAE,iBAAiB;aAC5B;SACF;QACD,MAAM,EAAE;YACN,WAAW,EAAE,8DAA8D;YAC3E,KAAK,EAAE;gBACL,QAAQ,EAAE,iBAAiB;aAC5B;SACF;QACD,YAAY,EAAE;YACZ,WAAW,EAAE,6CAA6C;YAC1D,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE;gBACL,QAAQ,EAAE,WAAW;aACtB;SACF;QACD,YAAY,EAAE;YACZ,WAAW,EAAE,gCAAgC;YAC7C,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE;gBACL,QAAQ,EAAE,WAAW;aAC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UAAU,EAAE,0CAA0C;YACtD,KAAK,EAAE,kBAAkB;SAC1B;KACF,EACD,YAAY,EAAE,eAAQ,EACtB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,eAAQ,WACtB,KACF;IAEW,mBAAmB,GAAG,cAAM,QACvCA,IAAC,aAAa,IACZ,MAAM,EAAC,OAAO,EACd,WAAW,QACX,aAAa,EAAE,EAAE,EACjB,YAAY,EAAE,eAAQ,EACtB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,eAAQ,WACtB,KACF;IAEW,sBAAsB,GAAG,cAAM,QAC1CA,IAAC,aAAa,IACZ,MAAM,EAAC,UAAU,EACjB,WAAW,QACX,aAAa,EAAE,EAAE,EACjB,YAAY,EAAE,eAAQ,EACtB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,eAAQ,WACtB,KACF;IAEW,qBAAqB,GAAG,cAAM,QACzCA,IAAC,aAAa,IACZ,WAAW,QACX,aAAa,EAAE,EAAE,EACjB,YAAY,EAAE,eAAQ,EACtB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,eAAQ,EACtB,OAAO,EAAE,OAAO,WAChB,KACF;IAEW,WAAW,GAAG,cAAM,QAC/BA,IAAC,aAAa,IACZ,aAAa,EAAE,EAAE,EACjB,YAAY,EAAE,eAAQ,EACtB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,eAAQ,EACtB,aAAa,EAAE;QACb,gBAAgB,EAAE,iDAAiD;QACnE,iBAAiB,EAAE,oBAAoB;QACvC,sBAAsB,EACpB,oDAAoD;KACvD,WACD;;;;;"}
@@ -14,7 +14,7 @@ import '../../index-dd80248b.js';
14
14
  import '../../index-e27b50cf.js';
15
15
  import '../../index-fb46adf9.js';
16
16
  import '../../style-inject.es-1f59c1d0.js';
17
- import '../../index-da10b7ad.js';
17
+ import '../../index-3e39c956.js';
18
18
 
19
19
  var mockOnFileSelect = jest.fn();
20
20
  var mockOnRemoveFile = jest.fn();
@@ -30,7 +30,7 @@ var icons = {
30
30
  uploadSmallIcon: uploadSmallSvg,
31
31
  };
32
32
 
33
- var css_248z = ".style-module_upload-file-cell__3nv5i {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 64px;\n padding: 8px 16px;\n border: 1px solid #d2d2d8;\n border-radius: 8px;\n background-color: white;\n animation: style-module_appear-down__14rCV 0.6s;\n animation-fill-mode: both;\n animation-delay: 0s;\n}\n\n.style-module_upload-file-cell-error__3KcSe {\n border-color: #e55454;\n background-color: rgba(229, 84, 84, 0.2);\n}\n\n.style-module_cell-left-section__3Iv8c {\n display: flex;\n align-items: center;\n}\n\n.style-module_main-icon__335_Y {\n width: 16px;\n height: 20px;\n margin-right: 16px;\n}\n\n.style-module_upload-display-text__3Rd68 {\n overflow-wrap: anywhere;\n}\n\n.style-module_progress-bar-container__2JCBO {\n position: relative;\n}\n\n.style-module_progress-bar__1Rosf {\n background-color: #f5f6fb;\n border-radius: 10px;\n height: 4px;\n}\n\n.style-module_progress-bar-filler__131fA {\n background-color: #8e8cee;\n border-radius: 10px;\n height: 4px;\n position: absolute;\n bottom: 0;\n transition: 1s ease;\n}\n\n.style-module_cell-right-section__dVWqJ {\n display: flex;\n justify-content: flex-end;\n min-width: 32px;\n margin-left: 16px;\n}\n\n.style-module_cell-right-section-complete__c0rHc {\n min-width: 64px;\n}\n\n.style-module_view-icon__3UenG,\n.style-module_remove-icon__2FWBQ {\n cursor: pointer;\n}\n\n.style-module_remove-icon__2FWBQ {\n margin-left: 16px;\n}\n\n.style-module_disabled__s-DR1 {\n pointer-events: none;\n cursor: default;\n}\n\n@keyframes style-module_appear-down__14rCV {\n from {\n transform: translateY(-10px);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}";
33
+ var css_248z = ".style-module_upload-file-cell__3nv5i {\n display: flex;\n align-items: center;\n justify-content: space-between;\n min-height: 64px;\n padding: 8px 16px;\n border: 1px solid #d2d2d8;\n border-radius: 8px;\n background-color: white;\n animation: style-module_appear-down__14rCV 0.6s;\n animation-fill-mode: both;\n animation-delay: 0s;\n}\n\n.style-module_upload-file-cell-error__3KcSe {\n border-color: #e55454;\n background-color: rgba(229, 84, 84, 0.2);\n}\n\n.style-module_cell-left-section__3Iv8c {\n display: flex;\n align-items: center;\n}\n\n.style-module_main-icon__335_Y {\n width: 16px;\n height: 20px;\n margin-right: 16px;\n}\n\n.style-module_upload-display-text__3Rd68 {\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n\n.style-module_progress-bar-container__2JCBO {\n position: relative;\n}\n\n.style-module_progress-bar__1Rosf {\n background-color: #f5f6fb;\n border-radius: 10px;\n height: 4px;\n}\n\n.style-module_progress-bar-filler__131fA {\n background-color: #8e8cee;\n border-radius: 10px;\n height: 4px;\n position: absolute;\n bottom: 0;\n transition: 1s ease;\n}\n\n.style-module_cell-right-section__dVWqJ {\n display: flex;\n justify-content: flex-end;\n min-width: 32px;\n margin-left: 16px;\n}\n\n.style-module_cell-right-section-complete__c0rHc {\n min-width: 64px;\n}\n\n.style-module_view-icon__3UenG,\n.style-module_remove-icon__2FWBQ {\n cursor: pointer;\n}\n\n.style-module_remove-icon__2FWBQ {\n margin-left: 16px;\n}\n\n.style-module_disabled__s-DR1 {\n pointer-events: none;\n cursor: default;\n}\n\n@keyframes style-module_appear-down__14rCV {\n from {\n transform: translateY(-10px);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}";
34
34
  var styles = {"upload-file-cell":"style-module_upload-file-cell__3nv5i","appear-down":"style-module_appear-down__14rCV","upload-file-cell-error":"style-module_upload-file-cell-error__3KcSe","cell-left-section":"style-module_cell-left-section__3Iv8c","main-icon":"style-module_main-icon__335_Y","upload-display-text":"style-module_upload-display-text__3Rd68","progress-bar-container":"style-module_progress-bar-container__2JCBO","progress-bar":"style-module_progress-bar__1Rosf","progress-bar-filler":"style-module_progress-bar-filler__131fA","cell-right-section":"style-module_cell-right-section__dVWqJ","cell-right-section-complete":"style-module_cell-right-section-complete__c0rHc","view-icon":"style-module_view-icon__3UenG","remove-icon":"style-module_remove-icon__2FWBQ","disabled":"style-module_disabled__s-DR1"};
35
35
  styleInject(css_248z);
36
36
 
@@ -46,24 +46,24 @@ var UploadFileCell = function (_a) {
46
46
  COMPLETE: icons.fileIcon,
47
47
  ERROR: icons.fileErrorIcon,
48
48
  };
49
- var mapDisplayText = {
49
+ var displayText = {
50
50
  UPLOADING: 'Uploading...',
51
51
  COMPLETE: name,
52
52
  ERROR: error !== null && error !== void 0 ? error : 'Something went wrong. Try uploading again.',
53
- };
53
+ }[uploadStatus];
54
54
  return (jsxs("div", __assign({ className: classNames("mt8 " + styles['upload-file-cell'], (_b = {},
55
55
  _b[styles['upload-file-cell-error']] = hasError,
56
56
  _b)) }, { children: [jsxs("div", __assign({ className: "w100 " + styles['cell-left-section'] }, { children: [jsx("img", { className: styles['main-icon'], src: mapFileIcon[uploadStatus], alt: "" }, void 0),
57
- jsxs("div", __assign({ className: "w100" }, { children: [jsx("div", __assign({ className: "p-p " + styles['upload-display-text'] }, { children: mapDisplayText[uploadStatus] }), void 0),
57
+ jsxs("div", __assign({ className: "w100" }, { children: [jsx("div", __assign({ className: "p-p " + styles['upload-display-text'], title: displayText }, { children: displayText }), void 0),
58
58
  isUploading && showProgressBar && (jsxs("div", __assign({ className: "mt8 w100 " + styles['progress-bar-container'] }, { children: [jsx("div", { className: "" + styles['progress-bar'] }, void 0),
59
59
  jsx("div", { "data-testid": "ds-filecell-progressbar", className: "" + styles['progress-bar-filler'], style: { width: progress + "%" } }, void 0)] }), void 0))] }), void 0)] }), void 0),
60
60
  jsx("div", __assign({ className: classNames(styles['cell-right-section'], (_c = {},
61
61
  _c[styles['cell-right-section-complete']] = isComplete,
62
62
  _c)) }, { children: isUploading ? (jsx("div", __assign({ className: styles.spinner }, { children: showLoadingSpinner && (jsx("div", { className: 'ds-spinner ds-spinner__m', "data-testid": "ds-filecell-spinner" }, void 0)) }), void 0)) : (jsxs("div", { children: [isComplete && (jsx("a", __assign({ className: styles['view-icon'], href: previewUrl, target: "_blank", rel: "noopener noreferrer" }, { children: jsx("img", { src: icons.eyeIcon, alt: "preview" }, void 0) }), void 0)),
63
- jsx("img", { className: classNames(styles['remove-icon'], (_d = {},
63
+ onRemoveFile && (jsx("img", { className: classNames(styles['remove-icon'], (_d = {},
64
64
  _d[styles.disabled] = uploading,
65
- _d)), src: hasError ? icons.trashErrorIcon : icons.trashIcon, onClick: function () { return onRemoveFile(id); }, alt: "remove" }, void 0)] }, void 0)) }), void 0)] }), void 0));
65
+ _d)), src: hasError ? icons.trashErrorIcon : icons.trashIcon, onClick: function () { return onRemoveFile(id); }, alt: "remove" }, void 0))] }, void 0)) }), void 0)] }), void 0));
66
66
  };
67
67
 
68
68
  export { UploadFileCell as U, icons as i };
69
- //# sourceMappingURL=index-da10b7ad.js.map
69
+ //# sourceMappingURL=index-3e39c956.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-da10b7ad.js","sources":["../../src/lib/components/multiDropzone/icons/eye.svg","../../src/lib/components/multiDropzone/icons/file.svg","../../src/lib/components/multiDropzone/icons/file-error.svg","../../src/lib/components/multiDropzone/icons/file-upload.svg","../../src/lib/components/multiDropzone/icons/trash.svg","../../src/lib/components/multiDropzone/icons/trash-error.svg","../../src/lib/components/multiDropzone/icons/upload.svg","../../src/lib/components/multiDropzone/icons/upload-small.svg","../../../src/lib/components/multiDropzone/icons/index.ts","../../../src/lib/components/multiDropzone/UploadFileCell/index.tsx"],"sourcesContent":["export default \"data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url%28%23clip0_14605_3108%29%22%3E%3Cpath%20d%3D%22M0.832031%209.99998C0.832031%209.99998%204.16536%203.33331%209.9987%203.33331C15.832%203.33331%2019.1654%209.99998%2019.1654%209.99998C19.1654%209.99998%2015.832%2016.6666%209.9987%2016.6666C4.16536%2016.6666%200.832031%209.99998%200.832031%209.99998Z%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M9.99902%2012.5C11.3797%2012.5%2012.499%2011.3807%2012.499%2010C12.499%208.61929%2011.3797%207.5%209.99902%207.5C8.61831%207.5%207.49902%208.61929%207.49902%2010C7.49902%2011.3807%208.61831%2012.5%209.99902%2012.5Z%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22clip0_14605_3108%22%3E%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%20transform%3D%22translate%28-0.000976562%29%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2218%22%20height%3D%2222%22%20viewBox%3D%220%200%2018%2022%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M14.8272%2021H2.7284C2.27%2021%201.83037%2020.8084%201.50624%2020.4675C1.1821%2020.1265%201%2019.664%201%2019.1818V6.45455L6.18519%201H14.8272C15.2856%201%2015.7252%201.19156%2016.0493%201.53253C16.3735%201.87351%2016.5556%202.33597%2016.5556%202.81818V19.1818C16.5556%2019.664%2016.3735%2020.1265%2016.0493%2020.4675C15.7252%2020.8084%2015.2856%2021%2014.8272%2021Z%22%20stroke%3D%22%23696970%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M6.0646%201V4.77358C6.0646%205.27399%205.88674%205.75391%205.57014%206.10775C5.25354%206.46159%204.82414%206.66038%204.3764%206.66038H1%22%20stroke%3D%22%23696970%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2218%22%20height%3D%2222%22%20viewBox%3D%220%200%2018%2022%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M14.8272%2021H2.72839C2.27%2021%201.83037%2020.8084%201.50624%2020.4675C1.1821%2020.1265%201%2019.664%201%2019.1818V6.45455L6.18518%201H14.8272C15.2856%201%2015.7252%201.19156%2016.0493%201.53253C16.3735%201.87351%2016.5556%202.33597%2016.5556%202.81818V19.1818C16.5556%2019.664%2016.3735%2020.1265%2016.0493%2020.4675C15.7252%2020.8084%2015.2856%2021%2014.8272%2021Z%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M6.0646%201V4.77358C6.0646%205.27399%205.88674%205.75391%205.57014%206.10775C5.25354%206.46159%204.82414%206.66038%204.3764%206.66038H1%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2218%22%20height%3D%2222%22%20viewBox%3D%220%200%2018%2022%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M14.8272%2021H2.72839C2.27%2021%201.83037%2020.8084%201.50624%2020.4675C1.1821%2020.1265%201%2019.664%201%2019.1818V6.45455L6.18518%201H14.8272C15.2856%201%2015.7252%201.19156%2016.0493%201.53253C16.3735%201.87351%2016.5556%202.33597%2016.5556%202.81818V19.1818C16.5556%2019.664%2016.3735%2020.1265%2016.0493%2020.4675C15.7252%2020.8084%2015.2856%2021%2014.8272%2021Z%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M6.0646%201V4.77358C6.0646%205.27399%205.88674%205.75391%205.57014%206.10775C5.25354%206.46159%204.82414%206.66038%204.3764%206.66038H1%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.5%205H4.16667H17.5%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M6.66699%205.00002V3.33335C6.66699%202.89133%206.84259%202.4674%207.15515%202.15484C7.46771%201.84228%207.89163%201.66669%208.33366%201.66669H11.667C12.109%201.66669%2012.5329%201.84228%2012.8455%202.15484C13.1581%202.4674%2013.3337%202.89133%2013.3337%203.33335V5.00002M15.8337%205.00002V16.6667C15.8337%2017.1087%2015.6581%2017.5326%2015.3455%2017.8452C15.0329%2018.1578%2014.609%2018.3334%2014.167%2018.3334H5.83366C5.39163%2018.3334%204.96771%2018.1578%204.65515%2017.8452C4.34259%2017.5326%204.16699%2017.1087%204.16699%2016.6667V5.00002H15.8337Z%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M8.33301%209.16669V14.1667%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M11.667%209.16669V14.1667%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.5%205H4.16667H17.5%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M6.66699%205.00002V3.33335C6.66699%202.89133%206.84259%202.4674%207.15515%202.15484C7.46771%201.84228%207.89163%201.66669%208.33366%201.66669H11.667C12.109%201.66669%2012.5329%201.84228%2012.8455%202.15484C13.1581%202.4674%2013.3337%202.89133%2013.3337%203.33335V5.00002M15.8337%205.00002V16.6667C15.8337%2017.1087%2015.6581%2017.5326%2015.3455%2017.8452C15.0329%2018.1578%2014.609%2018.3334%2014.167%2018.3334H5.83366C5.39163%2018.3334%204.96771%2018.1578%204.65515%2017.8452C4.34259%2017.5326%204.16699%2017.1087%204.16699%2016.6667V5.00002H15.8337Z%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M8.33301%209.16669V14.1667%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M11.667%209.16669V14.1667%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2270%22%20height%3D%2270%22%20viewBox%3D%220%200%2070%2070%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M25.589%2052.324H16.6368C12.2734%2052.324%202.91699%2048.3383%202.91699%2038.0351C2.91699%2026.9493%2012.2734%2023.2325%2016.9623%2023.2325C17.6018%2017.8902%2021.1291%207.97805%2034.1238%207.29132C46.6242%207.29132%2052.2035%2018.5714%2051.2854%2026.9756C56.175%2026.6729%2067.0837%2028.8787%2067.0837%2039.8558C67.0837%2049.1926%2057.3044%2052.7417%2052.4147%2052.324H44.7121%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%223.08333%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M35%2063.2981V32.646%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%223.08333%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M27.3428%2040.3045L35.0013%2032.646L42.6599%2040.3045%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%223.08333%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url%28%23clip0_14605_3119%29%22%3E%3Cpath%20d%3D%22M7.31072%2014.9498H4.75296C3.50626%2014.9498%200.833008%2013.811%200.833008%2010.8673C0.833008%207.69987%203.50626%206.63794%204.84594%206.63794C5.02868%205.11158%206.03646%202.27952%209.74924%202.08331C13.3208%202.08331%2014.9149%205.30618%2014.6525%207.70738C16.0496%207.6209%2019.1663%208.25113%2019.1663%2011.3875C19.1663%2014.0551%2016.3723%2015.0691%2014.9752%2014.9498H12.7745%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M10%2018.0851V9.32739%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M7.8125%2011.5155L10.0007%209.32739L12.1888%2011.5155%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22clip0_14605_3119%22%3E%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E\"","import eyeSvg from './eye.svg';\nimport fileSvg from './file.svg';\nimport fileErrorSvg from './file-error.svg';\nimport fileUploadSvg from './file-upload.svg';\nimport trashSvg from './trash.svg';\nimport trashErrorSvg from './trash-error.svg';\nimport uploadSvg from './upload.svg';\nimport uploadSmallSvg from './upload-small.svg';\n\nexport default {\n eyeIcon: eyeSvg,\n fileErrorIcon: fileErrorSvg,\n fileIcon: fileSvg,\n fileUploadIcon: fileUploadSvg,\n trashIcon: trashSvg,\n trashErrorIcon: trashErrorSvg,\n uploadIcon: uploadSvg,\n uploadSmallIcon: uploadSmallSvg,\n};\n","import React from 'react';\nimport classnames from 'classnames';\n\nimport styles from './style.module.scss';\nimport icons from '../icons/index';\nimport { UploadStatus, UploadedFile } from '../types';\n\ninterface Props {\n uploadStatus: UploadStatus;\n file: UploadedFile;\n onRemoveFile: (id: string) => void;\n uploading: boolean;\n}\n\nconst UploadFileCell: React.FC<Props> = ({\n uploadStatus,\n file,\n onRemoveFile,\n uploading,\n}) => {\n const {\n id,\n error,\n name,\n progress,\n previewUrl,\n showLoadingSpinner = false,\n showProgressBar = true\n } = file;\n\n const isComplete = uploadStatus === 'COMPLETE';\n const isUploading = uploadStatus === 'UPLOADING';\n const hasError = uploadStatus === 'ERROR';\n\n const mapFileIcon: { [k in UploadStatus]: string } = {\n UPLOADING: icons.fileUploadIcon,\n COMPLETE: icons.fileIcon,\n ERROR: icons.fileErrorIcon,\n };\n\n const mapDisplayText: { [s in UploadStatus]: string } = {\n UPLOADING: 'Uploading...',\n COMPLETE: name,\n ERROR: error ?? 'Something went wrong. Try uploading again.',\n };\n\n return (\n <div\n className={classnames(`mt8 ${styles['upload-file-cell']}`, {\n [styles['upload-file-cell-error']]: hasError,\n })}\n >\n <div className={`w100 ${styles['cell-left-section']}`}>\n <img\n className={styles['main-icon']}\n src={mapFileIcon[uploadStatus]}\n alt=\"\"\n />\n <div className=\"w100\">\n <div className={`p-p ${styles['upload-display-text']}`}>\n {mapDisplayText[uploadStatus]}\n </div>\n\n {isUploading && showProgressBar && (\n <div className={`mt8 w100 ${styles['progress-bar-container']}`}>\n <div className={`${styles['progress-bar']}`} />\n <div\n data-testid=\"ds-filecell-progressbar\"\n className={`${styles['progress-bar-filler']}`}\n style={{ width: `${progress}%` }}\n />\n </div>\n )}\n </div>\n </div>\n <div\n className={classnames(styles['cell-right-section'], {\n [styles['cell-right-section-complete']]: isComplete,\n })}\n >\n {isUploading ? (\n <div className={styles.spinner}>\n {showLoadingSpinner && (\n <div\n className='ds-spinner ds-spinner__m'\n data-testid=\"ds-filecell-spinner\"\n />\n )}\n </div>\n ) : (\n <div>\n {isComplete && (\n <a\n className={styles['view-icon']}\n href={previewUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <img src={icons.eyeIcon} alt=\"preview\" />\n </a>\n )}\n\n <img\n className={classnames(styles['remove-icon'], {\n [styles.disabled]: uploading,\n })}\n src={hasError ? icons.trashErrorIcon : icons.trashIcon}\n onClick={() => onRemoveFile(id)}\n alt=\"remove\"\n />\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default UploadFileCell;\n"],"names":["_jsxs","classnames","_jsx"],"mappings":";;;;;AAAA,aAAe;;ACAf,cAAe;;ACAf,mBAAe;;ACAf,oBAAe;;ACAf,eAAe;;ACAf,oBAAe;;ACAf,gBAAe;;ACAf,qBAAe;;ACS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AAC,SAAS,EACtD,OAAO,EAAE,cAAM,OAAA,YAAY,CAAC,EAAE,CAAC,GAAA,EAC/B,GAAG,EAAC,QAAQ,WACZ,YACE,CACP,YACG,aACF,EACN;AACJ;;;;"}
1
+ {"version":3,"file":"index-3e39c956.js","sources":["../../src/lib/components/multiDropzone/icons/eye.svg","../../src/lib/components/multiDropzone/icons/file.svg","../../src/lib/components/multiDropzone/icons/file-error.svg","../../src/lib/components/multiDropzone/icons/file-upload.svg","../../src/lib/components/multiDropzone/icons/trash.svg","../../src/lib/components/multiDropzone/icons/trash-error.svg","../../src/lib/components/multiDropzone/icons/upload.svg","../../src/lib/components/multiDropzone/icons/upload-small.svg","../../../src/lib/components/multiDropzone/icons/index.ts","../../../src/lib/components/multiDropzone/UploadFileCell/index.tsx"],"sourcesContent":["export default \"data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url%28%23clip0_14605_3108%29%22%3E%3Cpath%20d%3D%22M0.832031%209.99998C0.832031%209.99998%204.16536%203.33331%209.9987%203.33331C15.832%203.33331%2019.1654%209.99998%2019.1654%209.99998C19.1654%209.99998%2015.832%2016.6666%209.9987%2016.6666C4.16536%2016.6666%200.832031%209.99998%200.832031%209.99998Z%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M9.99902%2012.5C11.3797%2012.5%2012.499%2011.3807%2012.499%2010C12.499%208.61929%2011.3797%207.5%209.99902%207.5C8.61831%207.5%207.49902%208.61929%207.49902%2010C7.49902%2011.3807%208.61831%2012.5%209.99902%2012.5Z%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22clip0_14605_3108%22%3E%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%20transform%3D%22translate%28-0.000976562%29%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2218%22%20height%3D%2222%22%20viewBox%3D%220%200%2018%2022%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M14.8272%2021H2.7284C2.27%2021%201.83037%2020.8084%201.50624%2020.4675C1.1821%2020.1265%201%2019.664%201%2019.1818V6.45455L6.18519%201H14.8272C15.2856%201%2015.7252%201.19156%2016.0493%201.53253C16.3735%201.87351%2016.5556%202.33597%2016.5556%202.81818V19.1818C16.5556%2019.664%2016.3735%2020.1265%2016.0493%2020.4675C15.7252%2020.8084%2015.2856%2021%2014.8272%2021Z%22%20stroke%3D%22%23696970%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M6.0646%201V4.77358C6.0646%205.27399%205.88674%205.75391%205.57014%206.10775C5.25354%206.46159%204.82414%206.66038%204.3764%206.66038H1%22%20stroke%3D%22%23696970%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2218%22%20height%3D%2222%22%20viewBox%3D%220%200%2018%2022%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M14.8272%2021H2.72839C2.27%2021%201.83037%2020.8084%201.50624%2020.4675C1.1821%2020.1265%201%2019.664%201%2019.1818V6.45455L6.18518%201H14.8272C15.2856%201%2015.7252%201.19156%2016.0493%201.53253C16.3735%201.87351%2016.5556%202.33597%2016.5556%202.81818V19.1818C16.5556%2019.664%2016.3735%2020.1265%2016.0493%2020.4675C15.7252%2020.8084%2015.2856%2021%2014.8272%2021Z%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M6.0646%201V4.77358C6.0646%205.27399%205.88674%205.75391%205.57014%206.10775C5.25354%206.46159%204.82414%206.66038%204.3764%206.66038H1%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2218%22%20height%3D%2222%22%20viewBox%3D%220%200%2018%2022%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M14.8272%2021H2.72839C2.27%2021%201.83037%2020.8084%201.50624%2020.4675C1.1821%2020.1265%201%2019.664%201%2019.1818V6.45455L6.18518%201H14.8272C15.2856%201%2015.7252%201.19156%2016.0493%201.53253C16.3735%201.87351%2016.5556%202.33597%2016.5556%202.81818V19.1818C16.5556%2019.664%2016.3735%2020.1265%2016.0493%2020.4675C15.7252%2020.8084%2015.2856%2021%2014.8272%2021Z%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M6.0646%201V4.77358C6.0646%205.27399%205.88674%205.75391%205.57014%206.10775C5.25354%206.46159%204.82414%206.66038%204.3764%206.66038H1%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%222%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.5%205H4.16667H17.5%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M6.66699%205.00002V3.33335C6.66699%202.89133%206.84259%202.4674%207.15515%202.15484C7.46771%201.84228%207.89163%201.66669%208.33366%201.66669H11.667C12.109%201.66669%2012.5329%201.84228%2012.8455%202.15484C13.1581%202.4674%2013.3337%202.89133%2013.3337%203.33335V5.00002M15.8337%205.00002V16.6667C15.8337%2017.1087%2015.6581%2017.5326%2015.3455%2017.8452C15.0329%2018.1578%2014.609%2018.3334%2014.167%2018.3334H5.83366C5.39163%2018.3334%204.96771%2018.1578%204.65515%2017.8452C4.34259%2017.5326%204.16699%2017.1087%204.16699%2016.6667V5.00002H15.8337Z%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M8.33301%209.16669V14.1667%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M11.667%209.16669V14.1667%22%20stroke%3D%22%23D2D2D8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.5%205H4.16667H17.5%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M6.66699%205.00002V3.33335C6.66699%202.89133%206.84259%202.4674%207.15515%202.15484C7.46771%201.84228%207.89163%201.66669%208.33366%201.66669H11.667C12.109%201.66669%2012.5329%201.84228%2012.8455%202.15484C13.1581%202.4674%2013.3337%202.89133%2013.3337%203.33335V5.00002M15.8337%205.00002V16.6667C15.8337%2017.1087%2015.6581%2017.5326%2015.3455%2017.8452C15.0329%2018.1578%2014.609%2018.3334%2014.167%2018.3334H5.83366C5.39163%2018.3334%204.96771%2018.1578%204.65515%2017.8452C4.34259%2017.5326%204.16699%2017.1087%204.16699%2016.6667V5.00002H15.8337Z%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M8.33301%209.16669V14.1667%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M11.667%209.16669V14.1667%22%20stroke%3D%22%23E55454%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2270%22%20height%3D%2270%22%20viewBox%3D%220%200%2070%2070%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M25.589%2052.324H16.6368C12.2734%2052.324%202.91699%2048.3383%202.91699%2038.0351C2.91699%2026.9493%2012.2734%2023.2325%2016.9623%2023.2325C17.6018%2017.8902%2021.1291%207.97805%2034.1238%207.29132C46.6242%207.29132%2052.2035%2018.5714%2051.2854%2026.9756C56.175%2026.6729%2067.0837%2028.8787%2067.0837%2039.8558C67.0837%2049.1926%2057.3044%2052.7417%2052.4147%2052.324H44.7121%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%223.08333%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M35%2063.2981V32.646%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%223.08333%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M27.3428%2040.3045L35.0013%2032.646L42.6599%2040.3045%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%223.08333%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url%28%23clip0_14605_3119%29%22%3E%3Cpath%20d%3D%22M7.31072%2014.9498H4.75296C3.50626%2014.9498%200.833008%2013.811%200.833008%2010.8673C0.833008%207.69987%203.50626%206.63794%204.84594%206.63794C5.02868%205.11158%206.03646%202.27952%209.74924%202.08331C13.3208%202.08331%2014.9149%205.30618%2014.6525%207.70738C16.0496%207.6209%2019.1663%208.25113%2019.1663%2011.3875C19.1663%2014.0551%2016.3723%2015.0691%2014.9752%2014.9498H12.7745%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M10%2018.0851V9.32739%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M7.8125%2011.5155L10.0007%209.32739L12.1888%2011.5155%22%20stroke%3D%22%238E8CEE%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22clip0_14605_3119%22%3E%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E\"","import eyeSvg from './eye.svg';\nimport fileSvg from './file.svg';\nimport fileErrorSvg from './file-error.svg';\nimport fileUploadSvg from './file-upload.svg';\nimport trashSvg from './trash.svg';\nimport trashErrorSvg from './trash-error.svg';\nimport uploadSvg from './upload.svg';\nimport uploadSmallSvg from './upload-small.svg';\n\nexport default {\n eyeIcon: eyeSvg,\n fileErrorIcon: fileErrorSvg,\n fileIcon: fileSvg,\n fileUploadIcon: fileUploadSvg,\n trashIcon: trashSvg,\n trashErrorIcon: trashErrorSvg,\n uploadIcon: uploadSvg,\n uploadSmallIcon: uploadSmallSvg,\n};\n","import React from 'react';\nimport classnames from 'classnames';\n\nimport styles from './style.module.scss';\nimport icons from '../icons/index';\nimport { UploadStatus, UploadedFile } from '../types';\n\ninterface Props {\n uploadStatus: UploadStatus;\n file: UploadedFile;\n onRemoveFile?: (id: string) => void;\n uploading: boolean;\n}\n\nconst UploadFileCell: React.FC<Props> = ({\n uploadStatus,\n file,\n onRemoveFile,\n uploading,\n}) => {\n const {\n id,\n error,\n name,\n progress,\n previewUrl,\n showLoadingSpinner = false,\n showProgressBar = true\n } = file;\n\n const isComplete = uploadStatus === 'COMPLETE';\n const isUploading = uploadStatus === 'UPLOADING';\n const hasError = uploadStatus === 'ERROR';\n\n const mapFileIcon: { [k in UploadStatus]: string } = {\n UPLOADING: icons.fileUploadIcon,\n COMPLETE: icons.fileIcon,\n ERROR: icons.fileErrorIcon,\n };\n\n const displayText = {\n UPLOADING: 'Uploading...',\n COMPLETE: name,\n ERROR: error ?? 'Something went wrong. Try uploading again.',\n }[uploadStatus];\n\n return (\n <div\n className={classnames(`mt8 ${styles['upload-file-cell']}`, {\n [styles['upload-file-cell-error']]: hasError,\n })}\n >\n <div className={`w100 ${styles['cell-left-section']}`}>\n <img\n className={styles['main-icon']}\n src={mapFileIcon[uploadStatus]}\n alt=\"\"\n />\n <div className=\"w100\">\n <div className={`p-p ${styles['upload-display-text']}`} title={displayText}>\n {displayText}\n </div>\n\n {isUploading && showProgressBar && (\n <div className={`mt8 w100 ${styles['progress-bar-container']}`}>\n <div className={`${styles['progress-bar']}`} />\n <div\n data-testid=\"ds-filecell-progressbar\"\n className={`${styles['progress-bar-filler']}`}\n style={{ width: `${progress}%` }}\n />\n </div>\n )}\n </div>\n </div>\n <div\n className={classnames(styles['cell-right-section'], {\n [styles['cell-right-section-complete']]: isComplete,\n })}\n >\n {isUploading ? (\n <div className={styles.spinner}>\n {showLoadingSpinner && (\n <div\n className='ds-spinner ds-spinner__m'\n data-testid=\"ds-filecell-spinner\"\n />\n )}\n </div>\n ) : (\n <div>\n {isComplete && (\n <a\n className={styles['view-icon']}\n href={previewUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <img src={icons.eyeIcon} alt=\"preview\" />\n </a>\n )}\n\n {onRemoveFile && (\n <img\n className={classnames(styles['remove-icon'], {\n [styles.disabled]: uploading,\n })}\n src={hasError ? icons.trashErrorIcon : icons.trashIcon}\n onClick={() => onRemoveFile(id)}\n alt=\"remove\"\n />\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default UploadFileCell;\n"],"names":["_jsxs","classnames","_jsx"],"mappings":";;;;;AAAA,aAAe;;ACAf,cAAe;;ACAf,mBAAe;;ACAf,oBAAe;;ACAf,eAAe;;ACAf,oBAAe;;ACAf,gBAAe;;ACAf,qBAAe;;ACSf,YAAe;IACb,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,YAAY;IAC3B,QAAQ,EAAE,OAAO;IACjB,cAAc,EAAE,aAAa;IAC7B,SAAS,EAAE,QAAQ;IACnB,cAAc,EAAE,aAAa;IAC7B,UAAU,EAAE,SAAS;IACrB,eAAe,EAAE,cAAc;CAChC;;;;;;ICJK,cAAc,GAAoB,UAAC,EAKxC;;QAJC,YAAY,kBAAA,EACZ,IAAI,UAAA,EACJ,YAAY,kBAAA,EACZ,SAAS,eAAA;IAGP,IAAA,EAAE,GAOA,IAAI,GAPJ,EACF,KAAK,GAMH,IAAI,MAND,EACL,IAAI,GAKF,IAAI,KALF,EACJ,QAAQ,GAIN,IAAI,SAJE,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ACc,yBAAyB,EACrC,SAAS,EAAE,KAAG,MAAM,CAAC,qBAAqB,CAAG,EAC7C,KAAK,EAAE,EAAE,KAAK,EAAK,QAAQ,MAAG,EAAE,WAChC,aACE,CACP,aACG,aACF;YACNA,sBACE,SAAS,EAAED,UAAU,CAAC,MAAM,CAAC,oBAAoB,CAAC;oBAChD,GAAC,MAAM,CAAC,6BAA6B,CAAC,IAAG,UAAU;wBACnD,gBAED,WAAW,IACVC,sBAAK,SAAS,EAAE,MAAM,CAAC,OAAO,gBAC3B,kBAAkB,KACjBA,aACE,SAAS,EAAC,0BAA0B,iBACxB,qBAAqB,WACjC,CACH,YACG,KAENF,yBACG,UAAU,KACTE,oBACE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,EAC9B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,gBAEzBA,aAAK,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,EAAC,SAAS,WAAG,YACvC,CACL;wBAEA,YAAY,KACXA,aACE,SAAS,EAAED,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC;gCACzC,GAAC,MAAM,CAAC,QAAQ,IAAG,SAAS;oCAC5B,EACF,GAAG,EAAE,QAAQ,GAAG,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,SAAS,EACtD,OAAO,EAAE,cAAM,OAAA,YAAY,CAAC,EAAE,CAAC,GAAA,EAC/B,GAAG,EAAC,QAAQ,WACZ,CACH,YACG,CACP,YACG,aACF,EACN;AACJ;;;;"}
package/dist/esm/index.js CHANGED
@@ -401,7 +401,7 @@ import './index-1463d5e9.js';
401
401
  import './index-fb46adf9.js';
402
402
  import './index-dd80248b.js';
403
403
  import './index-e27b50cf.js';
404
- import './index-da10b7ad.js';
404
+ import './index-3e39c956.js';
405
405
  import './useOnClose-d818a54f.js';
406
406
  import './feather-logo-a3f07990.js';
407
407
  import './index-171a0108.js';
@@ -3,6 +3,23 @@ export interface AutocompleteAddressProps {
3
3
  apiKey: string;
4
4
  address?: Partial<Address>;
5
5
  onAddressChange: (address: Partial<Address>) => void;
6
+ inputProps?: {
7
+ street?: {
8
+ name?: string;
9
+ };
10
+ houseNumber?: {
11
+ name?: string;
12
+ };
13
+ additionalInformation?: {
14
+ name?: string;
15
+ };
16
+ postcode?: {
17
+ name?: string;
18
+ };
19
+ city?: {
20
+ name?: string;
21
+ };
22
+ };
6
23
  placeholders?: {
7
24
  manualAddressEntry?: string;
8
25
  street?: string;
@@ -16,5 +33,5 @@ export interface AutocompleteAddressProps {
16
33
  cta?: string;
17
34
  };
18
35
  }
19
- declare const AutocompleteAddress: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, }: AutocompleteAddressProps) => JSX.Element;
36
+ declare const AutocompleteAddress: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, inputProps, }: AutocompleteAddressProps) => JSX.Element;
20
37
  export { AutocompleteAddress };
@@ -1,7 +1,7 @@
1
1
  import { AutocompleteAddressProps } from '.';
2
2
  declare const story: {
3
3
  title: string;
4
- component: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, }: AutocompleteAddressProps) => JSX.Element;
4
+ component: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, inputProps, }: AutocompleteAddressProps) => JSX.Element;
5
5
  argTypes: {
6
6
  address: {
7
7
  description: string;
@@ -3,7 +3,7 @@ import { UploadStatus, UploadedFile } from '../types';
3
3
  interface Props {
4
4
  uploadStatus: UploadStatus;
5
5
  file: UploadedFile;
6
- onRemoveFile: (id: string) => void;
6
+ onRemoveFile?: (id: string) => void;
7
7
  uploading: boolean;
8
8
  }
9
9
  declare const UploadFileCell: React.FC<Props>;
@@ -3,7 +3,7 @@ interface MultiDropzoneProps {
3
3
  uploadedFiles: UploadedFile[];
4
4
  uploading: boolean;
5
5
  onFileSelect: (files: File[]) => void;
6
- onRemoveFile: (id: string) => void;
6
+ onRemoveFile?: (id: string) => void;
7
7
  accept?: AcceptType;
8
8
  isCondensed?: boolean;
9
9
  maxFiles?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popsure/dirty-swan",
3
- "version": "0.38.3",
3
+ "version": "0.38.5",
4
4
  "author": "Vincent Audoire <vincent@getpopsure.com>",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -9,49 +9,55 @@ const story = {
9
9
  address: {
10
10
  description: 'The address properties',
11
11
  table: {
12
- type: {
13
- summary: 'Partial<Address>'
12
+ type: {
13
+ summary: 'Partial<Address>',
14
14
  },
15
15
  },
16
16
  },
17
17
  apiKey: {
18
18
  defaultValue: 'AIzaSyDg0DSrjYKt5smmsjkVasDz7c4T5rbOXT8',
19
- description: 'Your private API key for the [Google Places API](https://developers.google.com/maps/documentation/places/web-service/overview)',
19
+ description:
20
+ 'Your private API key for the [Google Places API](https://developers.google.com/maps/documentation/places/web-service/overview)',
20
21
  table: {
21
- type: {
22
- summary: 'Partial<Address>'
22
+ type: {
23
+ summary: 'Partial<Address>',
23
24
  },
24
25
  },
25
26
  },
26
27
  onAddressChange: {
27
- description: 'Callback with the updated address, this function will get called everytime the address gets updated',
28
+ description:
29
+ 'Callback with the updated address, this function will get called everytime the address gets updated',
28
30
  action: true,
29
31
  table: {
30
- category: "Callbacks",
32
+ category: 'Callbacks',
31
33
  },
32
34
  },
33
35
  manualAddressEntryTexts: {
34
- description: 'The CTA that enables manual address entry and the text preceding it',
36
+ description:
37
+ 'The CTA that enables manual address entry and the text preceding it',
35
38
  table: {
36
39
  type: {
37
- summary: '{ preText?: string; cta: string?; }'
38
- }
39
- }
40
+ summary: '{ preText?: string; cta: string?; }',
41
+ },
42
+ },
40
43
  },
41
44
  placeholders: {
42
45
  description: 'Placeholder text',
43
46
  table: {
44
47
  type: {
45
- summary: '{ manualAddressEntry?: string; street: string?; houseNumber?: string; additionalInformation?: string; postcode?: string; city?: string; }'
46
- }
47
- }
48
- }
48
+ summary:
49
+ '{ manualAddressEntry?: string; street: string?; houseNumber?: string; additionalInformation?: string; postcode?: string; city?: string; }',
50
+ },
51
+ },
52
+ },
49
53
  },
50
54
  parameters: {
51
- componentSubtitle: 'Autocomplete Address are user interface elements which allow users start typing an address and get autocompletion suggestions on the address.',
55
+ componentSubtitle:
56
+ 'Autocomplete Address are user interface elements which allow users start typing an address and get autocompletion suggestions on the address.',
52
57
  docs: {
53
58
  description: {
54
- component: 'This component is for now only restricted to "address" types and will restrict every query to Germany.',
59
+ component:
60
+ 'This component is for now only restricted to "address" types and will restrict every query to Germany.',
55
61
  },
56
62
  },
57
63
  customTypes: {
@@ -62,8 +68,8 @@ const story = {
62
68
  city: string;
63
69
  additionalInformation?: string;
64
70
  country: string;
65
- }`
66
- }
71
+ }`,
72
+ },
67
73
  },
68
74
  };
69
75
 
@@ -74,9 +80,11 @@ export const AutocompleteAddressStory = ({
74
80
  onAddressChange,
75
81
  placeholders,
76
82
  }: AutocompleteAddressProps) => {
77
- const [address, setAddress] = useState<Partial<Address> | undefined>(defaultAddress);
83
+ const [address, setAddress] = useState<Partial<Address> | undefined>(
84
+ defaultAddress
85
+ );
78
86
  const handleOnAddressChange = (newAddress: Partial<Address>) => {
79
- onAddressChange(newAddress);
87
+ onAddressChange?.(newAddress);
80
88
  setAddress(newAddress);
81
89
  };
82
90
 
@@ -91,24 +99,24 @@ export const AutocompleteAddressStory = ({
91
99
  );
92
100
  };
93
101
 
94
- AutocompleteAddressStory.storyName = "AutocompleteAddress";
102
+ AutocompleteAddressStory.storyName = 'AutocompleteAddress';
95
103
 
96
104
  export const WithAddress = ({
97
105
  apiKey,
98
106
  onAddressChange,
99
107
  placeholders,
100
108
  }: AutocompleteAddressProps) => (
101
- <AutocompleteAddress
102
- address={{
103
- street: 'Lohmuehlenstraße',
104
- houseNumber: '65',
105
- city: 'Berlin',
106
- country: 'DE',
107
- additionalInformation: 'c/o Factory',
108
- }}
109
- apiKey={apiKey}
110
- onAddressChange={onAddressChange}
111
- />
109
+ <AutocompleteAddress
110
+ address={{
111
+ street: 'Lohmuehlenstraße',
112
+ houseNumber: '65',
113
+ city: 'Berlin',
114
+ country: 'DE',
115
+ additionalInformation: 'c/o Factory',
116
+ }}
117
+ apiKey={apiKey}
118
+ onAddressChange={onAddressChange}
119
+ />
112
120
  );
113
121
 
114
122
  export const WithLocalisationEntryText = ({
@@ -1,12 +1,11 @@
1
- import { useCallback, useEffect, useRef, useState } from 'react';
1
+ import { ChangeEvent, useCallback, useEffect, useRef, useState } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import debounce from 'lodash.debounce';
4
- import isEqual from 'lodash.isequal';
5
4
  import { Input } from '../input';
6
5
  import {
7
6
  Address,
8
- countryNameFromAlphaCode,
9
7
  Alpha2CountryCode,
8
+ countryNameFromAlphaCode,
10
9
  } from '@popsure/public-models';
11
10
 
12
11
  import { geocoderAddressComponentToPartialAddress } from './util';
@@ -53,6 +52,23 @@ export interface AutocompleteAddressProps {
53
52
  apiKey: string;
54
53
  address?: Partial<Address>;
55
54
  onAddressChange: (address: Partial<Address>) => void;
55
+ inputProps?: {
56
+ street?: {
57
+ name?: string;
58
+ };
59
+ houseNumber?: {
60
+ name?: string;
61
+ };
62
+ additionalInformation?: {
63
+ name?: string;
64
+ };
65
+ postcode?: {
66
+ name?: string;
67
+ };
68
+ city?: {
69
+ name?: string;
70
+ };
71
+ };
56
72
  placeholders?: {
57
73
  manualAddressEntry?: string;
58
74
  street?: string;
@@ -73,6 +89,7 @@ const AutocompleteAddress = ({
73
89
  onAddressChange,
74
90
  placeholders,
75
91
  manualAddressEntryTexts,
92
+ inputProps,
76
93
  }: AutocompleteAddressProps) => {
77
94
  const [manualAddressEntry, setManualAddressEntry] = useState(false);
78
95
  const [isLoading, setIsLoading] = useState(false);
@@ -99,15 +116,12 @@ const AutocompleteAddress = ({
99
116
  autocompleteElement.current.value = address.street;
100
117
  }
101
118
 
102
- if (isEqual(address, initialAddress) === false) {
103
- onAddressChange({ ...address });
104
- }
105
119
  handleEnterAddressManually();
106
120
  }
107
- }, [initialAddress, address, onAddressChange, hasLoadedGoogleAPI]);
121
+ }, [address, onAddressChange, hasLoadedGoogleAPI]);
108
122
 
109
123
  useEffect(() => {
110
- if (hasLoadedGoogleAPI === false) {
124
+ if (!hasLoadedGoogleAPI) {
111
125
  return;
112
126
  }
113
127
 
@@ -156,6 +170,7 @@ const AutocompleteAddress = ({
156
170
  ...geocoderAddress,
157
171
  additionalInformation: oldValue?.additionalInformation,
158
172
  }));
173
+ onAddressChange?.(geocoderAddress);
159
174
  }
160
175
 
161
176
  map.current?.panTo(newPlace.geometry.location);
@@ -204,12 +219,28 @@ const AutocompleteAddress = ({
204
219
  []
205
220
  );
206
221
 
207
- const debouncedSetPlace = debounce(setPlaceFromAddress, 1000);
222
+ const debouncedSetPlace = debounce(setPlaceFromAddress, 2000);
208
223
 
209
224
  const handleEnterAddressManually = () => {
210
225
  setManualAddressEntry(true);
211
226
  };
212
227
 
228
+ const onManualAddressChange =
229
+ ({ updatePlace } = { updatePlace: true }) =>
230
+ (e: ChangeEvent<HTMLInputElement>) => {
231
+ const newAddress = {
232
+ ...address,
233
+ [e.target.name]: e.target.value,
234
+ country: GERMANY_ALPHA_CODE,
235
+ };
236
+ setAddress(newAddress);
237
+ onAddressChange(newAddress);
238
+
239
+ if (updatePlace) {
240
+ debouncedSetPlace(newAddress);
241
+ }
242
+ };
243
+
213
244
  return (
214
245
  <>
215
246
  <div
@@ -257,15 +288,9 @@ const AutocompleteAddress = ({
257
288
  type="text"
258
289
  placeholder={placeholders?.street || 'Street'}
259
290
  value={address?.street || ''}
260
- onChange={(e) => {
261
- const newAddress = {
262
- ...address,
263
- street: e.target.value,
264
- country: GERMANY_ALPHA_CODE,
265
- };
266
- setAddress(newAddress);
267
- debouncedSetPlace(newAddress);
268
- }}
291
+ onChange={onManualAddressChange()}
292
+ name="street"
293
+ {...inputProps?.street}
269
294
  />
270
295
  <Input
271
296
  className={`wmx2 ${styles['house-number-input']}`}
@@ -273,15 +298,9 @@ const AutocompleteAddress = ({
273
298
  key="autocomplete-house-number"
274
299
  placeholder={placeholders?.houseNumber || 'House Number'}
275
300
  value={address?.houseNumber || ''}
276
- onChange={(e) => {
277
- const newAddress = {
278
- ...address,
279
- houseNumber: e.target.value,
280
- country: GERMANY_ALPHA_CODE,
281
- };
282
- setAddress(newAddress);
283
- debouncedSetPlace(newAddress);
284
- }}
301
+ name="houseNumber"
302
+ onChange={onManualAddressChange()}
303
+ {...inputProps?.houseNumber}
285
304
  />
286
305
  </div>
287
306
  <Input
@@ -293,14 +312,9 @@ const AutocompleteAddress = ({
293
312
  'Additional information (C/O, apartment, …)'
294
313
  }
295
314
  value={address?.additionalInformation || ''}
296
- onChange={(e) => {
297
- const newAddress = {
298
- ...address,
299
- additionalInformation: e.target.value,
300
- country: GERMANY_ALPHA_CODE,
301
- };
302
- setAddress(newAddress);
303
- }}
315
+ name="additionalInformation"
316
+ onChange={onManualAddressChange({ updatePlace: false })}
317
+ {...inputProps?.additionalInformation}
304
318
  />
305
319
  <div className={`d-flex mt16 c-gap16 ${styles['input-line']}`}>
306
320
  <Input
@@ -309,15 +323,9 @@ const AutocompleteAddress = ({
309
323
  key="autocomplete-postcode"
310
324
  placeholder={placeholders?.postcode || 'Postcode'}
311
325
  value={address?.postcode || ''}
312
- onChange={(e) => {
313
- const newAddress = {
314
- ...address,
315
- postcode: e.target.value,
316
- country: GERMANY_ALPHA_CODE,
317
- };
318
- setAddress(newAddress);
319
- debouncedSetPlace(newAddress);
320
- }}
326
+ name="postcode"
327
+ onChange={onManualAddressChange()}
328
+ {...inputProps?.postcode}
321
329
  />
322
330
  <Input
323
331
  className="w100"
@@ -325,15 +333,9 @@ const AutocompleteAddress = ({
325
333
  key="autocomplete-city"
326
334
  placeholder={placeholders?.city || 'City'}
327
335
  value={address?.city || ''}
328
- onChange={(e) => {
329
- const newAddress = {
330
- ...address,
331
- city: e.target.value,
332
- country: GERMANY_ALPHA_CODE,
333
- };
334
- setAddress(newAddress);
335
- debouncedSetPlace(newAddress);
336
- }}
336
+ name="city"
337
+ onChange={onManualAddressChange()}
338
+ {...inputProps?.city}
337
339
  />
338
340
  </div>
339
341
  </>