@transferwise/components 46.19.0 → 46.20.0

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 (60) hide show
  1. package/build/index.esm.js +59 -84
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +58 -83
  4. package/build/index.js.map +1 -1
  5. package/build/types/common/panel/Panel.d.ts.map +1 -1
  6. package/build/types/common/textFormat/formatWithPattern/index.d.ts +1 -1
  7. package/build/types/common/textFormat/formatWithPattern/index.d.ts.map +1 -1
  8. package/build/types/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.d.ts +1 -1
  9. package/build/types/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.d.ts.map +1 -1
  10. package/build/types/common/textFormat/getCountOfSymbolsInSelection/index.d.ts +1 -1
  11. package/build/types/common/textFormat/getCountOfSymbolsInSelection/index.d.ts.map +1 -1
  12. package/build/types/common/textFormat/getCursorPositionAfterKeystroke/index.d.ts +1 -1
  13. package/build/types/common/textFormat/getCursorPositionAfterKeystroke/index.d.ts.map +1 -1
  14. package/build/types/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.d.ts +2 -2
  15. package/build/types/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.d.ts.map +1 -1
  16. package/build/types/common/textFormat/getDistanceToSymbol/index.d.ts +1 -1
  17. package/build/types/common/textFormat/getDistanceToSymbol/index.d.ts.map +1 -1
  18. package/build/types/common/textFormat/getSymbolsInPatternWithPosition/index.d.ts +1 -1
  19. package/build/types/common/textFormat/getSymbolsInPatternWithPosition/index.d.ts.map +1 -1
  20. package/build/types/common/textFormat/index.d.ts +7 -6
  21. package/build/types/common/textFormat/index.d.ts.map +1 -1
  22. package/build/types/common/textFormat/unformatWithPattern/index.d.ts +1 -1
  23. package/build/types/common/textFormat/unformatWithPattern/index.d.ts.map +1 -1
  24. package/build/types/index.d.ts +1 -0
  25. package/build/types/index.d.ts.map +1 -1
  26. package/build/types/info/Info.d.ts +3 -2
  27. package/build/types/info/Info.d.ts.map +1 -1
  28. package/build/types/logo/Logo.d.ts.map +1 -1
  29. package/build/types/popover/Popover.d.ts +16 -21
  30. package/build/types/popover/Popover.d.ts.map +1 -1
  31. package/build/types/popover/index.d.ts +2 -1
  32. package/build/types/popover/index.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/src/common/panel/Panel.tsx +1 -0
  35. package/src/common/textFormat/getCountOfSymbolsInSelection/{getCountOfSymbolsInSelection.js → getCountOfSymbolsInSelection.ts} +5 -1
  36. package/src/common/textFormat/getCursorPositionAfterKeystroke/{getCursorPositionAfterKeystroke.spec.js → getCursorPositionAfterKeystroke.spec.ts} +15 -18
  37. package/src/common/textFormat/getDistanceToSymbol/{getDistanceToSymbol.spec.js → getDistanceToSymbol.spec.ts} +3 -3
  38. package/src/common/textFormat/getDistanceToSymbol/{getDistanceToSymbol.js → getDistanceToSymbol.ts} +8 -3
  39. package/src/index.ts +1 -0
  40. package/src/info/Info.tsx +2 -2
  41. package/src/logo/Logo.js +1 -0
  42. package/src/logo/__snapshots__/Logo.spec.js.snap +6 -0
  43. package/src/popover/{Popover.spec.js → Popover.spec.tsx} +5 -2
  44. package/src/popover/Popover.tsx +101 -0
  45. package/src/popover/__snapshots__/{Popover.spec.js.snap → Popover.spec.tsx.snap} +2 -3
  46. package/src/popover/index.ts +2 -0
  47. package/src/popover/Popover.js +0 -101
  48. package/src/popover/index.js +0 -1
  49. /package/src/common/textFormat/formatWithPattern/{formatWithPattern.spec.js → formatWithPattern.spec.ts} +0 -0
  50. /package/src/common/textFormat/formatWithPattern/{index.js → index.ts} +0 -0
  51. /package/src/common/textFormat/getCountOfSymbolsInSelection/{getCountOfSymbolsInSelection.spec.js → getCountOfSymbolsInSelection.spec.ts} +0 -0
  52. /package/src/common/textFormat/getCountOfSymbolsInSelection/{index.js → index.ts} +0 -0
  53. /package/src/common/textFormat/getCursorPositionAfterKeystroke/{index.js → index.ts} +0 -0
  54. /package/src/common/textFormat/getDistanceToSymbol/{index.js → index.ts} +0 -0
  55. /package/src/common/textFormat/getSymbolsInPatternWithPosition/{getSymbolsInPatternWithPosition.spec.js → getSymbolsInPatternWithPosition.spec.ts} +0 -0
  56. /package/src/common/textFormat/getSymbolsInPatternWithPosition/{index.js → index.ts} +0 -0
  57. /package/src/common/textFormat/{index.js → index.ts} +0 -0
  58. /package/src/common/textFormat/unformatWithPattern/{index.js → index.ts} +0 -0
  59. /package/src/common/textFormat/unformatWithPattern/{unformatWithPattern.spec.js → unformatWithPattern.spec.ts} +0 -0
  60. /package/src/popover/{Popover.story.js → Popover.story.tsx} +0 -0
