@transferwise/components 0.0.0-experimental-8f9699a → 0.0.0-experimental-dabc13b

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 (73) hide show
  1. package/build/i18n/cs.json +1 -0
  2. package/build/i18n/de.json +1 -0
  3. package/build/i18n/es.json +1 -0
  4. package/build/i18n/fr.json +1 -0
  5. package/build/i18n/hu.json +1 -0
  6. package/build/i18n/id.json +1 -0
  7. package/build/i18n/it.json +1 -0
  8. package/build/i18n/ja.json +1 -0
  9. package/build/i18n/pl.json +1 -0
  10. package/build/i18n/pt.json +4 -3
  11. package/build/i18n/ro.json +4 -3
  12. package/build/i18n/ru.json +2 -1
  13. package/build/i18n/th.json +1 -0
  14. package/build/i18n/tr.json +1 -0
  15. package/build/i18n/uk.json +1 -0
  16. package/build/i18n/zh-CN.json +1 -0
  17. package/build/i18n/zh-HK.json +1 -0
  18. package/build/index.esm.js +99 -159
  19. package/build/index.esm.js.map +1 -1
  20. package/build/index.js +99 -159
  21. package/build/index.js.map +1 -1
  22. package/build/main.css +1 -1
  23. package/build/styles/chips/Chip.css +1 -1
  24. package/build/styles/dateLookup/DateLookup.css +1 -1
  25. package/build/styles/main.css +1 -1
  26. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  27. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts +1 -1
  28. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -1
  29. package/build/types/dateLookup/tableLink/TableLink.d.ts +4 -14
  30. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
  31. package/build/types/dateLookup/tableLink/index.d.ts +1 -1
  32. package/build/types/dateLookup/tableLink/index.d.ts.map +1 -1
  33. package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts.map +1 -1
  34. package/package.json +2 -2
  35. package/src/chips/Chip.css +1 -1
  36. package/src/chips/Chip.less +9 -21
  37. package/src/dateLookup/DateLookup.css +1 -1
  38. package/src/dateLookup/DateLookup.js +4 -19
  39. package/src/dateLookup/DateLookup.keyboardEvents.spec.js +0 -12
  40. package/src/dateLookup/DateLookup.less +49 -39
  41. package/src/dateLookup/DateLookup.story.js +7 -8
  42. package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +3 -28
  43. package/src/dateLookup/dayCalendar/table/DayCalendarTable.spec.js +0 -25
  44. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.js +20 -33
  45. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.spec.js +0 -33
  46. package/src/dateLookup/tableLink/TableLink.js +70 -0
  47. package/src/dateLookup/tableLink/TableLink.spec.js +15 -6
  48. package/src/dateLookup/yearCalendar/table/YearCalendarTable.js +11 -33
  49. package/src/dateLookup/yearCalendar/table/YearCalendarTable.spec.js +0 -26
  50. package/src/i18n/cs.json +1 -0
  51. package/src/i18n/de.json +1 -0
  52. package/src/i18n/es.json +1 -0
  53. package/src/i18n/fr.json +1 -0
  54. package/src/i18n/hu.json +1 -0
  55. package/src/i18n/id.json +1 -0
  56. package/src/i18n/it.json +1 -0
  57. package/src/i18n/ja.json +1 -0
  58. package/src/i18n/pl.json +1 -0
  59. package/src/i18n/pt.json +4 -3
  60. package/src/i18n/ro.json +4 -3
  61. package/src/i18n/ru.json +2 -1
  62. package/src/i18n/th.json +1 -0
  63. package/src/i18n/tr.json +1 -0
  64. package/src/i18n/uk.json +1 -0
  65. package/src/i18n/zh-CN.json +1 -0
  66. package/src/i18n/zh-HK.json +1 -0
  67. package/src/main.css +1 -1
  68. package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts +0 -9
  69. package/build/types/dateLookup/getFocusableTime/getFocusableTime.d.ts.map +0 -1
  70. package/src/dateLookup/getFocusableTime/getFocusable.spec.ts +0 -40
  71. package/src/dateLookup/getFocusableTime/getFocusableTime.tsx +0 -14
  72. package/src/dateLookup/tableLink/TableLink.tsx +0 -79
  73. /package/src/dateLookup/tableLink/{index.ts → index.js} +0 -0
