@transferwise/components 45.26.0 → 45.26.2

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 (54) hide show
  1. package/build/i18n/en.json +1 -0
  2. package/build/index.esm.js +185 -99
  3. package/build/index.esm.js.map +1 -1
  4. package/build/index.js +185 -99
  5. package/build/index.js.map +1 -1
  6. package/build/main.css +1 -1
  7. package/build/styles/dateLookup/DateLookup.css +1 -1
  8. package/build/styles/main.css +1 -1
  9. package/build/styles/typeahead/typeaheadOption/TypeaheadOption.css +1 -1
  10. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  11. package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts +9 -0
  12. package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts.map +1 -0
  13. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts +1 -1
  14. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -1
  15. package/build/types/dateLookup/tableLink/TableLink.d.ts +14 -4
  16. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
  17. package/build/types/dateLookup/tableLink/index.d.ts +1 -1
  18. package/build/types/dateLookup/tableLink/index.d.ts.map +1 -1
  19. package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts.map +1 -1
  20. package/build/types/info/Info.d.ts +1 -1
  21. package/build/types/info/Info.d.ts.map +1 -1
  22. package/build/types/info/Info.messages.d.ts +8 -0
  23. package/build/types/info/Info.messages.d.ts.map +1 -0
  24. package/build/types/summary/Summary.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/dateLookup/DateLookup.css +1 -1
  27. package/src/dateLookup/DateLookup.js +19 -4
  28. package/src/dateLookup/DateLookup.keyboardEvents.spec.js +12 -0
  29. package/src/dateLookup/DateLookup.less +39 -49
  30. package/src/dateLookup/DateLookup.story.js +8 -7
  31. package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +28 -3
  32. package/src/dateLookup/dayCalendar/table/DayCalendarTable.spec.js +25 -0
  33. package/src/dateLookup/getFocusableTime/getFocusable.spec.ts +40 -0
  34. package/src/dateLookup/getFocusableTime/getFocusableTime.tsx +14 -0
  35. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.js +33 -20
  36. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.spec.js +33 -0
  37. package/src/dateLookup/tableLink/TableLink.spec.js +6 -15
  38. package/src/dateLookup/tableLink/TableLink.tsx +79 -0
  39. package/src/dateLookup/yearCalendar/table/YearCalendarTable.js +33 -11
  40. package/src/dateLookup/yearCalendar/table/YearCalendarTable.spec.js +26 -0
  41. package/src/i18n/en.json +1 -0
  42. package/src/info/Info.messages.ts +8 -0
  43. package/src/info/Info.spec.js +10 -4
  44. package/src/info/Info.tsx +5 -2
  45. package/src/main.css +1 -1
  46. package/src/popover/Popover.js +1 -1
  47. package/src/popover/__snapshots__/Popover.spec.js.snap +2 -2
  48. package/src/summary/Summary.tsx +0 -1
  49. package/src/typeahead/Typeahead.story.js +6 -0
  50. package/src/typeahead/typeaheadOption/TypeaheadOption.css +1 -1
  51. package/src/typeahead/typeaheadOption/TypeaheadOption.js +1 -1
  52. package/src/typeahead/typeaheadOption/TypeaheadOption.less +2 -1
  53. package/src/dateLookup/tableLink/TableLink.js +0 -70
  54. /package/src/dateLookup/tableLink/{index.js → index.ts} +0 -0
@@ -39,7 +39,7 @@ const Popover = ({ children, className, content, preferredPlacement, title }) =>
39
39
  <div
40
40
  className={isModern ? 'np-popover__content np-text-default-body' : 'np-popover__content'}
41
41
  aria-hidden={!open}
42
- role="tooltip"
42
+ role="dialog"
43
43
  >
