@transferwise/components 0.0.0-experimental-43daa3c → 0.0.0-experimental-e1c4386

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 (33) hide show
  1. package/build/actionOption/ActionOption.js +4 -2
  2. package/build/actionOption/ActionOption.js.map +1 -1
  3. package/build/actionOption/ActionOption.mjs +4 -2
  4. package/build/actionOption/ActionOption.mjs.map +1 -1
  5. package/build/main.css +28 -20
  6. package/build/styles/main.css +28 -20
  7. package/build/styles/uploadInput/uploadButton/UploadButton.css +5 -0
  8. package/build/styles/uploadInput/uploadItem/UploadItem.css +23 -20
  9. package/build/types/actionOption/ActionOption.d.ts +2 -1
  10. package/build/types/actionOption/ActionOption.d.ts.map +1 -1
  11. package/build/types/uploadInput/uploadItem/{UploadItemBody.d.ts → UploadItemLink.d.ts} +2 -2
  12. package/build/types/uploadInput/uploadItem/UploadItemLink.d.ts.map +1 -0
  13. package/build/uploadInput/uploadItem/UploadItem.js +3 -3
  14. package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
  15. package/build/uploadInput/uploadItem/UploadItem.mjs +3 -3
  16. package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
  17. package/build/uploadInput/uploadItem/UploadItemLink.js +32 -0
  18. package/build/uploadInput/uploadItem/UploadItemLink.js.map +1 -0
  19. package/build/uploadInput/uploadItem/{UploadItemBody.mjs → UploadItemLink.mjs} +5 -4
  20. package/build/uploadInput/uploadItem/UploadItemLink.mjs.map +1 -0
  21. package/package.json +3 -3
  22. package/src/actionOption/ActionOption.tsx +3 -0
  23. package/src/main.css +28 -20
  24. package/src/uploadInput/uploadButton/UploadButton.css +5 -0
  25. package/src/uploadInput/uploadButton/UploadButton.less +6 -0
  26. package/src/uploadInput/uploadItem/UploadItem.css +23 -20
  27. package/src/uploadInput/uploadItem/UploadItem.less +16 -12
  28. package/src/uploadInput/uploadItem/UploadItem.tsx +4 -4
  29. package/src/uploadInput/uploadItem/{UploadItemBody.tsx → UploadItemLink.tsx} +6 -2
  30. package/build/types/uploadInput/uploadItem/UploadItemBody.d.ts.map +0 -1
  31. package/build/uploadInput/uploadItem/UploadItemBody.js +0 -27
  32. package/build/uploadInput/uploadItem/UploadItemBody.js.map +0 -1
  33. package/build/uploadInput/uploadItem/UploadItemBody.mjs.map +0 -1
