@transferwise/components 45.26.0 → 45.26.1

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 (36) hide show
  1. package/build/index.esm.js +152 -75
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +152 -75
  4. package/build/index.js.map +1 -1
  5. package/build/main.css +1 -1
  6. package/build/styles/dateLookup/DateLookup.css +1 -1
  7. package/build/styles/main.css +1 -1
  8. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  9. package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts +9 -0
  10. package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts.map +1 -0
  11. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts +1 -1
  12. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -1
  13. package/build/types/dateLookup/tableLink/TableLink.d.ts +14 -4
  14. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
  15. package/build/types/dateLookup/tableLink/index.d.ts +1 -1
  16. package/build/types/dateLookup/tableLink/index.d.ts.map +1 -1
  17. package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts.map +1 -1
  18. package/package.json +1 -1
  19. package/src/dateLookup/DateLookup.css +1 -1
  20. package/src/dateLookup/DateLookup.js +19 -4
  21. package/src/dateLookup/DateLookup.keyboardEvents.spec.js +12 -0
  22. package/src/dateLookup/DateLookup.less +39 -49
  23. package/src/dateLookup/DateLookup.story.js +8 -7
  24. package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +28 -3
  25. package/src/dateLookup/dayCalendar/table/DayCalendarTable.spec.js +25 -0
  26. package/src/dateLookup/getFocusableTime/getFocusable.spec.ts +40 -0
  27. package/src/dateLookup/getFocusableTime/getFocusableTime.tsx +14 -0
  28. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.js +33 -20
  29. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.spec.js +33 -0
  30. package/src/dateLookup/tableLink/TableLink.spec.js +6 -15
  31. package/src/dateLookup/tableLink/TableLink.tsx +79 -0
  32. package/src/dateLookup/yearCalendar/table/YearCalendarTable.js +33 -11
  33. package/src/dateLookup/yearCalendar/table/YearCalendarTable.spec.js +26 -0
  34. package/src/main.css +1 -1
  35. package/src/dateLookup/tableLink/TableLink.js +0 -70
  36. /package/src/dateLookup/tableLink/{index.js → index.ts} +0 -0
@@ -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