@transferwise/components 0.0.0-experimental-1f8ed05 → 0.0.0-experimental-d0bd4b4

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 (48) hide show
  1. package/build/index.esm.js +53 -109
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +54 -110
  4. package/build/index.js.map +1 -1
  5. package/build/types/common/textFormat/formatWithPattern/formatWithPattern.d.ts +1 -1
  6. package/build/types/common/textFormat/formatWithPattern/formatWithPattern.d.ts.map +1 -1
  7. package/build/types/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.d.ts +2 -1
  8. package/build/types/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.d.ts.map +1 -1
  9. package/build/types/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.d.ts +5 -1
  10. package/build/types/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.d.ts.map +1 -1
  11. package/build/types/common/textFormat/unformatWithPattern/unformatWithPattern.d.ts +1 -1
  12. package/build/types/common/textFormat/unformatWithPattern/unformatWithPattern.d.ts.map +1 -1
  13. package/build/types/index.d.ts +2 -0
  14. package/build/types/index.d.ts.map +1 -1
  15. package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts +5 -11
  16. package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts.map +1 -1
  17. package/build/types/inputWithDisplayFormat/index.d.ts +2 -1
  18. package/build/types/inputWithDisplayFormat/index.d.ts.map +1 -1
  19. package/build/types/inputs/Input.d.ts +8 -6
  20. package/build/types/inputs/Input.d.ts.map +1 -1
  21. package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts +5 -11
  22. package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts.map +1 -1
  23. package/build/types/textareaWithDisplayFormat/index.d.ts +2 -1
  24. package/build/types/textareaWithDisplayFormat/index.d.ts.map +1 -1
  25. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts +55 -82
  26. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
  27. package/build/types/withDisplayFormat/index.d.ts +2 -1
  28. package/build/types/withDisplayFormat/index.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/common/textFormat/formatWithPattern/{formatWithPattern.js → formatWithPattern.ts} +8 -4
  31. package/src/common/textFormat/getCursorPositionAfterKeystroke/{getCursorPositionAfterKeystroke.js → getCursorPositionAfterKeystroke.ts} +7 -6
  32. package/src/common/textFormat/getSymbolsInPatternWithPosition/{getSymbolsInPatternWithPosition.js → getSymbolsInPatternWithPosition.ts} +7 -2
  33. package/src/common/textFormat/unformatWithPattern/{unformatWithPattern.js → unformatWithPattern.ts} +3 -2
  34. package/src/index.ts +2 -0
  35. package/src/inputWithDisplayFormat/InputWithDisplayFormat.tsx +11 -0
  36. package/src/inputWithDisplayFormat/index.ts +2 -0
  37. package/src/inputs/Input.tsx +6 -11
  38. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.spec.js +3 -1
  39. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +32 -0
  40. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.tsx +11 -0
  41. package/src/textareaWithDisplayFormat/index.ts +2 -0
  42. package/src/withDisplayFormat/{WithDisplayFormat.js → WithDisplayFormat.tsx} +111 -104
  43. package/src/withDisplayFormat/index.ts +2 -0
  44. package/src/inputWithDisplayFormat/InputWithDisplayFormat.js +0 -14
  45. package/src/inputWithDisplayFormat/index.js +0 -1
  46. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.js +0 -14
  47. package/src/textareaWithDisplayFormat/index.js +0 -1
  48. package/src/withDisplayFormat/index.js +0 -1
@@ -1,3 +1,3 @@
1
+ declare const formatWithPattern: (value: string, pattern: string) => string;
1
2
  export default formatWithPattern;
2
- declare function formatWithPattern(value: any, pattern: any): any;
3
3
  //# sourceMappingURL=formatWithPattern.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatWithPattern.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/formatWithPattern/formatWithPattern.js"],"names":[],"mappings":";AAEA,kEAoBC"}
