@transferwise/components 0.0.0-experimental-5ac3a46 → 0.0.0-experimental-215a547

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/build/index.js +56 -39
  2. package/build/index.js.map +1 -1
  3. package/build/index.mjs +57 -40
  4. package/build/index.mjs.map +1 -1
  5. package/build/main.css +108 -121
  6. package/build/styles/main.css +108 -121
  7. package/build/styles/uploadInput/UploadInput.css +27 -19
  8. package/build/styles/uploadInput/uploadButton/UploadButton.css +38 -24
  9. package/build/styles/uploadInput/uploadItem/UploadItem.css +46 -81
  10. package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
  11. package/build/types/uploadInput/types.d.ts +1 -9
  12. package/build/types/uploadInput/types.d.ts.map +1 -1
  13. package/build/types/uploadInput/uploadButton/UploadButton.d.ts +5 -1
  14. package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
  15. package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
  16. package/package.json +18 -19
  17. package/src/chips/Chips.story.tsx +5 -3
  18. package/src/dateLookup/DateLookup.tests.story.tsx +4 -2
  19. package/src/main.css +108 -121
  20. package/src/moneyInput/MoneyInput.story.tsx +1 -3
  21. package/src/phoneNumberInput/PhoneNumberInput.story.tsx +1 -0
  22. package/src/uploadInput/UploadInput.css +27 -19
  23. package/src/uploadInput/UploadInput.less +23 -20
  24. package/src/uploadInput/UploadInput.story.tsx +27 -75
  25. package/src/uploadInput/UploadInput.tsx +4 -1
  26. package/src/uploadInput/types.ts +1 -11
  27. package/src/uploadInput/uploadButton/UploadButton.css +38 -24
  28. package/src/uploadInput/uploadButton/UploadButton.less +40 -27
  29. package/src/uploadInput/uploadButton/UploadButton.spec.tsx +1 -0
  30. package/src/uploadInput/uploadButton/UploadButton.tsx +37 -12
  31. package/src/uploadInput/uploadItem/UploadItem.css +46 -81
  32. package/src/uploadInput/uploadItem/UploadItem.less +40 -75
  33. package/src/uploadInput/uploadItem/UploadItem.tsx +25 -30
  34. package/src/uploadInput/uploadItem/UploadItemBody.tsx +1 -1
