@transferwise/components 46.5.0 → 46.6.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 (48) hide show
  1. package/build/i18n/th.json +3 -3
  2. package/build/index.esm.js +67 -123
  3. package/build/index.esm.js.map +1 -1
  4. package/build/index.js +68 -124
  5. package/build/index.js.map +1 -1
  6. package/build/types/common/textFormat/formatWithPattern/formatWithPattern.d.ts +1 -1
  7. package/build/types/common/textFormat/formatWithPattern/formatWithPattern.d.ts.map +1 -1
  8. package/build/types/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.d.ts +2 -2
  9. package/build/types/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.d.ts.map +1 -1
  10. package/build/types/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.d.ts +5 -1
  11. package/build/types/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.d.ts.map +1 -1
  12. package/build/types/common/textFormat/unformatWithPattern/unformatWithPattern.d.ts +1 -1
  13. package/build/types/common/textFormat/unformatWithPattern/unformatWithPattern.d.ts.map +1 -1
  14. package/build/types/index.d.ts +2 -0
  15. package/build/types/index.d.ts.map +1 -1
  16. package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts +7 -11
  17. package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts.map +1 -1
  18. package/build/types/inputWithDisplayFormat/index.d.ts +2 -1
  19. package/build/types/inputWithDisplayFormat/index.d.ts.map +1 -1
  20. package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts +7 -11
  21. package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts.map +1 -1
  22. package/build/types/textareaWithDisplayFormat/index.d.ts +2 -1
  23. package/build/types/textareaWithDisplayFormat/index.d.ts.map +1 -1
  24. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts +55 -83
  25. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
  26. package/build/types/withDisplayFormat/index.d.ts +2 -1
  27. package/build/types/withDisplayFormat/index.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/src/common/textFormat/formatWithPattern/{formatWithPattern.js → formatWithPattern.ts} +8 -4
  30. package/src/common/textFormat/getCursorPositionAfterKeystroke/{getCursorPositionAfterKeystroke.js → getCursorPositionAfterKeystroke.ts} +8 -8
  31. package/src/common/textFormat/getSymbolsInPatternWithPosition/{getSymbolsInPatternWithPosition.js → getSymbolsInPatternWithPosition.ts} +7 -2
  32. package/src/common/textFormat/unformatWithPattern/{unformatWithPattern.js → unformatWithPattern.ts} +3 -2
  33. package/src/i18n/th.json +3 -3
  34. package/src/index.ts +2 -0
  35. package/src/inputWithDisplayFormat/InputWithDisplayFormat.tsx +10 -0
  36. package/src/inputWithDisplayFormat/index.ts +2 -0
  37. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.spec.js +3 -1
  38. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +32 -0
  39. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.tsx +13 -0
  40. package/src/textareaWithDisplayFormat/index.ts +2 -0
  41. package/src/withDisplayFormat/WithDisplayFormat.spec.js +1 -1
  42. package/src/withDisplayFormat/{WithDisplayFormat.js → WithDisplayFormat.tsx} +127 -107
  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,3 @@
