@transferwise/components 0.0.0-experimental-680afef → 0.0.0-experimental-c8fc1dc
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 +19 -11
- package/build/index.esm.js.map +1 -1
- package/build/index.js +19 -11
- package/build/index.js.map +1 -1
- package/build/types/instructionsList/InstructionsList.d.ts +4 -2
- package/build/types/instructionsList/InstructionsList.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/instructionsList/InstructionList.story.tsx +1 -0
- package/src/instructionsList/InstructionsList.tsx +41 -12
|
@@ -4,13 +4,15 @@ type InstructionNode = {
|
|
|
4
4
|
content: ReactNode;
|
|
5
5
|
['aria-label']: string;
|
|
6
6
|
};
|
|
7
|
-
type Props = CommonProps &
|
|
7
|
+
type Props = CommonProps & {
|
|
8
|
+
overrideCircleFillIcons?: boolean;
|
|
9
|
+
} & ({
|
|
8
10
|
dos?: ReactNode[];
|
|
9
11
|
donts?: ReactNode[];
|
|
10
12
|
} | {
|
|
11
13
|
dos?: InstructionNode[];
|
|
12
14
|
donts?: InstructionNode[];
|
|
13
15
|
});
|
|
14
|
-
declare const InstructionsList: ({ dos, donts }: Props) => import("react").JSX.Element;
|
|
16
|
+
declare const InstructionsList: ({ dos, donts, overrideCircleFillIcons }: Props) => import("react").JSX.Element;
|
|
15
17
|
export default InstructionsList;
|
|
16
18
|
//# sourceMappingURL=InstructionsList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstructionsList.d.ts","sourceRoot":"","sources":["../../../src/instructionsList/InstructionsList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InstructionsList.d.ts","sourceRoot":"","sources":["../../../src/instructionsList/InstructionsList.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAkB,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAc,WAAW,EAAE,MAAM,WAAW,CAAC;AAEpD,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,SAAS,CAAC;IACnB,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,KAAK,KAAK,GAAG,WAAW,GAAG;IAAE,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,CAC7D;IACE,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB,GACD;IACE,GAAG,CAAC,EAAE,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;CAC3B,CACJ,CAAC;AAEJ,QAAA,MAAM,gBAAgB,4CAAqD,KAAK,gCAyB/E,CAAC;AAoCF,eAAe,gBAAgB,CAAC"}
|
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-c8fc1dc",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
"storybook": "^7.4.5",
|
|
78
78
|
"@transferwise/less-config": "3.1.0",
|
|
79
79
|
"@transferwise/neptune-css": "14.9.5",
|
|
80
|
-
"@wise/components-theming": "0.0.0-experimental-
|
|
80
|
+
"@wise/components-theming": "0.0.0-experimental-c8fc1dc"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"@transferwise/icons": "^3.7.0",
|
|
84
84
|
"@transferwise/neptune-css": "^14.9.5",
|
|
85
85
|
"@wise/art": "^2.7.0",
|
|
86
|
-
"@wise/components-theming": "0.0.0-experimental-
|
|
86
|
+
"@wise/components-theming": "0.0.0-experimental-c8fc1dc",
|
|
87
87
|
"react": ">=16.14",
|
|
88
88
|
"react-dom": ">=16.14",
|
|
89
89
|
"react-intl": "^5.10.0 || ^6"
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { boolean } from '@storybook/addon-knobs';
|
|
2
|
+
import {
|
|
3
|
+
CrossCircleFill as DontCheckCircleIcon,
|
|
4
|
+
CheckCircleFill as DoCheckCircleIcon,
|
|
5
|
+
Cross as DontCrossIcon,
|
|
6
|
+
Check as DoCheckIcon,
|
|
7
|
+
} from '@transferwise/icons';
|
|
2
8
|
import { ReactNode, isValidElement } from 'react';
|
|
3
9
|
|
|
4
10
|
import Body from '../body/Body';
|
|
@@ -9,8 +15,7 @@ type InstructionNode = {
|
|
|
9
15
|
['aria-label']: string;
|
|
10
16
|
};
|
|
11
17
|
|
|
12
|
-
type Props = CommonProps &
|
|
13
|
-
(
|
|
18
|
+
type Props = CommonProps & { overrideCircleFillIcons?: boolean } & (
|
|
14
19
|
| {
|
|
15
20
|
dos?: ReactNode[];
|
|
16
21
|
donts?: ReactNode[];
|
|
@@ -21,24 +26,42 @@ type Props = CommonProps &
|
|
|
21
26
|
}
|
|
22
27
|
);
|
|
23
28
|
|
|
24
|
-
const InstructionsList = ({ dos, donts }: Props) => {
|
|
29
|
+
const InstructionsList = ({ dos, donts, overrideCircleFillIcons = false }: Props) => {
|
|
25
30
|
return (
|
|
26
31
|
<div className="tw-instructions">
|
|
27
32
|
{dos &&
|
|
28
33
|
dos.map((doThis, index) => (
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
<Instruction
|
|
35
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
36
|
+
key={index}
|
|
37
|
+
item={doThis}
|
|
38
|
+
type="do"
|
|
39
|
+
overrideCircleFillIcons={overrideCircleFillIcons}
|
|
40
|
+
/>
|
|
31
41
|
))}
|
|
32
42
|
{donts &&
|
|
33
43
|
donts.map((dont, index) => (
|
|
34
|
-
|
|
35
|
-
|
|
44
|
+
<Instruction
|
|
45
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
46
|
+
key={index}
|
|
47
|
+
item={dont}
|
|
48
|
+
type="dont"
|
|
49
|
+
overrideCircleFillIcons={overrideCircleFillIcons}
|
|
50
|
+
/>
|
|
36
51
|
))}
|
|
37
52
|
</div>
|
|
38
53
|
);
|
|
39
54
|
};
|
|
40
55
|
|
|
41
|
-
function Instruction({
|
|
56
|
+
function Instruction({
|
|
57
|
+
item,
|
|
58
|
+
type,
|
|
59
|
+
overrideCircleFillIcons,
|
|
60
|
+
}: {
|
|
61
|
+
item: ReactNode | InstructionNode;
|
|
62
|
+
type: 'do' | 'dont';
|
|
63
|
+
overrideCircleFillIcons: boolean;
|
|
64
|
+
}) {
|
|
42
65
|
const isInstructionNode =
|
|
43
66
|
typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;
|
|
44
67
|
return (
|
|
@@ -46,10 +69,16 @@ function Instruction({ item, type }: { item: ReactNode | InstructionNode; type:
|
|
|
46
69
|
className="instruction"
|
|
47
70
|
aria-label={isInstructionNode ? (item['aria-label'] as string) : undefined}
|
|
48
71
|
>
|
|
49
|
-
{
|
|
50
|
-
|
|
72
|
+
{overrideCircleFillIcons ? (
|
|
73
|
+
type === 'do' ? (
|
|
74
|
+
<DoCheckIcon size={24} className={type} />
|
|
75
|
+
) : (
|
|
76
|
+
<DontCrossIcon size={24} className={type} />
|
|
77
|
+
)
|
|
78
|
+
) : type === 'do' ? (
|
|
79
|
+
<DoCheckCircleIcon size={24} className={type} />
|
|
51
80
|
) : (
|
|
52
|
-
<
|
|
81
|
+
<DontCheckCircleIcon size={24} className={type} />
|
|
53
82
|
)}
|
|
54
83
|
<Body className="text-primary" type={Typography.BODY_LARGE}>
|
|
55
84
|
{isInstructionNode ? item.content : item}
|