@transferwise/components 0.0.0-experimental-a6eccb9 → 0.0.0-experimental-eecc435
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.
- package/build/index.esm.js +73 -60
- package/build/index.esm.js.map +1 -1
- package/build/index.js +72 -59
- package/build/index.js.map +1 -1
- package/build/types/common/textFormat/formatWithPattern/index.d.ts +1 -1
- package/build/types/common/textFormat/formatWithPattern/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.d.ts +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.d.ts.map +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/index.d.ts +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getCursorPositionAfterKeystroke/index.d.ts +1 -1
- package/build/types/common/textFormat/getCursorPositionAfterKeystroke/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.d.ts +2 -2
- package/build/types/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.d.ts.map +1 -1
- package/build/types/common/textFormat/getDistanceToSymbol/index.d.ts +1 -1
- package/build/types/common/textFormat/getDistanceToSymbol/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getSymbolsInPatternWithPosition/index.d.ts +1 -1
- package/build/types/common/textFormat/getSymbolsInPatternWithPosition/index.d.ts.map +1 -1
- package/build/types/common/textFormat/index.d.ts +7 -6
- package/build/types/common/textFormat/index.d.ts.map +1 -1
- package/build/types/common/textFormat/unformatWithPattern/index.d.ts +1 -1
- package/build/types/common/textFormat/unformatWithPattern/index.d.ts.map +1 -1
- package/build/types/index.d.ts +0 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/info/Info.d.ts +2 -3
- package/build/types/info/Info.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts.map +1 -1
- package/build/types/popover/Popover.d.ts +21 -16
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/build/types/popover/index.d.ts +1 -2
- package/build/types/popover/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/textFormat/getCountOfSymbolsInSelection/{getCountOfSymbolsInSelection.js → getCountOfSymbolsInSelection.ts} +5 -1
- package/src/common/textFormat/getCursorPositionAfterKeystroke/{getCursorPositionAfterKeystroke.spec.js → getCursorPositionAfterKeystroke.spec.ts} +15 -18
- package/src/common/textFormat/getDistanceToSymbol/{getDistanceToSymbol.spec.js → getDistanceToSymbol.spec.ts} +3 -3
- package/src/common/textFormat/getDistanceToSymbol/{getDistanceToSymbol.js → getDistanceToSymbol.ts} +8 -3
- package/src/index.ts +0 -1
- package/src/info/Info.tsx +2 -2
- package/src/logo/Logo.js +1 -0
- package/src/logo/__snapshots__/Logo.spec.js.snap +6 -0
- package/src/popover/Popover.js +101 -0
- package/src/popover/{Popover.spec.tsx → Popover.spec.js} +2 -5
- package/src/popover/index.js +1 -0
- package/src/popover/Popover.tsx +0 -106
- package/src/popover/index.ts +0 -2
- /package/src/common/textFormat/formatWithPattern/{formatWithPattern.spec.js → formatWithPattern.spec.ts} +0 -0
- /package/src/common/textFormat/formatWithPattern/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getCountOfSymbolsInSelection/{getCountOfSymbolsInSelection.spec.js → getCountOfSymbolsInSelection.spec.ts} +0 -0
- /package/src/common/textFormat/getCountOfSymbolsInSelection/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getCursorPositionAfterKeystroke/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getDistanceToSymbol/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getSymbolsInPatternWithPosition/{getSymbolsInPatternWithPosition.spec.js → getSymbolsInPatternWithPosition.spec.ts} +0 -0
- /package/src/common/textFormat/getSymbolsInPatternWithPosition/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/unformatWithPattern/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/unformatWithPattern/{unformatWithPattern.spec.js → unformatWithPattern.spec.ts} +0 -0
- /package/src/popover/{Popover.story.tsx → Popover.story.js} +0 -0
- /package/src/popover/__snapshots__/{Popover.spec.tsx.snap → Popover.spec.js.snap} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from './formatWithPattern';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/formatWithPattern/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/formatWithPattern/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|
package/build/types/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
declare const getCountOfSymbolsInSelection: (selectionStart: number, selectionEnd: number, pattern: string) => number;
|
|
1
2
|
export default getCountOfSymbolsInSelection;
|
|
2
|
-
declare function getCountOfSymbolsInSelection(selectionStart: any, selectionEnd: any, pattern: any): number;
|
|
3
3
|
//# sourceMappingURL=getCountOfSymbolsInSelection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCountOfSymbolsInSelection.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.
|
|
1
|
+
{"version":3,"file":"getCountOfSymbolsInSelection.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,4BAA4B,mBAChB,MAAM,gBACR,MAAM,WACX,MAAM,WAIP,CAAC;AAEX,eAAe,4BAA4B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from './getCountOfSymbolsInSelection';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getCountOfSymbolsInSelection/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getCountOfSymbolsInSelection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from './getCursorPositionAfterKeystroke';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getCursorPositionAfterKeystroke/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getCursorPositionAfterKeystroke/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export declare const getDistanceToNextSymbol: (selectionStart: number, pattern: string) => number;
|
|
2
|
+
export declare const getDistanceToPreviousSymbol: (selectionStart: number, pattern: string) => number;
|
|
3
3
|
//# sourceMappingURL=getDistanceToSymbol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDistanceToSymbol.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.
|
|
1
|
+
{"version":3,"file":"getDistanceToSymbol.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB,mBAAoB,MAAM,WAAW,MAAM,WAI9E,CAAC;AAEF,eAAO,MAAM,2BAA2B,mBAAoB,MAAM,WAAW,MAAM,WAMlF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getDistanceToPreviousSymbol, getDistanceToNextSymbol } from
|
|
1
|
+
export { getDistanceToPreviousSymbol, getDistanceToNextSymbol } from './getDistanceToSymbol';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getDistanceToSymbol/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getDistanceToSymbol/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from './getSymbolsInPatternWithPosition';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getSymbolsInPatternWithPosition/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getSymbolsInPatternWithPosition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { default as formatWithPattern } from
|
|
2
|
-
export { default as unformatWithPattern } from
|
|
3
|
-
export { default as getSymbolsInPatternWithPosition } from
|
|
4
|
-
export { default as getCountOfSymbolsInSelection } from
|
|
5
|
-
export { default as getCursorPositionAfterKeystroke } from
|
|
6
|
-
export { getDistanceToNextSymbol
|
|
1
|
+
export { default as formatWithPattern } from './formatWithPattern';
|
|
2
|
+
export { default as unformatWithPattern } from './unformatWithPattern';
|
|
3
|
+
export { default as getSymbolsInPatternWithPosition } from './getSymbolsInPatternWithPosition';
|
|
4
|
+
export { default as getCountOfSymbolsInSelection } from './getCountOfSymbolsInSelection';
|
|
5
|
+
export { default as getCursorPositionAfterKeystroke } from './getCursorPositionAfterKeystroke';
|
|
6
|
+
export { getDistanceToNextSymbol } from './getDistanceToSymbol';
|
|
7
|
+
export { getDistanceToPreviousSymbol } from './getDistanceToSymbol';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/textFormat/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/textFormat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from './unformatWithPattern';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/unformatWithPattern/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/unformatWithPattern/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export type { SearchInputProps } from './inputs/SearchInput';
|
|
|
14
14
|
export type { SelectInputGroupItem, SelectInputItem, SelectInputOptionContentProps, SelectInputOptionItem, SelectInputProps, SelectInputSeparatorItem, SelectInputTriggerButtonProps, } from './inputs/SelectInput';
|
|
15
15
|
export type { TextAreaProps } from './inputs/TextArea';
|
|
16
16
|
export type { PhoneNumberInputProps } from './phoneNumberInput/PhoneNumberInput';
|
|
17
|
-
export type { PopoverProps, PopoverPreferredPlacement } from './popover';
|
|
18
17
|
export type { RadioProps } from './radio';
|
|
19
18
|
export type { RadioGroupProps, RadioGroupRadio } from './radioGroup';
|
|
20
19
|
export type { RadioOptionProps } from './radioOption';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EACV,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,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D;;GAEG;AACH,OAAO,EACL,SAAS,EACT,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,MAAM,EACN,gBAAgB,EAChB,UAAU,EACV,OAAO,GACR,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC;;GAEG;AACH,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SizeSmall, SizeLarge } from '../common';
|
|
3
|
-
import { PopoverPreferredPlacement } from '../popover';
|
|
2
|
+
import { Position, SizeSmall, SizeLarge } from '../common';
|
|
4
3
|
export interface Props {
|
|
5
4
|
'aria-label'?: string;
|
|
6
5
|
/**
|
|
@@ -27,7 +26,7 @@ export interface Props {
|
|
|
27
26
|
/**
|
|
28
27
|
* Prferred placement of the Popover, does not apply to Modal
|
|
29
28
|
*/
|
|
30
|
-
preferredPlacement?:
|
|
29
|
+
preferredPlacement?: Position;
|
|
31
30
|
}
|
|
32
31
|
declare const Info: ({ className, content, onClick, presentation, size, title, "aria-label": ariaLabel, preferredPlacement, }: Props) => import("react").JSX.Element;
|
|
33
32
|
export default Info;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Info.d.ts","sourceRoot":"","sources":["../../../src/info/Info.tsx"],"names":[],"mappings":";AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"Info.d.ts","sourceRoot":"","sources":["../../../src/info/Info.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAQ,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAOjE,MAAM,WAAW,KAAK;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,kBAAkB,CAAC,EAAE,QAAQ,CAAC;CAC/B;AAED,QAAA,MAAM,IAAI,6GASP,KAAK,gCAiDP,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logo.d.ts","sourceRoot":"","sources":["../../../src/logo/Logo.js"],"names":[],"mappings":";AAkBA;;;;
|
|
1
|
+
{"version":3,"file":"Logo.d.ts","sourceRoot":"","sources":["../../../src/logo/Logo.js"],"names":[],"mappings":";AAkBA;;;;gCAcC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export type PopoverPreferredPlacement = "top" | "right" | "bottom" | "left" | "left-top" | "right-top" | "bottom-right" | "bottom-left";
|
|
4
|
+
|
|
5
|
+
export interface PopoverProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
content: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* `'left-top'` / `'right-top'` are deprecated use `Position.TOP` / `'top'` instead,
|
|
11
|
+
* `'bottom-right'` / `'bottom-left'` are deprecated use `Position.BOTTOM` / `'bottom'` instead
|
|
12
|
+
*/
|
|
13
|
+
preferredPlacement?: PopoverPreferredPlacement;
|
|
14
|
+
onClose?: (...args: any[])=>any;
|
|
15
|
+
title?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare const Popover: React.FC<PopoverProps>;
|
|
19
|
+
|
|
20
|
+
export default Popover;
|
|
21
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/popover/Popover.
|
|
1
|
+
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/popover/Popover.js"],"names":[],"mappings":";AAUA;;;;;;;gCA8CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/popover/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/popover/index.js"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import getSymbolsInPatternWithPosition from '../getSymbolsInPatternWithPosition';
|
|
2
2
|
|
|
3
|
-
const getCountOfSymbolsInSelection = (
|
|
3
|
+
const getCountOfSymbolsInSelection = (
|
|
4
|
+
selectionStart: number,
|
|
5
|
+
selectionEnd: number,
|
|
6
|
+
pattern: string,
|
|
7
|
+
) =>
|
|
4
8
|
getSymbolsInPatternWithPosition(pattern).filter(
|
|
5
9
|
(symbol) => symbol.index >= selectionStart && symbol.index < selectionEnd,
|
|
6
10
|
).length;
|
|
@@ -112,23 +112,20 @@ const tests = [
|
|
|
112
112
|
];
|
|
113
113
|
|
|
114
114
|
describe('pushValueToStack', () => {
|
|
115
|
-
tests
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
expect(
|
|
130
|
-
getCursorPositionAfterKeystroke(key, selectionStart, selectionEnd, pattern, pastedLength),
|
|
131
|
-
).toStrictEqual(expectedValue);
|
|
132
|
-
});
|
|
115
|
+
tests.forEach((test) => {
|
|
116
|
+
const {
|
|
117
|
+
key,
|
|
118
|
+
selectionStart,
|
|
119
|
+
selectionEnd = selectionStart,
|
|
120
|
+
expectedValue,
|
|
121
|
+
testMessage,
|
|
122
|
+
pattern,
|
|
123
|
+
pastedLength = 0,
|
|
124
|
+
} = test;
|
|
125
|
+
it(`${testMessage}`, () => {
|
|
126
|
+
expect(
|
|
127
|
+
getCursorPositionAfterKeystroke(key, selectionStart, selectionEnd, pattern, pastedLength),
|
|
128
|
+
).toStrictEqual(expectedValue);
|
|
133
129
|
});
|
|
130
|
+
});
|
|
134
131
|
});
|
|
@@ -28,9 +28,9 @@ describe('getDistanceToNextSymbol', () => {
|
|
|
28
28
|
describe('testsGetDistanceToPreviousSymbol', () => {
|
|
29
29
|
testsGetDistanceToPreviousSymbol.forEach((test) => {
|
|
30
30
|
it(`returns ${test.expectedValue} for current cursor ${test.selectionStart} if pattern is ${test.pattern} and direction ${test.direction}`, () => {
|
|
31
|
-
expect(
|
|
32
|
-
|
|
33
|
-
)
|
|
31
|
+
expect(getDistanceToPreviousSymbol(test.selectionStart, test.pattern)).toStrictEqual(
|
|
32
|
+
test.expectedValue,
|
|
33
|
+
);
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
});
|
package/src/common/textFormat/getDistanceToSymbol/{getDistanceToSymbol.js → getDistanceToSymbol.ts}
RENAMED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import getSymbolsInPatternWithPosition from '../getSymbolsInPatternWithPosition';
|
|
2
|
+
import { SymbolWithPosition } from '../getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition';
|
|
2
3
|
|
|
3
|
-
export const getDistanceToNextSymbol = (selectionStart, pattern) => {
|
|
4
|
+
export const getDistanceToNextSymbol = (selectionStart: number, pattern: string) => {
|
|
4
5
|
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
5
6
|
const applicablePattern = patternArray.filter((symbol) => symbol.index >= selectionStart);
|
|
6
7
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'left');
|
|
7
8
|
};
|
|
8
9
|
|
|
9
|
-
export const getDistanceToPreviousSymbol = (selectionStart, pattern) => {
|
|
10
|
+
export const getDistanceToPreviousSymbol = (selectionStart: number, pattern: string) => {
|
|
10
11
|
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
11
12
|
const applicablePattern = patternArray
|
|
12
13
|
.filter((symbol) => symbol.index < selectionStart)
|
|
@@ -14,7 +15,11 @@ export const getDistanceToPreviousSymbol = (selectionStart, pattern) => {
|
|
|
14
15
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'right');
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
const countConsecutiveSymbols = (
|
|
18
|
+
const countConsecutiveSymbols = (
|
|
19
|
+
selectionStart: number,
|
|
20
|
+
applicablePattern: SymbolWithPosition[],
|
|
21
|
+
direction: 'left' | 'right',
|
|
22
|
+
) => {
|
|
18
23
|
let cursor = selectionStart;
|
|
19
24
|
let groupSize;
|
|
20
25
|
|
package/src/index.ts
CHANGED
|
@@ -22,7 +22,6 @@ export type {
|
|
|
22
22
|
} from './inputs/SelectInput';
|
|
23
23
|
export type { TextAreaProps } from './inputs/TextArea';
|
|
24
24
|
export type { PhoneNumberInputProps } from './phoneNumberInput/PhoneNumberInput';
|
|
25
|
-
export type { PopoverProps, PopoverPreferredPlacement } from './popover';
|
|
26
25
|
export type { RadioProps } from './radio';
|
|
27
26
|
export type { RadioGroupProps, RadioGroupRadio } from './radioGroup';
|
|
28
27
|
export type { RadioOptionProps } from './radioOption';
|
package/src/info/Info.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import { useIntl } from 'react-intl';
|
|
|
5
5
|
|
|
6
6
|
import { Size, Position, SizeSmall, SizeLarge } from '../common';
|
|
7
7
|
import Modal from '../modal';
|
|
8
|
-
import Popover
|
|
8
|
+
import Popover from '../popover';
|
|
9
9
|
|
|
10
10
|
import messages from './Info.messages';
|
|
11
11
|
import { InfoPresentation } from './infoPresentations';
|
|
@@ -36,7 +36,7 @@ export interface Props {
|
|
|
36
36
|
/**
|
|
37
37
|
* Prferred placement of the Popover, does not apply to Modal
|
|
38
38
|
*/
|
|
39
|
-
preferredPlacement?:
|
|
39
|
+
preferredPlacement?: Position;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const Info = ({
|
package/src/logo/Logo.js
CHANGED
|
@@ -5,6 +5,7 @@ exports[`Logo on mobile renders only fast flag 1`] = `
|
|
|
5
5
|
<span
|
|
6
6
|
aria-label="Wise"
|
|
7
7
|
class="class np-logo"
|
|
8
|
+
role="img"
|
|
8
9
|
>
|
|
9
10
|
<svg
|
|
10
11
|
class="np-logo-svg np-logo-svg--size-sm"
|
|
@@ -39,6 +40,7 @@ exports[`Logo renders wise business logo 1`] = `
|
|
|
39
40
|
<span
|
|
40
41
|
aria-label="Wise business"
|
|
41
42
|
class="class np-logo"
|
|
43
|
+
role="img"
|
|
42
44
|
>
|
|
43
45
|
<svg
|
|
44
46
|
class="np-logo-svg np-logo-svg--size-sm"
|
|
@@ -73,6 +75,7 @@ exports[`Logo renders wise business logo inversed 1`] = `
|
|
|
73
75
|
<span
|
|
74
76
|
aria-label="Wise business"
|
|
75
77
|
class="class np-logo"
|
|
78
|
+
role="img"
|
|
76
79
|
>
|
|
77
80
|
<svg
|
|
78
81
|
class="np-logo-svg np-logo-svg--size-sm"
|
|
@@ -107,6 +110,7 @@ exports[`Logo renders wise logo 1`] = `
|
|
|
107
110
|
<span
|
|
108
111
|
aria-label="Wise"
|
|
109
112
|
class="class np-logo"
|
|
113
|
+
role="img"
|
|
110
114
|
>
|
|
111
115
|
<svg
|
|
112
116
|
class="np-logo-svg np-logo-svg--size-sm"
|
|
@@ -141,6 +145,7 @@ exports[`Logo renders wise logo by default 1`] = `
|
|
|
141
145
|
<span
|
|
142
146
|
aria-label="Wise"
|
|
143
147
|
class="class np-logo"
|
|
148
|
+
role="img"
|
|
144
149
|
>
|
|
145
150
|
<svg
|
|
146
151
|
class="np-logo-svg np-logo-svg--size-sm"
|
|
@@ -175,6 +180,7 @@ exports[`Logo renders wise logo inversed 1`] = `
|
|
|
175
180
|
<span
|
|
176
181
|
aria-label="Wise"
|
|
177
182
|
class="class np-logo"
|
|
183
|
+
role="img"
|
|
178
184
|
>
|
|
179
185
|
<svg
|
|
180
186
|
class="np-logo-svg np-logo-svg--size-sm"
|
|
@@ -0,0 +1,101 @@
|
|
|
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;
|
|
@@ -7,7 +7,7 @@ mockMatchMedia();
|
|
|
7
7
|
|
|
8
8
|
jest.mock('react-transition-group', () => ({
|
|
9
9
|
__esModule: true,
|
|
10
|
-
CSSTransition: (props
|
|
10
|
+
CSSTransition: (props) => (props.in ? props.children : null),
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
13
|
describe('Popover', () => {
|
|
@@ -117,10 +117,7 @@ describe('Popover', () => {
|
|
|
117
117
|
expect(handleOnClose).not.toHaveBeenCalled();
|
|
118
118
|
userEvent.click(screen.getByText('Open'));
|
|
119
119
|
await waitForPanel();
|
|
120
|
-
|
|
121
|
-
if (dimmer != null) {
|
|
122
|
-
userEvent.click(dimmer);
|
|
123
|
-
}
|
|
120
|
+
userEvent.click(getDimmer());
|
|
124
121
|
expect(handleOnClose).toHaveBeenCalledTimes(1);
|
|
125
122
|
});
|
|
126
123
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Popover';
|