1
- export default getCursorPositionAfteractionstroke;
2
- declare function getCursorPositionAfteractionstroke(action: any, selectionStart: any, selectionEnd: any, pattern: any, pastedLength: any): any;
1
+ declare const getCursorPositionAfterActionStroke: (action: string, selectionStart: number, selectionEnd: number, pattern: string, pastedLength: number) => number;
2
+ export default getCursorPositionAfterActionStroke;
3
3
  //# 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":"AAGA,QAAA,MAAM,kCAAkC,WAC9B,MAAM,kBACE,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,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;A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BAAgB,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,7 @@
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 WithDisplayFormatProps } from '../withDisplayFormat';
3
+ export interface InputWithDisplayFormatProps extends Omit<WithDisplayFormatProps, 'render'> {
4
+ }
5
+ declare const InputWithDisplayFormat: (props: InputWithDisplayFormatProps) => import("react").JSX.Element;
6
+ export default InputWithDisplayFormat;
7
+ //# 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,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC;CAAG;AAE9F,QAAA,MAAM,sBAAsB,UAAW,2BAA2B,gCAEjE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -1,2 +1,3 @@
1
- export { default } from "./InputWithDisplayFormat";
1
+ export { default } from './InputWithDisplayFormat';
2
+ export type { InputWithDisplayFormatProps } from './InputWithDisplayFormat';
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,2BAA2B,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,11 +1,7 @@
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 WithDisplayFormatProps } from '../withDisplayFormat';
3
+ export interface TextareaWithDisplayFormatProps extends Omit<WithDisplayFormatProps, 'render'> {
4
+ }
5
+ declare const TextareaWithDisplayFormat: (props: TextareaWithDisplayFormatProps) => import("react").JSX.Element;
6
+ export default TextareaWithDisplayFormat;
7
+ //# 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,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,MAAM,WAAW,8BAA+B,SAAQ,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC;CAAG;AAEjG,QAAA,MAAM,yBAAyB,UAAW,8BAA8B,gCAKvE,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
@@ -1,2 +1,3 @@
1
- export { default } from "./TextareaWithDisplayFormat";
1
+ export { default } from './TextareaWithDisplayFormat';
2
+ export type { TextareaWithDisplayFormatProps } from './TextareaWithDisplayFormat';
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,8BAA8B,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,90 +1,62 @@
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 } from 'react';
2
+ import { HistoryNavigator } from '../common';
3
+ import { InputProps } from '../inputs/Input';
4
+ import { TextAreaProps } from '../inputs/TextArea';
5
+ type HTMLTextElement = HTMLInputElement | HTMLTextAreaElement;
6
+ type TextElementProps = InputProps | TextAreaProps;
7
+ export type EventType = 'KeyDown' | 'Paste' | 'Cut' | 'Undo' | 'Redo' | 'Backspace' | 'Delete' | 'Initial';
8
+ interface WithDisplayFormatState {
9
+ value: string;
10
+ historyNavigator: HistoryNavigator;
11
+ prevDisplayPattern: string;
12
+ triggerType: EventType;
13
+ triggerEvent: React.KeyboardEvent<HTMLTextElement> | null;
14
+ pastedLength: number;
15
+ selectionStart: number;
16
+ selectionEnd: number;
17
+ }
18
+ export interface WithDisplayFormatProps<T extends TextElementProps = TextElementProps> extends Pick<TextElementProps, 'className' | 'disabled' | 'id' | 'maxLength' | 'minLength' | 'name' | 'placeholder' | 'readOnly' | 'required' | 'inputMode'> {
19
+ value?: string;
20
+ displayPattern: string;
21
+ /**
22
+ * autocomplete hides our form help so we need to disable it when help text
23
+ * is present. Chrome ignores autocomplete=off, the only way to disable it is
24
+ * to provide an 'invalid' value, for which 'disabled' serves.
25
+ */
26
+ autoComplete?: TextElementProps['autoComplete'] | 'disabled';
27
+ onChange?: (value: string) => void;
28
+ onBlur?: (value: string) => void;
29
+ onFocus?: (value: string) => void;
30
+ render: (renderProps: T) => JSX.Element;
31
+ }
32
+ declare class WithDisplayFormat<T extends TextElementProps> extends Component<WithDisplayFormatProps<T>, WithDisplayFormatState> {
33
+ props: WithDisplayFormatProps<T> & Required<Pick<WithDisplayFormatProps<T>, keyof typeof WithDisplayFormat.defaultProps>>;
34
+ static defaultProps: {
35
+ autoComplete: string;
36
+ displayPattern: string;
37
+ value: string;
38
+ };
39
+ constructor(props: WithDisplayFormatProps);
40
+ static getDerivedStateFromProps({ displayPattern }: WithDisplayFormatProps, { prevDisplayPattern, value, historyNavigator }: WithDisplayFormatState): {
41
+ prevDisplayPattern: string;
42
+ value: string;
6
43
  triggerType: null;
7
44
  triggerEvent: null;
8
45
  pastedLength: number;
9
46
  } | 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;
47
+ getUserAction: (unformattedValue: string) => EventType | string;
19
48
  resetEvent: () => void;
20
- detectUndoRedo: (event: any) => "Redo" | "Undo" | null;
21
- handleOnKeyDown: (event: any) => void;
22
- handleOnPaste: (event: any) => void;
23
- 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;
49
+ detectUndoRedo: (event: React.KeyboardEvent<HTMLTextElement>) => "Undo" | "Redo" | null;
50
+ handleOnKeyDown: React.KeyboardEventHandler<HTMLTextElement>;
51
+ handleOnPaste: React.ClipboardEventHandler<HTMLTextElement>;
52
+ handleOnCut: React.ClipboardEventHandler<HTMLTextElement>;
53
+ isKeyAllowed: (action: EventType | string) => boolean;
54
+ handleOnChange: React.ChangeEventHandler<HTMLTextElement>;
55
+ handleOnBlur: React.FocusEventHandler<HTMLTextElement>;
56
+ handleOnFocus: React.FocusEventHandler<HTMLTextElement>;
57
+ handleDelete: (unformattedValue: string, action: EventType) => string;
58
+ handleCursorPositioning: (action: string) => void;
59
+ render(): JSX.Element;
31
60
  }
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
- }
87
- }
88
- import { Component } from "react";
89
- import { HistoryNavigator } from "../common";
61
+ export default WithDisplayFormat;
90
62
  //# 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":3,"file":"WithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/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MrD;IAEF,YAAY,qBAAsB,MAAM,UAAU,SAAS,YAuBzD;IAEF,uBAAuB,WAAY,MAAM,UAkBvC;IAEF,MAAM;CAqCP;AAED,eAAe,iBAAiB,CAAC"}