44
44
  {title && (
45
45
  <Title type={Typography.TITLE_BODY} className="m-b-1">
@@ -14,7 +14,7 @@ exports[`Popover on desktop renders when is open 1`] = `
14
14
  <div
15
15
  aria-hidden="false"
16
16
  class="np-popover__content"
17
- role="tooltip"
17
+ role="dialog"
18
18
  >
19
19
  <h4
20
20
  class="np-text-title-body m-b-1"
@@ -89,7 +89,7 @@ exports[`Popover on mobile renders when is open 1`] = `
89
89
  <div
90
90
  aria-hidden="false"
91
91
  class="np-popover__content"
92
- role="tooltip"
92
+ role="dialog"
93
93
  >
94
94
  <h4
95
95
  class="np-text-title-body m-b-1"
@@ -100,7 +100,6 @@ const Summary = ({
100
100
  help,
101
101
  icon,
102
102
  illustration = null,
103
- // @ts-expect-error help is old and deprecated prop
104
103
  info = help,
105
104
  status,
106
105
  title,
@@ -114,3 +114,9 @@ export const Basic = () => {
114
114
  />
115
115
  );
116
116
  };
117
+
118
+ Basic.play = async ({ canvasElement }) => {
119
+ const canvas = within(canvasElement);
120
+ userEvent.type(canvas.getByRole('combobox'), 'abc');
121
+ userEvent.type(canvas.getByRole('combobox'), '{arrowDown}');
122
+ };
@@ -1 +1 @@
1
- .typeahead__option.tw-dropdown-item .dropdown-item:active strong{color:#fff}.typeahead__option.tw-dropdown-item--focused{background-color:#86a7bd1a;background-color:var(--color-background-neutral)}
1
+ .typeahead__option.tw-dropdown-item .dropdown-item:active strong{color:#fff}.typeahead__option.tw-dropdown-item--focused{border-radius:10px;border-radius:var(--radius-small);box-shadow:inset 0 0 0 1px #c9cbce;box-shadow:inset 0 0 0 1px var(--color-interactive-secondary)}
@@ -16,7 +16,7 @@ const Option = (props) => {
16
16
  'tw-dropdown-item--focused': selected,
17
17
  })}
18
18
  >
19
- <a className="dropdown-item" href="#" onClick={onClick}>
19
+ <a className="dropdown-item" href="#" tabIndex={-1} onClick={onClick}>
20
20
  <span>{hightlight(label, query)}</span>
21
21
  {note && <span className="np-text-body-default m-l-1">{note}</span>}
22
22
  {secondary && <span className="np-text-body-default text-ellipsis">{secondary}</span>}
@@ -8,6 +8,7 @@
8
8
  }
9
9
 
10
10
  &--focused {
11
- background-color: var(--color-background-neutral);
11
+ box-shadow: inset 0 0 0 1px var(--color-interactive-secondary);
12
+ border-radius: var(--radius-small);
12
13
  }
13
14
  }
@@ -1,70 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import { PureComponent } from 'react';
3
- import { injectIntl } from 'react-intl';
4
-
5
- import messages from '../DateLookup.messages';
6
-
7
- class TableLink extends PureComponent {
8
- onClick = (event) => {
9
- event.preventDefault();
10
- if (!this.props.disabled) {
11
- this.props.onClick(this.props.item);
12
- }
13
- };
14
-
15
- calculateAriaLabel = (longTitle, title, active, type, formatMessage) => {
16
- if (active) {
17
- return `${longTitle || title}, ${formatMessage(messages.selected)} ${formatMessage(
18
- messages[type],
19
- )}`;
20
- }
21
- return longTitle || title;
22
- };
23
-
24
- render() {
25
- const {
26
- item,
27
- type,
28
- title,
29
- longTitle,
30
- active,
31
- disabled,
32
- today,
33
- intl: { formatMessage },
34
- } = this.props;
35
- return (
36
- <>
37
- <button
38
- type="button"
39
- className={`tw-date-lookup-${type}-option ${active ? 'active' : ''} ${
40
- today ? 'today' : ''
41
- } np-text-body-default-bold`}
42
- disabled={disabled}
43
- aria-label={this.calculateAriaLabel(longTitle, title, active, type, formatMessage)}
44
- aria-pressed={active}
45
- onClick={this.onClick}
46
- >
47
- {title || item}
48
- </button>
49
- </>
50
- );
51
- }
52
- }
53
-
54
- TableLink.propTypes = {
55
- item: PropTypes.number.isRequired, // day (1-31), month (0-11) or year (2018 etc)
56
- type: PropTypes.oneOf(['day', 'month', 'year']).isRequired,
57
- title: PropTypes.string,
58
- longTitle: PropTypes.string,
59
- active: PropTypes.bool.isRequired,
60
- disabled: PropTypes.bool.isRequired,
61
- today: PropTypes.bool.isRequired,
62
- onClick: PropTypes.func.isRequired,
63
- };
64
-
65
- TableLink.defaultProps = {
66
- title: null,
67
- longTitle: null,
68
- };
69
-
70
- export default injectIntl(TableLink);
File without changes