package/src/main.css CHANGED
@@ -5390,69 +5390,95 @@ html:not([dir="rtl"]) .np-navigation-option {
5390
5390
  .tw-droppable-sm {
5391
5391
  min-height: 245px;
5392
5392
  }
5393
- .np-upload-button-container {
5394
- border-style: solid;
5393
+ .np-upload-button {
5394
+ width: 100%;
5395
+ border: 0 !important;
5396
+ padding: 12px 16px;
5397
+ padding: var(--size-12) var(--size-16);
5398
+ }
5399
+ .np-upload-button.np-upload-accent {
5400
+ color: #00a2dd;
5401
+ color: var(--color-interactive-accent);
5402
+ }
5403
+ label.np-upload-button:not(.disabled):hover,
5404
+ label.np-upload-button:not(.disabled):focus-visible,
5405
+ label.np-upload-button:not(.disabled):active {
5406
+ background-color: rgba(134,167,189,0.10196);
5407
+ background-color: var(--color-background-neutral);
5408
+ }
5409
+ .np-theme-personal label.np-upload-button:not(.disabled):hover,
5410
+ .np-theme-personal label.np-upload-button:not(.disabled):focus-visible,
5411
+ .np-theme-personal label.np-upload-button:not(.disabled):active {
5412
+ background-color: var(--color-background-screen-hover);
5413
+ }
5414
+ .np-theme-personal .disabled label.np-upload-button:not(.disabled):hover,
5415
+ .np-theme-personal .disabled label.np-upload-button:not(.disabled):focus-visible,
5416
+ .np-theme-personal .disabled label.np-upload-button:not(.disabled):active {
5417
+ background-color: transparent;
5418
+ }
5419
+ .np-upload-button .np-upload-icon {
5420
+ display: flex;
5421
+ align-items: center;
5422
+ }
5423
+ .np-upload-button-container.droppable {
5424
+ border: 0;
5395
5425
  }
5396
5426
  .np-upload-button-container .droppable-card-content {
5397
5427
  display: flex;
5398
5428
  }
5399
- .np-upload-button-container.droppable-dropping {
5400
- border-color: #c9cbce !important;
5401
- border-color: var(--color-interactive-secondary) !important;
5429
+ .np-theme-personal .np-upload-button-container .droppable-card-content {
5430
+ border-radius: calc(10px - 1px);
5431
+ border-radius: calc(var(--radius-small) - 1px);
5402
5432
  }
5403
5433
  .np-upload-button-container input[type="file"] {
5404
5434
  opacity: 0;
5405
5435
  z-index: -1;
5406
5436
  position: absolute;
5407
5437
  }
5408
- .np-upload-button-container .np-upload-button {
5409
- border: none;
5410
- }
5411
- .np-upload-button {
5412
- width: 100%;
5413
- padding: 16px;
5414
- padding: var(--padding-small);
5415
- border-radius: 0;
5416
- }
5417
- label.np-upload-button:not(.disabled):hover,
5418
- label.np-upload-button:not(.disabled):active {
5419
- background-color: var(--color-background-screen-hover);
5438
+ .np-upload-button-container input[type="file"]:focus-visible + label {
5439
+ background-color: rgba(134,167,189,0.10196);
5440
+ background-color: var(--color-background-neutral);
5420
5441
  }
5421
- .disabled label.np-upload-button:not(.disabled):hover,
5422
- .disabled label.np-upload-button:not(.disabled):active {
5423
- background-color: transparent;
5442
+ .np-upload-input {
5443
+ border: 1px solid #c9cbce;
5444
+ border: 1px solid var(--color-interactive-secondary);
5445
+ border-radius: 10px;
5446
+ border-radius: var(--radius-small);
5424
5447
  }
5425
- .np-upload-button .media {
5426
- align-items: flex-start;
5448
+ .np-upload-input:has(:focus-visible) {
5449
+ outline: var(--ring-outline-color) solid var(--ring-outline-width);
5450
+ outline-offset: var(--ring-outline-offset);
5427
5451
  }
5428
5452
  .np-upload-input.form-control {
5429
5453
  height: auto;
5430
5454
  padding: 0;
5431
5455
  padding: initial;
5432
5456
  }
5433
- .np-upload-input > div:first-child,
5434
- .np-upload-input > div:first-child .np-upload-item--single-file,
5435
- .np-upload-input > div:first-child .np-upload-item--link {
5436
- border-top-left-radius: 10px;
5437
- border-top-left-radius: var(--radius-small);
5438
- border-top-right-radius: 10px;
5439
- border-top-right-radius: var(--radius-small);
5440
- }
5441
- .np-upload-input > div:last-child {
5442
- border-bottom-left-radius: 10px;
5443
- border-bottom-left-radius: var(--radius-small);
5444
- border-bottom-right-radius: 10px;
5445
- border-bottom-right-radius: var(--radius-small);
5457
+ .np-theme-personal .np-upload-input {
5458
+ border-radius: 10px;
5459
+ border-radius: var(--radius-small);
5446
5460
  }
5447
5461
  .np-theme-personal .np-upload-input.disabled .btn {
5448
5462
  cursor: inherit;
5449
5463
  }
5464
+ .np-theme-personal .np-upload-input .np-upload-button {
5465
+ border-radius: calc(10px - 1px);
5466
+ border-radius: calc(var(--radius-small) - 1px);
5467
+ padding: 16px;
5468
+ padding: var(--padding-small);
5469
+ }
5470
+ .np-theme-personal .np-upload-input .np-upload-input--square-top {
5471
+ border-top-right-radius: 0px;
5472
+ border-top-left-radius: 0px;
5473
+ }
5474
+ .np-theme-personal .np-upload-input .np-upload-item__remove-button {
5475
+ border-radius: 0;
5476
+ border-radius: initial;
5477
+ }
5450
5478
  .np-theme-personal .np-upload-input .np-upload-icon {
5451
5479
  color: var(--color-interactive-primary);
5452
5480
  }
5453
5481
  .np-theme-personal .np-upload-input .media-body {
5454
- padding-right: 32px;
5455
- padding-right: var(--size-32);
5456
5482
  color: var(--color-content-link);
5457
5483
  white-space: break-spaces;
5458
5484
  }
@@ -5470,10 +5496,6 @@ label.np-upload-button:not(.disabled):active {
5470
5496
  .np-theme-personal .np-upload-input .media-body .text-negative {
5471
5497
  color: var(--color-sentiment-negative) !important;
5472
5498
  }
5473
- .np-theme-personal .np-upload-input-errors {
5474
- padding-left: 0;
5475
- list-style-position: inside;
5476
- }
5477
5499
  .np-theme-personal .np-upload-input .status-circle {
5478
5500
  width: 24px;
5479
5501
  width: var(--size-x-small);
@@ -5488,114 +5510,79 @@ label.np-upload-button:not(.disabled):active {
5488
5510
  height: var(--size-large);
5489
5511
  }
5490
5512
  }
5491
- .np-upload-item {
5492
- border: 1px solid #c9cbce;
5493
- border: 1px solid var(--color-interactive-secondary);
5494
- }
5495
- .np-upload-item:first-child ~ div:before {
5513
+ .np-upload-item:not(:last-child)::after {
5496
5514
  display: block;
5497
5515
  position: relative;
5498
- height: 1px;
5499
- background-color: rgba(0,0,0,0.10196);
5500
- background-color: var(--color-border-neutral);
5516
+ border-bottom: 1px solid rgba(0,0,0,0.10196);
5517
+ border-bottom: 1px solid var(--color-border-neutral);
5501
5518
  content: " ";
5502
5519
  margin: 0 16px;
5503
5520
  margin: 0 var(--size-16);
5504
5521
  }
5505
- .np-upload-item:first-child ~ div {
5506
- border-top: 0;
5507
- }
5508
- .np-upload-item:not(:last-child) {
5509
- border-bottom: 0;
5510
- }
5511
- .np-upload-item.np-upload-item__link:hover:before,
5512
- .np-upload-button-container:hover:before {
5513
- margin: 0 !important;
5514
- }
5515
- .np-upload-item.np-upload-item__link:hover + div:before,
5516
- .np-upload-button-container:hover + div:before {
5517
- margin: 0 !important;
5518
- }
5519
- .np-upload-button-container:has(:focus-visible) {
5520
- outline: var(--ring-outline-color) solid var(--ring-outline-width);
5521
- outline-offset: var(--ring-outline-offset);
5522
- border-color: transparent;
5523
- outline-offset: -3px;
5522
+ .np-theme-personal .np-upload-item:first-child a:hover,
5523
+ .np-theme-personal .np-upload-item:first-child a:focus-visible,
5524
+ .np-theme-personal .np-upload-item:first-child a:active {
5525
+ border-top-left-radius: calc(10px - 1px);
5526
+ border-top-left-radius: calc(var(--radius-small) - 1px);
5524
5527
  }
5525
- .np-upload-item--single-file:focus-visible,
5526
- .np-upload-item--link:focus-visible,
5527
- .np-upload-button-container:has(:focus-visible) {
5528
- outline-width: 3px;
5528
+ .np-theme-personal .np-upload-item:first-child a:hover ~ .np-upload-item__remove-button,
5529
+ .np-theme-personal .np-upload-item:first-child a:focus-visible ~ .np-upload-item__remove-button,
5530
+ .np-theme-personal .np-upload-item:first-child a:active ~ .np-upload-item__remove-button {
5531
+ border-top-right-radius: calc(10px - 1px);
5532
+ border-top-right-radius: calc(var(--radius-small) - 1px);
5529
5533
  }
5530
5534
  .np-upload-item__link a {
5531
5535
  flex: 1;
5532
5536
  -webkit-text-decoration: none;
5533
5537
  text-decoration: none;
5534
- border-radius: inherit;
5538
+ outline: none;
5539
+ border-top-right-radius: 0;
5540
+ border-bottom-right-radius: 0;
5541
+ }
5542
+ .np-theme-personal .np-upload-item__link a {
5543
+ border-radius: 0;
5544
+ border-radius: initial;
5535
5545
  }
5536
- .np-upload-item__link a:focus-visible {
5537
- outline-offset: -2px;
5546
+ .np-upload-item__link a.np-upload-item--single-file {
5547
+ border-bottom-left-radius: calc(10px - 1px);
5548
+ border-bottom-left-radius: calc(var(--radius-small) - 1px);
5538
5549
  }
5539
5550
  .np-upload-item__link a:hover,
5551
+ .np-upload-item__link a:focus-visible,
5540
5552
  .np-upload-item__link a:active {
5541
5553
  -webkit-text-decoration: none;
5542
5554
  text-decoration: none;
5543
5555
  background-color: rgba(134,167,189,0.10196);
5544
5556
  background-color: var(--color-background-neutral);
5545
5557
  }
5558
+ .np-upload-item__link a:hover ~ .np-upload-item__remove-button,
5559
+ .np-upload-item__link a:focus-visible ~ .np-upload-item__remove-button,
5560
+ .np-upload-item__link a:active ~ .np-upload-item__remove-button {
5561
+ background-color: rgba(134,167,189,0.10196);
5562
+ background-color: var(--color-background-neutral);
5563
+ }
5564
+ .np-upload-item__link .np-upload-item__remove-button.np-upload-item--single-file {
5565
+ border-bottom-right-radius: calc(10px - 1px);
5566
+ border-bottom-right-radius: calc(var(--radius-small) - 1px);
5567
+ }
5546
5568
  .np-upload-item__body {
5547
5569
  display: flex;
5548
5570
  align-items: center;
5549
5571
  justify-content: space-between;
5550
- position: relative;
5551
- border-radius: inherit;
5552
5572
  }
5553
5573
  .np-upload-item__remove-button {
5554
- display: flex;
5555
- align-items: center;
5556
- justify-content: center;
5557
- align-self: flex-start;
5558
- position: absolute;
5559
- height: 24px;
5560
- height: var(--size-24);
5561
- min-height: 0;
5562
- width: 24px;
5563
- width: var(--size-24);
5564
- padding: 0;
5565
- border-radius: 50% !important;
5566
- outline-offset: 0 !important;
5567
- background-color: rgba(134,167,189,0.10196);
5568
- background-color: var(--color-background-neutral);
5569
- color: var(--color-interactive-primary);
5570
- right: 16px;
5571
- right: var(--size-16);
5572
- top: 16px;
5573
- top: var(--size-16);
5574
- transition: color, background-color 0.15s ease-in-out;
5575
- }
5576
- @media (max-width: 320px) {
5577
- .np-upload-item__remove-button {
5578
- top: 16px;
5579
- top: var(--size-16);
5580
- right: 16px;
5581
- right: var(--size-16);
5582
- height: 48px;
5583
- height: var(--size-48);
5584
- width: 48px;
5585
- width: var(--size-48);
5586
- }
5587
- }
5588
- .np-upload-item__remove-button:hover {
5589
- background-color: var(--color-sentiment-negative);
5590
- color: var(--color-contrast-overlay) !important;
5574
+ flex-shrink: 0;
5575
+ align-self: stretch;
5576
+ padding: 12px 16px;
5577
+ padding: var(--size-12) var(--size-16);
5578
+ color: #c9cbce;
5579
+ color: var(--color-interactive-secondary);
5580
+ background: transparent;
5591
5581
  }
5592
- .np-upload-item__remove-button:before {
5593
- display: block;
5594
- width: 44px;
5595
- height: 44px;
5596
- content: '';
5597
- border-radius: 50%;
5598
- position: absolute;
5582
+ .np-upload-item__remove-button:hover,
5583
+ .np-upload-item__remove-button:focus {
5584
+ color: #d03238 !important;
5585
+ color: var(--color-interactive-negative-hover) !important;
5599
5586
  }
5600
5587
  .np-progress {
5601
5588
  border-radius: 10px;
@@ -1,9 +1,7 @@
1
- import { FORCE_RE_RENDER } from '@storybook/core-events';
2
- import { addons, useGlobals } from '@storybook/manager-api';
3
1
  import { Meta, StoryObj } from '@storybook/react';
4
2
  import { expect, within, userEvent } from '@storybook/test';
5
3
  import { Lock } from '@transferwise/icons';
6
- import React, { useEffect, useState } from 'react';
4
+ import { useState } from 'react';
7
5
 
8
6
  import MoneyInput, { CurrencyOptionItem } from '.';
9
7
  import Provider from '../provider/Provider';
@@ -19,5 +19,6 @@ export const Basic = {
19
19
  selectProps: {
20
20
  className: 'custom-class',
21
21
  },
22
+ onChange: () => {},
22
23
  },
23
24
  } satisfies Story;
@@ -1,31 +1,43 @@
1
+ .np-upload-input {
2
+ border: 1px solid #c9cbce;
3
+ border: 1px solid var(--color-interactive-secondary);
4
+ border-radius: 10px;
5
+ border-radius: var(--radius-small);
6
+ }
7
+ .np-upload-input:has(:focus-visible) {
8
+ outline: var(--ring-outline-color) solid var(--ring-outline-width);
9
+ outline-offset: var(--ring-outline-offset);
10
+ }
1
11
  .np-upload-input.form-control {
2
12
  height: auto;
3
13
  padding: 0;
4
14
  padding: initial;
5
15
  }
6
- .np-upload-input > div:first-child,
7
- .np-upload-input > div:first-child .np-upload-item--single-file,
8
- .np-upload-input > div:first-child .np-upload-item--link {
9
- border-top-left-radius: 10px;
10
- border-top-left-radius: var(--radius-small);
11
- border-top-right-radius: 10px;
12
- border-top-right-radius: var(--radius-small);
13
- }
14
- .np-upload-input > div:last-child {
15
- border-bottom-left-radius: 10px;
16
- border-bottom-left-radius: var(--radius-small);
17
- border-bottom-right-radius: 10px;
18
- border-bottom-right-radius: var(--radius-small);
16
+ .np-theme-personal .np-upload-input {
17
+ border-radius: 10px;
18
+ border-radius: var(--radius-small);
19
19
  }
20
20
  .np-theme-personal .np-upload-input.disabled .btn {
21
21
  cursor: inherit;
22
22
  }
23
+ .np-theme-personal .np-upload-input .np-upload-button {
24
+ border-radius: calc(10px - 1px);
25
+ border-radius: calc(var(--radius-small) - 1px);
26
+ padding: 16px;
27
+ padding: var(--padding-small);
28
+ }
29
+ .np-theme-personal .np-upload-input .np-upload-input--square-top {
30
+ border-top-right-radius: 0px;
31
+ border-top-left-radius: 0px;
32
+ }
33
+ .np-theme-personal .np-upload-input .np-upload-item__remove-button {
34
+ border-radius: 0;
35
+ border-radius: initial;
36
+ }
23
37
  .np-theme-personal .np-upload-input .np-upload-icon {
24
38
  color: var(--color-interactive-primary);
25
39
  }
26
40
  .np-theme-personal .np-upload-input .media-body {
27
- padding-right: 32px;
28
- padding-right: var(--size-32);
29
41
  color: var(--color-content-link);
30
42
  white-space: break-spaces;
31
43
  }
@@ -43,10 +55,6 @@
43
55
  .np-theme-personal .np-upload-input .media-body .text-negative {
44
56
  color: var(--color-sentiment-negative) !important;
45
57
  }
46
- .np-theme-personal .np-upload-input-errors {
47
- padding-left: 0;
48
- list-style-position: inside;
49
- }
50
58
  .np-theme-personal .np-upload-input .status-circle {
51
59
  width: 24px;
52
60
  width: var(--size-x-small);
@@ -3,38 +3,46 @@
3
3
  @import (reference) './uploadItem/UploadItem.less';
4
4
 
5
5
  .np-upload-input {
6
+ border: 1px solid var(--color-interactive-secondary);
7
+ border-radius: var(--radius-small);
8
+
9
+ &:has(:focus-visible) {
10
+ .ring();
11
+ }
12
+
6
13
  &.form-control {
7
14
  height: auto;
8
15
  padding: initial;
9
16
  }
10
-
11
- & > div {
12
- &:first-child,
13
- &:first-child .np-upload-item--single-file,
14
- &:first-child .np-upload-item--link {
15
- border-top-left-radius: var(--radius-small);
16
- border-top-right-radius: var(--radius-small);
17
- }
18
-
19
- &:last-child {
20
- border-bottom-left-radius: var(--radius-small);
21
- border-bottom-right-radius: var(--radius-small);
22
- }
23
- }
24
17
  }
25
18
 
26
19
  .np-theme-personal {
27
20
  .np-upload-input {
21
+ border-radius: var(--radius-small);
22
+
28
23
  &.disabled .btn {
29
24
  cursor: inherit;
30
25
  }
31
26
 
27
+ .np-upload-button {
28
+ border-radius: @small-border-minus-one;
29
+ padding: var(--padding-small);
30
+ }
31
+
32
+ .np-upload-input--square-top {
33
+ border-top-right-radius: 0px;
34
+ border-top-left-radius: 0px;
35
+ }
36
+
37
+ .np-upload-item__remove-button {
38
+ border-radius: unset;
39
+ }
40
+
32
41
  .np-upload-icon {
33
42
  color: var(--color-interactive-primary);
34
43
  }
35
44
 
36
45
  .media-body {
37
- padding-right: var(--size-32);
38
46
  color: var(--color-content-link);
39
47
  white-space: break-spaces;
40
48
 
@@ -54,11 +62,6 @@
54
62
  }
55
63
  }
56
64
 
57
- &-errors {
58
- padding-left: 0;
59
- list-style-position: inside;
60
- }
61
-
62
65
  .status-circle {
63
66
  width: var(--size-x-small);
64
67
  height: var(--size-x-small);
@@ -1,10 +1,10 @@
1
1
  import { action } from '@storybook/addon-actions';
2
- import { Story, Meta } from '@storybook/react';
2
+ import { StoryFn, Meta } from '@storybook/react';
3
3
 
4
4
  import { Status } from '../common';
5
5
 
6
6
  import UploadInput, { UploadInputProps } from './UploadInput';
7
- import { UploadedFile, UploadResponse } from './types';
7
+ import { UploadResponse } from './types';
8
8
 
9
9
  const meta: Meta<typeof UploadInput> = {
10
10
  title: 'Forms/UploadInput',
@@ -14,15 +14,12 @@ const meta: Meta<typeof UploadInput> = {
14
14
 
15
15
  export default meta;
16
16
 
17
+ type Story = StoryFn<UploadInputProps>;
18
+
17
19
  const files = [
18
20
  {
19
21
  id: 1,
20
- filename: 'purchase-receipt-0.pdf',
21
- url: 'https://wise.com/public-resources/assets/logos/wise/brand_logo_inverse.svg',
22
- },
23
- {
24
- id: 2,
25
- filename: 'purchase-receipt-1.pdf',
22
+ filename: 'purchase-receipt.pdf',
26
23
  url: 'https://wise.com/public-resources/assets/logos/wise/brand_logo_inverse.svg',
27
24
  },
28
25
  {
@@ -33,16 +30,14 @@ const files = [
33
30
  {
34
31
  id: 3,
35
32
  filename: 'receipt failed with error string.png',
36
- status: Status.FAILED,
37
- error: 'Something went wrong',
33
+ status: Status.SUCCEEDED,
38
34
  },
39
35
  {
40
36
  id: 4,
41
37
  filename: 'receipt failed with error object.png',
42
- status: Status.FAILED,
43
- error: { message: 'Something went wrong' },
38
+ status: Status.SUCCEEDED,
44
39
  },
45
- ] satisfies UploadedFile[];
40
+ ];
46
41
 
47
42
  const createDelayedPromise = async ({
48
43
  successful = true,
@@ -61,89 +56,46 @@ const createDelayedPromise = async ({
61
56
  });
62
57
 
63
58
  const props = {
64
- onUploadFile: async (formData: FormData) => {
59
+ onUploadFile: async () => {
65
60
  return createDelayedPromise();
66
61
  },
67
- onDeleteFile: async (id: string | number) => {
62
+ onDeleteFile: async () => {
68
63
  return createDelayedPromise();
69
64
  },
70
65
  };
71
66
 
72
- const Template: Story<UploadInputProps> = (args: UploadInputProps) => <UploadInput {...args} />;
67
+ const Template: Story = (args: UploadInputProps) => <UploadInput {...args} />;
73
68
 
74
- export const SingleFile: Story<UploadInputProps> = Template.bind({});
69
+ export const SingleFile: Story = Template.bind({});
75
70
  SingleFile.args = { ...props };
76
71
 
77
- export const MultipleFiles: Story<UploadInputProps> = Template.bind({});
72
+ export const MultipleFiles: Story = Template.bind({});
78
73
  MultipleFiles.args = { ...props, multiple: true };
79
74
 
80
- export const UploadInputWithDescriptionFromProps: Story<UploadInputProps> = Template.bind({});
75
+ export const UploadInputWithDescriptionFromProps: Story = Template.bind({});
81
76
  UploadInputWithDescriptionFromProps.args = {
82
77
  ...props,
83
78
  multiple: true,
84
79
  description: 'Custom file description from prop',
85
80
  };
86
81
 
87
- export const Disabled: Story<UploadInputProps> = Template.bind({});
82
+ export const Disabled: Story = Template.bind({});
88
83
  Disabled.args = { ...props, disabled: true };
89
84
 
90
- export const WithAnyFileType: Story<UploadInputProps> = Template.bind({});
85
+ export const WithAnyFileType: Story = Template.bind({});
91
86
  WithAnyFileType.args = { ...props, fileTypes: '*' };
92
87
 
93
- export const WithSingleFileType: Story<UploadInputProps> = Template.bind({});
88
+ export const WithSingleFileType: Story = Template.bind({});
94
89
  WithSingleFileType.args = { ...props, fileTypes: '.zip,application/zip' };
95
90
 
96
- export const WithMultipleExistingFiles: Story<UploadInputProps> = Template.bind({});
91
+ export const WithMultipleExistingFiles: Story = Template.bind({});
97
92
  WithMultipleExistingFiles.args = {
98
93
  ...props,
99
94
  files,
100
95
  multiple: true,
101
96
  };
102
97
 
103
- export const WithFileErrors: Story<UploadInputProps> = Template.bind({});
104
- WithFileErrors.args = {
105
- ...props,
106
- files: [
107
- {
108
- id: 1,
109
- filename: 'Error with default message.png',
110
- status: Status.FAILED,
111
- },
112
- {
113
- id: 2,
114
- filename: 'Error with `string` error.png',
115
- status: Status.FAILED,
116
- error: 'Single string error',
117
- },
118
- {
119
- id: 3,
120
- filename: 'Error with `obj` error ({ message : `string` }).png',
121
- status: Status.FAILED,
122
- error: { message: 'Single obj error' },
123
- },
124
- {
125
- id: 4,
126
- filename: 'Error with single error passed in `array`.png',
127
- status: Status.FAILED,
128
- errors: ['Single error in array'],
129
- },
130
- {
131
- id: 5,
132
- filename: 'Error with multiple `string` errors passed in `array`.png',
133
- status: Status.FAILED,
134
- errors: ['Error 1', 'Error 2', 'Error 3'],
135
- },
136
- {
137
- id: 6,
138
- filename: 'Error with multiple `obj` errors passed in `array`.png',
139
- status: Status.FAILED,
140
- errors: [{ message: 'Error 1' }, { message: 'Error 2' }, { message: 'Error 3' }],
141
- },
142
- ],
143
- multiple: true,
144
- };
145
-
146
- export const WithoutDelete: Story<UploadInputProps> = Template.bind({});
98
+ export const WithoutDelete: Story = Template.bind({});
147
99
  WithoutDelete.args = {
148
100
  ...props,
149
101
  files,
@@ -151,7 +103,7 @@ WithoutDelete.args = {
151
103
  multiple: true,
152
104
  };
153
105
 
154
- export const WithUploadFailed: Story<UploadInputProps> = Template.bind({});
106
+ export const WithUploadFailed: Story = Template.bind({});
155
107
  WithUploadFailed.args = {
156
108
  ...props,
157
109
  files: files.slice(0),
@@ -159,7 +111,7 @@ WithUploadFailed.args = {
159
111
  multiple: true,
160
112
  };
161
113
 
162
- export const WithDeleteFailed: Story<UploadInputProps> = Template.bind({});
114
+ export const WithDeleteFailed: Story = Template.bind({});
163
115
  WithDeleteFailed.args = {
164
116
  ...props,
165
117
  files: files.slice(0),
@@ -167,7 +119,7 @@ WithDeleteFailed.args = {
167
119
  multiple: true,
168
120
  };
169
121
 
170
- export const CustomConfirmMessage: Story<UploadInputProps> = Template.bind({});
122
+ export const CustomConfirmMessage: Story = Template.bind({});
171
123
  CustomConfirmMessage.args = {
172
124
  ...props,
173
125
  files: files.slice(0),
@@ -182,21 +134,21 @@ CustomConfirmMessage.args = {
182
134
  },
183
135
  };
184
136
 
185
- export const withManualDownloadHandler: Story<UploadInputProps> = Template.bind({});
137
+ export const withManualDownloadHandler: Story = Template.bind({});
186
138
  withManualDownloadHandler.args = {
187
139
  ...props,
188
140
  files,
189
141
  onDownload: action('Manual download handler'),
190
142
  };
191
143
 
192
- export const withFilesChangeHandler: Story<UploadInputProps> = Template.bind({});
144
+ export const withFilesChangeHandler: Story = Template.bind({});
193
145
  withFilesChangeHandler.args = {
194
146
  ...props,
195
147
  files,
196
148
  onFilesChange: action('Files change handler'),
197
149
  };
198
150
 
199
- export const withMaxFilesToUploadLimit: Story<UploadInputProps> = Template.bind({});
151
+ export const withMaxFilesToUploadLimit: Story = Template.bind({});
200
152
  withMaxFilesToUploadLimit.args = {
201
153
  ...props,
202
154
  multiple: true,
@@ -204,14 +156,14 @@ withMaxFilesToUploadLimit.args = {
204
156
  maxFilesErrorMessage: "Can't upload as maximum number of files allowed are already uploaded",
205
157
  };
206
158
 
207
- export const withFileSizeErrorMessage: Story<UploadInputProps> = Template.bind({});
159
+ export const withFileSizeErrorMessage: Story = Template.bind({});
208
160
  withFileSizeErrorMessage.args = {
209
161
  ...props,
210
162
  sizeLimit: 1,
211
163
  sizeLimitErrorMessage: 'The file is oversized',
212
164
  };
213
165
 
214
- export const withCustomUploadButtonTitle: Story<UploadInputProps> = Template.bind({});
166
+ export const withCustomUploadButtonTitle: Story = Template.bind({});
215
167
  withCustomUploadButtonTitle.args = {
216
168
  ...props,
217
169
  uploadButtonTitle: 'Upload the VAT receipts for FY 2022-23',