@@ -1,2 +1,3 @@
1
- export { default } from "./WithDisplayFormat";
1
+ export { default } from './WithDisplayFormat';
2
+ export type { WithDisplayFormatProps } 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,sBAAsB,EAAE,MAAM,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.5.0",
3
+ "version": "46.6.0",
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,13 @@
1
1
  import getCountOfSymbolsInSelection from '../getCountOfSymbolsInSelection';
2
2
  import { getDistanceToNextSymbol, getDistanceToPreviousSymbol } from '../getDistanceToSymbol';
3
3
 
4
- const getCursorPositionAfteractionstroke = (
5
- action,
6
- selectionStart,
7
- selectionEnd,
8
- pattern,
9
- pastedLength,
10
- ) => {
4
+ const getCursorPositionAfterActionStroke = (
5
+ action: string,
6
+ selectionStart: number,
7
+ selectionEnd: number,
8
+ pattern: string,
9
+ pastedLength: number,
10
+ ): number => {
11
11
  let cursorPosition = selectionStart;
12
12
 
13
13
  switch (action) {
@@ -38,4 +38,4 @@ const getCursorPositionAfteractionstroke = (
38
38
  return cursorPosition;
39
39
  };
40
40
 
41
- export default getCursorPositionAfteractionstroke;
41
+ export default getCursorPositionAfterActionStroke;
@@ -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/i18n/th.json CHANGED
@@ -9,16 +9,16 @@
9
9
  "neptune.DateInput.year.label": "ปี",
10
10
  "neptune.DateInput.year.placeholder": "YYYY",
11
11
  "neptune.DateLookup.day": "วัน",
12
- "neptune.DateLookup.goTo20YearView": "Go to 20 year view",
12
+ "neptune.DateLookup.goTo20YearView": "ไปที่มุมมอง 20 ปี",
13
13
  "neptune.DateLookup.month": "เดือน",
14
14
  "neptune.DateLookup.next": "ถัดไป",
15
15
  "neptune.DateLookup.previous": "ก่อนหน้า",
16
16
  "neptune.DateLookup.selected": "เลือกแล้ว",
17
17
  "neptune.DateLookup.twentyYears": "20 ปี",
18
18
  "neptune.DateLookup.year": "ปี",
19
- "neptune.FlowNavigation.back": "back to previous step",
19
+ "neptune.FlowNavigation.back": "กลับไปที่ขั้นก่อนหน้า",
20
20
  "neptune.Info.ariaLabel": "ข้อมูลเพิ่มเติม",
21
- "neptune.Link.opensInNewTab": "(opens in new tab)",
21
+ "neptune.Link.opensInNewTab": "(เปิดในแท็บใหม่)",
22
22
  "neptune.MoneyInput.Select.placeholder": "เลือกตัวเลือก...",
23
23
  "neptune.Select.searchPlaceholder": "ค้นหา...",
24
24
  "neptune.SelectInput.noResultsFound": "ไม่พบผลลัพธ์",
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,10 @@
1
+ import { Input, type InputProps } from '../inputs/Input';
2
+ import WithDisplayFormat, { type WithDisplayFormatProps } from '../withDisplayFormat';
3
+
4
+ export interface InputWithDisplayFormatProps extends Omit<WithDisplayFormatProps, 'render'> {}
5
+
6
+ const InputWithDisplayFormat = (props: InputWithDisplayFormatProps) => (
7
+ <WithDisplayFormat<InputProps> {...props} render={(renderProps) => <Input {...renderProps} />} />
8
+ );
9
+
10
+ export default InputWithDisplayFormat;
@@ -0,0 +1,2 @@
1
+ export { default } from './InputWithDisplayFormat';
2
+ export type { InputWithDisplayFormatProps } from './InputWithDisplayFormat';
@@ -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,13 @@
1
+ import { TextArea, type TextAreaProps } from '../inputs/TextArea';
2
+ import WithDisplayFormat, { type WithDisplayFormatProps } from '../withDisplayFormat';
3
+
4
+ export interface TextareaWithDisplayFormatProps extends Omit<WithDisplayFormatProps, 'render'> {}
5
+
6
+ const TextareaWithDisplayFormat = (props: TextareaWithDisplayFormatProps) => (
7
+ <WithDisplayFormat<TextAreaProps>
8
+ {...props}
9
+ render={(renderProps) => <TextArea {...renderProps} />}
10
+ />
11
+ );
12
+
13
+ export default TextareaWithDisplayFormat;
@@ -0,0 +1,2 @@
1
+ export { default } from './TextareaWithDisplayFormat';
2
+ export type { TextareaWithDisplayFormatProps } from './TextareaWithDisplayFormat';
@@ -145,7 +145,7 @@ describe('InputWithTextFormat', () => {
145
145
  });
146
146
 
147
147
  describe('set cursor position', () => {
148
- const triggerEventA = { ...triggerEvent, target: { setSelectionRange: () => {} } };
148
+ const triggerEventA = { ...triggerEvent, currentTarget: { setSelectionRange: () => {} } };
149
149
  beforeEach(() => {
150
150
  component.setState({
151
151
  triggerEvent: triggerEventA,