@@ -1,101 +0,0 @@
1
- import { useTheme } from '@wise/components-theming';
2
- import classnames from 'classnames';
3
- import PropTypes from 'prop-types';
4
- import { useRef, useState, cloneElement } from 'react';
5
-
6
- import { Position, Typography } from '../common';
7
- import ResponsivePanel from '../common/responsivePanel';
8
- import Title from '../title';
9
- import { logActionRequiredIf } from '../utilities';
10
-
11
- const Popover = ({ children, className, content, preferredPlacement, title, onClose }) => {
12
- logActionRequired({ preferredPlacement });
13
- const anchorReference = useRef(null);
14
- const [open, setOpen] = useState(false);
15
- const { isModern } = useTheme();
16
-
17
- const handleOnClose = () => {
18
- setOpen(false);
19
- onClose?.();
20
- };
21
-
22
- return (
23
- <span className={classnames('np-popover', className)}>
24
- <span ref={anchorReference} className="d-inline-block">
25
- {cloneElement(children, {
26
- onClick: () => {
27
- if (children?.props?.onClick) {
28
- children.props.onClick();
29
- }
30
- setOpen(!open);
31
- },
32
- })}
33
- </span>
34
- <ResponsivePanel
35
- open={open}
36
- anchorRef={anchorReference}
37
- position={deprecatedPlacements[preferredPlacement] || preferredPlacement}
38
- arrow
39
- className="np-popover__container"
40
- onClose={handleOnClose}
41
- >
42
- <div
43
- className={isModern ? 'np-popover__content np-text-default-body' : 'np-popover__content'}
44
- aria-hidden={!open}
45
- role="dialog"
46
- >
47
- {title && (
48
- <Title type={Typography.TITLE_BODY} className="m-b-1">
49
- {title}
50
- </Title>
51
- )}
52
- {content}
53
- </div>
54
- </ResponsivePanel>
55
- </span>
56
- );
57
- };
58
-
59
- const logActionRequired = ({ preferredPlacement }) => {
60
- logActionRequiredIf(
61
- `Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${deprecatedPlacements[preferredPlacement]} instead.`,
62
- deprecatedPlacements[preferredPlacement],
63
- );
64
- };
65
-
66
- Popover.defaultProps = {
67
- className: undefined,
68
- preferredPlacement: Position.RIGHT,
69
- title: undefined,
70
- };
71
-
72
- Popover.propTypes = {
73
- children: PropTypes.node.isRequired,
74
- className: PropTypes.string,
75
- content: PropTypes.node.isRequired,
76
- /**
77
- * `'left-top'` / `'right-top'` are deprecated use `Position.TOP` / `'top'` instead,
78
- * `'bottom-right'` / `'bottom-left'` are deprecated use `Position.BOTTOM` / `'bottom'` instead
79
- */
80
- preferredPlacement: PropTypes.oneOf([
81
- 'top',
82
- 'right',
83
- 'bottom',
84
- 'left',
85
- 'left-top',
86
- 'right-top',
87
- 'bottom-right',
88
- 'bottom-left',
89
- ]),
90
- onClose: PropTypes.func,
91
- title: PropTypes.node,
92
- };
93
-
94
- const deprecatedPlacements = {
95
- [Position.BOTTOM_LEFT]: Position.BOTTOM,
96
- [Position.BOTTOM_RIGHT]: Position.BOTTOM,
97
- [Position.LEFT_TOP]: Position.TOP,
98
- [Position.RIGHT_TOP]: Position.TOP,
99
- };
100
-
101
- export default Popover;
@@ -1 +0,0 @@
1
- export { default } from './Popover';
File without changes