@@ -1,9 +0,0 @@
1
- interface FocusableTimeProps {
2
- isActive: (time: number) => boolean;
3
- isNow: (time: number) => boolean;
4
- isDisabled: (time: number) => boolean;
5
- timeSpan: number[];
6
- }
7
- export declare function getFocusableTime(props: FocusableTimeProps): number | undefined;
8
- export {};
9
- //# sourceMappingURL=getFocusableTime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getFocusableTime.d.ts","sourceRoot":"","sources":["../../../../src/dateLookup/getFocusableTime/getFocusableTime.tsx"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,GAAG,SAAS,CAM9E"}
@@ -1,40 +0,0 @@
1
- import { getFocusableTime } from './getFocusableTime';
2
-
3
- describe('getFocusableTime', () => {
4
- const isActive = (value: number) => value === 2;
5
- const isNow = (value: number) => value === 3;
6
- const isDisabled = (value: number) => value === 4;
7
- const values = [1, 2, 3, 4, 5];
8
-
9
- it('returns first selected value', () => {
10
- expect(getFocusableTime({ isActive, isNow, isDisabled, timeSpan: values })).toBe(2);
11
- });
12
-
13
- it('returns first now value if nothing is selected', () => {
14
- expect(getFocusableTime({ isActive: () => false, isNow, isDisabled, timeSpan: values })).toBe(
15
- 3,
16
- );
17
- });
18
-
19
- it('returns first non disabled value when nothing is selected or now', () => {
20
- expect(
21
- getFocusableTime({
22
- isActive: () => false,
23
- isNow: () => false,
24
- isDisabled,
25
- timeSpan: values,
26
- }),
27
- ).toBe(1);
28
- });
29
-
30
- it('returns null if no selected, now, or non-disabled', () => {
31
- expect(
32
- getFocusableTime({
33
- isActive: () => false,
34
- isNow: () => false,
35
- isDisabled: () => true,
36
- timeSpan: values,
37
- }),
38
- ).toBeUndefined();
39
- });
40
- });
@@ -1,14 +0,0 @@
1
- interface FocusableTimeProps {
2
- isActive: (time: number) => boolean;
3
- isNow: (time: number) => boolean;
4
- isDisabled: (time: number) => boolean;
5
- timeSpan: number[];
6
- }
7
-
8
- export function getFocusableTime(props: FocusableTimeProps): number | undefined {
9
- return (
10
- props.timeSpan.find((time: number) => props.isActive(time)) ||
11
- props.timeSpan.find((time: number) => props.isNow(time) && !props.isDisabled(time)) ||
12
- props.timeSpan.find((time: number) => !props.isDisabled(time))
13
- );
14
- }
@@ -1,79 +0,0 @@
1
- import classNames from 'classnames';
2
- import { useEffect, useRef } from 'react';
3
- import { useIntl } from 'react-intl';
4
-
5
- import messages from '../DateLookup.messages';
6
-
7
- interface TableLinkProps {
8
- item: number;
9
- type: 'day' | 'month' | 'year';
10
- title?: string;
11
- longTitle?: string;
12
- active: boolean;
13
- disabled: boolean;
14
- today: boolean;
15
- autofocus?: boolean;
16
- onClick: (item: number) => void;
17
- }
18
-
19
- const TableLink = ({
20
- item,
21
- type,
22
- title,
23
- longTitle,
24
- active,
25
- disabled,
26
- today,
27
- autofocus,
28
- onClick,
29
- }: TableLinkProps) => {
30
- const buttonRef = useRef<HTMLButtonElement>(null);
31
- const intl = useIntl();
32
-
33
- useEffect(() => {
34
- if (autofocus) {
35
- setTimeout(() => {
36
- buttonRef.current?.focus();
37
- }, 0);
38
- }
39
- }, [autofocus]);
40
-
41
- const onCalendarClick = (event: React.MouseEvent<HTMLButtonElement>) => {
42
- event.preventDefault();
43
- if (!disabled) {
44
- onClick(item);
45
- }
46
- };
47
-
48
- const calculateAriaLabel = () => {
49
- if (active) {
50
- return `${longTitle || title || ''}, ${intl.formatMessage(
51
- messages.selected,
52
- )} ${intl.formatMessage(messages[type])}`;
53
- }
54
- return longTitle || title;
55
- };
56
-
57
- return (
58
- <>
59
- <button
60
- ref={buttonRef}
61
- type="button"
62
- className={classNames(
63
- `tw-date-lookup-${type}-option np-text-body-default-bold`,
64
- { active: !!active },
65
- { today: !!today },
66
- )}
67
- disabled={disabled}
68
- tabIndex={autofocus ? 0 : -1}
69
- aria-label={calculateAriaLabel()}
70
- aria-pressed={active}
71
- onClick={onCalendarClick}
72
- >
73
- {title || item}
74
- </button>
75
- </>
76
- );
77
- };
78
-
79
- export default TableLink;
File without changes