@transferwise/components 0.0.0-experimental-08de8b3 → 0.0.0-experimental-ab588f3
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/button/Button.js +4 -1
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.messages.js.map +1 -1
- package/build/button/Button.messages.mjs.map +1 -1
- package/build/button/Button.mjs +4 -1
- package/build/button/Button.mjs.map +1 -1
- package/build/button/classMap.js.map +1 -1
- package/build/button/classMap.mjs.map +1 -1
- package/build/button/legacyUtils/legacyUtils.js +5 -6
- package/build/button/legacyUtils/legacyUtils.js.map +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs +6 -7
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
- package/build/checkbox/Checkbox.js +1 -1
- package/build/checkbox/Checkbox.mjs +1 -1
- package/build/checkboxOption/CheckboxOption.js +1 -1
- package/build/checkboxOption/CheckboxOption.mjs +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/inputs/SelectInput.js +12 -3
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +12 -3
- package/build/inputs/SelectInput.mjs.map +1 -1
- package/build/stepper/deviceDetection.js +3 -2
- package/build/stepper/deviceDetection.js.map +1 -1
- package/build/stepper/deviceDetection.mjs +3 -2
- package/build/stepper/deviceDetection.mjs.map +1 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/Button.messages.d.ts +7 -7
- package/build/types/button/Button.messages.d.ts.map +1 -1
- package/build/types/button/classMap.d.ts +10 -10
- package/build/types/button/classMap.d.ts.map +1 -1
- package/build/types/button/legacyUtils/index.d.ts +1 -1
- package/build/types/button/legacyUtils/index.d.ts.map +1 -1
- package/build/types/button/legacyUtils/legacyUtils.d.ts +6 -20
- package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
- package/build/types/checkboxButton/index.d.ts +1 -1
- package/build/types/checkboxButton/index.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/stepper/deviceDetection.d.ts +1 -1
- package/build/types/stepper/deviceDetection.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/button/Button.tsx +3 -0
- package/src/button/legacyUtils/legacyUtils.js +54 -0
- package/src/flowNavigation/{FlowNavigation.story.tsx → FlowNavigation.story.js} +16 -34
- package/src/inputs/SelectInput.tsx +15 -8
- package/src/select/{Select.story.tsx → Select.story.js} +47 -97
- package/src/stepper/{deviceDetection.ts → deviceDetection.js} +6 -2
- package/src/button/legacyUtils/legacyUtils.ts +0 -74
- /package/src/button/{Button.messages.ts → Button.messages.js} +0 -0
- /package/src/button/{classMap.ts → classMap.js} +0 -0
- /package/src/button/legacyUtils/{index.ts → index.js} +0 -0
- /package/src/checkboxButton/{index.ts → index.js} +0 -0
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
function supportsTouchEvents() {
|
|
4
4
|
const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;
|
|
5
5
|
const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;
|
|
6
|
-
|
|
6
|
+
const documentTouchIsDefined = typeof window !== 'undefined' && window.DocumentTouch && document instanceof window.DocumentTouch;
|
|
7
|
+
return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);
|
|
7
8
|
}
|
|
8
9
|
function userAgentSuggestsTouchDevice() {
|
|
9
10
|
const sampleTouchDevices = ['android', 'iemobile', 'iphone', 'ipad', 'ipod', 'blackberry', 'bada'];
|
|
10
11
|
const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
|
|
11
12
|
const regex = new RegExp(matchString, 'gi');
|
|
12
|
-
return typeof navigator !== 'undefined' && !!
|
|
13
|
+
return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
|
|
13
14
|
}
|
|
14
15
|
// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.
|
|
15
16
|
// Only use this for small vanity changes where it still works either way.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceDetection.js","sources":["../../src/stepper/deviceDetection.
|
|
1
|
+
{"version":3,"file":"deviceDetection.js","sources":["../../src/stepper/deviceDetection.js"],"sourcesContent":["function supportsTouchEvents() {\n const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;\n const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;\n const documentTouchIsDefined =\n typeof window !== 'undefined' &&\n window.DocumentTouch &&\n document instanceof window.DocumentTouch;\n\n return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);\n}\n\nfunction userAgentSuggestsTouchDevice() {\n const sampleTouchDevices = [\n 'android',\n 'iemobile',\n 'iphone',\n 'ipad',\n 'ipod',\n 'blackberry',\n 'bada',\n ];\n const matchString = sampleTouchDevices.map((device) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);\n}\n// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.\n// Only use this for small vanity changes where it still works either way.\nexport function isTouchDevice() {\n return supportsTouchEvents() || userAgentSuggestsTouchDevice();\n}\n"],"names":["supportsTouchEvents","onTouchStartIsDefined","window","ontouchstart","undefined","maxTouchPointsIsDefined","navigator","maxTouchPoints","documentTouchIsDefined","DocumentTouch","document","userAgentSuggestsTouchDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","userAgent","match","isTouchDevice"],"mappings":";;AAAA,SAASA,mBAAmBA,GAAG;EAC7B,MAAMC,qBAAqB,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,YAAY,KAAKC,SAAS,CAAA;EAChG,MAAMC,uBAAuB,GAAG,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,cAAc,CAAA;AAC5F,EAAA,MAAMC,sBAAsB,GAC1B,OAAON,MAAM,KAAK,WAAW,IAC7BA,MAAM,CAACO,aAAa,IACpBC,QAAQ,YAAYR,MAAM,CAACO,aAAa,CAAA;AAE1C,EAAA,OAAO,CAAC,EAAER,qBAAqB,IAAII,uBAAuB,IAAIG,sBAAsB,CAAC,CAAA;AACvF,CAAA;AAEA,SAASG,4BAA4BA,GAAG;AACtC,EAAA,MAAMC,kBAAkB,GAAG,CACzB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,YAAY,EACZ,MAAM,CACP,CAAA;AACD,EAAA,MAAMC,WAAW,GAAGD,kBAAkB,CAACE,GAAG,CAAEC,MAAM,IAAK,CAAIA,CAAAA,EAAAA,MAAM,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;EAC/E,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,WAAW,EAAE,IAAI,CAAC,CAAA;AAC3C,EAAA,OAAO,OAAOP,SAAS,KAAK,WAAW,IAAI,CAAC,CAACA,SAAS,CAACa,SAAS,CAACC,KAAK,CAACH,KAAK,CAAC,CAAA;AAC/E,CAAA;AACA;AACA;AACO,SAASI,aAAaA,GAAG;AAC9B,EAAA,OAAOrB,mBAAmB,EAAE,IAAIW,4BAA4B,EAAE,CAAA;AAChE;;;;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
function supportsTouchEvents() {
|
|
2
2
|
const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;
|
|
3
3
|
const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;
|
|
4
|
-
|
|
4
|
+
const documentTouchIsDefined = typeof window !== 'undefined' && window.DocumentTouch && document instanceof window.DocumentTouch;
|
|
5
|
+
return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);
|
|
5
6
|
}
|
|
6
7
|
function userAgentSuggestsTouchDevice() {
|
|
7
8
|
const sampleTouchDevices = ['android', 'iemobile', 'iphone', 'ipad', 'ipod', 'blackberry', 'bada'];
|
|
8
9
|
const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
|
|
9
10
|
const regex = new RegExp(matchString, 'gi');
|
|
10
|
-
return typeof navigator !== 'undefined' && !!
|
|
11
|
+
return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
|
|
11
12
|
}
|
|
12
13
|
// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.
|
|
13
14
|
// Only use this for small vanity changes where it still works either way.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceDetection.mjs","sources":["../../src/stepper/deviceDetection.
|
|
1
|
+
{"version":3,"file":"deviceDetection.mjs","sources":["../../src/stepper/deviceDetection.js"],"sourcesContent":["function supportsTouchEvents() {\n const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;\n const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;\n const documentTouchIsDefined =\n typeof window !== 'undefined' &&\n window.DocumentTouch &&\n document instanceof window.DocumentTouch;\n\n return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);\n}\n\nfunction userAgentSuggestsTouchDevice() {\n const sampleTouchDevices = [\n 'android',\n 'iemobile',\n 'iphone',\n 'ipad',\n 'ipod',\n 'blackberry',\n 'bada',\n ];\n const matchString = sampleTouchDevices.map((device) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);\n}\n// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.\n// Only use this for small vanity changes where it still works either way.\nexport function isTouchDevice() {\n return supportsTouchEvents() || userAgentSuggestsTouchDevice();\n}\n"],"names":["supportsTouchEvents","onTouchStartIsDefined","window","ontouchstart","undefined","maxTouchPointsIsDefined","navigator","maxTouchPoints","documentTouchIsDefined","DocumentTouch","document","userAgentSuggestsTouchDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","userAgent","match","isTouchDevice"],"mappings":"AAAA,SAASA,mBAAm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EF,eAAe,MAAM,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
declare
|
|
2
|
-
loadingAriaLabel
|
|
3
|
-
id: string;
|
|
4
|
-
defaultMessage: string;
|
|
5
|
-
description: string;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
namespace loadingAriaLabel {
|
|
3
|
+
let id: string;
|
|
4
|
+
let defaultMessage: string;
|
|
5
|
+
let description: string;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
8
|
export default _default;
|
|
9
9
|
//# sourceMappingURL=Button.messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.messages.d.ts","sourceRoot":"","sources":["../../../src/button/Button.messages.
|
|
1
|
+
{"version":3,"file":"Button.messages.d.ts","sourceRoot":"","sources":["../../../src/button/Button.messages.js"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
accent: string;
|
|
3
|
-
positive: string;
|
|
4
|
-
negative: string;
|
|
5
|
-
}
|
|
6
|
-
export
|
|
7
|
-
primary: string;
|
|
8
|
-
secondary: string;
|
|
9
|
-
tertiary: string;
|
|
10
|
-
}
|
|
1
|
+
export namespace typeClassMap {
|
|
2
|
+
let accent: string;
|
|
3
|
+
let positive: string;
|
|
4
|
+
let negative: string;
|
|
5
|
+
}
|
|
6
|
+
export namespace priorityClassMap {
|
|
7
|
+
let primary: string;
|
|
8
|
+
let secondary: string;
|
|
9
|
+
let tertiary: string;
|
|
10
|
+
}
|
|
11
11
|
//# sourceMappingURL=classMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classMap.d.ts","sourceRoot":"","sources":["../../../src/button/classMap.
|
|
1
|
+
{"version":3,"file":"classMap.d.ts","sourceRoot":"","sources":["../../../src/button/classMap.js"],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { establishNewPriority, establishNewType, logDeprecationNotices } from
|
|
1
|
+
export { establishNewPriority, establishNewType, logDeprecationNotices } from "./legacyUtils";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/button/legacyUtils/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/button/legacyUtils/index.js"],"names":[],"mappings":""}
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
primary: string;
|
|
8
|
-
secondary: string;
|
|
9
|
-
};
|
|
10
|
-
type EstablishNewTypeType = (originalType: Type | (string & Record<never, never>) | null) => `${ControlType}` | string | null;
|
|
11
|
-
export declare const establishNewType: EstablishNewTypeType;
|
|
12
|
-
type EstablishNewPriorityType = (originalPriority?: Priority | (string & Record<never, never>) | null, originalType?: OldTypeKeys | (string & Record<never, never>) | null) => `${ControlType}` | string | null | undefined;
|
|
13
|
-
export declare const establishNewPriority: EstablishNewPriorityType;
|
|
14
|
-
type DeprecatedTypeMapMessageType = keyof typeof deprecatedTypeMapMessage;
|
|
15
|
-
type LogDeprecationNoticesType = (params: {
|
|
16
|
-
size: `${Size}`;
|
|
17
|
-
type: DeprecatedTypeMapMessageType | (string & Record<never, never>) | null;
|
|
18
|
-
}) => void;
|
|
19
|
-
export declare const logDeprecationNotices: LogDeprecationNoticesType;
|
|
20
|
-
export {};
|
|
1
|
+
export function establishNewType(originalType: any): any;
|
|
2
|
+
export function establishNewPriority(originalPriority: any, originalType: any): any;
|
|
3
|
+
export function logDeprecationNotices({ size, type }: {
|
|
4
|
+
size: any;
|
|
5
|
+
type: any;
|
|
6
|
+
}): void;
|
|
21
7
|
//# sourceMappingURL=legacyUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacyUtils.d.ts","sourceRoot":"","sources":["../../../../src/button/legacyUtils/legacyUtils.
|
|
1
|
+
{"version":3,"file":"legacyUtils.d.ts","sourceRoot":"","sources":["../../../../src/button/legacyUtils/legacyUtils.js"],"names":[],"mappings":"AA2BO,yDAA0F;AAE1F,oFAaN;AAEM;;;SASN"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from "./CheckboxButton";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/checkboxButton/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/checkboxButton/index.js"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../src/inputs/SelectInput.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC,OAAO,EAAsB,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAyB1E,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,MAAM;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,CAAC,CAAC;IACT,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,MAAM;IAC9C,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,MAAM,IAClC,qBAAqB,CAAC,CAAC,CAAC,GACxB,oBAAoB,CAAC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CAAC,CAAA;CAAE,CAAC,CAAC;AAEzD,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,mCAAmC,GAAG,QAAQ,EAAE,EACjG,EAAkB,EAClB,GAAG,SAAS,EACb,EAAE,6BAA6B,CAAC,CAAC,CAAC,+BAclC;AAoaD,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,wBAAgB,wBAAwB,CAAC,EACvC,KAAK,EACL,IAAI,EACJ,WAAW,EACX,IAAI,GACL,EAAE,6BAA6B,+BAiD/B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function isTouchDevice(): boolean;
|
|
2
2
|
//# sourceMappingURL=deviceDetection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceDetection.d.ts","sourceRoot":"","sources":["../../../src/stepper/deviceDetection.
|
|
1
|
+
{"version":3,"file":"deviceDetection.d.ts","sourceRoot":"","sources":["../../../src/stepper/deviceDetection.js"],"names":[],"mappings":"AA2BA,yCAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-ab588f3",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
"rollup-preserve-directives": "^1.1.1",
|
|
93
93
|
"storybook": "^8.2.2",
|
|
94
94
|
"@transferwise/less-config": "3.1.0",
|
|
95
|
-
"@
|
|
96
|
-
"@
|
|
95
|
+
"@transferwise/neptune-css": "14.19.0",
|
|
96
|
+
"@wise/components-theming": "1.6.0"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"@transferwise/icons": "^3.13.1",
|
package/src/button/Button.tsx
CHANGED
|
@@ -72,9 +72,12 @@ const Button = forwardRef<ButtonReferenceType, Props>(
|
|
|
72
72
|
) => {
|
|
73
73
|
const intl = useIntl();
|
|
74
74
|
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
75
76
|
logDeprecationNotices({ size, type });
|
|
76
77
|
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
77
79
|
const newType = establishNewType(type);
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
78
81
|
const newPriority = establishNewPriority(priority, type);
|
|
79
82
|
|
|
80
83
|
const classes = clsx(
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ControlType, Priority, Size, Type } from '../../common';
|
|
2
|
+
import { logActionRequiredIf } from '../../utilities';
|
|
3
|
+
|
|
4
|
+
const deprecatedTypeMap = {
|
|
5
|
+
[Type.PRIMARY]: ControlType.ACCENT,
|
|
6
|
+
[Type.SECONDARY]: ControlType.ACCENT,
|
|
7
|
+
[Type.LINK]: ControlType.ACCENT,
|
|
8
|
+
[Type.PAY]: ControlType.POSITIVE,
|
|
9
|
+
[Type.DANGER]: ControlType.NEGATIVE,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const oldTypePriorityMap = {
|
|
13
|
+
[Type.DANGER]: Priority.SECONDARY,
|
|
14
|
+
[Type.LINK]: Priority.TERTIARY,
|
|
15
|
+
[Type.SECONDARY]: Priority.SECONDARY,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const deprecatedTypeMapMessage = {
|
|
19
|
+
[Type.DANGER]: 'Type.NEGATIVE',
|
|
20
|
+
[Type.LINK]: 'ControlType.ACCENT with priority Priority.TERTIARY',
|
|
21
|
+
[Type.PAY]: 'ControlType.POSITIVE',
|
|
22
|
+
[Type.PRIMARY]: 'ControlType.ACCENT',
|
|
23
|
+
[Type.SECONDARY]: 'ControlType.ACCENT with priority Priority.SECONDARY',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const deprecatedTypes = Object.keys(deprecatedTypeMap);
|
|
27
|
+
|
|
28
|
+
export const establishNewType = (originalType) => deprecatedTypeMap[originalType] || originalType;
|
|
29
|
+
|
|
30
|
+
export const establishNewPriority = (originalPriority, originalType) => {
|
|
31
|
+
const type = establishNewType(originalType);
|
|
32
|
+
|
|
33
|
+
// The old SECONDARY and LINK types now map to priorities. If they're still using one of
|
|
34
|
+
// these old types, ignore whatever priority they've passed and use this instead.
|
|
35
|
+
if (oldTypePriorityMap[originalType]) {
|
|
36
|
+
return oldTypePriorityMap[originalType];
|
|
37
|
+
}
|
|
38
|
+
// Only ControlType.ACCENT supports tertiary styles
|
|
39
|
+
if (originalPriority === Priority.TERTIARY && type !== ControlType.ACCENT) {
|
|
40
|
+
return Priority.SECONDARY;
|
|
41
|
+
}
|
|
42
|
+
return originalPriority;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const logDeprecationNotices = ({ size, type }) => {
|
|
46
|
+
logActionRequiredIf(
|
|
47
|
+
'Button has deprecated the `Size.EXTRA_SMALL` value for the `size` prop. Please use Size.SMALL instead.',
|
|
48
|
+
size === Size.EXTRA_SMALL,
|
|
49
|
+
);
|
|
50
|
+
logActionRequiredIf(
|
|
51
|
+
`Button has deprecated the ${type} value for the \`type\` prop. Please update to ${deprecatedTypeMapMessage[type]}.`,
|
|
52
|
+
deprecatedTypes.includes(type),
|
|
53
|
+
);
|
|
54
|
+
};
|
|
@@ -24,10 +24,6 @@ const avatarProfiles = {
|
|
|
24
24
|
Business: <BriefcaseIcon />,
|
|
25
25
|
Profile: <ProfileIcon />,
|
|
26
26
|
};
|
|
27
|
-
type ProfileTypeKeys = keyof typeof ProfileType;
|
|
28
|
-
|
|
29
|
-
const getAvatarProfile = (showAvatar: string) =>
|
|
30
|
-
showAvatar in avatarProfiles ? avatarProfiles[showAvatar as keyof typeof avatarProfiles] : null;
|
|
31
27
|
|
|
32
28
|
export const Variants = () => {
|
|
33
29
|
const [activeStep, setActiveStep] = useState(2);
|
|
@@ -36,11 +32,7 @@ export const Variants = () => {
|
|
|
36
32
|
const showCloseButton = boolean('show closeButton', true);
|
|
37
33
|
const showMobileBackButton = boolean('show mobile backButton', true);
|
|
38
34
|
const done = boolean('done', false);
|
|
39
|
-
const profileType
|
|
40
|
-
'profileType',
|
|
41
|
-
Object.keys(ProfileType) as ProfileTypeKeys[],
|
|
42
|
-
undefined,
|
|
43
|
-
);
|
|
35
|
+
const profileType = select('profileType', Object.keys(ProfileType));
|
|
44
36
|
const avatarURL = text(
|
|
45
37
|
'avatarURL',
|
|
46
38
|
'https://wise.com/web-art/assets/illustrations/heart-small@2x.webp',
|
|
@@ -52,7 +44,7 @@ export const Variants = () => {
|
|
|
52
44
|
avatar={
|
|
53
45
|
!showAvatar ? null : (
|
|
54
46
|
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
55
|
-
{
|
|
47
|
+
{avatarProfiles[showAvatar]}
|
|
56
48
|
</Avatar>
|
|
57
49
|
)
|
|
58
50
|
}
|
|
@@ -78,11 +70,9 @@ export const Variants = () => {
|
|
|
78
70
|
onClick: () => setActiveStep(4),
|
|
79
71
|
},
|
|
80
72
|
]}
|
|
81
|
-
onClose={showCloseButton
|
|
73
|
+
onClose={showCloseButton && (() => setClosed(true))}
|
|
82
74
|
onGoBack={
|
|
83
|
-
showMobileBackButton
|
|
84
|
-
? () => setActiveStep(activeStep > 0 ? activeStep - 1 : 0)
|
|
85
|
-
: undefined
|
|
75
|
+
showMobileBackButton && (() => setActiveStep(activeStep > 0 ? activeStep - 1 : 0))
|
|
86
76
|
}
|
|
87
77
|
/>
|
|
88
78
|
|
|
@@ -122,11 +112,9 @@ export const Variants = () => {
|
|
|
122
112
|
onClick: () => setActiveStep(4),
|
|
123
113
|
},
|
|
124
114
|
]}
|
|
125
|
-
onClose={showCloseButton
|
|
115
|
+
onClose={showCloseButton && (() => setClosed(true))}
|
|
126
116
|
onGoBack={
|
|
127
|
-
showMobileBackButton
|
|
128
|
-
? () => setActiveStep(activeStep - 1 > 0 ? activeStep - 1 : 0)
|
|
129
|
-
: undefined
|
|
117
|
+
showMobileBackButton && (() => setActiveStep(activeStep - 1 > 0 ? activeStep - 1 : 0))
|
|
130
118
|
}
|
|
131
119
|
/>
|
|
132
120
|
|
|
@@ -167,11 +155,9 @@ export const Variants = () => {
|
|
|
167
155
|
onClick: () => setActiveStep(4),
|
|
168
156
|
},
|
|
169
157
|
]}
|
|
170
|
-
onClose={showCloseButton
|
|
158
|
+
onClose={showCloseButton && (() => setClosed(true))}
|
|
171
159
|
onGoBack={
|
|
172
|
-
showMobileBackButton
|
|
173
|
-
? () => setActiveStep(activeStep - 1 > 0 ? activeStep - 1 : 0)
|
|
174
|
-
: undefined
|
|
160
|
+
showMobileBackButton && (() => setActiveStep(activeStep - 1 > 0 ? activeStep - 1 : 0))
|
|
175
161
|
}
|
|
176
162
|
/>
|
|
177
163
|
|
|
@@ -185,11 +171,9 @@ export const Variants = () => {
|
|
|
185
171
|
{ label: 'Review', hoverLabel: 'Antonio Dozortevo', onClick: () => setActiveStep(1) },
|
|
186
172
|
{ label: 'Pay', hoverLabel: 'Enrico Gusso', onClick: () => setActiveStep(2) },
|
|
187
173
|
]}
|
|
188
|
-
onClose={showCloseButton
|
|
174
|
+
onClose={showCloseButton && (() => setClosed(true))}
|
|
189
175
|
onGoBack={
|
|
190
|
-
showMobileBackButton
|
|
191
|
-
? () => setActiveStep(activeStep - 1 > 0 ? activeStep - 1 : 0)
|
|
192
|
-
: undefined
|
|
176
|
+
showMobileBackButton && (() => setActiveStep(activeStep - 1 > 0 ? activeStep - 1 : 0))
|
|
193
177
|
}
|
|
194
178
|
/>
|
|
195
179
|
|
|
@@ -232,7 +216,7 @@ export const SendFlow = () => {
|
|
|
232
216
|
...(activeStep > 3 && { onClick: handleStepClick(3) }),
|
|
233
217
|
},
|
|
234
218
|
];
|
|
235
|
-
function handleStepClick(step
|
|
219
|
+
function handleStepClick(step) {
|
|
236
220
|
return () => {
|
|
237
221
|
setActiveStep(step);
|
|
238
222
|
};
|
|
@@ -284,18 +268,16 @@ export const WithOverlayHeaderComparison = () => {
|
|
|
284
268
|
avatar={
|
|
285
269
|
showAvatar ? (
|
|
286
270
|
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
287
|
-
{
|
|
271
|
+
{avatarProfiles[showAvatar]}
|
|
288
272
|
</Avatar>
|
|
289
273
|
) : null
|
|
290
274
|
}
|
|
291
275
|
activeStep={activeStep}
|
|
292
276
|
done={done}
|
|
293
277
|
steps={[]}
|
|
294
|
-
onClose={showCloseButton
|
|
278
|
+
onClose={showCloseButton && (() => setClosed(true))}
|
|
295
279
|
onGoBack={
|
|
296
|
-
showMobileBackButton
|
|
297
|
-
? () => setActiveStep(activeStep > 0 ? activeStep - 1 : 0)
|
|
298
|
-
: undefined
|
|
280
|
+
showMobileBackButton && (() => setActiveStep(activeStep > 0 ? activeStep - 1 : 0))
|
|
299
281
|
}
|
|
300
282
|
/>
|
|
301
283
|
</div>
|
|
@@ -304,11 +286,11 @@ export const WithOverlayHeaderComparison = () => {
|
|
|
304
286
|
avatar={
|
|
305
287
|
showAvatar ? (
|
|
306
288
|
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
307
|
-
{
|
|
289
|
+
{avatarProfiles[showAvatar]}
|
|
308
290
|
</Avatar>
|
|
309
291
|
) : null
|
|
310
292
|
}
|
|
311
|
-
onClose={showCloseButton
|
|
293
|
+
onClose={showCloseButton && (() => setClosed(true))}
|
|
312
294
|
/>
|
|
313
295
|
</div>
|
|
314
296
|
</>
|
|
@@ -546,8 +546,8 @@ function SelectInputOptions<T = string>({
|
|
|
546
546
|
listBoxLabelledBy,
|
|
547
547
|
}: SelectInputOptionsProps<T>) {
|
|
548
548
|
const intl = useIntl();
|
|
549
|
-
|
|
550
549
|
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
550
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
551
551
|
|
|
552
552
|
const needle = useMemo(() => {
|
|
553
553
|
if (filterable) {
|
|
@@ -555,8 +555,9 @@ function SelectInputOptions<T = string>({
|
|
|
555
555
|
}
|
|
556
556
|
return undefined;
|
|
557
557
|
}, [filterQuery, filterable]);
|
|
558
|
+
|
|
558
559
|
useEffect(() => {
|
|
559
|
-
if (needle) {
|
|
560
|
+
if (needle && !filterable) {
|
|
560
561
|
// Ensure having an active option while filtering.
|
|
561
562
|
// Without `requestAnimationFrame` upon which React depends for scheduling
|
|
562
563
|
// updates, the active status would only show for a split second and then
|
|
@@ -573,7 +574,13 @@ function SelectInputOptions<T = string>({
|
|
|
573
574
|
}
|
|
574
575
|
});
|
|
575
576
|
}
|
|
576
|
-
}, [controllerRef, needle]);
|
|
577
|
+
}, [controllerRef, needle, filterable]);
|
|
578
|
+
|
|
579
|
+
useEffect(() => {
|
|
580
|
+
if (isOpen && filterable && searchInputRef.current) {
|
|
581
|
+
searchInputRef.current.focus();
|
|
582
|
+
}
|
|
583
|
+
}, [isOpen, filterable, searchInputRef]);
|
|
577
584
|
|
|
578
585
|
const filteredItems: readonly SelectInputItem<NonNullable<T> | undefined>[] =
|
|
579
586
|
needle != null
|
|
@@ -581,8 +588,8 @@ function SelectInputOptions<T = string>({
|
|
|
581
588
|
selectInputOptionItemIncludesNeedle(item, needle),
|
|
582
589
|
)
|
|
583
590
|
: items;
|
|
584
|
-
const resultsEmpty = needle != null && filteredItems.length === 0;
|
|
585
591
|
|
|
592
|
+
const resultsEmpty = needle != null && filteredItems.length === 0;
|
|
586
593
|
const virtualized = filteredItems.length > MAX_ITEMS_WITHOUT_VIRTUALIZATION;
|
|
587
594
|
|
|
588
595
|
// Items shown once shall be kept mounted until the needle changes, otherwise
|
|
@@ -635,13 +642,16 @@ function SelectInputOptions<T = string>({
|
|
|
635
642
|
className="np-select-input-options-container"
|
|
636
643
|
onAriaActiveDescendantChange={(value: React.AriaAttributes['aria-activedescendant']) => {
|
|
637
644
|
if (controllerRef.current != null) {
|
|
638
|
-
if (value != null) {
|
|
645
|
+
if (value != null && isOpen) {
|
|
639
646
|
controllerRef.current.setAttribute('aria-activedescendant', value);
|
|
640
647
|
} else {
|
|
641
648
|
controllerRef.current.removeAttribute('aria-activedescendant');
|
|
642
649
|
}
|
|
643
650
|
}
|
|
644
651
|
}}
|
|
652
|
+
onChange={(value) => {
|
|
653
|
+
setIsOpen(value != null);
|
|
654
|
+
}}
|
|
645
655
|
>
|
|
646
656
|
{filterable ? (
|
|
647
657
|
<div className="np-select-input-query-container">
|
|
@@ -673,7 +683,6 @@ function SelectInputOptions<T = string>({
|
|
|
673
683
|
/>
|
|
674
684
|
</div>
|
|
675
685
|
) : null}
|
|
676
|
-
|
|
677
686
|
<section
|
|
678
687
|
ref={listboxContainerRef}
|
|
679
688
|
tabIndex={-1}
|
|
@@ -691,7 +700,6 @@ function SelectInputOptions<T = string>({
|
|
|
691
700
|
{intl.formatMessage(messages.noResultsFound)}
|
|
692
701
|
</div>
|
|
693
702
|
) : null}
|
|
694
|
-
|
|
695
703
|
<div
|
|
696
704
|
ref={listboxRef}
|
|
697
705
|
id={listboxId}
|
|
@@ -732,7 +740,6 @@ function SelectInputOptions<T = string>({
|
|
|
732
740
|
</Virtualizer>
|
|
733
741
|
)}
|
|
734
742
|
</div>
|
|
735
|
-
|
|
736
743
|
{renderFooter != null ? (
|
|
737
744
|
<footer className="np-select-input-footer">
|
|
738
745
|
<div
|