@@ -22,7 +22,8 @@ const ActionOption = ({
22
22
  className,
23
23
  showMediaAtAllSizes,
24
24
  showMediaCircle,
25
- isContainerAligned
25
+ isContainerAligned,
26
+ as
26
27
  }) => {
27
28
  const sharedProps = {
28
29
  media,
@@ -33,7 +34,8 @@ const ActionOption = ({
33
34
  showMediaAtAllSizes,
34
35
  showMediaCircle,
35
36
  className: classNames__default.default('tw-action-option', className),
36
- isContainerAligned
37
+ isContainerAligned,
38
+ as
37
39
  };
38
40
  const getAriaLabel = () => {
39
41
  const labels = [];
@@ -1 +1 @@
1
- {"version":3,"file":"ActionOption.js","sources":["../../src/actionOption/ActionOption.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport ActionButton from '../actionButton';\nimport { CommonProps, Priority, PriorityPrimary, PrioritySecondary } from '../common';\nimport Option from '../common/Option';\n\nexport type ActionOptionProps = {\n complex?: boolean;\n content?: React.ReactNode;\n disabled?: boolean;\n media?: React.ReactNode;\n showMediaAtAllSizes?: boolean;\n onClick: () => void;\n title: React.ReactNode;\n action: React.ReactNode;\n priority?: PriorityPrimary | PrioritySecondary;\n showMediaCircle?: boolean;\n isContainerAligned?: boolean;\n} & CommonProps;\n\nconst ActionOption = ({\n action,\n priority = Priority.PRIMARY,\n disabled,\n onClick,\n media,\n title,\n content,\n complex,\n className,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n}: ActionOptionProps) => {\n const sharedProps = {\n media,\n title,\n content,\n complex,\n disabled,\n showMediaAtAllSizes,\n showMediaCircle,\n className: classNames('tw-action-option', className),\n isContainerAligned,\n };\n\n const getAriaLabel = (): string | undefined => {\n const labels: string[] = [];\n\n if (typeof title === 'string') {\n labels.push(title);\n }\n\n if (typeof action === 'string') {\n labels.push(action);\n }\n\n return labels.join(', ') || undefined;\n };\n\n return (\n <Option\n {...sharedProps}\n button={\n <ActionButton\n priority={priority}\n disabled={disabled}\n aria-label={getAriaLabel()}\n onClick={onClick}\n >\n {action}\n </ActionButton>\n }\n />\n );\n};\n\nexport default ActionOption;\n"],"names":["ActionOption","action","priority","Priority","PRIMARY","disabled","onClick","media","title","content","complex","className","showMediaAtAllSizes","showMediaCircle","isContainerAligned","sharedProps","classNames","getAriaLabel","labels","push","join","undefined","_jsx","Option","button","ActionButton","children"],"mappings":";;;;;;;;;;;;AAoBMA,MAAAA,YAAY,GAAGA,CAAC;EACpBC,MAAM;EACNC,QAAQ,GAAGC,gBAAQ,CAACC,OAAO;EAC3BC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC,KAAK;EACLC,OAAO;EACPC,OAAO;EACPC,SAAS;EACTC,mBAAmB;EACnBC,eAAe;AACfC,EAAAA,kBAAAA;AAAkB,CACA,KAAI;AACtB,EAAA,MAAMC,WAAW,GAAG;IAClBR,KAAK;IACLC,KAAK;IACLC,OAAO;IACPC,OAAO;IACPL,QAAQ;IACRO,mBAAmB;IACnBC,eAAe;AACfF,IAAAA,SAAS,EAAEK,2BAAU,CAAC,kBAAkB,EAAEL,SAAS,CAAC;AACpDG,IAAAA,kBAAAA;GACD,CAAA;EAED,MAAMG,YAAY,GAAGA,MAAyB;IAC5C,MAAMC,MAAM,GAAa,EAAE,CAAA;AAE3B,IAAA,IAAI,OAAOV,KAAK,KAAK,QAAQ,EAAE;AAC7BU,MAAAA,MAAM,CAACC,IAAI,CAACX,KAAK,CAAC,CAAA;AACpB,KAAA;AAEA,IAAA,IAAI,OAAOP,MAAM,KAAK,QAAQ,EAAE;AAC9BiB,MAAAA,MAAM,CAACC,IAAI,CAAClB,MAAM,CAAC,CAAA;AACrB,KAAA;AAEA,IAAA,OAAOiB,MAAM,CAACE,IAAI,CAAC,IAAI,CAAC,IAAIC,SAAS,CAAA;GACtC,CAAA;EAED,oBACEC,cAAA,CAACC,MAAM,EAAA;AAAA,IAAA,GACDR,WAAW;IACfS,MAAM,eACJF,cAAA,CAACG,YAAY,EAAA;AACXvB,MAAAA,QAAQ,EAAEA,QAAS;AACnBG,MAAAA,QAAQ,EAAEA,QAAS;MACnB,YAAYY,EAAAA,YAAY,EAAG;AAC3BX,MAAAA,OAAO,EAAEA,OAAQ;AAAAoB,MAAAA,QAAA,EAEhBzB,MAAAA;KACW,CAAA;AACf,GAAA,CACD,CAAA;AAEN;;;;"}
1
+ {"version":3,"file":"ActionOption.js","sources":["../../src/actionOption/ActionOption.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport ActionButton from '../actionButton';\nimport { CommonProps, Priority, PriorityPrimary, PrioritySecondary } from '../common';\nimport Option from '../common/Option';\n\nexport type ActionOptionProps = {\n complex?: boolean;\n content?: React.ReactNode;\n disabled?: boolean;\n media?: React.ReactNode;\n showMediaAtAllSizes?: boolean;\n onClick: () => void;\n title: React.ReactNode;\n action: React.ReactNode;\n priority?: PriorityPrimary | PrioritySecondary;\n showMediaCircle?: boolean;\n isContainerAligned?: boolean;\n as?: React.ElementType;\n} & CommonProps;\n\nconst ActionOption = ({\n action,\n priority = Priority.PRIMARY,\n disabled,\n onClick,\n media,\n title,\n content,\n complex,\n className,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n as,\n}: ActionOptionProps) => {\n const sharedProps = {\n media,\n title,\n content,\n complex,\n disabled,\n showMediaAtAllSizes,\n showMediaCircle,\n className: classNames('tw-action-option', className),\n isContainerAligned,\n as,\n };\n\n const getAriaLabel = (): string | undefined => {\n const labels: string[] = [];\n\n if (typeof title === 'string') {\n labels.push(title);\n }\n\n if (typeof action === 'string') {\n labels.push(action);\n }\n\n return labels.join(', ') || undefined;\n };\n\n return (\n <Option\n {...sharedProps}\n button={\n <ActionButton\n priority={priority}\n disabled={disabled}\n aria-label={getAriaLabel()}\n onClick={onClick}\n >\n {action}\n </ActionButton>\n }\n />\n );\n};\n\nexport default ActionOption;\n"],"names":["ActionOption","action","priority","Priority","PRIMARY","disabled","onClick","media","title","content","complex","className","showMediaAtAllSizes","showMediaCircle","isContainerAligned","as","sharedProps","classNames","getAriaLabel","labels","push","join","undefined","_jsx","Option","button","ActionButton","children"],"mappings":";;;;;;;;;;;;AAqBMA,MAAAA,YAAY,GAAGA,CAAC;EACpBC,MAAM;EACNC,QAAQ,GAAGC,gBAAQ,CAACC,OAAO;EAC3BC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC,KAAK;EACLC,OAAO;EACPC,OAAO;EACPC,SAAS;EACTC,mBAAmB;EACnBC,eAAe;EACfC,kBAAkB;AAClBC,EAAAA,EAAAA;AAAE,CACgB,KAAI;AACtB,EAAA,MAAMC,WAAW,GAAG;IAClBT,KAAK;IACLC,KAAK;IACLC,OAAO;IACPC,OAAO;IACPL,QAAQ;IACRO,mBAAmB;IACnBC,eAAe;AACfF,IAAAA,SAAS,EAAEM,2BAAU,CAAC,kBAAkB,EAAEN,SAAS,CAAC;IACpDG,kBAAkB;AAClBC,IAAAA,EAAAA;GACD,CAAA;EAED,MAAMG,YAAY,GAAGA,MAAyB;IAC5C,MAAMC,MAAM,GAAa,EAAE,CAAA;AAE3B,IAAA,IAAI,OAAOX,KAAK,KAAK,QAAQ,EAAE;AAC7BW,MAAAA,MAAM,CAACC,IAAI,CAACZ,KAAK,CAAC,CAAA;AACpB,KAAA;AAEA,IAAA,IAAI,OAAOP,MAAM,KAAK,QAAQ,EAAE;AAC9BkB,MAAAA,MAAM,CAACC,IAAI,CAACnB,MAAM,CAAC,CAAA;AACrB,KAAA;AAEA,IAAA,OAAOkB,MAAM,CAACE,IAAI,CAAC,IAAI,CAAC,IAAIC,SAAS,CAAA;GACtC,CAAA;EAED,oBACEC,cAAA,CAACC,MAAM,EAAA;AAAA,IAAA,GACDR,WAAW;IACfS,MAAM,eACJF,cAAA,CAACG,YAAY,EAAA;AACXxB,MAAAA,QAAQ,EAAEA,QAAS;AACnBG,MAAAA,QAAQ,EAAEA,QAAS;MACnB,YAAYa,EAAAA,YAAY,EAAG;AAC3BZ,MAAAA,OAAO,EAAEA,OAAQ;AAAAqB,MAAAA,QAAA,EAEhB1B,MAAAA;KACW,CAAA;AACf,GAAA,CACD,CAAA;AAEN;;;;"}
@@ -16,7 +16,8 @@ const ActionOption = ({
16
16
  className,
17
17
  showMediaAtAllSizes,
18
18
  showMediaCircle,
19
- isContainerAligned
19
+ isContainerAligned,
20
+ as
20
21
  }) => {
21
22
  const sharedProps = {
22
23
  media,
@@ -27,7 +28,8 @@ const ActionOption = ({
27
28
  showMediaAtAllSizes,
28
29
  showMediaCircle,
29
30
  className: classNames('tw-action-option', className),
30
- isContainerAligned
31
+ isContainerAligned,
32
+ as
31
33
  };
32
34
  const getAriaLabel = () => {
33
35
  const labels = [];
@@ -1 +1 @@
1
- {"version":3,"file":"ActionOption.mjs","sources":["../../src/actionOption/ActionOption.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport ActionButton from '../actionButton';\nimport { CommonProps, Priority, PriorityPrimary, PrioritySecondary } from '../common';\nimport Option from '../common/Option';\n\nexport type ActionOptionProps = {\n complex?: boolean;\n content?: React.ReactNode;\n disabled?: boolean;\n media?: React.ReactNode;\n showMediaAtAllSizes?: boolean;\n onClick: () => void;\n title: React.ReactNode;\n action: React.ReactNode;\n priority?: PriorityPrimary | PrioritySecondary;\n showMediaCircle?: boolean;\n isContainerAligned?: boolean;\n} & CommonProps;\n\nconst ActionOption = ({\n action,\n priority = Priority.PRIMARY,\n disabled,\n onClick,\n media,\n title,\n content,\n complex,\n className,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n}: ActionOptionProps) => {\n const sharedProps = {\n media,\n title,\n content,\n complex,\n disabled,\n showMediaAtAllSizes,\n showMediaCircle,\n className: classNames('tw-action-option', className),\n isContainerAligned,\n };\n\n const getAriaLabel = (): string | undefined => {\n const labels: string[] = [];\n\n if (typeof title === 'string') {\n labels.push(title);\n }\n\n if (typeof action === 'string') {\n labels.push(action);\n }\n\n return labels.join(', ') || undefined;\n };\n\n return (\n <Option\n {...sharedProps}\n button={\n <ActionButton\n priority={priority}\n disabled={disabled}\n aria-label={getAriaLabel()}\n onClick={onClick}\n >\n {action}\n </ActionButton>\n }\n />\n );\n};\n\nexport default ActionOption;\n"],"names":["ActionOption","action","priority","Priority","PRIMARY","disabled","onClick","media","title","content","complex","className","showMediaAtAllSizes","showMediaCircle","isContainerAligned","sharedProps","classNames","getAriaLabel","labels","push","join","undefined","_jsx","Option","button","ActionButton","children"],"mappings":";;;;;;AAoBMA,MAAAA,YAAY,GAAGA,CAAC;EACpBC,MAAM;EACNC,QAAQ,GAAGC,QAAQ,CAACC,OAAO;EAC3BC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC,KAAK;EACLC,OAAO;EACPC,OAAO;EACPC,SAAS;EACTC,mBAAmB;EACnBC,eAAe;AACfC,EAAAA,kBAAAA;AAAkB,CACA,KAAI;AACtB,EAAA,MAAMC,WAAW,GAAG;IAClBR,KAAK;IACLC,KAAK;IACLC,OAAO;IACPC,OAAO;IACPL,QAAQ;IACRO,mBAAmB;IACnBC,eAAe;AACfF,IAAAA,SAAS,EAAEK,UAAU,CAAC,kBAAkB,EAAEL,SAAS,CAAC;AACpDG,IAAAA,kBAAAA;GACD,CAAA;EAED,MAAMG,YAAY,GAAGA,MAAyB;IAC5C,MAAMC,MAAM,GAAa,EAAE,CAAA;AAE3B,IAAA,IAAI,OAAOV,KAAK,KAAK,QAAQ,EAAE;AAC7BU,MAAAA,MAAM,CAACC,IAAI,CAACX,KAAK,CAAC,CAAA;AACpB,KAAA;AAEA,IAAA,IAAI,OAAOP,MAAM,KAAK,QAAQ,EAAE;AAC9BiB,MAAAA,MAAM,CAACC,IAAI,CAAClB,MAAM,CAAC,CAAA;AACrB,KAAA;AAEA,IAAA,OAAOiB,MAAM,CAACE,IAAI,CAAC,IAAI,CAAC,IAAIC,SAAS,CAAA;GACtC,CAAA;EAED,oBACEC,GAAA,CAACC,MAAM,EAAA;AAAA,IAAA,GACDR,WAAW;IACfS,MAAM,eACJF,GAAA,CAACG,YAAY,EAAA;AACXvB,MAAAA,QAAQ,EAAEA,QAAS;AACnBG,MAAAA,QAAQ,EAAEA,QAAS;MACnB,YAAYY,EAAAA,YAAY,EAAG;AAC3BX,MAAAA,OAAO,EAAEA,OAAQ;AAAAoB,MAAAA,QAAA,EAEhBzB,MAAAA;KACW,CAAA;AACf,GAAA,CACD,CAAA;AAEN;;;;"}
1
+ {"version":3,"file":"ActionOption.mjs","sources":["../../src/actionOption/ActionOption.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport ActionButton from '../actionButton';\nimport { CommonProps, Priority, PriorityPrimary, PrioritySecondary } from '../common';\nimport Option from '../common/Option';\n\nexport type ActionOptionProps = {\n complex?: boolean;\n content?: React.ReactNode;\n disabled?: boolean;\n media?: React.ReactNode;\n showMediaAtAllSizes?: boolean;\n onClick: () => void;\n title: React.ReactNode;\n action: React.ReactNode;\n priority?: PriorityPrimary | PrioritySecondary;\n showMediaCircle?: boolean;\n isContainerAligned?: boolean;\n as?: React.ElementType;\n} & CommonProps;\n\nconst ActionOption = ({\n action,\n priority = Priority.PRIMARY,\n disabled,\n onClick,\n media,\n title,\n content,\n complex,\n className,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n as,\n}: ActionOptionProps) => {\n const sharedProps = {\n media,\n title,\n content,\n complex,\n disabled,\n showMediaAtAllSizes,\n showMediaCircle,\n className: classNames('tw-action-option', className),\n isContainerAligned,\n as,\n };\n\n const getAriaLabel = (): string | undefined => {\n const labels: string[] = [];\n\n if (typeof title === 'string') {\n labels.push(title);\n }\n\n if (typeof action === 'string') {\n labels.push(action);\n }\n\n return labels.join(', ') || undefined;\n };\n\n return (\n <Option\n {...sharedProps}\n button={\n <ActionButton\n priority={priority}\n disabled={disabled}\n aria-label={getAriaLabel()}\n onClick={onClick}\n >\n {action}\n </ActionButton>\n }\n />\n );\n};\n\nexport default ActionOption;\n"],"names":["ActionOption","action","priority","Priority","PRIMARY","disabled","onClick","media","title","content","complex","className","showMediaAtAllSizes","showMediaCircle","isContainerAligned","as","sharedProps","classNames","getAriaLabel","labels","push","join","undefined","_jsx","Option","button","ActionButton","children"],"mappings":";;;;;;AAqBMA,MAAAA,YAAY,GAAGA,CAAC;EACpBC,MAAM;EACNC,QAAQ,GAAGC,QAAQ,CAACC,OAAO;EAC3BC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC,KAAK;EACLC,OAAO;EACPC,OAAO;EACPC,SAAS;EACTC,mBAAmB;EACnBC,eAAe;EACfC,kBAAkB;AAClBC,EAAAA,EAAAA;AAAE,CACgB,KAAI;AACtB,EAAA,MAAMC,WAAW,GAAG;IAClBT,KAAK;IACLC,KAAK;IACLC,OAAO;IACPC,OAAO;IACPL,QAAQ;IACRO,mBAAmB;IACnBC,eAAe;AACfF,IAAAA,SAAS,EAAEM,UAAU,CAAC,kBAAkB,EAAEN,SAAS,CAAC;IACpDG,kBAAkB;AAClBC,IAAAA,EAAAA;GACD,CAAA;EAED,MAAMG,YAAY,GAAGA,MAAyB;IAC5C,MAAMC,MAAM,GAAa,EAAE,CAAA;AAE3B,IAAA,IAAI,OAAOX,KAAK,KAAK,QAAQ,EAAE;AAC7BW,MAAAA,MAAM,CAACC,IAAI,CAACZ,KAAK,CAAC,CAAA;AACpB,KAAA;AAEA,IAAA,IAAI,OAAOP,MAAM,KAAK,QAAQ,EAAE;AAC9BkB,MAAAA,MAAM,CAACC,IAAI,CAACnB,MAAM,CAAC,CAAA;AACrB,KAAA;AAEA,IAAA,OAAOkB,MAAM,CAACE,IAAI,CAAC,IAAI,CAAC,IAAIC,SAAS,CAAA;GACtC,CAAA;EAED,oBACEC,GAAA,CAACC,MAAM,EAAA;AAAA,IAAA,GACDR,WAAW;IACfS,MAAM,eACJF,GAAA,CAACG,YAAY,EAAA;AACXxB,MAAAA,QAAQ,EAAEA,QAAS;AACnBG,MAAAA,QAAQ,EAAEA,QAAS;MACnB,YAAYa,EAAAA,YAAY,EAAG;AAC3BZ,MAAAA,OAAO,EAAEA,OAAQ;AAAAqB,MAAAA,QAAA,EAEhB1B,MAAAA;KACW,CAAA;AACf,GAAA,CACD,CAAA;AAEN;;;;"}
package/build/main.css CHANGED
@@ -5472,6 +5472,11 @@ label.np-upload-button:not(.disabled):active {
5472
5472
  .np-upload-button .media {
5473
5473
  align-items: flex-start;
5474
5474
  }
5475
+ @media (max-width: 320px) {
5476
+ .np-upload-icon {
5477
+ padding-left: 0;
5478
+ }
5479
+ }
5475
5480
  .np-upload-input.form-control {
5476
5481
  height: auto;
5477
5482
  padding: 0;
@@ -5563,9 +5568,9 @@ label.np-upload-button:not(.disabled):active {
5563
5568
  border: 1px solid var(--color-interactive-secondary);
5564
5569
  position: relative;
5565
5570
  }
5566
- .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
5567
- .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before,
5568
- .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
5571
+ .np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
5572
+ .np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before,
5573
+ .np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
5569
5574
  display: block;
5570
5575
  position: absolute;
5571
5576
  height: 1px;
@@ -5577,27 +5582,27 @@ label.np-upload-button:not(.disabled):active {
5577
5582
  width: calc(100% - 2 * 16px);
5578
5583
  width: calc(100% - 2 * var(--size-16));
5579
5584
  }
5580
- .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
5581
- .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before {
5585
+ .np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
5586
+ .np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before {
5582
5587
  top: 0;
5583
5588
  }
5584
- .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
5589
+ .np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
5585
5590
  bottom: -1px;
5586
5591
  }
5587
5592
  .np-upload-item:first-child ~ div {
5588
5593
  border-top: 1px;
5589
5594
  }
5590
- .np-upload-item:not(:first-child) .np-upload-item--link:hover {
5595
+ .np-upload-item:not(:first-child) .np-upload-item__link:hover {
5591
5596
  border-top-color: rgba(0,0,0,0.10196);
5592
5597
  border-top-color: var(--color-border-neutral);
5593
5598
  }
5594
5599
  .np-upload-item:not(:last-child) {
5595
5600
  border-bottom: 0;
5596
5601
  }
5597
- .np-upload-item.np-upload-item__link:hover + .np-upload-item:before,
5598
- .np-upload-item.np-upload-item__link:hover + .np-upload-button-container:before,
5599
- .np-upload-item.np-upload-item__link:hover + .np-upload-item .np-upload-item--link:before,
5600
- .np-upload-item.np-upload-item__link:hover + .np-upload-button-container .np-upload-item--link:before {
5602
+ .np-upload-item.np-upload-item--link:hover + .np-upload-item:before,
5603
+ .np-upload-item.np-upload-item--link:hover + .np-upload-button-container:before,
5604
+ .np-upload-item.np-upload-item--link:hover + .np-upload-item .np-upload-item__link:before,
5605
+ .np-upload-item.np-upload-item--link:hover + .np-upload-button-container .np-upload-item__link:before {
5601
5606
  display: none;
5602
5607
  }
5603
5608
  .np-upload-button-container:hover:before,
@@ -5612,38 +5617,41 @@ label.np-upload-button:not(.disabled):active {
5612
5617
  outline-offset: -3px;
5613
5618
  }
5614
5619
  .np-upload-item--single-file:focus-visible,
5615
- .np-upload-item--link:focus-visible,
5620
+ .np-upload-item__link:focus-visible,
5616
5621
  .np-upload-button-container:has(:focus-visible) {
5617
5622
  outline-width: 3px;
5618
5623
  }
5619
- .np-upload-item__link a {
5624
+ .np-upload-item--link a {
5620
5625
  flex: 1;
5621
5626
  -webkit-text-decoration: none;
5622
5627
  text-decoration: none;
5623
5628
  border-top: 1px solid transparent;
5624
5629
  border-radius: inherit;
5625
5630
  }
5626
- .np-upload-item__link a:focus-visible {
5631
+ .np-upload-item--link a:focus-visible {
5627
5632
  outline-offset: -2px;
5628
5633
  }
5629
- .np-upload-item__link a:hover:before {
5634
+ .np-upload-item--link a:hover:before {
5630
5635
  display: none !important;
5631
5636
  }
5632
- .np-upload-item__link a:hover:after {
5637
+ .np-upload-item--link a:hover:after {
5633
5638
  left: 0 !important;
5634
5639
  width: 100% !important;
5635
5640
  }
5636
- .np-upload-item__link a:hover,
5637
- .np-upload-item__link a:active {
5641
+ .np-upload-item--link a:hover,
5642
+ .np-upload-item--link a:active {
5638
5643
  -webkit-text-decoration: none;
5639
5644
  text-decoration: none;
5640
5645
  }
5641
- .np-upload-item__link a:hover .np-upload-button,
5642
- .np-upload-item__link a:active .np-upload-button {
5646
+ .np-upload-item--link a:hover .np-upload-button,
5647
+ .np-upload-item--link a:active .np-upload-button {
5643
5648
  background-color: rgba(134,167,189,0.10196);
5644
5649
  background-color: var(--color-background-neutral);
5645
5650
  border-radius: inherit;
5646
5651
  }
5652
+ .np-upload-item--link:first-of-type a {
5653
+ border-top: 0;
5654
+ }
5647
5655
  .np-upload-item__body {
5648
5656
  display: flex;
5649
5657
  align-items: center;
@@ -5472,6 +5472,11 @@ label.np-upload-button:not(.disabled):active {
5472
5472
  .np-upload-button .media {
5473
5473
  align-items: flex-start;
5474
5474
  }
5475
+ @media (max-width: 320px) {
5476
+ .np-upload-icon {
5477
+ padding-left: 0;
5478
+ }
5479
+ }
5475
5480
  .np-upload-input.form-control {
5476
5481
  height: auto;
5477
5482
  padding: 0;
@@ -5563,9 +5568,9 @@ label.np-upload-button:not(.disabled):active {
5563
5568
  border: 1px solid var(--color-interactive-secondary);
5564
5569
  position: relative;
5565
5570
  }
5566
- .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
5567
- .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before,
5568
- .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
5571
+ .np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
5572
+ .np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before,
5573
+ .np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
5569
5574
  display: block;
5570
5575
  position: absolute;
5571
5576
  height: 1px;
@@ -5577,27 +5582,27 @@ label.np-upload-button:not(.disabled):active {
5577
5582
  width: calc(100% - 2 * 16px);
5578
5583
  width: calc(100% - 2 * var(--size-16));
5579
5584
  }
5580
- .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
5581
- .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before {
5585
+ .np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
5586
+ .np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before {
5582
5587
  top: 0;
5583
5588
  }
5584
- .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
5589
+ .np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
5585
5590
  bottom: -1px;
5586
5591
  }
5587
5592
  .np-upload-item:first-child ~ div {
5588
5593
  border-top: 1px;
5589
5594
  }
5590
- .np-upload-item:not(:first-child) .np-upload-item--link:hover {
5595
+ .np-upload-item:not(:first-child) .np-upload-item__link:hover {
5591
5596
  border-top-color: rgba(0,0,0,0.10196);
5592
5597
  border-top-color: var(--color-border-neutral);
5593
5598
  }
5594
5599
  .np-upload-item:not(:last-child) {
5595
5600
  border-bottom: 0;
5596
5601
  }
5597
- .np-upload-item.np-upload-item__link:hover + .np-upload-item:before,
5598
- .np-upload-item.np-upload-item__link:hover + .np-upload-button-container:before,
5599
- .np-upload-item.np-upload-item__link:hover + .np-upload-item .np-upload-item--link:before,
5600
- .np-upload-item.np-upload-item__link:hover + .np-upload-button-container .np-upload-item--link:before {
5602
+ .np-upload-item.np-upload-item--link:hover + .np-upload-item:before,
5603
+ .np-upload-item.np-upload-item--link:hover + .np-upload-button-container:before,
5604
+ .np-upload-item.np-upload-item--link:hover + .np-upload-item .np-upload-item__link:before,
5605
+ .np-upload-item.np-upload-item--link:hover + .np-upload-button-container .np-upload-item__link:before {
5601
5606
  display: none;
5602
5607
  }
5603
5608
  .np-upload-button-container:hover:before,
@@ -5612,38 +5617,41 @@ label.np-upload-button:not(.disabled):active {
5612
5617
  outline-offset: -3px;
5613
5618
  }
5614
5619
  .np-upload-item--single-file:focus-visible,
5615
- .np-upload-item--link:focus-visible,
5620
+ .np-upload-item__link:focus-visible,
5616
5621
  .np-upload-button-container:has(:focus-visible) {
5617
5622
  outline-width: 3px;
5618
5623
  }
5619
- .np-upload-item__link a {
5624
+ .np-upload-item--link a {
5620
5625
  flex: 1;
5621
5626
  -webkit-text-decoration: none;
5622
5627
  text-decoration: none;
5623
5628
  border-top: 1px solid transparent;
5624
5629
  border-radius: inherit;
5625
5630
  }
5626
- .np-upload-item__link a:focus-visible {
5631
+ .np-upload-item--link a:focus-visible {
5627
5632
  outline-offset: -2px;
5628
5633
  }
5629
- .np-upload-item__link a:hover:before {
5634
+ .np-upload-item--link a:hover:before {
5630
5635
  display: none !important;
5631
5636
  }
5632
- .np-upload-item__link a:hover:after {
5637
+ .np-upload-item--link a:hover:after {
5633
5638
  left: 0 !important;
5634
5639
  width: 100% !important;
5635
5640
  }
5636
- .np-upload-item__link a:hover,
5637
- .np-upload-item__link a:active {
5641
+ .np-upload-item--link a:hover,
5642
+ .np-upload-item--link a:active {
5638
5643
  -webkit-text-decoration: none;
5639
5644
  text-decoration: none;
5640
5645
  }
5641
- .np-upload-item__link a:hover .np-upload-button,
5642
- .np-upload-item__link a:active .np-upload-button {
5646
+ .np-upload-item--link a:hover .np-upload-button,
5647
+ .np-upload-item--link a:active .np-upload-button {
5643
5648
  background-color: rgba(134,167,189,0.10196);
5644
5649
  background-color: var(--color-background-neutral);
5645
5650
  border-radius: inherit;
5646
5651
  }
5652
+ .np-upload-item--link:first-of-type a {
5653
+ border-top: 0;
5654
+ }
5647
5655
  .np-upload-item__body {
5648
5656
  display: flex;
5649
5657
  align-items: center;
@@ -37,3 +37,8 @@ label.np-upload-button:not(.disabled):active {
37
37
  .np-upload-button .media {
38
38
  align-items: flex-start;
39
39
  }
40
+ @media (max-width: 320px) {
41
+ .np-upload-icon {
42
+ padding-left: 0;
43
+ }
44
+ }
@@ -3,9 +3,9 @@
3
3
  border: 1px solid var(--color-interactive-secondary);
4
4
  position: relative;
5
5
  }
6
- .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
7
- .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before,
8
- .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
6
+ .np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
7
+ .np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before,
8
+ .np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
9
9
  display: block;
10
10
  position: absolute;
11
11
  height: 1px;
@@ -17,27 +17,27 @@
17
17
  width: calc(100% - 2 * 16px);
18
18
  width: calc(100% - 2 * var(--size-16));
19
19
  }
20
- .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
21
- .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before {
20
+ .np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
21
+ .np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before {
22
22
  top: 0;
23
23
  }
24
- .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
24
+ .np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
25
25
  bottom: -1px;
26
26
  }
27
27
  .np-upload-item:first-child ~ div {
28
28
  border-top: 1px;
29
29
  }
30
- .np-upload-item:not(:first-child) .np-upload-item--link:hover {
30
+ .np-upload-item:not(:first-child) .np-upload-item__link:hover {
31
31
  border-top-color: rgba(0,0,0,0.10196);
32
32
  border-top-color: var(--color-border-neutral);
33
33
  }
34
34
  .np-upload-item:not(:last-child) {
35
35
  border-bottom: 0;
36
36
  }
37
- .np-upload-item.np-upload-item__link:hover + .np-upload-item:before,
38
- .np-upload-item.np-upload-item__link:hover + .np-upload-button-container:before,
39
- .np-upload-item.np-upload-item__link:hover + .np-upload-item .np-upload-item--link:before,
40
- .np-upload-item.np-upload-item__link:hover + .np-upload-button-container .np-upload-item--link:before {
37
+ .np-upload-item.np-upload-item--link:hover + .np-upload-item:before,
38
+ .np-upload-item.np-upload-item--link:hover + .np-upload-button-container:before,
39
+ .np-upload-item.np-upload-item--link:hover + .np-upload-item .np-upload-item__link:before,
40
+ .np-upload-item.np-upload-item--link:hover + .np-upload-button-container .np-upload-item__link:before {
41
41
  display: none;
42
42
  }
43
43
  .np-upload-button-container:hover:before,
@@ -52,38 +52,41 @@
52
52
  outline-offset: -3px;
53
53
  }
54
54
  .np-upload-item--single-file:focus-visible,
55
- .np-upload-item--link:focus-visible,
55
+ .np-upload-item__link:focus-visible,
56
56
  .np-upload-button-container:has(:focus-visible) {
57
57
  outline-width: 3px;
58
58
  }
59
- .np-upload-item__link a {
59
+ .np-upload-item--link a {
60
60
  flex: 1;
61
61
  -webkit-text-decoration: none;
62
62
  text-decoration: none;
63
63
  border-top: 1px solid transparent;
64
64
  border-radius: inherit;
65
65
  }
66
- .np-upload-item__link a:focus-visible {
66
+ .np-upload-item--link a:focus-visible {
67
67
  outline-offset: -2px;
68
68
  }
69
- .np-upload-item__link a:hover:before {
69
+ .np-upload-item--link a:hover:before {
70
70
  display: none !important;
71
71
  }
72
- .np-upload-item__link a:hover:after {
72
+ .np-upload-item--link a:hover:after {
73
73
  left: 0 !important;
74
74
  width: 100% !important;
75
75
  }
76
- .np-upload-item__link a:hover,
77
- .np-upload-item__link a:active {
76
+ .np-upload-item--link a:hover,
77
+ .np-upload-item--link a:active {
78
78
  -webkit-text-decoration: none;
79
79
  text-decoration: none;
80
80
  }
81
- .np-upload-item__link a:hover .np-upload-button,
82
- .np-upload-item__link a:active .np-upload-button {
81
+ .np-upload-item--link a:hover .np-upload-button,
82
+ .np-upload-item--link a:active .np-upload-button {
83
83
  background-color: rgba(134,167,189,0.10196);
84
84
  background-color: var(--color-background-neutral);
85
85
  border-radius: inherit;
86
86
  }
87
+ .np-upload-item--link:first-of-type a {
88
+ border-top: 0;
89
+ }
87
90
  .np-upload-item__body {
88
91
  display: flex;
89
92
  align-items: center;
@@ -11,7 +11,8 @@ export type ActionOptionProps = {
11
11
  priority?: PriorityPrimary | PrioritySecondary;
12
12
  showMediaCircle?: boolean;
13
13
  isContainerAligned?: boolean;
14
+ as?: React.ElementType;
14
15
  } & CommonProps;
15
- declare const ActionOption: ({ action, priority, disabled, onClick, media, title, content, complex, className, showMediaAtAllSizes, showMediaCircle, isContainerAligned, }: ActionOptionProps) => import("react").JSX.Element;
16
+ declare const ActionOption: ({ action, priority, disabled, onClick, media, title, content, complex, className, showMediaAtAllSizes, showMediaCircle, isContainerAligned, as, }: ActionOptionProps) => import("react").JSX.Element;
16
17
  export default ActionOption;
17
18
  //# sourceMappingURL=ActionOption.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionOption.d.ts","sourceRoot":"","sources":["../../../src/actionOption/ActionOption.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAY,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGtF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,eAAe,GAAG,iBAAiB,CAAC;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GAAG,WAAW,CAAC;AAEhB,QAAA,MAAM,YAAY,kJAaf,iBAAiB,gCA0CnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"ActionOption.d.ts","sourceRoot":"","sources":["../../../src/actionOption/ActionOption.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAY,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGtF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,eAAe,GAAG,iBAAiB,CAAC;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;CACxB,GAAG,WAAW,CAAC;AAEhB,QAAA,MAAM,YAAY,sJAcf,iBAAiB,gCA2CnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -4,6 +4,6 @@ type UploadItemLinkProps = PropsWithChildren<{
4
4
  onDownload?: (event: MouseEvent) => void;
5
5
  singleFileUpload: boolean;
6
6
  }>;
7
- export declare const UploadItemBody: ({ children, url, onDownload, singleFileUpload, }: UploadItemLinkProps) => import("react").JSX.Element;
7
+ export declare const UploadItemLink: ({ children, url, onDownload, singleFileUpload, }: UploadItemLinkProps) => import("react").JSX.Element;
8
8
  export {};
9
- //# sourceMappingURL=UploadItemBody.d.ts.map
9
+ //# sourceMappingURL=UploadItemLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UploadItemLink.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItemLink.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGtD,KAAK,mBAAmB,GAAG,iBAAiB,CAAC;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC,CAAC;AAEH,eAAO,MAAM,cAAc,qDAKxB,mBAAmB,gCAmBrB,CAAC"}
@@ -9,7 +9,7 @@ var Body = require('../../body/Body.js');
9
9
  var ProcessIndicator = require('../../processIndicator/ProcessIndicator.js');
10
10
  var StatusIcon = require('../../statusIcon/StatusIcon.js');
11
11
  var UploadItem_messages = require('./UploadItem.messages.js');
12
- var UploadItemBody = require('./UploadItemBody.js');
12
+ var UploadItemLink = require('./UploadItemLink.js');
13
13
  var jsxRuntime = require('react/jsx-runtime');
14
14
  var sentiment = require('../../common/propsValues/sentiment.js');
15
15
  var status = require('../../common/propsValues/status.js');
@@ -126,12 +126,12 @@ const UploadItem = ({
126
126
  };
127
127
  return /*#__PURE__*/jsxRuntime.jsx("div", {
128
128
  className: classNames__default.default('np-upload-item', {
129
- 'np-upload-item__link': isSucceeded
129
+ 'np-upload-item--link': isSucceeded
130
130
  }),
131
131
  "data-testid": exports.TEST_IDS.uploadItem,
132
132
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
133
133
  className: "np-upload-item__body",
134
- children: [/*#__PURE__*/jsxRuntime.jsx(UploadItemBody.UploadItemBody, {
134
+ children: [/*#__PURE__*/jsxRuntime.jsx(UploadItemLink.UploadItemLink, {
135
135
  url: isSucceeded ? url : undefined,
136
136
  singleFileUpload: singleFileUpload,
137
137
  onDownload: onDownloadFile,
@@ -1 +1 @@
1
- {"version":3,"file":"UploadItem.js","sources":["../../../src/uploadInput/uploadItem/UploadItem.tsx"],"sourcesContent":["import { Bin } from '@transferwise/icons';\nimport classNames from 'classnames';\nimport { useIntl } from 'react-intl';\n\nimport Body from '../../body';\nimport { Size, Status, Typography, Sentiment } from '../../common';\nimport ProcessIndicator from '../../processIndicator/ProcessIndicator';\nimport StatusIcon from '../../statusIcon/StatusIcon';\nimport { UploadedFile, UploadError } from '../types';\n\nimport MESSAGES from './UploadItem.messages';\nimport { UploadItemBody } from './UploadItemBody';\n\nexport type UploadItemProps = JSX.IntrinsicAttributes & {\n file: UploadedFile;\n /**\n * Is this Item part of a multiple- or single-file UploadInput\n */\n singleFileUpload: boolean;\n canDelete: boolean;\n onDelete: () => void;\n\n /**\n * Callback to be called when the file link is clicked.\n * When provided, you need to manually trigger actions to load/download the file.\n *\n * @param file\n */\n onDownload?: (file: UploadedFile) => void;\n};\n\nexport enum TEST_IDS {\n uploadItem = 'uploadItem',\n mediaBody = 'mediaBody',\n}\n\nconst UploadItem = ({\n file,\n canDelete,\n onDelete,\n onDownload,\n singleFileUpload,\n}: UploadItemProps) => {\n const { formatMessage } = useIntl();\n const { status, filename, error, errors, url } = file;\n\n const isSucceeded = [Status.SUCCEEDED, undefined].includes(status) && !!url;\n\n const getIcon = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return <StatusIcon size={Size.SMALL} sentiment={Sentiment.NEGATIVE} />;\n }\n\n let processIndicator: React.ReactNode;\n\n switch (status) {\n case Status.PROCESSING:\n case Status.PENDING:\n processIndicator = <ProcessIndicator size={Size.EXTRA_SMALL} status={Status.PROCESSING} />;\n break;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n processIndicator = <StatusIcon size={Size.SMALL} sentiment={Sentiment.POSITIVE} />;\n }\n\n return processIndicator;\n };\n\n const getErrorMessage = (error?: UploadError) =>\n typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);\n\n const getMultipleErrors = (errors?: UploadError[]) => {\n if (!errors?.length) {\n return null;\n }\n\n if (errors?.length === 1) {\n return getErrorMessage(errors[0]);\n }\n\n return (\n <ul className=\"np-upload-input-errors m-b-0\">\n {errors.map((error, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <li key={index}>{getErrorMessage(error)}</li>;\n })}\n </ul>\n );\n };\n\n const getDescription = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-negative\">\n {errors?.length ? getMultipleErrors(errors) : getErrorMessage(error)}\n </Body>\n );\n }\n\n switch (status) {\n case Status.PENDING:\n return <Body type={Typography.BODY_DEFAULT_BOLD}>{formatMessage(MESSAGES.uploading)}</Body>;\n case Status.PROCESSING:\n return <Body>{formatMessage(MESSAGES.deleting)}</Body>;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-positive\">\n {formatMessage(MESSAGES.uploaded)}\n </Body>\n );\n }\n };\n\n const getTitle = () => {\n return filename || formatMessage(MESSAGES.uploadedFile);\n };\n\n const onDownloadFile = (event: React.MouseEvent): void => {\n if (onDownload) {\n event.preventDefault();\n onDownload(file);\n }\n };\n\n return (\n <div\n className={classNames('np-upload-item', { 'np-upload-item__link': isSucceeded })}\n data-testid={TEST_IDS.uploadItem}\n >\n <div className=\"np-upload-item__body\">\n <UploadItemBody\n url={isSucceeded ? url : undefined}\n singleFileUpload={singleFileUpload}\n onDownload={onDownloadFile}\n >\n <div className=\"np-upload-button\" aria-live=\"polite\">\n <div className=\"media\">\n <div className=\"np-upload-icon media-left\">{getIcon()}</div>\n <div className=\"media-body text-xs-left\" data-testid={TEST_IDS.mediaBody}>\n <Body className=\"text-word-break d-block text-primary\">{getTitle()}</Body>\n {getDescription()}\n </div>\n </div>\n </div>\n </UploadItemBody>\n {canDelete && (\n <button\n aria-label={formatMessage(MESSAGES.removeFile, { filename })}\n className={classNames('btn', 'np-upload-item__remove-button', 'media-left', {\n 'np-upload-item--single-file': singleFileUpload,\n })}\n type=\"button\"\n onClick={() => onDelete()}\n >\n <Bin size={16} />\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default UploadItem;\n"],"names":["TEST_IDS","UploadItem","file","canDelete","onDelete","onDownload","singleFileUpload","formatMessage","useIntl","status","filename","error","errors","url","isSucceeded","Status","SUCCEEDED","undefined","includes","getIcon","length","FAILED","_jsx","StatusIcon","size","Size","SMALL","sentiment","Sentiment","NEGATIVE","processIndicator","PROCESSING","PENDING","ProcessIndicator","EXTRA_SMALL","DONE","POSITIVE","getErrorMessage","message","MESSAGES","uploadingFailed","getMultipleErrors","className","children","map","index","getDescription","Body","type","Typography","BODY_DEFAULT_BOLD","uploading","deleting","uploaded","getTitle","uploadedFile","onDownloadFile","event","preventDefault","classNames","uploadItem","_jsxs","UploadItemBody","mediaBody","removeFile","onClick","Bin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+BYA,0BAGX;AAHD,CAAA,UAAYA,QAAQ,EAAA;AAClBA,EAAAA,QAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACzB,CAAC,EAHWA,gBAAQ,KAARA,gBAAQ,GAGnB,EAAA,CAAA,CAAA,CAAA;AAEKC,MAAAA,UAAU,GAAGA,CAAC;EAClBC,IAAI;EACJC,SAAS;EACTC,QAAQ;EACRC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACA,KAAI;EACpB,MAAM;AAAEC,IAAAA,aAAAA;GAAe,GAAGC,iBAAO,EAAE,CAAA;EACnC,MAAM;YAAEC,QAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,MAAM;AAAEC,IAAAA,GAAAA;AAAK,GAAA,GAAGX,IAAI,CAAA;AAErD,EAAA,MAAMY,WAAW,GAAG,CAACC,aAAM,CAACC,SAAS,EAAEC,SAAS,CAAC,CAACC,QAAQ,CAACT,QAAM,CAAC,IAAI,CAAC,CAACI,GAAG,CAA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AAA;AAAKnB,YAAAA,SAAS,EAAC,OAAO;AAAAC,YAAAA,QAAA,gBACpBrB,cAAA,CAAA,KAAA,EAAA;AAAKoB,cAAAA,SAAS,EAAC,2BAA2B;cAAAC,QAAA,EAAExB,OAAO,EAAE;aAAM,CAC3D,eAAA0C,eAAA,CAAA,KAAA,EAAA;AAAKnB,cAAAA,SAAS,EAAC,yBAAyB;cAAC,aAAa1C,EAAAA,gBAAQ,CAAC+D,SAAU;cAAApB,QAAA,EAAA,cACvErB,cAAA,CAACyB,IAAI,EAAA;AAACL,gBAAAA,SAAS,EAAC,sCAAsC;gBAAAC,QAAA,EAAEW,QAAQ,EAAE;AAAA,eAAO,CACzE,EAACR,cAAc,EAAE,CAAA;AAAA,aACd,CACP,CAAA;WAAK,CAAA;SACF,CAAA;AACP,OAAgB,CAChB,EAAC3C,SAAS,iBACRmB,cAAA,CAAA,QAAA,EAAA;AACE,QAAA,YAAA,EAAYf,aAAa,CAACgC,mBAAQ,CAACyB,UAAU,EAAE;AAAEtD,UAAAA,QAAAA;AAAU,SAAA,CAAE;QAC7DgC,SAAS,EAAEiB,2BAAU,CAAC,KAAK,EAAE,+BAA+B,EAAE,YAAY,EAAE;AAC1E,UAAA,6BAA6B,EAAErD,gBAAAA;AAChC,SAAA,CAAE;AACH0C,QAAAA,IAAI,EAAC,QAAQ;AACbiB,QAAAA,OAAO,EAAEA,MAAM7D,QAAQ,EAAG;QAAAuC,QAAA,eAE1BrB,cAAA,CAAC4C,SAAG,EAAA;AAAC1C,UAAAA,IAAI,EAAE,EAAA;SACb,CAAA;AAAA,OAAQ,CACT,CAAA;KACE,CAAA;AACP,GAAK,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"UploadItem.js","sources":["../../../src/uploadInput/uploadItem/UploadItem.tsx"],"sourcesContent":["import { Bin } from '@transferwise/icons';\nimport classNames from 'classnames';\nimport { useIntl } from 'react-intl';\n\nimport Body from '../../body';\nimport { Size, Status, Typography, Sentiment } from '../../common';\nimport ProcessIndicator from '../../processIndicator/ProcessIndicator';\nimport StatusIcon from '../../statusIcon/StatusIcon';\nimport { UploadedFile, UploadError } from '../types';\n\nimport MESSAGES from './UploadItem.messages';\nimport { UploadItemLink } from './UploadItemLink';\n\nexport type UploadItemProps = JSX.IntrinsicAttributes & {\n file: UploadedFile;\n /**\n * Is this Item part of a multiple- or single-file UploadInput\n */\n singleFileUpload: boolean;\n canDelete: boolean;\n onDelete: () => void;\n\n /**\n * Callback to be called when the file link is clicked.\n * When provided, you need to manually trigger actions to load/download the file.\n *\n * @param file\n */\n onDownload?: (file: UploadedFile) => void;\n};\n\nexport enum TEST_IDS {\n uploadItem = 'uploadItem',\n mediaBody = 'mediaBody',\n}\n\nconst UploadItem = ({\n file,\n canDelete,\n onDelete,\n onDownload,\n singleFileUpload,\n}: UploadItemProps) => {\n const { formatMessage } = useIntl();\n const { status, filename, error, errors, url } = file;\n\n const isSucceeded = [Status.SUCCEEDED, undefined].includes(status) && !!url;\n\n const getIcon = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return <StatusIcon size={Size.SMALL} sentiment={Sentiment.NEGATIVE} />;\n }\n\n let processIndicator: React.ReactNode;\n\n switch (status) {\n case Status.PROCESSING:\n case Status.PENDING:\n processIndicator = <ProcessIndicator size={Size.EXTRA_SMALL} status={Status.PROCESSING} />;\n break;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n processIndicator = <StatusIcon size={Size.SMALL} sentiment={Sentiment.POSITIVE} />;\n }\n\n return processIndicator;\n };\n\n const getErrorMessage = (error?: UploadError) =>\n typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);\n\n const getMultipleErrors = (errors?: UploadError[]) => {\n if (!errors?.length) {\n return null;\n }\n\n if (errors?.length === 1) {\n return getErrorMessage(errors[0]);\n }\n\n return (\n <ul className=\"np-upload-input-errors m-b-0\">\n {errors.map((error, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <li key={index}>{getErrorMessage(error)}</li>;\n })}\n </ul>\n );\n };\n\n const getDescription = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-negative\">\n {errors?.length ? getMultipleErrors(errors) : getErrorMessage(error)}\n </Body>\n );\n }\n\n switch (status) {\n case Status.PENDING:\n return <Body type={Typography.BODY_DEFAULT_BOLD}>{formatMessage(MESSAGES.uploading)}</Body>;\n case Status.PROCESSING:\n return <Body>{formatMessage(MESSAGES.deleting)}</Body>;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-positive\">\n {formatMessage(MESSAGES.uploaded)}\n </Body>\n );\n }\n };\n\n const getTitle = () => {\n return filename || formatMessage(MESSAGES.uploadedFile);\n };\n\n const onDownloadFile = (event: React.MouseEvent): void => {\n if (onDownload) {\n event.preventDefault();\n onDownload(file);\n }\n };\n\n return (\n <div\n className={classNames('np-upload-item', { 'np-upload-item--link': isSucceeded })}\n data-testid={TEST_IDS.uploadItem}\n >\n <div className=\"np-upload-item__body\">\n <UploadItemLink\n url={isSucceeded ? url : undefined}\n singleFileUpload={singleFileUpload}\n onDownload={onDownloadFile}\n >\n <div className=\"np-upload-button\" aria-live=\"polite\">\n <div className=\"media\">\n <div className=\"np-upload-icon media-left\">{getIcon()}</div>\n <div className=\"media-body text-xs-left\" data-testid={TEST_IDS.mediaBody}>\n <Body className=\"text-word-break d-block text-primary\">{getTitle()}</Body>\n {getDescription()}\n </div>\n </div>\n </div>\n </UploadItemLink>\n {canDelete && (\n <button\n aria-label={formatMessage(MESSAGES.removeFile, { filename })}\n className={classNames('btn', 'np-upload-item__remove-button', 'media-left', {\n 'np-upload-item--single-file': singleFileUpload,\n })}\n type=\"button\"\n onClick={() => onDelete()}\n >\n <Bin size={16} />\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default UploadItem;\n"],"names":["TEST_IDS","UploadItem","file","canDelete","onDelete","onDownload","singleFileUpload","formatMessage","useIntl","status","filename","error","errors","url","isSucceeded","Status","SUCCEEDED","undefined","includes","getIcon","length","FAILED","_jsx","StatusIcon","size","Size","SMALL","sentiment","Sentiment","NEGATIVE","processIndicator","PROCESSING","PENDING","ProcessIndicator","EXTRA_SMALL","DONE","POSITIVE","getErrorMessage","message","MESSAGES","uploadingFailed","getMultipleErrors","className","children","map","index","getDescription","Body","type","Typography","BODY_DEFAULT_BOLD","uploading","deleting","uploaded","getTitle","uploadedFile","onDownloadFile","event","preventDefault","classNames","uploadItem","_jsxs","UploadItemLink","mediaBody","removeFile","onClick","Bin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+BYA,0BAGX;AAHD,CAAA,UAAYA,QAAQ,EAAA;AAClBA,EAAAA,QAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACzB,CAAC,EAHWA,gBAAQ,KAARA,gBAAQ,GAGnB,EAAA,CAAA,CAAA,CAAA;AAEKC,MAAAA,UAAU,GAAGA,CAAC;EAClBC,IAAI;EACJC,SAAS;EACTC,QAAQ;EACRC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACA,KAAI;EACpB,MAAM;AAAEC,IAAAA,aAAAA;GAAe,GAAGC,iBAAO,EAAE,CAAA;EACnC,MAAM;YAAEC,QAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,MAAM;AAAEC,IAAAA,GAAAA;AAAK,GAAA,GAAGX,IAAI,CAAA;AAErD,EAAA,MAAMY,WAAW,GAAG,CAACC,aAAM,CAACC,SAAS,EAAEC,SAAS,CAAC,CAACC,QAAQ,CAACT,QAAM,CAAC,IAAI,CAAC,CAACI,GAAG,CAAA;EAE3E,MAAMM,OAAO,GAAGA,MAAK;IACnB,IAAIR,KAAK,IAAIC,MAAM,EAAEQ,MAAM,IAAIX,QAAM,KAAKM,aAAM,CAACM,MAAM,EAAE;MACvD,oBAAOC,cAAA,CAACC,UA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AAE;aAAM,CAC3D,eAAA0C,eAAA,CAAA,KAAA,EAAA;AAAKnB,cAAAA,SAAS,EAAC,yBAAyB;cAAC,aAAa1C,EAAAA,gBAAQ,CAAC+D,SAAU;cAAApB,QAAA,EAAA,cACvErB,cAAA,CAACyB,IAAI,EAAA;AAACL,gBAAAA,SAAS,EAAC,sCAAsC;gBAAAC,QAAA,EAAEW,QAAQ,EAAE;AAAA,eAAO,CACzE,EAACR,cAAc,EAAE,CAAA;AAAA,aACd,CACP,CAAA;WAAK,CAAA;SACF,CAAA;AACP,OAAgB,CAChB,EAAC3C,SAAS,iBACRmB,cAAA,CAAA,QAAA,EAAA;AACE,QAAA,YAAA,EAAYf,aAAa,CAACgC,mBAAQ,CAACyB,UAAU,EAAE;AAAEtD,UAAAA,QAAAA;AAAU,SAAA,CAAE;QAC7DgC,SAAS,EAAEiB,2BAAU,CAAC,KAAK,EAAE,+BAA+B,EAAE,YAAY,EAAE;AAC1E,UAAA,6BAA6B,EAAErD,gBAAAA;AAChC,SAAA,CAAE;AACH0C,QAAAA,IAAI,EAAC,QAAQ;AACbiB,QAAAA,OAAO,EAAEA,MAAM7D,QAAQ,EAAG;QAAAuC,QAAA,eAE1BrB,cAAA,CAAC4C,SAAG,EAAA;AAAC1C,UAAAA,IAAI,EAAE,EAAA;SACb,CAAA;AAAA,OAAQ,CACT,CAAA;KACE,CAAA;AACP,GAAK,CAAC,CAAA;AAEV;;;;"}
@@ -5,7 +5,7 @@ import Body from '../../body/Body.mjs';
5
5
  import ProcessIndicator from '../../processIndicator/ProcessIndicator.mjs';
6
6
  import StatusIcon from '../../statusIcon/StatusIcon.mjs';
7
7
  import MESSAGES from './UploadItem.messages.mjs';
8
- import { UploadItemBody } from './UploadItemBody.mjs';
8
+ import { UploadItemLink } from './UploadItemLink.mjs';
9
9
  import { jsx, jsxs } from 'react/jsx-runtime';
10
10
  import { Sentiment } from '../../common/propsValues/sentiment.mjs';
11
11
  import { Status } from '../../common/propsValues/status.mjs';
@@ -118,12 +118,12 @@ const UploadItem = ({
118
118
  };
119
119
  return /*#__PURE__*/jsx("div", {
120
120
  className: classNames('np-upload-item', {
121
- 'np-upload-item__link': isSucceeded
121
+ 'np-upload-item--link': isSucceeded
122
122
  }),
123
123
  "data-testid": TEST_IDS.uploadItem,
124
124
  children: /*#__PURE__*/jsxs("div", {
125
125
  className: "np-upload-item__body",
126
- children: [/*#__PURE__*/jsx(UploadItemBody, {
126
+ children: [/*#__PURE__*/jsx(UploadItemLink, {
127
127
  url: isSucceeded ? url : undefined,
128
128
  singleFileUpload: singleFileUpload,
129
129
  onDownload: onDownloadFile,
@@ -1 +1 @@
1
- {"version":3,"file":"UploadItem.mjs","sources":["../../../src/uploadInput/uploadItem/UploadItem.tsx"],"sourcesContent":["import { Bin } from '@transferwise/icons';\nimport classNames from 'classnames';\nimport { useIntl } from 'react-intl';\n\nimport Body from '../../body';\nimport { Size, Status, Typography, Sentiment } from '../../common';\nimport ProcessIndicator from '../../processIndicator/ProcessIndicator';\nimport StatusIcon from '../../statusIcon/StatusIcon';\nimport { UploadedFile, UploadError } from '../types';\n\nimport MESSAGES from './UploadItem.messages';\nimport { UploadItemBody } from './UploadItemBody';\n\nexport type UploadItemProps = JSX.IntrinsicAttributes & {\n file: UploadedFile;\n /**\n * Is this Item part of a multiple- or single-file UploadInput\n */\n singleFileUpload: boolean;\n canDelete: boolean;\n onDelete: () => void;\n\n /**\n * Callback to be called when the file link is clicked.\n * When provided, you need to manually trigger actions to load/download the file.\n *\n * @param file\n */\n onDownload?: (file: UploadedFile) => void;\n};\n\nexport enum TEST_IDS {\n uploadItem = 'uploadItem',\n mediaBody = 'mediaBody',\n}\n\nconst UploadItem = ({\n file,\n canDelete,\n onDelete,\n onDownload,\n singleFileUpload,\n}: UploadItemProps) => {\n const { formatMessage } = useIntl();\n const { status, filename, error, errors, url } = file;\n\n const isSucceeded = [Status.SUCCEEDED, undefined].includes(status) && !!url;\n\n const getIcon = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return <StatusIcon size={Size.SMALL} sentiment={Sentiment.NEGATIVE} />;\n }\n\n let processIndicator: React.ReactNode;\n\n switch (status) {\n case Status.PROCESSING:\n case Status.PENDING:\n processIndicator = <ProcessIndicator size={Size.EXTRA_SMALL} status={Status.PROCESSING} />;\n break;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n processIndicator = <StatusIcon size={Size.SMALL} sentiment={Sentiment.POSITIVE} />;\n }\n\n return processIndicator;\n };\n\n const getErrorMessage = (error?: UploadError) =>\n typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);\n\n const getMultipleErrors = (errors?: UploadError[]) => {\n if (!errors?.length) {\n return null;\n }\n\n if (errors?.length === 1) {\n return getErrorMessage(errors[0]);\n }\n\n return (\n <ul className=\"np-upload-input-errors m-b-0\">\n {errors.map((error, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <li key={index}>{getErrorMessage(error)}</li>;\n })}\n </ul>\n );\n };\n\n const getDescription = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-negative\">\n {errors?.length ? getMultipleErrors(errors) : getErrorMessage(error)}\n </Body>\n );\n }\n\n switch (status) {\n case Status.PENDING:\n return <Body type={Typography.BODY_DEFAULT_BOLD}>{formatMessage(MESSAGES.uploading)}</Body>;\n case Status.PROCESSING:\n return <Body>{formatMessage(MESSAGES.deleting)}</Body>;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-positive\">\n {formatMessage(MESSAGES.uploaded)}\n </Body>\n );\n }\n };\n\n const getTitle = () => {\n return filename || formatMessage(MESSAGES.uploadedFile);\n };\n\n const onDownloadFile = (event: React.MouseEvent): void => {\n if (onDownload) {\n event.preventDefault();\n onDownload(file);\n }\n };\n\n return (\n <div\n className={classNames('np-upload-item', { 'np-upload-item__link': isSucceeded })}\n data-testid={TEST_IDS.uploadItem}\n >\n <div className=\"np-upload-item__body\">\n <UploadItemBody\n url={isSucceeded ? url : undefined}\n singleFileUpload={singleFileUpload}\n onDownload={onDownloadFile}\n >\n <div className=\"np-upload-button\" aria-live=\"polite\">\n <div className=\"media\">\n <div className=\"np-upload-icon media-left\">{getIcon()}</div>\n <div className=\"media-body text-xs-left\" data-testid={TEST_IDS.mediaBody}>\n <Body className=\"text-word-break d-block text-primary\">{getTitle()}</Body>\n {getDescription()}\n </div>\n </div>\n </div>\n </UploadItemBody>\n {canDelete && (\n <button\n aria-label={formatMessage(MESSAGES.removeFile, { filename })}\n className={classNames('btn', 'np-upload-item__remove-button', 'media-left', {\n 'np-upload-item--single-file': singleFileUpload,\n })}\n type=\"button\"\n onClick={() => onDelete()}\n >\n <Bin size={16} />\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default UploadItem;\n"],"names":["TEST_IDS","UploadItem","file","canDelete","onDelete","onDownload","singleFileUpload","formatMessage","useIntl","status","filename","error","errors","url","isSucceeded","Status","SUCCEEDED","undefined","includes","getIcon","length","FAILED","_jsx","StatusIcon","size","Size","SMALL","sentiment","Sentiment","NEGATIVE","processIndicator","PROCESSING","PENDING","ProcessIndicator","EXTRA_SMALL","DONE","POSITIVE","getErrorMessage","message","MESSAGES","uploadingFailed","getMultipleErrors","className","children","map","index","getDescription","Body","type","Typography","BODY_DEFAULT_BOLD","uploading","deleting","uploaded","getTitle","uploadedFile","onDownloadFile","event","preventDefault","classNames","uploadItem","_jsxs","UploadItemBody","mediaBody","removeFile","onClick","Bin"],"mappings":";;;;;;;;;;;;;;IA+BYA,SAGX;AAHD,CAAA,UAAYA,QAAQ,EAAA;AAClBA,EAAAA,QAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACzB,CAAC,EAHWA,QAAQ,KAARA,QAAQ,GAGnB,EAAA,CAAA,CAAA,CAAA;AAEKC,MAAAA,UAAU,GAAGA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B,QAAAA,OAAO,EAAEA,MAAM7D,QAAQ,EAAG;QAAAuC,QAAA,eAE1BrB,GAAA,CAAC4C,GAAG,EAAA;AAAC1C,UAAAA,IAAI,EAAE,EAAA;SACb,CAAA;AAAA,OAAQ,CACT,CAAA;KACE,CAAA;AACP,GAAK,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"UploadItem.mjs","sources":["../../../src/uploadInput/uploadItem/UploadItem.tsx"],"sourcesContent":["import { Bin } from '@transferwise/icons';\nimport classNames from 'classnames';\nimport { useIntl } from 'react-intl';\n\nimport Body from '../../body';\nimport { Size, Status, Typography, Sentiment } from '../../common';\nimport ProcessIndicator from '../../processIndicator/ProcessIndicator';\nimport StatusIcon from '../../statusIcon/StatusIcon';\nimport { UploadedFile, UploadError } from '../types';\n\nimport MESSAGES from './UploadItem.messages';\nimport { UploadItemLink } from './UploadItemLink';\n\nexport type UploadItemProps = JSX.IntrinsicAttributes & {\n file: UploadedFile;\n /**\n * Is this Item part of a multiple- or single-file UploadInput\n */\n singleFileUpload: boolean;\n canDelete: boolean;\n onDelete: () => void;\n\n /**\n * Callback to be called when the file link is clicked.\n * When provided, you need to manually trigger actions to load/download the file.\n *\n * @param file\n */\n onDownload?: (file: UploadedFile) => void;\n};\n\nexport enum TEST_IDS {\n uploadItem = 'uploadItem',\n mediaBody = 'mediaBody',\n}\n\nconst UploadItem = ({\n file,\n canDelete,\n onDelete,\n onDownload,\n singleFileUpload,\n}: UploadItemProps) => {\n const { formatMessage } = useIntl();\n const { status, filename, error, errors, url } = file;\n\n const isSucceeded = [Status.SUCCEEDED, undefined].includes(status) && !!url;\n\n const getIcon = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return <StatusIcon size={Size.SMALL} sentiment={Sentiment.NEGATIVE} />;\n }\n\n let processIndicator: React.ReactNode;\n\n switch (status) {\n case Status.PROCESSING:\n case Status.PENDING:\n processIndicator = <ProcessIndicator size={Size.EXTRA_SMALL} status={Status.PROCESSING} />;\n break;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n processIndicator = <StatusIcon size={Size.SMALL} sentiment={Sentiment.POSITIVE} />;\n }\n\n return processIndicator;\n };\n\n const getErrorMessage = (error?: UploadError) =>\n typeof error === 'object' ? error.message : error || formatMessage(MESSAGES.uploadingFailed);\n\n const getMultipleErrors = (errors?: UploadError[]) => {\n if (!errors?.length) {\n return null;\n }\n\n if (errors?.length === 1) {\n return getErrorMessage(errors[0]);\n }\n\n return (\n <ul className=\"np-upload-input-errors m-b-0\">\n {errors.map((error, index) => {\n // eslint-disable-next-line react/no-array-index-key\n return <li key={index}>{getErrorMessage(error)}</li>;\n })}\n </ul>\n );\n };\n\n const getDescription = () => {\n if (error || errors?.length || status === Status.FAILED) {\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-negative\">\n {errors?.length ? getMultipleErrors(errors) : getErrorMessage(error)}\n </Body>\n );\n }\n\n switch (status) {\n case Status.PENDING:\n return <Body type={Typography.BODY_DEFAULT_BOLD}>{formatMessage(MESSAGES.uploading)}</Body>;\n case Status.PROCESSING:\n return <Body>{formatMessage(MESSAGES.deleting)}</Body>;\n case Status.SUCCEEDED:\n case Status.DONE:\n default:\n return (\n <Body type={Typography.BODY_DEFAULT_BOLD} className=\"text-positive\">\n {formatMessage(MESSAGES.uploaded)}\n </Body>\n );\n }\n };\n\n const getTitle = () => {\n return filename || formatMessage(MESSAGES.uploadedFile);\n };\n\n const onDownloadFile = (event: React.MouseEvent): void => {\n if (onDownload) {\n event.preventDefault();\n onDownload(file);\n }\n };\n\n return (\n <div\n className={classNames('np-upload-item', { 'np-upload-item--link': isSucceeded })}\n data-testid={TEST_IDS.uploadItem}\n >\n <div className=\"np-upload-item__body\">\n <UploadItemLink\n url={isSucceeded ? url : undefined}\n singleFileUpload={singleFileUpload}\n onDownload={onDownloadFile}\n >\n <div className=\"np-upload-button\" aria-live=\"polite\">\n <div className=\"media\">\n <div className=\"np-upload-icon media-left\">{getIcon()}</div>\n <div className=\"media-body text-xs-left\" data-testid={TEST_IDS.mediaBody}>\n <Body className=\"text-word-break d-block text-primary\">{getTitle()}</Body>\n {getDescription()}\n </div>\n </div>\n </div>\n </UploadItemLink>\n {canDelete && (\n <button\n aria-label={formatMessage(MESSAGES.removeFile, { filename })}\n className={classNames('btn', 'np-upload-item__remove-button', 'media-left', {\n 'np-upload-item--single-file': singleFileUpload,\n })}\n type=\"button\"\n onClick={() => onDelete()}\n >\n <Bin size={16} />\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default UploadItem;\n"],"names":["TEST_IDS","UploadItem","file","canDelete","onDelete","onDownload","singleFileUpload","formatMessage","useIntl","status","filename","error","errors","url","isSucceeded","Status","SUCCEEDED","undefined","includes","getIcon","length","FAILED","_jsx","StatusIcon","size","Size","SMALL","sentiment","Sentiment","NEGATIVE","processIndicator","PROCESSING","PENDING","ProcessIndicator","EXTRA_SMALL","DONE","POSITIVE","getErrorMessage","message","MESSAGES","uploadingFailed","getMultipleErrors","className","children","map","index","getDescription","Body","type","Typography","BODY_DEFAULT_BOLD","uploading","deleting","uploaded","getTitle","uploadedFile","onDownloadFile","event","preventDefault","classNames","uploadItem","_jsxs","UploadItemLink","mediaBody","removeFile","onClick","Bin"],"mappings":";;;;;;;;;;;;;;IA+BYA,SAGX;AAHD,CAAA,UAAYA,QAAQ,EAAA;AAClBA,EAAAA,QAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACzB,CAAC,EAHWA,QAAQ,KAARA,QAAQ,GAGnB,EAAA,CAAA,CAAA,CAAA;AAEKC,MAAAA,UAAU,GAAGA,CAAC;EAClBC,IAAI;EACJC,SAAS;EACTC,QAAQ;EACRC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACA,KAAI;EACpB,MAAM;AAAEC,IAAAA,aAAAA;GAAe,GAAGC,OAAO,EAAE,CAAA;EACnC,MAAM;IAAEC,MAAM;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AC,CAAA;AAEV;;;;"}
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ var classNames = require('classnames');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var classNames__default = /*#__PURE__*/_interopDefault(classNames);
9
+
10
+ const UploadItemLink = ({
11
+ children,
12
+ url,
13
+ onDownload,
14
+ singleFileUpload
15
+ }) => {
16
+ if (!url) {
17
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
18
+ children: children
19
+ });
20
+ }
21
+ return /*#__PURE__*/jsxRuntime.jsx("a", {
22
+ href: url,
23
+ target: "_blank",
24
+ rel: "noopener noreferrer",
25
+ className: classNames__default.default('np-upload-item__link', singleFileUpload ? 'np-upload-item--single-file' : ''),
26
+ onClick: onDownload,
27
+ children: children
28
+ });
29
+ };
30
+
31
+ exports.UploadItemLink = UploadItemLink;
32
+ //# sourceMappingURL=UploadItemLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UploadItemLink.js","sources":["../../../src/uploadInput/uploadItem/UploadItemLink.tsx"],"sourcesContent":["import { PropsWithChildren, MouseEvent } from 'react';\nimport classnames from 'classnames';\n\ntype UploadItemLinkProps = PropsWithChildren<{\n url?: string;\n onDownload?: (event: MouseEvent) => void;\n singleFileUpload: boolean;\n}>;\n\nexport const UploadItemLink = ({\n children,\n url,\n onDownload,\n singleFileUpload,\n}: UploadItemLinkProps) => {\n if (!url) {\n return <div>{children}</div>;\n }\n\n return (\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={classnames(\n 'np-upload-item__link',\n singleFileUpload ? 'np-upload-item--single-file' : '',\n )}\n onClick={onDownload}\n >\n {children}\n </a>\n );\n};\n"],"names":["UploadItemLink","children","url","onDownload","singleFileUpload","_jsx","href","target","rel","className","classnames","onClick"],"mappings":";;;;;;;;;AASO,MAAMA,cAAc,GAAGA,CAAC;EAC7BC,QAAQ;EACRC,GAAG;EACHC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACI,KAAI;EACxB,IAAI,CAACF,GAAG,EAAE;AACR,IAAA,oBAAOG,cAAA,CAAA,KAAA,EAAA;AAAAJ,MAAAA,QAAA,EAAMA,QAAAA;AAAQ,KAAM,CAAC,CAAA;AAC9B,GAAA;AAEA,EAAA,oBACEI,cAAA,CAAA,GAAA,EAAA;AACEC,IAAAA,IAAI,EAAEJ,GAAI;AACVK,IAAAA,MAAM,EAAC,QAAQ;AACfC,IAAAA,GAAG,EAAC,qBAAqB;IACzBC,SAAS,EAAEC,2BAAU,CACnB,sBAAsB,EACtBN,gBAAgB,GAAG,6BAA6B,GAAG,EAAE,CACrD;AACFO,IAAAA,OAAO,EAAER,UAAW;AAAAF,IAAAA,QAAA,EAEnBA,QAAAA;AAAQ,GACR,CAAC,CAAA;AAER;;;;"}
@@ -1,6 +1,7 @@
1
+ import classNames from 'classnames';
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
 
3
- const UploadItemBody = ({
4
+ const UploadItemLink = ({
4
5
  children,
5
6
  url,
6
7
  onDownload,
@@ -15,11 +16,11 @@ const UploadItemBody = ({
15
16
  href: url,
16
17
  target: "_blank",
17
18
  rel: "noopener noreferrer",
18
- className: singleFileUpload ? 'np-upload-item--single-file' : 'np-upload-item--link',
19
+ className: classNames('np-upload-item__link', singleFileUpload ? 'np-upload-item--single-file' : ''),
19
20
  onClick: onDownload,
20
21
  children: children
21
22
  });
22
23
  };
23
24
 
24
- export { UploadItemBody };
25
- //# sourceMappingURL=UploadItemBody.mjs.map
25
+ export { UploadItemLink };
26
+ //# sourceMappingURL=UploadItemLink.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UploadItemLink.mjs","sources":["../../../src/uploadInput/uploadItem/UploadItemLink.tsx"],"sourcesContent":["import { PropsWithChildren, MouseEvent } from 'react';\nimport classnames from 'classnames';\n\ntype UploadItemLinkProps = PropsWithChildren<{\n url?: string;\n onDownload?: (event: MouseEvent) => void;\n singleFileUpload: boolean;\n}>;\n\nexport const UploadItemLink = ({\n children,\n url,\n onDownload,\n singleFileUpload,\n}: UploadItemLinkProps) => {\n if (!url) {\n return <div>{children}</div>;\n }\n\n return (\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={classnames(\n 'np-upload-item__link',\n singleFileUpload ? 'np-upload-item--single-file' : '',\n )}\n onClick={onDownload}\n >\n {children}\n </a>\n );\n};\n"],"names":["UploadItemLink","children","url","onDownload","singleFileUpload","_jsx","href","target","rel","className","classnames","onClick"],"mappings":";;;AASO,MAAMA,cAAc,GAAGA,CAAC;EAC7BC,QAAQ;EACRC,GAAG;EACHC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACI,KAAI;EACxB,IAAI,CAACF,GAAG,EAAE;AACR,IAAA,oBAAOG,GAAA,CAAA,KAAA,EAAA;AAAAJ,MAAAA,QAAA,EAAMA,QAAAA;AAAQ,KAAM,CAAC,CAAA;AAC9B,GAAA;AAEA,EAAA,oBACEI,GAAA,CAAA,GAAA,EAAA;AACEC,IAAAA,IAAI,EAAEJ,GAAI;AACVK,IAAAA,MAAM,EAAC,QAAQ;AACfC,IAAAA,GAAG,EAAC,qBAAqB;IACzBC,SAAS,EAAEC,UAAU,CACnB,sBAAsB,EACtBN,gBAAgB,GAAG,6BAA6B,GAAG,EAAE,CACrD;AACFO,IAAAA,OAAO,EAAER,UAAW;AAAAF,IAAAA,QAAA,EAEnBA,QAAAA;AAAQ,GACR,CAAC,CAAA;AAER;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-43daa3c",
3
+ "version": "0.0.0-experimental-e1c4386",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -93,12 +93,12 @@
93
93
  "rollup-preserve-directives": "^1.1.1",
94
94
  "storybook": "^8.2.1",
95
95
  "@transferwise/less-config": "3.1.0",
96
- "@transferwise/neptune-css": "14.12.0",
96
+ "@transferwise/neptune-css": "0.0.0-experimental-e1c4386",
97
97
  "@wise/components-theming": "1.4.0"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "@transferwise/icons": "^3.7.0",
101
- "@transferwise/neptune-css": "^14.9.6",
101
+ "@transferwise/neptune-css": "0.0.0-experimental-e1c4386",
102
102
  "@wise/art": "^2.7.0",
103
103
  "@wise/components-theming": "^1.0.0",
104
104
  "react": ">=18",
@@ -16,6 +16,7 @@ export type ActionOptionProps = {
16
16
  priority?: PriorityPrimary | PrioritySecondary;
17
17
  showMediaCircle?: boolean;
18
18
  isContainerAligned?: boolean;
19
+ as?: React.ElementType;
19
20
  } & CommonProps;
20
21
 
21
22
  const ActionOption = ({
@@ -31,6 +32,7 @@ const ActionOption = ({
31
32
  showMediaAtAllSizes,
32
33
  showMediaCircle,
33
34
  isContainerAligned,
35
+ as,
34
36
  }: ActionOptionProps) => {
35
37
  const sharedProps = {
36
38
  media,
@@ -42,6 +44,7 @@ const ActionOption = ({
42
44
  showMediaCircle,
43
45
  className: classNames('tw-action-option', className),
44
46
  isContainerAligned,
47
+ as,
45
48
  };
46
49
 
47
50
  const getAriaLabel = (): string | undefined => {
package/src/main.css CHANGED
@@ -5472,6 +5472,11 @@ label.np-upload-button:not(.disabled):active {
5472
5472
  .np-upload-button .media {
5473
5473
  align-items: flex-start;
5474
5474
  }
5475
+ @media (max-width: 320px) {
5476
+ .np-upload-icon {
5477
+ padding-left: 0;
5478
+ }
5479
+ }
5475
5480
  .np-upload-input.form-control {
5476
5481
  height: auto;
5477
5482
  padding: 0;
@@ -5563,9 +5568,9 @@ label.np-upload-button:not(.disabled):active {
5563
5568
  border: 1px solid var(--color-interactive-secondary);
5564
5569
  position: relative;
5565
5570
  }
5566
- .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
5567
- .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before,
5568
- .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
5571
+ .np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
5572
+ .np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before,
5573
+ .np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
5569
5574
  display: block;
5570
5575
  position: absolute;
5571
5576
  height: 1px;
@@ -5577,27 +5582,27 @@ label.np-upload-button:not(.disabled):active {
5577
5582
  width: calc(100% - 2 * 16px);
5578
5583
  width: calc(100% - 2 * var(--size-16));
5579
5584
  }
5580
- .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
5581
- .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before {
5585
+ .np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
5586
+ .np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before {
5582
5587
  top: 0;
5583
5588
  }
5584
- .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
5589
+ .np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
5585
5590
  bottom: -1px;
5586
5591
  }
5587
5592
  .np-upload-item:first-child ~ div {
5588
5593
  border-top: 1px;
5589
5594
  }
5590
- .np-upload-item:not(:first-child) .np-upload-item--link:hover {
5595
+ .np-upload-item:not(:first-child) .np-upload-item__link:hover {
5591
5596
  border-top-color: rgba(0,0,0,0.10196);
5592
5597
  border-top-color: var(--color-border-neutral);
5593
5598
  }
5594
5599
  .np-upload-item:not(:last-child) {
5595
5600
  border-bottom: 0;
5596
5601
  }
5597
- .np-upload-item.np-upload-item__link:hover + .np-upload-item:before,
5598
- .np-upload-item.np-upload-item__link:hover + .np-upload-button-container:before,
5599
- .np-upload-item.np-upload-item__link:hover + .np-upload-item .np-upload-item--link:before,
5600
- .np-upload-item.np-upload-item__link:hover + .np-upload-button-container .np-upload-item--link:before {
5602
+ .np-upload-item.np-upload-item--link:hover + .np-upload-item:before,
5603
+ .np-upload-item.np-upload-item--link:hover + .np-upload-button-container:before,
5604
+ .np-upload-item.np-upload-item--link:hover + .np-upload-item .np-upload-item__link:before,
5605
+ .np-upload-item.np-upload-item--link:hover + .np-upload-button-container .np-upload-item__link:before {
5601
5606
  display: none;
5602
5607
  }
5603
5608
  .np-upload-button-container:hover:before,
@@ -5612,38 +5617,41 @@ label.np-upload-button:not(.disabled):active {
5612
5617
  outline-offset: -3px;
5613
5618
  }
5614
5619
  .np-upload-item--single-file:focus-visible,
5615
- .np-upload-item--link:focus-visible,
5620
+ .np-upload-item__link:focus-visible,
5616
5621
  .np-upload-button-container:has(:focus-visible) {
5617
5622
  outline-width: 3px;
5618
5623
  }
5619
- .np-upload-item__link a {
5624
+ .np-upload-item--link a {
5620
5625
  flex: 1;
5621
5626
  -webkit-text-decoration: none;
5622
5627
  text-decoration: none;
5623
5628
  border-top: 1px solid transparent;
5624
5629
  border-radius: inherit;
5625
5630
  }
5626
- .np-upload-item__link a:focus-visible {
5631
+ .np-upload-item--link a:focus-visible {
5627
5632
  outline-offset: -2px;
5628
5633
  }
5629
- .np-upload-item__link a:hover:before {
5634
+ .np-upload-item--link a:hover:before {
5630
5635
  display: none !important;
5631
5636
  }
5632
- .np-upload-item__link a:hover:after {
5637
+ .np-upload-item--link a:hover:after {
5633
5638
  left: 0 !important;
5634
5639
  width: 100% !important;
5635
5640
  }
5636
- .np-upload-item__link a:hover,
5637
- .np-upload-item__link a:active {
5641
+ .np-upload-item--link a:hover,
5642
+ .np-upload-item--link a:active {
5638
5643
  -webkit-text-decoration: none;
5639
5644
  text-decoration: none;
5640
5645
  }
5641
- .np-upload-item__link a:hover .np-upload-button,
5642
- .np-upload-item__link a:active .np-upload-button {
5646
+ .np-upload-item--link a:hover .np-upload-button,
5647
+ .np-upload-item--link a:active .np-upload-button {
5643
5648
  background-color: rgba(134,167,189,0.10196);
5644
5649
  background-color: var(--color-background-neutral);
5645
5650
  border-radius: inherit;
5646
5651
  }
5652
+ .np-upload-item--link:first-of-type a {
5653
+ border-top: 0;
5654
+ }
5647
5655
  .np-upload-item__body {
5648
5656
  display: flex;
5649
5657
  align-items: center;
@@ -37,3 +37,8 @@ label.np-upload-button:not(.disabled):active {
37
37
  .np-upload-button .media {
38
38
  align-items: flex-start;
39
39
  }
40
+ @media (max-width: 320px) {
41
+ .np-upload-icon {
42
+ padding-left: 0;
43
+ }
44
+ }
@@ -47,3 +47,9 @@
47
47
  align-items: flex-start;
48
48
  }
49
49
  }
50
+
51
+ .np-upload-icon{
52
+ @media (max-width: 320px){
53
+ padding-left: 0;
54
+ }
55
+ }
@@ -3,9 +3,9 @@
3
3
  border: 1px solid var(--color-interactive-secondary);
4
4
  position: relative;
5
5
  }
6
- .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
7
- .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before,
8
- .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
6
+ .np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
7
+ .np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before,
8
+ .np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
9
9
  display: block;
10
10
  position: absolute;
11
11
  height: 1px;
@@ -17,27 +17,27 @@
17
17
  width: calc(100% - 2 * 16px);
18
18
  width: calc(100% - 2 * var(--size-16));
19
19
  }
20
- .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
21
- .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before {
20
+ .np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
21
+ .np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before {
22
22
  top: 0;
23
23
  }
24
- .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
24
+ .np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
25
25
  bottom: -1px;
26
26
  }
27
27
  .np-upload-item:first-child ~ div {
28
28
  border-top: 1px;
29
29
  }
30
- .np-upload-item:not(:first-child) .np-upload-item--link:hover {
30
+ .np-upload-item:not(:first-child) .np-upload-item__link:hover {
31
31
  border-top-color: rgba(0,0,0,0.10196);
32
32
  border-top-color: var(--color-border-neutral);
33
33
  }
34
34
  .np-upload-item:not(:last-child) {
35
35
  border-bottom: 0;
36
36
  }
37
- .np-upload-item.np-upload-item__link:hover + .np-upload-item:before,
38
- .np-upload-item.np-upload-item__link:hover + .np-upload-button-container:before,
39
- .np-upload-item.np-upload-item__link:hover + .np-upload-item .np-upload-item--link:before,
40
- .np-upload-item.np-upload-item__link:hover + .np-upload-button-container .np-upload-item--link:before {
37
+ .np-upload-item.np-upload-item--link:hover + .np-upload-item:before,
38
+ .np-upload-item.np-upload-item--link:hover + .np-upload-button-container:before,
39
+ .np-upload-item.np-upload-item--link:hover + .np-upload-item .np-upload-item__link:before,
40
+ .np-upload-item.np-upload-item--link:hover + .np-upload-button-container .np-upload-item__link:before {
41
41
  display: none;
42
42
  }
43
43
  .np-upload-button-container:hover:before,
@@ -52,38 +52,41 @@
52
52
  outline-offset: -3px;
53
53
  }
54
54
  .np-upload-item--single-file:focus-visible,
55
- .np-upload-item--link:focus-visible,
55
+ .np-upload-item__link:focus-visible,
56
56
  .np-upload-button-container:has(:focus-visible) {
57
57
  outline-width: 3px;
58
58
  }
59
- .np-upload-item__link a {
59
+ .np-upload-item--link a {
60
60
  flex: 1;
61
61
  -webkit-text-decoration: none;
62
62
  text-decoration: none;
63
63
  border-top: 1px solid transparent;
64
64
  border-radius: inherit;
65
65
  }
66
- .np-upload-item__link a:focus-visible {
66
+ .np-upload-item--link a:focus-visible {
67
67
  outline-offset: -2px;
68
68
  }
69
- .np-upload-item__link a:hover:before {
69
+ .np-upload-item--link a:hover:before {
70
70
  display: none !important;
71
71
  }
72
- .np-upload-item__link a:hover:after {
72
+ .np-upload-item--link a:hover:after {
73
73
  left: 0 !important;
74
74
  width: 100% !important;
75
75
  }
76
- .np-upload-item__link a:hover,
77
- .np-upload-item__link a:active {
76
+ .np-upload-item--link a:hover,
77
+ .np-upload-item--link a:active {
78
78
  -webkit-text-decoration: none;
79
79
  text-decoration: none;
80
80
  }
81
- .np-upload-item__link a:hover .np-upload-button,
82
- .np-upload-item__link a:active .np-upload-button {
81
+ .np-upload-item--link a:hover .np-upload-button,
82
+ .np-upload-item--link a:active .np-upload-button {
83
83
  background-color: rgba(134,167,189,0.10196);
84
84
  background-color: var(--color-background-neutral);
85
85
  border-radius: inherit;
86
86
  }
87
+ .np-upload-item--link:first-of-type a {
88
+ border-top: 0;
89
+ }
87
90
  .np-upload-item__body {
88
91
  display: flex;
89
92
  align-items: center;
@@ -5,9 +5,9 @@
5
5
  border: 1px solid var(--color-interactive-secondary);
6
6
  position: relative;
7
7
 
8
- &:first-child ~ div:not(.np-upload-item__link):before,
9
- &:not(:first-child).np-upload-item__link .np-upload-item--link:before,
10
- &.np-upload-item__link:hover .np-upload-item--link:after {
8
+ &:first-child ~ div:not(.np-upload-item--link):before,
9
+ &:not(:first-child).np-upload-item--link .np-upload-item__link:before,
10
+ &.np-upload-item--link:hover .np-upload-item__link:after {
11
11
  display: block;
12
12
  position: absolute;
13
13
  height: 1px;
@@ -17,12 +17,12 @@
17
17
  width: calc(100% - 2 * var(--size-16));
18
18
  }
19
19
 
20
- &:first-child ~ div:not(.np-upload-item__link):before,
21
- &:not(:first-child).np-upload-item__link .np-upload-item--link:before {
20
+ &:first-child ~ div:not(.np-upload-item--link):before,
21
+ &:not(:first-child).np-upload-item--link .np-upload-item__link:before {
22
22
  top: 0;
23
23
  }
24
24
 
25
- &.np-upload-item__link:hover .np-upload-item--link:after {
25
+ &.np-upload-item--link:hover .np-upload-item__link:after {
26
26
  bottom: -1px;
27
27
  }
28
28
 
@@ -33,7 +33,7 @@
33
33
  }
34
34
 
35
35
  &:not(:first-child) {
36
- .np-upload-item--link:hover {
36
+ .np-upload-item__link:hover {
37
37
  border-top-color: var(--color-border-neutral);
38
38
  }
39
39
  }
@@ -43,10 +43,10 @@
43
43
  }
44
44
 
45
45
 
46
- &.np-upload-item__link:hover + .np-upload-item,
47
- &.np-upload-item__link:hover + .np-upload-button-container {
46
+ &.np-upload-item--link:hover + .np-upload-item,
47
+ &.np-upload-item--link:hover + .np-upload-button-container {
48
48
  &:before,
49
- .np-upload-item--link:before {
49
+ .np-upload-item__link:before {
50
50
  display: none;
51
51
  }
52
52
  }
@@ -67,12 +67,12 @@
67
67
  }
68
68
 
69
69
  .np-upload-item--single-file:focus-visible,
70
- .np-upload-item--link:focus-visible,
70
+ .np-upload-item__link:focus-visible,
71
71
  .np-upload-button-container:has(:focus-visible) {
72
72
  outline-width: 3px;
73
73
  }
74
74
 
75
- .np-upload-item__link {
75
+ .np-upload-item--link {
76
76
  a {
77
77
  flex: 1;
78
78
  text-decoration: none;
@@ -103,6 +103,10 @@
103
103
  }
104
104
  }
105
105
  }
106
+
107
+ &:first-of-type a {
108
+ border-top: 0;
109
+ }
106
110
  }
107
111
 
108
112
  .np-upload-item__body {
@@ -9,7 +9,7 @@ import StatusIcon from '../../statusIcon/StatusIcon';
9
9
  import { UploadedFile, UploadError } from '../types';
10
10
 
11
11
  import MESSAGES from './UploadItem.messages';
12
- import { UploadItemBody } from './UploadItemBody';
12
+ import { UploadItemLink } from './UploadItemLink';
13
13
 
14
14
  export type UploadItemProps = JSX.IntrinsicAttributes & {
15
15
  file: UploadedFile;
@@ -127,11 +127,11 @@ const UploadItem = ({
127
127
 
128
128
  return (
129
129
  <div
130
- className={classNames('np-upload-item', { 'np-upload-item__link': isSucceeded })}
130
+ className={classNames('np-upload-item', { 'np-upload-item--link': isSucceeded })}
131
131
  data-testid={TEST_IDS.uploadItem}
132
132
  >
133
133
  <div className="np-upload-item__body">
134
- <UploadItemBody
134
+ <UploadItemLink
135
135
  url={isSucceeded ? url : undefined}
136
136
  singleFileUpload={singleFileUpload}
137
137
  onDownload={onDownloadFile}
@@ -145,7 +145,7 @@ const UploadItem = ({
145
145
  </div>
146
146
  </div>
147
147
  </div>
148
- </UploadItemBody>
148
+ </UploadItemLink>
149
149
  {canDelete && (
150
150
  <button
151
151
  aria-label={formatMessage(MESSAGES.removeFile, { filename })}
@@ -1,4 +1,5 @@
1
1
  import { PropsWithChildren, MouseEvent } from 'react';
2
+ import classnames from 'classnames';
2
3
 
3
4
  type UploadItemLinkProps = PropsWithChildren<{
4
5
  url?: string;
@@ -6,7 +7,7 @@ type UploadItemLinkProps = PropsWithChildren<{
6
7
  singleFileUpload: boolean;
7
8
  }>;
8
9
 
9
- export const UploadItemBody = ({
10
+ export const UploadItemLink = ({
10
11
  children,
11
12
  url,
12
13
  onDownload,
@@ -21,7 +22,10 @@ export const UploadItemBody = ({
21
22
  href={url}
22
23
  target="_blank"
23
24
  rel="noopener noreferrer"
24
- className={singleFileUpload ? 'np-upload-item--single-file' : 'np-upload-item--link'}
25
+ className={classnames(
26
+ 'np-upload-item__link',
27
+ singleFileUpload ? 'np-upload-item--single-file' : '',
28
+ )}
25
29
  onClick={onDownload}
26
30
  >
27
31
  {children}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UploadItemBody.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItemBody.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEtD,KAAK,mBAAmB,GAAG,iBAAiB,CAAC;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC,CAAC;AAEH,eAAO,MAAM,cAAc,qDAKxB,mBAAmB,gCAgBrB,CAAC"}
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
-
5
- const UploadItemBody = ({
6
- children,
7
- url,
8
- onDownload,
9
- singleFileUpload
10
- }) => {
11
- if (!url) {
12
- return /*#__PURE__*/jsxRuntime.jsx("div", {
13
- children: children
14
- });
15
- }
16
- return /*#__PURE__*/jsxRuntime.jsx("a", {
17
- href: url,
18
- target: "_blank",
19
- rel: "noopener noreferrer",
20
- className: singleFileUpload ? 'np-upload-item--single-file' : 'np-upload-item--link',
21
- onClick: onDownload,
22
- children: children
23
- });
24
- };
25
-
26
- exports.UploadItemBody = UploadItemBody;
27
- //# sourceMappingURL=UploadItemBody.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UploadItemBody.js","sources":["../../../src/uploadInput/uploadItem/UploadItemBody.tsx"],"sourcesContent":["import { PropsWithChildren, MouseEvent } from 'react';\n\ntype UploadItemLinkProps = PropsWithChildren<{\n url?: string;\n onDownload?: (event: MouseEvent) => void;\n singleFileUpload: boolean;\n}>;\n\nexport const UploadItemBody = ({\n children,\n url,\n onDownload,\n singleFileUpload,\n}: UploadItemLinkProps) => {\n if (!url) {\n return <div>{children}</div>;\n }\n\n return (\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={singleFileUpload ? 'np-upload-item--single-file' : 'np-upload-item--link'}\n onClick={onDownload}\n >\n {children}\n </a>\n );\n};\n"],"names":["UploadItemBody","children","url","onDownload","singleFileUpload","_jsx","href","target","rel","className","onClick"],"mappings":";;;;AAQO,MAAMA,cAAc,GAAGA,CAAC;EAC7BC,QAAQ;EACRC,GAAG;EACHC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACI,KAAI;EACxB,IAAI,CAACF,GAAG,EAAE;AACR,IAAA,oBAAOG,cAAA,CAAA,KAAA,EAAA;AAAAJ,MAAAA,QAAA,EAAMA,QAAAA;AAAQ,KAAM,CAAC,CAAA;AAC9B,GAAA;AAEA,EAAA,oBACEI,cAAA,CAAA,GAAA,EAAA;AACEC,IAAAA,IAAI,EAAEJ,GAAI;AACVK,IAAAA,MAAM,EAAC,QAAQ;AACfC,IAAAA,GAAG,EAAC,qBAAqB;AACzBC,IAAAA,SAAS,EAAEL,gBAAgB,GAAG,6BAA6B,GAAG,sBAAuB;AACrFM,IAAAA,OAAO,EAAEP,UAAW;AAAAF,IAAAA,QAAA,EAEnBA,QAAAA;AAAQ,GACR,CAAC,CAAA;AAER;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UploadItemBody.mjs","sources":["../../../src/uploadInput/uploadItem/UploadItemBody.tsx"],"sourcesContent":["import { PropsWithChildren, MouseEvent } from 'react';\n\ntype UploadItemLinkProps = PropsWithChildren<{\n url?: string;\n onDownload?: (event: MouseEvent) => void;\n singleFileUpload: boolean;\n}>;\n\nexport const UploadItemBody = ({\n children,\n url,\n onDownload,\n singleFileUpload,\n}: UploadItemLinkProps) => {\n if (!url) {\n return <div>{children}</div>;\n }\n\n return (\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={singleFileUpload ? 'np-upload-item--single-file' : 'np-upload-item--link'}\n onClick={onDownload}\n >\n {children}\n </a>\n );\n};\n"],"names":["UploadItemBody","children","url","onDownload","singleFileUpload","_jsx","href","target","rel","className","onClick"],"mappings":";;AAQO,MAAMA,cAAc,GAAGA,CAAC;EAC7BC,QAAQ;EACRC,GAAG;EACHC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACI,KAAI;EACxB,IAAI,CAACF,GAAG,EAAE;AACR,IAAA,oBAAOG,GAAA,CAAA,KAAA,EAAA;AAAAJ,MAAAA,QAAA,EAAMA,QAAAA;AAAQ,KAAM,CAAC,CAAA;AAC9B,GAAA;AAEA,EAAA,oBACEI,GAAA,CAAA,GAAA,EAAA;AACEC,IAAAA,IAAI,EAAEJ,GAAI;AACVK,IAAAA,MAAM,EAAC,QAAQ;AACfC,IAAAA,GAAG,EAAC,qBAAqB;AACzBC,IAAAA,SAAS,EAAEL,gBAAgB,GAAG,6BAA6B,GAAG,sBAAuB;AACrFM,IAAAA,OAAO,EAAEP,UAAW;AAAAF,IAAAA,QAAA,EAEnBA,QAAAA;AAAQ,GACR,CAAC,CAAA;AAER;;;;"}