@transferwise/components 0.0.0-experimental-946934e → 0.0.0-experimental-b62a45e
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/main.css +2 -3
- package/build/prompt/InlinePrompt/InlinePrompt.js +6 -6
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs +7 -7
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/styles/avatarView/AvatarView.css +1 -2
- package/build/styles/common/circle/Circle.css +1 -1
- package/build/styles/main.css +2 -3
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatarView/AvatarView.css +1 -2
- package/src/avatarView/AvatarView.less +3 -3
- package/src/common/circle/Circle.css +1 -1
- package/src/common/circle/Circle.less +1 -1
- package/src/main.css +2 -3
- package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +66 -29
- package/src/prompt/InlinePrompt/InlinePrompt.tsx +9 -6
- package/src/sentimentSurface/SentimentSurface.story.tsx +1 -19
package/build/main.css
CHANGED
|
@@ -959,7 +959,7 @@
|
|
|
959
959
|
}
|
|
960
960
|
.np-avatar-view .np-avatar-view-content {
|
|
961
961
|
color: #37517e;
|
|
962
|
-
color: var(--color-
|
|
962
|
+
color: var(--color-content-primary);
|
|
963
963
|
}
|
|
964
964
|
.np-avatar-view-interactive {
|
|
965
965
|
cursor: pointer;
|
|
@@ -971,7 +971,6 @@
|
|
|
971
971
|
}
|
|
972
972
|
.np-avatar-view-non-interactive .np-circle {
|
|
973
973
|
background-color: transparent;
|
|
974
|
-
background-color: var(--color-sentiment-background-surface, transparent);
|
|
975
974
|
}
|
|
976
975
|
.np-avatar-view-non-interactive .np-avatar-view-content .wds-flag {
|
|
977
976
|
box-shadow: none;
|
|
@@ -1944,7 +1943,7 @@
|
|
|
1944
1943
|
width: var(--circle-size);
|
|
1945
1944
|
height: var(--circle-size);
|
|
1946
1945
|
flex-shrink: 0;
|
|
1947
|
-
--circle-border-color: var(--color-
|
|
1946
|
+
--circle-border-color: var(--color-border-neutral);
|
|
1948
1947
|
--circle-border-width: 1px;
|
|
1949
1948
|
font-size: var(--circle-font-size);
|
|
1950
1949
|
font-weight: 600;
|
|
@@ -42,12 +42,6 @@ const InlinePrompt = ({
|
|
|
42
42
|
}) => {
|
|
43
43
|
const surfaceSentiment = sentiment$1 === sentiment.Sentiment.POSITIVE ? 'success' : sentiment$1;
|
|
44
44
|
const renderMedia = () => {
|
|
45
|
-
if (media && ['proposition', 'positive'].includes(sentiment$1)) {
|
|
46
|
-
return media;
|
|
47
|
-
}
|
|
48
|
-
if (sentiment$1 === 'proposition') {
|
|
49
|
-
return /*#__PURE__*/jsxRuntime.jsx(icons.GiftBox, {});
|
|
50
|
-
}
|
|
51
45
|
if (muted) {
|
|
52
46
|
return /*#__PURE__*/jsxRuntime.jsx(icons.BackslashCircle, {
|
|
53
47
|
size: 16,
|
|
@@ -61,6 +55,12 @@ const InlinePrompt = ({
|
|
|
61
55
|
className: "wds-inline-prompt-process-indicator"
|
|
62
56
|
});
|
|
63
57
|
}
|
|
58
|
+
if (sentiment$1 === 'positive' && media) {
|
|
59
|
+
return media;
|
|
60
|
+
}
|
|
61
|
+
if (sentiment$1 === 'proposition') {
|
|
62
|
+
return media || /*#__PURE__*/jsxRuntime.jsx(icons.GiftBox, {});
|
|
63
|
+
}
|
|
64
64
|
return /*#__PURE__*/jsxRuntime.jsx(StatusIcon.default, {
|
|
65
65
|
size: 16,
|
|
66
66
|
sentiment: sentiment$1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlinePrompt.js","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport SentimentSurface from '../../sentimentSurface';\n\nexport type InlinePromptProps = {\n /**\n * The sentiment determines the colour scheme\n */\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n /**\n * Replaces the icon with a spinner while waiting for the short-lived action to finish.\n * @default false\n */\n loading?: boolean;\n /**\n * While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled\n * they are associated with actually disabled component (e.g. a disabled list item or input).\n * @default false\n */\n muted?: boolean;\n /**\n * Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.\n */\n media?: React.ReactNode;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\n/**\n * Inline prompts appear alongside a specific component on the screen. They help the user stay\n * informed, fix something, or get more out of what they're doing.\n */\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n 'data-testid': dataTestId,\n ...rest\n}: InlinePromptProps) => {\n const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;\n\n const renderMedia = () => {\n if (
|
|
1
|
+
{"version":3,"file":"InlinePrompt.js","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport SentimentSurface from '../../sentimentSurface';\n\nexport type InlinePromptProps = {\n /**\n * The sentiment determines the colour scheme\n */\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n /**\n * Replaces the icon with a spinner while waiting for the short-lived action to finish.\n * @default false\n */\n loading?: boolean;\n /**\n * While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled\n * they are associated with actually disabled component (e.g. a disabled list item or input).\n * @default false\n */\n muted?: boolean;\n /**\n * Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.\n */\n media?: React.ReactNode;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\n/**\n * Inline prompts appear alongside a specific component on the screen. They help the user stay\n * informed, fix something, or get more out of what they're doing.\n */\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n 'data-testid': dataTestId,\n ...rest\n}: InlinePromptProps) => {\n const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;\n\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return (\n <ProcessIndicator\n data-testid=\"InlinePrompt_ProcessIndicator\"\n size=\"xxs\"\n className=\"wds-inline-prompt-process-indicator\"\n />\n );\n }\n\n if (sentiment === 'positive' && media) {\n return media;\n }\n\n if (sentiment === 'proposition') {\n return media || <GiftBox />;\n }\n\n return <StatusIcon size={16} sentiment={sentiment} />;\n };\n\n return (\n <SentimentSurface\n sentiment={surfaceSentiment}\n data-testid={dataTestId}\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </SentimentSurface>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","media","dataTestId","rest","surfaceSentiment","renderMedia","_jsx","BackslashCircle","size","ProcessIndicator","GiftBox","StatusIcon","_jsxs","SentimentSurface","clsx","Body"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,MAAMA,YAAY,GAAGA,CAAC;aAC3BC,WAAS,GAAGC,mBAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;AACRC,EAAAA,KAAK,GAAG,IAAI;AACZ,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAI,CACW,KAAI;EACtB,MAAMC,gBAAgB,GAAGV,WAAS,KAAKC,mBAAS,CAACC,QAAQ,GAAG,SAAS,GAAGF,WAAS;EAEjF,MAAMW,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAIR,KAAK,EAAE;MACT,oBAAOS,cAAA,CAACC,qBAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIV,OAAO,EAAE;MACX,oBACEQ,cAAA,CAACG,wBAAgB,EAAA;AACf,QAAA,aAAA,EAAY,+BAA+B;AAC3CD,QAAAA,IAAI,EAAC,KAAK;AACVT,QAAAA,SAAS,EAAC;AAAqC,OAAA,CAC/C;AAEN,IAAA;AAEA,IAAA,IAAIL,WAAS,KAAK,UAAU,IAAIO,KAAK,EAAE;AACrC,MAAA,OAAOA,KAAK;AACd,IAAA;IAEA,IAAIP,WAAS,KAAK,aAAa,EAAE;AAC/B,MAAA,OAAOO,KAAK,iBAAIK,cAAA,CAACI,aAAO,KAAG;AAC7B,IAAA;IAEA,oBAAOJ,cAAA,CAACK,kBAAU,EAAA;AAACH,MAAAA,IAAI,EAAE,EAAG;AAACd,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;EAED,oBACEkB,eAAA,CAACC,wBAAgB,EAAA;AACfnB,IAAAA,SAAS,EAAEU,gBAAiB;AAC5B,IAAA,aAAA,EAAaF,UAAW;IACxBH,SAAS,EAAEe,SAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBpB,WAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEI,IAAI;AAAAH,IAAAA,QAAA,gBAERM,cAAA,CAAA,KAAA,EAAA;AAAKP,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEK,WAAW;AAAE,KAAM,CACtE,eAAAC,cAAA,CAACS,YAAI,EAAA;AAAAf,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAkB,CAAC;AAEvB;;;;"}
|
|
@@ -17,7 +17,7 @@ import '../../common/propsValues/variant.mjs';
|
|
|
17
17
|
import '../../common/propsValues/scroll.mjs';
|
|
18
18
|
import '../../common/propsValues/markdownNodeType.mjs';
|
|
19
19
|
import '../../common/fileType.mjs';
|
|
20
|
-
import {
|
|
20
|
+
import { BackslashCircle, GiftBox } from '@transferwise/icons';
|
|
21
21
|
import { clsx } from 'clsx';
|
|
22
22
|
import 'react';
|
|
23
23
|
import 'react-intl';
|
|
@@ -40,12 +40,6 @@ const InlinePrompt = ({
|
|
|
40
40
|
}) => {
|
|
41
41
|
const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;
|
|
42
42
|
const renderMedia = () => {
|
|
43
|
-
if (media && ['proposition', 'positive'].includes(sentiment)) {
|
|
44
|
-
return media;
|
|
45
|
-
}
|
|
46
|
-
if (sentiment === 'proposition') {
|
|
47
|
-
return /*#__PURE__*/jsx(GiftBox, {});
|
|
48
|
-
}
|
|
49
43
|
if (muted) {
|
|
50
44
|
return /*#__PURE__*/jsx(BackslashCircle, {
|
|
51
45
|
size: 16,
|
|
@@ -59,6 +53,12 @@ const InlinePrompt = ({
|
|
|
59
53
|
className: "wds-inline-prompt-process-indicator"
|
|
60
54
|
});
|
|
61
55
|
}
|
|
56
|
+
if (sentiment === 'positive' && media) {
|
|
57
|
+
return media;
|
|
58
|
+
}
|
|
59
|
+
if (sentiment === 'proposition') {
|
|
60
|
+
return media || /*#__PURE__*/jsx(GiftBox, {});
|
|
61
|
+
}
|
|
62
62
|
return /*#__PURE__*/jsx(StatusIcon, {
|
|
63
63
|
size: 16,
|
|
64
64
|
sentiment: sentiment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlinePrompt.mjs","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport SentimentSurface from '../../sentimentSurface';\n\nexport type InlinePromptProps = {\n /**\n * The sentiment determines the colour scheme\n */\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n /**\n * Replaces the icon with a spinner while waiting for the short-lived action to finish.\n * @default false\n */\n loading?: boolean;\n /**\n * While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled\n * they are associated with actually disabled component (e.g. a disabled list item or input).\n * @default false\n */\n muted?: boolean;\n /**\n * Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.\n */\n media?: React.ReactNode;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\n/**\n * Inline prompts appear alongside a specific component on the screen. They help the user stay\n * informed, fix something, or get more out of what they're doing.\n */\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n 'data-testid': dataTestId,\n ...rest\n}: InlinePromptProps) => {\n const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;\n\n const renderMedia = () => {\n if (
|
|
1
|
+
{"version":3,"file":"InlinePrompt.mjs","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport SentimentSurface from '../../sentimentSurface';\n\nexport type InlinePromptProps = {\n /**\n * The sentiment determines the colour scheme\n */\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n /**\n * Replaces the icon with a spinner while waiting for the short-lived action to finish.\n * @default false\n */\n loading?: boolean;\n /**\n * While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled\n * they are associated with actually disabled component (e.g. a disabled list item or input).\n * @default false\n */\n muted?: boolean;\n /**\n * Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.\n */\n media?: React.ReactNode;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\n/**\n * Inline prompts appear alongside a specific component on the screen. They help the user stay\n * informed, fix something, or get more out of what they're doing.\n */\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n 'data-testid': dataTestId,\n ...rest\n}: InlinePromptProps) => {\n const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;\n\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return (\n <ProcessIndicator\n data-testid=\"InlinePrompt_ProcessIndicator\"\n size=\"xxs\"\n className=\"wds-inline-prompt-process-indicator\"\n />\n );\n }\n\n if (sentiment === 'positive' && media) {\n return media;\n }\n\n if (sentiment === 'proposition') {\n return media || <GiftBox />;\n }\n\n return <StatusIcon size={16} sentiment={sentiment} />;\n };\n\n return (\n <SentimentSurface\n sentiment={surfaceSentiment}\n data-testid={dataTestId}\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </SentimentSurface>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","media","dataTestId","rest","surfaceSentiment","renderMedia","_jsx","BackslashCircle","size","ProcessIndicator","GiftBox","StatusIcon","_jsxs","SentimentSurface","clsx","Body"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,MAAMA,YAAY,GAAGA,CAAC;EAC3BC,SAAS,GAAGC,SAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;AACRC,EAAAA,KAAK,GAAG,IAAI;AACZ,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAI,CACW,KAAI;EACtB,MAAMC,gBAAgB,GAAGV,SAAS,KAAKC,SAAS,CAACC,QAAQ,GAAG,SAAS,GAAGF,SAAS;EAEjF,MAAMW,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAIR,KAAK,EAAE;MACT,oBAAOS,GAAA,CAACC,eAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIV,OAAO,EAAE;MACX,oBACEQ,GAAA,CAACG,gBAAgB,EAAA;AACf,QAAA,aAAA,EAAY,+BAA+B;AAC3CD,QAAAA,IAAI,EAAC,KAAK;AACVT,QAAAA,SAAS,EAAC;AAAqC,OAAA,CAC/C;AAEN,IAAA;AAEA,IAAA,IAAIL,SAAS,KAAK,UAAU,IAAIO,KAAK,EAAE;AACrC,MAAA,OAAOA,KAAK;AACd,IAAA;IAEA,IAAIP,SAAS,KAAK,aAAa,EAAE;AAC/B,MAAA,OAAOO,KAAK,iBAAIK,GAAA,CAACI,OAAO,KAAG;AAC7B,IAAA;IAEA,oBAAOJ,GAAA,CAACK,UAAU,EAAA;AAACH,MAAAA,IAAI,EAAE,EAAG;AAACd,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;EAED,oBACEkB,IAAA,CAACC,gBAAgB,EAAA;AACfnB,IAAAA,SAAS,EAAEU,gBAAiB;AAC5B,IAAA,aAAA,EAAaF,UAAW;IACxBH,SAAS,EAAEe,IAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBpB,SAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEI,IAAI;AAAAH,IAAAA,QAAA,gBAERM,GAAA,CAAA,KAAA,EAAA;AAAKP,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEK,WAAW;AAAE,KAAM,CACtE,eAAAC,GAAA,CAACS,IAAI,EAAA;AAAAf,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAkB,CAAC;AAEvB;;;;"}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
.np-avatar-view .np-avatar-view-content {
|
|
28
28
|
color: #37517e;
|
|
29
|
-
color: var(--color-
|
|
29
|
+
color: var(--color-content-primary);
|
|
30
30
|
}
|
|
31
31
|
.np-avatar-view-interactive {
|
|
32
32
|
cursor: pointer;
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
}
|
|
39
39
|
.np-avatar-view-non-interactive .np-circle {
|
|
40
40
|
background-color: transparent;
|
|
41
|
-
background-color: var(--color-sentiment-background-surface, transparent);
|
|
42
41
|
}
|
|
43
42
|
.np-avatar-view-non-interactive .np-avatar-view-content .wds-flag {
|
|
44
43
|
box-shadow: none;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
width: var(--circle-size);
|
|
5
5
|
height: var(--circle-size);
|
|
6
6
|
flex-shrink: 0;
|
|
7
|
-
--circle-border-color: var(--color-
|
|
7
|
+
--circle-border-color: var(--color-border-neutral);
|
|
8
8
|
--circle-border-width: 1px;
|
|
9
9
|
font-size: var(--circle-font-size);
|
|
10
10
|
font-weight: 600;
|
package/build/styles/main.css
CHANGED
|
@@ -959,7 +959,7 @@
|
|
|
959
959
|
}
|
|
960
960
|
.np-avatar-view .np-avatar-view-content {
|
|
961
961
|
color: #37517e;
|
|
962
|
-
color: var(--color-
|
|
962
|
+
color: var(--color-content-primary);
|
|
963
963
|
}
|
|
964
964
|
.np-avatar-view-interactive {
|
|
965
965
|
cursor: pointer;
|
|
@@ -971,7 +971,6 @@
|
|
|
971
971
|
}
|
|
972
972
|
.np-avatar-view-non-interactive .np-circle {
|
|
973
973
|
background-color: transparent;
|
|
974
|
-
background-color: var(--color-sentiment-background-surface, transparent);
|
|
975
974
|
}
|
|
976
975
|
.np-avatar-view-non-interactive .np-avatar-view-content .wds-flag {
|
|
977
976
|
box-shadow: none;
|
|
@@ -1944,7 +1943,7 @@
|
|
|
1944
1943
|
width: var(--circle-size);
|
|
1945
1944
|
height: var(--circle-size);
|
|
1946
1945
|
flex-shrink: 0;
|
|
1947
|
-
--circle-border-color: var(--color-
|
|
1946
|
+
--circle-border-color: var(--color-border-neutral);
|
|
1948
1947
|
--circle-border-width: 1px;
|
|
1949
1948
|
font-size: var(--circle-font-size);
|
|
1950
1949
|
font-weight: 600;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlinePrompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzC,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,SAAS,CAAC,EACN,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,GACpF,aAAa,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,+FAS1B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"InlinePrompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzC,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,SAAS,CAAC,EACN,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,GACpF,aAAa,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,+FAS1B,iBAAiB,gCA+CnB,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-b62a45e",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -84,13 +84,13 @@
|
|
|
84
84
|
"storybook-addon-tag-badges": "^2.0.2",
|
|
85
85
|
"storybook-addon-test-codegen": "^2.0.1",
|
|
86
86
|
"@transferwise/less-config": "3.1.2",
|
|
87
|
-
"@transferwise/neptune-css": "0.0.0-experimental-
|
|
87
|
+
"@transferwise/neptune-css": "0.0.0-experimental-b62a45e",
|
|
88
88
|
"@wise/components-theming": "1.9.1",
|
|
89
89
|
"@wise/wds-configs": "0.0.0"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@transferwise/icons": "^3 || ^4",
|
|
93
|
-
"@transferwise/neptune-css": "0.0.0-experimental-
|
|
93
|
+
"@transferwise/neptune-css": "0.0.0-experimental-b62a45e",
|
|
94
94
|
"@wise/art": "^2.24.4",
|
|
95
95
|
"@wise/components-theming": "^1.6.2",
|
|
96
96
|
"react": ">=18",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
.np-avatar-view .np-avatar-view-content {
|
|
28
28
|
color: #37517e;
|
|
29
|
-
color: var(--color-
|
|
29
|
+
color: var(--color-content-primary);
|
|
30
30
|
}
|
|
31
31
|
.np-avatar-view-interactive {
|
|
32
32
|
cursor: pointer;
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
}
|
|
39
39
|
.np-avatar-view-non-interactive .np-circle {
|
|
40
40
|
background-color: transparent;
|
|
41
|
-
background-color: var(--color-sentiment-background-surface, transparent);
|
|
42
41
|
}
|
|
43
42
|
.np-avatar-view-non-interactive .np-avatar-view-content .wds-flag {
|
|
44
43
|
box-shadow: none;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import './Dot.less';
|
|
2
2
|
|
|
3
3
|
.np-avatar-view {
|
|
4
4
|
.np-avatar-view-content {
|
|
5
|
-
color: var(--color-
|
|
5
|
+
color: var(--color-content-primary);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
&-interactive {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
&-non-interactive {
|
|
17
17
|
.np-circle {
|
|
18
|
-
background-color:
|
|
18
|
+
background-color: transparent;
|
|
19
19
|
}
|
|
20
20
|
.np-avatar-view-content {
|
|
21
21
|
// dismiss broken shadow on Flag component (DS-6309)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
width: var(--circle-size);
|
|
5
5
|
height: var(--circle-size);
|
|
6
6
|
flex-shrink: 0;
|
|
7
|
-
--circle-border-color: var(--color-
|
|
7
|
+
--circle-border-color: var(--color-border-neutral);
|
|
8
8
|
--circle-border-width: 1px;
|
|
9
9
|
font-size: var(--circle-font-size);
|
|
10
10
|
font-weight: 600;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
height: var(--circle-size);
|
|
5
5
|
flex-shrink: 0;
|
|
6
6
|
|
|
7
|
-
--circle-border-color: var(--color-
|
|
7
|
+
--circle-border-color: var(--color-border-neutral);
|
|
8
8
|
--circle-border-width: 1px;
|
|
9
9
|
|
|
10
10
|
// circle like components have custom typography styles for for default (Inter) font
|
package/src/main.css
CHANGED
|
@@ -959,7 +959,7 @@
|
|
|
959
959
|
}
|
|
960
960
|
.np-avatar-view .np-avatar-view-content {
|
|
961
961
|
color: #37517e;
|
|
962
|
-
color: var(--color-
|
|
962
|
+
color: var(--color-content-primary);
|
|
963
963
|
}
|
|
964
964
|
.np-avatar-view-interactive {
|
|
965
965
|
cursor: pointer;
|
|
@@ -971,7 +971,6 @@
|
|
|
971
971
|
}
|
|
972
972
|
.np-avatar-view-non-interactive .np-circle {
|
|
973
973
|
background-color: transparent;
|
|
974
|
-
background-color: var(--color-sentiment-background-surface, transparent);
|
|
975
974
|
}
|
|
976
975
|
.np-avatar-view-non-interactive .np-avatar-view-content .wds-flag {
|
|
977
976
|
box-shadow: none;
|
|
@@ -1944,7 +1943,7 @@
|
|
|
1944
1943
|
width: var(--circle-size);
|
|
1945
1944
|
height: var(--circle-size);
|
|
1946
1945
|
flex-shrink: 0;
|
|
1947
|
-
--circle-border-color: var(--color-
|
|
1946
|
+
--circle-border-color: var(--color-border-neutral);
|
|
1948
1947
|
--circle-border-width: 1px;
|
|
1949
1948
|
font-size: var(--circle-font-size);
|
|
1950
1949
|
font-weight: 600;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { mockMatchMedia, render, screen } from '../../test-utils';
|
|
3
2
|
import { InlinePrompt, InlinePromptProps } from './InlinePrompt';
|
|
4
3
|
import { Sentiment } from '../../common';
|
|
5
4
|
|
|
6
5
|
mockMatchMedia();
|
|
7
6
|
|
|
7
|
+
const MEDIA = <span data-testid="custom-media">Custom Media</span>;
|
|
8
|
+
|
|
8
9
|
describe('InlinePrompt', () => {
|
|
9
10
|
const defaultProps: InlinePromptProps = {
|
|
10
11
|
children: 'Prompt message',
|
|
@@ -21,39 +22,75 @@ describe('InlinePrompt', () => {
|
|
|
21
22
|
expect(screen.getByTestId('gift-box-icon')).toBeInTheDocument();
|
|
22
23
|
});
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
);
|
|
25
|
+
[
|
|
26
|
+
{ sentiment: Sentiment.NEGATIVE as const, acceptsMedia: false, statusIconLabel: 'Error:' },
|
|
27
|
+
{ sentiment: Sentiment.WARNING as const, acceptsMedia: false, statusIconLabel: 'Warning:' },
|
|
28
|
+
{ sentiment: Sentiment.NEUTRAL as const, acceptsMedia: false, statusIconLabel: 'Information:' },
|
|
29
|
+
{ sentiment: Sentiment.POSITIVE as const, acceptsMedia: true, statusIconLabel: '' },
|
|
30
|
+
{ sentiment: 'proposition' as const, acceptsMedia: true, statusIconLabel: '' },
|
|
31
|
+
].forEach(({ sentiment, statusIconLabel, acceptsMedia }) => {
|
|
32
|
+
describe(sentiment, () => {
|
|
33
|
+
it('should apply correct styles', () => {
|
|
34
|
+
render(<InlinePrompt {...defaultProps} sentiment={sentiment} />);
|
|
34
35
|
expect(screen.getByText('Prompt message').parentElement).toHaveClass(
|
|
35
36
|
`wds-inline-prompt--${sentiment}`,
|
|
36
37
|
);
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
});
|
|
38
|
+
});
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
expect(screen.getByTestId('InlinePrompt_Muted')).toBeInTheDocument();
|
|
48
|
-
});
|
|
40
|
+
if (statusIconLabel) {
|
|
41
|
+
it('should render StatusIcon', () => {
|
|
42
|
+
render(<InlinePrompt {...defaultProps} sentiment={sentiment} />);
|
|
43
|
+
expect(screen.getByLabelText(statusIconLabel)).toBeInTheDocument();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
describe('muted state', () => {
|
|
48
|
+
it('should render icon and apply css', () => {
|
|
49
|
+
render(<InlinePrompt {...defaultProps} muted sentiment={sentiment} />);
|
|
50
|
+
expect(screen.getByText('Prompt message').parentElement).toHaveClass(
|
|
51
|
+
'wds-inline-prompt--muted',
|
|
52
|
+
);
|
|
53
|
+
expect(screen.getByTestId('InlinePrompt_Muted')).toBeInTheDocument();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should trump `media`', () => {
|
|
57
|
+
render(<InlinePrompt {...defaultProps} muted sentiment={sentiment} media={MEDIA} />);
|
|
58
|
+
expect(screen.getByTestId('InlinePrompt_Muted')).toBeInTheDocument();
|
|
59
|
+
expect(screen.queryByTestId('custom-media')).not.toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('loading state', () => {
|
|
64
|
+
it('should render icon and apply css', () => {
|
|
65
|
+
render(<InlinePrompt {...defaultProps} sentiment={sentiment} loading />);
|
|
66
|
+
expect(screen.getByText('Prompt message').parentElement).toHaveClass(
|
|
67
|
+
'wds-inline-prompt--loading',
|
|
68
|
+
);
|
|
69
|
+
expect(screen.getByTestId('InlinePrompt_ProcessIndicator')).toBeInTheDocument();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should trump `media`', () => {
|
|
73
|
+
render(<InlinePrompt {...defaultProps} sentiment={sentiment} loading media={MEDIA} />);
|
|
74
|
+
expect(screen.getByTestId('InlinePrompt_ProcessIndicator')).toBeInTheDocument();
|
|
75
|
+
expect(screen.queryByTestId('custom-media')).not.toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('custom media', () => {
|
|
80
|
+
if (acceptsMedia) {
|
|
81
|
+
it('should respect `media`', () => {
|
|
82
|
+
render(<InlinePrompt {...defaultProps} sentiment={sentiment} media={MEDIA} />);
|
|
83
|
+
expect(screen.getByTestId('custom-media')).toBeInTheDocument();
|
|
84
|
+
});
|
|
85
|
+
} else {
|
|
86
|
+
it('should ignore `media`', () => {
|
|
87
|
+
render(<InlinePrompt {...defaultProps} sentiment={sentiment} media={MEDIA} />);
|
|
88
|
+
expect(screen.getByLabelText(statusIconLabel)).toBeInTheDocument();
|
|
89
|
+
expect(screen.queryByTestId('custom-media')).not.toBeInTheDocument();
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
57
94
|
});
|
|
58
95
|
|
|
59
96
|
it('applies custom className, id, and data-testid', () => {
|
|
@@ -51,12 +51,6 @@ export const InlinePrompt = ({
|
|
|
51
51
|
const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;
|
|
52
52
|
|
|
53
53
|
const renderMedia = () => {
|
|
54
|
-
if (media && ['proposition', 'positive'].includes(sentiment)) {
|
|
55
|
-
return media;
|
|
56
|
-
}
|
|
57
|
-
if (sentiment === 'proposition') {
|
|
58
|
-
return <GiftBox />;
|
|
59
|
-
}
|
|
60
54
|
if (muted) {
|
|
61
55
|
return <BackslashCircle size={16} data-testid="InlinePrompt_Muted" />;
|
|
62
56
|
}
|
|
@@ -69,6 +63,15 @@ export const InlinePrompt = ({
|
|
|
69
63
|
/>
|
|
70
64
|
);
|
|
71
65
|
}
|
|
66
|
+
|
|
67
|
+
if (sentiment === 'positive' && media) {
|
|
68
|
+
return media;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (sentiment === 'proposition') {
|
|
72
|
+
return media || <GiftBox />;
|
|
73
|
+
}
|
|
74
|
+
|
|
72
75
|
return <StatusIcon size={16} sentiment={sentiment} />;
|
|
73
76
|
};
|
|
74
77
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import {
|
|
2
|
+
import { Defrost } from '@transferwise/icons';
|
|
3
3
|
import Body from '../body';
|
|
4
4
|
import Button from '../button';
|
|
5
5
|
import Header from '../header';
|
|
@@ -8,8 +8,6 @@ import IconButton from '../iconButton';
|
|
|
8
8
|
import StatusIcon from '../statusIcon';
|
|
9
9
|
import SentimentSurface from './SentimentSurface';
|
|
10
10
|
import type { Sentiment, Emphasis } from './SentimentSurface.types';
|
|
11
|
-
import AvatarView from '../avatarView';
|
|
12
|
-
import AvatarLayout from '../avatarLayout';
|
|
13
11
|
|
|
14
12
|
const withComponentGrid = (Story: () => JSX.Element) => (
|
|
15
13
|
<div
|
|
@@ -394,12 +392,6 @@ export const SentimentAwareComponents: Story = {
|
|
|
394
392
|
<Button v2 priority="secondary" size="sm">
|
|
395
393
|
Secondary
|
|
396
394
|
</Button>
|
|
397
|
-
<AvatarView size={32}>
|
|
398
|
-
<Bank />
|
|
399
|
-
</AvatarView>
|
|
400
|
-
<AvatarView size={32} profileName="John Doe" />
|
|
401
|
-
<AvatarView size={32} imgSrc="../avatar-rectangle-fox.webp" badge={{ status: 'warning' }} />
|
|
402
|
-
<AvatarLayout size={32} avatars={[{ asset: <Bank /> }, { profileName: 'John Doe' }]} />
|
|
403
395
|
</div>
|
|
404
396
|
);
|
|
405
397
|
|
|
@@ -411,18 +403,8 @@ export const SentimentAwareComponents: Story = {
|
|
|
411
403
|
<Header level="group" title="Success sentiment surface" />
|
|
412
404
|
<SentimentSurface sentiment="success">{inner}</SentimentSurface>
|
|
413
405
|
|
|
414
|
-
<Header level="group" title="Success Elevated sentiment surface" />
|
|
415
|
-
<SentimentSurface sentiment="success" emphasis="elevated">
|
|
416
|
-
{inner}
|
|
417
|
-
</SentimentSurface>
|
|
418
|
-
|
|
419
406
|
<Header level="group" title="Negative sentiment surface" />
|
|
420
407
|
<SentimentSurface sentiment="negative">{inner}</SentimentSurface>
|
|
421
|
-
|
|
422
|
-
<Header level="group" title="Negative Elevated sentiment surface" />
|
|
423
|
-
<SentimentSurface sentiment="negative" emphasis="elevated">
|
|
424
|
-
{inner}
|
|
425
|
-
</SentimentSurface>
|
|
426
408
|
</>
|
|
427
409
|
);
|
|
428
410
|
},
|