1
+ {"version":3,"file":"formatWithPattern.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/formatWithPattern/formatWithPattern.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,iBAAiB,UAAW,MAAM,WAAW,MAAM,KAAG,MAuB3D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { EventType } from '../../../withDisplayFormat/WithDisplayFormat';
2
+ declare const getCursorPositionAfteractionstroke: (action: EventType, selectionStart: number, selectionEnd: number, pattern: string, pastedLength: number) => number;
1
3
  export default getCursorPositionAfteractionstroke;
2
- declare function getCursorPositionAfteractionstroke(action: any, selectionStart: any, selectionEnd: any, pattern: any, pastedLength: any): any;
3
4
  //# sourceMappingURL=getCursorPositionAfterKeystroke.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCursorPositionAfterKeystroke.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.js"],"names":[],"mappings":";AAGA,+IAmCC"}
1
+ {"version":3,"file":"getCursorPositionAfterKeystroke.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AAI9E,QAAA,MAAM,kCAAkC,WAC9B,SAAS,kBACD,MAAM,gBACR,MAAM,WACX,MAAM,gBACD,MAAM,KACnB,MA6BF,CAAC;AAEF,eAAe,kCAAkC,CAAC"}
@@ -1,3 +1,7 @@
1
+ export type SymbolWithPosition = {
2
+ index: number;
3
+ symbol: string;
4
+ };
5
+ declare const getSymbolsInPatternWithPosition: (pattern: string) => SymbolWithPosition[];
1
6
  export default getSymbolsInPatternWithPosition;
2
- declare function getSymbolsInPatternWithPosition(pattern: any): any[];
3
7
  //# sourceMappingURL=getSymbolsInPatternWithPosition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getSymbolsInPatternWithPosition.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.js"],"names":[],"mappings":";AAAA,sEAUC"}
1
+ {"version":3,"file":"getSymbolsInPatternWithPosition.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,QAAA,MAAM,+BAA+B,YAAa,MAAM,KAAG,kBAAkB,EAU5E,CAAC;AAEF,eAAe,+BAA+B,CAAC"}
@@ -1,3 +1,3 @@
1
+ declare const unformatWithPattern: (value: string, pattern: string) => string;
1
2
  export default unformatWithPattern;
2
- declare function unformatWithPattern(value: any, pattern: any): string;
3
3
  //# sourceMappingURL=unformatWithPattern.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unformatWithPattern.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/unformatWithPattern/unformatWithPattern.js"],"names":[],"mappings":";AAAA,uEAQC"}
1
+ {"version":3,"file":"unformatWithPattern.d.ts","sourceRoot":"","sources":["../../../../../src/common/textFormat/unformatWithPattern/unformatWithPattern.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,mBAAmB,UAAW,MAAM,WAAW,MAAM,KAAG,MAQ7D,CAAC;AAKF,eAAe,mBAAmB,CAAC"}
@@ -2,10 +2,12 @@
2
2
  * Types
3
3
  */
4
4
  export type { InputProps } from './inputs/Input';
5
+ export type { InputWithDisplayFormatProps } from './inputWithDisplayFormat';
5
6
  export type { InputGroupProps } from './inputs/InputGroup';
6
7
  export type { SearchInputProps } from './inputs/SearchInput';
7
8
  export type { SelectInputGroupItem, SelectInputItem, SelectInputOptionContentProps, SelectInputOptionItem, SelectInputProps, SelectInputSeparatorItem, SelectInputTriggerButtonProps, } from './inputs/SelectInput';
8
9
  export type { TextAreaProps } from './inputs/TextArea';
10
+ export type { TextareaWithDisplayFormatProps } from './textareaWithDisplayFormat';
9
11
  export type { UploadedFile, UploadError, UploadResponse } from './uploadInput/types';
10
12
  export type { ModalProps } from './modal';
11
13
  export type { CurrencyHeaderItem, CurrencyItem, CurrencyOptionItem, MoneyInputProps, } from './moneyInput';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,6BAA6B,EAC7B,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrF,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,eAAe,EACf,eAAe,EACf,UAAU,EACV,SAAS,EACT,SAAS,EACT,YAAY,GACb,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAA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,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,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,11 +1,5 @@
1
- import * as React from 'react';
2
-
3
- export interface InputWithDisplayFormatProps {
4
- displayPattern: string;
5
- onChange: (...args: any[])=>any;
6
- }
7
-
8
- declare const InputWithDisplayFormat: React.FC<InputWithDisplayFormatProps>;
9
-
10
- export default InputWithDisplayFormat;
11
-
1
+ /// <reference types="react" />
2
+ import { type TextInputProps } from '../withDisplayFormat';
3
+ declare const InputWithDisplayFormat: (props: TextInputProps) => import("react").JSX.Element;
4
+ export default InputWithDisplayFormat;
5
+ //# sourceMappingURL=InputWithDisplayFormat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InputWithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/inputWithDisplayFormat/InputWithDisplayFormat.js"],"names":[],"mappings":";AAIA,iFAEC"}
1
+ {"version":3,"file":"InputWithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/inputWithDisplayFormat/InputWithDisplayFormat.tsx"],"names":[],"mappings":";AACA,OAA0B,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE9E,QAAA,MAAM,sBAAsB,UAAW,cAAc,gCAKpD,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -1,2 +1,3 @@
1
- export { default } from "./InputWithDisplayFormat";
1
+ export { default } from './InputWithDisplayFormat';
2
+ export type { TextInputProps as InputWithDisplayFormatProps } from '../withDisplayFormat';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/inputWithDisplayFormat/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/inputWithDisplayFormat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,YAAY,EAAE,cAAc,IAAI,2BAA2B,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,11 +1,13 @@
1
- /// <reference types="react" />
1
+ import { InputHTMLAttributes } from 'react';
2
2
  import { SizeLarge, SizeMedium, SizeSmall } from '../common';
3
- import { Merge } from '../utils';
4
- export interface InputProps extends Merge<React.ComponentPropsWithRef<'input'>, {
3
+ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & {
5
4
  size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;
6
5
  shape?: 'rectangle' | 'pill';
7
6
  'aria-invalid'?: boolean;
8
- }> {
9
- }
10
- export declare const Input: import("react").ForwardRefExoticComponent<Omit<InputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
7
+ };
8
+ export declare const Input: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "size"> & {
9
+ size?: "auto" | "sm" | "md" | "lg" | undefined;
10
+ shape?: "rectangle" | "pill" | undefined;
11
+ 'aria-invalid'?: boolean | undefined;
12
+ } & import("react").RefAttributes<HTMLInputElement>>;
11
13
  //# sourceMappingURL=Input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/inputs/Input.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC,MAAM,WAAW,UACf,SAAQ,KAAK,CACX,KAAK,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACpC;IACE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IACnD,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CACF;CAAG;AAEN,eAAO,MAAM,KAAK,sHAkBhB,CAAC"}
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/inputs/Input.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAc,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAK7D,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,GAAG;IAC7E,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IACnD,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,KAAK;;;;oDAkBhB,CAAC"}
@@ -1,11 +1,5 @@
1
- import * as React from 'react';
2
-
3
- export interface TextareaWithDisplayFormatProps {
4
- displayPattern: string;
5
- onChange: (...args: any[])=>any;
6
- }
7
-
8
- declare const TextareaWithDisplayFormat: React.FC<TextareaWithDisplayFormatProps>;
9
-
10
- export default TextareaWithDisplayFormat;
11
-
1
+ /// <reference types="react" />
2
+ import { type TextInputProps } from '../withDisplayFormat';
3
+ declare const TextareaWithDisplayFormat: (props: TextInputProps) => import("react").JSX.Element;
4
+ export default TextareaWithDisplayFormat;
5
+ //# sourceMappingURL=TextareaWithDisplayFormat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextareaWithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/TextareaWithDisplayFormat.js"],"names":[],"mappings":";AAIA,oFAEC"}
1
+ {"version":3,"file":"TextareaWithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/TextareaWithDisplayFormat.tsx"],"names":[],"mappings":";AACA,OAA0B,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE9E,QAAA,MAAM,yBAAyB,UAAW,cAAc,gCAKvD,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
@@ -1,2 +1,3 @@
1
- export { default } from "./TextareaWithDisplayFormat";
1
+ export { default } from './TextareaWithDisplayFormat';
2
+ export type { TextInputProps as TextareaWithDisplayFormatProps } from '../withDisplayFormat';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,YAAY,EAAE,cAAc,IAAI,8BAA8B,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,90 +1,63 @@
1
- export default WithDisplayFormat;
2
- declare class WithDisplayFormat extends Component<any, any, any> {
3
- static getDerivedStateFromProps(nextProps: any, previousState: any): {
4
- prevDisplayPattern: any;
5
- value: any;
1
+ import { Component, KeyboardEvent, ClipboardEvent, ChangeEvent, FocusEvent } from 'react';
2
+ import { HistoryNavigator } from '../common';
3
+ import { InputProps } from '../inputs/Input';
4
+ import { TextAreaProps } from '../inputs/TextArea';
5
+ import { Merge } from '../utils';
6
+ export type TextInputProps = Merge<InputProps, {
7
+ value?: string;
8
+ displayPattern: string;
9
+ /**
10
+ * autocomplete hides our form help so we need to disable it when help text
11
+ * is present. Chrome ignores autocomplete=off, the only way to disable it is
12
+ * to provide an 'invalid' value, for which 'disabled' serves.
13
+ */
14
+ autoComplete?: InputProps['autoComplete'] | 'disabled';
15
+ onChange?: (value: string) => void;
16
+ onBlur?: (value: string) => void;
17
+ onFocus?: (value: string) => void;
18
+ }>;
19
+ export type Props = typeof WithDisplayFormat.defaultProps & {
20
+ render: (renderProps: InputProps | TextAreaProps) => JSX.Element;
21
+ } & TextInputProps;
22
+ export type EventType = 'KeyDown' | 'Paste' | 'Cut' | 'Undo' | 'Redo' | 'Backspace' | 'Delete' | null;
23
+ type State = {
24
+ value: string;
25
+ historyNavigator: HistoryNavigator;
26
+ prevDisplayPattern?: string;
27
+ triggerType?: EventType;
28
+ triggerEvent?: KeyboardEvent<HTMLInputElement> | null;
29
+ pastedLength?: number;
30
+ selectionStart?: HTMLInputElement['selectionStart'];
31
+ selectionEnd?: HTMLInputElement['selectionEnd'];
32
+ };
33
+ declare class WithDisplayFormat extends Component<Props, State> {
34
+ static defaultProps: {
35
+ autoComplete: string;
36
+ displayPattern: string;
37
+ type: string;
38
+ value: string;
39
+ };
40
+ constructor(props: Props);
41
+ static getDerivedStateFromProps({ displayPattern }: Props, { prevDisplayPattern, value, historyNavigator }: State): {
42
+ prevDisplayPattern: string;
43
+ value: string;
6
44
  triggerType: null;
7
45
  triggerEvent: null;
8
46
  pastedLength: number;
9
47
  } | null;
10
- constructor(props: any);
11
- state: {
12
- value: any;
13
- historyNavigator: HistoryNavigator;
14
- prevDisplayPattern: any;
15
- triggerType: null;
16
- triggerEvent: null;
17
- };
18
- getUserAction: (unformattedValue: any) => any;
48
+ getUserAction: (unformattedValue: string) => EventType;
19
49
  resetEvent: () => void;
20
- detectUndoRedo: (event: any) => "Redo" | "Undo" | null;
21
- handleOnKeyDown: (event: any) => void;
22
- handleOnPaste: (event: any) => void;
50
+ detectUndoRedo: (event: KeyboardEvent<HTMLInputElement>) => "Undo" | "Redo" | null;
51
+ handleOnKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
52
+ handleOnPaste: (event: ClipboardEvent<HTMLInputElement>) => void;
23
53
  handleOnCut: () => void;
24
- isKeyAllowed: (action: any) => boolean;
25
- handleOnChange: (event: any) => void;
26
- handleOnBlur: (event: any) => void;
27
- handleOnFocus: (event: any) => void;
28
- handleDelete: (unformattedValue: any, action: any) => string;
29
- handleCursorPositioning: (action: any) => void;
30
- render(): any;
31
- }
32
- declare namespace WithDisplayFormat {
33
- namespace propTypes {
34
- const autoComplete: any;
35
- const className: any;
36
- const disabled: any;
37
- const id: any;
38
- const maxLength: any;
39
- const minLength: any;
40
- const name: any;
41
- const onFocus: any;
42
- const onBlur: any;
43
- const onChange: any;
44
- const placeholder: any;
45
- const readOnly: any;
46
- const render: any;
47
- const required: any;
48
- const displayPattern: any;
49
- const type: any;
50
- const inputMode: any;
51
- const value: any;
52
- }
53
- namespace defaultProps {
54
- const autoComplete_1: string;
55
- export { autoComplete_1 as autoComplete };
56
- const className_1: null;
57
- export { className_1 as className };
58
- const disabled_1: boolean;
59
- export { disabled_1 as disabled };
60
- const id_1: null;
61
- export { id_1 as id };
62
- const maxLength_1: null;
63
- export { maxLength_1 as maxLength };
64
- const minLength_1: null;
65
- export { minLength_1 as minLength };
66
- const name_1: null;
67
- export { name_1 as name };
68
- const placeholder_1: null;
69
- export { placeholder_1 as placeholder };
70
- const readOnly_1: boolean;
71
- export { readOnly_1 as readOnly };
72
- const required_1: boolean;
73
- export { required_1 as required };
74
- const displayPattern_1: string;
75
- export { displayPattern_1 as displayPattern };
76
- const type_1: string;
77
- export { type_1 as type };
78
- const inputMode_1: null;
79
- export { inputMode_1 as inputMode };
80
- const value_1: string;
81
- export { value_1 as value };
82
- const onFocus_1: null;
83
- export { onFocus_1 as onFocus };
84
- const onBlur_1: null;
85
- export { onBlur_1 as onBlur };
86
- }
54
+ isKeyAllowed: (action: EventType) => boolean;
55
+ handleOnChange: (event: ChangeEvent<HTMLInputElement>) => void;
56
+ handleOnBlur: (event: FocusEvent<HTMLInputElement>) => void;
57
+ handleOnFocus: (event: FocusEvent<HTMLInputElement>) => void;
58
+ handleDelete: (unformattedValue: string, action: EventType) => string;
59
+ handleCursorPositioning: (action: EventType) => void;
60
+ render(): JSX.Element;
87
61
  }
88
- import { Component } from "react";
89
- import { HistoryNavigator } from "../common";
62
+ export default WithDisplayFormat;
90
63
  //# sourceMappingURL=WithDisplayFormat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/WithDisplayFormat.js"],"names":[],"mappings":";AAaA;IAcE;;;;;;aAkBC;IA/BD,wBAWC;IAPC;;;;;;MAMC;IAuBH,8CA0BE;IAEF,uBAME;IAEF,uDAME;IAEF,sCAuBE;IAEF,oCAQE;IAEF,wBAEE;IAEF,uCAKE;IAEF,qCA0BE;IAEF,mCAKE;IAEF,oCAME;IAEF,6DAuBE;IAEF,+CAkBE;IAEF,cAsCC;CACF"}
1
+ {"version":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,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACpD,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACjD,CAAC;AAEF,cAAM,iBAAkB,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IACrD,MAAM,CAAC,YAAY;;;;;MAKjB;gBAEU,KAAK,EAAE,KAAK;IAYxB,MAAM,CAAC,wBAAwB,CAC7B,EAAE,cAAc,EAAE,EAAE,KAAK,EACzB,EAAE,kBAAmC,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,KAAK;;;;;;;IAiBzE,aAAa,qBAAsB,MAAM,KAAG,SAAS,CA+BnD;IAEF,UAAU,aAMR;IAEF,cAAc,UAAW,cAAc,gBAAgB,CAAC,4BAMtD;IAEF,eAAe,UAAW,cAAc,gBAAgB,CAAC,UAuBvD;IAEF,aAAa,UAAW,eAAe,gBAAgB,CAAC,UAQtD;IAEF,WAAW,aAET;IAEF,YAAY,WAAY,SAAS,aAK/B;IAEF,cAAc,UAAW,YAAY,gBAAgB,CAAC,UA0BpD;IAEF,YAAY,UAAW,WAAW,gBAAgB,CAAC,UAEjD;IAEF,aAAa,UAAW,WAAW,gBAAgB,CAAC,UAMlD;IAEF,YAAY,qBAAsB,MAAM,UAAU,SAAS,YAwBzD;IAEF,uBAAuB,WAAY,SAAS,UAkB1C;IAEF,MAAM;CAuCP;AAED,eAAe,iBAAiB,CAAC"}
@@ -1,2 +1,3 @@
1
- export { default } from "./WithDisplayFormat";
1
+ export { default } from './WithDisplayFormat';
2
+ export type { Props as WithDisplayFormatProps, TextInputProps } from './WithDisplayFormat';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,YAAY,EAAE,KAAK,IAAI,sBAAsB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-1f8ed05",
3
+ "version": "0.0.0-experimental-d0bd4b4",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,6 +1,7 @@
1
1
  import getSymbolsInPatternWithPosition from '../getSymbolsInPatternWithPosition';
2
+ import type { SymbolWithPosition } from '../getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition';
2
3
 
3
- const formatWithPattern = (value, pattern) => {
4
+ const formatWithPattern = (value: string, pattern: string): string => {
4
5
  if (!value || value === '') {
5
6
  return '';
6
7
  }
@@ -9,13 +10,16 @@ const formatWithPattern = (value, pattern) => {
9
10
 
10
11
  const patternWithSymbolsPosition = getSymbolsInPatternWithPosition(pattern);
11
12
 
12
- let patternSymbol = [];
13
+ let patternSymbol: SymbolWithPosition[] = [];
13
14
  // valueArray.length increments during the cycle cause we are adding new elements.
14
15
  for (let index = 0; index < valueArray.length; index += 1) {
15
- patternSymbol = patternWithSymbolsPosition.filter((symbol) => symbol.index === index);
16
+ patternSymbol = patternWithSymbolsPosition.filter((pattern) => pattern.index === index);
16
17
  // Add pattern's symbol at n position
17
18
  if (patternSymbol.length === 1) {
18
- valueArray.splice(index, 0, patternSymbol.pop().symbol);
19
+ const last = patternSymbol.pop();
20
+ if (last) {
21
+ valueArray.splice(index, 0, last.symbol);
22
+ }
19
23
  }
20
24
  }
21
25
 
@@ -1,13 +1,14 @@
1
+ import type { EventType } from '../../../withDisplayFormat/WithDisplayFormat';
1
2
  import getCountOfSymbolsInSelection from '../getCountOfSymbolsInSelection';
2
3
  import { getDistanceToNextSymbol, getDistanceToPreviousSymbol } from '../getDistanceToSymbol';
3
4
 
4
5
  const getCursorPositionAfteractionstroke = (
5
- action,
6
- selectionStart,
7
- selectionEnd,
8
- pattern,
9
- pastedLength,
10
- ) => {
6
+ action: EventType,
7
+ selectionStart: number,
8
+ selectionEnd: number,
9
+ pattern: string,
10
+ pastedLength: number,
11
+ ): number => {
11
12
  let cursorPosition = selectionStart;
12
13
 
13
14
  switch (action) {
@@ -1,5 +1,10 @@
1
- const getSymbolsInPatternWithPosition = (pattern) => {
2
- const patternWithSymbolsPosition = [];
1
+ export type SymbolWithPosition = {
2
+ index: number;
3
+ symbol: string;
4
+ };
5
+
6
+ const getSymbolsInPatternWithPosition = (pattern: string): SymbolWithPosition[] => {
7
+ const patternWithSymbolsPosition: SymbolWithPosition[] = [];
3
8
  const patternArray = pattern.split('');
4
9
  patternArray.forEach((symbol, index) => {
5
10
  if (symbol !== '*') {
@@ -1,4 +1,4 @@
1
- const unformatWithPattern = (value, pattern) => {
1
+ const unformatWithPattern = (value: string, pattern: string): string => {
2
2
  let valueArray = [''];
3
3
  if (value && value.length > 0) {
4
4
  valueArray = value.toString().split('');
@@ -8,6 +8,7 @@ const unformatWithPattern = (value, pattern) => {
8
8
  return valueArray.join('');
9
9
  };
10
10
 
11
- const getSymbolsInPattern = (pattern) => pattern.split('').filter((symbol) => symbol !== '*');
11
+ const getSymbolsInPattern = (pattern: string): string[] =>
12
+ pattern.split('').filter((symbol) => symbol !== '*');
12
13
 
13
14
  export default unformatWithPattern;
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * Types
3
3
  */
4
4
  export type { InputProps } from './inputs/Input';
5
+ export type { InputWithDisplayFormatProps } from './inputWithDisplayFormat';
5
6
  export type { InputGroupProps } from './inputs/InputGroup';
6
7
  export type { SearchInputProps } from './inputs/SearchInput';
7
8
  export type {
@@ -14,6 +15,7 @@ export type {
14
15
  SelectInputTriggerButtonProps,
15
16
  } from './inputs/SelectInput';
16
17
  export type { TextAreaProps } from './inputs/TextArea';
18
+ export type { TextareaWithDisplayFormatProps } from './textareaWithDisplayFormat';
17
19
  export type { UploadedFile, UploadError, UploadResponse } from './uploadInput/types';
18
20
  export type { ModalProps } from './modal';
19
21
  export type {
@@ -0,0 +1,11 @@
1
+ import { Input, type InputProps } from '../inputs/Input';
2
+ import WithDisplayFormat, { type TextInputProps } from '../withDisplayFormat';
3
+
4
+ const InputWithDisplayFormat = (props: TextInputProps) => (
5
+ <WithDisplayFormat
6
+ {...props}
7
+ render={(renderProps) => <Input {...(renderProps as InputProps)} />}
8
+ />
9
+ );
10
+
11
+ export default InputWithDisplayFormat;
@@ -0,0 +1,2 @@
1
+ export { default } from './InputWithDisplayFormat';
2
+ export type { TextInputProps as InputWithDisplayFormatProps } from '../withDisplayFormat';
@@ -1,21 +1,16 @@
1
1
  import classNames from 'classnames';
2
- import { forwardRef } from 'react';
2
+ import { InputHTMLAttributes, forwardRef } from 'react';
3
3
 
4
4
  import { SizeLarge, SizeMedium, SizeSmall } from '../common';
5
- import { Merge } from '../utils';
6
5
 
7
6
  import { useInputPaddings } from './InputGroup';
8
7
  import { formControlClassNameBase } from './_common';
9
8
 
10
- export interface InputProps
11
- extends Merge<
12
- React.ComponentPropsWithRef<'input'>,
13
- {
14
- size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;
15
- shape?: 'rectangle' | 'pill';
16
- 'aria-invalid'?: boolean;
17
- }
18
- > {}
9
+ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & {
10
+ size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;
11
+ shape?: 'rectangle' | 'pill';
12
+ 'aria-invalid'?: boolean;
13
+ };
19
14
 
20
15
  export const Input = forwardRef(function Input(
21
16
  { size = 'auto', shape = 'rectangle', className, ...restProps }: InputProps,
@@ -1,5 +1,7 @@
1
1
  import { shallow } from 'enzyme';
2
2
 
3
+ import { TextArea } from '../inputs/TextArea';
4
+
3
5
  import TextareaWithDisplayFormat from '.';
4
6
 
5
7
  describe('TextareaWithDisplayFormat', () => {
@@ -10,6 +12,6 @@ describe('TextareaWithDisplayFormat', () => {
10
12
  .find('WithDisplayFormat')
11
13
  .renderProp('render')({ value: 'test' });
12
14
 
13
- expect(view.find('textarea').props('value')).toStrictEqual({ value: 'test' });
15
+ expect(view.find(TextArea).props('value')).toStrictEqual({ value: 'test' });
14
16
  });
15
17
  });
@@ -0,0 +1,32 @@
1
+ import { StoryObj } from '@storybook/react';
2
+
3
+ import { userEvent, within } from '../test-utils';
4
+
5
+ import TextareaWithDisplayFormat from './TextareaWithDisplayFormat';
6
+
7
+ export default {
8
+ component: TextareaWithDisplayFormat,
9
+ title: 'Forms/TextareaWithDisplayFormat',
10
+ };
11
+
12
+ type Story = StoryObj<typeof TextareaWithDisplayFormat>;
13
+
14
+ export const Basic: Story = {
15
+ render: (args) => {
16
+ return (
17
+ <>
18
+ <TextareaWithDisplayFormat
19
+ value="0000"
20
+ displayPattern="**** - **** - ****"
21
+ onChange={console.log}
22
+ />
23
+ </>
24
+ );
25
+ },
26
+ // intentionally use interactive typing (over init value via `value` prop)
27
+ // to trigger event handlers in the component
28
+ play: ({ canvasElement }) => {
29
+ const canvas = within(canvasElement);
30
+ userEvent.type(canvas.getByRole('textbox'), '111122223333');
31
+ },
32
+ };
@@ -0,0 +1,11 @@
1
+ import { TextArea, type TextAreaProps } from '../inputs/TextArea';
2
+ import WithDisplayFormat, { type TextInputProps } from '../withDisplayFormat';
3
+
4
+ const TextareaWithDisplayFormat = (props: TextInputProps) => (
5
+ <WithDisplayFormat
6
+ {...props}
7
+ render={(renderProps) => <TextArea {...(renderProps as TextAreaProps)} />}
8
+ />
9
+ );
10
+
11
+ export default TextareaWithDisplayFormat;
@@ -0,0 +1,2 @@
1
+ export { default } from './TextareaWithDisplayFormat';
2
+ export type { TextInputProps as TextareaWithDisplayFormatProps } from '../withDisplayFormat';