@transferwise/components 0.0.0-experimental-d087eac → 0.0.0-experimental-186b26b

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 (55) hide show
  1. package/build/field/Field.js +63 -32
  2. package/build/field/Field.js.map +1 -1
  3. package/build/field/Field.messages.js +14 -0
  4. package/build/field/Field.messages.js.map +1 -0
  5. package/build/field/Field.messages.mjs +10 -0
  6. package/build/field/Field.messages.mjs.map +1 -0
  7. package/build/field/Field.mjs +65 -34
  8. package/build/field/Field.mjs.map +1 -1
  9. package/build/i18n/en.json +1 -0
  10. package/build/i18n/en.json.js +1 -0
  11. package/build/i18n/en.json.js.map +1 -1
  12. package/build/i18n/en.json.mjs +1 -0
  13. package/build/i18n/en.json.mjs.map +1 -1
  14. package/build/inputs/TextArea.js +18 -0
  15. package/build/inputs/TextArea.js.map +1 -1
  16. package/build/inputs/TextArea.mjs +19 -1
  17. package/build/inputs/TextArea.mjs.map +1 -1
  18. package/build/inputs/contexts.js +16 -0
  19. package/build/inputs/contexts.js.map +1 -1
  20. package/build/inputs/contexts.mjs +16 -2
  21. package/build/inputs/contexts.mjs.map +1 -1
  22. package/build/main.css +19 -3
  23. package/build/moneyInput/MoneyInput.js +1 -2
  24. package/build/moneyInput/MoneyInput.js.map +1 -1
  25. package/build/moneyInput/MoneyInput.mjs +1 -2
  26. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  27. package/build/styles/field/Field.css +17 -3
  28. package/build/styles/main.css +19 -3
  29. package/build/types/field/Field.d.ts.map +1 -1
  30. package/build/types/field/Field.messages.d.ts +8 -0
  31. package/build/types/field/Field.messages.d.ts.map +1 -0
  32. package/build/types/inputs/TextArea.d.ts.map +1 -1
  33. package/build/types/inputs/contexts.d.ts +6 -0
  34. package/build/types/inputs/contexts.d.ts.map +1 -1
  35. package/build/types/moneyInput/MoneyInput.d.ts +0 -1
  36. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  37. package/build/types/test-utils/index.d.ts +2 -0
  38. package/build/types/test-utils/index.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/field/Field.css +17 -3
  41. package/src/field/Field.less +15 -3
  42. package/src/field/Field.messages.ts +8 -0
  43. package/src/field/Field.story.tsx +5 -1
  44. package/src/field/Field.test.tsx +90 -0
  45. package/src/field/Field.tsx +84 -37
  46. package/src/i18n/en.json +1 -0
  47. package/src/inputs/TextArea.story.tsx +56 -0
  48. package/src/inputs/TextArea.tsx +23 -2
  49. package/src/inputs/contexts.tsx +18 -1
  50. package/src/main.css +19 -3
  51. package/src/moneyInput/MoneyInput.story.tsx +0 -20
  52. package/src/moneyInput/MoneyInput.test.story.tsx +0 -30
  53. package/src/moneyInput/MoneyInput.test.tsx +0 -36
  54. package/src/moneyInput/MoneyInput.tsx +0 -2
  55. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +1 -0
@@ -566,42 +566,6 @@ describe('Money Input', () => {
566
566
  expect(screen.getByRole('listbox', { name: triggerLabel ?? '' })).toBeInTheDocument();
567
567
  });
568
568
 
569
- describe('disabled options', () => {
570
- const disabledCurrency: CurrencyOptionItem = {
571
- value: 'CNY',
572
- label: 'CNY',
573
- note: 'Chinese yuan',
574
- currency: 'cny',
575
- disabled: true,
576
- };
577
-
578
- it('renders disabled currency option with aria-disabled', async () => {
579
- customRender({
580
- currencies: [{ header: 'Popular currencies' }, ...popularCurrencies, disabledCurrency],
581
- });
582
- await openDropdown();
583
- const cnyOption = screen.getByRole('option', { name: /CNY/ });
584
- expect(cnyOption).toHaveAttribute('aria-disabled', 'true');
585
- });
586
-
587
- it('does not call onCurrencyChange when a disabled option is clicked', async () => {
588
- customRender({
589
- currencies: [{ header: 'Popular currencies' }, ...popularCurrencies, disabledCurrency],
590
- });
591
- await openDropdown();
592
- const cnyOption = screen.getByRole('option', { name: /CNY/ });
593
- await userEvent.click(cnyOption);
594
- expect(initialProps.onCurrencyChange).not.toHaveBeenCalled();
595
- });
596
-
597
- it('does not mark options without disabled property as disabled', async () => {
598
- customRender();
599
- await openDropdown();
600
- const eurOption = screen.getByRole('option', { name: /EUR/ });
601
- expect(eurOption).not.toHaveAttribute('aria-disabled', 'true');
602
- });
603
- });
604
-
605
569
  it('renders custom action button in dropdown footer and calls onCustomAction', async () => {
606
570
  const onCustomAction = jest.fn();
607
571
  render(
@@ -34,7 +34,6 @@ export interface CurrencyOptionItem {
34
34
  currency: string;
35
35
  note?: string;
36
36
  searchable?: string;
37
- disabled?: boolean;
38
37
  }
39
38
 
40
39
  export interface CurrencyHeaderItem {
@@ -257,7 +256,6 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
257
256
  type: 'option',
258
257
  value: item,
259
258
  filterMatchers: [item.value, item.label, item.note ?? '', item.searchable ?? ''],
260
- disabled: item.disabled,
261
259
  });
262
260
  }
263
261
  });
@@ -21,6 +21,7 @@ export const Basic: Story = {
21
21
  <TextareaWithDisplayFormat
22
22
  id={id}
23
23
  value="0000"
24
+ maxLength={20}
24
25
  displayPattern="**** - **** - ****"
25
26
  onChange={console.log}
26
27
  />